PageSourceSearch

https://covid19-globe.web.app/static/js/main.82f5ad8c.chunk.js

js covid19-globe.web.app collected 2026-10-03 12:20:24 UTC 419,131 bytes, 2 lines download raw bytes

1(this["webpackJsonpcovid19-globe"]=this["webpackJsonpcovid19-globe"]||[]).push([[0],{100:function(e,t,i){},101:function(e,t,i){e.exports=i.p+"static/media/logo2.fe7ad0d3.svg"},102:function(e,t,i){},103:function(e,t,i){"use strict";i.r(t);var r=i(0),n=i.n(r),o=i(9),a=i.n(o),s=(i(70),i(34)),h=i(10),l=i(48),c=i.n(l),u=i(128),p=i(11),f=i(126),d=i(49),m=i.n(d),g=i(90),v=function(e,t,i){i?new g.Tween(e).to({time:t},400).easing(g.Easing.Cubic.EaseOut).start():new g.Tween(e).to({time:t},0).start()},y=(i(91),Object(p.a)((function(){return{tooltip:{backgroundColor:"#363636",color:"white",fontSize:13}}}))(f.a)),x=function(e){var t=e.children,i=e.open,r=e.value;return n.a.createElement(y,{className:"tooltip",open:i,enterTouchDelay:0,placement:"top",title:r},t)};function _(e){var t=e.updateTime,i=e.data,o=e.time,a=Object(r.useState)([]),s=Object(h.a)(a,2),l=s[0],c=s[1];Object(r.useEffect)((function(){if(i){var e=function(e){var t,i,r="1",n=[],o=1,a=1,s=e.length/30.5;s>24?o=12:s>12?o=4:s>9?o=3:s>6&&(o=2);for(var h=0;h<e.length;++h){var l=e[h][0].split("/"),c=l[0];c!==r&&(r=c,console.log(o,a,s),a===o?(n.push({value:h,label:(t=c,i=l[2],["","20".concat(i.slice(0,2)),"FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"][parseInt(t)])}),a=1):(n.push({value:h,label:""}),a++))}return n}(i);c(e)}}),[i]);var p=function(e){if(i)return function(e){e=e.substring(0,e.length-1);var t=new Date(e),i=new Intl.DateTimeFormat("en",{month:"short",day:"2-digit",year:"numeric"}).formatToParts(t),r=Object(h.a)(i,5),n=r[0].value,o=r[2].value,a=r[4].value;return"".concat(n.toUpperCase()," ").concat(o,", ").concat(a)}(i[e][0])};return n.a.createElement("div",{className:"slidebar"},n.a.createElement(u.a,{className:"slider",value:o,min:0,max:i&&i.length-1,step:1,getAriaValueText:p,valueLabelFormat:p,onChange:function(e,i){t(i)},"aria-labelledby":"continuous-slider",valueLabelDisplay:"auto",marks:l,ValueLabelComponent:x,"aria-label":"custom thumb label",track:!1}))}var w=i(124),b=i(123),M=i(127),S=(i(96),[{value:"log",name:"LOG"},{value:"linear",name:"LINEAR"}]),T=[{value:!0,name:"ON"},{value:!1,name:"OFF"}],C=function(e){var t=e.label,i=e.value,r=e.toggleButtons,o=e.onChange;return n.a.createElement("div",{className:"settings__row"},n.a.createElement("span",{className:"settings__label"},t),n.a.createElement(M.a,{value:i,exclusive:!0,onChange:o},r.map((function(e){return n.a.createElement(b.a,{value:e.value},e.name)}))))};function A(e){var t=e.toggleLinLog,i=e.scale,r=e.setOpen,o=e.toggleRot,a=e.isRotating;return n.a.createElement(w.a,{onClickAway:function(){r(!1)}},n.a.createElement("div",{className:"settings"},n.a.createElement(C,{label:"SCALE:",value:i,toggleButtons:S,onChange:t}),n.a.createElement(C,{label:"AUTO-ROTATE:",value:a,toggleButtons:T,onChange:o})))}var E=i(54),L=i.n(E),P=i(52),D=i.n(P),R=i(53),F=i.n(R),V=i(125);i(97);function U(e){var t=e.data,i=e.globe,o=Object(r.useState)("log"),a=Object(h.a)(o,2),s=a[0],l=a[1],c=Object(r.useState)(!1),u=Object(h.a)(c,2),p=u[0],d=u[1],m=Object(r.useState)(!0),g=Object(h.a)(m,2),y=g[0],x=g[1],w=Object(r.useState)(Number.MAX_VALUE),b=Object(h.a)(w,2),M=b[0],S=b[1],T=Object(r.useState)(!1),C=Object(h.a)(T,2),E=C[0],P=C[1];Object(r.useEffect)((function(){var e;return E&&(e=setInterval(U,150)),function(){return clearInterval(e)}}),[E]),Object(r.useEffect)((function(){t&&S(t.length-1)}),[t]),Object(r.useEffect)((function(){if(i){var e=R(M,s),t=i.time<.5^e>.5;v(i,e,t)}}),[M,s]);var R=function(e,i){var r=e/(t.length-1);return"linear"===i?Math.min(r/2,.49):Math.max(r/2+.5,.51)},U=function(){S((function(e){return e===t.length-1?(P(!1),e):e+1}))};return n.a.createElement("div",{className:"control"},n.a.createElement(V.a,{className:"control__button",onClick:function(){M>=t.length-1?(S(0),P(!0)):P(!E)}},E?n.a.createElement(F.a,{className:"control__icon"}):n.a.createElement(D.a,{className:"control__icon"})),n.a.createElement(_,{updateTime:function(e){S(e)},data:t,time:M}),n.a.createElement(f.a,{title:n.a.createElement(A,{scale:s,toggleLinLog:function(e,t){null!==t&&l(t)},setOpen:d,toggleRot:function(e,t){null!==t&&(x(t),i.setRot(t))},isRotating:y}),interactive:!0,open:p,onClick:function(){p||(d(!0),P(!1))}},n.a.createElement(V.a,{className:"control__button"},n.a.createElement(L.a,{className:"control__icon"}))))}var z=i(55),N=i.n(z),O=i(56),B=i.n(O),I=(i(99),"https://github.com/just-ma/covid19-globe"),k=function(e){var t=e.link,i=e.name;return n.a.createElement("a",{href:t,target:"_blank",className:"infoLink"},i)},G=function(e){var t=e.onClickAway;return n.a.createElement(w.a,{onClickAway:t},n.a.createElement("div",{className:"info"},n.a.createElement("p",null,"COVID-19 Globe is a 3D visualizer for coronavirus cases around the world."),n.a.createElement("p",null,n.a.createElement(N.a,{className:"info__icon",onClick:function(){return window.open(I,"_blank")}}),n.a.createElement(k,{link:I,name:"GitHub Repo"})),n.a.createElement("p",null,"Data from ",n.a.createElement(k,{link:"https://github.com/CSSEGISandData/COVID-19/blob/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv",name:"JHU CSSE"})),n.a.createElement("p",null,"Powered by ",n.a.createElement(k,{link:"https://experiments.withgoogle.com/chrome/globe",name:"WebGL Globe"})," and ",n.a.createElement(k,{link:"https://material-ui.com/",name:"Material UI"}))))};function H(){var e=Object(r.useState)(!1),t=Object(h.a)(e,2),i=t[0],o=t[1];return n.a.createElement(f.a,{title:n.a.createElement(G,{onClickAway:function(){o(!1)}}),placement:"right",open:i,interactive:!0},n.a.createElement(V.a,{onClick:function(){i||o(!0)}},n.a.createElement(B.a,{className:"main__corner__icon"})))}i(100);var W=i(101);function j(){return n.a.createElement("div",{className:"loading"},n.a.createElement("div",{className:"loading__container"},n.a.createElement("img",{src:W})),n.a.createElement("div",{className:"loading__circle -first"}),n.a.createElement("div",{className:"loading__circle -second"}))}i(102);function X(){var e=Object(r.useState)(null),t=Object(h.a)(e,2),i=t[0],o=t[1],a=Object(r.useState)(null),l=Object(h.a)(a,2),u=l[0],p=l[1],f=Object(r.useState)(null),d=Object(h.a)(f,2),y=d[0],x=d[1],_=Object(r.useRef)(null);return Object(r.useEffect)((function(){c.a.get("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv").then((function(e){var t=function(e){var t=e.split("\n"),i=t.shift().split(","),r=i.length,n=[],o=[],a=0;t.forEach((function(e){for(var t=e.split(","),i=4;i<t.length;i++)a=Math.max(parseInt(t[i]),a)}));for(var s=Math.log(a/5e3),h=function(e){var r=[],h=[];t.forEach((function(t){var i=t.split(",");
1r.push(i[2],i[3],1.5*i[e]/a),h.push(i[2],i[3],Math.log(i[e]/5e3)/s)})),n.push([i[e]+"1",[].concat(r)]),o.push([i[e]+"2",[].concat(h)])},l=4;l<r;l++)h(l);return[n,o]}(e.data),i=Object(h.a)(t,2),r=i[0],n=i[1];o(r),p([].concat(Object(s.a)(r),Object(s.a)(n)))}))}),[]),Object(r.useEffect)((function(){if(u&&_){var e=function(e,t,i){if(0!==e.length&&t){var r=new m.a(t);g.start();for(var n=0;n<e.length;n++)r.addData(e[n][1],{format:"magnitude",name:e[n][0],animated:!0});return r.createPoints(),r.animate(),r}}(u,_.current);x(e),v(e,1,!1)}}),[u,_]),n.a.createElement("div",{className:"main"},n.a.createElement("div",{ref:_,className:"main__container"}),y?n.a.createElement("div",null,n.a.createElement("div",{className:"main__bottom"},n.a.createElement(U,{data:i,globe:y})),n.a.createElement("div",{className:"main__corner"},n.a.createElement(H,null))):n.a.createElement(j,null))}a.a.render(n.a.createElement(n.a.StrictMode,null,n.a.createElement(X,null)),document.getElementById("root"))},49:function(e,t,i){var r=i(88),n=i(89);e.exports=function(e,t){var i,o,a,s,h,l,c,u,p=(t=t||{}).colorFn||function(e){return new r.Color},f={earth:{uniforms:{texture:{type:"t",value:null}},vertexShader:["varying vec3 vNormal;","varying vec2 vUv;","void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","vUv = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D texture;","varying vec3 vNormal;","varying vec2 vUv;","void main() {","vec3 diffuse = texture2D( texture, vUv ).xyz;","float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );","vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );","gl_FragColor = vec4( diffuse + atmosphere, 1.0 );","}"].join("\n")},atmosphere:{uniforms:{},vertexShader:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.77 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;","}"].join("\n")}},d=!1,m=Date.now(),g=Date.now(),v=!0,y={x:0,y:0},x={x:0,y:0},_={x:0,y:0},w={x:3*Math.PI/2,y:Math.PI/6},b={x:0,y:0},M=5e3,S=1100,T=Math.PI/2;function C(e,t,i,n,o){var a=(90-e)*Math.PI/180,s=(180-t)*Math.PI/180;c.position.x=200*Math.sin(a)*Math.cos(s),c.position.y=200*Math.cos(a),c.position.z=200*Math.sin(a)*Math.sin(s),c.lookAt(l.position),c.scale.z=Math.max(i,.1),c.updateMatrix();for(var h=0;h<c.geometry.faces.length;h++)c.geometry.faces[h].color=n;r.GeometryUtils.merge(o,c)}function A(t){t.preventDefault(),v&&(d=!0,m=Date.now()),e.addEventListener("mousemove",L,!1),e.addEventListener("mouseup",F,!1),e.addEventListener("mouseout",U,!1),x.x=-t.clientX,x.y=t.clientY,b.x=w.x,b.y=w.y,e.style.cursor="move"}function E(t){t.preventDefault(),v&&(d=!0,m=Date.now()),t=t.touches[0],e.addEventListener("touchmove",R,!1),e.addEventListener("touchend",V,!1),e.addEventListener("touchcancel",z,!1),x.x=-t.clientX,x.y=t.clientY,b.x=w.x,b.y=w.y}function L(e){y.x=-e.clientX,y.y=e.clientY;var t=M/1e3;w.x=b.x+.005*(y.x-x.x)*t,w.y=b.y+.005*(y.y-x.y)*t,w.y=w.y>T?T:w.y,w.y=w.y<-T?-T:w.y}var P=!1,D=0;function R(e){var t=e.touches[0];y.x=-t.clientX,y.y=t.clientY;var i=M/1e3;if(w.x=b.x+.005*(y.x-x.x)*i,w.y=b.y+.005*(y.y-x.y)*i,w.y=w.y>T?T:w.y,w.y=w.y<-T?-T:w.y,e.touches.length>1){var r=e.touches[1],n=function(e,t,i,r){var n=Math.pow(e-i,2),o=Math.pow(t-r,2);return Math.sqrt(n+o)}(t.clientX,t.clientY,r.clientX,r.clientY);P?I(3*(n-D)):P=!0,D=n}else P=!1}function F(t){v&&(d=!1,g+=Date.now()-m),e.removeEventListener("mousemove",L,!1),e.removeEventListener("mouseup",F,!1),e.removeEventListener("mouseout",U,!1),e.style.cursor="auto"}function V(t){v&&(d=!1,g+=Date.now()-m),P=!1,e.removeEventListener("touchmove",R,!1),e.removeEventListener("touchend",V,!1),e.removeEventListener("touchcancel",z,!1)}function U(t){v&&(d=!1,g+=Date.now()-m),e.removeEventListener("mousemove",L,!1),e.removeEventListener("mouseup",F,!1),e.removeEventListener("mouseout",U,!1)}function z(t){v&&(d=!1,g+=Date.now()-m),P=!1,e.removeEventListener("touchmove",R,!1),e.removeEventListener("touchend",V,!1),e.removeEventListener("touchcancel",z,!1)}function N(e){return e.preventDefault(),u&&I(.3*e.wheelDeltaY),!1}function O(e){switch(e.keyCode){case 38:I(100),e.preventDefault();break;case 40:I(-100),e.preventDefault()}}function B(t){i.aspect=e.offsetWidth/e.offsetHeight,i.updateProjectionMatrix(),a.setSize(e.offsetWidth,e.offsetHeight)}function I(e){S=(S=(S-=e)>1500?1500:S)<350?350:S}var k=0,G=0;return function(){var t,p,d;e.style.color="#fff",e.style.font="13px/20px Arial, sans-serif",s=e.offsetWidth||window.innerWidth,h=e.offsetHeight||window.innerHeight,(i=new r.PerspectiveCamera(40,s/h,1,1e4)).position.z=M,o=new r.Scene;var m=new r.SphereGeometry(200,40,30);
1t=f.earth,(p=r.UniformsUtils.clone(t.uniforms)).texture.value=r.ImageUtils.loadTexture(n),d=new r.ShaderMaterial({uniforms:p,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),(l=new r.Mesh(m,d)).rotation.y=Math.PI,o.add(l),t=f.atmosphere,p=r.UniformsUtils.clone(t.uniforms),d=new r.ShaderMaterial({uniforms:p,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,side:r.BackSide,blending:r.AdditiveBlending,transparent:!0}),(l=new r.Mesh(m,d)).scale.set(1.1,1.1,1.1),o.add(l),(m=new r.CubeGeometry(.75,.75,1)).applyMatrix((new r.Matrix4).makeTranslation(0,0,-.5)),c=new r.Mesh(m),(a=new r.WebGLRenderer({antialias:!0})).setSize(s,h),a.domElement.style.position="absolute",e.appendChild(a.domElement),e.addEventListener("touchstart",E,!1),e.addEventListener("mousedown",A,!1),e.addEventListener("mousewheel",N,!1),document.addEventListener("keydown",O,!1),window.addEventListener("resize",B,!1),e.addEventListener("mouseover",(function(){u=!0}),!1),e.addEventListener("mouseout",(function(){u=!1}),!1),e.addEventListener("touchcancel",(function(){u=!1}),!1)}(),this.animate=function e(){requestAnimationFrame(e),function(){I(0);var e=d?m-g:Date.now()-g;e-k>100&&(G+=e-k);k=e;var t=1e-4*(e-G);_.x+=.1*(w.x-_.x+t),_.y+=.1*(w.y-_.y),M+=.1*(S-M),i.position.x=M*Math.sin(_.x)*Math.cos(_.y),i.position.y=M*Math.sin(_.y),i.position.z=M*Math.cos(_.x)*Math.cos(_.y),i.lookAt(l.position),a.render(o,i)}()},this.__defineGetter__("time",(function(){return this._time||0})),this.__defineSetter__("time",(function(e){var t=[],i=this.points.morphTargetDictionary;for(var r in i)r.indexOf("morphPadding")<0&&t.push(i[r]);t.sort();for(var n=e*(t.length-1)+1,o=Math.floor(n),a=0;a<t.length;a++)this.points.morphTargetInfluences[t[a]]=0;var s=o-1,h=n-o;s>=0&&(this.points.morphTargetInfluences[s]=1-h),this.points.morphTargetInfluences[o]=h,this._time=e})),this.setRot=function(e){e!==v&&(e?g+=Date.now()-m:m=Date.now(),d=!e,v=e)},this.addData=function(e,t){var i,n,o,a,s,h,l;if(t.animated=t.animated||!1,this.is_animated=t.animated,t.format=t.format||"magnitude",console.log(t.format),"magnitude"===t.format)h=3,l=function(e,t){return p(e[t+2])};else{if("legend"!==t.format)throw"error: format not supported: "+t.format;h=4,l=function(e,t){return p(e[t+3])}}if(t.animated){if(void 0===this._baseGeometry)for(this._baseGeometry=new r.Geometry,s=0;s<e.length;s+=h)C(i=e[s],n=e[s+1],o=0,a=l(e,s),this._baseGeometry);void 0===this._morphTargetId?this._morphTargetId=0:this._morphTargetId+=1,t.name=t.name||"morphTarget"+this._morphTargetId}var c=new r.Geometry;for(s=0;s<e.length;s+=h)i=e[s],n=e[s+1],a=l(e,s),o=e[s+2],C(i,n,o*=200,a,c);t.animated?this._baseGeometry.morphTargets.push({name:t.name,vertices:c.vertices}):this._baseGeometry=c},this.createPoints=function(){if(void 0!==this._baseGeometry){if(!1===this.is_animated)this.points=new r.Mesh(this._baseGeometry,new r.MeshBasicMaterial({color:16777215,vertexColors:r.FaceColors,morphTargets:!1}));else{if(this._baseGeometry.morphTargets.length<8){console.log("t l",this._baseGeometry.morphTargets.length);var e=8-this._baseGeometry.morphTargets.length;console.log("padding",e);for(var t=0;t<=e;t++)console.log("padding",t),this._baseGeometry.morphTargets.push({name:"morphPadding"+t,vertices:this._baseGeometry.vertices})}this.points=new r.Mesh(this._baseGeometry,new r.MeshBasicMaterial({color:16777215,vertexColors:r.FaceColors,morphTargets:!0}))}o.add(this.points)}},this.renderer=a,this.scene=o,this}},65:function(e,t,i){e.exports=i(103)},70:function(e,t,i){},88:function(e,t,i){"use strict";var r={REVISION:"62"},n=window.self;n.console=n.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}},String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},r.extend=function(e,t){if(Object.keys)for(var i=Object.keys(t),r=0,n=i.length;r<n;r++){var o=i[r];Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}else for(o in i={}.hasOwnProperty,t)i.call(t,o)&&(e[o]=t[o]);return e},function(){for(var e=0,t=["ms","moz","webkit","o"],i=0;i<t.length&&!n.requestAnimationFrame;++i)n.requestAnimationFrame=n[t[i]+"RequestAnimationFrame"],n.cancelAnimationFrame=n[t[i]+"CancelAnimationFrame"]||n[t[i]+"CancelRequestAnimationFrame"];void 0===n.requestAnimationFrame&&void 0!==n.setTimeout&&(n.requestAnimationFrame=function(t){var i=Date.now(),r=Math.max(0,16-(i-e)),o=n.setTimeout((function(){t(i+r)}),r);return e=i+r,o}),void 0===n.cancelAnimationFrame&&void 0!==n.clearTimeout&&(n.cancelAnimationFrame=function(e){n.clearTimeout(e)})}(),r.CullFaceNone=0,r.CullFaceBack=1,r.CullFaceFront=2,r.CullFaceFrontBack=3,r.FrontFaceDirectionCW=0,r.FrontFaceDirectionCCW=1,r.BasicShadowMap=0,r.PCFShadowMap=1,r.PCFSoftShadowMap=2,r.FrontSide=0,r.BackSide=1,r.DoubleSide=2,r.NoShading=0,r.FlatShading=1,r.SmoothShading=2,r.NoColors=0,r.FaceColors=1,r.VertexColors=2,r.NoBlending=0,r.NormalBlending=1,r.AdditiveBlending=2,r.SubtractiveBlending=3,r.MultiplyBlending=4,r.CustomBlending=5,r.AddEquation=100,r.SubtractEquation=101,r.ReverseSubtractEquation=102,r.ZeroFactor=200,r.OneFactor=201,r.SrcColorFactor=202,r.OneMinusSrcColorFactor=203,r.SrcAlphaFactor=204,r.OneMinusSrcAlphaFactor=205,r.DstAlphaFactor=206,r.OneMinusDstAlphaFactor=207,r.DstColorFactor=208,r.OneMinusDstColorFactor=209,r.SrcAlphaSaturateFactor=210,r.MultiplyOperation=0,r.MixOperation=1,r.AddOperation=2,r.UVMapping=function(){},r.CubeReflectionMapping=function(){},r.CubeRefractionMapping=function(){},r.SphericalReflectionMapping=function(){},r.SphericalRefractionMapping=function(){},r.RepeatWrapping=1e3,r.ClampToEdgeWrapping=1001,r.MirroredRepeatWrapping=1002,r.NearestFilter=1003,r.
1NearestMipMapNearestFilter=1004,r.NearestMipMapLinearFilter=1005,r.LinearFilter=1006,r.LinearMipMapNearestFilter=1007,r.LinearMipMapLinearFilter=1008,r.UnsignedByteType=1009,r.ByteType=1010,r.ShortType=1011,r.UnsignedShortType=1012,r.IntType=1013,r.UnsignedIntType=1014,r.FloatType=1015,r.UnsignedShort4444Type=1016,r.UnsignedShort5551Type=1017,r.UnsignedShort565Type=1018,r.AlphaFormat=1019,r.RGBFormat=1020,r.RGBAFormat=1021,r.LuminanceFormat=1022,r.LuminanceAlphaFormat=1023,r.RGB_S3TC_DXT1_Format=2001,r.RGBA_S3TC_DXT1_Format=2002,r.RGBA_S3TC_DXT3_Format=2003,r.RGBA_S3TC_DXT5_Format=2004,r.Color=function(e){return void 0!==e&&this.set(e),this},r.Color.prototype={constructor:r.Color,r:1,g:1,b:1,set:function(e){return e instanceof r.Color?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(e,t,i){if(0===t)this.r=this.g=this.b=i;else{var r=function(e,t,i){return 0>i&&(i+=1),1<i&&(i-=1),i<1/6?e+6*(t-e)*i:.5>i?t:i<2/3?e+6*(t-e)*(2/3-i):e};i=2*i-(t=.5>=i?i*(1+t):i+t-i*t);this.r=r(i,t,e+1/3),this.g=r(i,t,e),this.b=r(i,t,e-1/3)}return this},setStyle:function(e){return/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(e)?(e=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(e),this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,this):/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(e)?(e=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(e),this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,this):/^\#([0-9a-f]{6})$/i.test(e)?(e=/^\#([0-9a-f]{6})$/i.exec(e),this.setHex(parseInt(e[1],16)),this):/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)?(e=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e),this.setHex(parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3],16)),this):/^(\w+)$/i.test(e)?(this.setHex(r.ColorKeywords[e]),this):void 0},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e){return this.r=e.r*e.r,this.g=e.g*e.g,this.b=e.b*e.b,this},copyLinearToGamma:function(e){return this.r=Math.sqrt(e.r),this.g=Math.sqrt(e.g),this.b=Math.sqrt(e.b),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(){var e={h:0,s:0,l:0};return function(){var t,i=this.r,r=this.g,n=this.b,o=Math.max(i,r,n),a=((h=Math.min(i,r,n))+o)/2;if(h===o)h=t=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case i:t=(r-n)/s+(r<n?6:0);break;case r:t=(n-i)/s+2;break;case n:t=(i-r)/s+4}t/=6}return e.h=t,e.s=h,e.l=a,e}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=i,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new r.Color).setRGB(this.r,this.g,this.b)}},r.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},r.Quaternion=function(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1},r.Quaternion.prototype={constructor:r.Quaternion,_x:0,_y:0,_z:0,_w:0,_euler:void 0,_updateEuler:function(){void 0!==this._euler&&this._euler.setFromQuaternion(this,void 0,!1)},get x(){return this._x},set x(e){this._x=e,this._updateEuler()},get y(){return this._y},set y(e){this._y=e,this._updateEuler()},get z(){return this._z},set z(e){this._z=e,this._updateEuler()},get w(){return this._w},set w(e){this._w=e,this._updateEuler()},set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._updateEuler(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._updateEuler(),this},setFromEuler:function(e,t){if(!1===e instanceof r.Euler)throw Error("ERROR: Quaternion's .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.  Please update your co
1de.");var i=Math.cos(e._x/2),n=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),h=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=a*n*o+i*s*h,this._y=i*s*o-a*n*h,this._z=i*n*h+a*s*o,this._w=i*n*o-a*s*h):"YXZ"===e.order?(this._x=a*n*o+i*s*h,this._y=i*s*o-a*n*h,this._z=i*n*h-a*s*o,this._w=i*n*o+a*s*h):"ZXY"===e.order?(this._x=a*n*o-i*s*h,this._y=i*s*o+a*n*h,this._z=i*n*h+a*s*o,this._w=i*n*o-a*s*h):"ZYX"===e.order?(this._x=a*n*o-i*s*h,this._y=i*s*o+a*n*h,this._z=i*n*h-a*s*o,this._w=i*n*o+a*s*h):"YZX"===e.order?(this._x=a*n*o+i*s*h,this._y=i*s*o+a*n*h,this._z=i*n*h-a*s*o,this._w=i*n*o-a*s*h):"XZY"===e.order&&(this._x=a*n*o-i*s*h,this._y=i*s*o-a*n*h,this._z=i*n*h+a*s*o,this._w=i*n*o+a*s*h),!1!==t&&this._updateEuler(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._updateEuler(),this},setFromRotationMatrix:function(e){var t,i=(t=e.elements)[0],r=(e=t[4],t[8]),n=t[1],o=t[5],a=t[9],s=t[2],h=t[6],l=i+o+(t=t[10]);return 0<l?(i=.5/Math.sqrt(l+1),this._w=.25/i,this._x=(h-a)*i,this._y=(r-s)*i,this._z=(n-e)*i):i>o&&i>t?(i=2*Math.sqrt(1+i-o-t),this._w=(h-a)/i,this._x=.25*i,this._y=(e+n)/i,this._z=(r+s)/i):o>t?(i=2*Math.sqrt(1+o-i-t),this._w=(r-s)/i,this._x=(e+n)/i,this._y=.25*i,this._z=(a+h)/i):(i=2*Math.sqrt(1+t-i-o),this._w=(n-e)/i,this._x=(r+s)/i,this._y=(a+h)/i,this._z=.25*i),this._updateEuler(),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._updateEuler(),this},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 e=this.length();return 0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this},multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var i=e._x,r=e._y,n=e._z,o=e._w,a=t._x,s=t._y,h=t._z,l=t._w;return this._x=i*l+o*a+r*h-n*s,this._y=r*l+o*s+n*a-i*h,this._z=n*l+o*h+i*s-r*a,this._w=o*l-i*a-r*s-n*h,this._updateEuler(),this},multiplyVector3:function(e){return console.warn("DEPRECATED: Quaternion's .multiplyVector3(
1) has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){var i=this._x,r=this._y,n=this._z,o=this._w,a=o*e._w+i*e._x+r*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),1<=a)return this._w=o,this._x=i,this._y=r,this._z=n,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);return.001>Math.abs(h)?(this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this):(a=Math.sin((1-t)*s)/h,s=Math.sin(t*s)/h,this._w=o*a+this._w*s,this._x=i*a+this._x*s,this._y=r*a+this._y*s,this._z=n*a+this._z*s,this._updateEuler(),this)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],this._w=e[3],this._updateEuler(),this},toArray:function(){return[this._x,this._y,this._z,this._w]},clone:function(){return new r.Quaternion(this._x,this._y,this._z,this._w)}},r.Quaternion.slerp=function(e,t,i,r){return i.copy(e).slerp(t,r)},r.Vector2=function(e,t){this.x=e||0,this.y=t||0},r.Vector2.prototype={constructor:r.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScalar:function(e){return this.x+=e,this.y+=e,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divideScalar:function(e){return 0!==e?(e=1/e,this.x*=e,this.y*=e):this.y=this.x=0,this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return t*t+(e=this.y-e.y)*e},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e){return this.x=e[0],this.y=e[1],this},toArray:function(){return[this.x,this.y]},clone:function(){return new r.Vector2(this.x,this.y)}},r.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},r.Vector3.prototype={constructor:r.Vector3,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.
1y,this.z-=e.z,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z;e=e.elements;return this.x=e[0]*t+e[3]*i+e[6]*r,this.y=e[1]*t+e[4]*i+e[7]*r,this.z=e[2]*t+e[5]*i+e[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z;e=e.elements;return this.x=e[0]*t+e[4]*i+e[8]*r+e[12],this.y=e[1]*t+e[5]*i+e[9]*r+e[13],this.z=e[2]*t+e[6]*i+e[10]*r+e[14],this},applyProjection:function(e){var t=this.x,i=this.y,r=this.z,n=1/((e=e.elements)[3]*t+e[7]*i+e[11]*r+e[15]);return this.x=(e[0]*t+e[4]*i+e[8]*r+e[12])*n,this.y=(e[1]*t+e[5]*i+e[9]*r+e[13])*n,this.z=(e[2]*t+e[6]*i+e[10]*r+e[14])*n,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,o=e.y,a=e.z,s=(e=e.w)*t+o*r-a*i,h=e*i+a*t-n*r,l=e*r+n*i-o*t;t=-n*t-o*i-a*r;return this.x=s*e+t*-n+h*-a-l*-o,this.y=h*e+t*-o+l*-n-s*-a,this.z=l*e+t*-a+s*-o-h*-n,this},transformDirection:function(e){var t=this.x,i=this.y,r=this.z;e=e.elements;return this.x=e[0]*t+e[4]*i+e[8]*r,this.y=e[1]*t+e[5]*i+e[9]*r,this.z=e[2]*t+e[6]*i+e[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return 0!==e?(e=1/e,this.x*=e,this.y*=e,this.z*=e):this.z=this.y=this.x=0,this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},cross:function(e,t){if(void 0!==t)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-i*e.z,this.z=i*e.y-r*e.x,this},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,this},angleTo:function(e){return e=this.dot(e)/(this.length()*e.length()),Math.acos(r.Math.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i+(e=this.z-e.z)*e},setEulerFromRotationMatrix:function(){console.error("REMOVED: Vector3's setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code.")},setEulerFromQuaternion:function(){console.error("REMOVED: Vector3's setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code.")},getPositionFromMatrix:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},getScaleFromMatrix:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),i=this.set(e.elements[4],e.elements[5],e.elements[6]).length();e=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=i,this.z=e,this},getColumnFromMatrix:function(e,t){var i=4*e,r=t.elements;return this.x=r[i],this.y=r[i+1],this.z=r[i+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e){return this.x=e[0],this.y=e[1],this.z=e[2],this},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new r.Vector3(this.x,this.y,this.z)}},r.extend(r.Vector3.prototype,{applyEuler:function(){var e=new r.Quaternion;return function(t){return!1===t instanceof r.Euler&&console.error("ERROR: Vector3's .applyEuler() now expects a Euler rotation rather than a Vector3 and order.  Please update your co
1de."),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e=new r.Quaternion;return function(t,i){return this.applyQuaternion(e.setFromAxisAngle(t,i)),this}}(),projectOnVector:function(){var e=new r.Vector3;return function(t){return e.copy(t).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e=new r.Vector3;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new r.Vector3;return function(t){return e.copy(this).projectOnVector(t).multiplyScalar(2),this.subVectors(e,this)}}()}),r.Vector4=function(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1},r.Vector4.prototype={constructor:r.Vector4,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){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: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=this.w;e=e.elements;return this.x=e[0]*t+e[4]*i+e[8]*r+e[12]*n,this.y=e[1]*t+e[5]*i+e[9]*r
1+e[13]*n,this.z=e[2]*t+e[6]*i+e[10]*r+e[14]*n,this.w=e[3]*t+e[7]*i+e[11]*r+e[15]*n,this},divideScalar:function(e){return 0!==e?(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.z=this.y=this.x=0,this.w=1),this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,n=(e=e.elements)[0];r=e[4];var o=e[8],a=e[1],s=e[5],h=e[9];i=e[2],t=e[6];var l=e[10];return.01>Math.abs(r-a)&&.01>Math.abs(o-i)&&.01>Math.abs(h-t)?.1>Math.abs(r+a)&&.1>Math.abs(o+i)&&.1>Math.abs(h+t)&&.1>Math.abs(n+s+l-3)?(this.set(1,0,0,0),this):(e=Math.PI,l=(l+1)/2,r=(r+a)/4,o=(o+i)/4,h=(h+t)/4,(n=(n+1)/2)>(s=(s+1)/2)&&n>l?.01>n?(t=0,r=i=.707106781):(i=r/(t=Math.sqrt(n)),r=o/t):s>l?.01>s?(t=.707106781,i=0,r=.707106781):(t=r/(i=Math.sqrt(s)),r=h/i):.01>l?(i=t=.707106781,r=0):(t=o/(r=Math.sqrt(l)),i=h/r),this.set(t,i,r,e),this):(e=Math.sqrt((t-h)*(t-h)+(o-i)*(o-i)+(a-r)*(a-r)),.001>Math.abs(e)&&(e=1),this.x=(t-h)/e,this.y=(o-i)/e,this.z=(a-r)/e,this.w=Math.acos((n+s+l-1)/2),this)},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this.w<e.w&&(this.w=e.w),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this.w<e.w?this.w=e.w:this.w>t.w&&(this.w=t.w),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e){return this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3],this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new r.Vector4(this.x,this.y,this.z,this.w)}},r.Euler=function(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._order=n||r.Euler.DefaultOrder},r.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),r.Euler.DefaultOrder="XYZ",r.Euler.prototype={constructor:r.Euler,_x:0,_y:0,_z:0,_order:r.Euler.DefaultOrder,_quaternion:void 0,_updateQuaternion:function(){void 0!==this._quaternion&&this._quaternion.setFromEuler(this,!1)},get x(){return this._x},set x(e){this._x=e,this._updateQuaternion()},get y(){return this._y},set y(e){this._y=e,this._updateQuaternion()},get z(){return this._z},set z(e){this._z=e,this._updateQuaternion()},get order(){return this._order},set order(e){this._order=e,this._updateQuaternion()},set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this._updateQuaternion(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._updateQuaternion(),this},setFromRotationMatrix:function(e,t){function i(e){return Math.min(Math.max(e,-1),1)}var r=(u=e.elements)[0],n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],l=u[2],c=u[6],u=u[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(o)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,s),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(h)),.99999>Math.abs(h)?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-l,r),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(c)),.99999>Math.abs(c)?(this._y=Math.atan2(-l,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,r))):"ZYX"===t?(this._y=Math.asin(-i(l)),.99999>Math.abs(l)?(this._x=Math.atan2(c,u),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===t?(this._z=Math.asin(i(a)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-l,r)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===t?(this._z=Math.asin(-i(n)),.99999>Math.abs(n)?(this._x=Math.atan2(c,s),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+t),this._order=t,this._updateQuaternion(),this},setFromQuaternion:function(e,t,i){function r(e){return Math.min(Math.max(e,-1),1)}var n=e.x*e.x,o=e.y*e.y,a=e.z*e.z,s=e.w*e.w;return"XYZ"===(t=t||this._order)?(this._x=Math.atan2(2*(e.x*e.w-e.y*e.z),s-n-o+a),this._y=Math.asin(r(2*(e.x*e.z+e.y*e.w))),this._z=Math.atan2(2*(e.z*e.w-e.x*e.y),s+n-o-a)):"YXZ"===t?(this._x=Math.asin(r(2*(e.x*e.w-e.y*e.z))),this._y=Math.atan2(2*(e.x*e.z+e.y*e.w),s-n-o+a),this._z=Math.atan2(2*(e.x*e.y+e.z*e.w),s-n+o-a)):"ZXY"===t?(this._x=Math.asin(r(2*(e.x*e.w+e.y*e.z))),this._y=Math.atan2(2*(e.y*e.w-e.z*e.x),s-n-o+a),this._z=Math.atan2(2*(e.z*e.w-e.x*e.y),s-n+o-a)):"ZYX"===t?(this._x=Math.atan2(2*(e.x*e.w+e.z*e.y),s-n-o+a),this._y=Math.asin(r(2*(e.y*e.w-e.x*e.z))),this._z=Math.atan2(2*(e.x*e.y+e.z*e.w),s+n-o-a)):"YZX"===t?(this._x=Math.atan2(2*(e.x*e.w-e.z*e.y),s-n+o-a),this._y=Math.atan2(2*(e.y*e.w-e.x*e.z),s+n-o-a),this._z=Math.asin(r(2*(e.x*e.y+e.z*e.w)))):"XZY"===t?(this._x=Math.atan2(2*(e.x*e.w+e.y*e.z),s-n+o-a),this._y=Math.atan2(2*(e.x*e.z+e.y*e.w),s+n-o-a),this._z=Math.asin(r(2*(e.z*e.w-e.x*e.y)))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+t),this._order=t,!1!==i&&this._updateQuaternion(),this},reorder:function(){var e=new r.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._updateQuaternion(),this},toArray:function(){return[this._x,this._y,this._z,this._order]},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},clone:function(){return new r.Euler(this._x,this._y,this._z,this._order)}},r.Line3=function(e,t){this.start=void 0!==e?e:new r.Vector3,this.end=void 0!==t?t:new r.Vector3},r.Line3.prototype={constructor:r.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){return(e||new r.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new r.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new r.Vector3;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new r.Vector3,t=new r.Vector3;return function(i,n){e.subVectors(i,this.start),t.subVectors(this.end,this.start);var o=t.dot(t);o=t.dot(e)/o;return n&&(o=r.Math.clamp(o,0,1)),o}}(),closestPointToPoint:function(e,t,i){return e=this.closestPointToPointParameter(e,t),i=i||new r.Vector3,this.delta(i).multiplyScalar(e).add(this.start)}
1,applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new r.Line3).copy(this)}},r.Box2=function(e,t){this.min=void 0!==e?e:new r.Vector2(1/0,1/0),this.max=void 0!==t?t:new r.Vector2(-1/0,-1/0)},r.Box2.prototype={constructor:r.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){if(0<e.length){var t=e[0];this.min.copy(t),this.max.copy(t);for(var i=1,r=e.length;i<r;i++)(t=e[i]).x<this.min.x?this.min.x=t.x:t.x>this.max.x&&(this.max.x=t.x),t.y<this.min.y?this.min.y=t.y:t.y>this.max.y&&(this.max.y=t.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var e=new r.Vector2;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){return(e||new r.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new r.Vector2).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e){return new r.Vector2((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new r.Vector2).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new r.Vector2;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new r.Box2).copy(this)}},r.Box3=function(e,t){this.min=void 0!==e?e:new r.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new r.Vector3(-1/0,-1/0,-1/0)},r.Box3.prototype={constructor:r.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},addPoint:function(e){e.x<this.min.x?this.min.x=e.x:e.x>this.max.x&&(this.max.x=e.x),e.y<this.min.y?this.min.y=e.y:e.y>this.max.y&&(this.max.y=e.y),e.z<this.min.z?this.min.z=e.z:e.z>this.max.z&&(this.max.z=e.z)},setFromPoints:function(e){if(0<e.length){var t=e[0];this.min.copy(t),this.max.copy(t);t=1;for(var i=e.length;t<i;t++)this.addPoint(e[t])}else this.makeEmpty();return this},setFromCenterAndSize:function(){var e=new r.Vector3;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var e=new r.Vector3;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse((function(t){if(void 0!==t.geometry&&void 0!==t.geometry.vertices)for(var r=t.geometry.vertices,n=0,o=r.length;n<o;n++)e.copy(r[n]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e)})),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){return(e||new r.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new r.Vector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e){return new r.Vector3((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},clampPoint:function(e,t){return(t||new r.Vector3).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new r.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new r.Vector3;return function(t){return(t=t||new r.Sphere).center=this.center(),t.radiu
1s=.5*this.size(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new r.Box3).copy(this)}},r.Matrix3=function(e,t,i,r,n,o,a,s,h){this.elements=new Float32Array(9),this.set(void 0!==e?e:1,t||0,i||0,r||0,void 0!==n?n:1,o||0,a||0,s||0,void 0!==h?h:1)},r.Matrix3.prototype={constructor:r.Matrix3,set:function(e,t,i,r,n,o,a,s,h){var l=this.elements;return l[0]=e,l[3]=t,l[6]=i,l[1]=r,l[4]=n,l[7]=o,l[2]=a,l[5]=s,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){return e=e.elements,this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},multiplyVector3:function(e){return console.warn("DEPRECATED: Matrix3's .multiplyVector3(
1) has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){var e=new r.Vector3;return function(t){for(var i=0,r=t.length;i<r;i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyMatrix3(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=e.z;return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e,t=(e=this.elements)[0],i=e[1],r=e[2],n=e[3],o=e[4],a=e[5],s=e[6],h=e[7];return t*o*(e=e[8])-t*a*h-i*n*e+i*a*s+r*n*h-r*o*s},getInverse:function(e,t){var i=e.elements,r=this.elements;if(r[0]=i[10]*i[5]-i[6]*i[9],r[1]=-i[10]*i[1]+i[2]*i[9],r[2]=i[6]*i[1]-i[2]*i[5],r[3]=-i[10]*i[4]+i[6]*i[8],r[4]=i[10]*i[0]-i[2]*i[8],r[5]=-i[6]*i[0]+i[2]*i[4],r[6]=i[9]*i[4]-i[5]*i[8],r[7]=-i[9]*i[0]+i[1]*i[8],r[8]=i[5]*i[0]-i[1]*i[4],0===(i=i[0]*r[0]+i[1]*r[3]+i[2]*r[6])){if(t)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/i),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},clone:function(){var e=this.elements;return new r.Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])}},r.Matrix4=function(e,t,i,r,n,o,a,s,h,l,c,u,p,f,d,m){var g=this.elements=new Float32Array(16);g[0]=void 0!==e?e:1,g[4]=t||0,g[8]=i||0,g[12]=r||0,g[1]=n||0,g[5]=void 0!==o?o:1,g[9]=a||0,g[13]=s||0,g[2]=h||0,g[6]=l||0,g[10]=void 0!==c?c:1,g[14]=u||0,g[3]=p||0,g[7]=f||0,g[11]=d||0,g[15]=void 0!==m?m:1},r.Matrix4.prototype={constructor:r.Matrix4,set:function(e,t,i,r,n,o,a,s,h,l,c,u,p,f,d,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=p,g[7]=f,g[11]=d,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements;e=e.elements;return t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractRotation:function(){var e=new r.Vector3;return function(t){var i=this.elements,r=(t=t.elements,1/e.set(t[0],t[1],t[2]).length()),n=1/e.set(t[4],t[5],t[6]).length(),o=1/e.set(t[8],t[9],t[10]).length();return i[0]=t[0]*r,i[1]=t[1]*r,i[2]=t[2]*r,i[4]=t[4]*n,i[5]=t[5]*n,i[6]=t[6]*n,i[8]=t[8]*o,i[9]=t[9]*o,i[10]=t[10]*o,this}}(),makeRotationFromEuler:function(e){!1===e instanceof r.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.  Please update your code.");var t=this.elements,i=e.x,n=e.y,o=e.z,a=Math.cos(i),s=(i=Math.sin(i),Math.cos(n)),h=(n=Math.sin(n),Math.cos(o));o=Math.sin(o);if("XYZ"===e.order){e=a*h;var l=a*o,c=i*h,u=i*o;t[0]=s*h,t[4]=-s*o,t[8]=n,t[1]=l+c*n,t[5]=e-u*n,t[9]=-i*s,t[2]=u-e*n,t[6]=c+l*n,t[10]=a*s}else"YXZ"===e.order?(e=s*h,l=s*o,c=n*h,u=n*o,t[0]=e+u*i,t[4]=c*i-l,t[8]=a*n,t[1]=a*o,t[5]=a*h,t[9]=-i,t[2]=l*i-c,t[6]=u+e*i,t[10]=a*s):"ZXY"===e.order?(e=s*h,l=s*o,c=n*h,u=n*o,t[0]=e-u*i,t[4]=-a*o,t[8]=c+l*i,t[1]=l+c*i,t[5]=a*h,t[9]=u-e*i,t[2]=-a*n,t[6]=i,t[10]=a*s):"ZYX"===e.order?(e=a*h,l=a*o,c=i*h,u=i*o,t[0]=s*h,t[4]=c*n-l,t[8]=e*n+u,t[1]=s*o,t[5]=u*n+e,t[9]=l*n-c,t[2]=-n,t[6]=i*s,t[10]=a*s):"YZX"===e.order?(e=a*s,l=a*n,c=i*s,u=i*n,t[0]=s*h,t[4]=u-e*o,t[8]=c*o+l,t[1]=o,t[5]=a*h,t[9]=-i*h,t[2]=-n*h,t[6]=l*o+c,t[10]=e-u*o):"XZY"===e.order&&(e=a*s,l=a*n,c=i*s,u=i*n,t[0]=s*h,t[4]=-o,t[8]=n*h,t[1]=e*o+u,t[5]=a*h,t[9]=l*o-c,t[2]=c*o-l,t[6]=i*h,t[10]=u*o+e);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated 
1in favor of makeRotationFromQuaternion.  Please update your code."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z,o=e.w,a=n+n,s=(e=i*(l=i+i),i*(c=r+r)),h=(i=i*a,r*c),l=(r=r*a,n=n*a,o*l),c=o*c;o*=a;return t[0]=1-(h+n),t[4]=s-o,t[8]=i+c,t[1]=s+o,t[5]=1-(e+n),t[9]=r-l,t[2]=i-c,t[6]=r+l,t[10]=1-(e+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new r.Vector3,t=new r.Vector3,i=new r.Vector3;return function(r,n,o){var a=this.elements;return i.subVectors(r,n).normalize(),0===i.length()&&(i.z=1),e.crossVectors(o,i).normalize(),0===e.length()&&(i.x+=1e-4,e.crossVectors(o,i).normalize()),t.crossVectors(i,e),a[0]=e.x,a[4]=t.x,a[8]=i.x,a[1]=e.y,a[5]=t.y,a[9]=i.y,a[2]=e.z,a[6]=t.z,a[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,o=i[0],a=i[4],s=i[8],h=i[12],l=i[1],c=i[5],u=i[9],p=i[13],f=i[2],d=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],_=(i=i[15],r[0]),w=r[4],b=r[8],M=r[12],S=r[1],T=r[5],C=r[9],A=r[13],E=r[2],L=r[6],P=r[10],D=r[14],R=r[3],F=r[7],V=r[11];r=r[15];return n[0]=o*_+a*S+s*E+h*R,n[4]=o*w+a*T+s*L+h*F,n[8]=o*b+a*C+s*P+h*V,n[12]=o*M+a*A+s*D+h*r,n[1]=l*_+c*S+u*E+p*R,n[5]=l*w+c*T+u*L+p*F,n[9]=l*b+c*C+u*P+p*V,n[13]=l*M+c*A+u*D+p*r,n[2]=f*_+d*S+m*E+g*R,n[6]=f*w+d*T+m*L+g*F,n[10]=f*b+d*C+m*P+g*V,n[14]=f*M+d*A+m*D+g*r,n[3]=v*_+y*S+x*E+i*R,n[7]=v*w+y*T+x*L+i*F,n[11]=v*b+y*C+x*P+i*V,n[15]=v*M+y*A+x*D+i*r,this},multiplyToArray:function(e,t,i){var r=this.elements;return this.multiplyMatrices(e,t),i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return console.warn("DEPRECATED: Matrix4's .multiplyVector3(
1) has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){var e=new r.Vector3;return function(t){for(var i=0,r=t.length;i<r;i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyProjection(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=e.z;return t}}(),rotateAxis:function(e){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],o=e[1],a=e[5],s=e[9],h=e[13],l=e[2],c=e[6],u=e[10],p=e[14];return e[3]*(+n*s*c-r*h*c-n*a*u+i*h*u+r*a*p-i*s*p)+e[7]*(+t*s*p-t*h*u+n*o*u-r*o*p+r*h*l-n*s*l)+e[11]*(+t*h*c-t*a*p-n*o*c+i*o*p+n*a*l-i*h*l)+e[15]*(-r*a*l-t*s*c+t*a*u+r*o*c-i*o*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},flattenToArrayOffset:function(e,t){var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e},getPosition:function(){var e=new r.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,r=(y=e.elements)[0],n=y[4],o=y[8],a=y[12],s=y[1],h=y[5],l=y[9],c=y[13],u=y[2],p=y[6],f=y[10],d=y[14],m=y[3],g=y[7],v=y[11],y=y[15];if(i[0]=l*d*g-c*f*g+c*p*v-h*d*v-l*p*y+h*f*y,i[4]=a*f*g-o*d*g-a*p*v+n*d*v+o*p*y-n*f*y,i[8]=o*c*g-a*l*g+a*h*v-n*c*v-o*h*y+n*l*y,i[12]=a*l*p-o*c*p-a*h*f+n*c*f+o*h*d-n*l*d,i[1]=c*f*m-l*d*m-c*u*v+s*d*v+l*u*y-s*f*y,i[5]=o*d*m-a*f*m+a*u*v-r*d*v-o*u*y+r*f*y,i[9]=a*l*m-o*c*m-a*s*v+r*c*v+o*s*y-r*l*y,i[13]=o*c*u-a*l*u+a*s*f-r*c*f-o*s*d+r*l*d,i[2]=h*d*m-c*p*m+c*u*g-s*d*g-h*u*y+s*p*y,i[6]=a*p*m-n*d*m-a*u*g+r*d*g+n*u*y-r*p*y,i[10]=n*c*m-a*h*m+a*s*g-r*c*g-n*s*y+r*h*y,i[14]=a*h*u-n*c*u-a*s*p+r*c*p+n*s*d-r*h*d,i[3]=l*p*m-h*f*m-l*u*g+s*f*g+h*u*v-s*p*v,i[7]=n*f*m-o*p*m+o*u*g-r*f*g-n*u*v+r*p*v,i[11]=o*h*m-n*l*m-o*s*g+r*l*g+n*s*v-r*h*v,i[15]=n*l*u-o*h*u+o*s*p-r*l*p-n*s*f+r*h*f,0==(i=r*i[0]+s*i[4]+u*i[8]+m*i[12])){if(t)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/i),this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,i=e.x,r=e.y;e=e.z;return t[0]*=i,t[4]*=r,t[8]*=e,t[1]*=i,t[5]*=r,t[9]*=e,t[2]*=i,t[6]*=r,t[10]*=e,t[3]*=i,t[7]*=r,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],Math.max(e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10])))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);e=Math.sin(e);return this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);e=Math.sin(e);return this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);e=Math.sin(e);return this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=1-i,o=e.x,a=e.
1y,s=e.z,h=n*o,l=n*a;return this.set(h*o+i,h*a-r*s,h*s+r*a,0,h*a+r*s,l*a+i,l*s-r*o,0,h*s-r*a,l*s+r*o,n*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e=new r.Vector3,t=new r.Matrix4;return function(i,r,n){var o=this.elements,a=e.set(o[0],o[1],o[2]).length(),s=e.set(o[4],o[5],o[6]).length(),h=e.set(o[8],o[9],o[10]).length();i.x=o[12],i.y=o[13],i.z=o[14],t.elements.set(this.elements);i=1/a,o=1/s;var l=1/h;return t.elements[0]*=i,t.elements[1]*=i,t.elements[2]*=i,t.elements[4]*=o,t.elements[5]*=o,t.elements[6]*=o,t.elements[8]*=l,t.elements[9]*=l,t.elements[10]*=l,r.setFromRotationMatrix(t),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(e,t,i,r,n,o){var a=this.elements;return a[0]=2*n/(t-e),a[4]=0,a[8]=(t+e)/(t-e),a[12]=0,a[1]=0,a[5]=2*n/(r-i),a[9]=(r+i)/(r-i),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,i,n){var o=-(e=i*Math.tan(r.Math.degToRad(.5*e)));return this.makeFrustum(o*t,e*t,o,e,i,n)},makeOrthographic:function(e,t,i,r,n,o){var a=this.elements,s=t-e,h=i-r,l=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(t+e)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(i+r)/h,a[2]=0,a[6]=0,a[10]=-2/l,a[14]=-(o+n)/l,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){var e=this.elements;return new r.Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])}},r.Ray=function(e,t){this.origin=void 0!==e?e:new r.Vector3,this.direction=void 0!==t?t:new r.Vector3},r.Ray.prototype={constructor:r.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new r.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new r.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new r.Vector3;i.subVectors(e,this.origin);var n=i.dot(this.direction);return 0>n?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(){var e=new r.Vector3;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return 0>i?this.origin.distanceTo(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceTo(t))}}(),distanceSqToSegment:function(e,t,i,r){var n,o,a=e.clone().add(t).multiplyScalar(.5),s=t.clone().sub(e).normalize(),h=.5*e.distanceTo(t),l=this.origin.clone().sub(a),c=(e=-this.direction.dot(s),t=l.dot(this.direction),-l.dot(s)),u=l.lengthSq(),p=Math.abs(1-e*e);return 0<=p?(n=e*t-c,o=h*p,0<=(l=e*c-t)?n>=-o?n<=o?e=(l*=h=1/p)*(l+e*(n*=h)+2*t)+n*(e*l+n+2*c)+u:(n=h,e=-(l=Math.max(0,-(e*n+t)))*l+n*(n+2*c)+u):(n=-h,e=-(l=Math.max(0,-(e*n+t)))*l+n*(n+2*c)+u):n<=-o?e=-(l=Math.max(0,-(-e*h+t)))*l+(n=0<l?-h:Math.min(Math.max(-h,-c),h))*(n+2*c)+u:n<=o?(l=0,e=(n=Math.min(Math.max(-h,-c),h))*(n+2*c)+u):e=-(l=Math.max(0,-(e*h+t)))*l+(n=0<l?h:Math.min(Math.max(-h,-c),h))*(n+2*c)+u):(n=0<e?-h:h,e=-(l=Math.max(0,-(e*n+t)))*l+n*(n+2*c)+u),i&&i.copy(this.direction.clone().multiplyScalar(l).add(this.origin)),r&&r.copy(s.clone().multiplyScalar(n).add(a)),e},isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||0>e.normal.dot(this.direction)*t},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0==t?0==e.distanceToPoint(this.origin)?0:null:0<=(e=-(this.origin.dot(e.normal)+e.constant)/t)?e:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},isIntersectionBox:function(){var e=new r.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var i,r,n,o,a;r=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=r?(i=(e.min.x-s.x)*r,r*=e.max.x-s.x):(i=(e.max.x-s.x)*r,r*=e.min.x-s.x),0<=o?(n=(e.min.y-s.y)*o,o*=e.max.y-s.y):(n=(e.max.y-s.y)*o,o*=e.min.y-s.y),i>o||n>r?null:((n>i||i!==i)&&(i=n),(o<r||r!==r)&&(r=o),0<=a?(n=(e.min.z-s.z)*a,a*=e.max.z-s.z):(n=(e.max.z-s.z)*a,a*=e.min.z-s.z),i>a||n>r?null:((n>i||i!==i)&&(i=n),(a<r||r!==r)&&(r=a),0>r?null:this.at(0<=i?i:r,t)))},intersectTriangle:function(){var e=new r.Vector3,t=new r.Vector3,i=new r.Vector3,
1n=new r.Vector3;return function(r,o,a,s,h){if(t.subVectors(o,r),i.subVectors(a,r),n.crossVectors(t,i),0<(o=this.direction.dot(n))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return e.subVectors(this.origin,r),0>(r=s*this.direction.dot(i.crossVectors(e,i)))||0>(a=s*this.direction.dot(t.cross(e)))||r+a>o||0>(r=-s*e.dot(n))?null:this.at(r/o,h)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new r.Ray).copy(this)}},r.Sphere=function(e,t){this.center=void 0!==e?e:new r.Vector3,this.radius=void 0!==t?t:0},r.Sphere.prototype={constructor:r.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new r.Box3;return function(t,i){var r=this.center;void 0!==i?r.copy(i):e.setFromPoints(t).center(r);for(var n=0,o=0,a=t.length;o<a;o++)n=Math.max(n,r.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),n=t||new r.Vector3;return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){return(e=e||new r.Box3).set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new r.Sphere).copy(this)}},r.Frustum=function(e,t,i,n,o,a){this.planes=[void 0!==e?e:new r.Plane,void 0!==t?t:new r.Plane,void 0!==i?i:new r.Plane,void 0!==n?n:new r.Plane,void 0!==o?o:new r.Plane,void 0!==a?a:new r.Plane]},r.Frustum.prototype={constructor:r.Frustum,set:function(e,t,i,r,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(n),a[5].copy(o),this},copy:function(e){for(var t=this.planes,i=0;6>i;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=(e=(g=e.elements)[0],g[1]),r=g[2],n=g[3],o=g[4],a=g[5],s=g[6],h=g[7],l=g[8],c=g[9],u=g[10],p=g[11],f=g[12],d=g[13],m=g[14],g=g[15];return t[0].setComponents(n-e,h-o,p-l,g-f).normalize(),t[1].setComponents(n+e,h+o,p+l,g+f).normalize(),t[2].setComponents(n+i,h+a,p+c,g+d).normalize(),t[3].setComponents(n-i,h-a,p-c,g-d).normalize(),t[4].setComponents(n-r,h-s,p-u,g-m).normalize(),t[5].setComponents(n+r,h+s,p+u,g+m).normalize(),this},intersectsObject:function(){var e=new r.Sphere;return function(t){var i=t.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),e.copy(i.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=(e=-e.radius,0);6>r;r++)if(t[r].distanceToPoint(i)<e)return!1;return!0},intersectsBox:function(){var e=new r.Vector3,t=new r.Vector3;return function(i){for(var r=this.planes,n=0;6>n;n++){var o=r[n];e.x=0<o.normal.x?i.min.x:i.max.x,t.x=0<o.normal.x?i.max.x:i.min.x,e.y=0<o.normal.y?i.min.y:i.max.y,t.y=0<o.normal.y?i.max.y:i.min.y,e.z=0<o.normal.z?i.min.z:i.max.z,t.z=0<o.normal.z?i.max.z:i.min.z;var a=o.distanceToPoint(e);o=o.distanceToPoint(t);if(0>a&&0>o)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,i=0;6>i;i++)if(0>t[i].distanceToPoint(e))return!1;return!0},clone:function(){return(new r.Frustum).copy(this)}},r.Plane=function(e,t){this.normal=void 0!==e?e:new r.Vector3(1,0,0),this.constant=void 0!==t?t:0},r.Plane.prototype={constructor:r.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new r.Vector3,t=new r.Vector3;return function(i,r,n){return r=e.subVectors(n,r).cross(t.subVectors(i,r)).normalize(),this.setFromNormalAndCoplanarPoint(r,i),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e);return(t||new r.Vector3).copy(this.normal).multiplyScalar(i)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start);e=this.distanceToPoint(e.end);return 0>t&&0<e||0>e&&0<t},intersectLine:function(){var e=new r.Vector3;return function(t,i){var n=i||new r.Vector3,o=t.delta(e),a=this.normal.dot(o);return 0!=a?0>
1(a=-(t.start.dot(this.normal)+this.constant)/a)||1<a?void 0:n.copy(o).multiplyScalar(a).add(t.start):0==this.distanceToPoint(t.start)?n.copy(t.start):void 0}}(),coplanarPoint:function(e){return(e||new r.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new r.Vector3,t=new r.Vector3;return function(i,n){n=n||(new r.Matrix3).getNormalMatrix(i);var o=e.copy(this.normal).applyMatrix3(n),a=this.coplanarPoint(t);return a.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,a),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new r.Plane).copy(this)}},r.Math={PI2:2*Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=Array(36),r=0;return function(){for(var n=0;36>n;n++)8==n||13==n||18==n||23==n?i[n]="-":14==n?i[n]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,i[n]=t[19==n?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return e<t?t:e>i?i:e},clampBottom:function(e,t){return e<t?t:e},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},sign:function(e){return 0>e?-1:0<e?1:0},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}()},r.Spline=function(e){function t(e,t,i,r,n,o,a){return(2*(t-i)+(e=.5*(i-e))+(r=.5*(r-t)))*a+(-3*(t-i)-2*e-r)*o+e*n+t}this.points=e;var i,n,o,a,s,h,l,c,u,p=[],f={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return i=(this.points.length-1)*e,n=Math.floor(i),o=i-n,p[0]=0===n?n:n-1,p[1]=n,p[2]=n>this.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,h=this.points[p[0]],l=this.points[p[1]],c=this.points[p[2]],u=this.points[p[3]],s=o*(a=o*o),f.x=t(h.x,l.x,c.x,u.x,o,a,s),f.y=t(h.y,l.y,c.y,u.y,o,a,s),f.z=t(h.z,l.z,c.z,u.z,o,a,s),f},this.getControlPointsArray=function(){var e,t,i=this.points.length,r=[];for(e=0;e<i;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,i,n,o=t=t=0,a=new r.Vector3,s=new r.Vector3,h=[],l=0;for(h[0]=0,e||(e=100),i=this.points.length*e,a.copy(this.points[0]),e=1;e<i;e++)t=e/i,n=this.getPoint(t),s.copy(n),l+=s.distanceTo(a),a.copy(n),t*=this.points.length-1,(t=Math.floor(t))!=o&&(h[t]=l,o=t);return h[h.length]=l,{chunks:h,total:l}},this.reparametrizeByArcLength=function(e){var t,i,n,o,a,s,h=[],l=new r.Vector3,c=this.getLength();for(h.push(l.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(i=c.chunks[t]-c.chunks[t-1],s=Math.ceil(e*i/c.total),o=(t-1)/(this.points.length-1),a=t/(this.points.length-1),i=1;i<s-1;i++)n=o+i*(1/s)*(a-o),n=this.getPoint(n),h.push(l.copy(n).clone());h.push(l.copy(this.points[t]).clone())}this.points=h}},r.Triangle=function(e,t,i){this.a=void 0!==e?e:new r.Vector3,this.b=void 0!==t?t:new r.Vector3,this.c=void 0!==i?i:new r.Vector3},r.Triangle.normal=function(){var e=new r.Vector3;return function(t,i,n,o){return(o=o||new r.Vector3).subVectors(n,i),e.subVectors(t,i),o.cross(e),0<(t=o.lengthSq())?o.multiplyScalar(1/Math.sqrt(t)):o.set(0,0,0)}}(),r.Triangle.barycoordFromPoint=function(){var e=new r.Vector3,t=new r.Vector3,i=new r.Vector3;return function(n,o,a,s,h){e.subVectors(s,o),t.subVectors(a,o),i.subVectors(n,o);n=e.dot(e),o=e.dot(t),a=e.dot(i);var l=t.dot(t),c=(s=t.dot(i),n*l-o*o);h=h||new r.Vector3;return 0==c?h.set(-2,-1,-1):(l=(l*a-o*s)*(c=1/c),n=(n*s-o*a)*c,h.set(1-l-n,n,l))}}(),r.Triangle.containsPoint=function(){var e=new r.Vector3;return function(t,i,n,o){return 0<=(t=r.Triangle.barycoordFromPoint(t,i,n,o,e)).x&&0<=t.y&&1>=t.x+t.y}}(),r.Triangle.prototype={constructor:r.Triangle,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new r.Vector3,t=new r.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new r.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return r.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new r.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return r.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)}
1,containsPoint:function(e){return r.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new r.Triangle).copy(this)}},r.Vertex=function(e){return console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead."),e},r.UV=function(e,t){return console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead."),new r.Vector2(e,t)},r.Clock=function(e){this.autoStart=void 0===e||e,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},r.Clock.prototype={constructor:r.Clock,start:function(){this.oldTime=this.startTime=void 0!==n.performance&&void 0!==n.performance.now?n.performance.now():Date.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==n.performance&&void 0!==n.performance.now?n.performance.now():Date.now();e=.001*(t-this.oldTime);this.oldTime=t,this.elapsedTime+=e}return e}},r.EventDispatcher=function(){},r.EventDispatcher.prototype={constructor:r.EventDispatcher,apply:function(e){e.addEventListener=r.EventDispatcher.prototype.addEventListener,e.hasEventListener=r.EventDispatcher.prototype.hasEventListener,e.removeEventListener=r.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=r.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners,r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}},dispatchEvent:function(){var e=[];return function(t){if(void 0!==this._listeners){var i=this._listeners[t.type];if(void 0!==i){t.target=this;for(var r=i.length,n=0;n<r;n++)e[n]=i[n];for(n=0;n<r;n++)e[n].call(this,t)}}}}()},function(e){e.Raycaster=function(t,i,r,n){this.ray=new e.Ray(t,i),this.near=r||0,this.far=n||1/0};var t=new e.Sphere,i=new e.Ray;new e.Plane,new e.Vector3;
1var r=new e.Vector3,n=new e.Matrix4,o=function(e,t){return e.distance-t.distance},a=new e.Vector3,s=new e.Vector3,h=new e.Vector3,l=function o(l,c,u){if(l instanceof e.Sprite){if(r.getPositionFromMatrix(l.matrixWorld),(w=c.ray.distanceToPoint(r))>l.scale.x)return u;u.push({distance:w,point:l.position,face:null,object:l})}else if(l instanceof e.LOD)r.getPositionFromMatrix(l.matrixWorld),w=c.ray.origin.distanceTo(r),o(l.getObjectForDistance(w),c,u);else if(l instanceof e.Mesh){if(null===(M=l.geometry).boundingSphere&&M.computeBoundingSphere(),t.copy(M.boundingSphere),t.applyMatrix4(l.matrixWorld),!1===c.ray.isIntersectionSphere(t))return u;if(n.getInverse(l.matrixWorld),i.copy(c.ray).applyMatrix4(n),null!==M.boundingBox&&!1===i.isIntersectionBox(M.boundingBox))return u;if(M instanceof e.BufferGeometry){var p=l.material;if(void 0===p||!1===M.dynamic)return u;var f,d,m=c.precision;if(void 0!==M.attributes.index){var g=M.offsets,v=M.attributes.index.array,y=M.attributes.position.array,x=M.offsets.length,_=M.attributes.index.array.length/3;for(_=0;_<x;++_)for(var w=g[_].start,b=g[_].index,M=w,S=w+g[_].count;M<S;M+=3)w=b+v[M],f=b+v[M+1],d=b+v[M+2],a.set(y[3*w],y[3*w+1],y[3*w+2]),s.set(y[3*f],y[3*f+1],y[3*f+2]),h.set(y[3*d],y[3*d+1],y[3*d+2]),null!==(f=p.side===e.BackSide?i.intersectTriangle(h,s,a,!0):i.intersectTriangle(a,s,h,p.side!==e.DoubleSide))&&(f.applyMatrix4(l.matrixWorld),(w=c.ray.origin.distanceTo(f))<m||w<c.near||w>c.far||u.push({distance:w,point:f,face:null,faceIndex:null,object:l}))}else for(y=M.attributes.position.array,_=M.attributes.position.array.length,M=0;M<_;M+=3)w=M,f=M+1,d=M+2,a.set(y[3*w],y[3*w+1],y[3*w+2]),s.set(y[3*f],y[3*f+1],y[3*f+2]),h.set(y[3*d],y[3*d+1],y[3*d+2]),null!==(f=p.side===e.BackSide?i.intersectTriangle(h,s,a,!0):i.intersectTriangle(a,s,h,p.side!==e.DoubleSide))&&(f.applyMatrix4(l.matrixWorld),(w=c.ray.origin.distanceTo(f))<m||w<c.near||w>c.far||u.push({distance:w,point:f,face:null,faceIndex:null,object:l}))}else if(M instanceof e.Geometry)for(y=!0===(v=l.material instanceof e.MeshFaceMaterial)?l.material.materials:null,m=c.precision,g=M.vertices,x=0,_=M.faces.length;x<_;x++)b=M.faces[x],void 0!==(p=!0===v?y[b.materialIndex]:l.material)&&(w=g[b.a],f=g[b.b],d=g[b.c],null!==(f=p.side===e.BackSide?i.intersectTriangle(d,f,w,!0):i.intersectTriangle(w,f,d,p.side!==e.DoubleSide))&&(f.applyMatrix4(l.matrixWorld),(w=c.ray.origin.distanceTo(f))<m||w<c.near||w>c.far||u.push({distance:w,point:f,face:b,faceIndex:x,object:l})))}else if(l instanceof e.Line){if(p=(m=c.linePrecision)*m,null===(M=l.geometry).boundingSphere&&M.computeBoundingSphere(),t.copy(M.boundingSphere),t.applyMatrix4(l.matrixWorld),!1===c.ray.isIntersectionSphere(t))return u;if(n.getInverse(l.matrixWorld),i.copy(c.ray).applyMatrix4(n),M instanceof e.Geometry)for(m=(g=M.vertices).length,f=new e.Vector3,d=new e.Vector3,_=l.type===e.LineStrip?1:2,M=0;M<m-1;M+=_)i.distanceSqToSegment(g[M],g[M+1],d,f)>p||((w=i.origin.distanceTo(d))<c.near||w>c.far||u.push({distance:w,point:f.clone().applyMatrix4(l.matrixWorld),face:null,faceIndex:null,object:l}))}},c=function(e,t,i){for(var r=0,n=(e=e.getDescendants()).length;r<n;r++)l(e[r],t,i)};e.Raycaster.prototype.precision=1e-4,e.Raycaster.prototype.linePrecision=1,e.Raycaster.prototype.set=function(e,t){this.ray.set(e,t)},e.Raycaster.prototype.intersectObject=function(e,t){var i=[];return!0===t&&c(e,this,i),l(e,this,i),i.sort(o),i},e.Raycaster.prototype.intersectObjects=function(e,t){for(var i=[],r=0,n=e.length;r<n;r++)l(e[r],this,i),!0===t&&c(e[r],this,i);return i.sort(o),i}}(r),r.Object3D=function(){this.id=r.Object3DIdCount++,this.uuid=r.Math.generateUUID(),this.name="",this.parent=void 0,this.children=[],this.up=new r.Vector3(0,1,0),this.position=new r.Vector3,this.rotation=new r.Euler,this.quaternion=new r.Quaternion,this.scale=new r.Vector3(1,1,1),this.rotation._quaternion=this.quaternion,this.quaternion._euler=this.rotation,this.renderDepth=null,this.rotationAutoUpdate=!0,this.matrix=new r.Matrix4,this.matrixWorld=new r.Matrix4,this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.userData={}},r.Object3D.prototype={constructor:r.Object3D,get eulerOrder(){return console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order."),this.rotation.order},set eulerOrder(e){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order."),this.rotation.order=e},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library n
1ow uses quaternions by default.")},set useQuaternion(e){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(){var e=new r.Matrix4;return function(t){this.matrix.multiplyMatrices(t,this.matrix),this.position.getPositionFromMatrix(this.matrix),this.scale.getScaleFromMatrix(this.matrix),e.extractRotation(this.matrix),this.quaternion.setFromRotationMatrix(e)}}(),setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new r.Quaternion;return function(t,i){return e.setFromAxisAngle(t,i),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new r.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new r.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new r.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new r.Vector3;return function(t,i){return e.copy(t),e.applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translate:function(e,t){return console.warn("DEPRECATED: Object3D's .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed."),this.translateOnAxis(t,e)},translateX:function(){var e=new r.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new r.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new r.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new r.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new r.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(e===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(e instanceof r.Object3D){void 0!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e);for(var t=this;void 0!==t.parent;)t=t.parent;void 0!==t&&t instanceof r.Scene&&t.__addObject(e)}},remove:function(e){var t=this.children.indexOf(e);if(-1!==t){for(e.parent=void 0,e.dispatchEvent({type:"removed"}),this.children.splice(t,1),t=this;void 0!==t.parent;)t=t.parent;void 0!==t&&t instanceof r.Scene&&t.__removeObject(e)}},traverse:function(e){e(this);for(var t=0,i=this.children.length;t<i;t++)this.children[t].traverse(e)},getObjectById:function(e,t){for(var i=0,r=this.children.length;i<r;i++){var n=this.children[i];if(n.id===e||!0===t&&void 0!==(n=n.getObjectById(e,t)))return n}},getObjectByName:function(e,t){for(var i=0,r=this.children.length;i<r;i++){var n=this.children[i];if(n.name===e||!0===t&&void 0!==(n=n.getObjectByName(e,t)))return n}},getChildByName:function(e,t){return console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e,t)},getDescendants:function(e){void 0===e&&(e=[]),Array.prototype.push.apply(e,this.children);for(var t=0,i=this.children.length;t<i;t++)this.children[t].getDescendants(e);return e},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)},clone:function(e,t){if(void 0===e&&(e=new r.Object3D),void 0===t&&(t=!0),e.name=this.name,e.up.copy(this.up),e.position.copy(this.position),e.quaternion.copy(this.quaternion),e.scale.copy(this.scale),e.renderDepth=this.renderDepth,e.rotationAutoUpdate=this.rotationAutoUpdate,e.matrix.copy(this.matrix
1),e.matrixWorld.copy(this.matrixWorld),e.matrixAutoUpdate=this.matrixAutoUpdate,e.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,e.visible=this.visible,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow,e.frustumCulled=this.frustumCulled,e.userData=JSON.parse(JSON.stringify(this.userData)),!0===t)for(var i=0;i<this.children.length;i++)e.add(this.children[i].clone());return e}},r.EventDispatcher.prototype.apply(r.Object3D.prototype),r.Object3DIdCount=0,r.Projector=function(){function e(){if(s===y){var e=new r.RenderableVertex;return v.push(e),y++,s++,e}return v[s++]}function t(e,t){return e.z!==t.z?t.z-e.z:e.id!==t.id?e.id-t.id:0}function i(e,t){var i=0,r=1,n=e.z+e.w,o=t.z+t.w,a=-e.z+e.w,s=-t.z+t.w;return 0<=n&&0<=o&&0<=a&&0<=s||!(0>n&&0>o||0>a&&0>s)&&(0>n?i=Math.max(i,n/(n-o)):0>o&&(r=Math.min(r,n/(n-o))),0>a?i=Math.max(i,a/(a-s)):0>s&&(r=Math.min(r,a/(a-s))),!(r<i)&&(e.lerp(t,i),t.lerp(e,1-r),!0))}var n,o,a,s,h,l,c,u,p,f,d,m=[],g=0,v=[],y=0,x=[],_=0,w=[],b=0,M=[],S=0,T={objects:[],sprites:[],lights:[],elements:[]},C=new r.Vector3,A=new r.Vector4,E=new r.Box3(new r.Vector3(-1,-1,-1),new r.Vector3(1,1,1)),L=new r.Box3,P=Array(3),D=new r.Matrix4,R=new r.Matrix4,F=new r.Matrix4,V=new r.Matrix3,U=new r.Matrix3,z=new r.Vector3,N=new r.Frustum,O=new r.Vector4,B=new r.Vector4;this.projectVector=function(e,t){return t.matrixWorldInverse.getInverse(t.matrixWorld),R.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),e.applyProjection(R)},this.unprojectVector=function(e,t){return t.projectionMatrixInverse.getInverse(t.projectionMatrix),R.multiplyMatrices(t.matrixWorld,t.projectionMatrixInverse),e.applyProjection(R)},this.pickingRay=function(e,t){e.z=-1;var i=new r.Vector3(e.x,e.y,1);return this.unprojectVector(e,t),this.unprojectVector(i,t),i.sub(e).normalize(),new r.Raycaster(e,i)};var I=function(e){if(o===g){var t=new r.RenderableObject;m.push(t),g++,o++,n=t}else n=m[o++];return n.id=e.id,n.object=e,null!==e.renderDepth?n.z=e.renderDepth:(C.getPositionFromMatrix(e.matrixWorld),C.applyProjection(R),n.z=C.z),n},k=function e(t){if(!1!==t.visible){t instanceof r.Light?T.lights.push(t):t instanceof r.Mesh||t instanceof r.Line?(!1===t.frustumCulled||!0===N.intersectsObject(t))&&T.objects.push(I(t)):t instanceof r.Sprite&&T.sprites.push(I(t));for(var i=0,n=t.children.length;i<n;i++)e(t.children[i])}};this.projectScene=function(n,m,g,y){var C,I,G,H,W,j,X,Y,q,K,Q,Z,J=!1;for(f=u=l=0,T.elements.length=0,!0===n.autoUpdate&&n.updateMatrixWorld(),void 0===m.parent&&m.updateMatrixWorld(),D.copy(m.matrixWorldInverse.getInverse(m.matrixWorld)),R.multiplyMatrices(m.projectionMatrix,D),U.getNormalMatrix(D),N.setFromMatrix(R),o=0,T.objects.length=0,T.sprites.length=0,T.lights.length=0,k(n),!0===g&&T.objects.sort(t),n=0,g=T.objects.length;n<g;n++)if(X=T.objects[n].object,d=X.matrixWorld,s=0,X instanceof r.Mesh){for(G=(Y=X.geometry).vertices,q=Y.faces,Y=Y.faceVertexUvs,V.getNormalMatrix(d),Z=!0===(Q=X.material instanceof r.MeshFaceMaterial)?X.material:null,C=0,I=G.length;C<I;C++){(a=e()).positionWorld.copy(G[C]).applyMatrix4(d),a.positionScreen.copy(a.positionWorld).applyMatrix4(R);var $=1/a.positionScreen.w;a.positionScreen.x*=$,a.positionScreen.y*=$,a.positionScreen.z*=$,a.visible=!(-1>a.positionScreen.x||1<a.positionScreen.x||-1>a.positionScreen.y||1<a.positionScreen.y||-1>a.positionScreen.z||1<a.positionScreen.z)}for(G=0,C=q.length;G<C;G++)if(I=q[G],void 0!==($=!0===Q?Z.materials[I.materialIndex]:X.material)&&(j=$.side,H=v[I.a],W=v[I.b],K=v[I.c],P[0]=H.positionScreen,P[1]=W.positionScreen,P[2]=K.positionScreen,!0===H.visible||!0===W.visible||!0===K.visible||E.isIntersectionBox(L.setFromPoints(P)))&&(J=0>(K.positionScreen.x-H.positionScreen.x)*(W.positionScreen.y-H.positionScreen.y)-(K.positionScreen.y-H.positionScreen.y)*(W.positionScreen.x-H.positionScreen.x),j===r.DoubleSide||J===(j===r.FrontSide))){if(l===_){var ee=new r.RenderableFace3;x.push(ee),_++,l++,h=ee}else h=x[l++];for(h.id=X.id,h.v1.copy(H),h.v2.copy(W),h.v3.copy(K),h.normalModel.copy(I.normal),!1===J&&(j===r.BackSide||j===r.DoubleSide)&&h.normalModel.negate(),h.normalModel.applyMatrix3(V).normalize(),h.normalModelView.copy(h.normalModel).applyMatrix3(U),h.centroidModel.copy(I.centroid).applyMatrix4(d),K=I.vertexNormals,H=0,W=Math.min(K.length,3);H<W;H++)(ee=h.vertexNormalsModel[H]).copy(K[H]),!1===J&&(j===r.BackSide||j===r.DoubleSide)&&ee.negate(),ee.applyMatrix3(V).normalize(),h.vertexNormalsModelView[H].copy(ee).applyMatrix3(U);for(h.vertexNormalsLength=K.length,J=0,H=Math.min(Y.length,3);J<H;J++)if(void 0!==(K=Y[J][G]))for(W=0,j=K.length;W<j;W++)h.uvs[J][W]=K[W];h.color=I.color,h.material=$,z.copy(h.centroidModel).applyProjection(R),h.z=z.z,T.elements.push(h)}}else if(X instanceof r.Line)for(F.multiplyMatrices(R,d),G=X.geometry.vertices,(H=e()).positionScreen.copy(G[0]).applyMatrix4(F),q=X.type===r.LineP
1ieces?2:1,C=1,I=G.length;C<I;C++)(H=e()).positionScreen.copy(G[C]).applyMatrix4(F),0<(C+1)%q||(W=v[s-2],O.copy(H.positionScreen),B.copy(W.positionScreen),!0===i(O,B)&&(O.multiplyScalar(1/O.w),B.multiplyScalar(1/B.w),u===b?(Y=new r.RenderableLine,w.push(Y),b++,u++,c=Y):c=w[u++],c.id=X.id,c.v1.positionScreen.copy(O),c.v2.positionScreen.copy(B),c.z=Math.max(O.z,B.z),c.material=X.material,X.material.vertexColors===r.VertexColors&&(c.vertexColors[0].copy(X.geometry.colors[C]),c.vertexColors[1].copy(X.geometry.colors[C-1])),T.elements.push(c)));for(n=0,g=T.sprites.length;n<g;n++)X=T.sprites[n].object,d=X.matrixWorld,X instanceof r.Sprite&&(A.set(d.elements[12],d.elements[13],d.elements[14],1),A.applyMatrix4(R),$=1/A.w,A.z*=$,-1<A.z&&1>A.z&&(f===S?(q=new r.RenderableSprite,M.push(q),S++,f++,p=q):p=M[f++],p.id=X.id,p.x=A.x*$,p.y=A.y*$,p.z=A.z,p.object=X,p.rotation=X.rotation,p.scale.x=X.scale.x*Math.abs(p.x-(A.x+m.projectionMatrix.elements[0])/(A.w+m.projectionMatrix.elements[12])),p.scale.y=X.scale.y*Math.abs(p.y-(A.y+m.projectionMatrix.elements[5])/(A.w+m.projectionMatrix.elements[13])),p.material=X.material,T.elements.push(p)));return!0===y&&T.elements.sort(t),T}},r.Face3=function(e,t,i,n,o,a){this.a=e,this.b=t,this.c=i,this.normal=n instanceof r.Vector3?n:new r.Vector3,this.vertexNormals=n instanceof Array?n:[],this.color=o instanceof r.Color?o:new r.Color,this.vertexColors=o instanceof Array?o:[],this.vertexTangents=[],this.materialIndex=void 0!==a?a:0,this.centroid=new r.Vector3},r.Face3.prototype={constructor:r.Face3,clone:function(){var e,t,i=new r.Face3(this.a,this.b,this.c);for(i.normal.copy(this.normal),i.color.copy(this.color),i.centroid.copy(this.centroid),i.materialIndex=this.materialIndex,e=0,t=this.vertexNormals.length;e<t;e++)i.vertexNormals[e]=this.vertexNormals[e].clone();for(e=0,t=this.vertexColors.length;e<t;e++)i.vertexColors[e]=this.vertexColors[e].clone();for(e=0,t=this.vertexTangents.length;e<t;e++)i.vertexTangents[e]=this.vertexTangents[e].clone();return i}},r.Face4=function(e,t,i,n,o,a,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new r.Face3(e,t,i,o,a,s)},r.Geometry=function(){this.id=r.GeometryIdCount++,this.uuid=r.Math.generateUUID(),this.name="",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.hasTangents=!1,this.dynamic=!0,this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},r.Geometry.prototype={constructor:r.Geometry,applyMatrix:function(e){for(var t=(new r.Matrix3).getNormalMatrix(e),i=0,n=this.vertices.length;i<n;i++)this.vertices[i].applyMatrix4(e);for(i=0,n=this.faces.length;i<n;i++){var o=this.faces[i];o.normal.applyMatrix3(t).normalize();for(var a=0,s=o.vertexNormals.length;a<s;a++)o.vertexNormals[a].applyMatrix3(t).normalize();o.centroid.applyMatrix4(e)}this.boundingBox instanceof r.Box3&&this.computeBoundingBox(),this.boundingSphere instanceof r.Sphere&&this.computeBoundingSphere()},computeCentroids:function(){var e,t,i;for(e=0,t=this.faces.length;e<t;e++)(i=this.faces[e]).centroid.set(0,0,0),i.centroid.add(this.vertices[i.a]),i.centroid.add(this.vertices[i.b]),i.centroid.add(this.vertices[i.c]),i.centroid.divideScalar(3)},computeFaceNormals:function(){for(var e=new r.Vector3,t=new r.Vector3,i=0,n=this.faces.length;i<n;i++){var o=this.faces[i],a=this.vertices[o.a],s=this.vertices[o.b];e.subVectors(this.vertices[o.c],s),t.subVectors(a,s),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){var t,i,n,o;if(void 0===this.__tmpVertices){for(o=this.__tmpVertices=Array(this.vertices.length),t=0,i=this.vertices.length;t<i;t++)o[t]=new r.Vector3;for(t=0,i=this.faces.length;t<i;t++)(n=this.faces[t]).vertexNormals=[new r.Vector3,new r.Vector3,new r.Vector3]}else for(o=this.__tmpVertices,t=0,i=this.vertices.length;t<i;t++)o[t].set(0,0,0);if(e){var a,s,h=new r.Vector3,l=new r.Vector3;
1for(new r.Vector3,new r.Vector3,new r.Vector3,t=0,i=this.faces.length;t<i;t++)n=this.faces[t],e=this.vertices[n.a],a=this.vertices[n.b],s=this.vertices[n.c],h.subVectors(s,a),l.subVectors(e,a),h.cross(l),o[n.a].add(h),o[n.b].add(h),o[n.c].add(h)}else for(t=0,i=this.faces.length;t<i;t++)o[(n=this.faces[t]).a].add(n.normal),o[n.b].add(n.normal),o[n.c].add(n.normal);for(t=0,i=this.vertices.length;t<i;t++)o[t].normalize();for(t=0,i=this.faces.length;t<i;t++)(n=this.faces[t]).vertexNormals[0].copy(o[n.a]),n.vertexNormals[1].copy(o[n.b]),n.vertexNormals[2].copy(o[n.c])},computeMorphNormals:function(){var e,t,i,n,o;for(i=0,n=this.faces.length;i<n;i++)for((o=this.faces[i]).__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;e<t;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var a=new r.Geometry;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[],o=this.morphNormals[e].faceNormals;var s,h,l=this.morphNormals[e].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)s=new r.Vector3,h={a:new r.Vector3,b:new r.Vector3,c:new r.Vector3},o.push(s),l.push(h)}for(l=this.morphNormals[e],a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)o=this.faces[i],s=l.faceNormals[i],h=l.vertexNormals[i],s.copy(o.normal),h.a.copy(o.vertexNormals[0]),h.b.copy(o.vertexNormals[1]),h.c.copy(o.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;
1i++)(o=this.faces[i]).normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){var e,t,i,n,o,a,s,h,l,c,u,p,f,d,m,g,v,y=[],x=[];i=new r.Vector3;var _=new r.Vector3,w=new r.Vector3,b=new r.Vector3,M=new r.Vector3;for(e=0,t=this.vertices.length;e<t;e++)y[e]=new r.Vector3,x[e]=new r.Vector3;for(e=0,t=this.faces.length;e<t;e++)o=this.faces[e],a=this.faceVertexUvs[0][e],n=o.a,v=o.b,o=o.c,s=this.vertices[n],h=this.vertices[v],l=this.vertices[o],c=a[0],u=a[1],p=a[2],a=h.x-s.x,f=l.x-s.x,d=h.y-s.y,m=l.y-s.y,h=h.z-s.z,s=l.z-s.z,l=u.x-c.x,g=p.x-c.x,u=u.y-c.y,p=1/(l*(c=p.y-c.y)-g*u),i.set((c*a-u*f)*p,(c*d-u*m)*p,(c*h-u*s)*p),_.set((l*f-g*a)*p,(l*m-g*d)*p,(l*s-g*h)*p),y[n].add(i),y[v].add(i),y[o].add(i),x[n].add(_),x[v].add(_),x[o].add(_);for(_=["a","b","c","d"],e=0,t=this.faces.length;e<t;e++)for(o=this.faces[e],i=0;i<Math.min(o.vertexNormals.length,3);i++)M.copy(o.vertexNormals[i]),v=y[n=o[_[i]]],w.copy(v),w.sub(M.multiplyScalar(M.dot(v))).normalize(),b.crossVectors(o.vertexNormals[i],v),n=0>(n=b.dot(x[n]))?-1:1,o.vertexTangents[i]=new r.Vector4(w.x,w.y,w.z,n);this.hasTangents=!0},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,r=t.length;i<r;i++)0<i&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new r.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var e,t,i,r={},n=[],o=[],a=Math.pow(10,4);for(this.__tmpVertices=void 0,t=0,i=this.vertices.length;t<i;t++)e=this.vertices[t],void 0===r[e=Math.round(e.x*a)+"_"+Math.round(e.y*a)+"_"+Math.round(e.z*a)]?(r[e]=t,n.push(this.vertices[t]),o[t]=n.length-1):o[t]=o[r[e]];for(r=[],t=0,i=this.faces.length;t<i;t++)for((a=this.faces[t]).a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],e=0;3>e;e++)if(a[e]==a[(e+1)%3]){r.push(t);break}for(t=r.length-1;0<=t;t--)for(a=r[t],this.faces.splice(a,1),o=0,i=this.faceVertexUvs.length;o<i;o++)this.faceVertexUvs[o].splice(a,1);return t=this.vertices.length-n.length,this.vertices=n,t},clone:function(){for(var e=new r.Geometry,t=this.vertices,i=0,n=t.length;i<n;i++)e.vertices.push(t[i].clone());for(i=0,n=(t=this.faces).length;i<n;i++)e.faces.push(t[i].clone());for(i=0,n=(t=this.faceVertexUvs[0]).length;i<n;i++){for(var o=t[i],a=[],s=0,h=o.length;s<h;s++)a.push(new r.Vector2(o[s].x,o[s].y));e.faceVertexUvs[0].push(a)}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},r.EventDispatcher.prototype.apply(r.Geometry.prototype),r.GeometryIdCount=0,r.BufferGeometry=function(){this.id=r.GeometryIdCount++,this.uuid=r.Math.generateUUID(),this.name="",this.attributes={},this.dynamic=!0,this.offsets=[],this.boundingSphere=this.boundingBox=null,this.hasTangents=!1,this.morphTargets=[]},r.BufferGeometry.prototype={constructor:r.BufferGeometry,addAttribute:function(e,t,i,r){this.attributes[e]={itemSize:r,array:new t(i*r)}},applyMatrix:function(e){var t,i;this.attributes.position&&(t=this.attributes.position.array),this.attributes.normal&&(i=this.attributes.normal.array),void 0!==t&&(e.multiplyVector3Array(t),this.verticesNeedUpdate=!0),void 0!==i&&((new r.Matrix3).getNormalMatrix(e).multiplyVector3Array(i),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var e=this.attributes.position.array;if(e){var t,i,n,o=this.boundingBox;3<=e.length&&(o.min.x=o.max.x=e[0],o.min.y=o.max.y=e[1],o.min.z=o.max.z=e[2]);for(var a=3,s=e.length;a<s;a+=3)t=e[a],i=e[a+1],n=e[a+2],t<o.min.x?o.min.x=t:t>o.max.x&&(o.max.x=t),i<o.min.y?o.min.y=i:i>o.max.y&&(o.max.y=i),n<o.min.z?o.min.z=n:n>o.max.z&&(o.max.z=n)}void 0!==e&&0!==e.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0))},computeBoundingSphere:function(){var e=new r.Box3,t=new r.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere);var i=this.attributes.position.array;if(i){for(var n=this.boundingSphere.center,o=0,a=i.length;o<a;o+=3)t.set(i[o],i[o+1],i[o+2]),e.addPoint(t);e.center(n);var s=0;for(o=0,a=i.length;o<a;o+=3)t.set(i[o],i[o+1],i[o+2]),s=Math.max(s,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(s)}}}(),computeVertexNormals:function(){if(this.attributes.position){var e,t,i,n;if(e=this.attributes.position.array.length,void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(e)};else for(e=0,t=this.attributes.normal.array.length;e<t;e++)this.attributes.normal.array[e]=0;var o,a,s,h,l,c,u=this.attributes.position.array,p=this.attributes.normal.array,f=new r.Vector3,d=new r.Vector3,m=new r.Vector3,g=new r.Vector3,v=new r.Vector3;if(this.attributes.index){var y=this.attributes.index.array,x=this.offsets;for(i=0,n=x.length;i<n;++i){t=x[i].start,o=x[i].count;var _=x[i].index;for(e=t,t+=o;e<t;e+=3)o=_+y[e],a=_+y[e+1],s=_+y[e+2],h=u[3*o],l=u[3*o+1],c=u[3*o+2],f.set(h,l,c),h=u[3*a],l=u[3*a+1],c=u[3*a+2],d.set(h,l,c),h=u[3*s],l=u[3*s+1],c=u[3*s+2],m.set(h,l,c),g.subVectors(m,d),v.subVectors(f,d),g.cross(v),p[3*o]+=g.x,p[3*o+1]+=g.y,p[3*o+2]+=g.z,p[3*a]+=g.x,p[3*a+1]+=g.y,p[3*a+2]+=g.z,p[3*s]+=g.x,p[3*s+1]+=g.y,p[3*s+2]+=g.z}}else for(e=0,t=u.length;e<t;e+=9)h=u[e],l=u[e+1],c=u[e+2],f.set(h,l,c),h=u[e+3],l=u[e+4],c=u[e+5],d.set(h,l,c),h=u[e+6],l=u[e+7],c=u[e+8],m.set(h,l,c),g.subVectors(m,d),v.subVectors(f,d),g.cross(v),p[e]=g.x,p[e+1]=g.y,p[e+2]=g.z,p[e+3]=g.x,p[e+4]=g.y,p[e+5]=g.z,p[e+6]=g.x,p[e+7]=g.y,p[e+8]=g.z;this.normalizeNormals(),this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var e,t,i,r=this.attributes.normal.array,n=0,o=r.length;n<o;n+=3)e=r[n],t=r[n+1],i=r[n+2],e=1/Math.sqrt(e*e+t*t+i*i),r[n]*=e,r[n+1]*=e,r[n+2]*=e},computeTangents:function(){function e(e){I.x=n[3*e],I.y=n[3*e+1],I.z=n[3*e+2],k.copy(I),z=h[e],O.copy(z),O.sub(I.multiplyScalar(I.dot(z))).normalize(),B.crossVectors(k,z),N=B.dot(l[e]),U=0>N?-1:1,s[4*e]=O.x,s[4*e+1]=O.y,s[4*e+2]=O.z,s[4*e+3]=U}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var t=this.attributes.index.array,i=this.attributes.position.array,n=this.attributes.normal.array,o=this.attributes.uv.array,a=i.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*a)});for(var s=this.attributes.tangent.array,h=[],l=[],c=0;c<a;c++)h[c]=new r.Vector3,l[c]=new r.Vector3;a=new r.Vector3,c=new r.Vector3;var u,p,f,d,m,g,v,y,x,_,w,b,M,S,T,C,A,E,L,P,D,R,F=this.offsets;for(E=0,L=F.length;E<L;++E){A=F[E].start,P=F[E].count;var V=F[E].index;for(C=A,A+=P;C<A;C+=3)P=V+t[C],D=V+t[C+1],R=V+t[C+2],u=i[3*P],p=i[3*P+1],f=i[3*P+2],d=i[3*D],m=i[3*D+1],g=i[3*D+2],v=i[3*R],y=i[3*R+1],x=i[3*R+2],_=o[2*P],w=o[2*P+1],b=o[2*D],M=o[2*D+1],S=o[2*R],d-=u,u=v-u,m-=p,p=y-p,g-=f,f=x-f,M-=w,T=1/((b-=_)*(w=(T=o[2*R+1])-w)-(_=S-_)*M),a.set((w*d-M*u)*T,(w*m-M*p)*T,(w*g-M*f)*T),c.set((b*u-_*d)*T,(b*p-_*m)*T,(b*f-_*g)*T),h[P].add(a),h[D].add(a),h[R].add(a),l[P].add(c),l[D].add(c),l[R].add(c)}var U,z,N,O=new r.Vector3,B=new r.Vector3,I=new r.Vector3,k=new r.Vector3;for(E=0,L=F.length;E<L;++E)for(A=F[E].start,P=F[E].count,V=F[E].index,C=A,A+=P;C<A;C+=3)P=V+t[C],D=V+t[C+1],R=V+t[C+2],e(P),e(D),e(R);this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var e,t=new r.BufferGeometry,i=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
1];for(e in this.attributes){for(var n=(a=this.attributes[e]).array,o={itemSize:a.itemSize,numItems:a.numItems,array:null},a=0,s=i.length;a<s;a++){var h=i[a];if(n instanceof h){o.array=new h(n);break}}t.attributes[e]=o}for(a=0,s=this.offsets.length;a<s;a++)i=this.offsets[a],t.offsets.push({start:i.start,index:i.index,count:i.count});return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},r.EventDispatcher.prototype.apply(r.BufferGeometry.prototype),r.Camera=function(){r.Object3D.call(this),this.matrixWorldInverse=new r.Matrix4,this.projectionMatrix=new r.Matrix4,this.projectionMatrixInverse=new r.Matrix4},r.Camera.prototype=Object.create(r.Object3D.prototype),r.Camera.prototype.lookAt=function(){var e=new r.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),r.Camera.prototype.clone=function(e){return void 0===e&&(e=new r.Camera),r.Object3D.prototype.clone.call(this,e),e.matrixWorldInverse.copy(this.matrixWorldInverse),e.projectionMatrix.copy(this.projectionMatrix),e.projectionMatrixInverse.copy(this.projectionMatrixInverse),e},r.OrthographicCamera=function(e,t,i,n,o,a){r.Camera.call(this),this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=void 0!==o?o:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},r.OrthographicCamera.prototype=Object.create(r.Camera.prototype),r.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)},r.OrthographicCamera.prototype.clone=function(){var e=new r.OrthographicCamera;return r.Camera.prototype.clone.call(this,e),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e},r.PerspectiveCamera=function(e,t,i,n){r.Camera.call(this),this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.updateProjectionMatrix()},r.PerspectiveCamera.prototype=Object.create(r.Camera.prototype),r.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*r.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},r.PerspectiveCamera.prototype.setViewOffset=function(e,t,i,r,n,o){this.fullWidth=e,this.fullHeight=t,this.x=i,this.y=r,this.width=n,this.height=o,this.updateProjectionMatrix()},r.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var e=this.fullWidth/this.fullHeight,t=Math.tan(r.Math.degToRad(.5*this.fov))*this.near,i=e*(n=-t),n=(e=Math.abs(e*t-i),Math.abs(t-n));this.projectionMatrix.makeFrustum(i+this.x*e/this.fullWidth,i+(this.x+this.width)*e/this.fullWidth,t-(this.y+this.height)*n/this.fullHeight,t-this.y*n/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)},r.PerspectiveCamera.prototype.clone=function(){var e=new r.PerspectiveCamera;return r.Camera.prototype.clone.call(this,e),e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e},r.Light=function(e){r.Object3D.call(this),this.color=new r.Color(e)},r.Light.prototype=Object.create(r.Object3D.prototype),r.Light.prototype.clone=function(e){return void 0===e&&(e=new r.Light),r.Object3D.prototype.clone.call(this,e),e.color.copy(this.color),e},r.AmbientLight=function(e){r.Light.call(this,e)},r.AmbientLight.prototype=Object.create(r.Light.prototype),r.AmbientLight.prototype.clone=function(){var e=new r.AmbientLight;return r.Light.prototype.clone.call(this,e),e},r.AreaLight=function(e,t){r.Light.call(this,e),this.normal=new r.Vector3(0,-1,0),this.right=new r.Vector3(1,0,0),this.intensity=void 0!==t?t:1,this.height=this.width=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},r.AreaLight.prototype=Object.create(r.Light.prototype),r.DirectionalLight=function(e,t){r.Light.call(this,e),this.position.set(0,1,0),this.target=new r.Object3D,this.intensity=void 0!==t?t:1,this.onlyShadow=this.castShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraTop=this.shadowCameraRight=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapHeight=this.shadowMapWidth=512,this.shadowCascade=!1,this.shadowCascadeOffset=new r.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null},r.DirectionalLight.prototype=Object.create(r.Light.prototype),r.DirectionalLight.prototype.clone=function(){var e=new r.DirectionalLight;return r.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.
1intensity=this.intensity,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e},r.HemisphereLight=function(e,t,i){r.Light.call(this,e),this.position.set(0,100,0),this.groundColor=new r.Color(t),this.intensity=void 0!==i?i:1},r.HemisphereLight.prototype=Object.create(r.Light.prototype),r.HemisphereLight.prototype.clone=function(){var e=new r.HemisphereLight;return r.Light.prototype.clone.call(this,e),e.groundColor.copy(this.groundColor),e.intensity=this.intensity,e},r.PointLight=function(e,t,i){r.Light.call(this,e),this.intensity=void 0!==t?t:1,this.distance=void 0!==i?i:0},r.PointLight.prototype=Object.create(r.Light.prototype),r.PointLight.prototype.clone=function(){var e=new r.PointLight;return r.Light.prototype.clone.call(this,e),e.intensity=this.intensity,e.distance=this.distance,e},r.SpotLight=function(e,t,i,n,o){r.Light.call(this,e),this.position.set(0,1,0),this.target=new r.Object3D,this.intensity=void 0!==t?t:1,this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.exponent=void 0!==o?o:10,this.onlyShadow=this.castShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapHeight=this.shadowMapWidth=512,this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null},r.SpotLight.prototype=Object.create(r.Light.prototype),r.SpotLight.prototype.clone=function(){var e=new r.SpotLight;return r.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.distance=this.distance,e.angle=this.angle,e.exponent=this.exponent,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e},r.Loader=function(e){this.statusDomElement=(this.showStatus=e)?r.Loader.prototype.addStatusElement():null,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},r.Loader.prototype={constructor:r.Loader,crossOrigin:"anonymous",addStatusElement:function(){var e=document.createElement("div");return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";t=e.total?t+((100*e.loaded/e.total).toFixed(0)+"%"):t+((e.loaded/1e3).toFixed(2)+" KB");this.statusDomElement.innerHTML=t},extractUrlBase:function(e){return(e=e.split("/")).pop(),(1>e.length?".":e.join("/"))+"/"},initMaterials:function(e,t){for(var i=[],n=0;n<e.length;++n)i[n]=r.Loader.prototype.createMaterial(e[n],t);return i},needsTangents:function(e){for(var t=0,i=e.length;t<i;t++)if(e[t]instanceof r.ShaderMaterial)return!0;return!1},createMaterial:function(e,t){function i(e){return e=Math.log(e)/Math.LN2,Math.floor(e)==e}function n(e){return e=Math.log(e)/Math.LN2,Math.pow(2,Math.round(e))}function o(e,o,a,h,l,c,u){var p=/\.dds$/i.test(a),f=t+"/"+a;if(p){var d=r.ImageUtils.loadCompressedTexture(f);e[o]=d}else d=document.createElement("canvas"),e[o]=new r.Texture(d);if(e[o].sourceFile=a,h&&(e[o].repeat.set(h[0],h[1]),1!==h[0]&&(e[o].wrapS=r.RepeatWrapping),1!==h[1]&&(e[o].wrapT=r.RepeatWrapping)),l&&e[o].offset.set(l[0],l[1]),c&&(void 0!==(a={repeat:r.RepeatWrapping,mirror:r.MirroredRepeatWrapping})[c[0]]&&(e[o].wrapS=a[c[0]]),void 0!==a[c[1]]&&(e[o].wrapT=a[c[1]])),u&&(e[o].anisotropy=u),!p){var m=e[o];(e=new Image).onload=function(){if(i(this.width)&&i(this.height))m.image=this;else{var e=n(this.width),t=n(this.height);m.image.width=e,m.image.height=t,m.image.getContext("2d").drawImage(this,0,0,e,t)}m.needsUpdate=!0},e.crossOrigin=s.crossOrigin,e.src=f}}function a(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]}var s=this,h="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(e.shading){var c=e.shading.toLowerCase();"phong"===c?h="MeshPhongMaterial":"basic"===c&&(h="MeshBasicMaterial")}return void 0!==e.blending&&void 0!==r[e.blending]&&(l.blending=r[e.blending]),(void 0!==e.transparent||1>e.opacity)&&(l.transparent=e.transparent),void 0!==e.depthTest&&(l.depthTest=e.depthTest),void 0!==e.depthWrite&&(l.depthWrite=e.depthWrite),void 0!==e.visible&&(l.visible=e.visible),void 0!==e.flipSided&&(l.side=r.BackSide),void 0!==e.doubleSided&&(l.side=r.DoubleSide),void 0!==e.wireframe&&(l.wireframe=e.wireframe),void 0!==e.vertexColors&&("face"===e.vertexColors?l.vertexColors=r.FaceColors:e.vertexColors&&(l.vertexColors=r.VertexColors)),e.colorDiffuse?l.color=a(e.colorDiffuse):e.DbgColor&&(l.color=e.DbgColor),e.colorSpecular&&(l.specular=a(e.colorSpecular)),e.colorAmbient&&(l.ambient=a(e.colorAmbient)),e.transparency&&(l.opacity=e.transparency),e.specularCoef&&(l.shininess=e.specularCoef),e.mapDiffuse&&t&&o(l,"map",e.mapDiffuse,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy),e.mapLight&&t&&o(l,"lightMap",e.mapLight,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy),e.mapBump&&t&&o(l,"bumpMap",e.mapBump,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy),e.mapNormal&&t&&o(l,"normalMap",e.mapNormal,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy),e.mapSpecular&&t&&o(l,"specularMap",e.mapSpecular,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy),e.mapBumpScale&&(l.bumpScale=e.mapBumpScale),e.mapNormal?(h=r.ShaderLib.normalmap,(c=r.UniformsUtils.clone(h.uniforms)
1).tNormal.value=l.normalMap,e.mapNormalFactor&&c.uNormalScale.value.set(e.mapNormalFactor,e.mapNormalFactor),l.map&&(c.tDiffuse.value=l.map,c.enableDiffuse.value=!0),l.specularMap&&(c.tSpecular.value=l.specularMap,c.enableSpecular.value=!0),l.lightMap&&(c.tAO.value=l.lightMap,c.enableAO.value=!0),c.uDiffuseColor.value.setHex(l.color),c.uSpecularColor.value.setHex(l.specular),c.uAmbientColor.value.setHex(l.ambient),c.uShininess.value=l.shininess,void 0!==l.opacity&&(c.uOpacity.value=l.opacity),h=new r.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:c,lights:!0,fog:!0}),l.transparent&&(h.transparent=!0)):h=new r[h](l),void 0!==e.DbgName&&(h.name=e.DbgName),h}},r.XHRLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.XHRLoader.prototype={constructor:r.XHRLoader,load:function(e,t,i,r){var n=this,o=new XMLHttpRequest;void 0!==t&&o.addEventListener("load",(function(i){t(i.target.responseText),n.manager.itemEnd(e)}),!1),void 0!==i&&o.addEventListener("progress",(function(e){i(e)}),!1),void 0!==r&&o.addEventListener("error",(function(e){r(e)}),!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),o.open("GET",e,!0),o.send(null),n.manager.itemStart(e)},setCrossOrigin:function(e){this.crossOrigin=e}},r.ImageLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.ImageLoader.prototype={constructor:r.ImageLoader,load:function(e,t,i,r){var n=this,o=document.createElement("img");return void 0!==t&&o.addEventListener("load",(function(){n.manager.itemEnd(e),t(this)}),!1),void 0!==i&&o.addEventListener("progress",(function(e){i(e)}),!1),void 0!==r&&o.addEventListener("error",(function(e){r(e)}),!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),o.src=e,n.manager.itemStart(e),o},setCrossOrigin:function(e){this.crossOrigin=e}},r.JSONLoader=function(e){r.Loader.call(this,e),this.withCredentials=!1},r.JSONLoader.prototype=Object.create(r.Loader.prototype),r.JSONLoader.prototype.load=function(e,t,i){i=i&&"string"===typeof i?i:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,i)},r.JSONLoader.prototype.loadAjaxJSON=function(e,t,i,r,n){var o=new XMLHttpRequest,a=0;o.onreadystatechange=function(){if(o.readyState===o.DONE)if(200===o.status||0===o.status){if(o.responseText){var s=JSON.parse(o.responseText);s=e.parse(s,r);i(s.geometry,s.materials)}else console.warn("THREE.JSONLoader: ["+t+"] seems to be unreachable or file there is empty");e.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+t+"] ["+o.status+"]");else o.readyState===o.LOADING?n&&(0===a&&(a=o.getResponseHeader("Content-Length")),n({total:a,loaded:o.responseText.length})):o.readyState===o.HEADERS_RECEIVED&&void 0!==n&&(a=o.getResponseHeader("Content-Length"))},o.open("GET",t,!0),o.withCredentials=this.withCredentials,o.send(null)},r.JSONLoader.prototype.parse=function(e,t){var i,n,o,a,s,h,l,c,u,p,f,d,m,g,v=new r.Geometry,y=void 0!==e.scale?1/e.scale:1,x=e.faces;u=e.vertices;var _=e.normals,w=e.colors,b=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&b++;for(i=0;i<b;i++)v.faceVertexUvs[i]=[]}for(a=0,s=u.length;a<s;)(h=new r.Vector3).x=u[a++]*y,h.y=u[a++]*y,h.z=u[a++]*y,v.vertices.push(h);for(a=0,s=x.length;a<s;)if(p=1&(u=x[a++]),o=2&u,i=8&u,l=16&u,f=32&u,h=64&u,u&=128,p){if((p=new r.Face3).a=x[a],p.b=x[a+1],p.c=x[a+3],(d=new r.Face3).a=x[a+1],d.b=x[a+2],d.c=x[a+3],a+=4,o&&(o=x[a++],p.materialIndex=o,d.materialIndex=o),o=v.faces.length,i)for(i=0;i<b;i++)for(m=e.uvs[i],v.faceVertexUvs[i][o]=[],v.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)g=m[2*(c=x[a++])],c=m[2*c+1],g=new r.Vector2(g,c),2!==n&&v.faceVertexUvs[i][o].push(g),0!==n&&v.faceVertexUvs[i][o+1].push(g);if(l&&(l=3*x[a++],p.normal.set(_[l++],_[l++],_[l]),d.normal.copy(p.normal)),f)for(i=0;4>i;i++)l=3*x[a++],f=new r.Vector3(_[l++],_[l++],_[l]),2!==i&&p.vertexNormals.push(f),0!==i&&d.vertexNormals.push(f);if(h&&(h=w[h=x[a++]],p.color.setHex(h),d.color.setHex(h)),u)for(i=0;4>i;i++)h=w[h=x[a++]],2!==i&&p.vertexColors.push(new r.Color(h)),0!==i&&d.vertexColors.push(new r.Color(h));v.faces.push(p),v.faces.push(d)}else{if((p=new r.Face3).a=x[a++],p.b=x[a++],p.c=x[a++],o&&(o=x[a++],p.materialIndex=o),o=v.faces.length,i)for(i=0;i<b;i++)for(m=e.uvs[i],v.faceVertexUvs[i][o]=[],n=0;3>n;n++)g=m[2*(c=x[a++])],c=m[2*c+1],g=new r.Vector2(g,c),v.faceVertexUvs[i][o].push(g);
1if(l&&(l=3*x[a++],p.normal.set(_[l++],_[l++],_[l])),f)for(i=0;3>i;i++)l=3*x[a++],f=new r.Vector3(_[l++],_[l++],_[l]),p.vertexNormals.push(f);if(h&&(h=x[a++],p.color.setHex(w[h])),u)for(i=0;3>i;i++)h=x[a++],p.vertexColors.push(new r.Color(w[h]));v.faces.push(p)}if(e.skinWeights)for(a=0,s=e.skinWeights.length;a<s;a+=2)x=e.skinWeights[a],_=e.skinWeights[a+1],v.skinWeights.push(new r.Vector4(x,_,0,0));if(e.skinIndices)for(a=0,s=e.skinIndices.length;a<s;a+=2)x=e.skinIndices[a],_=e.skinIndices[a+1],v.skinIndices.push(new r.Vector4(x,_,0,0));if(v.bones=e.bones,v.animation=e.animation,v.animations=e.animations,void 0!==e.morphTargets)for(a=0,s=e.morphTargets.length;a<s;a++)for(v.morphTargets[a]={},v.morphTargets[a].name=e.morphTargets[a].name,v.morphTargets[a].vertices=[],w=v.morphTargets[a].vertices,x=0,_=(b=e.morphTargets[a].vertices).length;x<_;x+=3)(u=new r.Vector3).x=b[x]*y,u.y=b[x+1]*y,u.z=b[x+2]*y,w.push(u);if(void 0!==e.morphColors)for(a=0,s=e.morphColors.length;a<s;a++)for(v.morphColors[a]={},v.morphColors[a].name=e.morphColors[a].name,v.morphColors[a].colors=[],_=v.morphColors[a].colors,y=0,x=(w=e.morphColors[a].colors).length;y<x;y+=3)(b=new r.Color(16755200)).setRGB(w[y],w[y+1],w[y+2]),_.push(b);return v.computeCentroids(),v.computeFaceNormals(),v.computeBoundingSphere(),void 0===e.materials?{geometry:v}:(y=this.initMaterials(e.materials,t),this.needsTangents(y)&&v.computeTangents(),{geometry:v,materials:y})},r.LoadingManager=function(e,t,i){var r=this,n=0,o=0;this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(){o++},this.itemEnd=function(e){n++,void 0!==r.onProgress&&r.onProgress(e,n,o),n===o&&void 0!==r.onLoad&&r.onLoad()}},r.DefaultLoadingManager=new r.LoadingManager,r.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.BufferGeometryLoader.prototype={constructor:r.BufferGeometryLoader,load:function(e,t){var i=this,n=new r.XHRLoader;n.setCrossOrigin(this.crossOrigin),n.load(e,(function(e){t(i.parse(JSON.parse(e)))}))},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t,i=new r.BufferGeometry,o=e.attributes,a=e.offsets;e=e.boundingSphere;for(t in o){var s=o[t];i.attributes[t]={itemSize:s.itemSize,array:new n[s.type](s.array)}}return void 0!==a&&(i.offsets=JSON.parse(JSON.stringify(a))),void 0!==e&&(i.boundingSphere=new r.Sphere((new r.Vector3).fromArray(void 0!==e.center?e.center:[0,0,0]),e.radius)),i}},r.GeometryLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.GeometryLoader.prototype={constructor:r.GeometryLoader,load:function(e,t){var i=this,n=new r.XHRLoader;n.setCrossOrigin(this.crossOrigin),n.load(e,(function(e){t(i.parse(JSON.parse(e)))}))},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(){}},r.MaterialLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.MaterialLoader.prototype={constructor:r.MaterialLoader,load:function(e,t){var i=this,n=new r.XHRLoader;n.setCrossOrigin(this.crossOrigin),n.load(e,(function(e){t(i.parse(JSON.parse(e)))}))},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new r[e.type];if(void 0!==e.color&&t.color.setHex(e.color),void 0!==e.ambient&&t.ambient.setHex(e.ambient),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.materials)for(var i=0,n=e.materials.length;i<n;i++)t.materials.push(this.parse(e.materials[i]));return t}},r.ObjectLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.ObjectLoader.prototype={constructor:r.ObjectLoader,load:function(e,t){var i=this,n=new r.XHRLoader(i.manager);n.setCrossOrigin(this.crossOrigin),n.load(e,(function(e){t(i.parse(JSON.parse(e)))}))},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=this.parseGeometries(e.geometries),i=this.parseMaterials(e.materials);return this.parseObject(e.object,t,i)},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new r.JSONLoader,n=new r.BufferGeometryLoader,o=0,a=e.length;o<a;o++){var s,h=e[o];switch(h.type){case"PlaneGeometry":s=new r.PlaneGeometry(h.width,h.height,h.widthSegments,h.heightSegments);break;case"CircleGeometry":s=new r.CircleGeometry(h.radius,h.segments);break;case"CubeGeometry":s=new r.CubeGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CylinderGeometry":s=new r.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radiusSegments,h.heightSegments,h.openEnded);break;case"SphereGeometry":s=new r.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"IcosahedronGeometry":s=new r.IcosahedronGeometry(h.radius,h.detail);break;case"TorusGeometry":s=new r.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":s=new r.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case"BufferGeometry":s=n.parse(h.data);break;case"Geometry":s=i.parse(h.data).geometry}s.uuid=h.uuid,void 0!==h.name&&(s.name=h.name),t[h.uuid]=s}return t},parseMaterials:function(e){var t={};if(void 0!==e)for(var i=new r.MaterialLoader,n=0,o=e.length;n<o;n++){var a=e[n],s=i.parse(a);s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),t[a.uuid]=s}return t},parseObject:function(){var e=new r.Matrix4;return function(t,i,n){var o;switch(t.type){case"Scene":o=new r.Scene;break;case"PerspectiveCamera":o=new r.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;
1case"OrthographicCamera":o=new r.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new r.AmbientLight(t.color);break;case"DirectionalLight":o=new r.DirectionalLight(t.color,t.intensity);break;case"PointLight":o=new r.PointLight(t.color,t.intensity,t.distance);break;case"SpotLight":o=new r.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent);break;case"HemisphereLight":o=new r.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":o=i[t.geometry];var a=n[t.material];void 0===o&&console.error("THREE.ObjectLoader: Undefined geometry "+t.geometry),void 0===a&&console.error("THREE.ObjectLoader: Undefined material "+t.material),o=new r.Mesh(o,a);break;default:o=new r.Object3D}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var s in t.children)o.add(this.parseObject(t.children[s],i,n));return o}}()},r.SceneLoader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){},this.callbackSync=function(){},this.callbackProgress=function(){},this.geometryHandlers={},this.hierarchyHandlers={},this.addGeometryHandler("ascii",r.JSONLoader)},r.SceneLoader.prototype={constructor:r.SceneLoader,load:function(e,t){var i=this,n=new r.XHRLoader(i.manager);n.setCrossOrigin(this.crossOrigin),n.load(e,(function(r){i.parse(JSON.parse(r),t,e)}))},setCrossOrigin:function(e){this.crossOrigin=e},addGeometryHandler:function(e,t){this.geometryHandlers[e]={loaderClass:t}},addHierarchyHandler:function(e,t){this.hierarchyHandlers[e]={loaderClass:t}},parse:function(e,t,i){function n(e,t){return"relativeToHTML"==t?e:E+"/"+e}function o(){!function e(t,i){var o,a,h,l,c,d,m;for(m in i){var x=M.objects[m],_=i[m];if(void 0===x){if(_.type&&_.type in A.hierarchyHandlers){if(void 0===_.loading){for(var w in a={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1},h={},_)w in a||(h[w]=_[w]);p=M.materials[_.material],_.loading=!0,(a=A.hierarchyHandlers[_.type].loaderObject).options?a.load(n(_.url,P.urlBaseType),s(m,t,p,_)):a.load(n(_.url,P.urlBaseType),s(m,t,p,_),h)}}else if(void 0!==_.geometry){if(u=M.geometries[_.geometry]){if(x=!1,p=M.materials[_.material],x=p instanceof r.ShaderMaterial,h=_.position,l=_.rotation,c=_.scale,o=_.matrix,d=_.quaternion,_.material||(p=new r.MeshFaceMaterial(M.face_materials[_.geometry])),p instanceof r.MeshFaceMaterial&&0===p.materials.length&&(p=new r.MeshFaceMaterial(M.face_materials[_.geometry])),p instanceof r.MeshFaceMaterial)for(a=0;a<p.materials.length;a++)x=x||p.materials[a]instanceof r.ShaderMaterial;x&&u.computeTangents(),_.skin?x=new r.SkinnedMesh(u,p):_.morph?(x=new r.MorphAnimMesh(u,p),void 0!==_.duration&&(x.duration=_.duration),void 0!==_.time&&(x.time=_.time),void 0!==_.mirroredLoop&&(x.mirroredLoop=_.mirroredLoop),p.morphNormals&&u.computeMorphNormals()):x=new r.Mesh(u,p),x.name=m,o?(x.matrixAutoUpdate=!1,x.matrix.set(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],o[12],o[13],o[14],o[15])):(x.position.fromArray(h),d?x.quaternion.fromArray(d):x.rotation.fromArray(l),x.scale.fromArray(c)),x.visible=_.visible,x.castShadow=_.castShadow,x.receiveShadow=_.receiveShadow,t.add(x),M.objects[m]=x}}else"DirectionalLight"===_.type||"PointLight"===_.type||"AmbientLight"===_.type?(v=void 0!==_.color?_.color:16777215,y=void 0!==_.intensity?_.intensity:1,"DirectionalLight"===_.type?(h=_.direction,(g=new r.DirectionalLight(v,y)).position.fromArray(h),_.target&&(L.push({object:g,targetName:_.target}),g.target=null)):"PointLight"===_.type?(h=_.position,a=_.distance,(g=new r.PointLight(v,y,a)).position.fromArray(h)):"AmbientLight"===_.type&&(g=ne
1w r.AmbientLight(v)),t.add(g),g.name=m,M.lights[m]=g,M.objects[m]=g):"PerspectiveCamera"===_.type||"OrthographicCamera"===_.type?(h=_.position,l=_.rotation,d=_.quaternion,"PerspectiveCamera"===_.type?f=new r.PerspectiveCamera(_.fov,_.aspect,_.near,_.far):"OrthographicCamera"===_.type&&(f=new r.OrthographicCamera(_.left,_.right,_.top,_.bottom,_.near,_.far)),f.name=m,f.position.fromArray(h),void 0!==d?f.quaternion.fromArray(d):void 0!==l&&f.rotation.fromArray(l),t.add(f),M.cameras[m]=f,M.objects[m]=f):(h=_.position,l=_.rotation,c=_.scale,d=_.quaternion,(x=new r.Object3D).name=m,x.position.fromArray(h),d?x.quaternion.fromArray(d):x.rotation.fromArray(l),x.scale.fromArray(c),x.visible=void 0!==_.visible&&_.visible,t.add(x),M.objects[m]=x,M.empties[m]=x);if(x){if(void 0!==_.userData)for(var b in _.userData)x.userData[b]=_.userData[b];if(void 0!==_.groups)for(a=0;a<_.groups.length;a++)h=_.groups[a],void 0===M.groups[h]&&(M.groups[h]=[]),M.groups[h].push(m)}}void 0!==x&&void 0!==_.children&&e(x,_.children)}}(M.scene,P.objects)}function a(e){return function(t,i){t.name=e,M.geometries[e]=t,M.face_materials[e]=i,o(),x-=1,A.onLoadComplete(),l()}}function s(e,t,i,r){return function(n){n=n.content?n.content:n.dae?n.scene:n;var a=r.rotation,s=r.quaternion,h=r.scale;n.position.fromArray(r.position),s?n.quaternion.fromArray(s):n.rotation.fromArray(a),n.scale.fromArray(h),i&&n.traverse((function(e){e.material=i}));var c=void 0===r.visible||r.visible;n.traverse((function(e){e.visible=c})),t.add(n),n.name=e,M.objects[e]=n,o(),x-=1,A.onLoadComplete(),l()}}function h(e){return function(t,i){t.name=e,M.geometries[e]=t,M.face_materials[e]=i}}function l(){if(A.callbackProgress({totalModels:w,totalTextures:b,loadedModels:w-x,loadedTextures:b-_},M),A.onLoadProgress(),0===x&&0===_){for(var e=0;e<L.length;e++){var i=L[e],n=M.objects[i.targetName];n?i.object.target=n:(i.object.target=new r.Object3D,M.scene.add(i.object.target)),i.object.target.userData.targetInverse=i.object}t(M)}}function c(e,t){if(t(e),void 0!==e.children)for(var i in e.children)c(e.children[i],t)}var u,p,f,d,m,g,v,y,x,_,w,b,M,S,T,C,A=this,E=r.Loader.prototype.extractUrlBase(i),L=[],P=e;for(S in this.geometryHandlers)e=this.geometryHandlers[S].loaderClass,this.geometryHandlers[S].loaderObject=new e;for(S in this.hierarchyHandlers)e=this.hierarchyHandlers[S].loaderClass,this.hierarchyHandlers[S].loaderObject=new e;for(var D in _=x=0,M={scene:new r.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}},P.transform&&(S=P.transform.position,e=P.transform.rotation,i=P.transform.scale,S&&M.scene.position.fromArray(S),e&&M.scene.rotation.fromArray(e),i&&M.scene.scale.fromArray(i),S||e||i)&&(M.scene.updateMatrix(),M.scene.updateMatrixWorld()),S=function(e){return function(){_-=e,l(),A.onLoadComplete()}},P.fogs)"linear"===(e=P.fogs[D]).type?d=new r.Fog(0,e.near,e.far):"exp2"===e.type&&(d=new r.FogExp2(0,e.density)),e=e.color,d.color.setRGB(e[0],e[1],e[2]),M.fogs[D]=d;for(var R in P.geometries)(d=P.geometries[R]).type in this.geometryHandlers&&(x+=1,A.onLoadStart());for(var F in P.objects)c(P.objects[F],(function(e){e.type&&e.type in A.hierarchyHandlers&&(x+=1,A.onLoadStart())}));for(R in w=x,P.geometries)if("cube"===(d=P.geometries[R]).type)(u=new r.CubeGeometry(d.width,d.height,d.depth,d.widthSegments,d.heightSegments,d.depthSegments)).name=R,M.geometries[R]=u;else if("plane"===d.type)(u=new r.PlaneGeometry(d.width,d.height,d.widthSegments,d.heightSegments)).name=R,M.geometries[R]=u;else if("sphere"===d.type)(u=new r.SphereGeometry(d.radius,d.widthSegments,d.heightSegments)).name=R,M.geometries[R]=u;else if("cylinder"===d.type)(u=new r.CylinderGeometry(d.topRad,d.botRad,d.height,d.radSegs,d.heightSegs)).name=R,M.geometries[R]=u;else if("torus"===d.type)(u=new r.TorusGeometry(d.radius,d.tube,d.segmentsR,d.segmentsT)).name=R,M.geometries[R]=u;else if("icosahedron"===d.type)(u=new r.IcosahedronGeometry(d.radius,d.subdivisions)).name=R,M.geometries[R]=u;else if(d.type in this.geometryHandlers){for(m in F={},d)"type"!==m&&"url"!==m&&(F[m]=d[m]);this.geometryHandlers[d.type].loaderObject.load(n(d.url,P.urlBaseType),a(R),F)}else"embedded"===d.type&&((F=P.embeds[d.id]).metadata=P.metadata,F&&(F=this.geometryHandlers.ascii.loaderObject.parse(F,""),h(R)(F.geometry,F.materials)));for(var V in P.textures)if((R=P.textures[V]).url instanceof Array)for(_+=R.url.length,m=0;m<R.url.length;m++)A.onLoadStart();else _+=1,A.onLoadStart();for(V in b=_,P.textures){if(void 0!==(R=P.textures[V]).mapping&&void 0!==r[R.mapping]&&(R.mapping=new r[R.mapping]),R.url instanceof Array){for(F=R.url.length,d=[],m=0;m<F;m++)d[m]=n(R.url[m],P.urlBaseType);m=(m=/\.dds$/i.test(d[0]))?r.ImageUtils.loadCompressedTextureCube(d,R.mapping,S(F)):r.ImageUtils.loadTextureCube(d,R.mapping,S(F))}else m=/\.dds$/i.test(R.url),F=n(R.url,P.urlBaseType),d=S(1),m=m?r.ImageUtils.loadCompressedTexture(F,R.mapping,d):r.ImageUtils.loadTexture(F,R.mapping,d),void 0!==r[R.minFilter]&&(m.minFilter=r[R.minFilter]),void 0!==r[R.magFilter]&&(m.magFilter=r[R.magFilter]),R.anisotropy&&(m.anisotropy=R.anisotropy),R.repeat&&(m.repeat.set(R.repeat[0],R.repeat[1]),1!==R.repeat[0]&&(m.wrapS=r.RepeatWrapping),1!==R.repeat[1]&&(m.wrapT=r.RepeatWrapping)),R.offset&&m.offset.set(R.offset[0],R.offset[1]),R.wrap&&(void 0!==(F={repeat:r.RepeatWrapping,mirror:r.MirroredRepeatWrapping})[R.wrap[0]]&&(m.wrapS=F[R.wrap[0]]),void 0!==F[R.wrap[1]]&&(m.wrapT=F[R.wrap[1]]));M.textures[V]=m}for(T in P.materials){for(C in(V=P.materials[T]).parameters)"envMap"===C||"map"===C||"lightMap"===C||"bumpMap"===C?V.parameters[C]=M.textures[V.parameters[C]]:"shading"===C?V.parameters[C]="flat"===V.parameters[C]?r.FlatShading:r.SmoothShading:"side"===C?V.parameters[C]="double"==V.parameters[C]?r.DoubleSide:"back"==V.parameters[C]?r.BackSide:r.FrontSide:"blending"===C?V.parameters[C]=V.parameters[C]in r?r[V.parameters[C]]:r.NormalBlending:"combine"===C?V.parameters[C]=V.parameters[C]in r?r[V.parameters[C]]:r.MultiplyOperation:"vertexColors"===C?"face"==V.parameters[C]?V.parameters[C]=r.FaceColors:V.parameters[C]&&(V.parameters[C]=r.VertexColors):"wrapRGB"===C&&(S=V.parameters[C],V.parameters[C]=new r.Vector3(S[0],S[1],S[2]));void 0!==V.parameters.opacity&&1>V.parameters.opacity&&(V.parameters.transparent=!0),V.parameters.normalMap?(S=r.ShaderLib.normalmap,R=r.UniformsUtils.clone(S.uniforms),m=V.parameters.color,F=V.parameters.specular,d=V.parameters.ambient,D=V.parameters.shininess,R.tNormal.value=M.textures[V.parameters.normalMap],V.parameters.normalScale&&R.uNormalScale.value.set(V.parameters.normalScale[0],V.parameters.normalScale[1]),V.parameters.map&&(R.tDiffuse.value=V.parameters.map,R.enableDiffuse.value=!0),V.parameters.envMap&&(R.tCube.value=V.parameters.envMap,R.enableReflection.value=!0,R.uReflectivity.value=V.parameters.reflectivity),V.parameters.lightMap&&(R.tAO.value=V.parameters.lightMap,R.enableAO.value=!0),V.parameters.specularMap&&(R.tSpecular.value=M.textures[V.parameters.specularMap],R.enableSpecular.value=!0),V.parameters.displacementMap&&(R.tDisplacement.value=M.textures[V.parameters.displacementMap],R.enableDisplacement.value=!0,R.uDisplacementBias.value=V.parameters.displacementBias,R.uDisplacementScale.value=V.parameters.displacementScale),R.uDiffuseColor.value.setHex(m),R.uSpecularColor.value.setHex(F),R.uAmbientColor.value.setHex(d),R.uShininess.value=D,V.parameters.opacity&&(R.uOpacity.value=V.parameters.opacity),p=new r.ShaderMaterial({fragmentShader:S.fragmentShader,vertexShader:S.vertexShader,uniforms:R,lights:!0,fog:!0})):p=new r[V.type](V.parameters),p.name=T,M.materials[T]=p}for(T in P.materials)if((V=P.materials[T]).parameters.materials){for(C=[],m=0;m<V.parameters.materials.length;m++)C.push(M.materials[V.parameters.materials[m]]);M.materials[T].materials=C}o(),M.cameras&&P.defaults.camera&&(M.currentCamera=M.cameras[P.defaults.camera]),M.fogs&&P.defaults.fog&&(M.scene.fog=M.fogs[P.defaults.fog]),A.callbackSync(M),l()}},r.TextureLoader=function(e){this.manager=void 0!==e?e:r.DefaultLoadingManager},r.TextureLoader.prototype={constructor:r.TextureLoader,load:function(e,t){var i=new r.ImageLoader(this.manager);i.setCrossOrigin(this.crossOrigin),i.load(e,(function(e){(e=new r.Texture(e)).needsUpdate=!0,void 0!==t&&t(e)}))},setCrossOrigin:function(e){this.crossOrigin=e}},r.Material=function(){this.id=r.MaterialIdCount++,this.uuid=r.Math.generateUUID(),this.name="",this.side=r.FrontSide,this.opacity=1,this.transparent=!1,this.blending=r.NormalBlending,this.blendSrc=r.SrcAlphaFactor,this.blendDst=r.OneMinusSrcAlphaFactor,this.blendEquation=r.AddEquation,this.depthWrite=this.depthTest=!0,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.needsUpdate=this.visible=!0},r.Material.prototype={constructor:r.Material,setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0===i)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else if(t in this){var n=this[t];n instanceof r.Color?n.set(i):n instanceof r.Vector3&&i instanceof r.Vector3?n.copy(i):this[t]="overdraw"==t?Number(i):i}}},clone:function(e){return void 0===e&&(e=new r.Material),e.name=this.name,e.side=this.side,e.opacity=this.opacity,e.transparent=this.transparent,e.blending=this.blending,e.blendSrc=this.blendSrc,e.blendDst=this.blendDst,e.blendEquation=this.blendEquation,e.depthTest=this.depthTest,e.depthWrite=this.depthWrite,e.polygonOffset=this.polygonOffset,e.polygonOffsetFactor=this.polygonOffsetFactor,e.polygonOffsetUnits=this.polygonOffsetUnits,e.alphaTest=this.alphaTest,e.overdraw=this.overdraw,e.visible=this.visible,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},r.EventDispatcher.prototype.apply(r.Material.prototype),r.MaterialIdCount=0,r.LineBasicMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=!1,this.fog=!0,this.setValues(e)},r.LineBasicMaterial.prototype=Object.create(r.Material.prototype),r.LineBasicMaterial.prototype.clone=function(){var e=new r.LineBasicMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.linecap=this.linecap,e.linejoin=this.linejoin,e.vertexColors=this.vertexColors,e.fog=this.fog,e},r.LineDashedMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},r.LineDashedMaterial.prototype=Object.create(r.Material.prototype),r.LineDashedMaterial.prototype.clone=function(){var e=new r.LineDashedMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.scale=this.scale,e.dashSize=this.dashSize,e.gapSize=this.gapSize,e.vertexColors=this.vertexColors,e.fog=this.fog,e}
1,r.MeshBasicMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.envMap=this.specularMap=this.lightMap=this.map=null,this.combine=r.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=r.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=r.NoColors,this.morphTargets=this.skinning=!1,this.setValues(e)},r.MeshBasicMaterial.prototype=Object.create(r.Material.prototype),r.MeshBasicMaterial.prototype.clone=function(){var e=new r.MeshBasicMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e},r.MeshLambertMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.ambient=new r.Color(16777215),this.emissive=new r.Color(0),this.wrapAround=!1,this.wrapRGB=new r.Vector3(1,1,1),this.envMap=this.specularMap=this.lightMap=this.map=null,this.combine=r.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=r.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=r.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},r.MeshLambertMaterial.prototype=Object.create(r.Material.prototype),r.MeshLambertMaterial.prototype.clone=function(){var e=new r.MeshLambertMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy(this.emissive),e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},r.MeshPhongMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.ambient=new r.Color(16777215),this.emissive=new r.Color(0),this.specular=new r.Color(1118481),this.shininess=30,this.metal=!1,this.perPixel=!0,this.wrapAround=!1,this.wrapRGB=new r.Vector3(1,1,1),this.bumpMap=this.lightMap=this.map=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r.Vector2(1,1),this.envMap=this.specularMap=null,this.combine=r.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=r.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=r.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},r.MeshPhongMaterial.prototype=Object.create(r.Material.prototype),r.MeshPhongMaterial.prototype.clone=function(){var e=new r.MeshPhongMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy(this.emissive),e.specular.copy(this.specular),e.shininess=this.shininess,e.metal=this.metal,e.perPixel=this.perPixel,e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.bumpMap=this.bumpMap,e.bumpScale=this.bumpScale,e.normalMap=this.normalMap,e.normalScale.copy(this.normalScale),e.specularMap=this.specularMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},r.MeshDepthMaterial=function(e){r.Material.call(this),this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},r.MeshDepthMaterial.prototype=Object.create(r.Material.prototype),r.MeshDepthMaterial.prototype.clone=function(){var e=new r.MeshDepthMaterial;return r.Material.prototype.clone.call(this,e),e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},r.MeshNormalMaterial=function(e){r.Material.call(this,e),this.shading=r.FlatShading,this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},r.MeshNormalMaterial.prototype=Object.create(r.Material.prototype),r.MeshNormalMaterial.prototype.clone=function(){var e=new r.MeshNormalMaterial;return r.Material.prototype.clone.call(this,e),e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},r.MeshFaceMaterial=function(e){this.materials=e instanceof Array?e:[]},r.MeshFaceMaterial.prototype.clone=function(){for(var e=new r.MeshFaceMaterial,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e},r.ParticleSystemMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=!1,this.fog=!0,this.setValues(e)},r.ParticleSystemMaterial.prototype=Object.create(r.Material.prototype),r.ParticleSystemMaterial.prototype.clone=function(){var e=new r.ParticleSystemMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.size=this.size,e.sizeAttenuation=this.sizeAttenuation,e.vertexColors=this.vertexColors,e.fog=this.fog,e},r.ParticleBasicMaterial=r.ParticleSystemMaterial,r.ShaderMaterial=function(e){r.Material.call(this),this.vertexShader=this.fragmentShader="void main() {}",this.uniforms={},this.defines={},this.attributes=null,this.shading=r.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=r.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName="position",this.setValues(e)},r.ShaderMaterial.prototype=Object.create(r.Material.prototype),r.ShaderMaterial.prototype.clone=function(){var e=new r.ShaderMaterial;return r.Material.prototype.clone.call(this,e),e.fragmentShader=this.fragmentShader,e.vertexShader=this.vertexShader,e.uniforms=r.UniformsUtils.clone(this.uniforms),e.attributes=this.attributes,e.defines=this.defines,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.fog=this.fog,e.lights=this.lights,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},r.SpriteMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.map=new r.Texture,this.useScreenCoordinates=!0,this.depthTest=!this.useScreenCoordinates,this.sizeAttenuation=!this.useScreenCoordinates,this.alignment=r.SpriteAlignment.center.clone(),this.fog=!1,this.uvOffset=new r.Vector2(0,0),this.uvScale=new r.Vector2(1,1),this.setValues(e),void 0===(e=e||{}).depthTest&&(this.depthTest=!this.useScreenCoordinates),void 0===e.sizeAttenuation&&(this.sizeAttenuation=!this.useScreenCoordinates)},r.SpriteMaterial.prototype=Object.create(r.Material.prototype),r.SpriteMaterial.prototype.clone=function(){var e=new r.SpriteMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.useScreenCoordinates=this.useScreenCoordinates,e.sizeAttenuation=this.sizeAttenuation,e.alignment.copy(this.alignment),e.uvOffset.copy(this.uvOffset),e.uvScale.copy(this.uvScale),e.fog=this.fog,e},r.SpriteAlignment={},r.SpriteAlignment.topLeft=new r.Vector2(.5,-.5),r.SpriteAlignment.topCenter=new r.Vector2(0,-.5),r.SpriteAlignment.topRight=new r.Vector2(-.5,-.5),r.SpriteAlignment.centerLeft=new r.Vector2(.5,0),r.SpriteAlignment.center=new r.Vector2(0,0),r.SpriteAlignment.centerRight=new r.Vector2(-.5,0),r.SpriteAlignment.bottomLeft=new r.Vector2(.5,.5),r.SpriteAlignment.bottomCenter=new r.Vector2(0,.5),r.SpriteAlignment.bottomRight=new r.Vector2(-.5,.5),r.SpriteCanvasMaterial=function(e){r.Material.call(this),this.color=new r.Color(16777215),this.program=function(){},this.setValues(e)},r.SpriteCanvasMaterial.prototype=Object.create(r.Material.prototype),r.SpriteCanvasMaterial.prototype.clone=function(){var e=new r.SpriteCanvasMaterial;return r.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.program=this.program,e},r.ParticleCanvasMaterial=r.SpriteCanvasMaterial,r.Texture=function(e,t,i,n,o,a,s,h,l){this.id=r.TextureIdCount++,this.uuid=r.Math.generateUUID(),this.name="",this.image=e,this.mipmaps=[],this.mapping=void 0!==t?t:new r.UVMapping,this.wrapS=void 0!==i?i:r.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:r.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:r.LinearFilter,this.minFilter=void 0!==a?a:r.LinearMipMapLinearFilter,this.anisotropy=void 0!==l?l:1,this.format=void 0!==s?s:r.RGBAFormat,this.type=void 0!==h?h:r.UnsignedByteType,this.offset=new r.Vector2(0,0),this.repeat=new r.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.needsUpdate=!1,this.onUpdate=null},r.Texture.prototype={constructor:r.Texture,clone:function(e){return void 0===e&&(e=new r.Texture),e.image=this.image,e.mipmaps=this.mipmaps.slice(0),e.mapping=this.mapping,e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.format=this.format,e.type=this.t
1ype,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.generateMipmaps=this.generateMipmaps,e.premultiplyAlpha=this.premultiplyAlpha,e.flipY=this.flipY,e.unpackAlignment=this.unpackAlignment,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},r.EventDispatcher.prototype.apply(r.Texture.prototype),r.TextureIdCount=0,r.CompressedTexture=function(e,t,i,n,o,a,s,h,l,c,u){r.Texture.call(this,null,a,s,h,l,c,n,o,u),this.image={width:t,height:i},this.mipmaps=e,this.generateMipmaps=!1},r.CompressedTexture.prototype=Object.create(r.Texture.prototype),r.CompressedTexture.prototype.clone=function(){var e=new r.CompressedTexture;return r.Texture.prototype.clone.call(this,e),e},r.DataTexture=function(e,t,i,n,o,a,s,h,l,c,u){r.Texture.call(this,null,a,s,h,l,c,n,o,u),this.image={data:e,width:t,height:i}},r.DataTexture.prototype=Object.create(r.Texture.prototype),r.DataTexture.prototype.clone=function(){var e=new r.DataTexture;return r.Texture.prototype.clone.call(this,e),e},r.ParticleSystem=function(e,t){r.Object3D.call(this),this.geometry=void 0!==e?e:new r.Geometry,this.material=void 0!==t?t:new r.ParticleSystemMaterial({color:16777215*Math.random()}),this.frustumCulled=this.sortParticles=!1},r.ParticleSystem.prototype=Object.create(r.Object3D.prototype),r.ParticleSystem.prototype.clone=function(e){return void 0===e&&(e=new r.ParticleSystem(this.geometry,this.material)),e.sortParticles=this.sortParticles,r.Object3D.prototype.clone.call(this,e),e},r.Line=function(e,t,i){r.Object3D.call(this),this.geometry=void 0!==e?e:new r.Geometry,this.material=void 0!==t?t:new r.LineBasicMaterial({color:16777215*Math.random()}),this.type=void 0!==i?i:r.LineStrip},r.LineStrip=0,r.LinePieces=1,r.Line.prototype=Object.create(r.Object3D.prototype),r.Line.prototype.clone=function(e){return void 0===e&&(e=new r.Line(this.geometry,this.material,this.type)),r.Object3D.prototype.clone.call(this,e),e},r.Mesh=function(e,t){r.Object3D.call(this),this.geometry=void 0!==e?e:new r.Geometry,this.material=void 0!==t?t:new r.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},r.Mesh.prototype=Object.create(r.Object3D.prototype),r.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},r.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},r.Mesh.prototype.clone=function(e){return void 0===e&&(e=new r.Mesh(this.geometry,this.material)),r.Object3D.prototype.clone.call(this,e),e},r.Bone=function(e){r.Object3D.call(this),this.skin=e,this.skinMatrix=new r.Matrix4},r.Bone.prototype=Object.create(r.Object3D.prototype),r.Bone.prototype.update=function(e,t){this.matrixAutoUpdate&&(t|=this.updateMatrix()),(t||this.matrixWorldNeedsUpdate)&&(e?this.skinMatrix.multiplyMatrices(e,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);var i,r=this.children.length;for(i=0;i<r;i++)this.children[i].update(this.skinMatrix,t)},r.SkinnedMesh=function(e,t,i){var n,o,a;if(r.Mesh.call(this,e,t),this.useVertexTexture=void 0===i||i,this.identityMatrix=new r.Matrix4,this.bones=[],this.boneMatrices=[],this.geometry&&void 0!==this.geometry.bones){for(e=0;e<this.geometry.bones.length;e++)n=(i=this.geometry.bones[e]).pos,o=i.rotq,a=i.scl,(t=this.addBone()).name=i.name,t.position.set(n[0],n[1],n[2]),t.quaternion.set(o[0],o[1],o[2],o[3]),void 0!==a?t.scale.set(a[0],a[1],a[2]):t.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)i=this.geometry.bones[e],t=this.bones[e],-1===i.parent?this.add(t):this.bones[i.parent].add(t);e=this.bones.length,this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=e=256<e?64:64<e?32:16<e?16:8,this.boneMatrices=new Float32Array(4*this.boneTextureWidth*this.boneTextureHeight),this.boneTexture=new r.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,r.RGBAFormat,r.FloatType),this.boneTexture.minFilter=r.NearestFilter,this.boneTexture.magFilter=r.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*e),this.pose()}},r.SkinnedMesh.prototype=Object.create(r.Mesh.prototype),r.SkinnedMesh.prototype.addBone=function(e){return void 0===e&&(e=new r.Bone(this)),this.bones.push(e),e},r.SkinnedMesh.prototype.updateMatrixWorld=function(){var e=new r.Matrix4;return function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix
1):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1);t=0;for(var i=this.children.length;t<i;t++){var n=this.children[t];n instanceof r.Bone?n.update(this.identityMatrix,!1):n.updateMatrixWorld(!0)}if(void 0==this.boneInverses)for(this.boneInverses=[],t=0,i=this.bones.length;t<i;t++)(n=new r.Matrix4).getInverse(this.bones[t].skinMatrix),this.boneInverses.push(n);for(t=0,i=this.bones.length;t<i;t++)e.multiplyMatrices(this.bones[t].skinMatrix,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),r.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0),this.normalizeSkinWeights()},r.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof r.Geometry)for(var e=0;e<this.geometry.skinIndices.length;e++){var t=this.geometry.skinWeights[e],i=1/t.lengthManhattan();1/0!==i?t.multiplyScalar(i):t.set(1)}},r.SkinnedMesh.prototype.clone=function(e){return void 0===e&&(e=new r.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),r.Mesh.prototype.clone.call(this,e),e},r.MorphAnimMesh=function(e,t){r.Mesh.call(this,e,t),this.duration=1e3,this.mirroredLoop=!1,this.currentKeyframe=this.lastKeyframe=this.time=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},r.MorphAnimMesh.prototype=Object.create(r.Mesh.prototype),r.MorphAnimMesh.prototype.setFrameRange=function(e,t){this.startKeyframe=e,this.endKeyframe=t,this.length=this.endKeyframe-this.startKeyframe+1},r.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},r.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},r.MorphAnimMesh.prototype.parseAnimations=function(){var e=this.geometry;e.animations||(e.animations={});for(var t,i=e.animations,r=/([a-z]+)(\d+)/,n=0,o=e.morphTargets.length;n<o;n++){var a=e.morphTargets[n].name.match(r);if(a&&1<a.length){i[a=a[1]]||(i[a]={start:1/0,end:-1/0});var s=i[a];n<s.start&&(s.start=n),n>s.end&&(s.end=n),t||(t=a)}}e.firstAnimation=t},r.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,i){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:i}},r.MorphAnimMesh.prototype.playAnimation=function(e,t){var i=this.geometry.animations[e];i?(this.setFrameRange(i.start,i.end),this.duration=(i.end-i.start)/t*1e3,this.time=0):console.warn("animation["+e+"] undefined")},r.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||0>this.time)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)):(this.time%=this.duration,0>this.time&&(this.time+=this.duration)),(e=this.startKeyframe+r.Math.clamp(Math.floor(this.time/t),0,this.length-1))!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[e]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=e),t=this.time%t/t,this.directionBackwards&&(t=1-t),this.morphTargetInfluences[this.currentKeyframe]=t,this.morphTargetInfluences[this.lastKeyframe]=1-t},r.MorphAnimMesh.prototype.clone=function(e){return void 0===e&&(e=new r.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,r.Mesh.prototype.clone.call(this,e),e},r.LOD=function(){r.Object3D.call(this),this.objects=[]},r.LOD.prototype=Object.create(r.Object3D.prototype),r.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0);t=Math.abs(t);for(var i=0;i<this.objects.length&&!(t<this.objects[i].distance);i++);this.objects.splice(i,0,{distance:t,object:e}),this.add(e)},r.LOD.prototype.getObjectForDistance=function(e){for(var t=1,i=this.objects.length;t<i&&!(e<this.objects[t].distance);t++);return this.objects[t-1].object},r.LOD.prototype.update=function(){var e=new r.Vector3,t=new r.Vector3;return function(i){if(1<this.objects.length){e.getPositionFromMatr
1ix(i.matrixWorld),t.getPositionFromMatrix(this.matrixWorld),i=e.distanceTo(t),this.objects[0].object.visible=!0;for(var r=1,n=this.objects.length;r<n&&i>=this.objects[r].distance;r++)this.objects[r-1].object.visible=!1,this.objects[r].object.visible=!0;for(;r<n;r++)this.objects[r].object.visible=!1}}}(),r.LOD.prototype.clone=function(){},r.Sprite=function(e){r.Object3D.call(this),this.material=void 0!==e?e:new r.SpriteMaterial,this.rotation=0},r.Sprite.prototype=Object.create(r.Object3D.prototype),r.Sprite.prototype.updateMatrix=function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},r.Sprite.prototype.clone=function(e){return void 0===e&&(e=new r.Sprite(this.material)),r.Object3D.prototype.clone.call(this,e),e},r.Particle=r.Sprite,r.Scene=function(){r.Object3D.call(this),this.overrideMaterial=this.fog=null,this.autoUpdate=!0,this.matrixAutoUpdate=!1,this.__lights=[],this.__objectsAdded=[],this.__objectsRemoved=[]},r.Scene.prototype=Object.create(r.Object3D.prototype),r.Scene.prototype.__addObject=function(e){if(e instanceof r.Light)-1===this.__lights.indexOf(e)&&this.__lights.push(e),e.target&&void 0===e.target.parent&&this.add(e.target);else if(!(e instanceof r.Camera||e instanceof r.Bone)){this.__objectsAdded.push(e);var t=this.__objectsRemoved.indexOf(e);-1!==t&&this.__objectsRemoved.splice(t,1)}for(t=0;t<e.children.length;t++)this.__addObject(e.children[t])},r.Scene.prototype.__removeObject=function(e){if(e instanceof r.Light){var t=this.__lights.indexOf(e);if(-1!==t&&this.__lights.splice(t,1),e.shadowCascadeArray)for(t=0;t<e.shadowCascadeArray.length;t++)this.__removeObject(e.shadowCascadeArray[t])}else e instanceof r.Camera||(this.__objectsRemoved.push(e),-1!==(t=this.__objectsAdded.indexOf(e))&&this.__objectsAdded.splice(t,1));for(t=0;t<e.children.length;t++)this.__removeObject(e.children[t])},r.Scene.prototype.clone=function(e){return void 0===e&&(e=new r.Scene),r.Object3D.prototype.clone.call(this,e),null!==this.fog&&(e.fog=this.fog.clone()),null!==this.overrideMaterial&&(e.overrideMaterial=this.overrideMaterial.clone()),e.autoUpdate=this.autoUpdate,e.matrixAutoUpdate=this.matrixAutoUpdate,e},r.Fog=function(e,t,i){this.name="",this.color=new r.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3},r.Fog.prototype.clone=function(){return new r.Fog(this.color.getHex(),this.near,this.far)},r.FogExp2=function(e,t){this.name="",this.color=new r.Color(e),this.density=void 0!==t?t:25e-5},r.FogExp2.prototype.clone=function(){return new r.FogExp2(this.color.getHex(),this.density)},r.CanvasRenderer=function(e){function t(e,t,i){for(var n=0,o=_.length;n<o;n++){var a=_[n];if(_e.copy(a.color),a instanceof r.DirectionalLight){var s=Le.getPositionFromMatrix(a.matrixWorld).normalize(),h=t.dot(s);0>=h||(h*=a.intensity,i.add(_e.multiplyScalar(h)))}else a instanceof r.PointLight&&(s=Le.getPositionFromMatrix(a.matrixWorld),0>=(h=t.dot(Le.subVectors(s,e).normalize()))||0!=(h*=0==a.distance?1:1-Math.min(e.distanceTo(s)/a.distance,1))&&(h*=a.intensity,i.add(_e.multiplyScalar(h))))}}function i(e,t,i,r){p(t),f(i),d(r),m(e.getStyle()),F.stroke(),Te.expandByScalar(2*t)}function o(e){g(e.getStyle()),F.fill()}function a(e,t,i,n,a,s,h,l,c,u,p,f,d){if(!(d instanceof r.DataTexture||void 0===d.image||0==d.image.width)){if(!0===d.needsUpdate){var m=d.wrapS==r.RepeatWrapping,v=d.wrapT==r.RepeatWrapping;we[d.id]=F.createPattern(d.image,!0===m&&!0===v?"repeat":!0===m&&!1===v?"repeat-x":!1===m&&!0===v?"repeat-y":"no-repeat"),d.needsUpdate=!1}void 0===we[d.id]?g("rgba(0,0,0,1)"):g(we[d.id]);m=d.offset.x/d.repeat.x,v=d.offset.y/d.repeat.y;var y=d.image.width*d.repeat.x,x=d.image.height*d.repeat.y;i=i-e,n=n-t,a=a-e,s=s-t;0===(m=(c=(c+m)*y-(h=(h+m)*y))*(f=(1-f+v)*x-(l=(1-l+v)*x))-(p=(p+m)*y-h)*(u=(1-u+v)*x-l))?(void 0===be[d.id]&&((t=document.createElement("canvas")).width=d.image.width,t.height=d.image.height,(t=t.getContext("2d")).drawImage(d.image,0,0),be[d.id]=t.getImageData(0,0,d.image.width,d.image.height).data),t=be[d.id],h=4*(Math.floor(h)+Math.floor(l)*d.image.width),fe.setRGB(t[h]/255,t[h+1]/255,t[h+2]/255),o(fe)):(e=e-(d=(f*i-u*a)*(m=1/m))*h-(i=(c*a-p*i)*m)*l,h=t-(u=(f*n-u*s)*m)*h-(n=(c*s-p*n)*m)*l,F.save(),F.transform(d,u,i,n,e,h),F.fill(),F.restore(
1))}}function s(e,t,i,r,n,o,a,s,h,l,c,u,p){var f,d;f=p.width-1,e=e-(f=((u=u*(d=p.height-1)-(s*=d))*(i-=e)-(l=l*d-s)*(n-=e))*(d=1/((h=h*f-(a*=f))*u-(c=c*f-a)*l)))*a-(i=(h*n-c*i)*d)*s,t=t-(l=(u*(r-=t)-l*(o-=t))*d)*a-(r=(h*o-c*r)*d)*s,F.save(),F.transform(f,l,i,r,e,t),F.clip(),F.drawImage(p,0,0),F.restore()}function h(e,t,i,r){return ce[0]=255*e.r|0,ce[1]=255*e.g|0,ce[2]=255*e.b|0,ce[4]=255*t.r|0,ce[5]=255*t.g|0,ce[6]=255*t.b|0,ce[8]=255*i.r|0,ce[9]=255*i.g|0,ce[10]=255*i.b|0,ce[12]=255*r.r|0,ce[13]=255*r.g|0,ce[14]=255*r.b|0,he.putImageData(le,0,0),pe.drawImage(se,0,0),ue}function l(e,t,i){var r=t.x-e.x,n=t.y-e.y,o=r*r+n*n;0!==o&&(r*=i/=Math.sqrt(o),n*=i,t.x+=r,t.y+=n,e.x-=r,e.y-=n)}function c(e){z!==e&&(z=F.globalAlpha=e)}function u(e){N!==e&&(e===r.NormalBlending?F.globalCompositeOperation="source-over":e===r.AdditiveBlending?F.globalCompositeOperation="lighter":e===r.SubtractiveBlending&&(F.globalCompositeOperation="darker"),N=e)}function p(e){I!==e&&(I=F.lineWidth=e)}function f(e){k!==e&&(k=F.lineCap=e)}function d(e){G!==e&&(G=F.lineJoin=e)}function m(e){O!==e&&(O=F.strokeStyle=e)}function g(e){B!==e&&(B=F.fillStyle=e)}function v(e,t){H===e&&W===t||(F.setLineDash([e,t]),H=e,W=t)}console.log("THREE.CanvasRenderer",r.REVISION);var y,x,_,w,b,M,S,T=r.Math.smoothstep,C=(e=e||{},this),A=new r.Projector,E=void 0!==e.canvas?e.canvas:document.createElement("canvas"),L=E.width,P=E.height,D=Math.floor(L/2),R=Math.floor(P/2),F=E.getContext("2d"),V=new r.Color(0),U=0,z=1,N=0,O=null,B=null,I=null,k=null,G=null,H=null,W=0;new r.RenderableVertex,new r.RenderableVertex;var j,X,Y,q,K,Q,Z,J,$,ee,te,ie,re,ne,oe,ae,se,he,le,ce,ue,pe,fe=new r.Color,de=new r.Color,me=new r.Color,ge=new r.Color,ve=new r.Color,ye=new r.Color,xe=new r.Color,_e=new r.Color,we={},be={},Me=new r.Box2,Se=new r.Box2,Te=new r.Box2,Ce=new r.Color,Ae=new r.Color,Ee=new r.Color,Le=new r.Vector3,Pe=16;(se=document.createElement("canvas")).width=se.height=2,(he=se.getContext("2d")).fillStyle="rgba(0,0,0,1)",he.fillRect(0,0,2,2),le=he.getImageData(0,0,2,2),ce=le.data,(ue=document.createElement("canvas")).width=ue.height=Pe,(pe=ue.getContext("2d")).translate(-Pe/2,-Pe/2),pe.scale(Pe,Pe),Pe--,void 0===F.setLineDash&&(F.setLineDash=void 0!==F.mozDash?function(e){F.mozDash=null!==e[0]?e:null}:function(){}),this.domElement=E,this.devicePixelRatio=void 0!==e.devicePixelRatio?e.devicePixelRatio:void 0!==n.devicePixelRatio?n.devicePixelRatio:1,this.sortElements=this.sortObjects=this.autoClear=!0,this.info={render:{vertices:0,faces:0}},this.supportsVertexTextures=function(){},this.setFaceCulling=function(){},this.setSize=function(e,t,i){L=e*this.devicePixelRatio,P=t*this.devicePixelRatio,D=Math.floor(L/2),R=Math.floor(P/2),E.width=L,E.height=P,1!==this.devicePixelRatio&&!1!==i&&(E.style.width=e+"px",E.style.height=t+"px"),Me.set(new r.Vector2(-D,-R),new r.Vector2(D,R)),Se.set(new r.Vector2(-D,-R),new r.Vector2(D,R)),z=1,N=0,G=k=I=B=O=null},this.setClearColor=function(e,t){V.set(e),U=void 0!==t?t:1,Se.set(new r.Vector2(-D,-R),new r.Vector2(D,R))},this.setClearColorHex=function(e,t){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(e,t)},this.getMaxAnisotropy=function(){return 0},this.clear=function(){F.setTransform(1,0,0,-1,D,R),!1===Se.empty()&&(Se.intersect(Me),Se.expandByScalar(2),1>U&&F.clearRect(0|Se.min.x,0|Se.min.y,Se.max.x-Se.min.x|0,Se.max.y-Se.min.y|0),0<U&&(u(r.NormalBlending),c(1),g("rgba("+Math.floor(255*V.r)+","+Math.floor(255*V.g)+","+Math.floor(255*V.b)+","+U+")"),F.fillRect(0|Se.min.x,0|Se.min.y,Se.max.x-Se.min.x|0,Se.max.y-Se.min.y|0)),Se.makeEmpty())},this.render=function(e,n){if(!1===n instanceof r.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear(),F.setTransform(1,0,0,-1,D,R),C.info.render.vertices=0,C.info.render.faces=0,y=A.projectScene(e,n,this.sortObjects,this.sortElements),x=y.elements,_=y.lights,w=n,Ce.setRGB(0,0,0),Ae.setRGB(0,0,0),Ee.setRGB(0,0,0);for(var E=0,L=_.length;E<L;E++){var P=(z=_[E]).color;z instanceof r.AmbientLight?Ce.add(P):z instanceof r.DirectionalLight?Ae.add(P):z instanceof r.PointLight&&Ee.add(P)}for(E=0,L=x.length;E<L;E++){var V=x[E],U=V.material;if(void 0!==U&&!1!==U.visible){if(Te.makeEmpty(),V instanceof r.RenderableSprite){(b=V).x*=D,b.y*=R;var z=b,N=(P=V,U);c(N.opacity),u(N.blending);var O=U=V=void 0,B=void 0,I=void 0,k=void 0,H=void 0;N instanceof r.SpriteMaterial||N instanceof r.ParticleSystemMaterial?void 0!==N.map.image?(k=(I=N.map.image).width>>1,H=I.height>>1,V=(O=P.scale.x*D)*k,U=(B=P.scale.y*R)*H,Te.min.set(z.x-V,z.y-U),Te.max.set(z.x+V,z.y+U),!1===Me.isIntersectionBox(Te)?Te.makeEmpty():(F.save(),F.translate(z.x,z.y),F.rotate(-P.rotation),F.scale(O,-B),F.translate(-k,-H),F.drawImage(I,0,0),F.restore(
1))):(O=P.object.scale.x,B=P.object.scale.y,O*=P.scale.x*D,B*=P.scale.y*R,Te.min.set(z.x-O,z.y-B),Te.max.set(z.x+O,z.y+B),!1===Me.isIntersectionBox(Te)?Te.makeEmpty():(g(N.color.getStyle()),F.save(),F.translate(z.x,z.y),F.rotate(-P.rotation),F.scale(O,B),F.fillRect(-1,-1,2,2),F.restore())):N instanceof r.SpriteCanvasMaterial&&(V=P.scale.x*D,U=P.scale.y*R,Te.min.set(z.x-V,z.y-U),Te.max.set(z.x+V,z.y+U),!1===Me.isIntersectionBox(Te)?Te.makeEmpty():(m(N.color.getStyle()),g(N.color.getStyle()),F.save(),F.translate(z.x,z.y),F.rotate(-P.rotation),F.scale(V,U),N.program(F),F.restore()))}else if(V instanceof r.RenderableLine){if(b=V.v1,M=V.v2,b.positionScreen.x*=D,b.positionScreen.y*=R,M.positionScreen.x*=D,M.positionScreen.y*=R,Te.setFromPoints([b.positionScreen,M.positionScreen]),!0===Me.isIntersectionBox(Te))if(z=b,P=M,N=V,c((V=U).opacity),u(V.blending),F.beginPath(),F.moveTo(z.positionScreen.x,z.positionScreen.y),F.lineTo(P.positionScreen.x,P.positionScreen.y),V instanceof r.LineBasicMaterial){if(p(V.linewidth),f(V.linecap),d(V.linejoin),V.vertexColors!==r.VertexColors)m(V.color.getStyle());else if((U=N.vertexColors[0].getStyle())===(N=N.vertexColors[1].getStyle()))m(U);else{try{var W=F.createLinearGradient(z.positionScreen.x,z.positionScreen.y,P.positionScreen.x,P.positionScreen.y);W.addColorStop(0,U),W.addColorStop(1,N)}catch(G){W=U}m(W)}F.stroke(),Te.expandByScalar(2*V.linewidth)}else V instanceof r.LineDashedMaterial&&(p(V.linewidth),f(V.linecap),d(V.linejoin),m(V.color.getStyle()),v(V.dashSize,V.gapSize),F.stroke(),Te.expandByScalar(2*V.linewidth),v(null,null))}else if(V instanceof r.RenderableFace3){if(b=V.v1,M=V.v2,S=V.v3,-1>b.positionScreen.z||1<b.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>S.positionScreen.z||1<S.positionScreen.z)continue;if(b.positionScreen.x*=D,b.positionScreen.y*=R,M.positionScreen.x*=D,M.positionScreen.y*=R,S.positionScreen.x*=D,S.positionScreen.y*=R,0<U.overdraw&&(l(b.positionScreen,M.positionScreen,U.overdraw),l(M.positionScreen,S.positionScreen,U.overdraw),l(S.positionScreen,b.positionScreen,U.overdraw)),Te.setFromPoints([b.positionScreen,M.positionScreen,S.positionScreen]),!0===Me.isIntersectionBox(Te)){z=b,P=M,N=S,C.info.render.vertices+=3,C.info.render.faces++,c(U.opacity),u(U.blending),j=z.positionScreen.x,X=z.positionScreen.y,Y=P.positionScreen.x,q=P.positionScreen.y,K=N.positionScreen.x,Q=N.positionScreen.y;O=j,B=X,I=Y,k=q,H=K;var se=Q;F.beginPath(),F.moveTo(O,B),F.lineTo(I,k),F.lineTo(H,se),F.closePath(),(U instanceof r.MeshLambertMaterial||U instanceof r.MeshPhongMaterial)&&null===U.map?(ye.copy(U.color),xe.copy(U.emissive),U.vertexColors===r.FaceColors&&ye.multiply(V.color),!1===U.wireframe&&U.shading==r.SmoothShading&&3==V.vertexNormalsLength?(de.copy(Ce),me.copy(Ce),ge.copy(Ce),t(V.v1.positionWorld,V.vertexNormalsModel[0],de),t(V.v2.positionWorld,V.vertexNormalsModel[1],me),t(V.v3.positionWorld,V.vertexNormalsModel[2],ge),de.multiply(ye).add(xe),me.multiply(ye).add(xe),ge.multiply(ye).add(xe),ve.addColors(me,ge).multiplyScalar(.5),$=h(de,me,ge,ve),s(j,X,Y,q,K,Q,0,0,1,0,0,1,$)):(fe.copy(Ce),t(V.centroidModel,V.normalModel,fe),fe.multiply(ye).add(xe),!0===U.wireframe?i(fe,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):o(fe))):U instanceof r.MeshBasicMaterial||U instanceof r.MeshLambertMaterial||U instanceof r.MeshPhongMaterial?null!==U.map?U.map.mapping instanceof r.UVMapping&&(ee=V.uvs[0],a(j,X,Y,q,K,Q,ee[0].x,ee[0].y,ee[1].x,ee[1].y,ee[2].x,ee[2].y,U.map)):null!==U.envMap?U.envMap.mapping instanceof r.SphericalReflectionMapping&&(Le.copy(V.vertexNormalsModelView[0]),te=.5*Le.x+.5,ie=.5*Le.y+.5,Le.copy(V.vertexNormalsModelView[1]),re=.5*Le.x+.5,ne=.5*Le.y+.5,Le.copy(V.vertexNormalsModelView[2]),oe=.5*Le.x+.5,ae=.5*Le.y+.5,a(j,X,Y,q,K,Q,te,ie,re,ne,oe,ae,U.envMap)):(fe.copy(U.color),U.vertexColors===r.FaceColors&&fe.multiply(V.color),!0===U.wireframe?i(fe,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):o(fe)):U instanceof r.MeshDepthMaterial?(Z=w.near,J=w.far,de.r=de.g=de.b=1-T(z.positionScreen.z*z.positionScreen.w,Z,J),me.r=me.g=me.b=1-T(P.positionScreen.z*P.positionScreen.w,Z,J),ge.r=ge.g=ge.b=1-T(N.positionScreen.z*N.positionScreen.w,Z,J),ve.addColors(me,ge).multiplyScalar(.5),$=h(de,me,ge,ve),s(j,X,Y,q,K,Q,0,0,1,0,0,1,$)):U instanceof r.MeshNormalMaterial&&(z=void 0,U.shading==r.FlatShading?(z=V.normalModelView,fe.setRGB(z.x,z.y,z.z).multiplyScalar(.5).addScalar(.5),!0===U.wireframe?i(fe,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):o(fe)):U.shading==r.SmoothShading&&(z=V.vertexNormalsModelView[0],de.setRGB(z.x,z.y,z.z).multiplyScalar(.5).addScalar(.5),z=V.vertexNormalsModelView[1],me.setRGB(z.x,z.y,z.z).multiplyScalar(.5).addScalar(.5),z=V.vertexNormalsModelView[2],ge.setRGB(z.x,z.y,z.z).multiplyScalar(.5).addScalar(.5),ve.addColors(me,ge).multiplyScalar(.5),$=h(de,me,ge,ve),s(j,X,Y,q,K,Q,0,0,1,0,0,1,$)))}}Se.union(Te)}}F.setTransform(1,0,0,1,0,0)}}},r.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );
1\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;
1\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif",map_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\nvec4 texelColor = texture2D( map, vUv );\n#ifdef GAMMA_INPUT\ntexelColor.xyz *= texelColor.xyz;\n#endif\ngl_FragColor = gl_FragColor * texelColor;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx( vUv );\nvec2 dSTdy = dFdy( vUv );\nfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\nfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\nfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\nreturn vec2( dBx, dBy );\n}\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\nvec3 vSigmaX = dFdx( surf_pos );\nvec3 vSigmaY = dFdy( surf_pos );\nvec3 vN = surf_norm;\nvec3 R1 = cross( vSigmaY, vN );\nvec3 R2 = cross( vN, vSigmaX );\nfloat fDet = dot( vSigmaX, R1 );\nvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\nreturn normalize( abs( fDet ) * surf_norm - vGrad );\n}\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\nuniform sampler2D normalMap;\nuniform vec2 normalScale;\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\nvec3 q0 = dFdx( eye_pos.xyz );\nvec3 q1 = dFdy( eye_pos.xyz );\nvec2 st0 = dFdx( vUv.st );\nvec2 st1 = dFdy( vUv.st );\nvec3 S = normalize(  q0 * st1.t - q1 * st0.t );\nvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\nvec3 N = normalize( surf_norm );\nvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\nmapN.xy = normalScale * mapN.xy;\nmat3 tsn = mat3( S, T, N );\nreturn normalize( tsn * mapN );\n}\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D( specularMap, vUv );\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];
1\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\nvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n#ifdef DOUBLE_SIDED\nvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",lights_phong_pars_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];
1\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif",lights_phong_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvWorldPosition = worldPosition.xyz;\n#endif",lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#ifdef USE_NORMALMAP\nnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\nnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse  = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse  += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}
1\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse  = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse  = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse  += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse  = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += diffuse * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += specular * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;
1\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n#ifdef BONE_TEXTURE\nuniform sampler2D boneTexture;\nuniform int boneTextureWidth;\nuniform int boneTextureHeight;\nmat4 getBoneMatrix( const in float i ) {\nfloat j = i * 4.0;\nfloat x = mod( j, float( boneTextureWidth ) );\nfloat y = floor( j / float( boneTextureWidth ) );\nfloat dx = 1.0 / float( boneTextureWidth );\nfloat dy = 1.0 / float( boneTextureHeight );\ny = dy * ( y + 0.5 );\nvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\nvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\nvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\nvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\nmat4 bone = mat4( v1, v2, v3, v4 );\nreturn bone;\n}\n#else\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\nmat4 getBoneMatrix( const in float i ) {\nmat4 bone = boneGlobalMatrices[ int(i) ];\nreturn bone;\n}\n#endif\n#endif",skinbase_vertex:"#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix( skinIndex.x );\nmat4 boneMatY = getBoneMatrix( skinIndex.y );\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n#ifdef USE_MORPHTARGETS\nvec4 skinVertex = vec4( morphed, 1.0 );\n#else\nvec4 skinVertex = vec4( position, 1.0 );\n#endif\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\n#endif",default_vertex:"vec4 mvPosition;\n#ifdef USE_SKINNING\nmvPosition = modelViewMatrix * skinned;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( position, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal +=  ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal +=  ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal +=  ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal +=  ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix \t+= skinWeight.y * boneMatY;\n#ifdef USE_MORPHNORMALS\nvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n#else\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif\n#endif",defaultnormal_vertex:"vec3 objectNormal;\n#ifdef USE_SKINNING\nobjectNormal = skinnedNormal.xyz;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\nobjectNormal = morphedNormal;\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\nobjectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\nobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];
1\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\nfloat shadow = 0.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.0 * xPixelOffset;\nfloat dy0 = -1.0 * yPixelOffset;\nfloat dx1 = 1.0 * xPixelOffset;\nfloat dy1 = 1.0 * yPixelOffset;\nmat3 shadowKernel;\nmat3 depthKernel;\ndepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\ndepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\ndepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\ndepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\ndepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\ndepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\ndepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\ndepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\ndepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nvec3 shadowZ = vec3( shadowCoord.z );\nshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\nshadowKernel[0] *= vec3(0.25);\nshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\nshadowKernel[1] *= vec3(0.25);\nshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\nshadowKernel[2] *= vec3(0.25);
1\nvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\nshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\nshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\nvec4 shadowValues;\nshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\nshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\nshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\nshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\nshadow = dot( shadowValues, vec4( 1.0 ) );\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"},r.UniformsUtils={merge:function(e){var t,i,r,n={};for(t=0;t<e.length;t++)for(i in r=this.clone(e[t]))n[i]=r[i];return n},clone:function(e){var t,i,n,o={};for(t in e)for(i in o[t]={},e[t])n=e[t][i],o[t][i]=n instanceof r.Color||n instanceof r.Vector2||n instanceof r.Vector3||n instanceof r.Vector4||n instanceof r.Matrix4||n instanceof r.Texture?n.clone():n instanceof Array?n.slice():n;return o}},r.UniformsLib={common:{diffuse:{type:"c",value:new r.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new r.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new r.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new r.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new r.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new r.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},r.ShaderLib={basic:{uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.shadowmap]),vertexShader:[r.ShaderChunk.map_pars_vertex,r.ShaderChunk.lightmap_pars_vertex,r.ShaderChunk.envmap_pars_vertex,r.ShaderChunk.color_pars_vertex,r.ShaderChunk.morphtarget_pars_vertex,r.ShaderChunk.skinning_pars_vertex,r.ShaderChunk.shadowmap_pars_vertex,"void main() {",r.ShaderChunk.map_vertex,r.ShaderChunk.lightmap_vertex,r.ShaderChunk.color_vertex,r.ShaderChunk.skinbase_vertex,"#ifdef USE_ENVMAP",r.ShaderChunk.morphnormal_vertex,r.ShaderChunk.skinnormal_vertex,r.ShaderChunk.defaultnormal_vertex,"#endif",r.ShaderChunk.morphtarget_vertex,r.ShaderChunk.skinning_vertex,r.ShaderChunk.default_vertex,r.ShaderChunk.worldpos_vertex,r.ShaderChunk.envmap_vertex,r.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",r.ShaderChunk.color_pars_fragment,r.ShaderChunk.map_pars_fragment,r.ShaderChunk.lightmap_pars_fragment,r.ShaderChunk.envmap_pars_fragment,r.ShaderChunk.fog_pars_fragment,r.ShaderChunk.shadowmap_pars_fragment,r.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",r.ShaderChunk.map_fragment,r.ShaderChunk.alphatest_fragment,r.ShaderChunk.specularmap_fragment,r.ShaderChunk.lightmap_fragment,r.ShaderChunk.color_fragment,r.ShaderChunk.envmap_fragment,r.ShaderChunk.shadowmap_fragment,r.ShaderChunk.linear_to_gamma_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.lights,r.UniformsLib.shadowmap,{ambient:{type:"c",value:new r.Color(16777215)},emissive:{type:"c",value:new r.Color(0)},wrapRGB:{type:"v3",value:new r.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",r.ShaderChunk.map_pars_vertex,r.ShaderChunk.lightmap_pars_vertex,r.ShaderChunk.envmap_pars_vertex,r.ShaderChunk.lights_lambert_pars_vertex,r.ShaderChunk.color_pars_vertex,r.ShaderChunk.morphtarget_pars_vertex,r.ShaderChunk.skinning_pars_vertex,r.ShaderChunk.shadowmap_pars_vertex,"void main() {",r.ShaderChunk.map_vertex,r.ShaderChunk.lightmap_vertex,r.ShaderChunk.color_vertex,r.ShaderChunk.morphnormal_vertex,r.ShaderChunk.skinbase_vertex,r.ShaderChunk.skinnormal_vertex,r.ShaderChunk.defaultnormal_vertex,r.ShaderChunk.morphtarget_vertex,r.ShaderChunk.skinning_vertex,r.ShaderChunk.default_vertex,r.ShaderChunk.worldpos_vertex,r.ShaderChunk.envmap_vertex,r.ShaderChunk.lights_lambert_vertex,r.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",r.ShaderChunk.color_pars_fragment,r.ShaderChunk.map_pars_fragment,r.ShaderChunk.lightmap_pars_fragment,r.ShaderChunk.envmap_pars_fragment,r.ShaderChunk.fog_pars_fragment,r.ShaderChunk.shadowmap_pars_fragment,r.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",r.ShaderChunk.map_fragment,r.ShaderChunk.alphatest_fragment,r.ShaderChunk.specularmap_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",r.ShaderChunk.lightmap_fragment,r.ShaderChunk.color_fragment,r.ShaderChunk.envmap_fragment,r.ShaderChunk.shadowmap_fragment,r.ShaderChunk.linear_to_gamma_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.bump,r.UniformsLib.normalmap,r.UniformsLib.fog,r.UniformsLib.lights,r.UniformsLib.shadowmap,{ambient:{type:"c",value:new r.Color(16777215)},emissive:{type:"c",value:new r.Color(0)},specular:{type:"c",value:new r.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new r.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",r.ShaderChunk.map_pars_vertex,r.ShaderChunk.lightmap_pars_vertex,r.ShaderChunk.envmap_pars_vertex,r.ShaderChunk.lights_phong_pars_vertex,r.ShaderChunk.color_pars_vertex,r.ShaderChunk.morphtarget_pars_vertex,r.ShaderChunk.skinning_pars_vertex,r.ShaderChunk.shadowmap_pars_vertex,"void main() {",r.ShaderChunk.map_vertex,r.ShaderChunk.lightmap_vertex,r.ShaderChunk.color_vertex,r.ShaderChunk.morphnormal_vertex,r.ShaderChunk.skinbase_vertex,r.ShaderChunk.skinnormal_vertex,r.ShaderChunk.defaultnormal_vertex,"vNormal = normalize( transformedNormal );",r.ShaderChunk.morphtarget_vertex,r.ShaderChunk.skinning_vertex,r.ShaderChunk.default_vertex,"vViewPosition = -mvPosition.xyz;",r.ShaderChunk.worldpos_vertex,r.ShaderChunk.envmap_vertex,r.ShaderChunk.lights_phong_vertex,r.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",r.ShaderChunk.color_pars_fragment,r.ShaderChunk.map_pars_fragment,r.ShaderChunk.lightmap_pars_fragment,r.ShaderChunk.envmap_pars_fragment,r.ShaderChunk.fog_pars_fragment,r.ShaderChunk.lights_phong_pars_fragment,r.ShaderChunk.shadowmap_pars_fragment,r.ShaderChunk.bumpmap_pars_fragment,r.ShaderChunk.normalmap_pars_fragment,r.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",r.ShaderChunk.map_fragment,r.ShaderChunk.alphatest_fragment,r.ShaderChunk.specularmap_fragment,r.ShaderChunk.lights_phong_fragment,r.ShaderChunk.lightmap_fragment,r.ShaderChunk.color_fragment,r.ShaderChunk.envmap_fragment,r.ShaderChunk.shadowmap_fragment,r.ShaderChunk.linear_to_gamma_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:r.UniformsUtils.merge([r.UniformsLib.particle,r.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",r.ShaderChunk.color_pars_vertex,r.ShaderChunk.shadowmap_pars_vertex,"void main() {",r.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",r.ShaderChunk.worldpos_vertex,r.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",r.ShaderChunk.color_pars_fragment,r.ShaderChunk.map_particle_pars_fragment,r.ShaderChunk.fog_pars_fragment,r.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",r.ShaderChunk.map_particle_fragment,r.ShaderChunk.alphatest_fragment,r.ShaderChunk.color_fragment,r.ShaderChunk.shadowmap_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",r.ShaderChunk.color_pars_vertex,"void main() {",r.ShaderChunk.color_vertex,"vLineDistance = scale * lineDistance;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",r.ShaderChunk.color_pars_fragment,r.ShaderChunk.fog_pars_fragment,"void main() {\nif ( mod( vLineDistance, totalSize ) > dashSize ) {\ndiscard;\n}\ngl_FragColor = vec4( diffuse, opacity );",r.ShaderChunk.color_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3}
1,opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",r.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvNormal = normalize( normalMatrix * normal );",r.ShaderChunk.morphtarget_vertex,r.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},normalmap:{uniforms:r.UniformsUtils.merge([r.UniformsLib.fog,r.UniformsLib.lights,r.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new r.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new r.Color(16777215)},uSpecularColor:{type:"c",value:new r.Color(1118481)},uAmbientColor:{type:"c",value:new r.Color(16777215)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1},useRefract:{type:"i",value:0},uRefractionRatio:{type:"f",value:.98},uReflectivity:{type:"f",value:.5},uOffset:{type:"v2",value:new r.Vector2(0,0)},uRepeat:{type:"v2",value:new r.Vector2(1,1)},wrapRGB:{type:"v3",value:new r.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform vec2 uNormalScale;\nuniform bool useRefract;\nuniform float uRefractionRatio;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",r.ShaderChunk.shadowmap_pars_fragment,r.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\nvec3 finalNormal = tsb * normalTex;\n#ifdef FLIP_SIDED\nfinalNormal = -finalNormal;\n#endif\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointVector = lPosition.xyz + vViewPosition.xyz;\nfloat pointDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\npointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );\npointVector = normalize( pointVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;\n#else\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n#endif\n}
1\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 spotVector = lPosition.xyz + vViewPosition.xyz;\nfloat spotDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );\nspotVector = normalize( spotVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );\n#endif\nspotDiffuse += spotDistance * spotLightColor[ i ] * uDiffuseColor * spotDiffuseWeight * spotEffect;\nvec3 spotHalfVector = normalize( spotVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += spotDistance * spotLightColor[ i ] * uSpecularColor * spotSpecularWeight * spotDiffuseWeight * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse  = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += uDiffuseColor * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, uShininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlickSky = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += uSpecularColor * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;
1\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor ) + totalSpecular;\n#endif\nif ( enableReflection ) {\nvec3 vReflect;\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, normal, uRefractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, normal );\n}\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}",r.ShaderChunk.shadowmap_fragment,r.ShaderChunk.linear_to_gamma_fragment,r.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",r.ShaderChunk.skinning_pars_vertex,r.ShaderChunk.shadowmap_pars_vertex,"void main() {",r.ShaderChunk.skinbase_vertex,r.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},depthRGBA:{uniforms:{},vertexShader:[r.ShaderChunk.morphtarget_pars_vertex,r.ShaderChunk.skinning_pars_vertex,"void main() {",r.ShaderChunk.skinbase_vertex,r.ShaderChunk.morphtarget_vertex,r.ShaderChunk.skinning_vertex,r.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}},r.WebGLRenderer=function(e){function t(e,t){var i=e.vertices.length,r=t.material;if(r.attributes)for(var n in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),r.attributes){var o=r.attributes[n];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var a=1;"v2"===o.type?a=2:"v3"===o.type?a=3:"v4"===o.type?a=4:"c"===o.type&&(a=3),o.size=a,o.array=new Float32Array(i*a),o.buffer=G.createBuffer(),o.buffer.belongsToAttribute=n,o.needsUpdate=!0}e.__webglCustomAttributesList.push(o)}}function i(e,t){var i,r=t.geometry,n=3*(i=e.faces3).length,h=1*i.length,l=3*i.length,c=s(i=o(t,e)),u=a(i),p=!!i.vertexColors&&i.vertexColors;if(e.__vertexArray=new Float32Array(3*n),u&&(e.__normalArray=new Float32Array(3*n)),r.hasTangents&&(e.__tangentArray=new Float32Array(4*n)),p&&(e.__colorArray=new Float32Array(3*n)),c&&(0<r.faceVertexUvs.length&&(e.__uvArray=new Float32Array(2*n)),1<r.faceVertexUvs.length&&(e.__uv2Array=new Float32Array(2*n))),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*n),e.__skinWeightArray=new Float32Array(4*n)),e.__faceArray=new Uint16Array(3*h),e.__lineArray=new Uint16Array(2*l),e.numMorphTargets)for(e.__morphTargetsArrays=[],r=0,c=e.numMorphTargets;r<c;r++)e.__morphTargetsArrays.push(new Float32Array(3*n));if(e.numMorphNormals)for(e.__morphNormalsArrays=[],r=0,c=e.numMorphNormals;r<c;r++)e.__morphNormalsArrays.push(new Float32Array(3*n));if(e.__webglFaceCount=3*h,e.__webglLineCount=2*l,i.attributes)for(var f in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),i.attributes){var d;h=i.attributes[f],l={};for(d in h)l[d]=h[d];l.__webglInitialized&&!l.createUniqueBuffers||(l.__webglInitialized=!0,r=1,"v2"===l.type?r=2:"v3"===l.type?r=3:"v4"===l.type?r=4:"c"===l.type&&(r=3),l.size=r,l.array=new Float32Array(n*r),l.buffer=G.createBuffer(),l.buffer.belongsToAttribute=f,h.needsUpdate=!0,l.__original=h),e.__webglCustomAttributesList.push(l)}e.__inittedArrays=!0}function o(e,t){return e.material instanceof r.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function a(e){return!(e instanceof r.MeshBasicMaterial&&!e.envMap||e instanceof r.MeshDepthMaterial)&&(e&&void 0!==e.shading&&e.shading===r.SmoothShading?r.SmoothShading:r.FlatShading)}function s(e){return!!(e.map||e.lightMap||e.bumpMap||e.normalMap||e.specularMap||e instanceof r.ShaderMaterial)}function h(e){we[e]||(G.enableVertexAttribArray(e),we[e]=!0)}function l(){for(var e in we)we[e]&&(G.disableVertexAttribArray(e),we[e]=!1)}function c(e,t){return e.z!==t.z?t.z-e.z:e.id-t.id}function u(e,t){return t[0]-e[0]}function p(e,t,i){if(e.length)for(var r=0,n=e.length;r<n;r++)ee=Q=null,J=$=ne=re=ce=le=oe=-1,Ae=!0,e[r].render(t,i,xe,_e),ee=Q=null,J=$=ne=re=ce=le=oe=-1,Ae=!0}function f(e,t,i,n,o,a,s,h){var l,c,u,p;t?(c=e.length-1,p=t=-1):(c=0,t=e.length,p=1);for(var f=c;f!==t;f+=p)if((l=e[f]).render){if(c=l.object,u=l.buffer,h)l=h;else{if(!(l=l[i]))continue;s&&Y.setBlending(l.blending,l.blendEquation,l.blendSrc,l.blendDst),Y.setDepthTest(l.depthTest),Y.setDepthWrite(l.depthWrite),A(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}Y.setMaterialFaces(l),u instanceof r.BufferGeometry?Y.renderBufferDirect(n,o,a,l,u,c):Y.renderBuffer(n,o,a,l,u,c)}}function d(e,t,i,r,n,o,a){for(var s,h,l=0,c=e.length;l<c;l++)if((h=(s=e[l]).object).visible){if(a)s=a;else{if(!(s=s[t]))continue;o&&Y.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst),Y.setDepthTest(s.depthTest),Y.setDepthWrite(s.depthWrite),A(s.polygonOffset,s.polygonOffsetFactor,s.pol
1ygonOffsetUnits)}Y.renderImmediateObject(i,r,n,s,h)}}function m(e,n){var o,a,s,h;if(void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new r.Matrix4,e._normalMatrix=new r.Matrix3,void 0!==e.geometry&&void 0===e.geometry.__webglInit&&(e.geometry.__webglInit=!0,e.geometry.addEventListener("dispose",Ge)),void 0!==(a=e.geometry)))if(a instanceof r.BufferGeometry){var l,c;for(l in a.attributes)c="index"===l?G.ELEMENT_ARRAY_BUFFER:G.ARRAY_BUFFER,void 0===(h=a.attributes[l]).numItems&&(h.numItems=h.array.length),h.buffer=G.createBuffer(),G.bindBuffer(c,h.buffer),G.bufferData(c,h.array,G.STATIC_DRAW)}else if(e instanceof r.Mesh){if(s=e.material,void 0===a.geometryGroups){var u,p,f;c={};var d=(l=a).morphTargets.length,m=l.morphNormals.length,v=s instanceof r.MeshFaceMaterial;for(l.geometryGroups={},s=0,u=l.faces.length;s<u;s++)p=l.faces[s],void 0===c[p=v?p.materialIndex:0]&&(c[p]={hash:p,counter:0}),f=c[p].hash+"_"+c[p].counter,void 0===l.geometryGroups[f]&&(l.geometryGroups[f]={faces3:[],materialIndex:p,vertices:0,numMorphTargets:d,numMorphNormals:m}),65535<l.geometryGroups[f].vertices+3&&(c[p].counter+=1,f=c[p].hash+"_"+c[p].counter,void 0===l.geometryGroups[f]&&(l.geometryGroups[f]={faces3:[],materialIndex:p,vertices:0,numMorphTargets:d,numMorphNormals:m})),l.geometryGroups[f].faces3.push(s),l.geometryGroups[f].vertices+=3;for(h in l.geometryGroupsList=[],l.geometryGroups)l.geometryGroups[h].id=te++,l.geometryGroupsList.push(l.geometryGroups[h])}for(o in a.geometryGroups)if(!(h=a.geometryGroups[o]).__webglVertexBuffer){if((l=h).__webglVertexBuffer=G.createBuffer(),l.__webglNormalBuffer=G.createBuffer(),l.__webglTangentBuffer=G.createBuffer(),l.__webglColorBuffer=G.createBuffer(),l.__webglUVBuffer=G.createBuffer(),l.__webglUV2Buffer=G.createBuffer(),l.__webglSkinIndicesBuffer=G.createBuffer(),l.__webglSkinWeightsBuffer=G.createBuffer(),l.__webglFaceBuffer=G.createBuffer(),l.__webglLineBuffer=G.createBuffer(),d=c=void 0,l.numMorphTargets)for(l.__webglMorphTargetsBuffers=[],c=0,d=l.numMorphTargets;c<d;c++)l.__webglMorphTargetsBuffers.push(G.createBuffer());if(l.numMorphNormals)for(l.__webglMorphNormalsBuffers=[],c=0,d=l.numMorphNormals;c<d;c++)l.__webglMorphNormalsBuffers.push(G.createBuffer());Y.info.memory.geometries++,i(h,e),a.verticesNeedUpdate=!0,a.morphTargetsNeedUpdate=!0,a.elementsNeedUpdate=!0,a.uvsNeedUpdate=!0,a.normalsNeedUpdate=!0,a.tangentsNeedUpdate=!0,a.colorsNeedUpdate=!0}}else e instanceof r.Line?a.__webglVertexBuffer||((h=a).__webglVertexBuffer=G.createBuffer(),h.__webglColorBuffer=G.createBuffer(),h.__webglLineDistanceBuffer=G.createBuffer(),Y.info.memory.geometries++,l=(h=a).vertices.length,h.__vertexArray=new Float32Array(3*l),h.__colorArray=new Float32Array(3*l),h.__lineDistanceArray=new Float32Array(1*l),h.__webglLineCount=l,t(h,e),a.verticesNeedUpdate=!0,a.colorsNeedUpdate=!0,a.lineDistancesNeedUpdate=!0):e instanceof r.ParticleSystem&&!a.__webglVertexBuffer&&((h=a).__webglVertexBuffer=G.createBuffer(),h.__webglColorBuffer=G.createBuffer(),Y.info.memory.geometries++,l=(h=a).vertices.length,h.__vertexArray=new Float32Array(3*l),h.__colorArray=new Float32Array(3*l),h.__sortArray=[],h.__webglParticleCount=l,t(h,e),a.verticesNeedUpdate=!0,a.colorsNeedUpdate=!0);if(void 0===e.__webglActive){if(e instanceof r.Mesh){if((a=e.geometry)instanceof r.BufferGeometry)g(n.__webglObjects,a,e);else if(a instanceof r.Geometry)for(o in a.geometryGroups)h=a.geometryGroups[o],g(n.__webglObjects,h,e)}else e instanceof r.Line||e instanceof r.ParticleSystem?(a=e.geometry,g(n.__webglObjects,a,e)):e instanceof r.ImmediateRenderObject||e.immediateRenderCallback?n.__webglObjectsImmediate.push({id:null,object:e,opaque:null,transparent:null,z:0}):e instanceof r.Sprite?n.__webglSprites.push(e):e instanceof r.LensFlare&&n.__webglFlares.push(e);e.__webglActive=!0}}function g(e,t,i){e.push({id:null,buffer:t,object:i,opaque:null,transparent:null,z:0})}function v(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function y(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}function x(e,t){e instanceof r.Mesh||e instanceof r.ParticleSystem||e instanceof r.Line?_(t.__webglObjects,e):e instanceof r.Sprite?w(t.__webglSprites,e):e instanceof r.LensFlare?w(t.__webglFlares,e):(e instanceof r.ImmediateRenderObject||e.immediateRenderCallback)&&_(t.__webglObjectsImmediate,e),delete e.__webglActive}function _(e,t){for(var i=e.length-1;0<=i;i--)e[i].object===t&&e.splice(i,1)}function w(e,t){for(var i=e.length-1;0<=i;i--)e[i]===t&&e.splice(i,1)}function b(e,t,i,n,o){ie=0,n.needsUpdate&&(n.program&&Ye(n),Y.initMaterial(n,t,i,o),n.needsUpdate=!1),n.morphTargets&&!o.__webglMorphTargetInfluences&&(o.__webglMorphTargetInfluences=new Float32Array(Y.maxMorphTargets));var a=!1,s=n.program,h=s.uniforms,l=n.uniforms;if(s!==Q&&(G.useProgram(s),Q=s,a=!0),n.id!==J&&(J=n.id,a=!0),(a||e!==ee)&&(G.uniformMatrix4fv(h.projectionMatrix,!1,e.projectionMatrix.elements),e!==ee&&(ee=e)),n.skinning)if(Ue&&o.useVertexTexture){if(null!==h.boneTexture){var c=M();G.uniform1i(h.boneTexture,c),Y.setTexture(o.boneTexture,c)}null!==h.boneTextureWidth&&G.uniform1i(h.boneTextureWidth,o.boneTextureWidth),null!==h.boneTextureHeight&&G.uniform1i(h.boneTextureHeight,o.boneTextureHeight)}else null!==h.boneGlobalMatrices&&G.uniformMatrix4fv(h.boneGlobalMatrices,!1,o.boneMatrices);if(a){if(i&&n.fog&&(l.fogColor.value=i.color,i instanceof r.Fog?(l.fogNear.value=i.near,l.fogFar.value=i.far):i instanceof r.FogExp2&&(l.fogDensity.value=i.density)),n instanceof r.MeshPhongMaterial||n instanceof r.MeshLambertMaterial||n.lights){if(Ae){var u,p,f,d,m=c=0,g=0,v=Ee,y=v.directional.colors,x=v.directional.positions,_=v.point.colors,w=v.point.positions,b=v.point.distances,C=v.spot.colors,A=v.spot.positions,E=v.spot.distances,P=v.spot.directions,D=v.spot.anglesCos,V=v.spot.exponents,U=v.hemi.skyColors,z=v.hemi.groundColors,N=v.hemi.positions,O=0,B=0,I=0,k=0,H=0,W=0,j=0,X=0,q=u=0;for(i=d=q=0,a=t.length;i<a;i++)(u=t[i]).onlyShadow||(p=u.color,f=u.intensity,d=u.distance,u instanceof r.AmbientLight?u.visible&&(Y.gammaInput?(c+=p.r*p.r,m+=p.g*p.g,g+=p.b*p.b):(c+=p.r,m+=p.g,g+=p.b)):u instanceof r.DirectionalLight?(H+=1,u.visible&&(Ce.getPositionFromMatr
1ix(u.matrixWorld),Te.getPositionFromMatrix(u.target.matrixWorld),Ce.sub(Te),Ce.normalize(),0===Ce.x&&0===Ce.y&&0===Ce.z||(x[u=3*O]=Ce.x,x[u+1]=Ce.y,x[u+2]=Ce.z,Y.gammaInput?S(y,u,p,f*f):T(y,u,p,f),O+=1))):u instanceof r.PointLight?(W+=1,u.visible&&(q=3*B,Y.gammaInput?S(_,q,p,f*f):T(_,q,p,f),Te.getPositionFromMatrix(u.matrixWorld),w[q]=Te.x,w[q+1]=Te.y,w[q+2]=Te.z,b[B]=d,B+=1)):u instanceof r.SpotLight?(j+=1,u.visible&&(q=3*I,Y.gammaInput?S(C,q,p,f*f):T(C,q,p,f),Te.getPositionFromMatrix(u.matrixWorld),A[q]=Te.x,A[q+1]=Te.y,A[q+2]=Te.z,E[I]=d,Ce.copy(Te),Te.getPositionFromMatrix(u.target.matrixWorld),Ce.sub(Te),Ce.normalize(),P[q]=Ce.x,P[q+1]=Ce.y,P[q+2]=Ce.z,D[I]=Math.cos(u.angle),V[I]=u.exponent,I+=1)):u instanceof r.HemisphereLight&&(X+=1,u.visible&&(Ce.getPositionFromMatrix(u.matrixWorld),Ce.normalize(),0===Ce.x&&0===Ce.y&&0===Ce.z||(N[d=3*k]=Ce.x,N[d+1]=Ce.y,N[d+2]=Ce.z,p=u.color,u=u.groundColor,Y.gammaInput?(S(U,d,p,f*=f),S(z,d,u,f)):(T(U,d,p,f),T(z,d,u,f)),k+=1))));for(i=3*O,a=Math.max(y.length,3*H);i<a;i++)y[i]=0;for(i=3*B,a=Math.max(_.length,3*W);i<a;i++)_[i]=0;for(i=3*I,a=Math.max(C.length,3*j);i<a;i++)C[i]=0;for(i=3*k,a=Math.max(U.length,3*X);i<a;i++)U[i]=0;for(i=3*k,a=Math.max(z.length,3*X);i<a;i++)z[i]=0;v.directional.length=O,v.point.length=B,v.spot.length=I,v.hemi.length=k,v.ambient[0]=c,v.ambient[1]=m,v.ambient[2]=g,Ae=!1}i=Ee,l.ambientLightColor.value=i.ambient,l.directionalLightColor.value=i.directional.colors,l.directionalLightDirection.value=i.directional.positions,l.pointLightColor.value=i.point.colors,l.pointLightPosition.value=i.point.positions,l.pointLightDistance.value=i.point.distances,l.spotLightColor.value=i.spot.colors,l.spotLightPosition.value=i.spot.positions,l.spotLightDistance.value=i.spot.distances,l.spotLightDirection.value=i.spot.directions,l.spotLightAngleCos.value=i.spot.anglesCos,l.spotLightExponent.value=i.spot.exponents,l.hemisphereLightSkyColor.value=i.hemi.skyColors,l.hemisphereLightGroundColor.value=i.hemi.groundColors,l.hemisphereLightDirection.value=i.hemi.positions}var K;if(n instanceof r.MeshBasicMaterial||n instanceof r.MeshLambertMaterial||n instanceof r.MeshPhongMaterial)l.opacity.value=n.opacity,Y.gammaInput?l.diffuse.value.copyGammaToLinear(n.color):l.diffuse.value=n.color,l.map.value=n.map,l.lightMap.value=n.lightMap,l.specularMap.value=n.specularMap,n.bumpMap&&(l.bumpMap.value=n.bumpMap,l.bumpScale.value=n.bumpScale),n.normalMap&&(l.normalMap.value=n.normalMap,l.normalScale.value.copy(n.normalScale)),n.map?K=n.map:n.specularMap?K=n.specularMap:n.normalMap?K=n.normalMap:n.bumpMap&&(K=n.bumpMap),void 0!==K&&(i=K.offset,K=K.repeat,l.offsetRepeat.value.set(i.x,i.y,K.x,K.y)),l.envMap.value=n.envMap,l.flipEnvMap.value=n.envMap instanceof r.WebGLRenderTargetCube?1:-1,l.reflectivity.value=n.reflectivity,l.refractionRatio.value=n.refractionRatio,l.combine.value=n.combine,l.useRefract.value=n.envMap&&n.envMap.mapping instanceof r.CubeRefractionMapping;if(n instanceof r.LineBasicMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity):n instanceof r.LineDashedMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity,l.dashSize.value=n.dashSize,l.totalSize.value=n.dashSize+n.gapSize,l.scale.value=n.scale):n instanceof r.ParticleSystemMaterial?(l.psColor.value=n.color,l.opacity.value=n.opacity,l.size.value=n.size,l.scale.value=F.height/2,l.map.value=n.map):n instanceof r.MeshPhongMaterial?(l.shininess.value=n.shininess,Y.gammaInput?(l.ambient.value.copyGammaToLinear(n.ambient),l.emissive.value.copyGammaToLinear(n.emissive),l.specular.value.copyGammaToLinear(n.specular)):(l.ambient.value=n.ambient,l.emissive.value=n.emissive,l.specular.value=n.specular),n.wrapAround&&l.wrapRGB.value.copy(n.wrapRGB)):n instanceof r.MeshLambertMaterial?(Y.gammaInput?(l.ambient.value.copyGammaToLinear(n.ambient),l.emissive.value.copyGammaToLinear(n.emissive)):(l.ambient.value=n.ambient,l.emissive.value=n.emissive),n.wrapAround&&l.wrapRGB.value.copy(n.wrapRGB)):n instanceof r.MeshDepthMaterial?(l.mNear.value=e.near,l.mFar.value=e.far,l.opacity.value=n.opacity):n instanceof r.MeshNormalMaterial&&(l.opacity.value=n.opacity),o.receiveShadow&&!n._shadowPass&&l.shadowMatrix)for(i=K=0,a=t.length;i<a;i++)(c=t[i]).castShadow&&(c instanceof r.SpotLight||c instanceof r.DirectionalLight&&!c.shadowCascade)&&(l.shadowMap.value[K]=c.shadowMap,l.shadowMapSize.value[K]=c.shadowMapSize,l.shadowMatrix.value[K]=c.shadowMatrix,l.shadowDarkness.value[K]=c.shadowDarkness,l.shadowBias.value[K]=c.shadowBias,K++);for(l=0,K=(t=n.uniformsList).length;l<K;l++)if(a=s.uniforms[t[l][1]])if(m=(i=t[l][0]).type,c=i.value,"i"===m)G.uniform1i(a,c);else if("f"===m)G.uniform1f(a,c);else if("v2"===m)G.uniform2f(a,c.x,c.y);else if("v3"===m)G.uniform3f(a,c.x,c.y,c.z);else if("v4"===m)G.uniform4f(a,c.x,c.y,c.z,c.w);else if("c"===m)G.uniform3f(a,c.r,c.g,c.b);else if("iv1"===m)G.uniform1iv(a,c);else if("iv"===m)G.uniform3iv(a,c);else if("fv1"===m)G.uniform1fv(a,c);else if("fv"===m)G.uniform3fv(a,c);else if("v2v"===m){for(void 0===i._array&&(i._array=new Float32Array(2*c.length)),m=0,g=c.length;m<g;m++)v=2*m,i._array[v]=c[m].x,i._array[v+1]=c[m].y;G.uniform2fv(a,i._array)}else if("v3v"===m){for(void 0===i._array&&(i._array=new Float32Array(3*c.length)),m=0,g=c.length;m<g;m++)v=3*m,i._array[v]=c[m].x,i._array[v+1]=c[m].y,i._array[v+2]=c[m].z;G.uniform3fv(a,i._array)}else if("v4v"===m){for(void 0===i._array&&(i._array=new Float32Array(4*c.length)),m=0,g=c.length;m<g;m++)v=4*m,i._array[v]=c[m].x,i._array[v+1]=c[m].y,i._array[v+2]=c[m].z,i._array[v+3]=c[m].w;G.uniform4fv(a,i._array)}else if("m4"===m)void 0===i._array&&(i._array=new Float32Array(16)),c.flattenToArray(i._array),G.uniformMatrix4fv(a,!1,i._array);else if("m4v"===m){for(void 0===i._array&&(i._array=new Float32Array(16*c.length)),m=0,g=c.length;m<g;m++)c[m].flattenToArrayOffset(i._array,16*m);G.uniformMatrix4fv(a,!1,i._array)}else if("t"===m){if(v=c,c=M(),G.uniform1i(a,c),v)if(v.image instanceof Array&&6===v.image.length){if(a=c,6===(i=v).image.length)if(i.needsUpdate){for(i.image.__webglTextureCube||(i.addEventListener("dispose",He),i.image.__webglTextureCube=G.createTexture(),Y.info.memory.textures++),G.activeTexture(G.TEXTURE0+a),G.bindTexture(G.TEXTURE_CUBE_MAP,i.image.__webglTextureCube),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,i.flipY),a=i instanceof r.CompressedTexture,c=[],m=0;6>m;m++)Y.autoScaleCubemaps&&!a?(g=c,v=m,y=i.image[m],_=Re,y.width<=_&&y.height<=_||(w=Math.max(y.width,y.height),x=Math.floor(y.width*_/w),_=Math.floor(y.height*_/w),(w=document.createElement("canvas")).width=x,w.height=_,w.getContext("2d").drawImage(y,0,0,y.width,y.height,0,0,x,_),y=w),g[v]=y):c[m]=i.image[m];for(g=0===((m=c[0]).width&m.width-1)&&0===(m.height&m.height-1),v=R(i.format),y=R(i.type),L(G.TEXTURE_CUBE_MAP,i,g),m=0;6>m;m++)if(a)for(w=0,b=(_=c[m].mipmaps).length;w<b;w++)x=_[w],i.format!==r.RGBAFormat?G.compressedTexImage2D(G.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,v,x.width,x.height,0,x.data):G.texImage2D(G.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,v,x.width,x.height,0,v,y,x.data);else G.texImage2D(G.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,v,v,y,c[m]);i.generateMipmaps&&g&&G.generateMipmap(G.TEXTURE_CUBE_MAP),i.needsUpdate=!1,i.onUp
1date&&i.onUpdate()}else G.activeTexture(G.TEXTURE0+a),G.bindTexture(G.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else v instanceof r.WebGLRenderTargetCube?(i=v,G.activeTexture(G.TEXTURE0+c),G.bindTexture(G.TEXTURE_CUBE_MAP,i.__webglTexture)):Y.setTexture(v,c)}else if("tv"===m){for(void 0===i._array&&(i._array=[]),m=0,g=i.value.length;m<g;m++)i._array[m]=M();for(G.uniform1iv(a,i._array),m=0,g=i.value.length;m<g;m++)v=i.value[m],c=i._array[m],v&&Y.setTexture(v,c)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+m);(n instanceof r.ShaderMaterial||n instanceof r.MeshPhongMaterial||n.envMap)&&null!==h.cameraPosition&&(Te.getPositionFromMatrix(e.matrixWorld),G.uniform3f(h.cameraPosition,Te.x,Te.y,Te.z)),(n instanceof r.MeshPhongMaterial||n instanceof r.MeshLambertMaterial||n instanceof r.ShaderMaterial||n.skinning)&&null!==h.viewMatrix&&G.uniformMatrix4fv(h.viewMatrix,!1,e.matrixWorldInverse.elements)}return G.uniformMatrix4fv(h.modelViewMatrix,!1,o._modelViewMatrix.elements),h.normalMatrix&&G.uniformMatrix3fv(h.normalMatrix,!1,o._normalMatrix.elements),null!==h.modelMatrix&&G.uniformMatrix4fv(h.modelMatrix,!1,o.matrixWorld.elements),s}function M(){var e=ie;return e>=Pe&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Pe),ie+=1,e}function S(e,t,i,r){e[t]=i.r*i.r*r,e[t+1]=i.g*i.g*r,e[t+2]=i.b*i.b*r}function T(e,t,i,r){e[t]=i.r*r,e[t+1]=i.g*r,e[t+2]=i.b*r}function C(e){e!==de&&(G.lineWidth(e),de=e)}function A(e,t,i){ue!==e&&(e?G.enable(G.POLYGON_OFFSET_FILL):G.disable(G.POLYGON_OFFSET_FILL),ue=e),!e||pe===t&&fe===i||(G.polygonOffset(t,i),pe=t,fe=i)}function E(e,t){var i;return"fragment"===e?i=G.createShader(G.FRAGMENT_SHADER):"vertex"===e&&(i=G.createShader(G.VERTEX_SHADER)),G.shaderSource(i,t),G.compileShader(i),G.getShaderParameter(i,G.COMPILE_STATUS)?i:(console.error(G.getShaderInfoLog(i)),console.error(function(e){for(var t=0,i=(e=e.split("\n")).length;t<i;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t)),null)}function L(e,t,i){i?(G.texParameteri(e,G.TEXTURE_WRAP_S,R(t.wrapS)),G.texParameteri(e,G.TEXTURE_WRAP_T,R(t.wrapT)),G.texParameteri(e,G.TEXTURE_MAG_FILTER,R(t.magFilter)),G.texParameteri(e,G.TEXTURE_MIN_FILTER,R(t.minFilter))):(G.texParameteri(e,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(e,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.texParameteri(e,G.TEXTURE_MAG_FILTER,D(t.magFilter)),G.texParameteri(e,G.TEXTURE_MIN_FILTER,D(t.minFilter))),j&&t.type!==r.FloatType&&(1<t.anisotropy||t.__oldAnisotropy)&&(G.texParameterf(e,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Fe)),t.__oldAnisotropy=t.anisotropy)}function P(e,t){G.bindRenderbuffer(G.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(G.renderbufferStorage(G.RENDERBUFFER,G.DEPTH_COMPONENT16,t.width,t.height),G.framebufferRenderbuffer(G.FRAMEBUFFER,G.DEPTH_ATTACHMENT,G.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(G.renderbufferStorage(G.RENDERBUFFER,G.DEPTH_STENCIL,t.width,t.height),G.framebufferRenderbuffer(G.FRAMEBUFFER,G.DEPTH_STENCIL_ATTACHMENT,G.RENDERBUFFER,e)):G.renderbufferStorage(G.RENDERBUFFER,G.RGBA4,t.width,t.height)}function D(e){return e===r.NearestFilter||e===r.NearestMipMapNearestFilter||e===r.NearestMipMapLinearFilter?G.NEAREST:G.LINEAR}function R(e){if(e===r.RepeatWrapping)return G.REPEAT;if(e===r.ClampToEdgeWrapping)return G.CLAMP_TO_EDGE;if(e===r.MirroredRepeatWrapping)return G.MIRRORED_REPEAT;if(e===r.NearestFilter)return G.NEAREST;if(e===r.NearestMipMapNearestFilter)return G.NEAREST_MIPMAP_NEAREST;if(e===r.NearestMipMapLinearFilter)return G.NEAREST_MIPMAP_LINEAR;if(e===r.LinearFilter)return G.LINEAR;if(e===r.LinearMipMapNearestFilter)return G.LINEAR_MIPMAP_NEAREST;if(e===r.LinearMipMapLinearFilter)return G.LINEAR_MIPMAP_LINEAR;if(e===r.UnsignedByteType)return G.UNSIGNED_BYTE;if(e===r.UnsignedShort4444Type)return G.UNSIGNED_SHORT_4_4_4_4;if(e===r.UnsignedShort5551Type)return G.UNSIGNED_SHORT_5_5_5_1;if(e===r.UnsignedShort565Type)return G.UNSIGNED_SHORT_5_6_5;if(e===r.ByteType)return G.BYTE;if(e===r.ShortType)return G.SHORT;if(e===r.UnsignedShortType)return G.UNSIGNED_SHORT;if(e===r.IntType)return G.INT;if(e===r.UnsignedIntType)return G.UNSIGNED_INT;if(e===r.FloatType)return G.FLOAT;if(e===r.AlphaFormat)return G.ALPHA;if(e===r.RGBFormat)return G.RGB;if(e===r.RGBAFormat)return G.RGBA;if(e===r.LuminanceFormat)return G.LUMINANCE;if(e===r.LuminanceAlphaFormat)return G.LUMINANCE_ALPHA;if(e===r.AddEquation)return G.FUNC_ADD;if(e===r.SubtractEquation)return G.FUNC_SUBTRACT;if(e===r.ReverseSubtractEquation)return G.FUNC_REVERSE_SUBTRACT;if(e===r.ZeroFactor)return G.ZERO;if(e===r.OneFactor)return G.ONE;if(e===r.SrcColorFactor)return G.SRC_COLOR;if(e===r.OneMinusSrcColorFactor)return G.ONE_MINUS_SRC_COLOR;if(e===r.SrcAlphaFactor)return G.SRC_ALPHA;if(e===r.OneMinusSrcAlphaFactor)return G.ONE_MINUS_SRC_ALPHA;if(e===r.DstAlphaFactor)return G.DST_ALPHA;if(e===r.OneMinusDstAlphaFactor)return G.ONE_MINUS_DST_ALPHA;if(e===r.DstColorFactor)return G.DST_COLOR;if(e===r.OneMinusDstColorFactor)return G.ONE_MINUS_DST_COLOR;if(e===r.SrcAlphaSaturateFactor)return G.SRC_ALPHA_SATURATE;if(void 0!==X){if(e===r.RGB_S3TC_DXT1_Format)return X.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===r.RGBA_S3TC_DXT1_Format)return X.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===r.RGBA_S3TC_DXT3_Format)return X.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===r.RGBA_S3TC_DXT5_Format)return X.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",r.REVISION);var F=void 0!==(e=e||{}).canvas?e.canvas:document.createElement("canvas"),V=void 0!==e.precision?e.precision:"highp",U=void 0===e.alpha||e.alpha,z=void 0===e.premultipliedAlpha||e.premultipliedAlpha,N=void 0!==e.antialias&&e.antialias,O=void 0===e.stencil||e.stencil,B=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,I=new r.Color(0),k=0;this.domElement=F,this.context=null,this.devicePixelRatio=void 0!==e.devicePixelRatio?e.devicePixelRatio:void 0!==n.devicePixelRatio?n.devicePixelRatio:1,this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.shadowMapEnabled=this.physicallyBasedSha
1ding=this.gammaOutput=this.gammaInput=!1,this.shadowMapAutoUpdate=!0,this.shadowMapType=r.PCFShadowMap,this.shadowMapCullFace=r.CullFaceFront,this.shadowMapCascade=this.shadowMapDebug=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.renderPluginsPre=[],this.renderPluginsPost=[],this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G,H,W,j,X,Y=this,q=[],K=0,Q=null,Z=null,J=-1,$=null,ee=null,te=0,ie=0,re=-1,ne=-1,oe=-1,ae=-1,se=-1,he=-1,le=-1,ce=-1,ue=null,pe=null,fe=null,de=null,me=0,ge=0,ve=F.width,ye=F.height,xe=0,_e=0,we={},be=new r.Frustum,Me=new r.Matrix4,Se=new r.Matrix4,Te=new r.Vector3,Ce=new r.Vector3,Ae=!0,Ee={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var Le={alpha:U,premultipliedAlpha:z,antialias:N,stencil:O,preserveDrawingBuffer:B};if(null===(G=F.getContext("webgl",Le)||F.getContext("experimental-webgl",Le)))throw"Error creating WebGL context."}catch(qe){console.error(qe)}H=G.getExtension("OES_texture_float"),G.getExtension("OES_texture_float_linear"),W=G.getExtension("OES_standard_derivatives"),j=G.getExtension("EXT_texture_filter_anisotropic")||G.getExtension("MOZ_EXT_texture_filter_anisotropic")||G.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),X=G.getExtension("WEBGL_compressed_texture_s3tc")||G.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||G.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),H||console.log("THREE.WebGLRenderer: Float textures not supported."),W||console.log("THREE.WebGLRenderer: Standard derivatives not supported."),j||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported."),X||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported."),void 0===G.getShaderPrecisionFormat&&(G.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),G.clearColor(0,0,0,1),G.clearDepth(1),G.clearStencil(0),G.enable(G.DEPTH_TEST),G.depthFunc(G.LEQUAL),G.frontFace(G.CCW),G.cullFace(G.BACK),G.enable(G.CULL_FACE),G.enable(G.BLEND),G.blendEquation(G.FUNC_ADD),G.blendFunc(G.SRC_ALPHA,G.ONE_MINUS_SRC_ALPHA),G.viewport(me,ge,ve,ye),G.clearColor(I.r,I.g,I.b,k),this.context=G;var Pe=G.getParameter(G.MAX_TEXTURE_IMAGE_UNITS),De=G.getParameter(G.MAX_VERTEX_TEXTURE_IMAGE_UNITS);G.getParameter(G.MAX_TEXTURE_SIZE);var Re=G.getParameter(G.MAX_CUBE_MAP_TEXTURE_SIZE),Fe=j?G.getParameter(j.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ve=0<De,Ue=Ve&&H;X&&G.getParameter(G.COMPRESSED_TEXTURE_FORMATS);var ze=G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.HIGH_FLOAT),Ne=G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.MEDIUM_FLOAT);G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.LOW_FLOAT);var Oe=G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.HIGH_FLOAT),Be=G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.MEDIUM_FLOAT);G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.LOW_FLOAT),G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.HIGH_INT),G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.MEDIUM_INT),G.getShaderPrecisionFormat(G.VERTEX_SHADER,G.LOW_INT),G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.HIGH_INT),G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.MEDIUM_INT),G.getShaderPrecisionFormat(G.FRAGMENT_SHADER,G.LOW_INT);var Ie=0<ze.precision&&0<Oe.precision,ke=0<Ne.precision&&0<Be.precision;"highp"===V&&!Ie&&(ke?(V="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(V="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp"))),"mediump"===V&&!ke&&(V="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp")),this.getContext=function(){return G},this.supportsVertexTextures=function(){return Ve},this.supportsFloatTextures=function(){return H},this.supportsStandardDerivatives=function(){return W},this.supportsCompressedTextureS3TC=function(){return X},this.getMaxAnisotropy=function(){return Fe},this.getPrecision=function(){return V},this.setSize=function(e,t,i){F.width=e*this.devicePixelRatio,F.height=t*this.devicePixelRatio,1!==this.devicePixelRatio&&!1!==i&&(F.style.width=e+"px",F.style.height=t+"px"),this.setViewport(0,0,F.width,F.height)},this.setViewport=function(e,t,i,r){me=void 0!==e?e:0,ge=void 0!==t?t:0,ve=void 0!==i?i:F.width,ye=void 0!==r?r:F.height,G.viewport(me,ge,ve,ye)},this.setScissor=function(e,t,i,r){G.scissor(e,t,i,r)},this.enableScissorTest=function(e){e?G.enable(G.SCISSOR_TEST):G.disable(G.SCISSOR_TEST)},this.setClearColor=function(e,t){I.set(e),k=void 0!==t?t:1,G.clearColor(I.r,I.g,I.b,k)},this.setClearColorHex=function(e,t){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(e,t)},this.getClearColor=function(){return I},this.getClearAlpha=function(){return k},this.clear=function(e,t,i){var r=0;(void 0===e||e)&&(r|=G.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=G.DEPTH_BUFFER_BIT),(void 0===i||i)&&(r|=G.STENCIL_BUFFER_BIT),G.clear(r)},this.clearTarget=function(e,t,i,r){this.setRenderTarget(e),this.clear(t,i,r)},this.addPostPlugin=function(e){e.init(this),this.renderPluginsPost.push(e)},this.addPrePlugin=function(e){e.init(this),this.renderPluginsPre.push(e)},this.updateShadowMap=function(e,t){Q=null,J=$=ce=le=oe=-1,Ae=!0,ne=re=-1,this.shadowMapPlugin.update(e,t)};var Ge=function e(t){if((t=t.target).removeEventListener("dispose",e),t.__webglInit=void 0,t instanceof r.BufferGeometry){var i,n=t.attributes;for(i in n)void 0!==n[i].buffer&&G.deleteBuffer(n[i].buffer);Y.info.memory.geometries--}else if(void 0!==t.geometryGroups)for(n in t.geometryGroups){if(void 0!==(i=t.geometryGroups[n]).numMorphTargets)for(var o=0,a=i.numMorphTargets;o<a;o++)G.deleteBuffer(i.__webglMorphTargetsBuffers[o]);if(void 0!==i.numMorphNormals)for(o=0,a=i.numMorphNormals;o<a;o++)G.deleteBuffer(i.__webglMorphNormalsBuffers[o]);Xe(i)}else Xe(t)},He=function e(t){(t=t.target).removeEventListener("dispose",e),t.image&&t.image.__webglTextureCube?G.deleteTexture(t.image.__webglTextureCube):t.__webglInit&&(t.__webglInit=!1,G.deleteTexture(t.__webglTexture)),Y.info.memory.textures--},We=function e(t){if((t=t.target).removeEventListener("dispose",e),t&&t.__webglTexture)if(G.deleteTexture(t.__webglTexture),t instanceof r.WebGLRenderTargetCube)for(var i=0;6>i;
1i++)G.deleteFramebuffer(t.__webglFramebuffer[i]),G.deleteRenderbuffer(t.__webglRenderbuffer[i]);else G.deleteFramebuffer(t.__webglFramebuffer),G.deleteRenderbuffer(t.__webglRenderbuffer);Y.info.memory.textures--},je=function e(t){(t=t.target).removeEventListener("dispose",e),Ye(t)},Xe=function(e){if(void 0!==e.__webglVertexBuffer&&G.deleteBuffer(e.__webglVertexBuffer),void 0!==e.__webglNormalBuffer&&G.deleteBuffer(e.__webglNormalBuffer),void 0!==e.__webglTangentBuffer&&G.deleteBuffer(e.__webglTangentBuffer),void 0!==e.__webglColorBuffer&&G.deleteBuffer(e.__webglColorBuffer),void 0!==e.__webglUVBuffer&&G.deleteBuffer(e.__webglUVBuffer),void 0!==e.__webglUV2Buffer&&G.deleteBuffer(e.__webglUV2Buffer),void 0!==e.__webglSkinIndicesBuffer&&G.deleteBuffer(e.__webglSkinIndicesBuffer),void 0!==e.__webglSkinWeightsBuffer&&G.deleteBuffer(e.__webglSkinWeightsBuffer),void 0!==e.__webglFaceBuffer&&G.deleteBuffer(e.__webglFaceBuffer),void 0!==e.__webglLineBuffer&&G.deleteBuffer(e.__webglLineBuffer),void 0!==e.__webglLineDistanceBuffer&&G.deleteBuffer(e.__webglLineDistanceBuffer),void 0!==e.__webglCustomAttributesList)for(var t in e.__webglCustomAttributesList)G.deleteBuffer(e.__webglCustomAttributesList[t].buffer);Y.info.memory.geometries--},Ye=function(e){var t=e.program;if(void 0!==t){e.program=void 0;var i,r,n=!1;e=0;for(i=q.length;e<i;e++)if((r=q[e]).program===t){r.usedTimes--,0===r.usedTimes&&(n=!0);break}if(!0===n){for(n=[],e=0,i=q.length;e<i;e++)(r=q[e]).program!==t&&n.push(r);q=n,G.deleteProgram(t),Y.info.memory.programs--}}};this.renderBufferImmediate=function(e,t,i){if(e.hasPositions&&!e.__webglVertexBuffer&&(e.__webglVertexBuffer=G.createBuffer()),e.hasNormals&&!e.__webglNormalBuffer&&(e.__webglNormalBuffer=G.createBuffer()),e.hasUvs&&!e.__webglUvBuffer&&(e.__webglUvBuffer=G.createBuffer()),e.hasColors&&!e.__webglColorBuffer&&(e.__webglColorBuffer=G.createBuffer()),e.hasPositions&&(G.bindBuffer(G.ARRAY_BUFFER,e.__webglVertexBuffer),G.bufferData(G.ARRAY_BUFFER,e.positionArray,G.DYNAMIC_DRAW),G.enableVertexAttribArray(t.attributes.position),G.vertexAttribPointer(t.attributes.position,3,G.FLOAT,!1,0,0)),e.hasNormals){if(G.bindBuffer(G.ARRAY_BUFFER,e.__webglNormalBuffer),i.shading===r.FlatShading){var n,o,a,s,h,l,c,u,p=3*e.count;for(u=0;u<p;u+=9)n=(c=e.normalArray)[u],o=c[u+1],a=c[u+2],s=c[u+3],h=c[u+4],l=c[u+5],n=(n+s+c[u+6])/3,o=(o+h+c[u+7])/3,a=(a+l+c[u+8])/3,c[u]=n,c[u+1]=o,c[u+2]=a,c[u+3]=n,c[u+4]=o,c[u+5]=a,c[u+6]=n,c[u+7]=o,c[u+8]=a}G.bufferData(G.ARRAY_BUFFER,e.normalArray,G.DYNAMIC_DRAW),G.enableVertexAttribArray(t.attributes.normal),G.vertexAttribPointer(t.attributes.normal,3,G.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(G.bindBuffer(G.ARRAY_BUFFER,e.__webglUvBuffer),G.bufferData(G.ARRAY_BUFFER,e.uvArray,G.DYNAMIC_DRAW),G.enableVertexAttribArray(t.attributes.uv),G.vertexAttribPointer(t.attributes.uv,2,G.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==r.NoColors&&(G.bindBuffer(G.ARRAY_BUFFER,e.__webglColorBuffer),G.bufferData(G.ARRAY_BUFFER,e.colorArray,G.DYNAMIC_DRAW),G.enableVertexAttribArray(t.attributes.color),G.vertexAttribPointer(t.attributes.color,3,G.FLOAT,!1,0,0)),G.drawArrays(G.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,i,n,o,a){var s,c,u,p;if(!1!==n.visible)if(t=(s=b(e,t,i,n,a)).attributes,e=o.attributes,i=!1,(s=16777215*o.id+2*s.id+(n.wireframe?1:0))!==$&&($=s,i=!0),i&&l(),a instanceof r.Mesh)if(a=e.index){1<(o=o.offsets).length&&(i=!0);for(var f=0,d=o.length;f<d;f++){var m=o[f].index;if(i){for(c in t)u=t[c],s=e[c],0<=u&&(s?(p=s.itemSize,G.bindBuffer(G.ARRAY_BUFFER,s.buffer),h(u),G.vertexAttribPointer(u,p,G.FLOAT,!1,0,4*m*p)):n.defaultAttributeValues&&(2===n.defaultAttributeValues[c].length?G.vertexAttrib2fv(u,n.defaultAttributeValues[c]):3===n.defaultAttributeValues[c].length&&G.vertexAttrib3fv(u,n.defaultAttributeValues[c])));G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,a.buffer)}G.drawElements(G.TRIANGLES,o[f].count,G.UNSIGNED_SHORT,2*o[f].start),Y.info.render.calls++,Y.info.render.vertices+=o[f].count,Y.info.render.faces+=o[f].count/3}}else{if(i)for(c in t)"index"!==c&&(u=t[c],s=e[c],0<=u&&(s?(p=s.itemSize,G.bindBuffer(G.ARRAY_BUFFER,s.buffer),h(u),G.vertexAttribPointer(u,p,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&n.defaultAttributeValues[c]&&(2===n.defaultAttributeValues[c].length?G.vertexAttrib2fv(u,n.defaultAttributeValues[c]):3===n.defaultAttributeValues[c].length&&G.vertexAttrib3fv(u,n.defaultAttributeValues[c]))));n=o.attributes.position,G.drawArrays(G.TRIANGLES,0,n.numItems/3),Y.info.render.calls++,Y.info.render.vertices+=n.numItems/3,Y.info.render.faces+=n.numItems/3/3}else if(a instanceof r.ParticleSystem){if(i){for(c in t)u=t[c],s=e[c],0<=u&&(s?(p=s.itemSize,G.bindBuffer(G.ARRAY_BUFFER,s.buffer),h(u),G.vertexAttribPointer(u,p,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&n.defaultAttributeValues[c]&&(2===n.defaultAttributeValues[c].length?G.vertexAttrib2fv(u,n.defaultAttributeValues[c]):3===n.defaultAttributeValues[c].length&&G.vertexAttrib3fv(u,n.defaultAttributeValues[c])));n=e.position,G.drawArrays(G.POINTS,0,n.numItems/3),Y.info.render.calls++,Y.info.render.points+=n.numItems/3}}else if(a instanceof r.Line&&i){for(c in t)u=t[c],s=e[c],0<=u&&(s?(p=s.itemSize,G.bindBuffer(G.ARRAY_BUFFER,s.buffer),h(u),G.vertexAttribPointer(u,p,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&n.defaultAttributeValues[c]&&(2===n.defaultAttributeValues[c].length?G.vertexAttrib2fv(u,n.defaultAttributeValues[c]):3===n.defaultAttributeValues[c].length&&G.vertexAttrib3fv(u,n.defaultAttributeValues[c])));c=a.type===r.LineStrip?G.LINE_STRIP:G.LINES,C(n.linewidth),n=e.position,G.drawArrays(c,0,n.numItems/3),Y.info.render.calls++,Y.info.render.points+=n.numItems}},this.renderBuffer=function(e,t,i,n,o,a){if(!1!==n.visible){var s,c;e=(i=b(e,t,i,n,a)).attributes,t=!1;
1if((i=16777215*o.id+2*i.id+(n.wireframe?1:0))!==$&&($=i,t=!0),t&&l(),!n.morphTargets&&0<=e.position)t&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglVertexBuffer),h(e.position),G.vertexAttribPointer(e.position,3,G.FLOAT,!1,0,0));else if(a.morphTargetBase){if(i=n.program.attributes,-1!==a.morphTargetBase&&0<=i.position?(G.bindBuffer(G.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[a.morphTargetBase]),h(i.position),G.vertexAttribPointer(i.position,3,G.FLOAT,!1,0,0)):0<=i.position&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglVertexBuffer),h(i.position),G.vertexAttribPointer(i.position,3,G.FLOAT,!1,0,0)),a.morphTargetForcedOrder.length){var p=0;for(c=a.morphTargetForcedOrder,s=a.morphTargetInfluences;p<n.numSupportedMorphTargets&&p<c.length;)0<=i["morphTarget"+p]&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[c[p]]),h(i["morphTarget"+p]),G.vertexAttribPointer(i["morphTarget"+p],3,G.FLOAT,!1,0,0)),0<=i["morphNormal"+p]&&n.morphNormals&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglMorphNormalsBuffers[c[p]]),h(i["morphNormal"+p]),G.vertexAttribPointer(i["morphNormal"+p],3,G.FLOAT,!1,0,0)),a.__webglMorphTargetInfluences[p]=s[c[p]],p++}else{c=[];var f,d=(s=a.morphTargetInfluences).length;for(f=0;f<d;f++)0<(p=s[f])&&c.push([p,f]);for(c.length>n.numSupportedMorphTargets?(c.sort(u),c.length=n.numSupportedMorphTargets):c.length>n.numSupportedMorphNormals?c.sort(u):0===c.length&&c.push([0,0]),p=0;p<n.numSupportedMorphTargets;)c[p]?(f=c[p][1],0<=i["morphTarget"+p]&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[f]),h(i["morphTarget"+p]),G.vertexAttribPointer(i["morphTarget"+p],3,G.FLOAT,!1,0,0)),0<=i["morphNormal"+p]&&n.morphNormals&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglMorphNormalsBuffers[f]),h(i["morphNormal"+p]),G.vertexAttribPointer(i["morphNormal"+p],3,G.FLOAT,!1,0,0)),a.__webglMorphTargetInfluences[p]=s[f]):a.__webglMorphTargetInfluences[p]=0,p++}null!==n.program.uniforms.morphTargetInfluences&&G.uniform1fv(n.program.uniforms.morphTargetInfluences,a.__webglMorphTargetInfluences)}if(t){if(o.__webglCustomAttributesList)for(s=0,c=o.__webglCustomAttributesList.length;s<c;s++)0<=e[(i=o.__webglCustomAttributesList[s]).buffer.belongsToAttribute]&&(G.bindBuffer(G.ARRAY_BUFFER,i.buffer),h(e[i.buffer.belongsToAttribute]),G.vertexAttribPointer(e[i.buffer.belongsToAttribute],i.size,G.FLOAT,!1,0,0));0<=e.color&&(0<a.geometry.colors.length||0<a.geometry.faces.length?(G.bindBuffer(G.ARRAY_BUFFER,o.__webglColorBuffer),h(e.color),G.vertexAttribPointer(e.color,3,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&G.vertexAttrib3fv(e.color,n.defaultAttributeValues.color)),0<=e.normal&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglNormalBuffer),h(e.normal),G.vertexAttribPointer(e.normal,3,G.FLOAT,!1,0,0)),0<=e.tangent&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglTangentBuffer),h(e.tangent),G.vertexAttribPointer(e.tangent,4,G.FLOAT,!1,0,0)),0<=e.uv&&(a.geometry.faceVertexUvs[0]?(G.bindBuffer(G.ARRAY_BUFFER,o.__webglUVBuffer),h(e.uv),G.vertexAttribPointer(e.uv,2,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&G.vertexAttrib2fv(e.uv,n.defaultAttributeValues.uv)),0<=e.uv2&&(a.geometry.faceVertexUvs[1]?(G.bindBuffer(G.ARRAY_BUFFER,o.__webglUV2Buffer),h(e.uv2),G.vertexAttribPointer(e.uv2,2,G.FLOAT,!1,0,0)):n.defaultAttributeValues&&G.vertexAttrib2fv(e.uv2,n.defaultAttributeValues.uv2)),n.skinning&&0<=e.skinIndex&&0<=e.skinWeight&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),h(e.skinIndex),G.vertexAttribPointer(e.skinIndex,4,G.FLOAT,!1,0,0),G.bindBuffer(G.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),h(e.skinWeight),G.vertexAttribPointer(e.skinWeight,4,G.FLOAT,!1,0,0)),0<=e.lineDistance&&(G.bindBuffer(G.ARRAY_BUFFER,o.__webglLineDistanceBuffer),h(e.lineDistance),G.vertexAttribPointer(e.lineDistance,1,G.FLOAT,!1,0,0))}a instanceof r.Mesh?(n.wireframe?(C(n.wireframeLinewidth),t&&G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),G.drawElements(G.LINES,o.__webglLineCount,G.UNSIGNED_SHORT,0)):(t&&G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),G.drawElements(G.TRIANGLES,o.__webglFaceCount,G.UNSIGNED_SHORT,0)),Y.info.render.calls++,Y.info.render.vertices+=o.__webglFaceCount,Y.info.render.faces+=o.__webglFaceCount/3):a instanceof r.Line?(a=a.type===r.LineStrip?G.LINE_STRIP:G.LINES,C(n.linewidth),G.drawArrays(a,0,o.__webglLineCount),Y.info.render.calls++):a instanceof r.ParticleSystem&&(G.drawArrays(G.POINTS,0,o.__webglParticleCount),Y.info.render.calls++,Y.info.render.points+=o.__webglParticleCount)}
1},this.render=function(e,t,i,n){if(!1===t instanceof r.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var o,a,s,h,l=e.__lights,u=e.fog;for(J=-1,Ae=!0,!0===e.autoUpdate&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Me.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),be.setFromMatrix(Me),this.autoUpdateObjects&&this.initWebGLObjects(e),p(this.renderPluginsPre,e,t),Y.info.render.calls=0,Y.info.render.vertices=0,Y.info.render.faces=0,Y.info.render.points=0,this.setRenderTarget(i),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),n=0,o=(h=e.__webglObjects).length;n<o;n++)if(s=(a=h[n]).object,a.id=n,a.render=!1,s.visible&&(!(s instanceof r.Mesh||s instanceof r.ParticleSystem)||!s.frustumCulled||be.intersectsObject(s))){(m=s)._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,m.matrixWorld),m._normalMatrix.getNormalMatrix(m._modelViewMatrix);var m,g=(m=a).buffer,v=void 0,y=v=void 0;(y=m.object.material)instanceof r.MeshFaceMaterial?(v=g.materialIndex,(v=y.materials[v]).transparent?(m.transparent=v,m.opaque=null):(m.opaque=v,m.transparent=null)):(v=y)&&(v.transparent?(m.transparent=v,m.opaque=null):(m.opaque=v,m.transparent=null)),a.render=!0,!0===this.sortObjects&&(null!==s.renderDepth?a.z=s.renderDepth:(Te.getPositionFromMatrix(s.matrixWorld),Te.applyProjection(Me),a.z=Te.z))}for(this.sortObjects&&h.sort(c),n=0,o=(h=e.__webglObjectsImmediate).length;n<o;n++)(s=(a=h[n]).object).visible&&(s._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,s.matrixWorld),s._normalMatrix.getNormalMatrix(s._modelViewMatrix),(s=a.object.material).transparent?(a.transparent=s,a.opaque=null):(a.opaque=s,a.transparent=null));e.overrideMaterial?(n=e.overrideMaterial,this.setBlending(n.blending,n.blendEquation,n.blendSrc,n.blendDst),this.setDepthTest(n.depthTest),this.setDepthWrite(n.depthWrite),A(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits),f(e.__webglObjects,!1,"",t,l,u,!0,n),d(e.__webglObjectsImmediate,"",t,l,u,!1,n)):(n=null,this.setBlending(r.NoBlending),f(e.__webglObjects,!0,"opaque",t,l,u,!1,n),d(e.__webglObjectsImmediate,"opaque",t,l,u,!1,n),f(e.__webglObjects,!1,"transparent",t,l,u,!0,n),d(e.__webglObjectsImmediate,"transparent",t,l,u,!0,n)),p(this.renderPluginsPost,e,t),i&&i.generateMipmaps&&i.minFilter!==r.NearestFilter&&i.minFilter!==r.LinearFilter&&(i instanceof r.WebGLRenderTargetCube?(G.bindTexture(G.TEXTURE_CUBE_MAP,i.__webglTexture),G.generateMipmap(G.TEXTURE_CUBE_MAP),G.bindTexture(G.TEXTURE_CUBE_MAP,null)):(G.bindTexture(G.TEXTURE_2D,i.__webglTexture),G.generateMipmap(G.TEXTURE_2D),G.bindTexture(G.TEXTURE_2D,null))),this.setDepthTest(!0),this.setDepthWrite(!0)}},this.renderImmediateObject=function(e,t,i,r,n){var o=b(e,t,i,r,n);$=-1,Y.setMaterialFaces(r),n.immediateRenderCallback?n.immediateRenderCallback(o,G,be):n.render((function(e){Y.renderBufferImmediate(e,o,r)}))},this.initWebGLObjects=function(e){for(e.__webglObjects||(e.__webglObjects=[],e.__webglObjectsImmediate=[],e.__webglSprites=[],e.__webglFlares=[]);e.__objectsAdded.length;)m(e.__objectsAdded[0],e),e.__objectsAdded.splice(0,1);for(;e.__objectsRemoved.length;)x(e.__objectsRemoved[0],e),e.__objectsRemoved.splice(0,1);for(var t=0,n=e.__webglObjects.length;t<n;t++){var h=e.__webglObjects[t].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&x(h,e),m(h,e));var l=h,c=l.geometry,p=void 0,f=void 0,d=void 0;if(c instanceof r.BufferGeometry){var g=G.DYNAMIC_DRAW,_=!c.dynamic,w=c.attributes,b=void 0,M=void 0;for(b in w)(M=w[b]).needsUpdate&&("index"===b?(G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,M.buffer),G.bufferData(G.ELEMENT_ARRAY_BUFFER,M.array,g)):(G.bindBuffer(G.ARRAY_BUFFER,M.buffer),G.bufferData(G.ARRAY_BUFFER,M.array,g)),M.needsUpdate=!1),_&&!M.dynamic&&(M.array=null)}else if(l instanceof r.Mesh){for(var S=0,T=c.geometryGroupsList.length;S<T;S++)if(d=o(l,p=c.geometryGroupsList[S]),c.buffersNeedUpdate&&i(p,l),f=d.attributes&&v(d),c.verticesNeedUpdate||c.morphTargetsNeedUpdate||c.elementsNeedUpdate||c.uvsNeedUpdate||c.normalsNeedUpdate||c.colorsNeedUpdate||c.tangentsNeedUpdate||f){var C=p,A=l,E=G.DYNAMIC_DRAW,L=!c.dynamic,P=d;if(C.__inittedArrays){var D=a(P),R=!!P.vertexColors&&P.vertexColors,F=s(P),V=D===r.SmoothShading,U=void 0,z=void 0,N=void 0,O=void 0,B=void 0,I=void 0,k=void 0,H=void 0,W=void 0,j=void 0,X=void 0,Y=void 0,q=void 0,K=void 0,Q=void 0,Z=void 0,J=void 0,$=void 0,ee=void 0,te=void 0,ie=void 0,re=void 0,ne=void 0,oe=void 0,ae=void 0,se=void 0,he=void 0,le=void 0,ce=void 0,ue=void 0,pe
1=void 0,fe=void 0,de=void 0,me=void 0,ge=void 0,ve=void 0,ye=void 0,xe=void 0,_e=void 0,we=0,be=0,Ce=0,Ae=0,Ee=0,Le=0,Pe=0,De=0,Re=0,Fe=0,Ve=0,Ue=0,ze=void 0,Ne=C.__vertexArray,Oe=C.__uvArray,Be=C.__uv2Array,Ie=C.__normalArray,ke=C.__tangentArray,Ge=C.__colorArray,He=C.__skinIndexArray,We=C.__skinWeightArray,je=C.__morphTargetsArrays,Xe=C.__morphNormalsArrays,Ye=C.__webglCustomAttributesList,qe=void 0,Ke=C.__faceArray,Qe=C.__lineArray,Ze=A.geometry,Je=Ze.elementsNeedUpdate,$e=Ze.uvsNeedUpdate,et=Ze.normalsNeedUpdate,tt=Ze.tangentsNeedUpdate,it=Ze.colorsNeedUpdate,rt=Ze.morphTargetsNeedUpdate,nt=Ze.vertices,ot=C.faces3,at=Ze.faces,st=Ze.faceVertexUvs[0],ht=Ze.faceVertexUvs[1],lt=Ze.skinIndices,ct=Ze.skinWeights,ut=Ze.morphTargets,pt=Ze.morphNormals;if(Ze.verticesNeedUpdate){for(U=0,z=ot.length;U<z;U++)X=nt[(N=at[ot[U]]).a],Y=nt[N.b],q=nt[N.c],Ne[be]=X.x,Ne[be+1]=X.y,Ne[be+2]=X.z,Ne[be+3]=Y.x,Ne[be+4]=Y.y,Ne[be+5]=Y.z,Ne[be+6]=q.x,Ne[be+7]=q.y,Ne[be+8]=q.z,be+=9;G.bindBuffer(G.ARRAY_BUFFER,C.__webglVertexBuffer),G.bufferData(G.ARRAY_BUFFER,Ne,E)}if(rt)for(me=0,ge=ut.length;me<ge;me++){for(U=Ve=0,z=ot.length;U<z;U++)N=at[xe=ot[U]],X=ut[me].vertices[N.a],Y=ut[me].vertices[N.b],q=ut[me].vertices[N.c],(ve=je[me])[Ve]=X.x,ve[Ve+1]=X.y,ve[Ve+2]=X.z,ve[Ve+3]=Y.x,ve[Ve+4]=Y.y,ve[Ve+5]=Y.z,ve[Ve+6]=q.x,ve[Ve+7]=q.y,ve[Ve+8]=q.z,P.morphNormals&&(V?(J=(_e=pt[me].vertexNormals[xe]).a,$=_e.b,ee=_e.c):ee=$=J=pt[me].faceNormals[xe],(ye=Xe[me])[Ve]=J.x,ye[Ve+1]=J.y,ye[Ve+2]=J.z,ye[Ve+3]=$.x,ye[Ve+4]=$.y,ye[Ve+5]=$.z,ye[Ve+6]=ee.x,ye[Ve+7]=ee.y,ye[Ve+8]=ee.z),Ve+=9;G.bindBuffer(G.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[me]),G.bufferData(G.ARRAY_BUFFER,je[me],E),P.morphNormals&&(G.bindBuffer(G.ARRAY_BUFFER,C.__webglMorphNormalsBuffers[me]),G.bufferData(G.ARRAY_BUFFER,Xe[me],E))}if(ct.length){for(U=0,z=ot.length;U<z;U++)ne=ct[(N=at[ot[U]]).a],oe=ct[N.b],ae=ct[N.c],We[Fe]=ne.x,We[Fe+1]=ne.y,We[Fe+2]=ne.z,We[Fe+3]=ne.w,We[Fe+4]=oe.x,We[Fe+5]=oe.y,We[Fe+6]=oe.z,We[Fe+7]=oe.w,We[Fe+8]=ae.x,We[Fe+9]=ae.y,We[Fe+10]=ae.z,We[Fe+11]=ae.w,se=lt[N.a],he=lt[N.b],le=lt[N.c],He[Fe]=se.x,He[Fe+1]=se.y,He[Fe+2]=se.z,He[Fe+3]=se.w,He[Fe+4]=he.x,He[Fe+5]=he.y,He[Fe+6]=he.z,He[Fe+7]=he.w,He[Fe+8]=le.x,He[Fe+9]=le.y,He[Fe+10]=le.z,He[Fe+11]=le.w,Fe+=12;0<Fe&&(G.bindBuffer(G.ARRAY_BUFFER,C.__webglSkinIndicesBuffer),G.bufferData(G.ARRAY_BUFFER,He,E),G.bindBuffer(G.ARRAY_BUFFER,C.__webglSkinWeightsBuffer),G.bufferData(G.ARRAY_BUFFER,We,E))}if(it&&R){for(U=0,z=ot.length;U<z;U++)I=(N=at[ot[U]]).vertexColors,k=N.color,3===I.length&&R===r.VertexColors?(te=I[0],ie=I[1],re=I[2]):re=ie=te=k,Ge[Re]=te.r,Ge[Re+1]=te.g,Ge[Re+2]=te.b,Ge[Re+3]=ie.r,Ge[Re+4]=ie.g,Ge[Re+5]=ie.b,Ge[Re+6]=re.r,Ge[Re+7]=re.g,Ge[Re+8]=re.b,Re+=9;0<Re&&(G.bindBuffer(G.ARRAY_BUFFER,C.__webglColorBuffer),G.bufferData(G.ARRAY_BUFFER,Ge,E))}if(tt&&Ze.hasTangents){for(U=0,z=ot.length;U<z;U++)K=(H=(N=at[ot[U]]).vertexTangents)[0],Q=H[1],Z=H[2],ke[Pe]=K.x,ke[Pe+1]=K.y,ke[Pe+2]=K.z,ke[Pe+3]=K.w,ke[Pe+4]=Q.x,ke[Pe+5]=Q.y,ke[Pe+6]=Q.z,ke[Pe+7]=Q.w,ke[Pe+8]=Z.x,ke[Pe+9]=Z.y,ke[Pe+10]=Z.z,ke[Pe+11]=Z.w,Pe+=12;G.bindBuffer(G.ARRAY_BUFFER,C.__webglTangentBuffer),G.bufferData(G.ARRAY_BUFFER,ke,E)}if(et&&D){for(U=0,z=ot.length;U<z;U++)if(O=(N=at[ot[U]]).vertexNormals,B=N.normal,3===O.length&&V)for(ce=0;3>ce;ce++)pe=O[ce],Ie[Le]=pe.x,Ie[Le+1]=pe.y,Ie[Le+2]=pe.z,Le+=3;else for(ce=0;3>ce;ce++)Ie[Le]=B.x,Ie[Le+1]=B.y,Ie[Le+2]=B.z,Le+=3;G.bindBuffer(G.ARRAY_BUFFER,C.__webglNormalBuffer),G.bufferData(G.ARRAY_BUFFER,Ie,E)}if($e&&st&&F){for(U=0,z=ot.length;U<z;U++)if(void 0!==(W=st[ot[U]]))for(ce=0;3>ce;ce++)fe=W[ce],Oe[Ce]=fe.x,Oe[Ce+1]=fe.y,Ce+=2;0<Ce&&(G.bindBuffer(G.ARRAY_BUFFER,C.__webglUVBuffer),G.bufferData(G.ARRAY_BUFFER,Oe,E))}if($e&&ht&&F){for(U=0,z=ot.length;U<z;U++)if(void 0!==(j=ht[ot[U]]))for(ce=0;3>ce;ce++)de=j[ce],Be[Ae]=de.x,Be[Ae+1]=de.y,Ae+=2;0<Ae&&(G.bindBuffer(G.ARRAY_BUFFER,C.__webglUV2Buffer),G.bufferData(G.ARRAY_BUFFER,Be,E))}if(Je){for(U=0,z=ot.length;U<z;U++)Ke[Ee]=we,Ke[Ee+1]=we+1,Ke[Ee+2]=we+2,Ee+=3,Qe[De]=we,Qe[De+1]=we+1,Qe[De+2]=we,Qe[De+3]=we+2,Qe[De+4]=we+1,Qe[De+5]=we+2,De+=6,we+=3;G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer),G.bufferData(G.ELEMENT_ARRAY_BUFFER,Ke,E),G.bindBuffer(G.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer),G.bufferData(G.ELEMENT_ARRAY_BUFFER,Qe,E)}if(Ye)for(ce=0,ue=Ye.length;ce<ue;ce++)if((qe=Ye[ce]).__original.needsUpdate){if(Ue=0,1===qe.size){if(void 0===qe.boun
1dTo||"vertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)N=at[ot[U]],qe.array[Ue]=qe.value[N.a],qe.array[Ue+1]=qe.value[N.b],qe.array[Ue+2]=qe.value[N.c],Ue+=3;else if("faces"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)ze=qe.value[ot[U]],qe.array[Ue]=ze,qe.array[Ue+1]=ze,qe.array[Ue+2]=ze,Ue+=3}else if(2===qe.size){if(void 0===qe.boundTo||"vertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)N=at[ot[U]],X=qe.value[N.a],Y=qe.value[N.b],q=qe.value[N.c],qe.array[Ue]=X.x,qe.array[Ue+1]=X.y,qe.array[Ue+2]=Y.x,qe.array[Ue+3]=Y.y,qe.array[Ue+4]=q.x,qe.array[Ue+5]=q.y,Ue+=6;else if("faces"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)q=Y=X=ze=qe.value[ot[U]],qe.array[Ue]=X.x,qe.array[Ue+1]=X.y,qe.array[Ue+2]=Y.x,qe.array[Ue+3]=Y.y,qe.array[Ue+4]=q.x,qe.array[Ue+5]=q.y,Ue+=6}else if(3===qe.size){var ft;if(ft="c"===qe.type?["r","g","b"]:["x","y","z"],void 0===qe.boundTo||"vertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)N=at[ot[U]],X=qe.value[N.a],Y=qe.value[N.b],q=qe.value[N.c],qe.array[Ue]=X[ft[0]],qe.array[Ue+1]=X[ft[1]],qe.array[Ue+2]=X[ft[2]],qe.array[Ue+3]=Y[ft[0]],qe.array[Ue+4]=Y[ft[1]],qe.array[Ue+5]=Y[ft[2]],qe.array[Ue+6]=q[ft[0]],qe.array[Ue+7]=q[ft[1]],qe.array[Ue+8]=q[ft[2]],Ue+=9;else if("faces"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)q=Y=X=ze=qe.value[ot[U]],qe.array[Ue]=X[ft[0]],qe.array[Ue+1]=X[ft[1]],qe.array[Ue+2]=X[ft[2]],qe.array[Ue+3]=Y[ft[0]],qe.array[Ue+4]=Y[ft[1]],qe.array[Ue+5]=Y[ft[2]],qe.array[Ue+6]=q[ft[0]],qe.array[Ue+7]=q[ft[1]],qe.array[Ue+8]=q[ft[2]],Ue+=9;else if("faceVertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)X=(ze=qe.value[ot[U]])[0],Y=ze[1],q=ze[2],qe.array[Ue]=X[ft[0]],qe.array[Ue+1]=X[ft[1]],qe.array[Ue+2]=X[ft[2]],qe.array[Ue+3]=Y[ft[0]],qe.array[Ue+4]=Y[ft[1]],qe.array[Ue+5]=Y[ft[2]],qe.array[Ue+6]=q[ft[0]],qe.array[Ue+7]=q[ft[1]],qe.array[Ue+8]=q[ft[2]],Ue+=9}else if(4===qe.size)if(void 0===qe.boundTo||"vertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)N=at[ot[U]],X=qe.value[N.a],Y=qe.value[N.b],q=qe.value[N.c],qe.array[Ue]=X.x,qe.array[Ue+1]=X.y,qe.array[Ue+2]=X.z,qe.array[Ue+3]=X.w,qe.array[Ue+4]=Y.x,qe.array[Ue+5]=Y.y,qe.array[Ue+6]=Y.z,qe.array[Ue+7]=Y.w,qe.array[Ue+8]=q.x,qe.array[Ue+9]=q.y,qe.array[Ue+10]=q.z,qe.array[Ue+11]=q.w,Ue+=12;else if("faces"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)q=Y=X=ze=qe.value[ot[U]],qe.array[Ue]=X.x,qe.array[Ue+1]=X.y,qe.array[Ue+2]=X.z,qe.array[Ue+3]=X.w,qe.array[Ue+4]=Y.x,qe.array[Ue+5]=Y.y,qe.array[Ue+6]=Y.z,qe.array[Ue+7]=Y.w,qe.array[Ue+8]=q.x,qe.array[Ue+9]=q.y,qe.array[Ue+10]=q.z,qe.array[Ue+11]=q.w,Ue+=12;else if("faceVertices"===qe.boundTo)for(U=0,z=ot.length;U<z;U++)X=(ze=qe.value[ot[U]])[0],Y=ze[1],q=ze[2],qe.array[Ue]=X.x,qe.array[Ue+1]=X.y,qe.array[Ue+2]=X.z,qe.array[Ue+3]=X.w,qe.array[Ue+4]=Y.x,qe.array[Ue+5]=Y.y,qe.array[Ue+6]=Y.z,qe.array[Ue+7]=Y.w,qe.array[Ue+8]=q.x,qe.array[Ue+9]=q.y,qe.array[Ue+10]=q.z,qe.array[Ue+11]=q.w,Ue+=12;G.bindBuffer(G.ARRAY_BUFFER,qe.buffer),G.bufferData(G.ARRAY_BUFFER,qe.array,E)}L&&(delete C.__inittedArrays,delete C.__colorArray,delete C.__normalArray,delete C.__tangentArray,delete C.__uvArray,delete C.__uv2Array,delete C.__faceArray,delete C.__vertexArray,delete C.__lineArray,delete C.__skinIndexArray,delete C.__skinWeightArray)}}c.verticesNeedUpdate=!1,c.morphTargetsNeedUpdate=!1,c.elementsNeedUpdate=!1,c.uvsNeedUpdate=!1,c.normalsNeedUpdate=!1,c.colorsNeedUpdate=!1,c.tangentsNeedUpdate=!1,c.buffersNeedUpdate=!1,d.attributes&&y(d)}else if(l instanceof r.Line){if(f=(d=o(l,c)).attributes&&v(d),c.verticesNeedUpdate||c.colorsNeedUpdate||c.lineDistancesNeedUpdate||f){var dt=c,mt=G.DYNAMIC_DRAW,gt=void 0,vt=void 0,yt=void 0,xt=void 0,_t=void 0,wt=void 0,bt=dt.vertices,Mt=dt.colors,St=dt.lineDistances,Tt=bt.length,Ct=Mt.length,At=St.length,Et=dt.__vertexArray,Lt=dt.__colorArray,Pt=dt.__lineDistanceArray,Dt=dt.colorsNeedUpdate,Rt=dt.lineDistancesNeedUpdate,Ft=dt.__webglCustomAttributesList,Vt=void 0,Ut=void 0,zt=void 0,Nt=void 0,Ot=void 0,Bt=void 0;if(dt.verticesNeedUpdate){for(gt=0;gt<Tt;gt++)xt=bt[gt],Et[_t=3*gt]=xt.x,Et[_t+1]=xt.y,Et[_t+2]=xt.z;G.bindBuffer(G.ARRAY_BUFFER,dt.__webglVertexBuffer),G.bufferData(G.ARRAY_BUFFER,Et,mt)}if(Dt){for(vt=0;vt<Ct;vt++)wt=Mt[vt],Lt[_t=3*vt]=wt.r,Lt[_t+1]=wt.g,Lt[_t+2]=wt.b;G.bindBuffer(G.ARRAY_BUFFER,dt.__webglColorBuffer),G.bufferData(G.ARRAY_BUFFER,Lt,mt)}if(Rt){for(yt=0;yt<At;yt++)Pt[yt]=St[yt];G.bindBuffer(G.ARRAY_BUFFER,dt.__webglLineDistanceBuffer),G.bufferData(G.ARRAY_BUFFER,Pt,mt)}if(Ft)for(Vt=0,Ut=Ft.length;Vt<Ut;Vt++)if((Bt=Ft[Vt]).needsUpdate&&(void 0===Bt.boundTo||"vertices"===Bt.boundTo)){if(_t=0,Nt=Bt.value.length,1===Bt.size)for(zt=0;zt<Nt;zt++)Bt.array[zt]=Bt.value[zt];
1else if(2===Bt.size)for(zt=0;zt<Nt;zt++)Ot=Bt.value[zt],Bt.array[_t]=Ot.x,Bt.array[_t+1]=Ot.y,_t+=2;else if(3===Bt.size)if("c"===Bt.type)for(zt=0;zt<Nt;zt++)Ot=Bt.value[zt],Bt.array[_t]=Ot.r,Bt.array[_t+1]=Ot.g,Bt.array[_t+2]=Ot.b,_t+=3;else for(zt=0;zt<Nt;zt++)Ot=Bt.value[zt],Bt.array[_t]=Ot.x,Bt.array[_t+1]=Ot.y,Bt.array[_t+2]=Ot.z,_t+=3;else if(4===Bt.size)for(zt=0;zt<Nt;zt++)Ot=Bt.value[zt],Bt.array[_t]=Ot.x,Bt.array[_t+1]=Ot.y,Bt.array[_t+2]=Ot.z,Bt.array[_t+3]=Ot.w,_t+=4;G.bindBuffer(G.ARRAY_BUFFER,Bt.buffer),G.bufferData(G.ARRAY_BUFFER,Bt.array,mt)}}c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,c.lineDistancesNeedUpdate=!1,d.attributes&&y(d)}else if(l instanceof r.ParticleSystem){if(f=(d=o(l,c)).attributes&&v(d),c.verticesNeedUpdate||c.colorsNeedUpdate||l.sortParticles||f){var It=c,kt=G.DYNAMIC_DRAW,Gt=l,Ht=void 0,Wt=void 0,jt=void 0,Xt=void 0,Yt=void 0,qt=void 0,Kt=It.vertices,Qt=Kt.length,Zt=It.colors,Jt=Zt.length,$t=It.__vertexArray,ei=It.__colorArray,ti=It.__sortArray,ii=It.verticesNeedUpdate,ri=It.colorsNeedUpdate,ni=It.__webglCustomAttributesList,oi=void 0,ai=void 0,si=void 0,hi=void 0,li=void 0,ci=void 0;if(Gt.sortParticles){for(Se.copy(Me),Se.multiply(Gt.matrixWorld),Ht=0;Ht<Qt;Ht++)jt=Kt[Ht],Te.copy(jt),Te.applyProjection(Se),ti[Ht]=[Te.z,Ht];for(ti.sort(u),Ht=0;Ht<Qt;Ht++)jt=Kt[ti[Ht][1]],$t[Xt=3*Ht]=jt.x,$t[Xt+1]=jt.y,$t[Xt+2]=jt.z;for(Wt=0;Wt<Jt;Wt++)Xt=3*Wt,qt=Zt[ti[Wt][1]],ei[Xt]=qt.r,ei[Xt+1]=qt.g,ei[Xt+2]=qt.b;if(ni)for(oi=0,ai=ni.length;oi<ai;oi++)if(void 0===(ci=ni[oi]).boundTo||"vertices"===ci.boundTo)if(Xt=0,hi=ci.value.length,1===ci.size)for(si=0;si<hi;si++)Yt=ti[si][1],ci.array[si]=ci.value[Yt];else if(2===ci.size)for(si=0;si<hi;si++)Yt=ti[si][1],li=ci.value[Yt],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,Xt+=2;else if(3===ci.size)if("c"===ci.type)for(si=0;si<hi;si++)Yt=ti[si][1],li=ci.value[Yt],ci.array[Xt]=li.r,ci.array[Xt+1]=li.g,ci.array[Xt+2]=li.b,Xt+=3;else for(si=0;si<hi;si++)Yt=ti[si][1],li=ci.value[Yt],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,ci.array[Xt+2]=li.z,Xt+=3;else if(4===ci.size)for(si=0;si<hi;si++)Yt=ti[si][1],li=ci.value[Yt],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,ci.array[Xt+2]=li.z,ci.array[Xt+3]=li.w,Xt+=4}else{if(ii)for(Ht=0;Ht<Qt;Ht++)jt=Kt[Ht],$t[Xt=3*Ht]=jt.x,$t[Xt+1]=jt.y,$t[Xt+2]=jt.z;if(ri)for(Wt=0;Wt<Jt;Wt++)qt=Zt[Wt],ei[Xt=3*Wt]=qt.r,ei[Xt+1]=qt.g,ei[Xt+2]=qt.b;if(ni)for(oi=0,ai=ni.length;oi<ai;oi++)if((ci=ni[oi]).needsUpdate&&(void 0===ci.boundTo||"vertices"===ci.boundTo))if(hi=ci.value.length,Xt=0,1===ci.size)for(si=0;si<hi;si++)ci.array[si]=ci.value[si];else if(2===ci.size)for(si=0;si<hi;si++)li=ci.value[si],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,Xt+=2;else if(3===ci.size)if("c"===ci.type)for(si=0;si<hi;si++)li=ci.value[si],ci.array[Xt]=li.r,ci.array[Xt+1]=li.g,ci.array[Xt+2]=li.b,Xt+=3;else for(si=0;si<hi;si++)li=ci.value[si],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,ci.array[Xt+2]=li.z,Xt+=3;else if(4===ci.size)for(si=0;si<hi;si++)li=ci.value[si],ci.array[Xt]=li.x,ci.array[Xt+1]=li.y,ci.array[Xt+2]=li.z,ci.array[Xt+3]=li.w,Xt+=4}if((ii||Gt.sortParticles)&&(G.bindBuffer(G.ARRAY_BUFFER,It.__webglVertexBuffer),G.bufferData(G.ARRAY_BUFFER,$t,kt)),(ri||Gt.sortParticles)&&(G.bindBuffer(G.ARRAY_BUFFER,It.__webglColorBuffer),G.bufferData(G.ARRAY_BUFFER,ei,kt)),ni)for(oi=0,ai=ni.length;oi<ai;oi++)((ci=ni[oi]).needsUpdate||Gt.sortParticles)&&(G.bindBuffer(G.ARRAY_BUFFER,ci.buffer),G.bufferData(G.ARRAY_BUFFER,ci.array,kt))}c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,d.attributes&&y(d)}}},this.initMaterial=function(e,t,i,n){var o,a,s,h,l,c,u,p,f;if(e.addEventListener("dispose",je),e instanceof r.MeshDepthMaterial?f="depth":e instanceof r.MeshNormalMaterial?f="normal":e instanceof r.MeshBasicMaterial?f="basic":e instanceof r.MeshLambertMaterial?f="lambert":e instanceof r.MeshPhongMaterial?f="phong":e instanceof r.LineBasicMaterial?f="basic":e instanceof r.LineDashedMaterial?f="dashed":e instanceof r.ParticleSystemMaterial&&(f="particle_basic"),f){var d=r.ShaderLib[f];e.uniforms=r.UniformsUtils.clone(d.uniforms),e.vertexShader=d.vertexShader,e.fragmentShader=d.fragmentShader}var m=o=0,g=0,v=d=0;for(a=t.length;v<a;v++)(s=t[v]).onlyShadow||(s instanceof r.DirectionalLight&&o++,s instanceof r.PointLight&&m++,s instanceof r.SpotLight&&g++,s instanceof r.HemisphereLight&&d++);for(a=m,s=g,h=d,g=d=0,m=t.length;g<m;g++)(v=t[g]).castShadow&&(v instanceof r.SpotLight&&d++,v instanceof r.DirectionalLight&&!v.shadowCascade&&d++);p=d,Ue&&n&&n.useVertexTexture?u=1024:(t=G.getParameter(G.MAX_VERTEX_UNIFORM_VECTORS),t=Math.floor((t-20)/4),void 0!==n&&n instanceof r.SkinnedMesh&&((t=Math.min(n.bones.length,t))<n.bones.length&&console.warn("WebGLRenderer: too many bones - "+n.bones.length+", this GPU supports just "+t+" (try OpenGL instead of ANGLE)")),u=t);e:{var y,x,_,w;g=e.fragmentShader,m=e.vertexShader,d=e.uniforms,t=e.attributes,v=e.defines,i={map:!!e.map,envMap:!!e.envMap,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,vertexColors:e.vertexColors,fog:i,useFog:e.fog,fogExp:i instanceof r.FogExp2,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,maxBones:u,useVertexTexture:Ue&&n&&n.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:o,maxPointLights:a,maxSpotLights:s,maxHemiLights:h,maxShadows:p,shadowMapEnabled:this.shadowMapEnabled&&n.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,perPixel:e.perPixel,wrapAround:e.wrapAround,doubleSided:e.side===r.DoubleSide,flipSided:e.side===r.BackSide},n=e.index0AttributeName;for(x in o=[],f?o.push(f):(o.push(g),o.push(m)),v)o.push(x),o.push(v[x]);for(y in i)o.push(y),o.push(i[y]);for(f=o.join(),y=0,x=q.length;y<x;y++)if((o=q[y]).code===f){o.usedTimes++,c=o.program;break e}for(_ in y="SHADOWMAP_TYPE_BASIC",i.shadowMapType===r.PCFShadowMap?y="SHADOWMAP_TYPE_PCF":i.shadowMapType===r.PCFSoftShadowMap&&(y="SHADOWMAP_TYPE_PCF_SOFT"),x=[],v)!1!==(o=v[_])&&(o="#define "+_+" "+o,x.push(o));for(w in o=x.join("\n"),_=G.createProgram(),x=["precision "+V+" float;","precision "+V+" int;",o,Ve?"#define VERTEX_TEXTURES":"",Y.gammaInput?"#define GAMMA_INPUT":"",Y.gammaOutput?"#define GAMMA_OUTPUT":"",Y.physicallyBasedSha
1ding?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.vertexColors?"#define USE_COLOR":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals?"#define USE_MORPHNORMALS":"",i.perPixel?"#define PHONG_PER_PIXEL":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+y:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"),y=["precision "+V+" float;","precision "+V+" int;",i.bumpMap||i.normalMap?"#extension GL_OES_standard_derivatives : enable":"",o,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"",Y.gammaInput?"#define GAMMA_INPUT":"",Y.gammaOutput?"#define GAMMA_OUTPUT":"",Y.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.vertexColors?"#define USE_COLOR":"",i.metal?"#define METAL":"",i.perPixel?"#define PHONG_PER_PIXEL":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+y:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"),x=E("vertex",x+m),y=E("fragment",y+g),G.attachShader(_,x),G.attachShader(_,y),n&&G.bindAttribLocation(_,0,n),G.linkProgram(_),G.getProgramParameter(_,G.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+G.getProgramParameter(_,G.VALIDATE_STATUS)+", gl error ["+G.getError()+"]"),console.error("Program Info Log: "+G.getProgramInfoLog(_))),G.deleteShader(y),G.deleteShader(x),_.uniforms={},_.attributes={},y="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" "),i.useVertexTexture?(y.push("boneTexture"),y.push("boneTextureWidth"),y.push("boneTextureHeight")):y.push("boneGlobalMatrices"),d)y.push(w);for(w=y,y=0,x=w.length;y<x;y++)d=w[y],_.uniforms[d]=G.getUniformLocation(_,d);for(y="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" "),w=0;w<i.maxMorphTargets;w++)y.push("morphTarget"+w);for(w=0;w<i.maxMorphNormals;w++)y.push("morphNormal"+w);for(c in t)y.push(c);for(w=0,t=(c=y).length;w<t;w++)y=c[w],_.attributes[y]=G.getAttribLocation(_,y);_.id=K++,q.push({program:_,code:f,usedTimes:1}),Y.info.memory.programs=q.length,c=_}if(e.program=c,w=e.program.attributes,e.morphTargets)for(e.numSupportedMorphTargets=0,t="morphTarget",c=0;c<this.maxMorphTargets;c++)0<=w[_=t+c]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(e.numSupportedMorphNormals=0,t="morphNormal",c=0;c<this.maxMorphNormals;c++)0<=w[_=t+c]&&e.numSupportedMorphNormals++;for(l in e.uniformsList=[],e.uniforms)e.uniformsList.push([e.uniforms[l],l])},this.setFaceCulling=function(e,t){e===r.CullFaceNone?G.disable(G.CULL_FACE):(t===r.FrontFaceDirectionCW?G.frontFace(G.CW):G.frontFace(G.CCW),e===r.CullFaceBack?G.cullFace(G.BACK):e===r.CullFaceFront?G.cullFace(G.FRONT):G.cullFace(G.FRONT_AND_BACK),G.enable(G.CULL_FACE))},this.setMaterialFaces=function(e){var t=e.side===r.DoubleSide;e=e.side===r.BackSide;re!==t&&(t?G.disable(G.CULL_FACE):G.enable(G.CULL_FACE),re=t),ne!==e&&(e?G.frontFace(G.CW):G.frontFace(G.CCW),ne=e)},this.setDepthTest=function(e){le!==e&&(e?G.enable(G.DEPTH_TEST):G.disable(G.DEPTH_TEST),le=e)},this.setDepthWrite=function(e){ce!==e&&(G.depthMask(e),ce=e)},this.setBlending=function(e,t,i,n){e!==oe&&(e===r.NoBlending?G.disable(G.BLEND):e===r.AdditiveBlending?(G.enable(G.BLEND),G.blendEquation(G.FUNC_ADD),G.blendFunc(G.SRC_ALPHA,G.ONE)):e===r.SubtractiveBlending?(G.enable(G.BLEND),G.blendEquation(G.FUNC_ADD),G.blendFunc(G.ZERO,G.ONE_MINUS_SRC_COLOR)):e===r.MultiplyBlending?(G.enable(G.BLEND),G.blendEquation(G.FUNC_ADD),G.blendFunc(G.ZERO,G.SRC_COLOR)):e===r.CustomBlending?G.enable(G.BLEND):(G.enable(G.BLEND),G.blendEquationSeparate(G.FUNC_ADD,G.FUNC_ADD),G.blendFuncSeparate(G.SRC_ALPHA,G.ONE_MINUS_SRC_ALPHA,G.ONE,G.ONE_MINUS_SRC_ALPHA)),oe=e),e===r.CustomBlending?(t!==ae&&(G.blendEquation(R(t)),ae=t),(i!==se||n!==he)&&(G.blendFunc(R(i),R(n)),se=i,he=n)):he=se=ae=null},this.setTexture=function(e,t){if(e.needsUpdate){e.__webglInit||(e.__webglInit=!0,e.addEventListener("dispose",He),e.__webglTexture=G.createTexture(),Y.info.memory.textures++),G.activeTexture(G.TEXTURE0+t),G.bindTexture(G.TEXTURE_2D,e.__webglTexture),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,e.flipY),G.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),G.pixelStorei(G.UNPACK_ALIGNMENT,e.unpackAlignment);var i=e.image,n=0===(i.width&i.width-1)&&0===(i.height&i.height-1),o=R(e.format),a=R(e.type);L(G.TEXTURE_2D,e,n);var s=e.mipmaps;if(e instanceof r.DataTexture)if(0<s.length&&n){for(var h=0,l=s.length;h<l;h++)i=s[h],G.texImage2D(G.TEXTURE_2D,h,o,i.width,i.height,0,o,a,i.data);e.generateMipmaps=!1}else G.texImage2D(G.TEXTURE_2D,0,o,i.width,i.height,0,o,a,i.data);else if(e instanceof r.CompressedTexture)for(h=0,l=s.length;h<l;h++)i=s[h],e.format!==r.RGBAFormat?G.compressedTexImage2D(G.TEXTURE_2D,h,o,i.width,i.height,0,i.data):G.texImage2D(G.TEXTURE_2D,h,o,i.width,i.height,0,o,a,i.data);else if(0<s.length&&n){for(h=0,l=s.length;h<l;h++)i=s[h],G.texImage2D(G.TEXTURE_2D,h,o,o,a,i);e.generateMipmaps=!1}else G.texImage2D(G.TEXTURE_2D,0,o,o,a,e.image);e.generateMipmaps&&n&&G.generateMipmap(G.TEXTURE_2D),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else G.activeTexture(G.TEXTURE0+t),G.bindTexture(G.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof r.WebGLRenderTargetCube;if(e&&!e.__webglFramebuffer){void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",We),e.__webglTexture=G.createTexture(),Y.info.memory.textures++;var i=0===(e.width&e.width-1)&&0===(e.height&e.height-1),n=R(e.format),o=R(e.type);if(t){e.__webglFramebuffer=[],e.__webglRenderbuffer=[],G.bindTexture(G.TEXTURE_CUBE_MAP,e.__webglTexture),L(G.TEXTURE_CUBE_MAP,e,i);for(var a=0;6>a;a++){e.__webglFramebuffer[a]=G.createFramebuffer(),e.__webglRenderbuffer[a]=G.createRenderbuffer(),G.texImage2D(G.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,n,e.width,e.height,0,n,o,null);var s=e,h=G.TEXTURE_CUBE_MAP_POSITIVE_X+a;G.bindFramebuffer(G.FRAMEBUFFER,e.__webglFramebuffer[a]),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,h,s.__webglTexture,0),P(e.__webglRenderbuffer[a],e)}i&&G.generateMipmap(G.TEXTURE_CUBE_MAP)}else e.__webglFramebuffer=G.createFramebuffer(),e.__webglRenderbuffer=e.shareDepthFrom?e.shareDepthFrom.__webglRenderbuffer:G.createRenderbuffer(),G.bindTexture(G.TEXTURE_2D,e.__webglTexture),L(G.TEXTURE_2D,e,i),G.texImage2D(G.TEXTURE_2D,0,n,e.width,e.height,0,n,o,null),n=G.TEXTURE_2D,G.bindFramebuffer(G.FRAMEBUFFER,e.__webglFramebuffer),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,n,e.__webglTexture,0),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?G.framebufferRenderbuffer(G.FRAMEBUFFER,G.DEPTH_ATTACHMENT,G.RENDERBUFFER,e.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&G.framebufferRenderbuffer(G.FRAMEBUFFER,G.DEPTH_STENCIL_ATTACHMENT,G.RENDERBUFFER,e.__webglRenderbuffer):P(e.__webglRenderbuffer,e),i&&G.generateMipmap(G.TEXTURE_2D);t?G.bindTexture(G.TEXTURE_CUBE_MAP,null):G.bindTexture(G.TEXTURE_2D,null),G.bindRenderbuffer(G.RENDERBUFFER,null),G.bindFramebuffer(G.FRAMEBUFFER,null)}e?(t=t?e.__webglFramebuffer[e.activeCubeFace]:e.__webglFramebuffer,i=e.width,e=e.height,o=n=0):(t=null,i=ve,e=ye,n=me,o=ge),t!==Z&&(G.bindFramebuffer(G.FRAMEBUFFER,t),G.viewport(n,o,i,e),Z=t),xe=i,_e=e},this.shadowMapPlugin=new r.ShadowMapPlugin,this.addPrePlugin(this.shadowMapPlugin),this.addPostPlugin(new r.SpritePlugin),this.addPostPlugin(new r.LensFlarePlugin)},r.WebGLRenderTarget=function(e,t,i){this.width=e,this.height=t,i=i||{},this.wrapS=void 0!==i.wrapS?i.wrapS:r.ClampToEdgeWrapping,this.wrapT=void 0!==i.wrapT?i.wrapT:r.ClampToEdgeWrapping,this.magFilter=void 0!==i.magFilter?i.magFilter:r.LinearFilter,this.minFilter=void 0!==i.minFilter?i.minFilter:r.LinearMipMapLinearFilter,this.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,this.offset=new r.Vector2(0,0),this.repeat=new r.Vector2(1,1),this.format=void 0!==i.format?i.format:r.RGBAFormat,this.type=void 0!==i.type?i.type:r.UnsignedByteType,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.generateMipmaps=!0,this.shareDepthFrom=null},r.WebGLRenderTarget.prototype={constructor:r.WebGLRenderTarget,clone:function(){var e=new r.WebGLRenderTarget(this.width,this.height);return e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.format=this.format,e.type=this.t
1ype,e.depthBuffer=this.depthBuffer,e.stencilBuffer=this.stencilBuffer,e.generateMipmaps=this.generateMipmaps,e.shareDepthFrom=this.shareDepthFrom,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},r.EventDispatcher.prototype.apply(r.WebGLRenderTarget.prototype),r.WebGLRenderTargetCube=function(e,t,i){r.WebGLRenderTarget.call(this,e,t,i),this.activeCubeFace=0},r.WebGLRenderTargetCube.prototype=Object.create(r.WebGLRenderTarget.prototype),r.RenderableVertex=function(){this.positionWorld=new r.Vector3,this.positionScreen=new r.Vector4,this.visible=!0},r.RenderableVertex.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)},r.RenderableFace3=function(){this.id=0,this.v1=new r.RenderableVertex,this.v2=new r.RenderableVertex,this.v3=new r.RenderableVertex,this.centroidModel=new r.Vector3,this.normalModel=new r.Vector3,this.normalModelView=new r.Vector3,this.vertexNormalsLength=0,this.vertexNormalsModel=[new r.Vector3,new r.Vector3,new r.Vector3],this.vertexNormalsModelView=[new r.Vector3,new r.Vector3,new r.Vector3],this.material=this.color=null,this.uvs=[[]],this.z=0},r.RenderableObject=function(){this.id=0,this.object=null,this.z=0},r.RenderableSprite=function(){this.id=0,this.object=null,this.rotation=this.z=this.y=this.x=0,this.scale=new r.Vector2,this.material=null},r.RenderableLine=function(){this.id=0,this.v1=new r.RenderableVertex,this.v2=new r.RenderableVertex,this.vertexColors=[new r.Color,new r.Color],this.material=null,this.z=0},r.GeometryUtils={merge:function(e,t,i){var n,o,a=e.vertices.length,s=t instanceof r.Mesh?t.geometry:t,h=e.vertices,l=s.vertices,c=e.faces,u=s.faces;e=e.faceVertexUvs[0],s=s.faceVertexUvs[0];void 0===i&&(i=0),t instanceof r.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,o=(new r.Matrix3).getNormalMatrix(n));t=0;for(var p=l.length;t<p;t++){var f=l[t].clone();n&&f.applyMatrix4(n),h.push(f)}for(t=0,p=u.length;t<p;t++){var d,m,g=(f=u[t]).vertexNormals,v=f.vertexColors;for((d=new r.Face3(f.a+a,f.b+a,f.c+a)).normal.copy(f.normal),o&&d.normal.applyMatrix3(o).normalize(),h=0,l=g.length;h<l;h++)m=g[h].clone(),o&&m.applyMatrix3(o).normalize(),d.vertexNormals.push(m);for(d.color.copy(f.color),h=0,l=v.length;h<l;h++)m=v[h],d.vertexColors.push(m.clone());d.materialIndex=f.materialIndex+i,d.centroid.copy(f.centroid),n&&d.centroid.applyMatrix4(n),c.push(d)}for(t=0,p=s.length;t<p;t++){for(n=[],h=0,l=(i=s[t]).length;h<l;h++)n.push(new r.Vector2(i[h].x,i[h].y));e.push(n)}},randomPointInTriangle:function(){var e=new r.Vector3;return function(t,i,n){var o=new r.Vector3,a=r.Math.random16(),s=r.Math.random16();1<a+s&&(a=1-a,s=1-s);var h=1-a-s;return o.copy(t),o.multiplyScalar(a),e.copy(i),e.multiplyScalar(s),o.add(e),e.copy(n),e.multiplyScalar(h),o.add(e),o}}(),randomPointInFace:function(e,t){return r.GeometryUtils.randomPointInTriangle(t.vertices[e.a],t.vertices[e.b],t.vertices[e.c])},randomPointsInGeometry:function(e,t){function i(e){return function t(i,r){if(r<i)return i;var n=i+Math.floor((r-i)/2);return f[n]>e?t(i,n-1):f[n]<e?t(n+1,r):n}(0,f.length-1)}var n,o,a,s,h,l=e.faces,c=e.vertices,u=l.length,p=0,f=[];for(o=0;o<u;o++)a=c[(n=l[o]).a],s=c[n.b],h=c[n.c],n._area=r.GeometryUtils.triangleArea(a,s,h),p+=n._area,f[o]=p;for(n=[],o=0;o<t;o++)c=i(c=r.Math.random16()*p),n[o]=r.GeometryUtils.randomPointInFace(l[c],e,!0);return n},triangleArea:function(){var e=new r.Vector3,t=new r.Vector3;return function(i,r,n){return e.subVectors(r,i),t.subVectors(n,i),e.cross(t),.5*e.length()}}(),center:function(e){e.computeBoundingBox();var t=e.boundingBox,i=new r.Vector3;return i.addVectors(t.min,t.max),i.multiplyScalar(-.5),e.applyMatrix((new r.Matrix4).makeTranslation(i.x,i.y,i.z)),e.computeBoundingBox(),i},triangulateQuads:function(e){var t,i,r,n,o=[],a=[];for(t=0,i=e.faceVertexUvs.length;t<i;t++)a[t]=[];for(t=0,i=e.faces.length;t<i;t++)for(o.push(e.faces[t]),r=0,n=e.faceVertexUvs.length;r<n;r++)a[r].push(e.faceVertexUvs[r][t]);e.faces=o,e.faceVertexUvs=a,e.computeCentroids(),e.computeFaceNormals(),e.computeVertexNormals(),e.hasTangents&&e.computeTangents()}},r.ImageUtils={crossOrigin:"anonymous",loadTexture:function(e,t,i){var n=new r.ImageLoader;n.crossOrigin=this.crossOrigin;var o=new r.Texture(void 0,t);t=n.load(e,(function(){o.needsUpdate=!0,i&&i(o)}));return o.image=t,o.sourceFile=e,o},loadCompressedTexture:function(e,t,i,n){var o=new r.CompressedTexture;o.mapping=t;var a=new XMLHttpRequest;return a.onload=function(){var e=r.ImageUtils.parseDDS(a.response,!0);o.format=e.format,o.mipmaps=e.mipmaps,o.image.width=e.width,o.image.height=e.height,o.generateMipmaps=!1,o.needsUpdate=!0,i&&i(o)},a.onerror=n,a.open("GET",e,!0),a.responseType="arraybuffer",a.send(null),o},loadTextureCube:function(e,t,i,n){var o=[];o.loadCount=0;var a=new r.Texture;a.image=o,void 0!==t&&(a.mapping=t),a.flipY=!1;t=0;for(var s=e.length;t<s;++t){var h=new Image;o[t]=h,h.onload=function(){o.loadCount+=1,6===o.loadCount&&(a.needsUpdate=!0,i&&i(a))},h.onerror=n,h.crossOrigin=this.crossOrigin,h.src=e[t]}return a},loadCompressedTextureCube:function(e,t,i,n){var o=[];o.loadCount=0;var a=new r.CompressedTexture;if(a.image=o,void 0!==t&&(a.mapping=t),a.flipY=!1,a.generateMipmaps=!1,t=function(e,t){return function(){var n=r.ImageUtils.parseDDS(e.response,!0);t.format=n.format,t.mipmaps=n.mipmaps,t.width=n.width,t.height=n.height,o.loadCount+=1,6===o.loadCount&&(a.format=n.format,a.needsUpdate=!0,i&&i(a))}},e instanceof Array)for(var s=0,h=e.length;s<h;++s){var l={};o[s]=l;var c=new XMLHttpRequest;c.onload=t(c,l),c.onerror=n,l=e[s],c.open("GET",l,!0),c.responseType="arraybuffer",c.send(null)}else(c=new XMLHttpRequest).onload=function(){var e=r.ImageUtils.parseDDS(c.response,!0);if(e.isCubemap){for(var t=e.mipmaps.length/e.mipmapCount,n=0;n<t;n++){o[n]={mipmaps:[]};for(var s=0;s<e.mipmapCount;s++)o[n].mipmaps.push(e.mipmaps[n*e.mipmapCount+s]),o[n].format=e.format,o[n].width=e.width,o[n].height=e.height}a.format=e.format,a.needsUpdate=!0,i&&i(a)}},c.onerror=n,c.open("GET",e,!0),c.responseType="arraybuffer",c.send(null);return a},loadDDSTexture:function(e,t,i,n){var o=[];o.loadCount=0;var a=new r.CompressedTexture;a.image=o,void 0!==t&&(a.mapping=t),a.flipY=!1,a.generateMipmaps=!1;var s=new XMLHttpRequest;return s.onload=function(){var e=r.ImageUtils.parseDDS(s.response,!0);if(e.isCubemap)for(var t=e.mipmaps.length/e.mipmapCount,n=0;n<t;n++){o[n]={mipmaps:[]};for(var h=0;h<e.mipmapCount;h++)o[n].mipmaps.push(e.mipmaps[n*e.mipmapCount+h]),o[n].format=e.format,o[n].width=e.width,o[n].height=e.height}else a.image.width=e.width,a.image.height=e.height,a.mipmaps=e.mipmaps;a.format=e.format,a.needsUpdate=!0,i&&i(a)},s.onerror=n,s.open("GET",e,!0),s.responseType="arraybuffer",s.send(null),a},parseDDS:function(e,t){function i(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var n={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},o=i("DXT1"),a=i("DXT3"),s=i("DXT5");if(542327876!==(l=new Int32Array(e,0,31))[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),n;if(4&!l[20])return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),n;var h=!1;switch(c=l[21]){case o:o=8,n.format=r.RGB_S3TC_DXT1_Format;break;case a:o=16,n.format=r.RGBA_S3TC_DXT3_Format;break;case s:o=16,n.format=r.RGBA_S3TC_DXT5_Format;break;default:if(!(32==l[22]&&16711680&l[23]&&65280&l[24]&&255&l[25]&&4278190080&l[26]))return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(255&c,c>>8&255,c>>16&255,c>>24&255)),n;h=!0,o=64,n.format=r.RGBAFormat}n.mipmapCount=1,131072&l[2]&&!1!==t&&(n.mipmapCount=Math.max(1,l[7])),n.isCubemap=!!(512&l[28]),n.width=l[4],n.height=l[3];for(var l=l[1]+4,c=(a=n.width,s=n.height,n.isCubemap?6:1),u=0;u<c;u++){for(var p=0;p<n.mipmapCount;p++){if(h){for(var f,d=s,m=4*(f=a)*d,g=new Uint8Array(e,l,m),v=(m=new Uint8Array(m),0),y=0,x=0;x<d;x++)for(var _=0;_<f;_++){var w=g[y],b=g[++y],M=g[++y],S=g[++y];y++,m[v]=M,m[++v]=b,m[++v]=w,m[++v]=S,v++}d=(f=m).length}else d=Math.max(4,a)/4*Math.max(4,s)/4*o,f=new Uint8Array(e,l,d);n.mipmaps.push({data:f,width:a,height:s}),l+=d,a=Math.max(.5*a,1),s=Math.max(.5*s,1)}a=n.width,s=n.height}return n},getNormalMap:function(e,t){var i=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]},r=(t=1|t,e.width),n=e.height,o=document.createElement("canvas");o.width=r,o.height=n;var a=o.getContext("2d");a.drawImage(e,0,0);for(var s=a.getImageData(0,0,r,n).data,h=a.createImageData(r,n),l=h.data,c=0;c<r;c++)for(var u=0;u<n;u++){var p=0>u-1?0:u-1,f=u+1>n-1?n-1:u+1,d=0>c-1?0:c-1,m=c+1>
1r-1?r-1:c+1,g=[],v=[0,0,s[4*(u*r+c)]/255*t];for(g.push([-1,0,s[4*(u*r+d)]/255*t]),g.push([-1,-1,s[4*(p*r+d)]/255*t]),g.push([0,-1,s[4*(p*r+c)]/255*t]),g.push([1,-1,s[4*(p*r+m)]/255*t]),g.push([1,0,s[4*(u*r+m)]/255*t]),g.push([1,1,s[4*(f*r+m)]/255*t]),g.push([0,1,s[4*(f*r+c)]/255*t]),g.push([-1,1,s[4*(f*r+d)]/255*t]),p=[],d=g.length,f=0;f<d;f++){m=g[f];var y=g[(f+1)%d];m=[m[0]-v[0],m[1]-v[1],m[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];p.push(i([m[1]*y[2]-m[2]*y[1],m[2]*y[0]-m[0]*y[2],m[0]*y[1]-m[1]*y[0]]))}for(g=[0,0,0],f=0;f<p.length;f++)g[0]+=p[f][0],g[1]+=p[f][1],g[2]+=p[f][2];g[0]/=p.length,g[1]/=p.length,g[2]/=p.length,l[v=4*(u*r+c)]=(g[0]+1)/2*255|0,l[v+1]=(g[1]+1)/2*255|0,l[v+2]=255*g[2]|0,l[v+3]=255}return a.putImageData(h,0,0),o},generateDataTexture:function(e,t,i){for(var n=e*t,o=new Uint8Array(3*n),a=Math.floor(255*i.r),s=Math.floor(255*i.g),h=(i=Math.floor(255*i.b),0);h<n;h++)o[3*h]=a,o[3*h+1]=s,o[3*h+2]=i;return(e=new r.DataTexture(o,e,t,r.RGBFormat)).needsUpdate=!0,e}},r.SceneUtils={createMultiMaterialObject:function(e,t){for(var i=new r.Object3D,n=0,o=t.length;n<o;n++)i.add(new r.Mesh(e,t[n]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var n=new r.Matrix4;n.getInverse(i.matrixWorld),e.applyMatrix(n),t.remove(e),i.add(e)}},r.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(e){var t=e.familyName.toLowerCase();return this.faces[t]=this.faces[t]||{},this.faces[t][e.cssFontWeight]=this.faces[t][e.cssFontWeight]||{},this.faces[t][e.cssFontWeight][e.cssFontStyle]=e,this.faces[t][e.cssFontWeight][e.cssFontStyle]=e},drawText:function(e){var t=this.getFace(),i=this.size/t.resolution,n=0,o=String(e).split(""),a=o.length,s=[];for(e=0;e<a;e++){var h=new r.Path;n=n+(h=this.extractGlyphPoints(o[e],t,i,n,h)).offset;s.push(h.path)}return{paths:s,offset:n/2}},extractGlyphPoints:function(e,t,i,n,o){var a,s,h,l,c,u,p,f,d,m,g,v=[],y=t.glyphs[e]||t.glyphs["?"];if(y){if(y.o)for(l=(t=y._cachedOutline||(y._cachedOutline=y.o.split(" "))).length,e=0;e<l;)switch(h=t[e++]){case"m":h=t[e++]*i+n,c=t[e++]*i,o.moveTo(h,c);break;case"l":h=t[e++]*i+n,c=t[e++]*i,o.lineTo(h,c);break;case"q":if(h=t[e++]*i+n,c=t[e++]*i,f=t[e++]*i+n,d=t[e++]*i,o.quadraticCurveTo(f,d,h,c),a=v[v.length-1])for(u=a.x,p=a.y,a=1,s=this.divisions;a<=s;a++){var x=a/s;r.Shape.Utils.b2(x,u,f,h),r.Shape.Utils.b2(x,p,d,c)}break;case"b":if(h=t[e++]*i+n,c=t[e++]*i,f=t[e++]*i+n,d=t[e++]*-i,m=t[e++]*i+n,g=t[e++]*-i,o.bezierCurveTo(h,c,f,d,m,g),a=v[v.length-1])for(u=a.x,p=a.y,a=1,s=this.divisions;a<=s;a++)x=a/s,r.Shape.Utils.b3(x,u,f,m,h),r.Shape.Utils.b3(x,p,d,g,c)}return{offset:y.ha*i,path:o}}}},r.FontUtils.generateShapes=function(e,t){var i=void 0!==(t=t||{}).curveSegments?t.curveSegments:4,n=void 0!==t.font?t.font:"helvetiker",o=void 0!==t.weight?t.weight:"normal",a=void 0!==t.style?t.style:"normal";for(r.FontUtils.size=void 0!==t.size?t.size:100,r.FontUtils.divisions=i,r.FontUtils.face=n,r.FontUtils.weight=o,r.FontUtils.style=a,n=[],o=0,a=(i=r.FontUtils.drawText(e).paths).length;o<a;o++)Array.prototype.push.apply(n,i[o].toShapes());return n},function(e){var t=function(e){for(var t=e.length,i=0,r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return.5*i};e.Triangulate=function(e,i){var r=e.length;if(3>r)return null;var n,o,a,s=[],h=[],l=[];if(0<t(e))for(o=0;o<r;o++)h[o]=o;else for(o=0;o<r;o++)h[o]=r-1-o;var c=2*r;for(o=r-1;2<r;){if(0>=c--){console.log("Warning, unable to triangulate polygon!");break}var u;r<=(n=o)&&(n=0),r<=(o=n+1)&&(o=0),r<=(a=o+1)&&(a=0);e:{var p=u=void 0,f=void 0,d=void 0,m=void 0,g=(p=e[h[n]].x,e[h[n]].y),v=e[h[o]].x,y=e[h[o]].y,x=e[h[a]].x;if(1e-10>(v-p)*((f=e[h[a]].y)-g)-(y-g)*(x-p))u=!1;else{var _=void 0,w=void 0,b=void 0,M=void 0,S=(b=w=_=m=d=void 0,x-v),T=f-y,C=p-x,A=g-f,E=v-p,L=y-g;for(u=0;
1u<r;u++)if(u!==n&&u!==o&&u!==a&&(b=(d=e[h[u]].x)-v,M=(m=e[h[u]].y)-y,_=E*(w=m-g)-L*(_=d-p),w=C*(m-=f)-A*(d-=x),-1e-10<=(b=S*M-T*b)&&-1e-10<=w&&-1e-10<=_)){u=!1;break e}u=!0}}if(u){for(s.push([e[h[n]],e[h[o]],e[h[a]]]),l.push([h[n],h[o],h[a]]),n=o,a=o+1;a<r;n++,a++)h[n]=h[a];c=2*--r}}return i?l:s},e.Triangulate.area=t}(r.FontUtils),n._typeface_js={faces:r.FontUtils.faces,loadFace:r.FontUtils.loadFace},r.typeface_js=n._typeface_js,r.Curve=function(){},r.Curve.prototype.getPoint=function(){return console.log("Warning, getPoint() not implemented!"),null},r.Curve.prototype.getPointAt=function(e){return e=this.getUtoTmapping(e),this.getPoint(e)},r.Curve.prototype.getPoints=function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i},r.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPointAt(t/e));return i},r.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},r.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,r=[],n=this.getPoint(0),o=0;for(r.push(0),i=1;i<=e;i++)o+=(t=this.getPoint(i/e)).distanceTo(n),r.push(o),n=t;return this.cacheArcLengths=r},r.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},r.Curve.prototype.getUtoTmapping=function(e,t){var i,r=this.getLengths(),n=0,o=r.length;i=t||e*r[o-1];for(var a,s=0,h=o-1;s<=h;)if(0>(a=r[n=Math.floor(s+(h-s)/2)]-i))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return r[n=h]==i?n/(o-1):(n+(i-(s=r[n]))/(r[n+1]-s))/(o-1)},r.Curve.prototype.getTangent=function(e){var t=e-1e-4;return 0>t&&(t=0),1<(e=e+1e-4)&&(e=1),t=this.getPoint(t),this.getPoint(e).clone().sub(t).normalize()},r.Curve.prototype.getTangentAt=function(e){return e=this.getUtoTmapping(e),this.getTangent(e)},r.Curve.Utils={tangentQuadraticBezier:function(e,t,i,r){return 2*(1-e)*(i-t)+2*e*(r-i)},tangentCubicBezier:function(e,t,i,r,n){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*n},tangentSpline:function(e){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,i,r,n){var o=n*n;return(2*t-2*i+(e=.5*(i-e))+(r=.5*(r-t)))*n*o+(-3*t+3*i-2*e-r)*o+e*n+t}},r.Curve.create=function(e,t){return e.prototype=Object.create(r.Curve.prototype),e.prototype.getPoint=t,e},r.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},r.CurvePath.prototype=Object.create(r.Curve.prototype),r.CurvePath.prototype.add=function(e){this.curves.push(e)},r.CurvePath.prototype.checkConnection=function(){},r.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new r.LineCurve(t,e))},r.CurvePath.prototype.getPoint=function(e){var t=e*this.getLength(),i=this.getCurveLengths();for(e=0;e<i.length;){if(i[e]>=t)return t=1-(t=i[e]-t)/(e=this.curves[e]).getLength(),e.getPointAt(t);e++}return null},r.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},r.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e,t=[],i=0,r=this.curves.length;for(e=0;e<r;e++)i+=this.curves[e].getLength(),t.push(i);return this.cacheLengths=t},r.CurvePath.prototype.getBoundingBox=function(){var e,t,i,n,o,a,s=this.getPoints();e=t=Number.NEGATIVE_INFINITY,n=o=Number.POSITIVE_INFINITY;var h,l,c,u,p=s[0]instanceof r.Vector3;for(u=p?new r.Vector3:new r.Vector2,l=0,c=s.length;l<c;l++)(h=s[l]).x>e?e=h.x:h.x<n&&(n=h.x),h.y>t?t=h.y:h.y<o&&(o=h.y),p&&(h.z>i?i=h.z:h.z<a&&(a=h.z)),u.add(h);return s={minX:n,minY:o,maxX:e,maxY:t,centroid:u.divideScalar(c)},p&&(s.maxZ=i,s.minZ=a),s},r.CurvePath.prototype.createPointsGeometry=function(e){return e=this.getPoints(e,!0),this.createGeometry(e)},r.CurvePath.prototype.createSpacedPointsGeometry=function(e){return e=this.getSpacedPoints(e,!0),this.createGeometry(e)},r.CurvePath.prototype.createGeometry=function(e){for(var t=new r.Geometry,i=0;i<e.length;i++)t.vertices.push(new r.Vector3(e[i].x,e[i].y,e[i].z||0));return t},r.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)},r.CurvePath.prototype.getTransformedPoints=function(e,t){var i,r,n=this.getPoints(e);for(t||(t=this.bends),i=0,r=t.length;i<r;i++)n=this.getWrapPoints(n,t[i]);return n},r.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var i,r,n=this.getSpacedPoints(e);for(t||(t=this.bends),i=0,r=t.length;i<r;i++)n=this.getWrapPoints(n,t[i]);return n},r.CurvePath.prototype.getWrapPoints=function(e,t){var i,r,n,o,a,s,h=this.getBoundingBox();for(i=0,r=e.length;i<r;i++)o=(n=e[i]).x,a=n.y,s=o/h.maxX,s=t.getUtoTmapping(s,o),o=t.getPoint(s),a=t.getNormalVector(s).multiplyScalar(a),n.x=o.x+a.x,n.y=o.y+a.y;return e},r.Gyroscope=function(){r.Object3D.call(this)},r.Gyroscope.prototype=Object.create(r.Object3D.prototype),r.Gyroscope.prototype.updateMatrixWorld=function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix
1),this.matrixWorld.decompose(this.translationWorld,this.quaternionWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.quaternionObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.quaternionObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)},r.Gyroscope.prototype.translationWorld=new r.Vector3,r.Gyroscope.prototype.translationObject=new r.Vector3,r.Gyroscope.prototype.quaternionWorld=new r.Quaternion,r.Gyroscope.prototype.quaternionObject=new r.Quaternion,r.Gyroscope.prototype.scaleWorld=new r.Vector3,r.Gyroscope.prototype.scaleObject=new r.Vector3,r.Path=function(e){r.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},r.Path.prototype=Object.create(r.CurvePath.prototype),r.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},r.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y)},r.Path.prototype.moveTo=function(e,t){var i=Array.prototype.slice.call(arguments);this.actions.push({action:r.PathActions.MOVE_TO,args:i})},r.Path.prototype.lineTo=function(e,t){var i=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;n=new r.LineCurve(new r.Vector2(n[n.length-2],n[n.length-1]),new r.Vector2(e,t));this.curves.push(n),this.actions.push({action:r.PathActions.LINE_TO,args:i})},r.Path.prototype.quadraticCurveTo=function(e,t,i,n){var o=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args;a=new r.QuadraticBezierCurve(new r.Vector2(a[a.length-2],a[a.length-1]),new r.Vector2(e,t),new r.Vector2(i,n));this.curves.push(a),this.actions.push({action:r.PathActions.QUADRATIC_CURVE_TO,args:o})},r.Path.prototype.bezierCurveTo=function(e,t,i,n,o,a){var s=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;h=new r.CubicBezierCurve(new r.Vector2(h[h.length-2],h[h.length-1]),new r.Vector2(e,t),new r.Vector2(i,n),new r.Vector2(o,a));this.curves.push(h),this.actions.push({action:r.PathActions.BEZIER_CURVE_TO,args:s})},r.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args;i=[new r.Vector2(i[i.length-2],i[i.length-1])];Array.prototype.push.apply(i,e),i=new r.SplineCurve(i),this.curves.push(i),this.actions.push({action:r.PathActions.CSPLINE_THRU,args:t})},r.Path.prototype.arc=function(e,t,i,r,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(e+a[a.length-2],t+a[a.length-1],i,r,n,o)},r.Path.prototype.absarc=function(e,t,i,r,n,o){this.absellipse(e,t,i,i,r,n,o)},r.Path.prototype.ellipse=function(e,t,i,r,n,o,a){var s=this.actions[this.actions.length-1].args;this.absellipse(e+s[s.length-2],t+s[s.length-1],i,r,n,o,a)},r.Path.prototype.absellipse=function(e,t,i,n,o,a,s){var h=Array.prototype.slice.call(arguments),l=new r.EllipseCurve(e,t,i,n,o,a,s);this.curves.push(l),l=l.getPoint(1),h.push(l.x),h.push(l.y),this.actions.push({action:r.PathActions.ELLIPSE,args:h})},r.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],i=0;i<e;i++)t.push(this.getPoint(i/e));return t},r.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(e,t);e=e||12;var i,n,o,a,s,h,l,c,u,p,f,d,m,g=[];for(i=0,n=this.actions.length;i<n;i++)switch(a=(o=this.actions[i]).action,o=o.args,a){case r.PathActions.MOVE_TO:case r.PathActions.LINE_TO:g.push(new r.Vector2(o[0],o[1]));break;case r.PathActions.QUADRATIC_CURVE_TO:for(s=o[2],h=o[3],u=o[0],p=o[1],0<g.length?(f=(a=g[g.length-1]).x,d=a.y):(f=(a=this.actions[i-1].args)[a.length-2],d=a[a.length-1]),o=1;o<=e;o++)m=o/e,a=r.Shape.Utils.b2(m,f,u,s),m=r.Shape.Utils.b2(m,d,p,h),g.push(new r.Vector2(a,m));break;case r.PathActions.BEZIER_CURVE_TO:for(s=o[4],h=o[5],u=o[0],p=o[1],l=o[2],c=o[3],0<g.length?(f=(a=g[g.length-1]).x,d=a.y):(f=(a=this.actions[i-1].args)[a.length-2],d=a[a.length-1]),o=1;o<=e;o++)m=o/e,a=r.Shape.Utils.b3(m,f,u,l,s),m=r.Shape.Utils.b3(m,d,p,c,h),g.push(new r.Vector2(a,m));break;case r.PathActions.CSPLINE_THRU:for(a=this.actions[i-1].args,m=[new r.Vector2(a[a.length-2],a[a.length-1])],a=e*o[0].length,m=m.concat(o[0]),m=new r.SplineCurve(m),o=1;o<=a;o++)g.push(m.getPointAt(o/a));break;case r.PathActions.ARC:for(s=o[0],h=o[1],p=o[2],l=o[3],a=o[4],u=!!o[5],f=a-l,d=2*e,o=1;o<=d;
1o++)m=o/d,u||(m=1-m),m=l+m*f,a=s+p*Math.cos(m),m=h+p*Math.sin(m),g.push(new r.Vector2(a,m));break;case r.PathActions.ELLIPSE:for(s=o[0],h=o[1],p=o[2],c=o[3],l=o[4],a=o[5],u=!!o[6],f=a-l,d=2*e,o=1;o<=d;o++)m=o/d,u||(m=1-m),m=l+m*f,a=s+p*Math.cos(m),m=h+c*Math.sin(m),g.push(new r.Vector2(a,m))}return i=g[g.length-1],1e-10>Math.abs(i.x-g[0].x)&&1e-10>Math.abs(i.y-g[0].y)&&g.splice(g.length-1,1),t&&g.push(g[0]),g},r.Path.prototype.toShapes=function(e){var t,i,n,o,a,s=[],h=new r.Path;for(t=0,i=this.actions.length;t<i;t++)o=(n=this.actions[t]).args,(n=n.action)==r.PathActions.MOVE_TO&&0!=h.actions.length&&(s.push(h),h=new r.Path),h[n].apply(h,o);if(0!=h.actions.length&&s.push(h),0==s.length)return[];if(o=[],1==s.length)return n=s[0],(a=new r.Shape).actions=n.actions,a.curves=n.curves,o.push(a),o;if(t=!r.Shape.Utils.isClockWise(s[0].getPoints()),e?!t:t)for(a=new r.Shape,t=0,i=s.length;t<i;t++)n=s[t],h=r.Shape.Utils.isClockWise(n.getPoints()),(h=e?!h:h)?(a.actions=n.actions,a.curves=n.curves,o.push(a),a=new r.Shape):a.holes.push(n);else{for(a=void 0,t=0,i=s.length;t<i;t++)n=s[t],h=r.Shape.Utils.isClockWise(n.getPoints()),(h=e?!h:h)?(a&&o.push(a),(a=new r.Shape).actions=n.actions,a.curves=n.curves):a.holes.push(n);o.push(a)}return o},r.Shape=function(){r.Path.apply(this,arguments),this.holes=[]},r.Shape.prototype=Object.create(r.Path.prototype),r.Shape.prototype.extrude=function(e){return new r.ExtrudeGeometry(this,e)},r.Shape.prototype.makeGeometry=function(e){return new r.ShapeGeometry(this,e)},r.Shape.prototype.getPointsHoles=function(e){var t,i=this.holes.length,r=[];for(t=0;t<i;t++)r[t]=this.holes[t].getTransformedPoints(e,this.bends);return r},r.Shape.prototype.getSpacedPointsHoles=function(e){var t,i=this.holes.length,r=[];for(t=0;t<i;t++)r[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return r},r.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},r.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},r.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},r.Shape.Utils={removeHoles:function(e,t){var i,n,o,a,s,h,l,c,u,p,f=e.concat(),d=f.concat(),m=[];for(s=0;s<t.length;s++){for(h=t[s],Array.prototype.push.apply(d,h),n=Number.POSITIVE_INFINITY,i=0;i<h.length;i++)for(u=h[i],p=[],c=0;c<f.length;c++)l=f[c],l=u.distanceToSquared(l),p.push(l),l<n&&(n=l,o=i,a=c);i=0<=a-1?a-1:f.length-1,n=0<=o-1?o-1:h.length-1;var g=[h[o],f[a],f[i]];c=r.FontUtils.Triangulate.area(g);var v=[h[o],h[n],f[a]];u=r.FontUtils.Triangulate.area(v),p=a,l=o,o+=-1,0>(a+=1)&&(a+=f.length),a%=f.length,0>o&&(o+=h.length),o%=h.length,i=0<=a-1?a-1:f.length-1,n=0<=o-1?o-1:h.length-1,g=[h[o],f[a],f[i]],g=r.FontUtils.Triangulate.area(g),v=[h[o],h[n],f[a]],c+u>g+(v=r.FontUtils.Triangulate.area(v))&&(o=l,0>(a=p)&&(a+=f.length),a%=f.length,0>o&&(o+=h.length),o%=h.length,i=0<=a-1?a-1:f.length-1,n=0<=o-1?o-1:h.length-1),c=f.slice(0,a),u=f.slice(a),p=h.slice(o),l=h.slice(0,o),n=[h[o],h[n],f[a]],m.push([h[o],f[a],f[i]]),m.push(n),f=c.concat(p).concat(l).concat(u)}return{shape:f,isolatedPts:m,allpoints:d}},triangulateShape:function(e,t){var i,n,o,a,s=(l=r.Shape.Utils.removeHoles(e,t)).allpoints,h=l.isolatedPts,l=r.FontUtils.Triangulate(l.shape,!1),c={};for(i=0,n=s.length;i<n;i++)void 0!==c[a=s[i].x+":"+s[i].y]&&console.log("Duplicate point",a),c[a]=i;for(i=0,n=l.length;i<n;i++)for(o=l[i],s=0;3>s;s++)void 0!==(a=c[a=o[s].x+":"+o[s].y])&&(o[s]=a);for(i=0,n=h.length;i<n;i++)for(o=h[i],s=0;3>s;s++)void 0!==(a=c[a=o[s].x+":"+o[s].y])&&(o[s]=a);return l.concat(h)},isClockWise:function(e){return 0>r.FontUtils.Triangulate.area(e)},b2p0:function(e,t){var i=1-e;return i*i*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,i,r){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,r)},b3p0:function(e,t){var i=1-e;return i*i*i*t},b3p1:function(e,t){var i=1-e;return 3*i*i*e*t},b3p2:function(e,t){return 3*(1-e)*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,i,r,n){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,r)+this.b3p3(e,n)}},r.LineCurve=function(e,t){this.v1=e,this.v2=t},r.LineCurve.prototype=Object.create(r.Curve.prototype),r.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},r.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},r.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},r.QuadraticBezierCurve=function(e,t,i){this.v0=e,this.v1=t,this.v2=i}
1,r.QuadraticBezierCurve.prototype=Object.create(r.Curve.prototype),r.QuadraticBezierCurve.prototype.getPoint=function(e){var t;return t=r.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),e=r.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),new r.Vector2(t,e)},r.QuadraticBezierCurve.prototype.getTangent=function(e){var t;return t=r.Curve.Utils.tangentQuadraticBezier(e,this.v0.x,this.v1.x,this.v2.x),e=r.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y),(t=new r.Vector2(t,e)).normalize(),t},r.CubicBezierCurve=function(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r},r.CubicBezierCurve.prototype=Object.create(r.Curve.prototype),r.CubicBezierCurve.prototype.getPoint=function(e){var t;return t=r.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e=r.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new r.Vector2(t,e)},r.CubicBezierCurve.prototype.getTangent=function(e){var t;return t=r.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e=r.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),(t=new r.Vector2(t,e)).normalize(),t},r.SplineCurve=function(e){this.points=void 0==e?[]:e},r.SplineCurve.prototype=Object.create(r.Curve.prototype),r.SplineCurve.prototype.getPoint=function(e){var t,i=new r.Vector2,n=[],o=this.points;return t=(o.length-1)*e,t-=e=Math.floor(t),n[0]=0==e?e:e-1,n[1]=e,n[2]=e>o.length-2?o.length-1:e+1,n[3]=e>o.length-3?o.length-1:e+2,i.x=r.Curve.Utils.interpolate(o[n[0]].x,o[n[1]].x,o[n[2]].x,o[n[3]].x,t),i.y=r.Curve.Utils.interpolate(o[n[0]].y,o[n[1]].y,o[n[2]].y,o[n[3]].y,t),i},r.EllipseCurve=function(e,t,i,r,n,o,a){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a},r.EllipseCurve.prototype=Object.create(r.Curve.prototype),r.EllipseCurve.prototype.getPoint=function(e){var t;return 0>(t=this.aEndAngle-this.aStartAngle)&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI),t=!0===this.aClockwise?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t,e=this.aX+this.xRadius*Math.cos(t),t=this.aY+this.yRadius*Math.sin(t),new r.Vector2(e,t)},r.ArcCurve=function(e,t,i,n,o,a){r.EllipseCurve.call(this,e,t,i,i,n,o,a)},r.ArcCurve.prototype=Object.create(r.EllipseCurve.prototype),r.LineCurve3=r.Curve.create((function(e,t){this.v1=e,this.v2=t}),(function(e){var t=new r.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t})),r.QuadraticBezierCurve3=r.Curve.create((function(e,t,i){this.v0=e,this.v1=t,this.v2=i}),(function(e){var t,i;return t=r.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),i=r.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),e=r.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),new r.Vector3(t,i,e)})),r.CubicBezierCurve3=r.Curve.create((function(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r}),(function(e){var t,i;return t=r.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),i=r.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e=r.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),new r.Vector3(t,i,e)})),r.SplineCurve3=r.Curve.create((function(e){this.points=void 0==e?[]:e}),(function(e){var t,i=new r.Vector3,n=[],o=this.points;e=(o.length-1)*e;e-=t=Math.floor(e),n[0]=0==t?t:t-1,n[1]=t,n[2]=t>o.length-2?o.length-1:t+1,n[3]=t>o.length-3?o.length-1:t+2,t=o[n[0]];var a=o[n[1]],s=o[n[2]];n=o[n[3]];return i.x=r.Curve.Utils.interpolate(t.x,a.x,s.x,n.x,e),i.y=r.Curve.Utils.interpolate(t.y,a.y,s.y,n.y,e),i.z=r.Curve.Utils.interpolate(t.z,a.z,s.z,n.z,e),i})),r.ClosedSplineCurve3=r.Curve.create((function(e){this.points=void 0==e?[]:e}),(function(e){var t,i=new r.Vector3,n=[],o=this.points;return t=(o.length-0)*e,t-=e=Math.floor(t),e+=0<e?0:(Math.floor(Math.abs(e)/o.length)+1)*o.length,n[0]=(e-1)%o.length,n[1]=e%o.length,n[2]=(e+1)%o.length,n[3]=(e+2)%o.length,i.x=r.Curve.Utils.interpolate(o[n[0]].x,o[n[1]].x,o[n[2]].x,o[n[3]].x,t),i.y=r.Curve.Utils.interpolate(o[n[0]].y,o[n[1]].y,o[n[2]].y,o[n[3]].y,t),i.z=r.Curve.Utils.interpolate(o[n[0]].z,o[n[1]].z,o[n[2]].z,o[n[3]].z,t),i})),r.AnimationHandler=function(){var e=[],t={},i={update:function(t){for(var i=0;i<e.length;i++)e[i].update(t)},addToUpdate:function(t){-1===e.indexOf(t)&&e.push(t)},removeFromUpdate:function(t){-1!==(t=e.indexOf(t))&&e.splice(t,1)},add:function(e){if(void 0!==t[e.name]&&console.log("THREE.AnimationHandler.add: Warning! "+e.n
1ame+" already exists in library. Overwriting."),t[e.name]=e,!0!==e.initialized){for(var i=0;i<e.hierarchy.length;i++){for(var n=0;n<e.hierarchy[i].keys.length;n++)if(0>e.hierarchy[i].keys[n].time&&(e.hierarchy[i].keys[n].time=0),void 0!==e.hierarchy[i].keys[n].rot&&!(e.hierarchy[i].keys[n].rot instanceof r.Quaternion)){var o=e.hierarchy[i].keys[n].rot;e.hierarchy[i].keys[n].rot=new r.Quaternion(o[0],o[1],o[2],o[3])}if(e.hierarchy[i].keys.length&&void 0!==e.hierarchy[i].keys[0].morphTargets){for(o={},n=0;n<e.hierarchy[i].keys.length;n++)for(var a=0;a<e.hierarchy[i].keys[n].morphTargets.length;a++){var s=e.hierarchy[i].keys[n].morphTargets[a];o[s]=-1}for(e.hierarchy[i].usedMorphTargets=o,n=0;n<e.hierarchy[i].keys.length;n++){var h={};for(s in o){for(a=0;a<e.hierarchy[i].keys[n].morphTargets.length;a++)if(e.hierarchy[i].keys[n].morphTargets[a]===s){h[s]=e.hierarchy[i].keys[n].morphTargetsInfluences[a];break}a===e.hierarchy[i].keys[n].morphTargets.length&&(h[s]=0)}e.hierarchy[i].keys[n].morphTargetsInfluences=h}}for(n=1;n<e.hierarchy[i].keys.length;n++)e.hierarchy[i].keys[n].time===e.hierarchy[i].keys[n-1].time&&(e.hierarchy[i].keys.splice(n,1),n--);for(n=0;n<e.hierarchy[i].keys.length;n++)e.hierarchy[i].keys[n].index=n}for(n=parseInt(e.length*e.fps,10),e.JIT={},e.JIT.hierarchy=[],i=0;i<e.hierarchy.length;i++)e.JIT.hierarchy.push(Array(n));e.initialized=!0}},get:function(e){if("string"===typeof e)return t[e]?t[e]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+e),null)},parse:function(e){var t=[];if(e instanceof r.SkinnedMesh)for(var i=0;i<e.bones.length;i++)t.push(e.bones[i]);else n(e,t);return t}},n=function e(t,i){i.push(t);for(var r=0;r<t.children.length;r++)e(t.children[r],i)};return i.LINEAR=0,i.CATMULLROM=1,i.CATMULLROM_FORWARD=2,i}(),r.Animation=function(e,t,i){this.root=e,this.data=r.AnimationHandler.get(t),this.hierarchy=r.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=this.isPaused=!0,this.interpolationType=void 0!==i?i:r.AnimationHandler.LINEAR,this.points=[],this.target=new r.Vector3},r.Animation.prototype.play=function(e,t){if(!1===this.isPlaying){this.isPlaying=!0,this.loop=void 0===e||e,this.currentTime=void 0!==t?t:0;var i,n,o=this.hierarchy.length;for(i=0;i<o;i++){(n=this.hierarchy[i]).matrixAutoUpdate=!0,void 0===n.animationCache&&(n.animationCache={},n.animationCache.prevKey={pos:0,rot:0,scl:0},n.animationCache.nextKey={pos:0,rot:0,scl:0},n.animationCache.originalMatrix=n instanceof r.Bone?n.skinMatrix:n.matrix);var a=n.animationCache.prevKey;n=n.animationCache.nextKey,a.pos=this.data.hierarchy[i].keys[0],a.rot=this.data.hierarchy[i].keys[0],a.scl=this.data.hierarchy[i].keys[0],n.pos=this.getNextKeyWith("pos",i,1),n.rot=this.getNextKeyWith("rot",i,1),n.scl=this.getNextKeyWith("scl",i,1)}this.update(0)}this.isPaused=!1,r.AnimationHandler.addToUpdate(this)},r.Animation.prototype.pause=function(){!0===this.isPaused?r.AnimationHandler.addToUpdate(this):r.AnimationHandler.removeFromUpdate(this),this.isPaused=!this.isPaused},r.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1,r.AnimationHandler.removeFromUpdate(this)},r.Animation.prototype.update=function(e){if(!1!==this.isPlaying){var t,i,n,o,a,s,h,l,c,u=["pos","rot","scl"];c=this.currentTime+=e*this.timeScale,l=this.currentTime%=this.data.length,parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,f=this.hierarchy.length;p<f;p++){h=(e=this.hierarchy[p]).animationCache;for(var d=0;3>d;d++){if(t=u[d],a=h.prevKey[t],(s=h.nextKey[t]).time<=c){if(l<c){if(!this.loop)return void this.stop();for(a=this.data.hierarchy[p].keys[0],s=this.getNextKeyWith(t,p,1);s.time<l;)a=s,s=this.getNextKeyWith(t,p,s.index+1)}else do{a=s,s=this.getNextKeyWith(t,p,s.index+1)}while(s.time<l);h.prevKey[t]=a,h.nextKey[t]=s}e.matrixAutoUpdate=!0,e.matrixWorldNeedsUpdate=!0,i=(l-a.time)/(s.time-a.time),n=a[t],o=s[t],(0>i||1<i)&&(console.log("THREE.Animation.update: Warning! Scale out of bounds:"+i+" on bone "+p),i=0>i?0:1),"pos"===t?(t=e.position,this.interpolationType===r.AnimationHandler.LINEAR?(t.x=n[0]+(o[0]-n[0])*i,t.y=n[1]+(o[1]-n[1])*i,t.z=n[2]+(o[2]-n[2])*i):this.interpolationType!==r.AnimationHandler.CATMULLROM&&this.interpolationType!==r.AnimationHandler.CATMULLROM_FORWARD||(this.points[0]=this.getPrevKeyWith("pos",p,a.index-1).pos,this.points[1]=n,this.points[2]=o,this.points[3]=this.getNextKeyWith("pos",p,s.index+1).pos,i=.33*i+.33,n=this.interpolateCatmullRom(this.points,i),t.x=n[0],t.y=n[1],t.z=n[2],this.interpolationType===r.AnimationHandler.CATMULLROM_FORWARD&&(i=this.interpolateCatmullRom(this.points,1.01*i),this.target.set(i[0],i[1],i[2]),this.target.sub(t),this.target.y=0,this.target.normalize(),i=Math.atan2(this.target.x,this.target.z),e.rotation.set(0,i,0)))):"rot"===t?r.Quaternion.slerp(n,o,e.quaternion,i):"scl"===t&&((t=e.scale).x=n[0]+(o[0]-n[0])*i,t.y=n[1]+(o[1]-n[1])*i,t.z=n[2]+(o[2]-n[2])*i)}}}},r.Animation.prototype.interpolateCatmullRom=function(e,t){var i,r,n,o,a,s,h=[],l=[];return i=(e.length-1)*t,i-=r=Math.floor(i),h[0]=0===r?r:r-1,h[1]=r,h[2]=r>e.length-2?r:r+1,h[3]=r>e.length-3?r:r+2,r=e[h[0]],o=e[h[1]],a=e[h[2]],s=e[h[3]],n=i*(h=i*i),l[0]=this.interpolate(r[0],o[0],a[0],s[0],i,h,n),l[1]=this.interpolate(r[1],o[1],a[1],s[1],i,h,n),l[2]=this.interpolate(r[2],o[2],a[2],s[2],i,h,n),l},r.Animation.prototype.interpolate=function(e,t,i,r,n,o,a){return(2*(t-i)+(e=.5*(i-e))+(r=.5*(r-t)))*a+(-3*(t-i)-2*e-r)*o+e*n+t},r.Animation.prototype.getNextKeyWith=function(e,t,i){var n=this.data.hierarchy[t].keys;for(i=this.interpolationType===r.AnimationHandler.CATMULLROM||this.interpolationType===r.AnimationHandler.CATMULLROM_FORWARD?i<n.length-1?i:n.length-1:i%n.length;i<n.length;i++)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[0]},r.Animation.prototype.getPrevKeyWith=function(e,t,i){var n=this.data.hierarchy[t].keys;for(i=this.interpolationType===r.AnimationHandler.CATMULLROM||this.interpolationType===r.AnimationHandler.CATMULLROM_FORWARD?0<i?i:0:0<=i?i:i+n.length;0<=i;i--)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[n.length-1]},r.KeyFrameAnimation=function(e,t,i){for(this.root=e,this.data=r.AnimationHandler.get(t),this.hierarchy=r.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.loop=this.isPaused=!0,this.JITCompile=void 0===i||i,e=0,t=this.hierarchy.length;e<t;e++){i=this.data.hierarchy[e].sids;var n=this.hierarchy[e];if(this.data.hierarchy[e].keys.length&&i){for(var o=0;o<i.length;o++){var a=i[o],s=this.getNextKeyWith(a,e,0);s&&s.apply(a)}n.matrixAutoUpdate=!1,this.data.hierarchy[e].node.updateMatrix(),n.matrixWorldNeedsUpdate=!0}}},r.KeyFrameAnimation.prototype.play=function(e,t){if(!this.isPlaying){this.isPlaying=!0,this.loop=void 0===e||e,this.currentTime=void 0!==t?t:0,this.startTimeMs=t,this.startTime=1e7,this.endTime=-this.startTime;var i,n,o,a=this.hierarchy.length;for(i=0;i<a;i++)n=this.hierarchy[i],void 0===(o=this.data.hierarchy[i]).animationCache&&(o.animationCache={},o.animationCache.prevKey=null,o.animationCache.nextKey=null,o.animationCache.originalMatrix=n instanceof r.Bone?n.skinMatrix:n.matrix
1),(n=this.data.hierarchy[i].keys).length&&(o.animationCache.prevKey=n[0],o.animationCache.nextKey=n[1],this.startTime=Math.min(n[0].time,this.startTime),this.endTime=Math.max(n[n.length-1].time,this.endTime));this.update(0)}this.isPaused=!1,r.AnimationHandler.addToUpdate(this)},r.KeyFrameAnimation.prototype.pause=function(){this.isPaused?r.AnimationHandler.addToUpdate(this):r.AnimationHandler.removeFromUpdate(this),this.isPaused=!this.isPaused},r.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1,r.AnimationHandler.removeFromUpdate(this);for(var e=0;e<this.data.hierarchy.length;e++){var t=this.hierarchy[e],i=this.data.hierarchy[e];if(void 0!==i.animationCache){var n=i.animationCache.originalMatrix;t instanceof r.Bone?(n.copy(t.skinMatrix),t.skinMatrix=n):(n.copy(t.matrix),t.matrix=n),delete i.animationCache}}},r.KeyFrameAnimation.prototype.update=function(e){if(this.isPlaying){var t,i,n,o,a,s,h,l=this.data.JIT.hierarchy;if(s=this.currentTime+=e*this.timeScale,(a=this.currentTime%=this.data.length)<this.startTimeMs&&(a=this.currentTime=this.startTimeMs+a),o=parseInt(Math.min(a*this.data.fps,this.data.length*this.data.fps),10),(h=a<s)&&!this.loop){e=0;for(var c=this.hierarchy.length;e<c;e++){var u=this.data.hierarchy[e].keys;l=this.data.hierarchy[e].sids;if(n=u.length-1,o=this.hierarchy[e],u.length){for(u=0;u<l.length;u++)a=l[u],(s=this.getPrevKeyWith(a,e,n))&&s.apply(a);this.data.hierarchy[e].node.updateMatrix(),o.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(a<this.startTime)){for(e=0,c=this.hierarchy.length;e<c;e++){n=this.hierarchy[e];u=(t=this.data.hierarchy[e]).keys;var p=t.animationCache;if(this.JITCompile&&void 0!==l[e][o])n instanceof r.Bone?(n.skinMatrix=l[e][o],n.matrixWorldNeedsUpdate=!1):(n.matrix=l[e][o],n.matrixWorldNeedsUpdate=!0);else if(u.length){if(this.JITCompile&&p&&(n instanceof r.Bone?n.skinMatrix=p.originalMatrix:n.matrix=p.originalMatrix),t=p.prevKey,i=p.nextKey,t&&i){if(i.time<=s){if(h&&this.loop)for(t=u[0],i=u[1];i.time<a;)i=u[(t=i).index+1];else if(!h)for(var f=u.length-1;i.time<a&&i.index!==f;)i=u[(t=i).index+1];p.prevKey=t,p.nextKey=i}i.time>=a?t.interpolate(i,a):t.interpolate(i,i.time)}this.data.hierarchy[e].node.updateMatrix(),n.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===l[0][o])for(this.hierarchy[0].updateMatrixWorld(!0),e=0;e<this.hierarchy.length;e++)l[e][o]=this.hierarchy[e]instanceof r.Bone?this.hierarchy[e].skinMatrix.clone():this.hierarchy[e].matrix.clone()}}},r.KeyFrameAnimation.prototype.getNextKeyWith=function(e,t,i){for(i%=(t=this.data.hierarchy[t].keys).length;i<t.length;i++)if(t[i].hasTarget(e))return t[i];return t[0]},r.KeyFrameAnimation.prototype.getPrevKeyWith=function(e,t,i){for(t=this.data.hierarchy[t].keys,i=0<=i?i:i+t.length;0<=i;i--)if(t[i].hasTarget(e))return t[i];return t[t.length-1]},r.CubeCamera=function(e,t,i){r.Object3D.call(this);var n=new r.PerspectiveCamera(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new r.Vector3(1,0,0)),this.add(n);var o=new r.PerspectiveCamera(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new r.Vector3(-1,0,0)),this.add(o);var a=new r.PerspectiveCamera(90,1,e,t);a.up.set(0,0,1),a.lookAt(new r.Vector3(0,1,0)),this.add(a);var s=new r.PerspectiveCamera(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new r.Vector3(0,-1,0)),this.add(s);var h=new r.PerspectiveCamera(90,1,e,t);h.up.set(0,-1,0),h.lookAt(new r.Vector3(0,0,1)),this.add(h);var l=new r.PerspectiveCamera(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new r.Vector3(0,0,-1)),this.add(l),this.renderTarget=new r.WebGLRenderTargetCube(i,i,{format:r.RGBFormat,magFilter:r.LinearFilter,minFilter:r.LinearFilter}),this.updateCubeMap=function(e,t){var i=this.renderTarget,r=i.generateMipmaps;i.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,n,i),i.activeCubeFace=1,e.render(t,o,i),i.activeCubeFace=2,e.render(t,a,i),i.activeCubeFace=3,e.render(t,s,i),i.activeCubeFace=4,e.render(t,h,i),i.generateMipmaps=r,i.activeCubeFace=5,e.render(t,l,i)}},r.CubeCamera.prototype=Object.create(r.Object3D.prototype),r.CombinedCamera=function(e,t,i,n,o,a,s){r.Camera.call(this),this.fov=i,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2,this.cameraO=new r.Orthogra
1phicCamera(e/-2,e/2,t/2,t/-2,a,s),this.cameraP=new r.PerspectiveCamera(i,e/t,n,o),this.zoom=1,this.toPerspective()},r.CombinedCamera.prototype=Object.create(r.Camera.prototype),r.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near,this.far=this.cameraP.far,this.cameraP.fov=this.fov/this.zoom,this.cameraP.updateProjectionMatrix(),this.projectionMatrix=this.cameraP.projectionMatrix,this.inPerspectiveMode=!0,this.inOrthographicMode=!1},r.CombinedCamera.prototype.toOrthographic=function(){var e=this.cameraP.aspect,t=(this.cameraP.near+this.cameraP.far)/2;e=2*(t=Math.tan(this.fov/2)*t)*e/2,t/=this.zoom,e/=this.zoom;this.cameraO.left=-e,this.cameraO.right=e,this.cameraO.top=t,this.cameraO.bottom=-t,this.cameraO.updateProjectionMatrix(),this.near=this.cameraO.near,this.far=this.cameraO.far,this.projectionMatrix=this.cameraO.projectionMatrix,this.inPerspectiveMode=!1,this.inOrthographicMode=!0},r.CombinedCamera.prototype.setSize=function(e,t){this.cameraP.aspect=e/t,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2},r.CombinedCamera.prototype.setFov=function(e){this.fov=e,this.inPerspectiveMode?this.toPerspective():this.toOrthographic()},r.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())},r.CombinedCamera.prototype.setLens=function(e,t){void 0===t&&(t=24);var i=2*r.Math.radToDeg(Math.atan(t/(2*e)));return this.setFov(i),i},r.CombinedCamera.prototype.setZoom=function(e){this.zoom=e,this.inPerspectiveMode?this.toPerspective():this.toOrthographic()},r.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0,this.rotation.y=Math.PI,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0,this.rotation.y=-Math.PI/2,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0,this.rotation.y=Math.PI/2,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},r.CircleGeometry=function(e,t,i,n){r.Geometry.call(this),this.radius=e=e||50,this.segments=t=void 0!==t?Math.max(3,t):8,this.thetaStart=i=void 0!==i?i:0,this.thetaLength=n=void 0!==n?n:2*Math.PI;var o,a=[];o=new r.Vector3;var s=new r.Vector2(.5,.5);for(this.vertices.push(o),a.push(s),o=0;o<=t;o++){var h=new r.Vector3,l=i+o/t*n;h.x=e*Math.cos(l),h.y=e*Math.sin(l),this.vertices.push(h),a.push(new r.Vector2((h.x/e+1)/2,(h.y/e+1)/2))}for(i=new r.Vector3(0,0,1),o=1;o<=t;o++)this.faces.push(new r.Face3(o,o+1,0,[i,i,i])),this.faceVertexUvs[0].push([a[o],a[o+1],s]);this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere=new r.Sphere(new r.Vector3,e)},r.CircleGeometry.prototype=Object.create(r.Geometry.prototype),r.CubeGeometry=function(e,t,i,n,o,a){function s(e,t,i,n,o,a,s,l){var c,u=h.widthSegments,p=h.heightSegments,f=o/2,d=a/2,m=h.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?c="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(c="y",p=h.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(c="x",u=h.depthSegments);var g=u+1,v=p+1,y=o/u,x=a/p,_=new r.Vector3;for(_[c]=0<s?1:-1,o=0;o<v;o++)for(a=0;a<g;a++){var w=new r.Vector3;w[e]=(a*y-f)*i,w[t]=(o*x-d)*n,w[c]=s,h.vertices.push(w)}for(o=0;o<p;o++)for(a=0;a<u;a++)d=a+g*o,e=a+g*(o+1),t=a+1+g*(o+1),i=a+1+g*o,n=new r.Vector2(a/u,1-o/p),s=new r.Vector2(a/u,1-(o+1)/p),c=new r.Vector2((a+1)/u,1-(o+1)/p),f=new r.Vector2((a+1)/u,1-o/p),(d=new r.Face3(d+m,e+m,i+m)).normal.copy(_),d.vertexNormals.push(_.clone(),_.clone(),_.clone()),d.materialIndex=l,h.faces.push(d),h.faceVertexUvs[0].push([n,s,f]),(d=new r.Face3(e+m,t+m,i+m)).normal.copy(_),d.vertexNormals.push(_.clone(),_.clone(),_.clone()),d.materialIndex=l,h.faces.push(d),h.faceVertexUvs[0].push([s.clone(),c,f.clone()])}r.Geometry.call(this);var h=this;this.width=e,this.height=t,this.depth=i,this.widthSegments=n||1,this.heightSegments=o||1,this.depthSegments=a||1,e=this.width/2,t=this.height/2,i=this.depth/2,s("z","y",-1,-1,this.depth,this.height,e,0),s("z","y",1,-1,this.depth,this.height,-e,1),s("x","z",1,1,this.width,this.depth,t,2),s("x","z",1,-1,this.width,this.depth,-t,3),s("x","y",1,-1,this.width,this.height,i,4),s("x","y",-1,-1,this.width,this.height,-i,5),this.computeCentroids(),this.mergeVertices()},r.CubeGeometry.prototype=Object.create(r.Geometry.prototype),r.CylinderGeometry=function(e,t,i,n,o,a){r.Geometry.call(this),this.radiusTop=e=void 0!==e?e:20,this.radiusBottom=t=void 0!==t?t:20,this.height=i=void 0!==i?i:100,this.radialSegments=n=n||8,this.heightSegments=o=o||1,this.openEnded=a=void 0!==a&&a;var s,h,l=i/2,c=[],u=[];for(h=0;h<=o;h++){var p=[],f=[],d=(g=h/o)*(t-e)+e;for(s=0;s<=n;s++){var m=s/n;(v=new r.Vector3).x=d*Math.sin(2*m*Math.PI),v.y=-g*i+l,v.z=d*Math.cos(2*m*Math.PI),this.vertices.push(v),p.push(this.vertices.length-1),f.push(new r.Vector2(m,1-g))}c.push(p),u.push(f)}for(i=(t-e)/i,s=0;s<n;s++)for(0!==e?(p=this.vertices[c[0][s]].clone(),f=this.vertices[c[0][s+1]].clone()):(p=this.vertices[c[1][s]].clone(),f=this.vertices[c[1][s+1]].clone()),p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*i).normalize(),f.setY(Math.sqrt(f.x*f.x+f.z*f.z)*i).normalize(),h=0;h<o;h++){var g=c[h][s],v=(d=c[h+1][s],m=c[h+1][s+1],c[h][s+1]),y=p.clone(),x=p.clone(),_=f.clone(),w=f.clone(),b=u[h][s].clone(),M=u[h+1][s].clone(),S=u[h+1][s+1].clone(),T=u[h][s+1].clone();this.faces.push(new r.Face3(g,d,v,[y,x,w])),this.faceVertexUvs[0].push([b,M,T]),this.faces.push(new r.Face3(d,m,v,[x,_,w])),this.faceVertexUvs[0].push([M,S,T])}if(!1===a&&0<e)for(this.vertices.push(new r.Vector3(0,l,0)),s=0;s<n;s++)g=c[0][s],d=c[0][s+1],m=this.vertices.length-1,y=new r.Vector3(0,1,0),x=new r.Vector3(0,1,0),_=new r.Vector3(0,1,0),b=u[0][s].clone(),M=u[0][s+1].clone(),S=new r.Vector2(M.u,0),this.faces.push(new r.Face3(g,d,m,[y,x,_])),this.faceVertexUvs[0].push([b,M,S]);if(!1===a&&0<t)for(this.vertices.push(new r.Vector3(0,-l,0)),s=0;s<n;s++)g=c[h][s+1],d=c[h][s],m=this.vertices.length-1,y=new r.Vector3(0,-1,0),x=new r.Vector3(0,-1,0),_=new r.Vector3(0,-1,0),b=u[h][s+1].clone(),M=u[h][s].clone(),S=new r.Vector2(M.u,1),this.faces.push(new r.Face3(g,d,m,[y,x,_])),this.faceVertexUvs[0].push([b,M,S]);this.computeCentroids(),this.computeFaceNormals()},r.CylinderGeometry.prototype=Object.create(r.Geometry.prototype),r.ExtrudeGeometry=function(e,t){"undefined"!==typeof e&&(r.Geometry.call(this),e=e instanceof Array?e:[e],this.shapebb=e[e.length-1].getBoundingBox(),this.addShapeList(e,t),this.computeCentroids(),this.computeFaceNormals())},r.ExtrudeGeometry.prototype=Object.create(r.Geometry.prototype),r.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var i=e.length,r=0;r<i;r++)this.addShape(e[r],t)},r.ExtrudeGeometry.prototype.addShape=function(e,t){function i(e,t,i){return t||console.log("die"),t.clone().multiplyScalar(i).add(e)}function n(e,t,i){var n=r.ExtrudeGeometry.__v1,o=r.ExtrudeGeometry.__v2,a=r.ExtrudeGeometry.__v3,s=r.ExtrudeGeometry.__v4,h=r.ExtrudeGeometry.__v5,l=r.ExtrudeGeometry.__v6;return n.set(e.x-t.x,e.y-t.y),o.set(e.x-i.x,e.y-i.y),n=n.normalize(),o=o.normalize(),a.set(-n.y,n.x),s.set(o.y,-o.x),h.copy(e).add(a),l.copy(e).add(s),h.equals(l)?s.clone():(h.copy(t).add(a),l.copy(i).add(s),a=n.dot(s),s=l.sub(h).dot(s),0===a&&(console.log("Either infinite or no solutions!"),0===s?console.log("Its finite solutions."):console.log("Too bad, no solutions.")),0>(s/=a)?((t=Math.atan2(t.y-e.y,t.x-e.x))>(e=Math.atan2(i.y-e.y,i.x-e.x))&&(e+=2*Math.PI),i=(t+e)/2,e=-Math.cos(i),i=-Math.sin(i),new r.Vector2(e,i)):n.multiplyScalar(s).add(h).sub(e).clone())}function o(i,n){var o,a;for(B=i.length;0<=--B;){o=B,0>(a=B-1)&&(a=i.length-1);var s=0,h=x+2*g;for(s=0;s<h;s++){var l=i,c=s,u=h,p=o,f=a,d=(d=n+o+(m=z*s))+L,m=(m=n+a+m)+L,v=(v=n+a+(y=z*(s+1)))+L,y=(y=n+o+y)+L;E.faces.push(new r.Face3(d,m,y,null,null,M)),E.faces.push(new r.Face3(m,v,y,null,null,M)),d=S.generateSideWallUV(E,e,l,t,d,m,v,y,c,u,p,f),E.faceVertexUvs[0].push([d[0],d[1],d[3]]),E.faceVertexUvs[0].push([d[1],d[2],d[3]])}}}function a(e,t,i){E.vertices.push(new r.Vector3(e,t,i))}function s(i,n,o,a){i+=L,n+=L,o+=L,E.faces.push(new r.Face3(i,n,o,null,
1null,b)),i=a?S.generateBottomUV(E,e,t,i,n,o):S.generateTopUV(E,e,t,i,n,o),E.faceVertexUvs[0].push(i)}var h,l,c,u,p,f=void 0!==t.amount?t.amount:100,d=void 0!==t.bevelThickness?t.bevelThickness:6,m=void 0!==t.bevelSize?t.bevelSize:d-2,g=void 0!==t.bevelSegments?t.bevelSegments:3,v=void 0===t.bevelEnabled||t.bevelEnabled,y=void 0!==t.curveSegments?t.curveSegments:12,x=void 0!==t.steps?t.steps:1,_=t.extrudePath,w=!1,b=t.material,M=t.extrudeMaterial,S=void 0!==t.UVGenerator?t.UVGenerator:r.ExtrudeGeometry.WorldUVGenerator;_&&(h=_.getSpacedPoints(x),w=!0,v=!1,l=void 0!==t.frames?t.frames:new r.TubeGeometry.FrenetFrames(_,x,!1),c=new r.Vector3,u=new r.Vector3,p=new r.Vector3),v||(m=d=g=0);var T,C,A,E=this,L=this.vertices.length,P=(y=e.extractPoints(y)).shape;y=y.holes;if(_=!r.Shape.Utils.isClockWise(P)){for(P=P.reverse(),C=0,A=y.length;C<A;C++)T=y[C],r.Shape.Utils.isClockWise(T)&&(y[C]=T.reverse());_=!1}var D=r.Shape.Utils.triangulateShape(P,y);_=P;for(C=0,A=y.length;C<A;C++)T=y[C],P=P.concat(T);var R,F,V,U,z=P.length,N=D.length,O=[],B=0,I=_.length;for(R=I-1,F=B+1;B<I;B++,R++,F++)R===I&&(R=0),F===I&&(F=0),O[B]=n(_[B],_[R],_[F]);var k,G=[],H=O.concat();for(C=0,A=y.length;C<A;C++){for(T=y[C],k=[],B=0,R=(I=T.length)-1,F=B+1;B<I;B++,R++,F++)R===I&&(R=0),F===I&&(F=0),k[B]=n(T[B],T[R],T[F]);G.push(k),H=H.concat(k)}for(R=0;R<g;R++){for(V=d*(1-(T=R/g)),F=m*Math.sin(T*Math.PI/2),B=0,I=_.length;B<I;B++)a((U=i(_[B],O[B],F)).x,U.y,-V);for(C=0,A=y.length;C<A;C++)for(T=y[C],k=G[C],B=0,I=T.length;B<I;B++)a((U=i(T[B],k[B],F)).x,U.y,-V)}for(F=m,B=0;B<z;B++)U=v?i(P[B],H[B],F):P[B],w?(u.copy(l.normals[0]).multiplyScalar(U.x),c.copy(l.binormals[0]).multiplyScalar(U.y),p.copy(h[0]).add(u).add(c),a(p.x,p.y,p.z)):a(U.x,U.y,0);for(T=1;T<=x;T++)for(B=0;B<z;B++)U=v?i(P[B],H[B],F):P[B],w?(u.copy(l.normals[T]).multiplyScalar(U.x),c.copy(l.binormals[T]).multiplyScalar(U.y),p.copy(h[T]).add(u).add(c),a(p.x,p.y,p.z)):a(U.x,U.y,f/x*T);for(R=g-1;0<=R;R--){for(V=d*(1-(T=R/g)),F=m*Math.sin(T*Math.PI/2),B=0,I=_.length;B<I;B++)a((U=i(_[B],O[B],F)).x,U.y,f+V);for(C=0,A=y.length;C<A;C++)for(T=y[C],k=G[C],B=0,I=T.length;B<I;B++)U=i(T[B],k[B],F),w?a(U.x,U.y+h[x-1].y,h[x-1].x+V):a(U.x,U.y,f+V)}if(v){for(d=0*z,B=0;B<N;B++)s((f=D[B])[2]+d,f[1]+d,f[0]+d,!0);for(d=z*(x+2*g),B=0;B<N;B++)s((f=D[B])[0]+d,f[1]+d,f[2]+d,!1)}else{for(B=0;B<N;B++)s((f=D[B])[2],f[1],f[0],!0);for(B=0;B<N;B++)s((f=D[B])[0]+z*x,f[1]+z*x,f[2]+z*x,!1)}for(o(_,f=0),f+=_.length,C=0,A=y.length;C<A;C++)o(T=y[C],f),f+=T.length},r.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,i,n,o,a){return t=e.vertices[o].x,o=e.vertices[o].y,i=e.vertices[a].x,a=e.vertices[a].y,[new r.Vector2(e.vertices[n].x,e.vertices[n].y),new r.Vector2(t,o),new r.Vector2(i,a)]},generateBottomUV:function(e,t,i,r,n,o){return this.generateTopUV(e,t,i,r,n,o)},generateSideWallUV:function(e,t,i,n,o,a,s,h){t=e.vertices[o].x,i=e.vertices[o].y,o=e.vertices[o].z,n=e.vertices[a].x;var l=e.vertices[a].y,c=(a=e.vertices[a].z,e.vertices[s].x),u=e.vertices[s].y,p=(s=e.vertices[s].z,e.vertices[h].x),f=e.vertices[h].y;e=e.vertices[h].z;return.01>Math.abs(i-l)?[new r.Vector2(t,1-o),new r.Vector2(n,1-a),new r.Vector2(c,1-s),new r.Vector2(p,1-e)]:[new r.Vector2(i,1-o),new r.Vector2(l,1-a),new r.Vector2(u,1-s),new r.Vector2(f,1-e)]}},r.ExtrudeGeometry.__v1=new r.Vector2,r.ExtrudeGeometry.__v2=new r.Vector2,r.ExtrudeGeometry.__v3=new r.Vector2,r.ExtrudeGeometry.__v4=new r.Vector2,r.ExtrudeGeometry.__v5=new r.Vector2,r.ExtrudeGeometry.__v6=new r.Vector2,r.ShapeGeometry=function(e,t){r.Geometry.call(this),!1===e instanceof Array&&(e=[e]),this.shapebb=e[e.length-1].getBoundingBox(),this.addShapeList(e,t),this.computeCentroids(),this.computeFaceNormals()},r.ShapeGeometry.prototype=Object.create(r.Geometry.prototype),r.ShapeGeometry.prototype.addShapeList=function(e,t){for(var i=0,r=e.length;i<r;i++)this.addShape(e[i],t);return this},r.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var i,n,o,a=t.material,s=void 0===t.UVGenerator?r.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,h=this.vertices.length,l=(i=e.extractPoints(void 0!==t.curveSegments?t.curveSegments:12)).shape,c=i.holes;if(!r.Shape.Utils.isClockWise(l))for(l=l.reverse(),i=0,n=c.length;i<n;i++)o=c[i],r.Shape.Utils.isClockWise(o)&&(c[i]=o.reverse());var u=r.Shape.Utils.triangulateShape(l,c);for(i=0,n=c.length;i<n;i++)o=c[i],l=l.concat(o);for(c=l.length,n=u.length,i=0;i<c;i++)o=l[i],this.vertices.push(new r.Vector3(o.x,o.y,0));for(i=0;i<n;i++)l=(c=u[i])[0]+h,o=c[1]+h,c=c[2]+h,this.faces.push(new r.Face3(l,o,c,null,null,a)),this.faceVertexUvs[0].push(s.generateBottomUV(this,e,t,l,o,c))},r.LatheGeometry=function(e,t,i,n){r.Geometry.call(this);
1t=t||12,i=i||0,n=n||2*Math.PI;for(var o=1/(e.length-1),a=1/t,s=0,h=t;s<=h;s++)for(var l=i+s*a*n,c=Math.cos(l),u=Math.sin(l),p=(l=0,e.length);l<p;l++){var f=e[l];(d=new r.Vector3).x=c*f.x-u*f.y,d.y=u*f.x+c*f.y,d.z=f.z,this.vertices.push(d)}for(i=e.length,s=0,h=t;s<h;s++)for(l=0,p=e.length-1;l<p;l++){t=u=l+i*s,n=u+i,c=u+1+i,u=u+1;var d,m=(f=s*a)+a,g=(d=l*o)+o;this.faces.push(new r.Face3(t,n,u)),this.faceVertexUvs[0].push([new r.Vector2(f,d),new r.Vector2(m,d),new r.Vector2(f,g)]),this.faces.push(new r.Face3(n,c,u)),this.faceVertexUvs[0].push([new r.Vector2(m,d),new r.Vector2(m,g),new r.Vector2(f,g)])}this.mergeVertices(),this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},r.LatheGeometry.prototype=Object.create(r.Geometry.prototype),r.PlaneGeometry=function(e,t,i,n){r.Geometry.call(this),this.width=e,this.height=t,this.widthSegments=i||1,this.heightSegments=n||1;var o=e/2,a=t/2,s=(i=this.widthSegments)+1,h=(n=this.heightSegments)+1,l=this.width/i,c=this.height/n,u=new r.Vector3(0,0,1);for(e=0;e<h;e++)for(t=0;t<s;t++)this.vertices.push(new r.Vector3(t*l-o,-(e*c-a),0));for(e=0;e<n;e++)for(t=0;t<i;t++){var p=t+s*e,f=(o=t+s*(e+1),a=t+1+s*(e+1),h=t+1+s*e,l=new r.Vector2(t/i,1-e/n),c=new r.Vector2(t/i,1-(e+1)/n),new r.Vector2((t+1)/i,1-(e+1)/n)),d=new r.Vector2((t+1)/i,1-e/n);(p=new r.Face3(p,o,h)).normal.copy(u),p.vertexNormals.push(u.clone(),u.clone(),u.clone()),this.faces.push(p),this.faceVertexUvs[0].push([l,c,d]),(p=new r.Face3(o,a,h)).normal.copy(u),p.vertexNormals.push(u.clone(),u.clone(),u.clone()),this.faces.push(p),this.faceVertexUvs[0].push([c.clone(),f,d.clone()])}this.computeCentroids()},r.PlaneGeometry.prototype=Object.create(r.Geometry.prototype),r.RingGeometry=function(e,t,i,n,o,a){r.Geometry.call(this);e=e||0,t=t||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var s=[],h=e,l=(t-e)/(n=void 0!==n?Math.max(3,n):8);for(e=0;e<=n;e++){for(t=0;t<=i;t++){var c=o+t/i*a;(u=new r.Vector3).x=h*Math.cos(c),u.y=h*Math.sin(c),this.vertices.push(u),s.push(new r.Vector2((u.x/h+1)/2,-(u.y/h+1)/2+1))}h+=l}for(o=new r.Vector3(0,0,1),e=0;e<n;e++)for(a=e*i,t=0;t<=i;t++){l=(c=t+a)+e;var u=c+i+e,p=c+i+1+e;this.faces.push(new r.Face3(l,u,p,[o,o,o])),this.faceVertexUvs[0].push([s[l],s[u],s[p]]),l=c+e,u=c+i+1+e,p=c+1+e,this.faces.push(new r.Face3(l,u,p,[o,o,o])),this.faceVertexUvs[0].push([s[l],s[u],s[p]])}this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere=new r.Sphere(new r.Vector3,h)},r.RingGeometry.prototype=Object.create(r.Geometry.prototype),r.SphereGeometry=function(e,t,i,n,o,a,s){r.Geometry.call(this),this.radius=e=e||50,this.widthSegments=t=Math.max(3,Math.floor(t)||8),this.heightSegments=i=Math.max(2,Math.floor(i)||6),this.phiStart=n=void 0!==n?n:0,this.phiLength=o=void 0!==o?o:2*Math.PI,this.thetaStart=a=void 0!==a?a:0,this.thetaLength=s=void 0!==s?s:Math.PI;var h,l,c=[],u=[];for(l=0;l<=i;l++){var p=[],f=[];for(h=0;h<=t;h++){var d=h/t,m=l/i;(g=new r.Vector3).x=-e*Math.cos(n+d*o)*Math.sin(a+m*s),g.y=e*Math.cos(a+m*s),g.z=e*Math.sin(n+d*o)*Math.sin(a+m*s),this.vertices.push(g),p.push(this.vertices.length-1),f.push(new r.Vector2(d,1-m))}c.push(p),u.push(f)}for(l=0;l<this.heightSegments;l++)for(h=0;h<this.widthSegments;h++){t=c[l][h+1],i=c[l][h],n=c[l+1][h],o=c[l+1][h+1],a=this.vertices[t].clone().normalize(),s=this.vertices[i].clone().normalize(),p=this.vertices[n].clone().normalize(),f=this.vertices[o].clone().normalize(),d=u[l][h+1].clone(),m=u[l][h].clone();var g=u[l+1][h].clone(),v=u[l+1][h+1].clone();Math.abs(this.vertices[t].y)===this.radius?(this.faces.push(new r.Face3(t,n,o,[a,p,f])),this.faceVertexUvs[0].push([d,g,v])):Math.abs(this.vertices[n].y)===this.radius?(this.faces.push(new r.Face3(t,i,n,[a,s,p])),this.faceVertexUvs[0].push([d,m,g])):(this.faces.push(new r.Face3(t,i,o,[a,s,f])),this.faceVertexUvs[0].push([d,m,v]),this.faces.push(new r.Face3(i,n,o,[s,p,f])),this.faceVertexUvs[0].push([m.clone(),g,v.clone()]))}this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere=new r.Sphere(new r.Vector3,e)},r.SphereGeometry.prototype=Object.create(r.Geometry.prototype),r.TextGeometry=function(e,t){t=t||{};var i=r.FontUtils.generateShapes(e,t);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),r.ExtrudeGeometry.call(this,i,t)},r.TextGeometry.prototype=Object.create(r.ExtrudeGeometry.prototype),r.TorusGeometry=function(e,t,i,n,o){for(r.Geometry.call(this),this.radius=e||100,this.tube=t||40,this.radialSegments=i||8,this.tubularSegments=n||6,this.arc=o||2*Math.PI,o=new r.Vector3,e=[],t=[],i=0;i<=this.radialSegments;i++)for(n=0;n<=this.tubularSegments;n++){var a=n/this.tubularSegments*this.arc,s=2*i/this.radialSegments*Math.PI;o.x=this.radius*Math.cos(a),o.y=this.radius*Math.sin(a),(h=new r.Vector3).x=(this.radius+this.tube*Math.cos(s))*Math.cos(a),h.y=(this.radius+this.tube*Math.cos(s))*Math.sin(a),h.z=this.tube*Math.sin(s),this.vertices.push(h),e.push(new r.Vector2(n/this.tubularSegments,i/this.radialSegments)),t.push(h.clone().sub(o).normalize())}for(i=1;i<=this.radialSegments;i++)for(n=1;n<=this.tubularSegments;n++){o=(this.tubularSegments+1)*i+n-1,a=(this.tubularSegments+1)*(i-1)+n-1,s=(this.tubularSegments+1)*(i-1)+n;var h=(this.tubularSegments+1)*i+n,l=new r.Face3(o,a,h,[t[o],t[a],t[h]]);l.normal.add(t[o]),l.normal.add(t[a]),l.normal.add(t[h]),l.normal.normalize(),this.faces.push(l),this.faceVertexUvs[0].push([e[o].clone(),e[a].clone(),e[h].clone()]),(l=new r.Face3(a,s,h,[t[a],t[s],t[h]])).normal.add(t[a]),l.normal.add(t[s]),l.normal.add(t[h]),l.normal.normalize(),this.faces.push(l),this.faceVertexUvs[0].push([e[a].clone(),e[s].clone(),e[h].clone()])}this.computeCentroids()},r.TorusGeometry.prototype=Object.create(r.Geometry.prototype),r.TorusKnotGeometry=function(e,t,i,n,o,a,s){function h(e,t,i,n,o){var a=Math.cos(e),s=Math.sin(e);e*=t/i,a=n*(2+(t=Math.cos(e)))*.5*a,s*=.5*n*(2+t),n=.5*o*n*Math.sin(e);return new r.Vector3(a,s,n)}for(r.Geometry.call(this),this.radius=e||100,this.tube=t||40,this.radialSegments=i||64,this.tubularSegments=n||8,this.p=o||2,this.q=a||3,this.heightScale=s||1,this.grid=Array(this.radialSegments),i=new r.Vector3,
1n=new r.Vector3,o=new r.Vector3,e=0;e<this.radialSegments;++e)for(this.grid[e]=Array(this.tubularSegments),a=h(t=e/this.radialSegments*2*this.p*Math.PI,this.q,this.p,this.radius,this.heightScale),t=h(t+.01,this.q,this.p,this.radius,this.heightScale),i.subVectors(t,a),n.addVectors(t,a),o.crossVectors(i,n),n.crossVectors(o,i),o.normalize(),n.normalize(),t=0;t<this.tubularSegments;++t){var l=t/this.tubularSegments*2*Math.PI;s=-this.tube*Math.cos(l),l=this.tube*Math.sin(l);(c=new r.Vector3).x=a.x+s*n.x+l*o.x,c.y=a.y+s*n.y+l*o.y,c.z=a.z+s*n.z+l*o.z,this.grid[e][t]=this.vertices.push(c)-1}for(e=0;e<this.radialSegments;++e)for(t=0;t<this.tubularSegments;++t){o=(e+1)%this.radialSegments,a=(t+1)%this.tubularSegments,i=this.grid[e][t],n=this.grid[o][t],o=this.grid[o][a],a=this.grid[e][a],s=new r.Vector2(e/this.radialSegments,t/this.tubularSegments),l=new r.Vector2((e+1)/this.radialSegments,t/this.tubularSegments);var c=new r.Vector2((e+1)/this.radialSegments,(t+1)/this.tubularSegments),u=new r.Vector2(e/this.radialSegments,(t+1)/this.tubularSegments);this.faces.push(new r.Face3(i,n,a)),this.faceVertexUvs[0].push([s,l,u]),this.faces.push(new r.Face3(n,o,a)),this.faceVertexUvs[0].push([l.clone(),c,u.clone()])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},r.TorusKnotGeometry.prototype=Object.create(r.Geometry.prototype),r.TubeGeometry=function(e,t,i,n,o){r.Geometry.call(this),this.path=e,this.segments=t||64,this.radius=i||1,this.radialSegments=n||8,this.closed=o||!1,this.grid=[];var a,s,h,l,c,u,p;n=this.segments+1,o=new r.Vector3;for(u=(t=new r.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed)).normals,p=t.binormals,this.tangents=t.tangents,this.normals=u,this.binormals=p,t=0;t<n;t++)for(this.grid[t]=[],i=t/(n-1),c=e.getPointAt(i),a=u[t],s=p[t],i=0;i<this.radialSegments;i++)h=i/this.radialSegments*2*Math.PI,l=-this.radius*Math.cos(h),h=this.radius*Math.sin(h),o.copy(c),o.x+=l*a.x+h*s.x,o.y+=l*a.y+h*s.y,o.z+=l*a.z+h*s.z,this.grid[t][i]=this.vertices.push(new r.Vector3(o.x,o.y,o.z))-1;for(t=0;t<this.segments;t++)for(i=0;i<this.radialSegments;i++)o=this.closed?(t+1)%this.segments:t+1,u=(i+1)%this.radialSegments,e=this.grid[t][i],n=this.grid[o][i],o=this.grid[o][u],u=this.grid[t][u],p=new r.Vector2(t/this.segments,i/this.radialSegments),a=new r.Vector2((t+1)/this.segments,i/this.radialSegments),s=new r.Vector2((t+1)/this.segments,(i+1)/this.radialSegments),l=new r.Vector2(t/this.segments,(i+1)/this.radialSegments),this.faces.push(new r.Face3(e,n,u)),this.faceVertexUvs[0].push([p,a,l]),this.faces.push(new r.Face3(n,o,u)),this.faceVertexUvs[0].push([a.clone(),s,l.clone()]);this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},r.TubeGeometry.prototype=Object.create(r.Geometry.prototype),r.TubeGeometry.FrenetFrames=function(e,t,i){new r.Vector3;var n=new r.Vector3;new r.Vector3;var o,a,s,h=[],l=[],c=[],u=new r.Vector3,p=new r.Matrix4;t+=1;for(this.tangents=h,this.normals=l,this.binormals=c,o=0;o<t;o++)a=o/(t-1),h[o]=e.getTangentAt(a),h[o].normalize();for(l[0]=new r.Vector3,c[0]=new r.Vector3,e=Number.MAX_VALUE,o=Math.abs(h[0].x),a=Math.abs(h[0].y),s=Math.abs(h[0].z),o<=e&&(e=o,n.set(1,0,0)),a<=e&&(e=a,n.set(0,1,0)),s<=e&&n.set(0,0,1),u.crossVectors(h[0],n).normalize(),l[0].crossVectors(h[0],u),c[0].crossVectors(h[0],l[0]),o=1;o<t;o++)l[o]=l[o-1].clone(),c[o]=c[o-1].clone(),u.crossVectors(h[o-1],h[o]),1e-4<u.length()&&(u.normalize(),n=Math.acos(r.Math.clamp(h[o-1].dot(h[o]),-1,1)),l[o].applyMatrix4(p.makeRotationAxis(u,n))),c[o].crossVectors(h[o],l[o]);if(i)for(n=Math.acos(r.Math.clamp(l[0].dot(l[t-1]),-1,1)),n/=t-1,0<h[0].dot(u.crossVectors(l[0],l[t-1]))&&(n=-n),o=1;o<t;o++)l[o].applyMatrix4(p.makeRotationAxis(h[o],n*o)),c[o].crossVectors(h[o],l[o])},r.PolyhedronGeometry=function(e,t,i,n){function o(e){var t=e.normalize().clone();t.index=h.vertices.push(t)-1;var i=Math.atan2(e.z,-e.x)/2/Math.PI+.5;e=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;return t.uv=new r.Vector2(i,1-e),t}function a(e,t,i){var n=new r.Face3(e.index,t.index,i.index,[e.clone(),t.clone(),i.clone()]);n.centroid.add(e).add(t).add(i).divideScalar(3),h.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),h.faceVertexUvs[0].push([s(e.uv,e,n),s(t.uv,t,n),s(i.uv,i,n)])}function s(e,t,i){return 0>i&&1===e.x&&(e=new r.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new r.Vector2(i/2/Math.PI+.5,e.y)),e.clone()}r.Geometry.call(this);i=i||1,n=n||0;for(var h=this,l=0,c=e.length;l<c;l++)o(new r.Vector3(e[l][0],e[l][1],e[l][2]));var u=this.vertices;for(e=[],l=0,c=t.length;l<c;l++){var p=u[t[l][0]],f=u[t[l][1]],d=u[t[l][2]];e[l]=new r.Face3(p.index,f.index,d.index,[p.clone(),f.clone(),d.clone()])}for(l=0,c=e.length;l<c;l++){f=e[l],u=n,t=Math.pow(2,u),Math.pow(4,u);u=o(h.vertices[f.a]),p=o(h.vertices[f.b]);var m=o(h.vertices[f.c]);for(f=[],d=0;d<=t;d++){f[d]=[];for(var g=o(u.clone().lerp(m,d/t)),v=o(p.clone().lerp(m,d/t)),y=t-d,x=0;x<=y;
1x++)f[d][x]=0==x&&d==t?g:o(g.clone().lerp(v,x/y))}for(d=0;d<t;d++)for(x=0;x<2*(t-d)-1;x++)u=Math.floor(x/2),0==x%2?a(f[d][u+1],f[d+1][u],f[d][u]):a(f[d][u+1],f[d+1][u+1],f[d+1][u])}for(l=0,c=this.faceVertexUvs[0].length;l<c;l++)e=(n=this.faceVertexUvs[0][l])[0].x,t=n[1].x,u=n[2].x,p=Math.max(e,Math.max(t,u)),f=Math.min(e,Math.min(t,u)),.9<p&&.1>f&&(.2>e&&(n[0].x+=1),.2>t&&(n[1].x+=1),.2>u&&(n[2].x+=1));for(l=0,c=this.vertices.length;l<c;l++)this.vertices[l].multiplyScalar(i);this.mergeVertices(),this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere=new r.Sphere(new r.Vector3,i)},r.PolyhedronGeometry.prototype=Object.create(r.Geometry.prototype),r.IcosahedronGeometry=function(e,t){this.radius=e,this.detail=t;var i=(1+Math.sqrt(5))/2;r.PolyhedronGeometry.call(this,[[-1,i,0],[1,i,0],[-1,-i,0],[1,-i,0],[0,-1,i],[0,1,i],[0,-1,-i],[0,1,-i],[i,0,-1],[i,0,1],[-i,0,-1],[-i,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],e,t)},r.IcosahedronGeometry.prototype=Object.create(r.Geometry.prototype),r.OctahedronGeometry=function(e,t){r.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],e,t)},r.OctahedronGeometry.prototype=Object.create(r.Geometry.prototype),r.TetrahedronGeometry=function(e,t){r.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],e,t)},r.TetrahedronGeometry.prototype=Object.create(r.Geometry.prototype),r.ParametricGeometry=function(e,t,i){r.Geometry.call(this);var n,o,a,s,h,l,c,u,p=this.vertices,f=this.faces,d=this.faceVertexUvs[0],m=t+1;for(n=0;n<=i;n++)for(s=n/i,o=0;o<=t;o++)a=e(a=o/t,s),p.push(a);for(n=0;n<i;n++)for(o=0;o<t;o++)e=n*m+o,p=n*m+o+1,s=(n+1)*m+o+1,a=(n+1)*m+o,h=new r.Vector2(o/t,n/i),l=new r.Vector2((o+1)/t,n/i),c=new r.Vector2((o+1)/t,(n+1)/i),u=new r.Vector2(o/t,(n+1)/i),f.push(new r.Face3(e,p,a)),d.push([h,l,u]),f.push(new r.Face3(p,s,a)),d.push([l.clone(),c,u.clone()]);this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},r.ParametricGeometry.prototype=Object.create(r.Geometry.prototype),r.AxisHelper=function(e){e=e||1;var t=new r.Geometry;t.vertices.push(new r.Vector3,new r.Vector3(e,0,0),new r.Vector3,new r.Vector3(0,e,0),new r.Vector3,new r.Vector3(0,0,e)),t.colors.push(new r.Color(16711680),new r.Color(16755200),new r.Color(65280),new r.Color(11206400),new r.Color(255),new r.Color(43775)),e=new r.LineBasicMaterial({vertexColors:r.VertexColors}),r.Line.call(this,t,e,r.LinePieces)},r.AxisHelper.prototype=Object.create(r.Line.prototype),r.ArrowHelper=function(e,t,i,n){r.Object3D.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),this.position=t,(t=new r.Geometry).vertices.push(new r.Vector3(0,0,0)),t.vertices.push(new r.Vector3(0,1,0)),this.line=new r.Line(t,new r.LineBasicMaterial({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),(t=new r.CylinderGeometry(0,.05,.25,5,1)).applyMatrix((new r.Matrix4).makeTranslation(0,.875,0)),this.cone=new r.Mesh(t,new r.MeshBasicMaterial({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i)},r.ArrowHelper.prototype=Object.create(r.Object3D.prototype),r.ArrowHelper.prototype.setDirection=function(){var e,t=new r.Vector3;return function(i){.99999<i.y?this.quaternion.set(0,0,0,1):-.99999>i.y?this.quaternion.set(1,0,0,0):(t.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(t,e))}}(),r.ArrowHelper.prototype.setLength=function(e){this.scale.set(e,e,e)},r.ArrowHelper.prototype.setColor=function(e){this.line.material.color.setHex(e),this.cone.material.color.setHex(e)},r.BoxHelper=function(e){var t=[new r.Vector3(1,1,1),new r.Vector3(-1,1,1),new r.Vector3(-1,-1,1),new r.Vector3(1,-1,1),new r.Vector3(1,1,-1),new r.Vector3(-1,1,-1),new r.Vector3(-1,-1,-1),new r.Vector3(1,-1,-1)];this.vertices=t;var i=new r.Geometry;i.vertices.push(t[0],t[1],t[1],t[2],t[2],t[3],t[3],t[0],t[4],t[5],t[5],t[6],t[6],t[7],t[7],t[4],t[0],t[4],t[1],t[5],t[2],t[6],t[3],t[7]),r.Line.call(this,i,new r.LineBasicMaterial({color:16776960}),r.LinePieces),void 0!==e&&this.update(e)},r.BoxHelper.prototype=Object.create(r.Line.prototype),r.BoxHelper.prototype.update=function(e){null===(i=e.geometry).boundingBox&&i.computeBoundingBox();var t=i.boundingBox.min,i=i.boundingBox.max,r=this.vertices;r[0].set(i.x,i.y,i.z),r[1].set(t.x,i.y,i.z),r[2].set(t.x,t.y,i.z),r[3].set(i.x,t.y,i.z),r[4].set(i.x,i.y,t.z),r[5].set(t.x,i.y,t.z),r[6].set(t.x,t.y,t.z),r[7].set(i.x,t.y,t.z),this.geometry.computeBoundingSphere(),this.geometry.verticesNeedUpdate=!0,this.matrixAutoUpdate=!1,this.matrixWorld=e.matrixWorld},r.BoundingBoxHelper=function(e,t){var i=t||8947848;this.object=e,this.box=new r.Box3,r.Mesh.call(this,new r.CubeGeometry(1,1,1),new r.MeshBasicMaterial({color:i,wireframe:!0}))},r.BoundingBoxHelper.prototype=Object.create(r.Mesh.prototype),r.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},r.CameraHelper=function(e){function t(e,t,r){i(e,r),i(t,r)}function i(e,t){n.vertices.push(new r.Vector3),n.colors.push(new r.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(n.vertices.length-1)}var n=new r.Geometry,o=new r.LineBasicMaterial({color:16777215,vertexColors:r.FaceColors}),a={};t("n1","n2",16755200),t("n2","n4",16755200),t("n4","n3",16755200),t("n3","n1",16755200),t("f1","f2",16755200),t("f2","f4",16755200),t("f4","f3",16755200),t("f3","f1",16755200),t("n1","f1",16755200),t("n2","f2",16755200),t("n3","f3",16755200),t("n4","f4",16755200),t("p","n1",16711680),t("p","n2",16711680),t("p","n3",16711680),t("p","n4",16711680),t("u1","u2",43775),t("u2","u3",43775),t("u3","u1",43775),t("c","t",16777215),t("p","c",3355443),t("cn1","cn2",3355443),t("cn3","cn4",3355443),t("cf1","cf2",3355443),t("cf3","cf4",3355443),r.Line.call(this,n,o,r.LinePieces),this.camera=e,this.matrixWorld=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},r.CameraHelper.prototype=Object.create(r.Line.prototype),r.CameraHelper.prototype.update=function(){var e=new r.Vector3,t=new r.Camera,i=new r.Projector;
1return function(){function r(r,o,a,s){if(e.set(o,a,s),i.unprojectVector(e,t),void 0!==(r=n.pointMap[r]))for(o=0,a=r.length;o<a;o++)n.geometry.vertices[r[o]].copy(e)}var n=this;t.projectionMatrix.copy(this.camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-1,-1,-1),r("n2",1,-1,-1),r("n3",-1,1,-1),r("n4",1,1,-1),r("f1",-1,-1,1),r("f2",1,-1,1),r("f3",-1,1,1),r("f4",1,1,1),r("u1",.7,1.1,-1),r("u2",-.7,1.1,-1),r("u3",0,2,-1),r("cf1",-1,0,1),r("cf2",1,0,1),r("cf3",0,-1,1),r("cf4",0,1,1),r("cn1",-1,0,-1),r("cn2",1,0,-1),r("cn3",0,-1,-1),r("cn4",0,1,-1),this.geometry.verticesNeedUpdate=!0}}(),r.DirectionalLightHelper=function(e,t){r.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrixWorld=e.matrixWorld,this.matrixAutoUpdate=!1;var i=new r.PlaneGeometry(t,t),n=new r.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new r.Mesh(i,n),this.add(this.lightPlane),(i=new r.Geometry).vertices.push(new r.Vector3),i.vertices.push(new r.Vector3),i.computeLineDistances(),(n=new r.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new r.Line(i,n),this.add(this.targetLine),this.update()},r.DirectionalLightHelper.prototype=Object.create(r.Object3D.prototype),r.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},r.DirectionalLightHelper.prototype.update=function(){var e=new r.Vector3;return function(){e.getPositionFromMatrix(this.light.matrixWorld).negate(),this.lightPlane.lookAt(e),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].c
1opy(e),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),r.FaceNormalsHelper=function(e,t,i,n){this.object=e,this.size=t||1;e=i||16776960,n=n||1,t=new r.Geometry,i=0;for(var o=this.object.geometry.faces.length;i<o;i++)t.vertices.push(new r.Vector3),t.vertices.push(new r.Vector3);r.Line.call(this,t,new r.LineBasicMaterial({color:e,linewidth:n}),r.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new r.Matrix3,this.update()},r.FaceNormalsHelper.prototype=Object.create(r.Line.prototype),r.FaceNormalsHelper.prototype.update=function(){var e=new r.Vector3;return function(){this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var t=this.geometry.vertices,i=this.object.geometry.faces,r=this.object.matrixWorld,n=0,o=i.length;n<o;n++){var a=i[n];e.copy(a.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);var s=2*n;t[s].copy(a.centroid).applyMatrix4(r),t[s+1].addVectors(t[s],e)}return this.geometry.verticesNeedUpdate=!0,this}}(),r.GridHelper=function(e,t){var i=new r.Geometry,n=new r.LineBasicMaterial({vertexColors:r.VertexColors});this.color1=new r.Color(4473924),this.color2=new r.Color(8947848);for(var o=-e;o<=e;o+=t){i.vertices.push(new r.Vector3(-e,0,o),new r.Vector3(e,0,o),new r.Vector3(o,0,-e),new r.Vector3(o,0,e));var a=0===o?this.color1:this.color2;i.colors.push(a,a,a,a)}r.Line.call(this,i,n,r.LinePieces)},r.GridHelper.prototype=Object.create(r.Line.prototype),r.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},r.HemisphereLightHelper=function(e,t){r.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrixWorld=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new r.Color,new r.Color];var i=new r.SphereGeometry(t,4,2);i.applyMatrix((new r.Matrix4).makeRotationX(-Math.PI/2));for(var n=0;8>n;n++)i.faces[n].color=this.colors[4>n?0:1];n=new r.MeshBasicMaterial({vertexColors:r.FaceColors,wireframe:!0}),this.lightSphere=new r.Mesh(i,n),this.add(this.lightSphere),this.update()},r.HemisphereLightHelper.prototype=Object.create(r.Object3D.prototype),r.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},r.HemisphereLightHelper.prototype.update=function(){var e=new r.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.getPositionFromMatrix(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),r.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var i=new r.SphereGeometry(t,4,2),n=new r.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.Mesh.call(this,i,n),this.matrixWorld=this.light.matrixWorld,this.matrixAutoUpdate=!1},r.PointLightHelper.prototype=Object.create(r.Mesh.prototype),r.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},r.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},r.SpotLightHelper=function(e){r.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrixWorld=e.matrixWorld,this.matrixAutoUpdate=!1,(e=new r.CylinderGeometry(0,1,1,8,1,!0)).applyMatrix((new r.Matrix4).makeTranslation(0,-.5,0)),e.applyMatrix((new r.Matrix4).makeRotationX(-Math.PI/2));var t=new r.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new r.Mesh(e,t),this.add(this.cone),this.update()},r.SpotLightHelper.prototype=Object.create(r.Object3D.prototype),r.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},r.SpotLightHelper.prototype.update=function(){var e=new r.Vector3,t=new r.Vector3;return function(){var i=this.light.distance?this.light.distance:1e4,r=i*Math.tan(this.light.angle);
1this.cone.scale.set(r,r,i),e.getPositionFromMatrix(this.light.matrixWorld),t.getPositionFromMatrix(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),r.VertexNormalsHelper=function(e,t,i,n){this.object=e,this.size=t||1;t=i||16711680,n=n||1,i=new r.Geometry;for(var o=0,a=(e=e.geometry.faces).length;o<a;o++)for(var s=0,h=e[o].vertexNormals.length;s<h;s++)i.vertices.push(new r.Vector3),i.vertices.push(new r.Vector3);r.Line.call(this,i,new r.LineBasicMaterial({color:t,linewidth:n}),r.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new r.Matrix3,this.update()},r.VertexNormalsHelper.prototype=Object.create(r.Line.prototype),r.VertexNormalsHelper.prototype.update=function(){var e=new r.Vector3;return function(){var t=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var i=this.geometry.vertices,r=this.object.geometry.vertices,n=this.object.geometry.faces,o=this.object.matrixWorld,a=0,s=0,h=n.length;s<h;s++)for(var l=n[s],c=0,u=l.vertexNormals.length;c<u;c++){var p=l.vertexNormals[c];i[a].copy(r[l[t[c]]]).applyMatrix4(o),e.copy(p).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),e.add(i[a]),i[a+=1].copy(e),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),r.VertexTangentsHelper=function(e,t,i,n){this.object=e,this.size=t||1;t=i||255,n=n||1,i=new r.Geometry;for(var o=0,a=(e=e.geometry.faces).length;o<a;o++)for(var s=0,h=e[o].vertexTangents.length;s<h;s++)i.vertices.push(new r.Vector3),i.vertices.push(new r.Vector3);r.Line.call(this,i,new r.LineBasicMaterial({color:t,linewidth:n}),r.LinePieces),this.matrixAutoUpdate=!1,this.update()},r.VertexTangentsHelper.prototype=Object.create(r.Line.prototype),r.VertexTangentsHelper.prototype.update=function(){var e=new r.Vector3;return function(){var t=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var i=this.geometry.vertices,r=this.object.geometry.vertices,n=this.object.geometry.faces,o=this.object.matrixWorld,a=0,s=0,h=n.length;s<h;s++)for(var l=n[s],c=0,u=l.vertexTangents.length;c<u;c++){var p=l.vertexTangents[c];i[a].copy(r[l[t[c]]]).applyMatrix4(o),e.copy(p).transformDirection(o).multiplyScalar(this.size),e.add(i[a]),i[a+=1].copy(e),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),r.WireframeHelper=function(e){for(var t=[0,0],i={},n=function(e,t){return e-t},o=["a","b","c","d"],a=new r.Geometry,s=e.geometry.vertices,h=e.geometry.faces,l=0,c=h.length;l<c;l++)for(var u=h[l],p=0;3>p;p++){t[0]=u[o[p]],t[1]=u[o[(p+1)%3]],t.sort(n);var f=t.toString();void 0===i[f]&&(a.vertices.push(s[t[0]]),a.vertices.push(s[t[1]]),i[f]=!0)}r.Line.call(this,a,new r.LineBasicMaterial({color:16777215}),r.LinePieces),this.matrixAutoUpdate=!1,this.matrixWorld=e.matrixWorld},r.WireframeHelper.prototype=Object.create(r.Line.prototype),r.ImmediateRenderObject=function(){r.Object3D.call(this),this.render=function(){}},r.ImmediateRenderObject.prototype=Object.create(r.Object3D.prototype),r.LensFlare=function(e,t,i,n,o){r.Object3D.call(this),this.lensFlares=[],this.positionScreen=new r.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,n,o)},r.LensFlare.prototype=Object.create(r.Object3D.prototype),r.LensFlare.prototype.add=function(e,t,i,n,o,a){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===o&&(o=new r.Color(16777215)),void 0===n&&(n=r.NormalBlending),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:1,opacity:a,color:o,blending:n})},r.LensFlare.prototype.updateLensFlares=function(){var e,t,i=this.lensFlares.length,r=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;e<i;e++)(t=this.lensFlares[e]).x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=.25*t.x*Math.PI,t.rotation+=.25*(t.wantedRotation-t.rotation)},r.MorphBlendMesh=function(e,t){r.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length;this.createAnimation("__default",0,i-1,i/1),this.setAnimationWeight("__default",1)},r.MorphBlendMesh.prototype=Object.create(r.Mesh.prototype),r.MorphBlendMesh.prototype.createAnimation=function(e,t,i,r){t={startFrame:t,endFrame:i,length:i-t+1,fps:r,duration:(i-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[e]=t,this.animationsList.push(t)},r.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)(\d+)/,r={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s=n.morphTargets[o].name.match(i);
1if(s&&1<s.length){var h=s[1];r[h]||(r[h]={start:1/0,end:-1/0}),o<(s=r[h]).start&&(s.start=o),o>s.end&&(s.end=o),t||(t=h)}}for(h in r)s=r[h],this.createAnimation(h,s.start,s.end,e);this.firstAnimation=t},r.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){(e=this.animationsMap[e])&&(e.direction=1,e.directionBackwards=!1)},r.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){(e=this.animationsMap[e])&&(e.direction=-1,e.directionBackwards=!0)},r.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},r.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},r.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},r.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},r.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0;return(e=this.animationsMap[e])&&(t=e.time),t},r.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1;return(e=this.animationsMap[e])&&(t=e.duration),t},r.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("animation["+e+"] undefined")},r.MorphBlendMesh.prototype.stopAnimation=function(e){(e=this.animationsMap[e])&&(e.active=!1)},r.MorphBlendMesh.prototype.update=function(e){for(var t=0,i=this.animationsList.length;t<i;t++){var n=this.animationsList[t];if(n.active){var o=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||0>n.time)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),0>n.time&&(n.time=0,n.directionBackwards=!1)):(n.time%=n.duration,0>n.time&&(n.time+=n.duration));var a=n.startFrame+r.Math.clamp(Math.floor(n.time/o),0,n.length-1),s=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a),o=n.time%o/o,n.directionBackwards&&(o=1-o),this.morphTargetInfluences[n.currentFrame]=o*s,this.morphTargetInfluences[n.lastFrame]=(1-o)*s}}},r.LensFlarePlugin=function(){function e(e,i){var r=t.createProgram(),n=t.createShader(t.FRAGMENT_SHADER),o=t.createShader(t.VERTEX_SHADER),a="precision "+i+" float;\n";return t.shaderSource(n,a+e.fragmentShader),t.shaderSource(o,a+e.vertexShader),t.compileShader(n),t.compileShader(o),t.attachShader(r,n),t.attachShader(r,o),t.linkProgram(r),r}var t,i,n,o,a,s,h,l,c,u,p,f,d;this.init=function(m){t=m.context,i=m,n=m.getPrecision(),o=new Float32Array(16),a=new Uint16Array(6),m=0,o[m++]=-1,o[m++]=-1,o[m++]=0,o[m++]=0,o[m++]=1,o[m++]=-1,o[m++]=1,o[m++]=0,o[m++]=1,o[m++]=1,o[m++]=1,o[m++]=1,o[m++]=-1,o[m++]=1,o[m++]=0,o[m++]=1,m=0,a[m++]=0,a[m++]=1,a[m++]=2,a[m++]=0,a[m++]=2,a[m++]=3,s=t.createBuffer(),h=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,h),t.bufferData(t.ELEMENT_ARRAY_BUFFER,a,t.STATIC_DRAW),l=t.createTexture(),c=t.createTexture(),t.bindTexture(t.TEXTURE_2D,l),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.bindTexture(t.TEXTURE_2D,c),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),0>=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(u=!1,p=e(r.ShaderFlares.lensFlare,n)):(u=!0,p=e(r.ShaderFlares.lensFlareVertexTexture,n)),d={},(f={}).vertex=t.getAttribLocation(p,"position"),f.uv=t.getAttribLocation(p,"uv"),d.renderType=t.getUniformLocation(p,"renderType"),d.map=t.getUniformLocation(p,"map"),d.occlusionMap=t.getUniformLocation(p,"occlusionMap"),d.opacity=t.getUniformLocation(p,"opacity"),d.color=t.getUniformLocation(p,"color"),d.scale=t.getUniformLocation(p,"scale"),d.rotation=t.getUniformLocation(p,"rotation"),d.screenPosition=t.getUniformLocation(p,"screenPosition")},this.render=function(e,n,o,a){var m=(e=e.__webglFlares).length;if(m){var g,v,y,x,_,w=new r.Vector3,b=a/o,M=.5*o,S=.5*a,T=16/a,C=new r.Vector2(T*b,T),A=new r.Vector3(1,1,0),E=new r.Vector2(1,1),L=d;T=f;for(t.useProgram(p),t.enableVertexAttribArray(f.vertex),t.enableVertexAttribArray(f.uv),t.uniform1i(L.occlusionMap,0),t.uniform1i(L.map,1),t.bindBuffer(t.ARRAY_BUFFER,s),t.vertexAttribPointer(T.vertex,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(T.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,h),t.disable(t.CULL_FACE),t.depthMask(!1),g=0;g<m;g++)if(T=16/a,C.set(T*b,T),x=e[g],w.set(x.matrixWorld.elements[12],x.matrixWorld.elements[13],x.matrixWorld.elements[14]),w.applyMatrix4(n.matrixWorldInverse),w.applyProjection(n.projectionMatrix),A.copy(w),E.x=A.x*M+M,E.y=A.y*S+S,u||0<E.x&&E.x<o&&0<E.y&&E.y<a)for(t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,l),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGB,E.x-8,E.y-8,16,16,0),t.uniform1i(L.renderType,0),t.uniform2f(L.scale,C.x,C.y),t.uniform3f(L.screenPosition,A.x,A.y,A.z),t.disable(t.BLEND),t.enable(t.DEPTH_TEST),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,c),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,E.x-8,E.y-8,16,16,0),t.uniform1i(L.renderType,1),t.disable(t.DEPTH_TEST),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,l),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),x.positionScreen.copy(A),x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares(),t.uniform1i(L.renderType,2),t.enable(t.BLEND),v=0,y=x.lensFlares.length;v<y;v++).001<(_=x.lensFlares[v]).opacity&&.001<_.scale&&(A.x=_.x,A.y=_.y,A.z=_.z,T=_.size*_.scale/a,C.x=T*b,C.y=T,t.uniform3f(L.screenPosition,A.x,A.y,A.z),t.uniform2f(L.scale,C.x,C.y),t.uniform1f(L.rotation,_.rotation),t.uniform1f(L.op
1acity,_.opacity),t.uniform3f(L.color,_.color.r,_.color.g,_.color.b),i.setBlending(_.blending,_.blendEquation,_.blendSrc,_.blendDst),i.setTexture(_.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0));t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.depthMask(!0)}}},r.ShadowMapPlugin=function(){var e,t,i,n,o,a,s=new r.Frustum,h=new r.Matrix4,l=new r.Vector3,c=new r.Vector3,u=new r.Vector3;this.init=function(s){e=s.context,t=s;s=r.ShaderLib.depthRGBA;var h=r.UniformsUtils.clone(s.uniforms);i=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h}),n=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,morphTargets:!0}),o=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,skinning:!0}),a=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,morphTargets:!0,skinning:!0}),i._shadowPass=!0,n._shadowPass=!0,o._shadowPass=!0,a._shadowPass=!0},this.render=function(e,i){t.shadowMapEnabled&&t.shadowMapAutoUpdate&&this.update(e,i)},this.update=function(p,f){var d,m,g,v,y,x,_,w,b,M=[];for(v=0,e.clearColor(1,1,1,1),e.disable(e.BLEND),e.enable(e.CULL_FACE),e.frontFace(e.CCW),t.shadowMapCullFace===r.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.BACK),t.setDepthTest(!0),d=0,m=p.__lights.length;d<m;d++)if((g=p.__lights[d]).castShadow)if(g instanceof r.DirectionalLight&&g.shadowCascade)for(y=0;y<g.shadowCascadeCount;y++){var S;if(g.shadowCascadeArray[y])S=g.shadowCascadeArray[y];else{b=g,_=y,(S=new r.DirectionalLight).isVirtual=!0,S.onlyShadow=!0,S.castShadow=!0,S.shadowCameraNear=b.shadowCameraNear,S.shadowCameraFar=b.shadowCameraFar,S.shadowCameraLeft=b.shadowCameraLeft,S.shadowCameraRight=b.shadowCameraRight,S.shadowCameraBottom=b.shadowCameraBottom,S.shadowCameraTop=b.shadowCameraTop,S.shadowCameraVisible=b.shadowCameraVisible,S.shadowDarkness=b.shadowDarkness,S.shadowBias=b.shadowCascadeBias[_],S.shadowMapWidth=b.shadowCascadeWidth[_],S.shadowMapHeight=b.shadowCascadeHeight[_],S.pointsWorld=[],S.pointsFrustum=[],w=S.pointsWorld,x=S.pointsFrustum;for(var T=0;8>T;T++)w[T]=new r.Vector3,x[T]=new r.Vector3;w=b.shadowCascadeNearZ[_],b=b.shadowCascadeFarZ[_],x[0].set(-1,-1,w),x[1].set(1,-1,w),x[2].set(-1,1,w),x[3].set(1,1,w),x[4].set(-1,-1,b),x[5].set(1,-1,b),x[6].set(-1,1,b),x[7].set(1,1,b),S.originalCamera=f,(x=new r.Gyroscope).position=g.shadowCascadeOffset,x.add(S),x.add(S.target),f.add(x),g.shadowCascadeArray[y]=S,console.log("Created virtualLight",S)}w=y,(b=(_=g).shadowCascadeArray[w]).position.copy(_.position),b.target.position.copy(_.target.position),b.lookAt(b.target),b.shadowCameraVisible=_.shadowCameraVisible,b.shadowDarkness=_.shadowDarkness,b.shadowBias=_.shadowCascadeBias[w],x=_.shadowCascadeNearZ[w],_=_.shadowCascadeFarZ[w],(b=b.pointsFrustum)[0].z=x,b[1].z=x,b[2].z=x,b[3].z=x,b[4].z=_,b[5].z=_,b[6].z=_,b[7].z=_,M[v]=S,v++}else M[v]=g,v++;for(d=0,m=M.length;d<m;d++){if((g=M[d]).shadowMap||(y=r.LinearFilter,t.shadowMapType===r.PCFSoftShadowMap&&(y=r.NearestFilter),g.shadowMap=new r.WebGLRenderTarget(g.shadowMapWidth,g.shadowMapHeight,{minFilter:y,magFilter:y,format:r.RGBAFormat}),g.shadowMapSize=new r.Vector2(g.shadowMapWidth,g.shadowMapHeight),g.shadowMatrix=new r.Matrix4),!g.shadowCamera){if(g instanceof r.SpotLight)g.shadowCamera=new r.PerspectiveCamera(g.shadowCameraFov,g.shadowMapWidth/g.shadowMapHeight,g.shadowCameraNear,g.shadowCameraFar);else{if(!(g instanceof r.DirectionalLight)){console.error("Unsupported light type for shadow");continue}g.shadowCamera=new r.OrthographicCamera(g.shadowCameraLeft,g.shadowCameraRight,g.shadowCameraTop,g.shadowCameraBottom,g.shadowCameraNear,g.shadowCameraFar)}p.add(g.shadowCamera),!0===p.autoUpdate&&p.updateMatrixWorld()}if(g.shadowCameraVisible&&!g.cameraHelper&&(g.cameraHelper=new r.CameraHelper(g.shadowCamera),g.shadowCamera.add(g.cameraHelper)),g.isVirtual&&S.originalCamera==f){for(y=f,v=g.shadowCamera,x=g.pointsFrustum,b=g.pointsWorld,l.set(1/0,1/0,1/0),c.set(-1/0,-1/0,-1/0),_=0;8>_;_++)(w=b[_]).copy(x[_]),r.ShadowMapPlugin.__projector.unprojectVector(w,y),w.applyMatrix4(v.matrixWorldInverse),w.x<l.x&&(l.x=w.x),w.x>
1c.x&&(c.x=w.x),w.y<l.y&&(l.y=w.y),w.y>c.y&&(c.y=w.y),w.z<l.z&&(l.z=w.z),w.z>c.z&&(c.z=w.z);v.left=l.x,v.right=c.x,v.top=c.y,v.bottom=l.y,v.updateProjectionMatrix()}for(v=g.shadowMap,x=g.shadowMatrix,(y=g.shadowCamera).position.getPositionFromMatrix(g.matrixWorld),u.getPositionFromMatrix(g.target.matrixWorld),y.lookAt(u),y.updateMatrixWorld(),y.matrixWorldInverse.getInverse(y.matrixWorld),g.cameraHelper&&(g.cameraHelper.visible=g.shadowCameraVisible),g.shadowCameraVisible&&g.cameraHelper.update(),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(y.projectionMatrix),x.multiply(y.matrixWorldInverse),h.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),s.setFromMatrix(h),t.setRenderTarget(v),t.clear(),g=0,v=(b=p.__webglObjects).length;g<v;g++)x=(_=b[g]).object,_.render=!1,!x.visible||!x.castShadow||(x instanceof r.Mesh||x instanceof r.ParticleSystem)&&x.frustumCulled&&!s.intersectsObject(x)||(x._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,x.matrixWorld),_.render=!0);for(g=0,v=b.length;g<v;g++)(_=b[g]).render&&(x=_.object,_=_.buffer,T=x.material instanceof r.MeshFaceMaterial?x.material.materials[0]:x.material,w=0<x.geometry.morphTargets.length&&T.morphTargets,T=x instanceof r.SkinnedMesh&&T.skinning,w=x.customDepthMaterial?x.customDepthMaterial:T?w?a:o:w?n:i,_ instanceof r.BufferGeometry?t.renderBufferDirect(y,p.__lights,null,w,_,x):t.renderBuffer(y,p.__lights,null,w,_,x));for(g=0,v=(b=p.__webglObjectsImmediate).length;g<v;g++)(x=(_=b[g]).object).visible&&x.castShadow&&(x._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,x.matrixWorld),t.renderImmediateObject(y,p.__lights,null,i,x))}d=t.getClearColor(),m=t.getClearAlpha(),e.clearColor(d.r,d.g,d.b,m),e.enable(e.BLEND),t.shadowMapCullFace===r.CullFaceFront&&e.cullFace(e.BACK)}},r.ShadowMapPlugin.__projector=new r.Projector,r.SpritePlugin=function(){function e(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var t,i,n,o,a,s,h,l,c,u;this.init=function(e){t=e.context,i=e,n=e.getPrecision(),o=new Float32Array(16),a=new Uint16Array(6),e=0,o[e++]=-.5,o[e++]=-.5,o[e++]=0,o[e++]=0,o[e++]=.5,o[e++]=-.5,o[e++]=1,o[e++]=0,o[e++]=.5,o[e++]=.5,o[e++]=1,o[e++]=1,o[e++]=-.5,o[e++]=.5,o[e++]=0,o[e++]=1,e=0,a[e++]=0,a[e++]=1,a[e++]=2,a[e++]=0,a[e++]=2,a[e++]=3,s=t.createBuffer(),h=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,h),t.bufferData(t.ELEMENT_ARRAY_BUFFER,a,t.STATIC_DRAW);e=r.ShaderSprite.sprite;var p=t.createProgram(),f=t.createShader(t.FRAGMENT_SHADER),d=t.createShader(t.VERTEX_SHADER),m="precision "+n+" float;\n";t.shaderSource(f,m+e.fragmentShader),t.shaderSource(d,m+e.vertexShader),t.compileShader(f),t.compileShader(d),t.attachShader(p,f),t.attachShader(p,d),t.linkProgram(p),l=p,u={},(c={}).position=t.getAttribLocation(l,"position"),c.uv=t.getAttribLocation(l,"uv"),u.uvOffset=t.getUniformLocation(l,"uvOffset"),u.uvScale=t.getUniformLocation(l,"uvScale"),u.rotation=t.getUniformLocation(l,"rotation"),u.scale=t.getUniformLocation(l,"scale"),u.alignment=t.getUniformLocation(l,"alignment"),u.halfViewport=t.getUniformLocation(l,"halfViewport"),u.color=t.getUniformLocation(l,"color"),u.map=t.getUniformLocation(l,"map"),u.opacity=t.getUniformLocation(l,"opacity"),u.useScreenCoordinates=t.getUniformLocation(l,"useScreenCoordinates"),u.sizeAttenuation=t.getUniformLocation(l,"sizeAttenuation"),u.screenPosition=t.getUniformLocation(l,"screenPosition"),u.modelViewMatrix=t.getUniformLocation(l,"modelViewMatrix"),u.projectionMatrix=t.getUniformLocation(l,"projectionMatrix"),u.fogType=t.getUniformLocation(l,"fogType"),u.fogDensity=t.getUniformLocation(l,"fogDensity"),u.fogNear=t.getUniformLocation(l,"fogNear"),u.fogFar=t.getUniformLocation(l,"fogFar"),u.fogColor=t.getUniformLocation(l,"fogColor"),u.alphaTest=t.getUniformLocation(l,"alphaTest")},this.render=function(n,o,a,p){var f=n.__webglSprites,d=f.length;if(d){var m=c,g=u;a=.5*a,p=.5*p;t.useProgram(l),t.enableVertexAttribArray(m.position),t.enableVertexAttribArray(m.uv),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,s),t.vertexAttribPointer(m.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(m.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,h),t.uniformMatrix4fv(g.projectionMatrix,!1,o.projectionMatrix.elements),t.activeTexture(t.TEXTURE0),t.uniform1i(g.map,0);var v=m=0;(w=n.fog)?(t.uniform3f(g.fogColor,w.color.r,w.color.g,w.color.b),w instanceof r.Fog?(t.uniform1f(g.fogNear,w.near),t.uniform1f(g.fogFar,w.far),t.uniform1i(g.fogType,1),v=m=1):w instanceof r.FogExp2&&(t.uniform1f(g.fogDensity,w.density),t.uniform1i(g.fogType,2),v=m=2)):(t.uniform1i(g.fogType,0),v=m=0);for(var y,x,_=[],w=0;w<d;w++)x=(y=f[w]).material,y.visible&&0!==x.opacity&&(x.useScreenCoordinates?y.z=-y.position.z:(y._modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,y.matrixWorld),y.z=-y._modelViewMatrix.elements[14]));for(f.sort(e),w=0;w<d;w++)x=(y=f[w]).material,y.visible&&0!==x.opacity&&x.map&&x.map.image&&x.map.image.width&&(t.uniform1f(g.alphaTest,x.alphaTest),!0===x.useScreenCoordinates?(t.uniform1i(g.useScreenCoordinates,1),t.uniform3f(g.screenPosition,(y.position.x*i.devicePixelRatio-a)/a,(p-y.position.y*i.devicePixelRatio)/p,Math.max(0,Math.min(1,y.position.z))),_[0]=i.devicePixelRatio*y.scale.x,_[1]=i.devicePixelRatio*y.scale.y):(t.uniform1i(g.useScreenCoordinates,0),t.uniform1i(g.sizeAttenuation,x.sizeAttenuation?1:0),t.uniformMatrix4fv(g.modelViewMatrix,!1,y._modelViewMatrix.elements),_[0]=y.scale.x,_[1]=y.scale.y),m!==(o=n.fog&&x.fog?v:0)&&(t.uniform1i(g.fogType,o),m=o),t.uniform2f(g.uvScale,x.uvScale.x,x.uvScale.y),t.uniform2f(g.uvOffset,x.uvOffset.x,x.uvOffset.y),t.uniform2f(g.alignment,x.alignment.x,x.alignment.y),t.uniform1f(g.opacity,x.op
1acity),t.uniform3f(g.color,x.color.r,x.color.g,x.color.b),t.uniform1f(g.rotation,y.rotation),t.uniform2fv(g.scale,_),t.uniform2f(g.halfViewport,a,p),i.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst),i.setDepthTest(x.depthTest),i.setDepthWrite(x.depthWrite),i.setTexture(x.map,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0));t.enable(t.CULL_FACE)}}},r.DepthPassPlugin=function(){this.enabled=!1,this.renderTarget=null;var e,t,i,n,o,a,s=new r.Frustum,h=new r.Matrix4;this.init=function(s){e=s.context,t=s;s=r.ShaderLib.depthRGBA;var h=r.UniformsUtils.clone(s.uniforms);i=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h}),n=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,morphTargets:!0}),o=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,skinning:!0}),a=new r.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:h,morphTargets:!0,skinning:!0}),i._shadowPass=!0,n._shadowPass=!0,o._shadowPass=!0,a._shadowPass=!0},this.render=function(e,t){this.enabled&&this.update(e,t)},this.update=function(l,c){var u,p,f,d,m,g,v;for(e.clearColor(1,1,1,1),e.disable(e.BLEND),t.setDepthTest(!0),!0===l.autoUpdate&&l.updateMatrixWorld(),c.matrixWorldInverse.getInverse(c.matrixWorld),h.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),s.setFromMatrix(h),t.setRenderTarget(this.renderTarget),t.clear(),u=0,p=(g=l.__webglObjects).length;u<p;u++)m=(f=g[u]).object,f.render=!1,!m.visible||(m instanceof r.Mesh||m instanceof r.ParticleSystem)&&m.frustumCulled&&!s.intersectsObject(m)||(m._modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,m.matrixWorld),f.render=!0);for(u=0,p=g.length;u<p;u++)!(f=g[u]).render||(m=f.object,f=f.buffer,m instanceof r.ParticleSystem&&!m.customDepthMaterial)||((v=m.material instanceof r.MeshFaceMaterial?m.material.materials[0]:m.material)&&t.setMaterialFaces(m.material),d=0<m.geometry.morphTargets.length&&v.morphTargets,v=m instanceof r.SkinnedMesh&&v.skinning,d=m.customDepthMaterial?m.customDepthMaterial:v?d?a:o:d?n:i,f instanceof r.BufferGeometry?t.renderBufferDirect(c,l.__lights,null,d,f,m):t.renderBuffer(c,l.__lights,null,d,f,m));for(u=0,p=(g=l.__webglObjectsImmediate).length;u<p;u++)(m=(f=g[u]).object).visible&&(m._modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,m.matrixWorld),t.renderImmediateObject(c,l.__lights,null,i,m));u=t.getClearColor(),p=t.getClearAlpha(),e.clearColor(u.r,u.g,u.b,p),e.enable(e.BLEND)}},r.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );
1\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}},r.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nuniform vec2 halfViewport;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = ( position + alignment ) * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + ( rotatedPosition / halfViewport ), screenPosition.z, 1.0 );\n} else {\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\nfinalPosition = projectionMatrix * finalPosition;\n}\ngl_Position = finalPosition;\n}",fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}},e.exports=r},89:function(e,t,i){e.exports=i.p+"static/media/world.646e6417.jpg"},90:function(e,t){var i=i||function(){var e,t,i,r,n=[];return{start:function(e){i=setInterval(this.update,1e3/(e||60))},stop:function(){clearInterval(i)},add:function(e){n.push(e)},remove:function(t){-1!==(e=n.indexOf(t))&&n.splice(e,1)},update:function(){for(e=0,t=n.length,r=(new Date).getTime();e<t;)n[e].update(r)?e++:(n.splice(e,1),t--)}}}();i.Tween=function(e){var t={},r={},n={},o=1e3,a=0,s=null,h=i.Easing.Linear.EaseNone,l=null,c=null,u=null;this.to=function(t,i){for(var r in null!==i&&(o=i),t)null!==e[r]&&(n[r]=t[r]);return this},this.start=function(){for(var o in i.add(this),s=(new Date).getTime()+a,n)null!==e[o]&&(t[o]=e[o],r[o]=n[o]-e[o]);return this},this.stop=function(){return i.remove(this),this},this.delay=function(e){return a=e,this},this.easing=function(e){return h=e,this},this.chain=function(e){l=e},this.onUpdate=function(e){return c=e,this},this.onComplete=function(e){return u=e,this},this.update=function(i){var n,a;if(i<s)return!0;for(n in a=h(i=(i=(i-s)/o)>1?1:i),r)e[n]=t[n]+r[n]*a;return null!==c&&c.call(e,a),1!=i||(null!==u&&u.call(e),null!==l&&l.start(),!1)}},i.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}},i.Easing.Linear.EaseNone=function(e){return e},i.Easing.Quadratic.EaseIn=function(e){return e*e},i.Easing.Quadratic.EaseOut=function(e){return-e*(e-2)},i.Easing.Quadratic.EaseInOut=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},i.Easing.Cubic.EaseIn=function(e){return e*e*e},i.Easing.Cubic.EaseOut=function(e){return--e*e*e+1},i.Easing.Cubic.EaseInOut=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},i.Easing.Quartic.EaseIn=function(e){return e*e*e*e},i.Easing.Quartic.EaseOut=function(e){return-(--e*e*e*e-1)},i.Easing.Quartic.EaseInOut=function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},i.Easing.Quintic.EaseIn=function(e){return e*e*e*e*e},i.Easing.Quintic.EaseOut=function(e){return(e-=1)*e*e*e*e+1},i.Easing.Quintic.EaseInOut=function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},i.Easing.Sinusoidal.EaseIn=function(e){return 1-Math.cos(e*Math.PI/2)},i.Easing.Sinusoidal.EaseOut=function(e){return Math.sin(e*Math.PI/2)},i.Easing.Sinusoidal.EaseInOut=function(e){return-.5*(Math.cos(Math.PI*e)-1)},i.Easing.Exponential.EaseIn=function(e){return 0==e?0:Math.pow(2,10*(e-1))},i.Easing.Exponential.EaseOut=function(e){return 1==e?1:1-Math.pow(2,-10*e)},i.Easing.Exponential.EaseInOut=function(e){return 0==e?0:1==e?1:(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))},i.Easing.Circular.EaseIn=function(e){return-(Math.sqrt(1-e*e)-1)},i.Easing.Circular.EaseOut=function(e){return Math.sqrt(1- --e*e)},i.Easing.Circular.EaseInOut=function(e){return(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},i.Easing.Elastic.EaseIn=function(e){var t,i=.1,r=.4;return 0==e?0:1==e?1:(r||(r=.3),!i||i<1?(i=1,t=r/4):t=r/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r))},i.Easing.Elastic.EaseOut=function(e){var t,i=.1,r=.4;return 0==e?0:1==e?1:(r||(r=.3),!i||i<1?(i=1,t=r/4):t=r/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/r)+1)},i.Easing.Elastic.EaseInOut=function(e){var t,i=.1,r=.4;return 0==e?0:1==e?1:(r||(r=.3),!i||i<1?(i=1,t=r/4):t=r/(2*Math.PI)*Math.asin(1/i),(e*=2)<1?-.5*i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r):i*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r)*.5+1)},i.Easing.Back.EaseIn=function(e){return e*e*(2.70158*e-1.70158)},i.Easing.Back.EaseOut=function(e){return(e-=1)*e*(2.70158*e+1.70158)+1},i.Easing.Back.EaseInOut=function(e){return(e*=2)<1?.5*e*e*(3.5949095*e-2.5949095):.5*((e-=2)*e*(3.5949095*e+2.5949095)+2)},i.Easing.Bounce.EaseIn=function(e){return 1-i.Easing.Bounce.EaseOut(1-e)},i.Easing.Bounce.EaseOut=function(e){return(e/=1)<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},i.Easing.Bounce.EaseInOut=function(e){return e<.5?.5*i.Easing.Bounce.EaseIn(2*e):.5*i.Easing.Bounce.EaseOut(2*e-1)+.5},e.exports=i},91:function(e,t,i){},96:function(e,t,i){},97:function(e,t,i){},99:function(e,t,i){}},[[65,1,2]]]);
2//# sourceMappingURL=main.82f5ad8c.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.