!function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'':'
'),I=e(n.theme?'':''),n.theme&&k?(U=' "):n.theme?(U=' "):U=k?'':'',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel&&document.documentElement.clientWidth||document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight||document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah=document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('');t&&s.append("n!==t.next.y>n&&t.next.y!==t.y&&k<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(p=!p),t=t.next;while(t!==l);t=p}l=t}if(l){a=Oh(g,h);g=$d(g,g.next);a=$d(a,a.next);ae(g,b,c,d,e,f);ae(a,b,c,d,e,f);break a}h= h.next}g=g.next}while(g!==a)}break}}}}function ak(a,b,c,d){var e=a.prev,f=a.next;if(0<=ua(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=ig(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=ua(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, f.x,f.y,d.x,d.y)&&0<=ua(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=ua(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=ua(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function bk(a,b){return a.x-b.x}function ck(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x =c.x&&c.x>=g&&d!==c.x&&Tc(e h.x)&&be(c,a)&&(h=c,m=p)}c=c.next}return h}function ig(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b| b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function dk(a){var b=a,c=a;do{if(b.x ua(a.prev,a,a.next)?0<=ua(a,b,a.next)&&0<=ua(a,a.prev,b):0>ua(a,b,a.prev)||0>ua(a,a.next,b)}function Oh(a,b){var c=new jg(a.i,a.x,a.y),d=new jg(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Mh(a,b,c,d){a=new jg(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Zd(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ= a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function jg(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Ph(a){var b=a.length;2Number.EPSILON){var l=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/l;b=b.y+d/l;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new v(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new v(f/e,d/e)}function h(a,b){for(L=a.length;0<=--L;){var c=L;var f=L-1;0>f&&(f=a.length-1);var g,h=x+2*D;for(g=0;g k;k++){var n=m[f[k]];var r=m[f[(k+1)%3]];d[0]=Math.min(n,r);d[1]=Math.max(n,r);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new A(c,3))}function hc(a,b,c,d,e,f,g,h){G.call(this);this.type="CylinderGeometry"; this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new rb(a,b,c,d,e,f,g,h));this.mergeVertices()}function rb(a,b,c,d,e,f,g,h){function l(c){var e,f=new v,l=new n,p=0,y=!0===c?a:b,x=!0===c?1:-1;var A=t;for(e=1;e<=d;e++)u.push(0,w*x,0),r.push(0,x,0),q.push(.5,.5),t++;var B=t;for(e=0;e<=d;e++){var D=e/d*h+g,F=Math.cos(D);D=Math.sin(D);l.x=y*D;l.y=w*x;l.z=y*F;u.push(l.x,l.y,l.z);r.push(0,x,0);f.x=.5*F+ .5;f.y=.5*D*x+.5;q.push(f.x,f.y);t++}for(e=0;e this.duration&&this.resetDuration()}function fk(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c;case "vector":case "vector2":case "vector3":case "vector4":return ad; case "color":return Re;case "quaternion":return ke;case "bool":case "boolean":return Qe;case "string":return Te}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function gk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=fk(a.type);if(void 0===a.times){var c=[],d=[];Z.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function kg(a,b,c){var d=this,e= !1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function aa(a){this.manager=void 0!==a?a:Th;this.crossOrigin= "anonymous";this.resourcePath=this.path=""}function Na(a){aa.call(this,a)}function lg(a){aa.call(this,a)}function mg(a){aa.call(this,a);this._parser=null}function Ue(a){aa.call(this,a);this._parser=null}function bd(a){aa.call(this,a)}function Ve(a){aa.call(this,a)}function We(a){aa.call(this,a)}function F(){this.type="Curve";this.arcLengthDivisions=200}function Ia(a,b,c,d,e,f,g,h){F.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle= e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function cd(a,b,c,d,e,f){Ia.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ng(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,l,m,k){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+k)+(h-g)/k)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function sa(a, b,c,d){F.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Uh(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function le(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function me(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Sa(a,b,c,d){F.call(this);this.type="CubicBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v; this.v3=d||new v}function gb(a,b,c,d){F.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function Da(a,b){F.call(this);this.type="LineCurve";this.v1=a||new v;this.v2=b||new v}function Ta(a,b){F.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Ua(a,b,c){F.call(this);this.type="QuadraticBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v}function hb(a,b,c){F.call(this);this.type="QuadraticBezierCurve3"; this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function Va(a){F.call(this);this.type="SplineCurve";this.points=a||[]}function sb(){F.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Wa(a){sb.call(this);this.type="Path";this.currentPoint=new v;a&&this.setFromPoints(a)}function Jb(a){Wa.call(this,a);this.uuid=O.generateUUID();this.type="Shape";this.holes=[]}function V(a,b){B.call(this);this.type="Light";this.color=new J(a);this.intensity=void 0!==b?b:1;this.receiveShadow= void 0}function Xe(a,b,c){V.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(B.DefaultUp);this.updateMatrix();this.groundColor=new J(b)}function ib(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new v(512,512);this.mapPass=this.map=null;this.matrix=new P;this._frustum=new Ed;this._frameExtents=new v(1,1);this._viewportCount=1;this._viewports=[new da(0,0,1,1)]}function Ye(){ib.call(this,new la(50,1,.5,500))}function Ze(a,b,c,d,e,f){V.call(this,a,b);this.type= "SpotLight";this.position.copy(B.DefaultUp);this.updateMatrix();this.target=new B;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Ye}function og(){ib.call(this,new la(90,1,.5,500));this._frameExtents=new v(4,2);this._viewportCount=6;this._viewports=[new da(2,1,1,1),new da(0,1,1,1),new da(3, 1,1,1),new da(1,1,1,1),new da(3,0,1,1),new da(1,0,1,1)];this._cubeDirections=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)];this._cubeUps=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)]}function $e(a,b,c,d){V.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d: 1;this.shadow=new og}function ne(a,b,c,d,e,f){bb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function af(){ib.call(this,new ne(-5,5,5,-5,.5,500))}function bf(a,b){V.call(this,a,b);this.type="DirectionalLight";this.position.copy(B.DefaultUp);this.updateMatrix();this.target=new B;this.shadow= new af}function cf(a,b){V.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function df(a,b,c,d){V.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function ef(a){aa.call(this,a);this.textures={}}function ff(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function gf(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")); N.call(this,a,b,c);this.meshPerAttribute=d||1}function hf(a){aa.call(this,a)}function jf(a){aa.call(this,a)}function pg(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");aa.call(this,a);this.options=void 0}function qg(){this.type="ShapePath";this.color=new J;this.subPaths=[];this.currentPath=null}function rg(a){this.type="Font";this.data= a}function sg(a){aa.call(this,a)}function kf(a){aa.call(this,a)}function lf(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Xa(a,b){V.call(this,void 0,b);this.sh=void 0!==a?a:new lf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new J).set(a);c=(new J).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a, b){Xa.call(this,void 0,b);a=(new J).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Vh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new la;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new la;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime= this.oldTime=this.startTime=0;this.running=!1}function wg(){B.call(this);this.type="AudioListener";this.context=xg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){B.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime= 0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize= c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Wh(a,b,c){c=c||ma.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ma(a,b,c){this.path=b;this.parsedPath=c||ma.parseTrackName(b);this.node=ma.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Xh(){this.uuid= O.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Yh(a,b,c){this._mixer=a;this._clip=b;this._localRoot= c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity; this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function mf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){ac.call(this,a,b);this.meshPerAttribute=c||1}function Zh(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{}, Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function $h(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;d c;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1, Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Y({fog:!1});this.cone=new R(a,b);this.add(this.cone);this.update()}function ci(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;c a?-1:0ve;ve++)qa[ve]=(16>ve?"0":"")+ ve.toString(16);var O={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(qa[a&255]+qa[a>>8&255]+qa[a>>16&255]+qa[a>>24&255]+"-"+qa[b&255]+qa[b>>8&255]+"-"+qa[b>>16&15|64]+qa[b>>24&255]+"-"+qa[c&63|128]+qa[c>>8&255]+"-"+qa[c>>16&255]+qa[c>>24&255]+qa[d&255]+qa[d>>8&255]+qa[d>>16&255]+qa[d>>24&255]).toUpperCase()},clamp:function(a,b,c){return Math.max(b,Math.min(c, a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a* (.5-Math.random())},degToRad:function(a){return a*O.DEG2RAD},radToDeg:function(a){return a*O.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(v.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(v.prototype, {isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors(a, b) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y= a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c|| 1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.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(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(na,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==n){f=1-g;var r=h*d+l*k+m*n+c*e,q=0<=r?1:-1,t=1-r*r;t>Number.EPSILON&&(t=Math.sqrt(t),r=Math.atan2(t,r*q),f=Math.sin(f*r)/t,g=Math.sin(g*r)/t);q*=g;h=h*f+d*q;l=l*f+k*q;m=m*f+n*q;c=c*f+e*q;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(na.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}}, y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(na.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),l=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"YXZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z= h*l*e-c*d*f,this._w=h*l*f+c*d*e):"ZXY"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"ZYX"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"YZX"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f-c*d*e):"XZY"===a&&(this._x=c*l*f-h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f+c*d*e);!1!==b&&this._onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b); this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this._onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],l=b[6];b=b[10];var m=c+f+b;0 f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(l-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+l)/ c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+l)/c,this._z=.25*c);this._onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(O.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions(a, b) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w; var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this._onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g* f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize(),this._onChangeCallback(),this;a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this._onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2]; this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Ig=new n,fi=new na;Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this}, add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors(a, b) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors(a, b) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(fi.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(fi.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]* d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-l*-e;return this}, project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a, Math.min(b,this.z));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors(a, b) instead."),this.crossVectors(a,b)):this.crossVectors(this, a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){Ig.copy(this).projectOnVector(a);return this.sub(Ig)},reflect:function(a){return this.sub(Ig.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(O.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta, a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var pc=new n;Object.assign(ta.prototype,{isMatrix3:!0,set:function(a, b,c,d,e,f,g,h,l){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this}, applyToBufferAttribute:function(a){for(var b=0,c=a.count;b c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var md,Kb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===md&&(md=document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"));md.width=a.width;md.height=a.height;var b=md.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=md}return 2048 a.x||1 a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1 a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(ba.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.defineProperties(da.prototype,{width:{get:function(){return this.z},set:function(a){this.z=a}},height:{get:function(){return this.w},set:function(a){this.w=a}}});Object.assign(da.prototype,{isVector4:!0,set:function(a,b,c,d){this.x= a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}, addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-= a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var l=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-l)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+l)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI; b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+l)/4;b>f&&b>m?.01>b?(l=0,c=h=.707106781):(l=Math.sqrt(b),h=c/l,c=d/l):f>m?.01>f?(l=.707106781,h=0,c=.707106781):(h=Math.sqrt(f),l=c/h,c=g/h):.01>m?(h=l=.707106781,c=0):(c=Math.sqrt(m),l=d/c,h=g/c);this.set(l,h,c,a);return this}a=Math.sqrt((l-g)*(l-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(l-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b, this.y));this.z=Math.max(a,Math.min(b,this.z));this.w=Math.max(a,Math.min(b,this.w));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x= Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z* a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z- this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});Ka.prototype=Object.assign(Object.create(xa.prototype),{constructor:Ka,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.texture.image.width=a,this.texture.image.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport); this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Pf.prototype=Object.assign(Object.create(Ka.prototype),{constructor:Pf,isWebGLMultisampleRenderTarget:!0,copy:function(a){Ka.prototype.copy.call(this,a);this.samples=a.samples;return this}});var Ja=new n,ja=new P,hk=new n(0,0,0),ik=new n(1,1,1),Lb=new n,rf=new n,za=new n;Object.assign(P.prototype,{isMatrix4:!0, set:function(a,b,c,d,e,f,g,h,l,m,k,n,r,q,t,y){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=l;p[6]=m;p[10]=k;p[14]=n;p[3]=r;p[7]=q;p[11]=t;p[15]=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new P).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11]; b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(a){var b=this.elements,c=a.elements,d=1/Ja.setFromMatrixColumn(a,0).length(), e=1/Ja.setFromMatrixColumn(a,1).length();a=1/Ja.setFromMatrixColumn(a,2).length();b[0]=c[0]*d;b[1]=c[1]*d;b[2]=c[2]*d;b[3]=0;b[4]=c[4]*e;b[5]=c[5]*e;b[6]=c[6]*e;b[7]=0;b[8]=c[8]*a;b[9]=c[9]*a;b[10]=c[10]*a;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d); d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,m=c*h,k=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-k*d;b[9]=-c*g;b[2]=k-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a+k*c,b[4]=m*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-m,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,m=c*h,k=c*e,b[0]=g*h, b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(hk,a,ik)},lookAt:function(a,b, c){var d=this.elements;za.subVectors(a,b);0===za.lengthSq()&&(za.z=1);za.normalize();Lb.crossVectors(c,za);0===Lb.lengthSq()&&(1===Math.abs(c.z)?za.x+=1E-4:za.z+=1E-4,za.normalize(),Lb.crossVectors(c,za));Lb.normalize();rf.crossVectors(za,Lb);d[0]=Lb.x;d[4]=rf.x;d[8]=za.x;d[1]=Lb.y;d[5]=rf.y;d[9]=za.y;d[2]=Lb.z;d[6]=rf.z;d[10]=za.z;return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices(a, b) instead."), this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],n=c[2],r=c[6],q=c[10],t=c[14],y=c[3],w=c[7],z=c[11];c=c[15];var x=d[0],v=d[4],A=d[8],E=d[12],B=d[1],D=d[5],F=d[9],G=d[13],I=d[2],H=d[6],J=d[10],K=d[14],N=d[3],O=d[7],P=d[11];d=d[15];b[0]=a*x+e*B+f*I+g*N;b[4]=a*v+e*D+f*H+g*O;b[8]=a*A+e*F+f*J+ g*P;b[12]=a*E+e*G+f*K+g*d;b[1]=h*x+l*B+m*I+k*N;b[5]=h*v+l*D+m*H+k*O;b[9]=h*A+l*F+m*J+k*P;b[13]=h*E+l*G+m*K+k*d;b[2]=n*x+r*B+q*I+t*N;b[6]=n*v+r*D+q*H+t*O;b[10]=n*A+r*F+q*J+t*P;b[14]=n*E+r*G+q*K+t*d;b[3]=y*x+w*B+z*I+c*N;b[7]=y*v+w*D+z*H+c*O;b[11]=y*A+w*F+z*J+c*P;b[15]=y*E+w*G+z*K+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(a){for(var b= 0,c=a.count;b this.determinant()&&(e=-e);a.x=d[12];a.y=d[13];a.z=d[14];ja.copy(this);a=1/e;d=1/f;var h=1/g;ja.elements[0]*=a;ja.elements[1]*=a;ja.elements[2]*=a;ja.elements[4]*=d;ja.elements[5]*=d;ja.elements[6]*=d;ja.elements[8]*=h;ja.elements[9]*=h;ja.elements[10]*=h;b.setFromRotationMatrix(ja);c.x=e;c.y=f;c.z=g;return this},makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var gi=new P,hi=new na;Qb.RotationOrders= "XYZ YZX ZXY XZY YXZ ZYX".split(" ");Qb.DefaultOrder="XYZ";Object.defineProperties(Qb.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(Qb.prototype,{isEuler:!0,set:function(a, b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=O.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],l=e[5],m=e[9],k=e[2],n=e[6];e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.9999999>Math.abs(g)? (this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,l),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.9999999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.9999999>Math.abs(n)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.9999999>Math.abs(k)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)): (this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.9999999>Math.abs(f)?(this._x=Math.atan2(n,l),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;!1!==c&&this._onChangeCallback();return this},setFromQuaternion:function(a, b,c){gi.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(gi,b,c)},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(a){hi.setFromEuler(this);return this.setFromQuaternion(hi,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a= []);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});Object.assign(Qf.prototype,{set:function(a){this.mask=1<e&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d); this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.count;h e&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b this.max.x||a.y this.max.y||a.z this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new n);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y), (a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x this.max.x||a.max.y this.max.y||a.max.z this.max.z?!1:!0},intersectsSphere:function(a){this.clampPoint(a.center,jb);return jb.distanceToSquared(a.center)<=a.radius*a.radius},intersectsPlane:function(a){if(0 =-a.constant},intersectsTriangle:function(a){if(this.isEmpty())return!1;this.getCenter(xe);tf.subVectors(this.max,xe);od.subVectors(a.a,xe);pd.subVectors(a.b,xe);qd.subVectors(a.c,xe);Mb.subVectors(pd,od);Nb.subVectors(qd,pd);qc.subVectors(od,qd);a=[0,-Mb.z,Mb.y,0,-Nb.z,Nb.y,0,-qc.z, qc.y,Mb.z,0,-Mb.x,Nb.z,0,-Nb.x,qc.z,0,-qc.x,-Mb.y,Mb.x,0,-Nb.y,Nb.x,0,-qc.y,qc.x,0];if(!Rf(a,od,pd,qd,tf))return!1;a=[1,0,0,0,1,0,0,0,1];if(!Rf(a,od,pd,qd,tf))return!1;uf.crossVectors(Mb,Nb);a=[uf.x,uf.y,uf.z];return Rf(a,od,pd,qd,tf)},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new n);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return jb.copy(a).clamp(this.min,this.max).sub(a).length()},getBoundingSphere:function(a){void 0===a&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(a.center);a.radius=.5*this.getSize(jb).length();return a},intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;wb[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);wb[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); wb[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);wb[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);wb[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);wb[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);wb[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);wb[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(wb);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& a.max.equals(this.max)}});var nk=new ab;Object.assign(nb.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a,b){var c=this.center;void 0!==b?c.copy(b):nk.setFromPoints(a).getCenter(c);for(var d=b=0,e=a.length;d = this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a); void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new n);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new ab);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this}, translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});var xb=new n,Jg=new n,vf=new n,Ob=new n,Kg=new n,wf=new n,Lg=new n;Object.assign(Sb.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){void 0===b&&(console.warn("THREE.Ray: .at() target is now required"), b=new n);return b.copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(a){this.origin.copy(this.at(a,xb));return this},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new n);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))}, distanceSqToPoint:function(a){var b=xb.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);xb.copy(this.direction).multiplyScalar(b).add(this.origin);return xb.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){Jg.copy(a).add(b).multiplyScalar(.5);vf.copy(b).sub(a).normalize();Ob.copy(this.origin).sub(Jg);var e=.5*a.distanceTo(b),f=-this.direction.dot(vf),g=Ob.dot(this.direction),h=-Ob.dot(vf),l=Ob.lengthSq(),m=Math.abs(1-f*f);if(0 =-k?b<=k?(e=1/m,a*=e,b*=e,f=a*(a+f*b+2*g)+b*(f*a+b+2*h)+l):(b=e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):(b=-e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):b<=-k?(a=Math.max(0,-(-f*e+g)),b=0a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y- f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(d a||h>c)return null;if(h>g||g!==g)g=h;if(a c?null:this.at(0<=g?g:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,xb)},intersectTriangle:function(a,b,c,d,e){Kg.subVectors(b,a);wf.subVectors(c,a);Lg.crossVectors(Kg,wf);b=this.direction.dot(Lg);if(0b)d=-1,b=-b;else return null; Ob.subVectors(this.origin,a);a=d*this.direction.dot(wf.crossVectors(Ob,wf));if(0>a)return null;c=d*this.direction.dot(Kg.cross(Ob));if(0>c||a+c>b)return null;a=-d*Ob.dot(Lg);return 0>a?null:this.at(a/b,e)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var Ya=new n,yb=new n,Mg=new n,zb=new n,rd=new n,sd=new n,mi=new n,Ng=new n,Og=new n,Pg=new n;Object.assign(ia, {getNormal:function(a,b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new n);d.subVectors(c,b);Ya.subVectors(a,b);d.cross(Ya);a=d.lengthSq();return 0=zb.x+zb.y},getUV:function(a,b,c,d,e,f,g,h){this.getBarycoord(a,b,c,d,zb);h.set(0,0);h.addScaledVector(e,zb.x);h.addScaledVector(f,zb.y);h.addScaledVector(g,zb.z);return h},isFrontFacing:function(a,b,c,d){Ya.subVectors(c,b);yb.subVectors(a,b);return 0>Ya.cross(yb).dot(d)?!0:!1}});Object.assign(ia.prototype,{set:function(a, b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){Ya.subVectors(this.c,this.b);yb.subVectors(this.a,this.b);return.5*Ya.cross(yb).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"), a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ia.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ia.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,e){return ia.getUV(a,this.a,this.b,this.c,b,c,d,e)},containsPoint:function(a){return ia.containsPoint(a, this.a,this.b,this.c)},isFrontFacing:function(a){return ia.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new n);var c=this.a,d=this.b,e=this.c;rd.subVectors(d,c);sd.subVectors(e,c);Ng.subVectors(a,c);var f=rd.dot(Ng),g=sd.dot(Ng);if(0>=f&&0>=g)return b.copy(c);Og.subVectors(a,d);var h=rd.dot(Og),l=sd.dot(Og);if(0<=h&&l<= h)return b.copy(d);var m=f*l-h*g;if(0>=m&&0<=f&&0>=h)return d=f/(f-h),b.copy(c).addScaledVector(rd,d);Pg.subVectors(a,e);a=rd.dot(Pg);var k=sd.dot(Pg);if(0<=k&&a<=k)return b.copy(e);f=a*g-f*k;if(0>=f&&0<=g&&0>=k)return m=g/(g-k),b.copy(c).addScaledVector(sd,m);g=h*k-a*l;if(0>=g&&0<=l-h&&0<=a-k)return mi.subVectors(e,d),m=(l-h)/(l-h+(a-k)),b.copy(d).addScaledVector(mi,m);e=1/(g+f+m);d=f*e;m*=e;return b.copy(c).addScaledVector(rd,d).addScaledVector(sd,m)},equals:function(a){return a.a.equals(this.a)&& a.b.equals(this.b)&&a.c.equals(this.c)}});var ok={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},Aa={h:0,s:0,l:0},xf={h:0,s:0,l:0};Object.assign(J.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a); this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){a=O.euclideanModulo(a,1);b=O.clamp(b,0,1);c=O.clamp(c,0,1);0===b?this.r=this.g=this.b=c:(b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=Sf(c,b,a+1/3),this.g=Sf(c,b,a),this.b=Sf(c,b,a-1/3));return this},setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c= /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100, parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r= parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0 =h?l/(e+f):l/(2-e-f);switch(e){case b:g=(c- d)/l+(c this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;d.stencilWrite=this.stencilWrite;d.stencilFunc= this.stencilFunc;d.stencilRef=this.stencilRef;d.stencilMask=this.stencilMask;d.stencilFail=this.stencilFail;d.stencilZFail=this.stencilZFail;d.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&&(d.linewidth=this.linewidth); void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0 g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;c \n\t#include \n}", fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main(){\n\tvec3 direction=normalize(vWorldDirection);\n\tvec2 sampleUV;\n\tsampleUV.y=asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x=atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor=texture2D(tEquirect, sampleUV);\n}",side:1,blending:0});d.uniforms.tEquirect.value=b;b=new ra(new Bb(5, 5,5),d);c.add(b);d=new Dc(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Zb.prototype=Object.create(ba.prototype);Zb.prototype.constructor=Zb;Zb.prototype.isDataTexture=!0;var Ug=new n,qk=new n,rk=new ta;Object.assign(cb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=Ug.subVectors(c,b).cross(qk.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*= -1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new n);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(a,b){void 0===b&&(console.warn("THREE.Plane: .intersectLine() target is now required"),b=new n);var c= a.delta(Ug),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else if(d=-(a.start.dot(this.normal)+this.constant)/d,!(0>d||1 b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],r=c[10],q=c[11],t=c[12],y=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,k-g,q-n,c-t).normalize();b[1].setComponents(f+a,k+g,q+n,c+t).normalize();b[2].setComponents(f+ d,k+h,q+u,c+y).normalize();b[3].setComponents(f-d,k-h,q-u,c-y).normalize();b[4].setComponents(f-e,k-l,q-r,c-w).normalize();b[5].setComponents(f+e,k+l,q+r,c+w).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)c;c++){var d=b[c];Af.x=0 d.distanceToPoint(Af))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var K={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *=texture2D(alphaMap, vUv).g;\n#endif", alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif(diffuseColor.a < ALPHATEST) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion=(texture2D(aoMap, vUv2).r - 1.0) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *=ambientOcclusion;\n\t#if defined(USE_ENVMAP)&&defined(STANDARD)\n\t\tfloat dotNV=saturate(dot(geometry.normal, geometry.viewDir));\n\t\treflectedLight.indirectSpecular *=computeSpecularOcclusion(dotNV, ambientOcclusion, material.specularRoughness);\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed=vec3(position);",beginnormal_vertex:"vec3 objectNormal=vec3(normal);\n#ifdef USE_TANGENT\n\tvec3 objectTangent=vec3(tangent.xyz);\n#endif",bsdfs:"vec2 integrateSpecularBRDF(const in float dotNV, const in float roughness){\n\tconst vec4 c0=vec4(- 1, - 0.0275, - 0.572, 0.022);\n\tconst vec4 c1=vec4(1, 0.0425, 1.04, - 0.04);\n\tvec4 r=roughness * c0 + c1;\n\tfloat a004=min(r.x * r.x, exp2(- 9.28 * dotNV)) * r.x + r.y;\n\treturn vec2(-1.04, 1.04) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor(const in float lightDistance, const in float cutoffDistance, const in float decayExponent){\n#if defined(PHYSICALLY_CORRECT_LIGHTS)\n\tfloat distanceFalloff=1.0 / max(pow(lightDistance, decayExponent), 0.01);\n\tif(cutoffDistance > 0.0){\n\t\tdistanceFalloff *=pow2(saturate(1.0 - pow4(lightDistance / cutoffDistance)));\n\t}\n\treturn distanceFalloff;\n#else\n\tif(cutoffDistance > 0.0&&decayExponent > 0.0){\n\t\treturn pow(saturate(-lightDistance / cutoffDistance + 1.0), decayExponent);\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor){\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick(const in vec3 specularColor, const in float dotLH){\n\tfloat fresnel=exp2(( -5.55473 * dotLH - 6.98316) * dotLH);\n\treturn(1.0 - specularColor) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent(const in vec3 F0, const in float dotNV, const in float roughness){\n\tfloat fresnel=exp2(( -5.55473 * dotNV - 6.98316) * dotNV);\n\tvec3 Fr=max(vec3(1.0 - roughness), F0) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV){\n\tfloat a2=pow2(alpha);\n\tfloat gl=dotNL + sqrt(a2 +(1.0 - a2) * pow2(dotNL));\n\tfloat gv=dotNV + sqrt(a2 +(1.0 - a2) * pow2(dotNV));\n\treturn 1.0 /(gl * gv);\n}\nfloat G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV){\n\tfloat a2=pow2(alpha);\n\tfloat gv=dotNL * sqrt(a2 +(1.0 - a2) * pow2(dotNV));\n\tfloat gl=dotNV * sqrt(a2 +(1.0 - a2) * pow2(dotNL));\n\treturn 0.5 / max(gv + gl, EPSILON);\n}\nfloat D_GGX(const in float alpha, const in float dotNH){\n\tfloat a2=pow2(alpha);\n\tfloat denom=pow2(dotNH) *(a2 - 1.0) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2(denom);\n}\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness){\n\tfloat alpha=pow2(roughness);\n\tvec3 halfDir=normalize(incidentLight.direction + viewDir);\n\tfloat dotNL=saturate(dot(normal, incidentLight.direction));\n\tfloat dotNV=saturate(dot(normal, viewDir));\n\tfloat dotNH=saturate(dot(normal, halfDir));\n\tfloat dotLH=saturate(dot(incidentLight.direction, halfDir));\n\tvec3 F=F_Schlick(specularColor, dotLH);\n\tfloat G=G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n\tfloat D=D_GGX(alpha, dotNH);\n\treturn F *(G * D);\n}\nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness){\n\tconst float LUT_SIZE=64.0;\n\tconst float LUT_SCALE=(LUT_SIZE - 1.0) / LUT_SIZE;\n\tconst float LUT_BIAS=0.5 / LUT_SIZE;\n\tfloat dotNV=saturate(dot(N, V));\n\tvec2 uv=vec2(roughness, sqrt(1.0 - dotNV));\n\tuv=uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor(const in vec3 f){\n\tfloat l=length(f);\n\treturn max(( l * l + f.z) /(l + 1.0), 0.0);\n}\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2){\n\tfloat x=dot(v1, v2);\n\tfloat y=abs(x);\n\tfloat a=0.8543985 +(0.4965155 + 0.0145206 * y) * y;\n\tfloat b=3.4175940 +(4.1616724 + y) * y;\n\tfloat v=a / b;\n\tfloat theta_sintheta=(x > 0.0) ? v:0.5 * inversesqrt(max(1.0 - x * x, 1e-7)) - v;\n\treturn cross(v1, v2) * theta_sintheta;\n}\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ]){\n\tvec3 v1=rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2=rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal=cross(v1, v2);\n\tif(dot(lightNormal, P - rectCoords[ 0 ]) < 0.0) return vec3(0.0);\n\tvec3 T1, T2;\n\tT1=normalize(V - N * dot(V, N));\n\tT2=- cross(N, T1);\n\tmat3 mat=mInv * transposeMat3(mat3(T1, T2, N));\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ]=mat *(rectCoords[ 0 ] - P);\n\tcoords[ 1 ]=mat *(rectCoords[ 1 ] - P);\n\tcoords[ 2 ]=mat *(rectCoords[ 2 ] - P);\n\tcoords[ 3 ]=mat *(rectCoords[ 3 ] - P);\n\tcoords[ 0 ]=normalize(coords[ 0 ]);\n\tcoords[ 1 ]=normalize(coords[ 1 ]);\n\tcoords[ 2 ]=normalize(coords[ 2 ]);\n\tcoords[ 3 ]=normalize(coords[ 3 ]);\n\tvec3 vectorFormFactor=vec3(0.0);\n\tvectorFormFactor +=LTC_EdgeVectorFormFactor(coords[ 0 ], coords[ 1 ]);\n\tvectorFormFactor +=LTC_EdgeVectorFormFactor(coords[ 1 ], coords[ 2 ]);\n\tvectorFormFactor +=LTC_EdgeVectorFormFactor(coords[ 2 ], coords[ 3 ]);\n\tvectorFormFactor +=LTC_EdgeVectorFormFactor(coords[ 3 ], coords[ 0 ]);\n\tfloat result=LTC_ClippedSphereFormFactor(vectorFormFactor);\n\treturn vec3(result);\n}\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness){\n\tfloat dotNV=saturate(dot(normal, viewDir));\n\tvec2 brdf=integrateSpecularBRDF(dotNV, roughness);\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment(const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter){\n\tfloat dotNV=saturate(dot(geometry.normal, geometry.viewDir));\n\tvec3 F=F_Schlick_RoughnessDependent(specularColor, dotNV, roughness);\n\tvec2 brdf=integrateSpecularBRDF(dotNV, roughness);\n\tvec3 FssEss=F * brdf.x + brdf.y;\n\tfloat Ess=brdf.x + brdf.y;\n\tfloat Ems=1.0 - Ess;\n\tvec3 Favg=specularColor +(1.0 - specularColor) * 0.047619;\tvec3 Fms=FssEss * Favg /(1.0 - Ems * Favg);\n\tsingleScatter +=FssEss;\n\tmultiScatter +=Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit(){\n\treturn 0.25;\n}\nfloat D_BlinnPhong(const in float shininess, const in float dotNH){\n\treturn RECIPROCAL_PI *(shininess * 0.5 + 1.0) * pow(dotNH, shininess);\n}\nvec3 BRDF_Specular_BlinnPhong(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess){\n\tvec3 halfDir=normalize(incidentLight.direction + geometry.viewDir);\n\tfloat dotNH=saturate(dot(geometry.normal, halfDir));\n\tfloat dotLH=saturate(dot(incidentLight.direction, halfDir));\n\tvec3 F=F_Schlick(specularColor, dotLH);\n\tfloat G=G_BlinnPhong_Implicit();\n\tfloat D=D_BlinnPhong(shininess, dotNH);\n\treturn F *(G * D);\n}\nfloat GGXRoughnessToBlinnExponent(const in float ggxRoughness){\n\treturn(2.0 / pow2(ggxRoughness + 0.0001) - 2.0);\n}\nfloat BlinnExponentToGGXRoughness(const in float blinnExponent){\n\treturn sqrt(2.0 /(blinnExponent + 2.0));\n}\n#if defined(USE_SHEEN)\nfloat D_Charlie(float roughness, float NoH){\n\tfloat invAlpha=1.0 / roughness;\n\tfloat cos2h=NoH * NoH;\n\tfloat sin2h=max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL){\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen(const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor){\n\tvec3 N=geometry.normal;\n\tvec3 V=geometry.viewDir;\n\tvec3 H=normalize(V + L);\n\tfloat dotNH=saturate(dot(N, H));\n\treturn specularColor * D_Charlie(roughness, dotNH) * V_Neubelt(dot(N, V), dot(N, L));\n}\n#endif", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd(){\n\t\tvec2 dSTdx=dFdx(vUv);\n\t\tvec2 dSTdy=dFdy(vUv);\n\t\tfloat Hll=bumpScale * texture2D(bumpMap, vUv).x;\n\t\tfloat dBx=bumpScale * texture2D(bumpMap, vUv + dSTdx).x - Hll;\n\t\tfloat dBy=bumpScale * texture2D(bumpMap, vUv + dSTdy).x - Hll;\n\t\treturn vec2(dBx, dBy);\n\t}\n\tvec3 perturbNormalArb(vec3 surf_pos, vec3 surf_norm, vec2 dHdxy){\n\t\tvec3 vSigmaX=vec3(dFdx(surf_pos.x), dFdx(surf_pos.y), dFdx(surf_pos.z));\n\t\tvec3 vSigmaY=vec3(dFdy(surf_pos.x), dFdy(surf_pos.y), dFdy(surf_pos.z));\n\t\tvec3 vN=surf_norm;\n\t\tvec3 R1=cross(vSigmaY, vN);\n\t\tvec3 R2=cross(vN, vSigmaX);\n\t\tfloat fDet=dot(vSigmaX, R1);\n\t\tfDet *=(float(gl_FrontFacing) * 2.0 - 1.0);\n\t\tvec3 vGrad=sign(fDet) *(dHdxy.x * R1 + dHdxy.y * R2);\n\t\treturn normalize(abs(fDet) * surf_norm - vGrad);\n\t}\n#endif", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor(int i=0; i < UNION_CLIPPING_PLANES; i ++){\n\t\tplane=clippingPlanes[ i ];\n\t\tif(dot(vViewPosition, plane.xyz) > plane.w) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped=true;\n\t\t#pragma unroll_loop\n\t\tfor(int i=UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++){\n\t\t\tplane=clippingPlanes[ i ];\n\t\t\tclipped=(dot(vViewPosition, plane.xyz) > plane.w)&&clipped;\n\t\t}\n\t\tif(clipped) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined(STANDARD)&&! defined(PHONG)&&! defined(MATCAP)\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0&&! defined(STANDARD)&&! defined(PHONG)&&! defined(MATCAP)\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0&&! defined(STANDARD)&&! defined(PHONG)&&! defined(MATCAP)\n\tvViewPosition=- mvPosition.xyz;\n#endif", color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *=vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz=color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp(a, 0.0, 1.0)\n#define whiteComplement(a)(1.0 - saturate(a))\nfloat pow2(const in float x){ return x*x; }\nfloat pow3(const in float x){ return x*x*x; }\nfloat pow4(const in float x){ float x2=x*x; return x2*x2; }\nfloat average(const in vec3 color){ return dot(color, vec3(0.3333)); }\nhighp float rand (const in vec2 uv){\n\tconst highp float a=12.9898, b=78.233, c=43758.5453;\n\thighp float dt=dot(uv.xy, vec2(a,b)), sn=mod(dt, PI);\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength(vec3 v){ return length(v); }\n#else\n\tfloat max3(vec3 v){ return max(max(v.x, v.y), v.z); }\n\tfloat precisionSafeLength(vec3 v){\n\t\tfloat maxComponent=max3(abs(v));\n\t\treturn length(v / maxComponent) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection(in vec3 dir, in mat4 matrix){\n\treturn normalize(( matrix * vec4(dir, 0.0)).xyz);\n}\nvec3 inverseTransformDirection(in vec3 dir, in mat4 matrix){\n\treturn normalize(( vec4(dir, 0.0) * matrix).xyz);\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal){\n\tfloat distance=dot(planeNormal, point - pointOnPlane);\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal){\n\treturn sign(dot(point - pointOnPlane, planeNormal));\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal){\n\treturn lineDirection *(dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nmat3 transposeMat3(const in mat3 m){\n\tmat3 tmp;\n\ttmp[ 0 ]=vec3(m[ 0 ].x, m[ 1 ].x, m[ 2 ].x);\n\ttmp[ 1 ]=vec3(m[ 0 ].y, m[ 1 ].y, m[ 2 ].y);\n\ttmp[ 2 ]=vec3(m[ 0 ].z, m[ 1 ].z, m[ 2 ].z);\n\treturn tmp;\n}\nfloat linearToRelativeLuminance(const in vec3 color){\n\tvec3 weights=vec3(0.2126, 0.7152, 0.0722);\n\treturn dot(weights, color.rgb);\n}", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction){\n\tvec3 absDirection=abs(direction);\n\tint face=-1;\n\tif(absDirection.x > absDirection.z){\n\t\tif(absDirection.x > absDirection.y)\n\t\t\tface=direction.x > 0.0 ? 0:3;\n\t\telse\n\t\t\tface=direction.y > 0.0 ? 1:4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y)\n\t\t\tface=direction.z > 0.0 ? 2:5;\n\t\telse\n\t\t\tface=direction.y > 0.0 ? 1:4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo(vec3 vec, float roughnessLevel, float roughness){\n\tfloat scale=exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness=dFdx(roughness);\n\tfloat dyRoughness=dFdy(roughness);\n\tvec3 dx=dFdx(vec * scale * dxRoughness);\n\tvec3 dy=dFdy(vec * scale * dyRoughness);\n\tfloat d=max(dot(dx, dx), dot(dy, dy));\n\td=clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel=0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel){\n\tmipLevel=roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0:mipLevel;\n\tfloat a=16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed=exp2(vec2(roughnessLevel, mipLevel));\n\tvec2 rcp_exp2_packed=vec2(1.0) / exp2_packed;\n\tfloat powScale=exp2_packed.x * exp2_packed.y;\n\tfloat scale=rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset=0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes=mipLevel==0.0;\n\tscale=bRes&&(scale < a) ? a:scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face=getFaceFromDirection(direction);\n\tfloat rcpPowScale=1.0 / powScale;\n\tif(face==0){\n\t\tr=vec3(direction.x, -direction.z, direction.y);\n\t\toffset=vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? a:offset.y;\n\t}\n\telse if(face==1){\n\t\tr=vec3(direction.y, direction.x, direction.z);\n\t\toffset=vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? a:offset.y;\n\t}\n\telse if(face==2){\n\t\tr=vec3(direction.z, direction.x, direction.y);\n\t\toffset=vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? a:offset.y;\n\t}\n\telse if(face==3){\n\t\tr=vec3(direction.x, direction.z, direction.y);\n\t\toffset=vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? 0.0:offset.y;\n\t}\n\telse if(face==4){\n\t\tr=vec3(direction.y, direction.x, -direction.z);\n\t\toffset=vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? 0.0:offset.y;\n\t}\n\telse {\n\t\tr=vec3(direction.z, -direction.x, direction.y);\n\t\toffset=vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y=bRes&&(offset.y < 2.0*a) ? 0.0:offset.y;\n\t}\n\tr=normalize(r);\n\tfloat texelOffset=0.5 * cubeUV_rcpTextureSize;\n\tvec2 s=(r.yz / abs(r.x) + vec2(1.0)) * 0.5;\n\tvec2 base=offset + vec2(texelOffset);\n\treturn base + s *(scale - 2.0 * texelOffset);\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(sampler2D envMap, vec3 reflectedDirection, float roughness){\n\tfloat roughnessVal=roughness* cubeUV_maxLods3;\n\tfloat r1=floor(roughnessVal);\n\tfloat r2=r1 + 1.0;\n\tfloat t=fract(roughnessVal);\n\tvec2 mipInfo=MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s=mipInfo.y;\n\tfloat level0=mipInfo.x;\n\tfloat level1=level0 + 1.0;\n\tlevel1=level1 > 5.0 ? 5.0:level1;\n\tlevel0 +=min(floor(s + 0.5), 5.0);\n\tvec2 uv_10=getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10=envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20=getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20=envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result=mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif", defaultnormal_vertex:"vec3 transformedNormal=normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal=- transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent=normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent=- transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed +=normalize(objectNormal) *(texture2D(displacementMap, uv).x * displacementScale + displacementBias);\n#endif", emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor=texture2D(emissiveMap, vUv);\n\temissiveColor.rgb=emissiveMapTexelToLinear(emissiveColor).rgb;\n\ttotalEmissiveRadiance *=emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor=linearToOutputTexel(gl_FragColor);",encodings_pars_fragment:"\nvec4 LinearToLinear(in vec4 value){\n\treturn value;\n}\nvec4 GammaToLinear(in vec4 value, in float gammaFactor){\n\treturn vec4(pow(value.rgb, vec3(gammaFactor)), value.a);\n}\nvec4 LinearToGamma(in vec4 value, in float gammaFactor){\n\treturn vec4(pow(value.rgb, vec3(1.0 / gammaFactor)), value.a);\n}\nvec4 sRGBToLinear(in vec4 value){\n\treturn vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.a);\n}\nvec4 LinearTosRGB(in vec4 value){\n\treturn vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.a);\n}\nvec4 RGBEToLinear(in vec4 value){\n\treturn vec4(value.rgb * exp2(value.a * 255.0 - 128.0), 1.0);\n}\nvec4 LinearToRGBE(in vec4 value){\n\tfloat maxComponent=max(max(value.r, value.g), value.b);\n\tfloat fExp=clamp(ceil(log2(maxComponent)), -128.0, 127.0);\n\treturn vec4(value.rgb / exp2(fExp),(fExp + 128.0) / 255.0);\n}\nvec4 RGBMToLinear(in vec4 value, in float maxRange){\n\treturn vec4(value.rgb * value.a * maxRange, 1.0);\n}\nvec4 LinearToRGBM(in vec4 value, in float maxRange){\n\tfloat maxRGB=max(value.r, max(value.g, value.b));\n\tfloat M=clamp(maxRGB / maxRange, 0.0, 1.0);\n\tM=ceil(M * 255.0) / 255.0;\n\treturn vec4(value.rgb /(M * maxRange), M);\n}\nvec4 RGBDToLinear(in vec4 value, in float maxRange){\n\treturn vec4(value.rgb *(( maxRange / 255.0) / value.a), 1.0);\n}\nvec4 LinearToRGBD(in vec4 value, in float maxRange){\n\tfloat maxRGB=max(value.r, max(value.g, value.b));\n\tfloat D=max(maxRange / maxRGB, 1.0);\n\tD=min(floor(D) / 255.0, 1.0);\n\treturn vec4(value.rgb *(D *(255.0 / maxRange)), D);\n}\nconst mat3 cLogLuvM=mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);\nvec4 LinearToLogLuv(in vec4 value){\n\tvec3 Xp_Y_XYZp=cLogLuvM * value.rgb;\n\tXp_Y_XYZp=max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy=Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le=2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w=fract(Le);\n\tvResult.z=(Le -(floor(vResult.w * 255.0)) / 255.0) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM=mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);\nvec4 LogLuvToLinear(in vec4 value){\n\tfloat Le=value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y=exp2(( Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z=Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x=value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB=cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4(max(vRGB, 0.0), 1.0);\n}", envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToVertex=normalize(vWorldPosition - cameraPosition);\n\t\tvec3 worldNormal=inverseTransformDirection(normal, viewMatrix);\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec=reflect(cameraToVertex, worldNormal);\n\t\t#else\n\t\t\tvec3 reflectVec=refract(cameraToVertex, worldNormal, refractionRatio);\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec=vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor=textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));\n\t#elif defined(ENVMAP_TYPE_EQUIREC)\n\t\tvec2 sampleUV;\n\t\treflectVec=normalize(reflectVec);\n\t\tsampleUV.y=asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x=atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor=texture2D(envMap, sampleUV);\n\t#elif defined(ENVMAP_TYPE_SPHERE)\n\t\treflectVec=normalize(reflectVec);\n\t\tvec3 reflectView=normalize(( viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0, 0.0, 1.0));\n\t\tvec4 envColor=texture2D(envMap, reflectView.xy * 0.5 + 0.5);\n\t#else\n\t\tvec4 envColor=vec4(0.0);\n\t#endif\n\tenvColor=envMapTexelToLinear(envColor);\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight=mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);\n\t#elif defined(ENVMAP_BLENDING_MIX)\n\t\toutgoingLight=mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);\n\t#elif defined(ENVMAP_BLENDING_ADD)\n\t\toutgoingLight +=envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif", envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif", envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined(USE_ENVMAP)\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance(const in GeometricContext geometry, const in int maxMIPLevel){\n\t\tvec3 worldNormal=inverseTransformDirection(geometry.normal, viewMatrix);\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec=vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor=textureCubeLodEXT(envMap, queryVec, float(maxMIPLevel));\n\t\t\t#else\n\t\t\t\tvec4 envMapColor=textureCube(envMap, queryVec, float(maxMIPLevel));\n\t\t\t#endif\n\t\t\tenvMapColor.rgb=envMapTexelToLinear(envMapColor).rgb;\n\t\t#elif defined(ENVMAP_TYPE_CUBE_UV)\n\t\t\tvec3 queryVec=vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n\t\t\tvec4 envMapColor=textureCubeUV(envMap, queryVec, 1.0);\n\t\t#else\n\t\t\tvec4 envMapColor=vec4(0.0);\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel(const in float roughness, const in int maxMIPLevel){\n\t\tfloat maxMIPLevelScalar=float(maxMIPLevel);\n\t\tfloat sigma=PI * roughness * roughness /(1.0 + roughness);\n\t\tfloat desiredMIPLevel=maxMIPLevelScalar + log2(sigma);\n\t\treturn clamp(desiredMIPLevel, 0.0, maxMIPLevelScalar);\n\t}\n\tvec3 getLightProbeIndirectRadiance(const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel){\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec=reflect(-viewDir, normal);\n\t\t reflectVec=normalize(mix(reflectVec, normal, roughness * roughness));\n\t\t#else\n\t\t vec3 reflectVec=refract(-viewDir, normal, refractionRatio);\n\t\t#endif\n\t\treflectVec=inverseTransformDirection(reflectVec, viewMatrix);\n\t\tfloat specularMIPLevel=getSpecularMIPLevel(roughness, maxMIPLevel);\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec=vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor=textureCubeLodEXT(envMap, queryReflectVec, specularMIPLevel);\n\t\t\t#else\n\t\t\t\tvec4 envMapColor=textureCube(envMap, queryReflectVec, specularMIPLevel);\n\t\t\t#endif\n\t\t\tenvMapColor.rgb=envMapTexelToLinear(envMapColor).rgb;\n\t\t#elif defined(ENVMAP_TYPE_CUBE_UV)\n\t\t\tvec3 queryReflectVec=vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n\t\t\tvec4 envMapColor=textureCubeUV(envMap, queryReflectVec, roughness);\n\t\t#elif defined(ENVMAP_TYPE_EQUIREC)\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\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor=texture2DLodEXT(envMap, sampleUV, specularMIPLevel);\n\t\t\t#else\n\t\t\t\tvec4 envMapColor=texture2D(envMap, sampleUV, specularMIPLevel);\n\t\t\t#endif\n\t\t\tenvMapColor.rgb=envMapTexelToLinear(envMapColor).rgb;\n\t\t#elif defined(ENVMAP_TYPE_SPHERE)\n\t\t\tvec3 reflectView=normalize(( viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0,0.0,1.0));\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor=texture2DLodEXT(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n\t\t\t#else\n\t\t\t\tvec4 envMapColor=texture2D(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n\t\t\t#endif\n\t\t\tenvMapColor.rgb=envMapTexelToLinear(envMapColor).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition=worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex=normalize(worldPosition.xyz - cameraPosition);\n\t\tvec3 worldNormal=inverseTransformDirection(transformedNormal, viewMatrix);\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect=reflect(cameraToVertex, worldNormal);\n\t\t#else\n\t\t\tvReflect=refract(cameraToVertex, worldNormal, refractionRatio);\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth=-mvPosition.z;\n#endif", fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor=1.0 - exp(- fogDensity * fogDensity * fogDepth * fogDepth);\n\t#else\n\t\tfloat fogFactor=smoothstep(fogNear, fogFar, fogDepth);\n\t#endif\n\tgl_FragColor.rgb=mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif", gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance(vec3 normal, vec3 lightDirection){\n\t\tfloat dotNL=dot(normal, lightDirection);\n\t\tvec2 coord=vec2(dotNL * 0.5 + 0.5, 0.0);\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D(gradientMap, coord).rgb;\n\t\t#else\n\t\t\treturn(coord.x < 0.7) ? vec3(0.7):vec3(1.0);\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse +=PI * texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n#endif", lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse=vec3(1.0);\nGeometricContext geometry;\ngeometry.position=mvPosition.xyz;\ngeometry.normal=normalize(transformedNormal);\ngeometry.viewDir=normalize(-mvPosition.xyz);\nGeometricContext backGeometry;\nbackGeometry.position=geometry.position;\nbackGeometry.normal=-geometry.normal;\nbackGeometry.viewDir=geometry.viewDir;\nvLightFront=vec3(0.0);\nvIndirectFront=vec3(0.0);\n#ifdef DOUBLE_SIDED\n\tvLightBack=vec3(0.0);\n\tvIndirectBack=vec3(0.0);\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_POINT_LIGHTS; i ++){\n\t\tgetPointDirectLightIrradiance(pointLights[ i ], geometry, directLight);\n\t\tdotNL=dot(geometry.normal, directLight.direction);\n\t\tdirectLightColor_Diffuse=PI * directLight.color;\n\t\tvLightFront +=saturate(dotNL) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +=saturate(-dotNL) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_SPOT_LIGHTS; i ++){\n\t\tgetSpotDirectLightIrradiance(spotLights[ i ], geometry, directLight);\n\t\tdotNL=dot(geometry.normal, directLight.direction);\n\t\tdirectLightColor_Diffuse=PI * directLight.color;\n\t\tvLightFront +=saturate(dotNL) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +=saturate(-dotNL) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_DIR_LIGHTS; i ++){\n\t\tgetDirectionalDirectLightIrradiance(directionalLights[ i ], geometry, directLight);\n\t\tdotNL=dot(geometry.normal, directLight.direction);\n\t\tdirectLightColor_Diffuse=PI * directLight.color;\n\t\tvLightFront +=saturate(dotNL) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +=saturate(-dotNL) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_HEMI_LIGHTS; i ++){\n\t\tvIndirectFront +=getHemisphereLightIrradiance(hemisphereLights[ i ], geometry);\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack +=getHemisphereLightIrradiance(hemisphereLights[ i ], backGeometry);\n\t\t#endif\n\t}\n#endif", lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt(in vec3 normal, in vec3 shCoefficients[ 9 ]){\n\tfloat x=normal.x, y=normal.y, z=normal.z;\n\tvec3 result=shCoefficients[ 0 ] * 0.886227;\n\tresult +=shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult +=shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult +=shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult +=shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult +=shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult +=shCoefficients[ 6 ] *(0.743125 * z * z - 0.247708);\n\tresult +=shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult +=shCoefficients[ 8 ] * 0.429043 *(x * x - y * y);\n\treturn result;\n}\nvec3 getLightProbeIrradiance(const in vec3 lightProbe[ 9 ], const in GeometricContext geometry){\n\tvec3 worldNormal=inverseTransformDirection(geometry.normal, viewMatrix);\n\tvec3 irradiance=shGetIrradianceAt(worldNormal, lightProbe);\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance(const in vec3 ambientLightColor){\n\tvec3 irradiance=ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *=PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance(const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight){\n\t\tdirectLight.color=directionalLight.color;\n\t\tdirectLight.direction=directionalLight.direction;\n\t\tdirectLight.visible=true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance(const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight){\n\t\tvec3 lVector=pointLight.position - geometry.position;\n\t\tdirectLight.direction=normalize(lVector);\n\t\tfloat lightDistance=length(lVector);\n\t\tdirectLight.color=pointLight.color;\n\t\tdirectLight.color *=punctualLightIntensityToIrradianceFactor(lightDistance, pointLight.distance, pointLight.decay);\n\t\tdirectLight.visible=(directLight.color!=vec3(0.0));\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance(const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight){\n\t\tvec3 lVector=spotLight.position - geometry.position;\n\t\tdirectLight.direction=normalize(lVector);\n\t\tfloat lightDistance=length(lVector);\n\t\tfloat angleCos=dot(directLight.direction, spotLight.direction);\n\t\tif(angleCos > spotLight.coneCos){\n\t\t\tfloat spotEffect=smoothstep(spotLight.coneCos, spotLight.penumbraCos, angleCos);\n\t\t\tdirectLight.color=spotLight.color;\n\t\t\tdirectLight.color *=spotEffect * punctualLightIntensityToIrradianceFactor(lightDistance, spotLight.distance, spotLight.decay);\n\t\t\tdirectLight.visible=true;\n\t\t}else{\n\t\t\tdirectLight.color=vec3(0.0);\n\t\t\tdirectLight.visible=false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight, const in GeometricContext geometry){\n\t\tfloat dotNL=dot(geometry.normal, hemiLight.direction);\n\t\tfloat hemiDiffuseWeight=0.5 * dotNL + 0.5;\n\t\tvec3 irradiance=mix(hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight);\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *=PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor=diffuseColor.rgb;\nmaterial.specularColor=specular;\nmaterial.specularShininess=shininess;\nmaterial.specularStrength=specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong(const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight){\n\t#ifdef TOON\n\t\tvec3 irradiance=getGradientIrradiance(geometry.normal, directLight.direction) * directLight.color;\n\t#else\n\t\tfloat dotNL=saturate(dot(geometry.normal, directLight.direction));\n\t\tvec3 irradiance=dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *=PI;\n\t#endif\n\treflectedLight.directDiffuse +=irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n\treflectedLight.directSpecular +=irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight){\n\treflectedLight.indirectDiffuse +=irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD(material)\t(0)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor=diffuseColor.rgb *(1.0 - metalnessFactor);\nmaterial.specularRoughness=clamp(roughnessFactor, 0.04, 1.0);\n#ifdef REFLECTIVITY\n\tmaterial.specularColor=mix(vec3(MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity)), diffuseColor.rgb, metalnessFactor);\n#else\n\tmaterial.specularColor=mix(vec3(DEFAULT_SPECULAR_COEFFICIENT), diffuseColor.rgb, metalnessFactor);\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat=saturate(clearcoat);\tmaterial.clearcoatRoughness=clamp(clearcoatRoughness, 0.04, 1.0);\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor=sheen;\n#endif", lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox(const in float roughness, const in float dotNL){\n\treturn DEFAULT_SPECULAR_COEFFICIENT +(1.0 - DEFAULT_SPECULAR_COEFFICIENT) *(pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight){\n\t\tvec3 normal=geometry.normal;\n\t\tvec3 viewDir=geometry.viewDir;\n\t\tvec3 position=geometry.position;\n\t\tvec3 lightPos=rectAreaLight.position;\n\t\tvec3 halfWidth=rectAreaLight.halfWidth;\n\t\tvec3 halfHeight=rectAreaLight.halfHeight;\n\t\tvec3 lightColor=rectAreaLight.color;\n\t\tfloat roughness=material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ]=lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ]=lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ]=lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ]=lightPos + halfWidth + halfHeight;\n\t\tvec2 uv=LTC_Uv(normal, viewDir, roughness);\n\t\tvec4 t1=texture2D(ltc_1, uv);\n\t\tvec4 t2=texture2D(ltc_2, uv);\n\t\tmat3 mInv=mat3(\n\t\t\tvec3(t1.x, 0, t1.y),\n\t\t\tvec3(0, 1, 0),\n\t\t\tvec3(t1.z, 0, t1.w)\n\t\t);\n\t\tvec3 fresnel=(material.specularColor * t2.x +(vec3(1.0) - material.specularColor) * t2.y);\n\t\treflectedLight.directSpecular +=lightColor * fresnel * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords);\n\t\treflectedLight.directDiffuse +=lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords);\n\t}\n#endif\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight){\n\tfloat dotNL=saturate(dot(geometry.normal, directLight.direction));\n\tvec3 irradiance=dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *=PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL=saturate(dot(geometry.clearcoatNormal, directLight.direction));\n\t\tvec3 ccIrradiance=ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *=PI;\n\t\t#endif\n\t\tfloat clearcoatDHR=material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\n\t\treflectedLight.directSpecular +=ccIrradiance * material.clearcoat * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n\t#else\n\t\tfloat clearcoatDHR=0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular +=(1.0 - clearcoatDHR) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular +=(1.0 - clearcoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse +=(1.0 - clearcoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight){\n\treflectedLight.indirectDiffuse +=irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Physical(const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight){\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV=saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n\t\treflectedLight.indirectSpecular +=clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment(geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n\t\tfloat ccDotNL=ccDotNV;\n\t\tfloat clearcoatDHR=material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\n\t#else\n\t\tfloat clearcoatDHR=0.0;\n\t#endif\n\tfloat clearcoatInv=1.0 - clearcoatDHR;\n\tvec3 singleScattering=vec3(0.0);\n\tvec3 multiScattering=vec3(0.0);\n\tvec3 cosineWeightedIrradiance=irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment(geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering);\n\tvec3 diffuse=material.diffuseColor *(1.0 -(singleScattering + multiScattering));\n\treflectedLight.indirectSpecular +=clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse +=multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse +=diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness){\n\treturn saturate(pow(dotNV + ambientOcclusion, exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position=- vViewPosition;\ngeometry.normal=normal;\ngeometry.viewDir=normalize(vViewPosition);\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal=clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if(NUM_POINT_LIGHTS > 0)&&defined(RE_Direct)\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_POINT_LIGHTS; i ++){\n\t\tpointLight=pointLights[ i ];\n\t\tgetPointDirectLightIrradiance(pointLight, geometry, directLight);\n\t\t#if defined(USE_SHADOWMAP)&&(UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)\n\t\tdirectLight.color *=all(bvec2(pointLight.shadow, directLight.visible)) ? getPointShadow(pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar):1.0;\n\t\t#endif\n\t\tRE_Direct(directLight, geometry, material, reflectedLight);\n\t}\n#endif\n#if(NUM_SPOT_LIGHTS > 0)&&defined(RE_Direct)\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_SPOT_LIGHTS; i ++){\n\t\tspotLight=spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance(spotLight, geometry, directLight);\n\t\t#if defined(USE_SHADOWMAP)&&(UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS)\n\t\tdirectLight.color *=all(bvec2(spotLight.shadow, directLight.visible)) ? getShadow(spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ]):1.0;\n\t\t#endif\n\t\tRE_Direct(directLight, geometry, material, reflectedLight);\n\t}\n#endif\n#if(NUM_DIR_LIGHTS > 0)&&defined(RE_Direct)\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_DIR_LIGHTS; i ++){\n\t\tdirectionalLight=directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance(directionalLight, geometry, directLight);\n\t\t#if defined(USE_SHADOWMAP)&&(UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)\n\t\tdirectLight.color *=all(bvec2(directionalLight.shadow, directLight.visible)) ? getShadow(directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ]):1.0;\n\t\t#endif\n\t\tRE_Direct(directLight, geometry, material, reflectedLight);\n\t}\n#endif\n#if(NUM_RECT_AREA_LIGHTS > 0)&&defined(RE_Direct_RectArea)\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_RECT_AREA_LIGHTS; i ++){\n\t\trectAreaLight=rectAreaLights[ i ];\n\t\tRE_Direct_RectArea(rectAreaLight, geometry, material, reflectedLight);\n\t}\n#endif\n#if defined(RE_IndirectDiffuse)\n\tvec3 iblIrradiance=vec3(0.0);\n\tvec3 irradiance=getAmbientLightIrradiance(ambientLightColor);\n\tirradiance +=getLightProbeIrradiance(lightProbe, geometry);\n\t#if(NUM_HEMI_LIGHTS > 0)\n\t\t#pragma unroll_loop\n\t\tfor(int i=0; i < NUM_HEMI_LIGHTS; i ++){\n\t\t\tirradiance +=getHemisphereLightIrradiance(hemisphereLights[ i ], geometry);\n\t\t}\n\t#endif\n#endif\n#if defined(RE_IndirectSpecular)\n\tvec3 radiance=vec3(0.0);\n\tvec3 clearcoatRadiance=vec3(0.0);\n#endif", lights_fragment_maps:"#if defined(RE_IndirectDiffuse)\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance=texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *=PI;\n\t\t#endif\n\t\tirradiance +=lightMapIrradiance;\n\t#endif\n\t#if defined(USE_ENVMAP)&&defined(STANDARD)&&defined(ENVMAP_TYPE_CUBE_UV)\n\t\tiblIrradiance +=getLightProbeIndirectIrradiance(geometry, maxMipLevel);\n\t#endif\n#endif\n#if defined(USE_ENVMAP)&&defined(RE_IndirectSpecular)\n\tradiance +=getLightProbeIndirectRadiance(geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel);\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance +=getLightProbeIndirectRadiance(geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel);\n\t#endif\n#endif", lights_fragment_end:"#if defined(RE_IndirectDiffuse)\n\tRE_IndirectDiffuse(irradiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_IndirectSpecular)\n\tRE_IndirectSpecular(radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight);\n#endif",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF)&&defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT=log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined(USE_LOGDEPTHBUF)&&defined(USE_LOGDEPTHBUF_EXT)\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif", logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth=1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z=log2(max(EPSILON, gl_Position.w + 1.0)) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *=gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor=texture2D(map, vUv);\n\ttexelColor=mapTexelToLinear(texelColor);\n\tdiffuseColor *=texelColor;\n#endif", map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv=(uvTransform * vec3(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1)).xy;\n\tvec4 mapTexel=texture2D(map, uv);\n\tdiffuseColor *=mapTexelToLinear(mapTexel);\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor=metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness=texture2D(metalnessMap, vUv);\n\tmetalnessFactor *=texelMetalness.b;\n#endif", metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal +=(morphNormal0 - normal) * morphTargetInfluences[ 0 ];\n\tobjectNormal +=(morphNormal1 - normal) * morphTargetInfluences[ 1 ];\n\tobjectNormal +=(morphNormal2 - normal) * morphTargetInfluences[ 2 ];\n\tobjectNormal +=(morphNormal3 - normal) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif", morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed +=(morphTarget0 - position) * morphTargetInfluences[ 0 ];\n\ttransformed +=(morphTarget1 - position) * morphTargetInfluences[ 1 ];\n\ttransformed +=(morphTarget2 - position) * morphTargetInfluences[ 2 ];\n\ttransformed +=(morphTarget3 - position) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed +=(morphTarget4 - position) * morphTargetInfluences[ 4 ];\n\ttransformed +=(morphTarget5 - position) * morphTargetInfluences[ 5 ];\n\ttransformed +=(morphTarget6 - position) * morphTargetInfluences[ 6 ];\n\ttransformed +=(morphTarget7 - position) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif", normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx=vec3(dFdx(vViewPosition.x), dFdx(vViewPosition.y), dFdx(vViewPosition.z));\n\tvec3 fdy=vec3(dFdy(vViewPosition.x), dFdy(vViewPosition.y), dFdy(vViewPosition.z));\n\tvec3 normal=normalize(cross(fdx, fdy));\n#else\n\tvec3 normal=normalize(vNormal);\n\t#ifdef DOUBLE_SIDED\n\t\tnormal=normal *(float(gl_FrontFacing) * 2.0 - 1.0);\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent=normalize(vTangent);\n\t\tvec3 bitangent=normalize(vBitangent);\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent=tangent *(float(gl_FrontFacing) * 2.0 - 1.0);\n\t\t\tbitangent=bitangent *(float(gl_FrontFacing) * 2.0 - 1.0);\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal=normal;", normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal=texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal=- normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal=normal *(float(gl_FrontFacing) * 2.0 - 1.0);\n\t#endif\n\tnormal=normalize(normalMatrix * normal);\n#elif defined(TANGENTSPACE_NORMALMAP)\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN=mat3(tangent, bitangent, normal);\n\t\tvec3 mapN=texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n\t\tmapN.xy=normalScale * mapN.xy;\n\t\tnormal=normalize(vTBN * mapN);\n\t#else\n\t\tnormal=perturbNormal2Arb(-vViewPosition, normal, normalScale, normalMap);\n\t#endif\n#elif defined(USE_BUMPMAP)\n\tnormal=perturbNormalArb(-vViewPosition, normal, dHdxy_fwd());\n#endif", normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined(USE_TANGENT)&&(defined(TANGENTSPACE_NORMALMAP)||defined(USE_CLEARCOAT_NORMALMAP))\n\tvec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap){\n\t\tvec3 q0=vec3(dFdx(eye_pos.x), dFdx(eye_pos.y), dFdx(eye_pos.z));\n\t\tvec3 q1=vec3(dFdy(eye_pos.x), dFdy(eye_pos.y), dFdy(eye_pos.z));\n\t\tvec2 st0=dFdx(vUv.st);\n\t\tvec2 st1=dFdy(vUv.st);\n\t\tfloat scale=sign(st1.t * st0.s - st0.t * st1.s);\n\t\tvec3 S=normalize(( q0 * st1.t - q1 * st0.t) * scale);\n\t\tvec3 T=normalize(( - q0 * st1.s + q1 * st0.s) * scale);\n\t\tvec3 N=normalize(surf_norm);\n\t\tvec3 mapN=texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n\t\tmapN.xy *=normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvec3 NfromST=cross(S, T);\n\t\t\tif(dot(NfromST, N) > 0.0){\n\t\t\t\tS *=-1.0;\n\t\t\t\tT *=-1.0;\n\t\t\t}\n\t\t#else\n\t\t\tmapN.xy *=(float(gl_FrontFacing) * 2.0 - 1.0);\n\t\t#endif\n\t\tmat3 tsn=mat3(S, T, N);\n\t\treturn normalize(tsn * mapN);\n\t}\n#endif", clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal=geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN=mat3(tangent, bitangent, clearcoatNormal);\n\t\tvec3 mapN=texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n\t\tmapN.xy=clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal=normalize(vTBN * mapN);\n\t#else\n\t\tclearcoatNormal=perturbNormal2Arb(- vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap);\n\t#endif\n#endif", clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB(const in vec3 normal){\n\treturn normalize(normal) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal(const in vec3 rgb){\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale=256. / 255.;const float UnpackDownscale=255. / 256.;\nconst vec3 PackFactors=vec3(256. * 256. * 256., 256. * 256., 256.);\nconst vec4 UnpackFactors=UnpackDownscale / vec4(PackFactors, 1.);\nconst float ShiftRight8=1. / 256.;\nvec4 packDepthToRGBA(const in float v){\n\tvec4 r=vec4(fract(v * PackFactors), v);\n\tr.yzw -=r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v){\n\treturn dot(v, UnpackFactors);\n}\nvec4 encodeHalfRGBA(vec2 v){\n\tvec4 encoded=vec4(0.0);\n\tconst vec2 offset=vec2(1.0 / 255.0, 0.0);\n\tencoded.xy=vec2(v.x, fract(v.x * 255.0));\n\tencoded.xy=encoded.xy -(encoded.yy * offset);\n\tencoded.zw=vec2(v.y, fract(v.y * 255.0));\n\tencoded.zw=encoded.zw -(encoded.ww * offset);\n\treturn encoded;\n}\nvec2 decodeHalfRGBA(vec4 v){\n\treturn vec2(v.x +(v.y / 255.0), v.z +(v.w / 255.0));\n}\nfloat viewZToOrthographicDepth(const in float viewZ, const in float near, const in float far){\n\treturn(viewZ + near) /(near - far);\n}\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far){\n\treturn linearClipZ *(near - far) - near;\n}\nfloat viewZToPerspectiveDepth(const in float viewZ, const in float near, const in float far){\n\treturn ((near + viewZ) * far) / ((far - near) * viewZ);\n}\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far){\n\treturn(near * far) /(( far - near) * invClipZ - far);\n}", premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *=gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition=modelViewMatrix * vec4(transformed, 1.0);\ngl_Position=projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb=dithering(gl_FragColor.rgb);\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering(vec3 color){\n\t\tfloat grid_position=rand (gl_FragCoord.xy);\n\t\tvec3 dither_shift_RGB=vec3(0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0);\n\t\tdither_shift_RGB=mix(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position);\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif", roughnessmap_fragment:"float roughnessFactor=roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness=texture2D(roughnessMap, vUv);\n\troughnessFactor *=texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare(sampler2D depths, vec2 uv, float compare){\n\t\treturn step(compare, unpackRGBAToDepth(texture2D(depths, uv)));\n\t}\n\tvec2 texture2DDistribution(sampler2D shadow, vec2 uv){\n\t\treturn decodeHalfRGBA(texture2D(shadow, uv));\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare){\n\t\tfloat occlusion=1.0;\n\t\tvec2 distribution=texture2DDistribution(shadow, uv);\n\t\tfloat hard_shadow=step(compare , distribution.x);\n\t\tif(hard_shadow!=1.0){\n\t\t\tfloat distance=compare - distribution.x ;\n\t\t\tfloat variance=max(0.00000, distribution.y * distribution.y);\n\t\t\tfloat softness_probability=variance / (variance + distance * distance);\t\t\tsoftness_probability=clamp(( softness_probability - 0.3) /(0.95 - 0.3), 0.0, 1.0);\t\t\tocclusion=clamp(max(hard_shadow, softness_probability), 0.0, 1.0);\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare){\n\t\tconst vec2 offset=vec2(0.0, 1.0);\n\t\tvec2 texelSize=vec2(1.0) / size;\n\t\tvec2 centroidUV=(floor(uv * size - 0.5) + 0.5) * texelSize;\n\t\tfloat lb=texture2DCompare(depths, centroidUV + texelSize * offset.xx, compare);\n\t\tfloat lt=texture2DCompare(depths, centroidUV + texelSize * offset.xy, compare);\n\t\tfloat rb=texture2DCompare(depths, centroidUV + texelSize * offset.yx, compare);\n\t\tfloat rt=texture2DCompare(depths, centroidUV + texelSize * offset.yy, compare);\n\t\tvec2 f=fract(uv * size + 0.5);\n\t\tfloat a=mix(lb, lt, f.y);\n\t\tfloat b=mix(rb, rt, f.y);\n\t\tfloat c=mix(a, b, f.x);\n\t\treturn c;\n\t}\n\tfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord){\n\t\tfloat shadow=1.0;\n\t\tshadowCoord.xyz /=shadowCoord.w;\n\t\tshadowCoord.z +=shadowBias;\n\t\tbvec4 inFrustumVec=bvec4(shadowCoord.x >=0.0, shadowCoord.x <=1.0, shadowCoord.y >=0.0, shadowCoord.y <=1.0);\n\t\tbool inFrustum=all(inFrustumVec);\n\t\tbvec2 frustumTestVec=bvec2(inFrustum, shadowCoord.z <=1.0);\n\t\tbool frustumTest=all(frustumTestVec);\n\t\tif(frustumTest){\n\t\t#if defined(SHADOWMAP_TYPE_PCF)\n\t\t\tvec2 texelSize=vec2(1.0) / shadowMapSize;\n\t\t\tfloat dx0=- texelSize.x * shadowRadius;\n\t\t\tfloat dy0=- texelSize.y * shadowRadius;\n\t\t\tfloat dx1=+ texelSize.x * shadowRadius;\n\t\t\tfloat dy1=+ texelSize.y * shadowRadius;\n\t\t\tfloat dx2=dx0 / 2.0;\n\t\t\tfloat dy2=dy0 / 2.0;\n\t\t\tfloat dx3=dx1 / 2.0;\n\t\t\tfloat dy3=dy1 / 2.0;\n\t\t\tshadow=(\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx2, dy2), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy2), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx3, dy2), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx2, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx3, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx2, dy3), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy3), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx3, dy3), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n\t\t\t\ttexture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n\t\t\t) *(1.0 / 17.0);\n\t\t#elif defined(SHADOWMAP_TYPE_PCF_SOFT)\n\t\t\tvec2 texelSize=vec2(1.0) / shadowMapSize;\n\t\t\tfloat 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\tshadow=(\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n\t\t\t\ttexture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n\t\t\t) *(1.0 / 9.0);\n\t\t#elif defined(SHADOWMAP_TYPE_VSM)\n\t\t\tshadow=VSMShadow(shadowMap, shadowCoord.xy, shadowCoord.z);\n\t\t#else\n\t\t\tshadow=texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV(vec3 v, float texelSizeY){\n\t\tvec3 absV=abs(v);\n\t\tfloat scaleToCube=1.0 / max(absV.x, max(absV.y, absV.z));\n\t\tabsV *=scaleToCube;\n\t\tv *=scaleToCube *(1.0 - 2.0 * texelSizeY);\n\t\tvec2 planar=v.xy;\n\t\tfloat almostATexel=1.5 * texelSizeY;\n\t\tfloat almostOne=1.0 - almostATexel;\n\t\tif(absV.z >=almostOne){\n\t\t\tif(v.z > 0.0)\n\t\t\t\tplanar.x=4.0 - v.x;\n\t\t}else if(absV.x >=almostOne){\n\t\t\tfloat signX=sign(v.x);\n\t\t\tplanar.x=v.z * signX + 2.0 * signX;\n\t\t}else if(absV.y >=almostOne){\n\t\t\tfloat signY=sign(v.y);\n\t\t\tplanar.x=v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y=v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2(0.125, 0.25) * planar + vec2(0.375, 0.75);\n\t}\n\tfloat getPointShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar){\n\t\tvec2 texelSize=vec2(1.0) /(shadowMapSize * vec2(4.0, 2.0));\n\t\tvec3 lightToPosition=shadowCoord.xyz;\n\t\tfloat dp=(length(lightToPosition) - shadowCameraNear) /(shadowCameraFar - shadowCameraNear);\t\tdp +=shadowBias;\n\t\tvec3 bd3D=normalize(lightToPosition);\n\t\t#if defined(SHADOWMAP_TYPE_PCF)||defined(SHADOWMAP_TYPE_PCF_SOFT)||defined(SHADOWMAP_TYPE_VSM)\n\t\t\tvec2 offset=vec2(- 1, 1) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyy, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyy, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyx, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyx, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxy, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxy, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxx, texelSize.y), dp) +\n\t\t\t\ttexture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxx, texelSize.y), dp)\n\t\t\t) *(1.0 / 9.0);\n\t\t#else\n\t\t\treturn texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp);\n\t\t#endif\n\t}\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif", shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_DIR_LIGHT_SHADOWS; i ++){\n\t\tvDirectionalShadowCoord[ i ]=directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_SPOT_LIGHT_SHADOWS; i ++){\n\t\tvSpotShadowCoord[ i ]=spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_POINT_LIGHT_SHADOWS; i ++){\n\t\tvPointShadowCoord[ i ]=pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif", shadowmask_pars_fragment:"float getShadowMask(){\n\tfloat shadow=1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_DIR_LIGHT_SHADOWS; i ++){\n\t\tdirectionalLight=directionalLights[ i ];\n\t\tshadow *=bool(directionalLight.shadow) ? getShadow(directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ]):1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_SPOT_LIGHT_SHADOWS; i ++){\n\t\tspotLight=spotLights[ i ];\n\t\tshadow *=bool(spotLight.shadow) ? getShadow(spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ]):1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor(int i=0; i < NUM_POINT_LIGHT_SHADOWS; i ++){\n\t\tpointLight=pointLights[ i ];\n\t\tshadow *=bool(pointLight.shadow) ? getPointShadow(pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar):1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX=getBoneMatrix(skinIndex.x);\n\tmat4 boneMatY=getBoneMatrix(skinIndex.y);\n\tmat4 boneMatZ=getBoneMatrix(skinIndex.z);\n\tmat4 boneMatW=getBoneMatrix(skinIndex.w);\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix(const in float i){\n\t\t\tfloat j=i * 4.0;\n\t\t\tfloat x=mod(j, float(boneTextureSize));\n\t\t\tfloat y=floor(j / float(boneTextureSize));\n\t\t\tfloat dx=1.0 / float(boneTextureSize);\n\t\t\tfloat dy=1.0 / float(boneTextureSize);\n\t\t\ty=dy *(y + 0.5);\n\t\t\tvec4 v1=texture2D(boneTexture, vec2(dx *(x + 0.5), y));\n\t\t\tvec4 v2=texture2D(boneTexture, vec2(dx *(x + 1.5), y));\n\t\t\tvec4 v3=texture2D(boneTexture, vec2(dx *(x + 2.5), y));\n\t\t\tvec4 v4=texture2D(boneTexture, vec2(dx *(x + 3.5), y));\n\t\t\tmat4 bone=mat4(v1, v2, v3, v4);\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix(const in float i){\n\t\t\tmat4 bone=boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex=bindMatrix * vec4(transformed, 1.0);\n\tvec4 skinned=vec4(0.0);\n\tskinned +=boneMatX * skinVertex * skinWeight.x;\n\tskinned +=boneMatY * skinVertex * skinWeight.y;\n\tskinned +=boneMatZ * skinVertex * skinWeight.z;\n\tskinned +=boneMatW * skinVertex * skinWeight.w;\n\ttransformed=(bindMatrixInverse * skinned).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix=mat4(0.0);\n\tskinMatrix +=skinWeight.x * boneMatX;\n\tskinMatrix +=skinWeight.y * boneMatY;\n\tskinMatrix +=skinWeight.z * boneMatZ;\n\tskinMatrix +=skinWeight.w * boneMatW;\n\tskinMatrix=bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal=vec4(skinMatrix * vec4(objectNormal, 0.0)).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent=vec4(skinMatrix * vec4(objectTangent, 0.0)).xyz;\n\t#endif\n#endif", specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular=texture2D(specularMap, vUv);\n\tspecularStrength=texelSpecular.r;\n#else\n\tspecularStrength=1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined(TONE_MAPPING)\n\tgl_FragColor.rgb=toneMapping(gl_FragColor.rgb);\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp(a, 0.0, 1.0)\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping(vec3 color){\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping(vec3 color){\n\tcolor *=toneMappingExposure;\n\treturn saturate(color /(vec3(1.0) + color));\n}\n#define Uncharted2Helper(x) max(((x *(0.15 * x + 0.10 * 0.50) + 0.20 * 0.02) /(x *(0.15 * x + 0.50) + 0.20 * 0.30)) - 0.02 / 0.30, vec3(0.0))\nvec3 Uncharted2ToneMapping(vec3 color){\n\tcolor *=toneMappingExposure;\n\treturn saturate(Uncharted2Helper(color) / Uncharted2Helper(vec3(toneMappingWhitePoint)));\n}\nvec3 OptimizedCineonToneMapping(vec3 color){\n\tcolor *=toneMappingExposure;\n\tcolor=max(vec3(0.0), color - 0.004);\n\treturn pow(( color *(6.2 * color + 0.5)) /(color *(6.2 * color + 1.7) + 0.06), vec3(2.2));\n}\nvec3 ACESFilmicToneMapping(vec3 color){\n\tcolor *=toneMappingExposure;\n\treturn saturate(( color *(2.51 * color + 0.03)) /(color *(2.43 * color + 0.59) + 0.14));\n}", uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv=(uvTransform * vec3(uv, 1)).xy;\n#endif",uv2_pars_fragment:"#if defined(USE_LIGHTMAP)||defined(USE_AOMAP)\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined(USE_LIGHTMAP)||defined(USE_AOMAP)\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined(USE_LIGHTMAP)||defined(USE_AOMAP)\n\tvUv2=uv2;\n#endif", worldpos_vertex:"#if defined(USE_ENVMAP)||defined(DISTANCE)||defined(USE_SHADOWMAP)\n\tvec4 worldPosition=modelMatrix * vec4(transformed, 1.0);\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main(){\n\tvec4 texColor=texture2D(t2D, vUv);\n\tgl_FragColor=mapTexelToLinear(texColor);\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main(){\n\tvUv=(uvTransform * vec3(uv, 1)).xy;\n\tgl_Position=vec4(position.xy, 1.0, 1.0);\n}", cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main(){\n\tvec4 texColor=textureCube(tCube, vec3(tFlip * vWorldDirection.x, vWorldDirection.yz));\n\tgl_FragColor=mapTexelToLinear(texColor);\n\tgl_FragColor.a *=opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main(){\n\tvWorldDirection=transformDirection(position, modelMatrix);\n\t#include \n\t#include \n\tgl_Position.z=gl_Position.w;\n}", depth_frag:"#if DEPTH_PACKING==3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main(){\n\t#include \n\tvec4 diffuseColor=vec4(1.0);\n\t#if DEPTH_PACKING==3200\n\t\tdiffuseColor.a=opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING==3200\n\t\tgl_FragColor=vec4(vec3(1.0 - gl_FragCoord.z), opacity);\n\t#elif DEPTH_PACKING==3201\n\t\tgl_FragColor=packDepthToRGBA(gl_FragCoord.z);\n\t#endif\n}", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main(){\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main (){\n\t#include \n\tvec4 diffuseColor=vec4(1.0);\n\t#include \n\t#include \n\t#include \n\tfloat dist=length(vWorldPosition - referencePosition);\n\tdist=(dist - nearDistance) /(farDistance - nearDistance);\n\tdist=saturate(dist);\n\tgl_FragColor=packDepthToRGBA(dist);\n}", distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main(){\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition=worldPosition.xyz;\n}", equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main(){\n\tvec3 direction=normalize(vWorldDirection);\n\tvec2 sampleUV;\n\tsampleUV.y=asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x=atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor=texture2D(tEquirect, sampleUV);\n\tgl_FragColor=mapTexelToLinear(texColor);\n\t#include \n\t#include \n}", equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main(){\n\tvWorldDirection=transformDirection(position, modelMatrix);\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main(){\n\t#include \n\tif(mod(vLineDistance, totalSize) > dashSize){\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight=vec3(0.0);\n\tvec4 diffuseColor=vec4(diffuse, opacity);\n\t#include \n\t#include \n\toutgoingLight=diffuseColor.rgb;\n\tgl_FragColor=vec4(outgoingLight, diffuseColor.a);\n\t#include \n\t#include \n\t#include \n\t#include \n}", linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include