17 lines
525 KiB
JavaScript
17 lines
525 KiB
JavaScript
!function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="assets/js",e(0)}([function(t,e,i){t.exports=i(1)},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(){if(c["default"].webgl){var t=document.getElementById("appContainer");new l["default"](t)}else c["default"].addGetWebGLMessage()}var a=i(2),o=n(a),s=i(4),c=n(s),h=i(5),l=n(h);o["default"].isDev=!0,window.onload=r},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var r=i(3),a=n(r);e["default"]={isDev:!1,isLoaded:!1,isTweening:!1,isRotating:!0,isMouseMoving:!1,isMouseOver:!1,maxAnisotropy:1,dpr:1,easing:a["default"].Easing.Quadratic.InOut,duration:500,model:{path:"/assets/models/teapot-claraio.json",scale:20},texture:{path:"/assets/textures/",imageFiles:[{name:"UV",image:"UV_Grid_Sm.jpg"}]},mesh:{enableHelper:!1,wireframe:!1,translucent:!1,material:{color:16777215,emissive:16777215}},fog:{color:16777215,near:8e-4},camera:{fov:40,near:2,far:1e3,aspect:1,posX:0,posY:30,posZ:40},controls:{autoRotate:!0,autoRotateSpeed:-.5,rotateSpeed:.5,zoomSpeed:.8,minDistance:200,maxDistance:600,minPolarAngle:Math.PI/5,maxPolarAngle:Math.PI/2,minAzimuthAngle:-(1/0),maxAzimuthAngle:1/0,enableDamping:!0,dampingFactor:.5,enableZoom:!0,target:{x:0,y:0,z:0}},ambientLight:{enabled:!1,color:1315860},directionalLight:{enabled:!0,color:15790320,intensity:.4,x:-75,y:280,z:150},shadow:{enabled:!0,helperEnabled:!0,bias:-25e-5,mapWidth:1024,mapHeight:1024,near:200,far:400,top:150,right:150,bottom:-150,left:-150},pointLight:{enabled:!0,color:16777215,intensity:.34,distance:115,x:0,y:0,z:0},hemiLight:{enabled:!0,color:13158600,groundColor:16777215,intensity:.3,x:-275,y:145,z:0}}},function(t,e,i){var n,r;"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};!function(){if("performance"in window==!1&&(window.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in window.performance==!1){var t=window.performance.timing&&window.performance.timing.navigationStart?window.performance.timing.navigationStart:Date.now();window.performance.now=function(){return Date.now()-t}}}();var a=a||function(){var t=[];return{getAll:function(){return t},removeAll:function(){t=[]},add:function(e){t.push(e)},remove:function(e){var i=t.indexOf(e);i!==-1&&t.splice(i,1)},update:function(e){if(0===t.length)return!1;var i=0;for(e=void 0!==e?e:window.performance.now();i<t.length;)t[i].update(e)?i++:t.splice(i,1);return!0}}}();a.Tween=function(t){var e=t,i={},n={},r={},o=1e3,s=0,c=!1,h=!1,l=!1,u=0,d=null,p=a.Easing.Linear.None,f=a.Interpolation.Linear,m=[],g=null,v=!1,y=null,x=null,b=null;for(var _ in t)i[_]=parseFloat(t[_],10);this.to=function(t,e){return void 0!==e&&(o=e),n=t,this},this.start=function(t){a.add(this),h=!0,v=!1,d=void 0!==t?t:window.performance.now(),d+=u;for(var o in n){if(n[o]instanceof Array){if(0===n[o].length)continue;n[o]=[e[o]].concat(n[o])}i[o]=e[o],i[o]instanceof Array==!1&&(i[o]*=1),r[o]=i[o]||0}return this},this.stop=function(){return h?(a.remove(this),h=!1,null!==b&&b.call(e),this.stopChainedTweens(),this):this},this.stopChainedTweens=function(){for(var t=0,e=m.length;t<e;t++)m[t].stop()},this.delay=function(t){return u=t,this},this.repeat=function(t){return s=t,this},this.yoyo=function(t){return c=t,this},this.easing=function(t){return p=t,this},this.interpolation=function(t){return f=t,this},this.chain=function(){return m=arguments,this},this.onStart=function(t){return g=t,this},this.onUpdate=function(t){return y=t,this},this.onComplete=function(t){return x=t,this},this.onStop=function(t){return b=t,this},this.update=function(t){var a;if(t<d)return!0;v===!1&&(null!==g&&g.call(e),v=!0);var h=(t-d)/o;h=h>1?1:h;var b=p(h);for(a in n){var _=i[a]||0,M=n[a];M instanceof Array?e[a]=f(M,b):("string"==typeof M&&(M=_+parseFloat(M,10)),"number"==typeof M&&(e[a]=_+(M-_)*b))}if(null!==y&&y.call(e,b),1===h){if(s>0){isFinite(s)&&s--;for(a in r){if("string"==typeof n[a]&&(r[a]=r[a]+parseFloat(n[a],10)),c){var w=r[a];r[a]=n[a],n[a]=w}i[a]=r[a]}return c&&(l=!l),d=t+u,!0}null!==x&&x.call(e);for(var S=0,T=m.length;S<T;S++)m[S].start(t);return!1}return!0}},a.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),-(i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)))},Out:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},InOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)):i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-a.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*a.Easing.Bounce.In(2*t):.5*a.Easing.Bounce.Out(2*t-1)+.5}}},a.Interpolation={Linear:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=a.Interpolation.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){var i,n=0,r=t.length-1,o=Math.pow,s=a.Interpolation.Utils.Bernstein;for(i=0;i<=r;i++)n+=o(1-e,r-i)*o(e,i)*t[i]*s(r,i);return n},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=a.Interpolation.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=a.Interpolation.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:function(){var t=[1];return function(e){var i,n=1;if(t[e])return t[e];for(i=e;i>1;i--)n*=i;return t[e]=n,n}}(),CatmullRom:function(t,e,i,n,r){var a=.5*(i-t),o=.5*(n-e),s=r*r,c=r*s;return(2*e-2*i+a+o)*c+(-3*e+3*i-2*a-o)*s+a*r+e}}},function(i){n=[],r=function(){return a}.apply(e,n),!(void 0!==r&&(t.exports=r))}(void 0)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(e){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000000">here</a>.'].join("\n")),t},addGetWebGLMessage:function(t){var e,i,n;t=t||{},e=void 0!==t.parent?t.parent:document.body,i=void 0!==t.id?t.id:"oldie",n=this.getWebGLErrorMessage(),n.id=i,e.appendChild(n)}}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(3),h=n(c),l=i(7),u=n(l),d=i(8),p=n(d),f=i(9),m=n(f),g=i(10),v=n(g),y=i(12),x=n(y),b=i(13),_=n(b),M=i(19),w=n(M),S=i(22),T=n(S),L=i(25),A=n(L),C=i(2),E=n(C),P=void 0,R=void 0,D=void 0,I=void 0,O=function(){function t(e){var i=this;r(this,t),this.container=e,this.clock=new s["default"].Clock,this.scene=new s["default"].Scene,this.scene.fog=new s["default"].FogExp2(E["default"].fog.color,E["default"].fog.near),window.devicePixelRatio&&(E["default"].dpr=window.devicePixelRatio),this.renderer=new u["default"](e,this.scene),this.camera=new p["default"](this.renderer.threeRenderer),this.controls=new v["default"](this.camera.threeCamera,this.container),this.light=new m["default"](this.scene);for(var n=["ambient","directional","point","hemi"],a=0;a<n.length;a++)this.light.place(n[a]);this.geometry=new x["default"](this.scene),this.geometry.make("plane")(100,100,10,10),this.geometry.place([0,-20,0],[Math.PI/2,0,0]),E["default"].isDev&&(R=new BrowserStats,D=new glStats,I=new threeStats(this.renderer.threeRenderer),P=new rStats({CSSPath:"/assets/css/",userTimingAPI:!0,values:{frame:{caption:"Total frame time (ms)",over:16,average:!0,avgMs:100},fps:{caption:"Framerate (FPS)",below:30},calls:{caption:"Calls (three.js)",over:3e3},raf:{caption:"Time since last rAF (ms)",average:!0,avgMs:100},rstats:{caption:"rStats update (ms)",average:!0,avgMs:100},texture:{caption:"GenTex",average:!0,avgMs:100}},groups:[{caption:"Framerate",values:["fps","raf"]},{caption:"Frame Budget",values:["frame","texture","setup","render"]}],fractions:[{base:"frame",steps:["texture","setup","render"]}],plugins:[R,I,D]})),this.texture=new _["default"],this.texture.load().then(function(){i.manager=new s["default"].LoadingManager,i.model=new w["default"](i.scene,i.manager,i.texture.textures),i.model.load(),i.manager.onProgress=function(t,e,i){},i.manager.onLoad=function(){new T["default"](i.renderer.threeRenderer,i.scene,i.camera.threeCamera,i.controls.threeControls),E["default"].isDev&&new A["default"](i,i.model.obj),E["default"].isLoaded=!0}}),this.render()}return a(t,[{key:"render",value:function(){this.clock.getDelta();E["default"].isDev&&(P("frame").start(),D.start(),P("rAF").tick(),P("FPS").frame(),P("render").start()),this.renderer.threeRenderer.clear(),this.renderer.render(this.scene,this.camera.threeCamera),E["default"].isDev&&(P("render").end(),P("frame").end(),P("rStats").start(),P().update(),P("rStats").end()),h["default"].update(),this.controls.threeControls.update(),requestAnimationFrame(this.render.bind(this))}}]),t}();e["default"]=O},function(t,e,i){var n,r,a={REVISION:"79"};n=a,r="function"==typeof n?n.call(e,i,e,t):n,!(void 0!==r&&(t.exports=r)),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){"use strict";if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}}(),Object.assign(a,{MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2},CullFaceNone:0,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,FrontFaceDirectionCW:0,FrontFaceDirectionCCW:1,BasicShadowMap:0,PCFShadowMap:1,PCFSoftShadowMap:2,FrontSide:0,BackSide:1,DoubleSide:2,FlatShading:1,SmoothShading:2,NoColors:0,FaceColors:1,VertexColors:2,NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5,AddEquation:100,SubtractEquation:101,ReverseSubtractEquation:102,MinEquation:103,MaxEquation:104,ZeroFactor:200,OneFactor:201,SrcColorFactor:202,OneMinusSrcColorFactor:203,SrcAlphaFactor:204,OneMinusSrcAlphaFactor:205,DstAlphaFactor:206,OneMinusDstAlphaFactor:207,DstColorFactor:208,OneMinusDstColorFactor:209,SrcAlphaSaturateFactor:210,NeverDepth:0,AlwaysDepth:1,LessDepth:2,LessEqualDepth:3,EqualDepth:4,GreaterEqualDepth:5,GreaterDepth:6,NotEqualDepth:7,MultiplyOperation:0,MixOperation:1,AddOperation:2,NoToneMapping:0,LinearToneMapping:1,ReinhardToneMapping:2,Uncharted2ToneMapping:3,CineonToneMapping:4,UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307,RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002,NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008,UnsignedByteType:1009,ByteType:1010,ShortType:1011,UnsignedShortType:1012,IntType:1013,UnsignedIntType:1014,FloatType:1015,HalfFloatType:1025,UnsignedShort4444Type:1016,UnsignedShort5551Type:1017,UnsignedShort565Type:1018,AlphaFormat:1019,RGBFormat:1020,RGBAFormat:1021,LuminanceFormat:1022,LuminanceAlphaFormat:1023,RGBEFormat:a.RGBAFormat,DepthFormat:1026,RGB_S3TC_DXT1_Format:2001,RGBA_S3TC_DXT1_Format:2002,RGBA_S3TC_DXT3_Format:2003,RGBA_S3TC_DXT5_Format:2004,RGB_PVRTC_4BPPV1_Format:2100,RGB_PVRTC_2BPPV1_Format:2101,RGBA_PVRTC_4BPPV1_Format:2102,RGBA_PVRTC_2BPPV1_Format:2103,RGB_ETC1_Format:2151,LoopOnce:2200,LoopRepeat:2201,LoopPingPong:2202,InterpolateDiscrete:2300,InterpolateLinear:2301,InterpolateSmooth:2302,ZeroCurvatureEnding:2400,ZeroSlopeEnding:2401,WrapAroundEnding:2402,TrianglesDrawMode:0,TriangleStripDrawMode:1,TriangleFanDrawMode:2,LinearEncoding:3e3,sRGBEncoding:3001,GammaEncoding:3007,RGBEEncoding:3002,LogLuvEncoding:3003,RGBM7Encoding:3004,RGBM16Encoding:3005,RGBDEncoding:3006,BasicDepthPacking:3200,RGBADepthPacking:3201}),a.Color=function(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)},a.Color.prototype={constructor:a.Color,r:1,g:1,b:1,set:function(t){return t instanceof a.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=a.Math.euclideanModulo(e,1),i=a.Math.clamp(i,0,1),n=a.Math.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,o=2*n-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(t){void 0!==t&&parseFloat(t)<1}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(s,c,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=i[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(t&&t.length>0){var l=a.ColorKeywords[t];void 0!==l&&this.setHex(l)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,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(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),h=(c+s)/2;if(c===s)e=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case r:e=(a-o)/l+(a<o?6:0);break;case a:e=(o-r)/l+2;break;case o:e=(r-a)/l+4}e/=6}return n.h=e,n.s=i,n.l=h,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},a.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},a.Quaternion=function(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1},a.Quaternion.prototype={constructor:a.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(t instanceof a.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i=Math.cos(t._x/2),n=Math.cos(t._y/2),r=Math.cos(t._z/2),o=Math.sin(t._x/2),s=Math.sin(t._y/2),c=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*n*r+i*s*c,this._y=i*s*r-o*n*c,this._z=i*n*c+o*s*r,this._w=i*n*r-o*s*c):"YXZ"===h?(this._x=o*n*r+i*s*c,this._y=i*s*r-o*n*c,this._z=i*n*c-o*s*r,this._w=i*n*r+o*s*c):"ZXY"===h?(this._x=o*n*r-i*s*c,this._y=i*s*r+o*n*c,this._z=i*n*c+o*s*r,this._w=i*n*r-o*s*c):"ZYX"===h?(this._x=o*n*r-i*s*c,this._y=i*s*r+o*n*c,this._z=i*n*c-o*s*r,this._w=i*n*r+o*s*c):"YZX"===h?(this._x=o*n*r+i*s*c,this._y=i*s*r+o*n*c,this._z=i*n*c-o*s*r,this._w=i*n*r-o*s*c):"XZY"===h&&(this._x=o*n*r-i*s*c,this._y=i*s*r-o*n*c,this._z=i*n*c+o*s*r,this._w=i*n*r+o*s*c),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],d=n+s+u;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+h)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new a.Vector3),e=n.dot(r)+1,e<i?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=n*h+this._y*l,this._z=r*h+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(a.Quaternion,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==d||h!==p){var m=1-o,g=s*u+c*d+h*p+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*v;if(s=s*m+u*_,c=c*m+d*_,h=h*m+p*_,l=l*m+f*_,m===1-o){var M=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=M,c*=M,h*=M,l*=M}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),a.Vector2=function(t,e){this.x=t||0,this.y=e||0},a.Vector2.prototype={constructor:a.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new a.Vector2,e=new a.Vector2),t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function o(){var o=Math.atan2(this.y,this.x);return o<0&&(o+=2*Math.PI),o},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}},a.Vector3=function(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0},a.Vector3.prototype={constructor:a.Vector3,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){
|
|
case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return e instanceof a.Euler==!1,void 0===t&&(t=new a.Quaternion),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new a.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new a.Vector3,e=new a.Vector3),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new a.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new a.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(a.Math.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},a.Vector4=function(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1},a.Vector4.prototype={constructor:a.Vector4,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=.01,o=.1,s=t.elements,c=s[0],h=s[4],l=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(h-u)<a&&Math.abs(l-f)<a&&Math.abs(p-m)<a){if(Math.abs(h+u)<o&&Math.abs(l+f)<o&&Math.abs(p+m)<o&&Math.abs(c+d+g-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var v=(c+1)/2,y=(d+1)/2,x=(g+1)/2,b=(h+u)/4,_=(l+f)/4,M=(p+m)/4;return v>y&&v>x?v<a?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(v),n=b/i,r=_/i):y>x?y<a?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=b/n,r=M/n):x<a?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(x),i=_/r,n=M/r),this.set(i,n,r,e),this}var w=Math.sqrt((m-p)*(m-p)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(w)<.001&&(w=1),this.x=(m-p)/w,this.y=(l-f)/w,this.z=(u-h)/w,this.w=Math.acos((c+d+g-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new a.Vector4,e=new a.Vector4),t.set(i,i,i,i),e.set(n,n,n,n),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},a.Euler=function(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||a.Euler.DefaultOrder},a.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],a.Euler.DefaultOrder="XYZ",a.Euler.prototype={constructor:a.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=a.Math.clamp,r=t.elements,o=r[0],s=r[4],c=r[8],h=r[1],l=r[5],u=r[9],d=r[2],p=r[6],f=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-d,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,o))):"ZYX"===e?(this._y=Math.asin(-n(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===e?(this._z=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===e&&(this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-u,f),this._y=0)),this._order=e,i!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,i,n){return void 0===t&&(t=new a.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new a.Quaternion;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new a.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},a.Line3=function(t,e){this.start=void 0!==t?t:new a.Vector3,this.end=void 0!==e?e:new a.Vector3},a.Line3.prototype={constructor:a.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new a.Vector3;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new a.Vector3;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new a.Vector3;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new a.Vector3,e=new a.Vector3;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),s=o/r;return n&&(s=a.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new a.Vector3;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},a.Box2=function(t,e){this.min=void 0!==t?t:new a.Vector2((+(1/0)),(+(1/0))),this.max=void 0!==e?e:new a.Vector2((-(1/0)),(-(1/0)))},a.Box2.prototype={constructor:a.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new a.Vector2;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=+(1/0),this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){var e=t||new a.Vector2;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new a.Vector2;return e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var i=e||new a.Vector2;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){var i=e||new a.Vector2;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new a.Vector2;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},a.Box3=function(t,e){this.min=void 0!==t?t:new a.Vector3((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==e?e:new a.Vector3((-(1/0)),(-(1/0)),(-(1/0)))},a.Box3.prototype={constructor:a.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),i=+(1/0),n=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}this.min.set(e,i,n),this.max.set(r,a,o)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new a.Vector3;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(){var t=new a.Vector3;return function(e){var i=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var n=e.geometry;if(void 0!==n)if(n instanceof a.Geometry)for(var r=n.vertices,o=0,s=r.length;o<s;o++)t.copy(r[o]),t.applyMatrix4(e.matrixWorld),i.expandByPoint(t);else if(n instanceof a.BufferGeometry){var c=n.attributes.position;if(void 0!==c){var h,l,u;c instanceof a.InterleavedBufferAttribute?(h=c.data.array,l=c.offset,u=c.data.stride):(h=c.array,l=0,u=3);for(var o=l,s=h.length;o<s;o+=u)t.fromArray(h,o),t.applyMatrix4(e.matrixWorld),i.expandByPoint(t)}}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+(1/0),this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){var e=t||new a.Vector3;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new a.Vector3;return e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new a.Vector3;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new a.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new a.Vector3;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new a.Vector3;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new a.Vector3;return function(e){var i=e||new a.Sphere;return i.center=this.center(),i.radius=.5*this.size(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},a.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0},a.Matrix3.prototype={constructor:a.Matrix3,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new a.Vector3),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r<n;r+=3,o+=3)t.fromArray(e,o),t.applyMatrix3(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,i,n){void 0===t&&(t=new a.Vector3),void 0===i&&(i=0),void 0===n&&(n=e.length/e.itemSize);for(var r=0,o=i;r<n;r++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t instanceof a.Matrix4;var i=t.elements,n=this.elements,r=i[0],o=i[1],s=i[2],c=i[3],h=i[4],l=i[5],u=i[6],d=i[7],p=i[8],f=p*h-l*d,m=l*u-p*c,g=d*c-h*u,v=r*f+o*m+s*g;if(0===v){var y="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(y);return this.identity()}var x=1/v;return n[0]=f*x,n[1]=(s*d-p*o)*x,n[2]=(l*o-s*h)*x,n[3]=m*x,n[4]=(p*r-s*u)*x,n[5]=(s*c-l*r)*x,n[6]=g*x,n[7]=(o*u-d*r)*x,n[8]=(h*r-o*c)*x,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){return this.toArray(t,e)},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}},a.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0},a.Matrix4.prototype={constructor:a.Matrix4,set:function(t,e,i,n,r,a,o,s,c,h,l,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new a.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new a.Vector3);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),s=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*s,i[9]=n[9]*s,i[10]=n[10]*s,this}}(),makeRotationFromEuler:function(t){t instanceof a.Euler==!1;var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),s=Math.sin(i),c=Math.cos(n),h=Math.sin(n),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var d=o*l,p=o*u,f=s*l,m=s*u;e[0]=c*l,e[4]=-c*u,e[8]=h,e[1]=p+f*h,e[5]=d-m*h,e[9]=-s*c,e[2]=m-d*h,e[6]=f+p*h,e[10]=o*c}else if("YXZ"===t.order){var g=c*l,v=c*u,y=h*l,x=h*u;e[0]=g+x*s,e[4]=y*s-v,e[8]=o*h,e[1]=o*u,e[5]=o*l,e[9]=-s,e[2]=v*s-y,e[6]=x+g*s,e[10]=o*c}else if("ZXY"===t.order){var g=c*l,v=c*u,y=h*l,x=h*u;e[0]=g-x*s,e[4]=-o*u,e[8]=y+v*s,e[1]=v+y*s,e[5]=o*l,e[9]=x-g*s,e[2]=-o*h,e[6]=s,e[10]=o*c}else if("ZYX"===t.order){var d=o*l,p=o*u,f=s*l,m=s*u;e[0]=c*l,e[4]=f*h-p,e[8]=d*h+m,e[1]=c*u,e[5]=m*h+d,e[9]=p*h-f,e[2]=-h,e[6]=s*c,e[10]=o*c}else if("YZX"===t.order){var b=o*c,_=o*h,M=s*c,w=s*h;e[0]=c*l,e[4]=w-b*u,e[8]=M*u+_,e[1]=u,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=_*u+M,e[10]=b-w*u}else if("XZY"===t.order){var b=o*c,_=o*h,M=s*c,w=s*h;e[0]=c*l,e[4]=-u,e[8]=h*l,e[1]=b*u+w,e[5]=o*l,e[9]=_*u-M,e[2]=M*u-_,e[6]=s*l,e[10]=w*u+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,a=t.w,o=i+i,s=n+n,c=r+r,h=i*o,l=i*s,u=i*c,d=n*s,p=n*c,f=r*c,m=a*o,g=a*s,v=a*c;return e[0]=1-(d+f),e[4]=l-v,e[8]=u+g,e[1]=l+v,e[5]=1-(h+f),e[9]=p-m,e[2]=u-g,e[6]=p+m,e[10]=1-(h+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,o){void 0===t&&(t=new a.Vector3,e=new a.Vector3,i=new a.Vector3);var s=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(o,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(o,i).normalize()),e.crossVectors(i,t),s[0]=t.x,s[4]=e.x,s[8]=i.x,s[1]=t.y,s[5]=e.y,s[9]=i.y,s[2]=t.z,s[6]=e.z,s[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],_=n[0],M=n[4],w=n[8],S=n[12],T=n[1],L=n[5],A=n[9],C=n[13],E=n[2],P=n[6],R=n[10],D=n[14],I=n[3],O=n[7],B=n[11],U=n[15];return r[0]=a*_+o*T+s*E+c*I,r[4]=a*M+o*L+s*P+c*O,r[8]=a*w+o*A+s*R+c*B,r[12]=a*S+o*C+s*D+c*U,r[1]=h*_+l*T+u*E+d*I,r[5]=h*M+l*L+u*P+d*O,r[9]=h*w+l*A+u*R+d*B,r[13]=h*S+l*C+u*D+d*U,r[2]=p*_+f*T+m*E+g*I,r[6]=p*M+f*L+m*P+g*O,r[10]=p*w+f*A+m*R+g*B,r[14]=p*S+f*C+m*D+g*U,r[3]=v*_+y*T+x*E+b*I,r[7]=v*M+y*L+x*P+b*O,r[11]=v*w+y*A+x*R+b*B,r[15]=v*S+y*C+x*D+b*U,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new a.Vector3),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r<n;r+=3,o+=3)t.fromArray(e,o),t.applyMatrix4(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,i,n){void 0===t&&(t=new a.Vector3),void 0===i&&(i=0),void 0===n&&(n=e.length/e.itemSize);for(var r=0,o=i;r<n;r++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],d=t[14],p=t[3],f=t[7],m=t[11],g=t[15];return p*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*d-i*s*d)+f*(+e*s*d-e*c*u+r*a*u-n*a*d+n*c*h-r*s*h)+m*(+e*c*l-e*o*d-r*a*l+i*a*d+r*o*h-i*c*h)+g*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){return this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new a.Vector3),t.setFromMatrixColumn(this,3)}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],b=p*y*u-v*f*u+v*l*m-h*y*m-p*l*x+h*f*x,_=g*f*u-d*y*u-g*l*m+c*y*m+d*l*x-c*f*x,M=d*v*u-g*p*u+g*h*m-c*v*m-d*h*x+c*p*x,w=g*p*l-d*v*l-g*h*f+c*v*f+d*h*y-c*p*y,S=r*b+a*_+o*M+s*w;
|
|
if(0===S){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(T);return this.identity()}var L=1/S;return i[0]=b*L,i[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*L,i[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*L,i[3]=(p*l*s-h*f*s-p*o*u+a*f*u+h*o*m-a*l*m)*L,i[4]=_*L,i[5]=(d*y*s-g*f*s+g*o*m-r*y*m-d*o*x+r*f*x)*L,i[6]=(g*l*s-c*y*s-g*o*u+r*y*u+c*o*x-r*l*x)*L,i[7]=(c*f*s-d*l*s+d*o*u-r*f*u-c*o*m+r*l*m)*L,i[8]=M*L,i[9]=(g*p*s-d*v*s-g*a*m+r*v*m+d*a*x-r*p*x)*L,i[10]=(c*v*s-g*h*s+g*a*u-r*v*u-c*a*x+r*h*x)*L,i[11]=(d*h*s-c*p*s-d*a*u+r*p*u+c*a*m-r*h*m)*L,i[12]=w*L,i[13]=(d*v*o-g*p*o+g*a*f-r*v*f-d*a*y+r*p*y)*L,i[14]=(g*h*o-c*v*o-g*a*l+r*v*l+c*a*y-r*h*y)*L,i[15]=(c*p*o-d*h*o+d*a*l-r*p*l-c*a*f+r*h*f)*L,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},compose:function(t,e,i){return this.makeRotationFromQuaternion(e),this.scale(i),this.setPosition(t),this},decompose:function(){var t,e;return function(i,n,r){void 0===t&&(t=new a.Vector3,e=new a.Matrix4);var o=this.elements,s=t.set(o[0],o[1],o[2]).length(),c=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length(),l=this.determinant();l<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],e.elements.set(this.elements);var u=1/s,d=1/c,p=1/h;return e.elements[0]*=u,e.elements[1]*=u,e.elements[2]*=u,e.elements[4]*=d,e.elements[5]*=d,e.elements[6]*=d,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,n.setFromRotationMatrix(e),r.x=s,r.y=c,r.z=h,this}}(),makeFrustum:function(t,e,i,n,r,a){var o=this.elements,s=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),l=(n+i)/(n-i),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,i,n){var r=i*Math.tan(a.Math.DEG2RAD*t*.5),o=-r,s=o*e,c=r*e;return this.makeFrustum(s,c,o,r,i,n)},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,d=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},a.Ray=function(t,e){this.origin=void 0!==t?t:new a.Vector3,this.direction=void 0!==e?e:new a.Vector3},a.Ray.prototype={constructor:a.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){var i=e||new a.Vector3;return i.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new a.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var i=e||new a.Vector3;i.subVectors(t,this.origin);var n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new a.Vector3;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Vector3;return function(n,r,a,o){t.copy(n).add(r).multiplyScalar(.5),e.copy(r).sub(n).normalize(),i.copy(this.origin).sub(t);var s,c,h,l,u=.5*n.distanceTo(r),d=-this.direction.dot(e),p=i.dot(this.direction),f=-i.dot(e),m=i.lengthSq(),g=Math.abs(1-d*d);if(g>0)if(s=d*f-p,c=d*p-f,l=u*g,s>=0)if(c>=-l)if(c<=l){var v=1/g;s*=v,c*=v,h=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-d*u+p)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(d*u+p)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=d>0?-u:u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),h}}(),intersectSphere:function(){var t=new a.Vector3;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||r>n?null:((r>i||i!==i)&&(i=r),(a<n||n!==n)&&(n=a),l>=0?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),i>s||o>n?null:((o>i||i!==i)&&(i=o),(s<n||n!==n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))},intersectsBox:function(){var t=new a.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Vector3,n=new a.Vector3;return function(r,a,o,s,c){e.subVectors(a,r),i.subVectors(o,r),n.crossVectors(e,i);var h,l=this.direction.dot(n);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}t.subVectors(this.origin,r);var u=h*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var d=h*this.direction.dot(e.cross(t));if(d<0)return null;if(u+d>l)return null;var p=-h*t.dot(n);return p<0?null:this.at(p/l,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},a.Sphere=function(t,e){this.center=void 0!==t?t:new a.Vector3,this.radius=void 0!==e?e:0},a.Sphere.prototype={constructor:a.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new a.Box3;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).center(n);for(var r=0,a=0,o=e.length;a<o;a++)r=Math.max(r,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t),n=e||new a.Vector3;return n.copy(t),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new a.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},a.Frustum=function(t,e,i,n,r,o){this.planes=[void 0!==t?t:new a.Plane,void 0!==e?e:new a.Plane,void 0!==i?i:new a.Plane,void 0!==n?n:new a.Plane,void 0!==r?r:new a.Plane,void 0!==o?o:new a.Plane]},a.Frustum.prototype={constructor:a.Frustum,set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+d,y+g).normalize(),e[3].setComponents(o-r,l-c,f-d,y-g).normalize(),e[4].setComponents(o-a,l-h,f-p,y-v).normalize(),e[5].setComponents(o+a,l+h,f+p,y+v).normalize(),this},intersectsObject:function(){var t=new a.Sphere;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new a.Sphere;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var a=e[r].distanceToPoint(i);if(a<n)return!1}return!0},intersectsBox:function(){var t=new a.Vector3,e=new a.Vector3;return function(i){for(var n=this.planes,r=0;r<6;r++){var a=n[r];t.x=a.normal.x>0?i.min.x:i.max.x,e.x=a.normal.x>0?i.max.x:i.min.x,t.y=a.normal.y>0?i.min.y:i.max.y,e.y=a.normal.y>0?i.max.y:i.min.y,t.z=a.normal.z>0?i.min.z:i.max.z,e.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}},a.Plane=function(t,e){this.normal=void 0!==t?t:new a.Vector3(1,0,0),this.constant=void 0!==e?e:0},a.Plane.prototype={constructor:a.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new a.Vector3,e=new a.Vector3;return function(i,n,r){var a=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var i=this.distanceToPoint(t),n=e||new a.Vector3;return n.copy(this.normal).multiplyScalar(i)},intersectLine:function(){var t=new a.Vector3;return function(e,i){var n=i||new a.Vector3,r=e.delta(t),o=this.normal.dot(r);if(0!==o){var s=-(e.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return n.copy(r).multiplyScalar(s).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new a.Vector3;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new a.Vector3,e=new a.Matrix3;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),a=n||e.getNormalMatrix(i),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},a.Spherical=function(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this},a.Spherical.prototype={constructor:a.Spherical,set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius.copy(t.radius),this.phi.copy(t.phi),this.theta.copy(t.theta),this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(a.Math.clamp(t.y/this.radius,-1,1))),this}},a.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?i[r]="-":14===r?i[r]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*a.Math.DEG2RAD},radToDeg:function(t){return t*a.Math.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}},a.Spline=function(t){function e(t,e,i,n,r,a,o){var s=.5*(i-t),c=.5*(n-e);return(2*(e-i)+s+c)*o+(-3*(e-i)-2*s-c)*a+s*r+e}this.points=t;var i,n,r,o,s,c,h,l,u,d=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return i=(this.points.length-1)*t,n=Math.floor(i),r=i-n,d[0]=0===n?n:n-1,d[1]=n,d[2]=n>this.points.length-2?this.points.length-1:n+1,d[3]=n>this.points.length-3?this.points.length-1:n+2,c=this.points[d[0]],h=this.points[d[1]],l=this.points[d[2]],u=this.points[d[3]],o=r*r,s=r*o,p.x=e(c.x,h.x,l.x,u.x,r,o,s),p.y=e(c.y,h.y,l.y,u.y,r,o,s),p.z=e(c.z,h.z,l.z,u.z,r,o,s),p},this.getControlPointsArray=function(){var t,e,i=this.points.length,n=[];for(t=0;t<i;t++)e=this.points[t],n[t]=[e.x,e.y,e.z];return n},this.getLength=function(t){var e,i,n,r,o=0,s=0,c=0,h=new a.Vector3,l=new a.Vector3,u=[],d=0;for(u[0]=0,t||(t=100),n=this.points.length*t,h.copy(this.points[0]),e=1;e<n;e++)i=e/n,r=this.getPoint(i),l.copy(r),d+=l.distanceTo(h),h.copy(r),o=(this.points.length-1)*i,s=Math.floor(o),s!==c&&(u[s]=d,c=s);return u[u.length]=d,{chunks:u,total:d}},this.reparametrizeByArcLength=function(t){var e,i,n,r,o,s,c,h,l=[],u=new a.Vector3,d=this.getLength();for(l.push(u.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(s=d.chunks[e]-d.chunks[e-1],c=Math.ceil(t*s/d.total),r=(e-1)/(this.points.length-1),o=e/(this.points.length-1),i=1;i<c-1;i++)n=r+i*(1/c)*(o-r),h=this.getPoint(n),l.push(u.copy(h).clone());l.push(u.copy(this.points[e]).clone())}this.points=l}},a.Triangle=function(t,e,i){this.a=void 0!==t?t:new a.Vector3,this.b=void 0!==e?e:new a.Vector3,this.c=void 0!==i?i:new a.Vector3},a.Triangle.normal=function(){var t=new a.Vector3;return function(e,i,n,r){var o=r||new a.Vector3;o.subVectors(n,i),t.subVectors(e,i),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),a.Triangle.barycoordFromPoint=function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Vector3;return function(n,r,o,s,c){t.subVectors(s,r),e.subVectors(o,r),i.subVectors(n,r);var h=t.dot(t),l=t.dot(e),u=t.dot(i),d=e.dot(e),p=e.dot(i),f=h*d-l*l,m=c||new a.Vector3;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(d*u-l*p)*g,y=(h*p-l*u)*g;return m.set(1-v-y,y,v)}}(),a.Triangle.containsPoint=function(){var t=new a.Vector3;return function(e,i,n,r){var o=a.Triangle.barycoordFromPoint(e,i,n,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),a.Triangle.prototype={constructor:a.Triangle,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new a.Vector3,e=new a.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new a.Vector3;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return a.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new a.Plane;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return a.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return a.Triangle.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,o){void 0===t&&(t=new a.Plane,e=[new a.Line3,new a.Line3,new a.Line3],i=new a.Vector3,n=new a.Vector3);var s=o||new a.Vector3,c=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)s.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var h=0;h<e.length;h++){e[h].closestPointToPoint(i,!0,n);var l=i.distanceToSquared(n);l<c&&(c=l,s.copy(n))}}return s}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},a.Interpolant=function(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i},a.Interpolant.prototype={constructor:a.Interpolant,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}{if(t>=r)break t;var s=e[1];t<s&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){var c=i+a>>>1;t<e[c]?a=c:i=c+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(t,e,i,n){throw new Error("call to abstract method")},intervalChanged_:function(t,e,i){}},Object.assign(a.Interpolant.prototype,{beforeStart_:a.Interpolant.prototype.copySampleValue_,afterEnd_:a.Interpolant.prototype.copySampleValue_}),a.CubicInterpolant=function(t,e,i,n){a.Interpolant.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0},a.CubicInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.CubicInterpolant,DefaultSettings_:{endingStart:a.ZeroCurvatureEnding,endingEnd:a.ZeroCurvatureEnding},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,o=t+1,s=n[r],c=n[o];if(void 0===s)switch(this.getSettings_().endingStart){case a.ZeroSlopeEnding:r=t,s=2*e-i;break;case a.WrapAroundEnding:r=n.length-2,s=e+n[r]-n[r+1];break;default:r=t,s=i}if(void 0===c)switch(this.getSettings_().endingEnd){case a.ZeroSlopeEnding:o=t,c=2*i-e;break;case a.WrapAroundEnding:o=1,c=i+n[1]-n[0];break;default:o=t-1,c=e}var h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-s),this._weightNext=h/(c-i),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)r[b]=g*a[h+b]+v*a[c+b]+y*a[s+b]+x*a[l+b];return r}}),a.DiscreteInterpolant=function(t,e,i,n){a.Interpolant.call(this,t,e,i,n)},a.DiscreteInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.DiscreteInterpolant,interpolate_:function(t,e,i,n){return this.copySampleValue_(t-1)}}),a.LinearInterpolant=function(t,e,i,n){a.Interpolant.call(this,t,e,i,n)},a.LinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.LinearInterpolant,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),a.QuaternionLinearInterpolant=function(t,e,i,n){a.Interpolant.call(this,t,e,i,n)},a.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.QuaternionLinearInterpolant,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s,h=(i-e)/(n-e),l=c+s;c!==l;c+=4)a.Quaternion.slerpFlat(r,0,o,c-s,o,c,h);return r}}),a.Clock=function(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},a.Clock.prototype={constructor:a.Clock,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},a.EventDispatcher=function(){},Object.assign(a.EventDispatcher.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&i[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners,n=i[t];if(void 0!==n){var r=n.indexOf(e);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,i=e[t.type];if(void 0!==i){t.target=this;var n=[],r=0,a=i.length;for(r=0;r<a;r++)n[r]=i[r];for(r=0;r<a;r++)n[r].call(this,t)}}}}),a.Layers=function(){this.mask=1},a.Layers.prototype={constructor:a.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function i(t,e,n,r){if(t.visible!==!1&&(t.raycast(e,n),r===!0))for(var a=t.children,o=0,s=a.length;o<s;o++)i(a[o],e,n,!0)}t.Raycaster=function(e,i,n,r){this.ray=new t.Ray(e,i),this.near=n||0,this.far=r||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return this.Points}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,i){i instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(i).sub(this.ray.origin).normalize()):i instanceof t.OrthographicCamera&&(this.ray.origin.set(e.x,e.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld))},intersectObject:function(t,n){var r=[];return i(t,this,r,n),r.sort(e),r},intersectObjects:function(t,n){var r=[];if(Array.isArray(t)===!1)return r;for(var a=0,o=t.length;a<o;a++)i(t[a],this,r,n);return r.sort(e),r}}}(a),a.Object3D=function(){function t(){r.setFromEuler(n,!1)}function e(){n.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:a.Object3DIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=a.Object3D.DefaultUp.clone();var i=new a.Vector3,n=new a.Euler,r=new a.Quaternion,o=new a.Vector3(1,1,1);n.onChange(t),r.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:i},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new a.Matrix4},normalMatrix:{value:new a.Matrix3}}),this.matrix=new a.Matrix4,this.matrixWorld=new a.Matrix4,this.matrixAutoUpdate=a.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new a.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},a.Object3D.DefaultUp=new a.Vector3(0,1,0),a.Object3D.DefaultMatrixAutoUpdate=!0,Object.assign(a.Object3D.prototype,a.EventDispatcher.prototype,{applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new a.Quaternion;return function(e,i){return t.setFromAxisAngle(e,i),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new a.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new a.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new a.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new a.Vector3;return function(e,i){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(i)),this}}(),translateX:function(){var t=new a.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new a.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new a.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new a.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new a.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?this:(t instanceof a.Object3D&&(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var i=this.children.indexOf(t);i!==-1&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i],a=r.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new a.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new a.Vector3,e=new a.Vector3;return function(i){var n=i||new a.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,e),n}}(),getWorldRotation:function(){var t=new a.Quaternion;return function(e){var i=e||new a.Euler;return this.getWorldQuaternion(t),i.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new a.Vector3,e=new a.Quaternion;return function(i){var n=i||new a.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,n),n}}(),getWorldDirection:function(){var t=new a.Quaternion;return function(e){var i=e||new a.Vector3;return this.getWorldQuaternion(t),i.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(this.visible!==!1){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&t!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,i=this.children.length;e<i;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var i=void 0===t||""===t,n={};i&&(t={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),
|
|
r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(t).object)}if(i){var o=e(t.geometries),s=e(t.materials),c=e(t.textures),h=e(t.images);o.length>0&&(n.geometries=o),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),h.length>0&&(n.images=h)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),a.Object3DIdCount=0,a.Face3=function(t,e,i,n,r,o){this.a=t,this.b=e,this.c=i,this.normal=n instanceof a.Vector3?n:new a.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=r instanceof a.Color?r:new a.Color,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0},a.Face3.prototype={constructor:a.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},a.BufferAttribute=function(t,e,i){this.uuid=a.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=i===!0},a.BufferAttribute.prototype={constructor:a.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(o=new a.Color),e[i++]=o.r,e[i++]=o.g,e[i++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];e[i++]=a.a,e[i++]=a.b,e[i++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(o=new a.Vector2),e[i++]=o.x,e[i++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(o=new a.Vector3),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(o=new a.Vector4),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z,e[i++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},clone:function(){return(new this.constructor).copy(this)}},a.Int8Attribute=function(t,e){return new a.BufferAttribute(new Int8Array(t),e)},a.Uint8Attribute=function(t,e){return new a.BufferAttribute(new Uint8Array(t),e)},a.Uint8ClampedAttribute=function(t,e){return new a.BufferAttribute(new Uint8ClampedArray(t),e)},a.Int16Attribute=function(t,e){return new a.BufferAttribute(new Int16Array(t),e)},a.Uint16Attribute=function(t,e){return new a.BufferAttribute(new Uint16Array(t),e)},a.Int32Attribute=function(t,e){return new a.BufferAttribute(new Int32Array(t),e)},a.Uint32Attribute=function(t,e){return new a.BufferAttribute(new Uint32Array(t),e)},a.Float32Attribute=function(t,e){return new a.BufferAttribute(new Float32Array(t),e)},a.Float64Attribute=function(t,e){return new a.BufferAttribute(new Float64Array(t),e)},a.DynamicBufferAttribute=function(t,e){return new a.BufferAttribute(t,e).setDynamic(!0)},a.InstancedBufferAttribute=function(t,e,i){a.BufferAttribute.call(this,t,e),this.meshPerAttribute=i||1},a.InstancedBufferAttribute.prototype=Object.create(a.BufferAttribute.prototype),a.InstancedBufferAttribute.prototype.constructor=a.InstancedBufferAttribute,a.InstancedBufferAttribute.prototype.copy=function(t){return a.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},a.InterleavedBuffer=function(t,e){this.uuid=a.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},a.InterleavedBuffer.prototype={constructor:a.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},a.InstancedInterleavedBuffer=function(t,e,i){a.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=i||1},a.InstancedInterleavedBuffer.prototype=Object.create(a.InterleavedBuffer.prototype),a.InstancedInterleavedBuffer.prototype.constructor=a.InstancedInterleavedBuffer,a.InstancedInterleavedBuffer.prototype.copy=function(t){return a.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},a.InterleavedBufferAttribute=function(t,e,i,n){this.uuid=a.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=i,this.normalized=n===!0},a.InterleavedBufferAttribute.prototype={constructor:a.InterleavedBufferAttribute,get length(){return this.array.length},get count(){return this.data.count},get array(){return this.data.array},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}},a.Geometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},Object.assign(a.Geometry.prototype,a.EventDispatcher.prototype,{applyMatrix:function(t){for(var e=(new a.Matrix3).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){var r=this.vertices[i];r.applyMatrix4(t)}for(var i=0,n=this.faces.length;i<n;i++){var o=this.faces[i];o.normal.applyMatrix3(e).normalize();for(var s=0,c=o.vertexNormals.length;s<c;s++)o.vertexNormals[s].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,i,n){return void 0===t&&(t=new a.Matrix4),t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,i,n){return void 0===t&&(t=new a.Matrix4),t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new a.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,n,r){var o=void 0!==s?[u[t].clone(),u[e].clone(),u[n].clone()]:[],f=void 0!==c?[i.colors[t].clone(),i.colors[e].clone(),i.colors[n].clone()]:[],m=new a.Face3(t,e,n,o,f,r);i.faces.push(m),void 0!==h&&i.faceVertexUvs[0].push([d[t].clone(),d[e].clone(),d[n].clone()]),void 0!==l&&i.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[n].clone()])}var i=this,n=null!==t.index?t.index.array:void 0,r=t.attributes,o=r.position.array,s=void 0!==r.normal?r.normal.array:void 0,c=void 0!==r.color?r.color.array:void 0,h=void 0!==r.uv?r.uv.array:void 0,l=void 0!==r.uv2?r.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=[],d=[],p=[],f=0,m=0;f<o.length;f+=3,m+=2)i.vertices.push(new a.Vector3(o[f],o[f+1],o[f+2])),void 0!==s&&u.push(new a.Vector3(s[f],s[f+1],s[f+2])),void 0!==c&&i.colors.push(new a.Color(c[f],c[f+1],c[f+2])),void 0!==h&&d.push(new a.Vector2(h[m],h[m+1])),void 0!==l&&p.push(new a.Vector2(l[m],l[m+1]));if(void 0!==n){var g=t.groups;if(g.length>0)for(var f=0;f<g.length;f++)for(var v=g[f],y=v.start,x=v.count,m=y,b=y+x;m<b;m+=3)e(n[m],n[m+1],n[m+2],v.materialIndex);else for(var f=0;f<n.length;f+=3)e(n[f],n[f+1],n[f+2])}else for(var f=0;f<o.length/3;f+=3)e(f,f+1,f+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new a.Matrix4;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new a.Vector3,e=new a.Vector3,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],o=this.vertices[r.a],s=this.vertices[r.b],c=this.vertices[r.c];t.subVectors(c,s),e.subVectors(o,s),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,i,n,r,o,s;for(s=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)s[e]=new a.Vector3;if(t){var c,h,l,u=new a.Vector3,d=new a.Vector3;for(n=0,r=this.faces.length;n<r;n++)o=this.faces[n],c=this.vertices[o.a],h=this.vertices[o.b],l=this.vertices[o.c],u.subVectors(l,h),d.subVectors(c,h),u.cross(d),s[o.a].add(u),s[o.b].add(u),s[o.c].add(u)}else for(n=0,r=this.faces.length;n<r;n++)o=this.faces[n],s[o.a].add(o.normal),s[o.b].add(o.normal),s[o.c].add(o.normal);for(e=0,i=this.vertices.length;e<i;e++)s[e].normalize();for(n=0,r=this.faces.length;n<r;n++){o=this.faces[n];var p=o.vertexNormals;3===p.length?(p[0].copy(s[o.a]),p[1].copy(s[o.b]),p[2].copy(s[o.c])):(p[0]=s[o.a].clone(),p[1]=s[o.b].clone(),p[2]=s[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for(r=this.faces[i],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var o=new a.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var s,c,h=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)s=new a.Vector3,c={a:new a.Vector3,b:new a.Vector3,c:new a.Vector3},h.push(s),l.push(c)}var u=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var s,c;for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],s=u.faceNormals[i],c=u.vertexNormals[i],s.copy(r.normal),c.a.copy(r.vertexNormals[0]),c.b.copy(r.vertexNormals[1]),c.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeTangents:function(){},computeLineDistances:function(){for(var t=0,e=this.vertices,i=0,n=e.length;i<n;i++)i>0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t instanceof a.Geometry!=!1){var n,r=this.vertices.length,o=this.vertices,s=t.vertices,c=this.faces,h=t.faces,l=this.faceVertexUvs[0],u=t.faceVertexUvs[0];void 0===i&&(i=0),void 0!==e&&(n=(new a.Matrix3).getNormalMatrix(e));for(var d=0,p=s.length;d<p;d++){var f=s[d],m=f.clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(d=0,p=h.length;d<p;d++){var g,v,y,x=h[d],b=x.vertexNormals,_=x.vertexColors;g=new a.Face3(x.a+r,x.b+r,x.c+r),g.normal.copy(x.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var M=0,w=b.length;M<w;M++)v=b[M].clone(),void 0!==n&&v.applyMatrix3(n).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(var M=0,w=_.length;M<w;M++)y=_[M],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+i,c.push(g)}for(d=0,p=u.length;d<p;d++){var S=u[d],T=[];if(void 0!==S){for(var M=0,w=S.length;M<w;M++)T.push(S[M].clone());l.push(T)}}}},mergeMesh:function(t){t instanceof a.Mesh!=!1&&(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,i,n,r,a,o,s,c={},h=[],l=[],u=4,d=Math.pow(10,u);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],e=Math.round(t.x*d)+"_"+Math.round(t.y*d)+"_"+Math.round(t.z*d),void 0===c[e]?(c[e]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[e]];var p=[];for(i=0,n=this.faces.length;i<n;i++){r=this.faces[i],r.a=l[r.a],r.b=l[r.b],r.c=l[r.c],a=[r.a,r.b,r.c];for(var f=-1,m=0;m<3;m++)if(a[m]===a[(m+1)%3]){f=m,p.push(i);break}}for(i=p.length-1;i>=0;i--){var g=p[i];for(this.faces.splice(g,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(g,1)}var v=this.vertices.length-h.length;return this.vertices=h,v},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,i=e.length,n=0;n<i;n++)e[n]._id=n;e.sort(t);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===i&&(r=[]),s&&s.length===i&&(a=[]);for(var n=0;n<i;n++){var c=e[n]._id;r&&r.push(o[c]),a&&a.push(s[c])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,i){return i?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=u.length/3,u.push(t.x,t.y,t.z),d[e])}function i(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=p.length,p.push(t.getHex()),f[e])}function n(t){var e=t.x.toString()+t.y.toString();return void 0!==g[e]?g[e]:(g[e]=m.length/2,m.push(t.x,t.y),g[e])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],d={},p=[],f={},m=[],g={},c=0;c<this.faces.length;c++){var v=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],_=v.normal.length()>0,M=v.vertexNormals.length>0,w=1!==v.color.r||1!==v.color.g||1!==v.color.b,S=v.vertexColors.length>0,T=0;if(T=t(T,0,0),T=t(T,1,y),T=t(T,2,x),T=t(T,3,b),T=t(T,4,_),T=t(T,5,M),T=t(T,6,w),T=t(T,7,S),l.push(T),l.push(v.a,v.b,v.c),l.push(v.materialIndex),b){var L=this.faceVertexUvs[0][c];l.push(n(L[0]),n(L[1]),n(L[2]))}if(_&&l.push(e(v.normal)),M){var A=v.vertexNormals;l.push(e(A[0]),e(A[1]),e(A[2]))}if(w&&l.push(i(v.color)),S){var C=v.vertexColors;l.push(i(C[0]),i(C[1]),i(C[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,p.length>0&&(r.data.colors=p),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new a.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,i=0,n=e.length;i<n;i++)this.vertices.push(e[i].clone());for(var r=t.faces,i=0,n=r.length;i<n;i++)this.faces.push(r[i].clone());for(var i=0,n=t.faceVertexUvs.length;i<n;i++){var a=t.faceVertexUvs[i];void 0===this.faceVertexUvs[i]&&(this.faceVertexUvs[i]=[]);for(var o=0,s=a.length;o<s;o++){for(var c=a[o],h=[],l=0,u=c.length;l<u;l++){var d=c[l];h.push(d.clone())}this.faceVertexUvs[i].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.GeometryIdCount=0,a.DirectGeometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1},Object.assign(a.DirectGeometry.prototype,a.EventDispatcher.prototype,{computeBoundingBox:a.Geometry.prototype.computeBoundingBox,computeBoundingSphere:a.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){},computeVertexNormals:function(){},computeGroups:function(t){for(var e,i,n=[],r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,n.push(e)),e={start:3*a,materialIndex:i})}void 0!==e&&(e.count=3*a-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,o=r[0]&&r[0].length>0,s=r[1]&&r[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l<h;l++)e[l]=[];this.morphTargets.position=e}var u,d=t.morphNormals,p=d.length;if(p>0){u=[];for(var l=0;l<p;l++)u[l]=[];this.morphTargets.normal=u}for(var f=t.skinIndices,m=t.skinWeights,g=f.length===n.length,v=m.length===n.length,l=0;l<i.length;l++){var y=i[l];this.vertices.push(n[y.a],n[y.b],n[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var _=y.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var M=y.color;this.colors.push(M,M,M)}if(o===!0){var w=r[0][l];void 0!==w?this.uvs.push(w[0],w[1],w[2]):this.uvs.push(new a.Vector2,new a.Vector2,new a.Vector2)}if(s===!0){var w=r[1][l];void 0!==w?this.uvs2.push(w[0],w[1],w[2]):this.uvs2.push(new a.Vector2,new a.Vector2,new a.Vector2)}for(var S=0;S<h;S++){var T=c[S].vertices;e[S].push(T[y.a],T[y.b],T[y.c])}for(var S=0;S<p;S++){var L=d[S].vertexNormals[l];u[S].push(L.a,L.b,L.c)}g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.BufferGeometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}},Object.assign(a.BufferGeometry.prototype,a.EventDispatcher.prototype,{getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return e instanceof a.BufferAttribute==!1&&e instanceof a.InterleavedBufferAttribute==!1?void this.addAttribute(t,new a.BufferAttribute(arguments[1],arguments[2])):"index"===t?void this.setIndex(e):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new a.Matrix3).getNormalMatrix(t);n.applyToVector3Array(i.array),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,i,n){return void 0===t&&(t=new a.Matrix4),t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,i,n){return void 0===t&&(t=new a.Matrix4),t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new a.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof a.Points||t instanceof a.Line){var i=new a.Float32Attribute(3*e.vertices.length,3),n=new a.Float32Attribute(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new a.Float32Attribute(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof a.Mesh&&e instanceof a.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof a.Mesh){var i=e.__directGeometry;if(void 0===i||e.elementsNeedUpdate===!0)return this.fromGeometry(e);i.verticesNeedUpdate=e.verticesNeedUpdate||e.elementsNeedUpdate,i.normalsNeedUpdate=e.normalsNeedUpdate||e.elementsNeedUpdate,i.colorsNeedUpdate=e.colorsNeedUpdate||e.elementsNeedUpdate,i.uvsNeedUpdate=e.uvsNeedUpdate||e.elementsNeedUpdate,i.groupsNeedUpdate=e.groupsNeedUpdate||e.elementsNeedUpdate,e.elementsNeedUpdate=!1,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=i}var n;return e.verticesNeedUpdate===!0&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new a.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new a.BufferAttribute(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new a.BufferAttribute(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new a.BufferAttribute(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new a.BufferAttribute(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new a.BufferAttribute(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var s=t.vertices.length>65535?Uint32Array:Uint16Array,c=new s(3*t.indices.length);this.setIndex(new a.BufferAttribute(c,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var h in t.morphTargets){for(var l=[],u=t.morphTargets[h],d=0,p=u.length;d<p;d++){var f=u[d],m=new a.Float32Attribute(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[h]=l}if(t.skinIndices.length>0){var g=new a.Float32Attribute(4*t.skinIndices.length,4);this.addAttribute("skinIndex",g.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new a.Float32Attribute(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)},computeBoundingSphere:function(){var t=new a.Box3,e=new a.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.center(r);for(var o=0,s=0,c=n.length;s<c;s+=3)e.fromArray(n,s),o=Math.max(o,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,i=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new a.BufferAttribute(new Float32Array(n.length),3));else for(var r=e.normal.array,o=0,s=r.length;o<s;o++)r[o]=0;var c,h,l,u=e.normal.array,d=new a.Vector3,p=new a.Vector3,f=new a.Vector3,m=new a.Vector3,g=new a.Vector3;if(t){var v=t.array;0===i.length&&this.addGroup(0,v.length);for(var y=0,x=i.length;y<x;++y)for(var b=i[y],_=b.start,M=b.count,o=_,s=_+M;o<s;o+=3)c=3*v[o+0],h=3*v[o+1],l=3*v[o+2],d.fromArray(n,c),p.fromArray(n,h),f.fromArray(n,l),m.subVectors(f,p),g.subVectors(d,p),m.cross(g),u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var o=0,s=n.length;o<s;o+=9)d.fromArray(n,o),p.fromArray(n,o+3),f.fromArray(n,o+6),m.subVectors(f,p),g.subVectors(d,p),m.cross(g),u[o]=m.x,u[o+1]=m.y,u[o+2]=m.z,u[o+3]=m.x,u[o+4]=m.y,u[o+5]=m.z,u[o+6]=m.x,u[o+7]=m.y,u[o+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t instanceof a.BufferGeometry!=!1){void 0===e&&(e=0);var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r=i[n],o=r.array,s=t.attributes[n],c=s.array,h=s.itemSize,l=0,u=h*e;l<c.length;l++,u++)o[u]=c[l];return this}},normalizeNormals:function(){for(var t,e,i,n,r=this.attributes.normal.array,a=0,o=r.length;a<o;a+=3)t=r[a],e=r[a+1],i=r[a+2],n=1/Math.sqrt(t*t+e*e+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(null===this.index)return this;var t=new a.BufferGeometry,e=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],o=r.array,s=r.itemSize,c=new o.constructor(e.length*s),h=0,l=0,u=0,d=e.length;u<d;u++){h=e[u]*s;for(var p=0;p<s;p++)c[l++]=o[h++]}t.addAttribute(n,new a.BufferAttribute(c,s))}return t},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);t.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new a.BufferGeometry).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.BufferGeometry.MaxIndex=65535,a.InstancedBufferGeometry=function(){a.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},a.InstancedBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.InstancedBufferGeometry.prototype.constructor=a.InstancedBufferGeometry,a.InstancedBufferGeometry.prototype.addGroup=function(t,e,i){this.groups.push({start:t,count:e,instances:i})},a.InstancedBufferGeometry.prototype.copy=function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){
|
|
var c=a[o];this.addGroup(c.start,c.count,c.instances)}return this},a.Uniform=function(t){"string"==typeof t&&(t=arguments[1]),this.value=t,this.dynamic=!1},a.Uniform.prototype={constructor:a.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},a.AnimationAction=function(){throw new Error("THREE.AnimationAction: Use mixer.clipAction for construction.")},a.AnimationAction._new=function(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,o=new Array(r),s={endingStart:a.ZeroCurvatureEnding,endingEnd:a.ZeroCurvatureEnding},c=0;c!==r;++c){var h=n[c].createInterpolant(null);o[c]=h,h.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=a.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0},a.AnimationAction._new.prototype={constructor:a.AnimationAction._new,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){this._startTime;return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){this._mixer;if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===a.LoopOnce){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=n===a.LoopPingPong;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var s=Math.floor(e/i);e-=i*s,r+=Math.abs(s);var c=this.repetitions-r;if(c<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===c){var h=t<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}if(o&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=a.ZeroSlopeEnding,n.endingEnd=a.ZeroSlopeEnding):(t?n.endingStart=this.zeroSlopeAtStart?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:n.endingStart=a.WrapAroundEnding,e?n.endingEnd=this.zeroSlopeAtEnd?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:n.endingEnd=a.WrapAroundEnding)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}},a.AnimationClip=function(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=a.Math.generateUUID(),this.duration<0&&this.resetDuration(),this.trim(),this.optimize()},a.AnimationClip.prototype={constructor:a.AnimationClip,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(a.AnimationClip,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,o=i.length;r!==o;++r)e.push(a.KeyframeTrack.parse(i[r]).scale(n));return new a.AnimationClip(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e},r=0,o=i.length;r!==o;++r)e.push(a.KeyframeTrack.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,o=[],s=0;s<r;s++){var c=[],h=[];c.push((s+r-1)%r,s,(s+1)%r),h.push(0,1,0);var l=a.AnimationUtils.getKeyframeOrder(c);c=a.AnimationUtils.sortedArray(c,1,l),h=a.AnimationUtils.sortedArray(h,1,l),n||0!==c[0]||(c.push(r),h.push(h[0])),o.push(new a.NumberKeyframeTrack(".morphTargetInfluences["+e[s].name+"]",c,h).scale(1/i))}return new a.AnimationClip(t,(-1),o)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,o=0,s=t.length;o<s;o++){var c=t[o],h=c.name.match(r);if(h&&h.length>1){var l=h[1],u=n[l];u||(n[l]=u=[]),u.push(c)}}var d=[];for(var l in n)d.push(a.AnimationClip.CreateFromMorphTargetSequence(l,n[l],e,i));return d},parseAnimation:function(t,e,i){if(!t)return null;for(var n=function(t,e,i,n,r){if(0!==i.length){var o=[],s=[];a.AnimationUtils.flattenJSON(i,o,s,n),0!==o.length&&r.push(new t(e,o,s))}},r=[],o=t.name||"default",s=t.length||-1,c=t.fps||30,h=t.hierarchy||[],l=0;l<h.length;l++){var u=h[l].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var d={},p=0;p<u.length;p++)if(u[p].morphTargets)for(var f=0;f<u[p].morphTargets.length;f++)d[u[p].morphTargets[f]]=-1;for(var m in d){for(var g=[],v=[],f=0;f!==u[p].morphTargets.length;++f){var y=u[p];g.push(y.time),v.push(y.morphTarget===m?1:0)}r.push(new a.NumberKeyframeTrack(".morphTargetInfluence["+m+"]",g,v))}s=d.length*(c||1)}else{var x=".bones["+e[l].name+"]";n(a.VectorKeyframeTrack,x+".position",u,"pos",r),n(a.QuaternionKeyframeTrack,x+".quaternion",u,"rot",r),n(a.VectorKeyframeTrack,x+".scale",u,"scl",r)}}if(0===r.length)return null;var b=new a.AnimationClip(o,s,r);return b}}),a.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},Object.assign(a.AnimationMixer.prototype,a.EventDispatcher.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?a.AnimationClip.findByName(i,t):t,o=null!==r?r.uuid:t,s=this._actionsByClip[o],c=null;if(void 0!==s){var h=s.actionByRoot[n];if(void 0!==h)return h;c=s.knownActions[0],null===r&&(r=c._clip)}if(null===r)return null;var l=new a.AnimationMixer._Action(this,r,e);return this._bindAction(l,c),this._addInactiveAction(l,o,n),l},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?a.AnimationClip.findByName(i,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s?s.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){var s=e[o];s.enabled&&s._update(n,t,r,a)}for(var c=this._bindings,h=this._nActiveBindings,o=0;o!==h;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,e[h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,a=r[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),a.AnimationMixer._Action=a.AnimationAction._new,Object.assign(a.AnimationMixer.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,s=t._interpolants,c=i.uuid,h=this._bindingsByRootAndName,l=h[c];void 0===l&&(l={},h[c]=l);for(var u=0;u!==r;++u){var d=n[u],p=d.name,f=l[p];if(void 0!==f)o[u]=f;else{if(f=o[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}var m=e&&e._propertyBindings[u].binding.parsedPath;f=new a.PropertyMixer(a.PropertyBinding.create(i,p,m),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),o[u]=f}s[u].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),t._byClipCacheIndex=null;var l=o.actionByRoot,u=(e._localRoot||this._root).uuid;delete l[u],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[r];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(i=new a.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1)}),a.AnimationObjectGroup=function(t){this.uuid=a.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}},a.AnimationObjectGroup.prototype={constructor:a.AnimationObjectGroup,add:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,o=this._paths,s=this._parsedPaths,c=this._bindings,h=c.length,l=0,u=arguments.length;l!==u;++l){var d=arguments[l],p=d.uuid,f=r[p];if(void 0===f){f=i++,r[p]=f,e.push(d);for(var m=0,g=h;m!==g;++m)c[m].push(new a.PropertyBinding(d,o[m],s[m]))}else if(f<n){var v=e[f],y=--n,x=e[y];r[x.uuid]=f,e[f]=x,r[p]=y,e[y]=d;for(var m=0,g=h;m!==g;++m){var b=c[m],_=b[y],M=b[f];b[f]=_,void 0===M&&(M=new a.PropertyBinding(d,o[m],s[m])),b[y]=M}}else e[f]!==v}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,i=(e.length,this.nCachedObjects_),n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l&&l>=i){var u=i++,d=e[u];n[d.uuid]=l,e[l]=d,n[h]=u,e[u]=c;for(var p=0,f=a;p!==f;++p){var m=r[p],g=m[u],v=m[l];m[l]=g,m[u]=v}}}this.nCachedObjects_=i},uncache:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=r[l];if(void 0!==u)if(delete r[l],u<n){var d=--n,p=e[d],f=--i,m=e[f];r[p.uuid]=u,e[u]=p,r[m.uuid]=d,e[d]=m,e.pop();for(var g=0,v=o;g!==v;++g){var y=a[g],x=y[d],b=y[f];y[u]=x,y[d]=b,y.pop()}}else{var f=--i,m=e[f];r[m.uuid]=u,e[u]=m,e.pop();for(var g=0,v=o;g!==v;++g){var y=a[g];y[u]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var o=this._paths,s=this._parsedPaths,c=this._objects,h=c.length,l=this.nCachedObjects_,u=new Array(h);n=r.length,i[t]=n,o.push(t),s.push(e),r.push(u);for(var d=l,p=c.length;d!==p;++d){var f=c[d];u[d]=new a.PropertyBinding(f,t,e)}return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=t[o];e[c]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}},a.AnimationUtils={arraySlice:function(t,e,i){return a.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o)){do o=a[n],void 0!==o&&(e.push(a.time),i.push.apply(i,o)),a=t[r++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[n],void 0!==o&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++];while(void 0!==a)}else do o=a[n],void 0!==o&&(e.push(a.time),i.push(o)),a=t[r++];while(void 0!==a)}}},a.KeyframeTrack=function(t,e,i,n){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=a.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=a.AnimationUtils.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()},a.KeyframeTrack.prototype={constructor:a.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new a.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new a.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new a.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case a.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case a.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case a.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)this.createInterpolant=e;else{var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return a.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return a.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return a.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,o=n-1;r!==n&&i[r]<t;)++r;for(;o!==-1&&i[o]>e;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);var s=this.getValueSize();this.times=a.AnimationUtils.arraySlice(i,r,o),this.values=a.AnimationUtils.arraySlice(this.values,r*s,o*s)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(t=!1);for(var o=null,s=0;s!==r;s++){var c=i[s];if("number"==typeof c&&isNaN(c)){t=!1;break}if(null!==o&&o>c){t=!1;break}o=c}if(void 0!==n&&a.AnimationUtils.isTypedArray(n))for(var s=0,h=n.length;s!==h;++s){var l=n[s];if(isNaN(l)){t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=1,r=1,o=t.length-1;r<=o;++r){var s=!1,c=t[r],h=t[r+1];if(c!==h&&(1!==r||c!==c[0]))for(var l=r*i,u=l-i,d=l+i,p=0;p!==i;++p){var f=e[l+p];if(f!==e[u+p]||f!==e[d+p]){s=!0;break}}if(s){if(r!==n){t[n]=t[r];for(var m=r*i,g=n*i,p=0;p!==i;++p)e[g+p]=e[m+p]}++n}}return n!==t.length&&(this.times=a.AnimationUtils.arraySlice(t,0,n),this.values=a.AnimationUtils.arraySlice(e,0,n*i)),this}},Object.assign(a.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=a.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];a.AnimationUtils.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:a.AnimationUtils.convertArray(t.times,Array),values:a.AnimationUtils.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return a.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return a.VectorKeyframeTrack;case"color":return a.ColorKeyframeTrack;case"quaternion":return a.QuaternionKeyframeTrack;case"bool":case"boolean":return a.BooleanKeyframeTrack;case"string":return a.StringKeyframeTrack}throw new Error("Unsupported typeName: "+t)}}),a.PropertyBinding=function(t,e,i){this.path=e,this.parsedPath=i||a.PropertyBinding.parseTrackName(e),this.node=a.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},a.PropertyBinding.prototype={constructor:a.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=a.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return;if(!t.material.materials)return;t=t.material.materials;break;case"bones":if(!t.skeleton)return;t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;default:if(void 0===t[i])return;t=t[i]}if(void 0!==o){if(void 0===t[o])return;t=t[o]}}var c=t[n];if(void 0!==c){var h=this.Versioning.None;void 0!==t.needsUpdate?(h=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return;if(!t.geometry.morphTargets)return;for(var s=0;s<this.node.geometry.morphTargets.length;s++)if(t.geometry.morphTargets[s].name===r){r=s;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=r}else void 0!==c.fromArray&&void 0!==c.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=c):void 0!==c.length?(l=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][h]}else{e.nodeName}}},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(a.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:a.PropertyBinding.prototype.getValue,_setValue_unbound:a.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),a.PropertyBinding.Composite=function(t,e,i){var n=i||a.PropertyBinding.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)},a.PropertyBinding.Composite.prototype={constructor:a.PropertyBinding.Composite,getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},a.PropertyBinding.create=function(t,e,i){return t instanceof a.AnimationObjectGroup?new a.PropertyBinding.Composite(t,e,i):new a.PropertyBinding(t,e,i)},a.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,i=e.exec(t);if(!i)throw new Error("cannot parse trackName at all: "+t);i.index===e.lastIndex&&e.lastIndex++;var n={nodeName:i[3],objectName:i[5],objectIndex:i[7],propertyName:i[9],propertyIndex:i[11]};if(null===n.propertyName||0===n.propertyName.length)throw new Error("can not parse propertyName from trackName: "+t);return n},a.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=function(t){for(var i=0;i<t.bones.length;i++){var n=t.bones[i];if(n.name===e)return n}return null},n=i(t.skeleton);if(n)return n}if(t.children){var r=function o(t){for(var i=0;i<t.length;i++){var n=t[i];if(n.name===e||n.uuid===e)return n;var r=o(n.children);if(r)return r}return null},a=r(t.children);if(a)return a}return null},a.PropertyMixer=function(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},a.PropertyMixer.prototype={constructor:a.PropertyMixer,accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n,r){a.Quaternion.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}},a.BooleanKeyframeTrack=function(t,e,i){a.KeyframeTrack.call(this,t,e,i)},a.BooleanKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:a.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),a.ColorKeyframeTrack=function(t,e,i,n){a.KeyframeTrack.call(this,t,e,i,n)},a.ColorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.ColorKeyframeTrack,ValueTypeName:"color"}),a.NumberKeyframeTrack=function(t,e,i,n){a.KeyframeTrack.call(this,t,e,i,n)},a.NumberKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.NumberKeyframeTrack,ValueTypeName:"number"}),a.QuaternionKeyframeTrack=function(t,e,i,n){a.KeyframeTrack.call(this,t,e,i,n)},a.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new a.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),a.StringKeyframeTrack=function(t,e,i,n){a.KeyframeTrack.call(this,t,e,i,n)},a.StringKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:a.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),a.VectorKeyframeTrack=function(t,e,i,n){a.KeyframeTrack.call(this,t,e,i,n)},a.VectorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.VectorKeyframeTrack,ValueTypeName:"vector"}),a.Audio=function(t){a.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[];
|
|
},a.Audio.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Audio,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.source.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying!==!0&&this.hasPlaybackControl!==!1){var t=this.context.createBufferSource();return t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}},pause:function(){if(this.hasPlaybackControl!==!1)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this},stop:function(){if(this.hasPlaybackControl!==!1)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),this.isPlaying===!0?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(this.hasPlaybackControl!==!1)return this.playbackRate=t,this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl!==!1&&this.source.loop},setLoop:function(t){this.hasPlaybackControl!==!1&&(this.source.loop=t)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),a.AudioAnalyser=function(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},Object.assign(a.AudioAnalyser.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.defineProperty(a,"AudioContext",{get:function(){var t;return function(){return void 0===t&&(t=new(window.AudioContext||window.webkitAudioContext)),t}}()}),a.PositionalAudio=function(t){a.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},a.PositionalAudio.prototype=Object.assign(Object.create(a.Audio.prototype),{constructor:a.PositionalAudio,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new a.Vector3;return function(e){a.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),a.AudioListener=function(){a.Object3D.call(this),this.type="AudioListener",this.context=a.AudioContext,this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},a.AudioListener.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.AudioListener,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new a.Vector3,e=new a.Quaternion,i=new a.Vector3,n=new a.Vector3;return function(r){a.Object3D.prototype.updateMatrixWorld.call(this,r);var o=this.context.listener,s=this.up;this.matrixWorld.decompose(t,e,i),n.set(0,0,-1).applyQuaternion(e),o.setPosition(t.x,t.y,t.z),o.setOrientation(n.x,n.y,n.z,s.x,s.y,s.z)}}()}),a.Camera=function(){a.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new a.Matrix4,this.projectionMatrix=new a.Matrix4},a.Camera.prototype=Object.create(a.Object3D.prototype),a.Camera.prototype.constructor=a.Camera,a.Camera.prototype.getWorldDirection=function(){var t=new a.Quaternion;return function(e){var i=e||new a.Vector3;return this.getWorldQuaternion(t),i.set(0,0,-1).applyQuaternion(t)}}(),a.Camera.prototype.lookAt=function(){var t=new a.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),a.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},a.Camera.prototype.copy=function(t){return a.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},a.CubeCamera=function(t,e,i){a.Object3D.call(this),this.type="CubeCamera";var n=90,r=1,o=new a.PerspectiveCamera(n,r,t,e);o.up.set(0,-1,0),o.lookAt(new a.Vector3(1,0,0)),this.add(o);var s=new a.PerspectiveCamera(n,r,t,e);s.up.set(0,-1,0),s.lookAt(new a.Vector3((-1),0,0)),this.add(s);var c=new a.PerspectiveCamera(n,r,t,e);c.up.set(0,0,1),c.lookAt(new a.Vector3(0,1,0)),this.add(c);var h=new a.PerspectiveCamera(n,r,t,e);h.up.set(0,0,-1),h.lookAt(new a.Vector3(0,(-1),0)),this.add(h);var l=new a.PerspectiveCamera(n,r,t,e);l.up.set(0,-1,0),l.lookAt(new a.Vector3(0,0,1)),this.add(l);var u=new a.PerspectiveCamera(n,r,t,e);u.up.set(0,-1,0),u.lookAt(new a.Vector3(0,0,(-1))),this.add(u);var d={format:a.RGBFormat,magFilter:a.LinearFilter,minFilter:a.LinearFilter};this.renderTarget=new a.WebGLRenderTargetCube(i,i,d),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,o,i),i.activeCubeFace=1,t.render(e,s,i),i.activeCubeFace=2,t.render(e,c,i),i.activeCubeFace=3,t.render(e,h,i),i.activeCubeFace=4,t.render(e,l,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,t.render(e,u,i),t.setRenderTarget(null)}},a.CubeCamera.prototype=Object.create(a.Object3D.prototype),a.CubeCamera.prototype.constructor=a.CubeCamera,a.OrthographicCamera=function(t,e,i,n,r,o){a.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},a.OrthographicCamera.prototype=Object.assign(Object.create(a.Camera.prototype),{constructor:a.OrthographicCamera,copy:function(t){return a.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=l*(this.view.offsetX/c),a=r+l*(this.view.width/c),o-=u*(this.view.offsetY/h),s=o-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),a.PerspectiveCamera=function(t,e,i,n){a.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()},a.PerspectiveCamera.prototype=Object.assign(Object.create(a.Camera.prototype),{constructor:a.PerspectiveCamera,copy:function(t){return a.Camera.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*a.Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*a.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*a.Math.RAD2DEG*Math.atan(Math.tan(.5*a.Math.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*a.Math.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,o=this.view;if(null!==o){var s=o.fullWidth,c=o.fullHeight;r+=o.offsetX*n/s,e-=o.offsetY*i/c,n*=o.width/s,i*=o.height/c}var h=this.filmOffset;0!==h&&(r+=t*h/this.getFilmWidth()),this.projectionMatrix.makeFrustum(r,r+n,e-i,e,t,this.far)},toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),a.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new a.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new a.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},Object.assign(a.StereoCamera.prototype,{update:function(){var t,e,i,n,r,o=new a.Matrix4,s=new a.Matrix4;return function(c){var h=t!==c.focus||e!==c.fov||i!==c.aspect*this.aspect||n!==c.near||r!==c.far;if(h){t=c.focus,e=c.fov,i=c.aspect*this.aspect,n=c.near,r=c.far;var l,u,d=c.projectionMatrix.clone(),p=.032,f=p*n/t,m=n*Math.tan(a.Math.DEG2RAD*e*.5);s.elements[12]=-p,o.elements[12]=p,l=-m*i+f,u=m*i+f,d.elements[0]=2*n/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(d),l=-m*i-f,u=m*i-f,d.elements[0]=2*n/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(o)}}()}),a.Light=function(t,e){a.Object3D.call(this),this.type="Light",this.color=new a.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},a.Light.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Light,copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e}}),a.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new a.Vector2(512,512),this.map=null,this.matrix=new a.Matrix4},Object.assign(a.LightShadow.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}}),a.AmbientLight=function(t,e){a.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},a.AmbientLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.AmbientLight}),a.DirectionalLight=function(t,e){a.Light.call(this,t,e),this.type="DirectionalLight",this.position.copy(a.Object3D.DefaultUp),this.updateMatrix(),this.target=new a.Object3D,this.shadow=new a.DirectionalLightShadow},a.DirectionalLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.DirectionalLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),a.DirectionalLightShadow=function(t){a.LightShadow.call(this,new a.OrthographicCamera((-5),5,5,(-5),.5,500))},a.DirectionalLightShadow.prototype=Object.assign(Object.create(a.LightShadow.prototype),{constructor:a.DirectionalLightShadow}),a.HemisphereLight=function(t,e,i){a.Light.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(a.Object3D.DefaultUp),this.updateMatrix(),this.groundColor=new a.Color(e)},a.HemisphereLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.HemisphereLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),a.PointLight=function(t,e,i,n){a.Light.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new a.LightShadow(new a.PerspectiveCamera(90,1,.5,500))},a.PointLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.PointLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),a.SpotLight=function(t,e,i,n,r,o){a.Light.call(this,t,e),this.type="SpotLight",this.position.copy(a.Object3D.DefaultUp),this.updateMatrix(),this.target=new a.Object3D,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new a.SpotLightShadow},a.SpotLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.SpotLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),a.SpotLightShadow=function(){a.LightShadow.call(this,new a.PerspectiveCamera(50,1,.5,500))},a.SpotLightShadow.prototype=Object.assign(Object.create(a.LightShadow.prototype),{constructor:a.SpotLightShadow,update:function(t){var e=2*a.Math.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),a.AudioLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.AudioLoader.prototype,{load:function(t,e,i,n){var r=new a.XHRLoader(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){var i=a.AudioContext;i.decodeAudioData(t,function(t){e(t)})},i,n)}}),a.Cache={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},a.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},a.Loader.prototype={constructor:a.Loader,crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:function(){var t,e,i;return function(n,r,o){function s(t,i,n,s,h){var l,u=r+t,d=a.Loader.Handlers.get(u);null!==d?l=d.load(u):(e.setCrossOrigin(o),l=e.load(u)),void 0!==i&&(l.repeat.fromArray(i),1!==i[0]&&(l.wrapS=a.RepeatWrapping),1!==i[1]&&(l.wrapT=a.RepeatWrapping)),void 0!==n&&l.offset.fromArray(n),void 0!==s&&("repeat"===s[0]&&(l.wrapS=a.RepeatWrapping),"mirror"===s[0]&&(l.wrapS=a.MirroredRepeatWrapping),"repeat"===s[1]&&(l.wrapT=a.RepeatWrapping),"mirror"===s[1]&&(l.wrapT=a.MirroredRepeatWrapping)),void 0!==h&&(l.anisotropy=h);var p=a.Math.generateUUID();return c[p]=l,p}void 0===t&&(t=new a.Color),void 0===e&&(e=new a.TextureLoader),void 0===i&&(i=new a.MaterialLoader);var c={},h={uuid:a.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in n){var u=n[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=a[u];break;case"colorAmbient":case"mapAmbient":break;case"colorDiffuse":h.color=t.fromArray(u).getHex();break;case"colorSpecular":h.specular=t.fromArray(u).getHex();break;case"colorEmissive":h.emissive=t.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(h.type="MeshStandardMaterial");break;case"mapDiffuse":h.map=s(u,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":h.emissiveMap=s(u,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":h.lightMap=s(u,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":h.metalnessMap=s(u,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":h.roughnessMap=s(u,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=a.BackSide;break;case"doubleSided":h.side=a.DoubleSide;break;case"transparency":h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":u===!0&&(h.vertexColors=a.VertexColors),"face"===u&&(h.vertexColors=a.FaceColors)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),i.setTextures(c),i.parse(h)}}()},a.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},a.XHRLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.XHRLoader.prototype,{load:function(t,e,i,n){void 0!==this.path&&(t=this.path+t);var r=this,o=a.Cache.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",t,!0),s.addEventListener("load",function(i){var o=i.target.response;a.Cache.add(t,o),200===this.status?(e&&e(o),r.manager.itemEnd(t)):0===this.status?(e&&e(o),r.manager.itemEnd(t)):(n&&n(i),r.manager.itemError(t))},!1),void 0!==i&&s.addEventListener("progress",function(t){i(t)},!1),s.addEventListener("error",function(e){n&&n(e),r.manager.itemError(t)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),r.manager.itemStart(t),s},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this}}),a.FontLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.FontLoader.prototype,{load:function(t,e,i,n){var r=this,o=new a.XHRLoader(this.manager);o.load(t,function(t){var i;try{i=JSON.parse(t)}catch(n){i=JSON.parse(t.substring(65,t.length-2))}var a=r.parse(i);e&&e(a)},i,n)},parse:function(t){return new a.Font(t)}}),a.ImageLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.ImageLoader.prototype,{load:function(t,e,i,n){var r=this,o=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(o.onload=function(){URL.revokeObjectURL(o.src),e&&e(o),r.manager.itemEnd(t)},0===t.indexOf("data:"))o.src=t;else{var s=new a.XHRLoader;s.setPath(this.path),s.setResponseType("blob"),s.load(t,function(t){o.src=URL.createObjectURL(t)},i,n)}return r.manager.itemStart(t),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.JSONLoader=function(t){"boolean"==typeof t&&(t=void 0),this.manager=void 0!==t?t:a.DefaultLoadingManager,this.withCredentials=!1},Object.assign(a.JSONLoader.prototype,{load:function(t,e,i,n){var r=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.Loader.prototype.extractUrlBase(t),s=new a.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(t,function(t){var i=JSON.parse(t),n=i.metadata;if(void 0!==n){var a=n.type;if(void 0!==a){if("object"===a.toLowerCase())return;if("scene"===a.toLowerCase())return}}var s=r.parse(i,o);e(s.geometry,s.materials)},i,n)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){function i(e){function i(t,e){return t&1<<e}var n,r,o,c,h,l,u,d,p,f,m,g,v,y,x,b,_,M,w,S,T,L,A,C,E,P,R,D=t.faces,I=t.vertices,O=t.normals,B=t.colors,U=0;if(void 0!==t.uvs){for(n=0;n<t.uvs.length;n++)t.uvs[n].length&&U++;for(n=0;n<U;n++)s.faceVertexUvs[n]=[]}for(c=0,h=I.length;c<h;)M=new a.Vector3,M.x=I[c++]*e,M.y=I[c++]*e,M.z=I[c++]*e,s.vertices.push(M);for(c=0,h=D.length;c<h;)if(f=D[c++],m=i(f,0),g=i(f,1),v=i(f,3),y=i(f,4),x=i(f,5),b=i(f,6),_=i(f,7),m){if(S=new a.Face3,S.a=D[c],S.b=D[c+1],S.c=D[c+3],T=new a.Face3,T.a=D[c+1],T.b=D[c+2],T.c=D[c+3],c+=4,g&&(p=D[c++],S.materialIndex=p,T.materialIndex=p),o=s.faces.length,v)for(n=0;n<U;n++)for(C=t.uvs[n],s.faceVertexUvs[n][o]=[],s.faceVertexUvs[n][o+1]=[],r=0;r<4;r++)d=D[c++],P=C[2*d],R=C[2*d+1],E=new a.Vector2(P,R),2!==r&&s.faceVertexUvs[n][o].push(E),0!==r&&s.faceVertexUvs[n][o+1].push(E);if(y&&(u=3*D[c++],S.normal.set(O[u++],O[u++],O[u]),T.normal.copy(S.normal)),x)for(n=0;n<4;n++)u=3*D[c++],A=new a.Vector3(O[u++],O[u++],O[u]),2!==n&&S.vertexNormals.push(A),0!==n&&T.vertexNormals.push(A);if(b&&(l=D[c++],L=B[l],S.color.setHex(L),T.color.setHex(L)),_)for(n=0;n<4;n++)l=D[c++],L=B[l],2!==n&&S.vertexColors.push(new a.Color(L)),0!==n&&T.vertexColors.push(new a.Color(L));s.faces.push(S),s.faces.push(T)}else{if(w=new a.Face3,w.a=D[c++],w.b=D[c++],w.c=D[c++],g&&(p=D[c++],w.materialIndex=p),o=s.faces.length,v)for(n=0;n<U;n++)for(C=t.uvs[n],s.faceVertexUvs[n][o]=[],r=0;r<3;r++)d=D[c++],P=C[2*d],R=C[2*d+1],E=new a.Vector2(P,R),s.faceVertexUvs[n][o].push(E);if(y&&(u=3*D[c++],w.normal.set(O[u++],O[u++],O[u])),x)for(n=0;n<3;n++)u=3*D[c++],A=new a.Vector3(O[u++],O[u++],O[u]),w.vertexNormals.push(A);if(b&&(l=D[c++],w.color.setHex(B[l])),_)for(n=0;n<3;n++)l=D[c++],w.vertexColors.push(new a.Color(B[l]));s.faces.push(w)}}function n(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e){var r=t.skinWeights[i],o=e>1?t.skinWeights[i+1]:0,c=e>2?t.skinWeights[i+2]:0,h=e>3?t.skinWeights[i+3]:0;s.skinWeights.push(new a.Vector4(r,o,c,h))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i<n;i+=e){var l=t.skinIndices[i],u=e>1?t.skinIndices[i+1]:0,d=e>2?t.skinIndices[i+2]:0,p=e>3?t.skinIndices[i+3]:0;s.skinIndices.push(new a.Vector4(l,u,d,p))}s.bones=t.bones,s.bones&&s.bones.length>0&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)}function r(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){s.morphTargets[i]={},s.morphTargets[i].name=t.morphTargets[i].name,s.morphTargets[i].vertices=[];for(var r=s.morphTargets[i].vertices,o=t.morphTargets[i].vertices,c=0,h=o.length;c<h;c+=3){var l=new a.Vector3;l.x=o[c]*e,l.y=o[c+1]*e,l.z=o[c+2]*e,r.push(l)}}if(void 0!==t.morphColors&&t.morphColors.length>0)for(var u=s.faces,d=t.morphColors[0].colors,i=0,n=u.length;i<n;i++)u[i].color.fromArray(d,3*i)}function o(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var r=a.AnimationClip.parseAnimation(i[n],s.bones);r&&e.push(r)}if(s.morphTargets){var o=a.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);e=e.concat(o)}e.length>0&&(s.animations=e)}var s=new a.Geometry,c=void 0!==t.scale?1/t.scale:1;if(i(c),n(),r(c),o(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:s};var h=a.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:s,materials:h}}}),a.LoadingManager=function(t,e,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,r===!1&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}},a.DefaultLoadingManager=new a.LoadingManager,a.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.BufferGeometryLoader.prototype,{load:function(t,e,i,n){var r=this,o=new a.XHRLoader(r.manager);o.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=new a.BufferGeometry,i=t.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var r=new n[i.type](i.array);e.setIndex(new a.BufferAttribute(r,1))}var o=t.data.attributes;for(var s in o){var c=o[s],r=new n[c.type](c.array);e.addAttribute(s,new a.BufferAttribute(r,c.itemSize,c.normalized))}var h=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==h)for(var l=0,u=h.length;l!==u;++l){var d=h[l];e.addGroup(d.start,d.count,d.materialIndex)}var p=t.data.boundingSphere;if(void 0!==p){var f=new a.Vector3;void 0!==p.center&&f.fromArray(p.center),e.boundingSphere=new a.Sphere(f,p.radius)}return e}}),a.MaterialLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this.textures={}},Object.assign(a.MaterialLoader.prototype,{load:function(t,e,i,n){var r=this,o=new a.XHRLoader(r.manager);o.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t],e[t]},parse:function(t){var e=new a[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale){var i=t.normalScale;Array.isArray(i)===!1&&(i=[i,i]),e.normalScale=(new a.Vector2).fromArray(i)}if(void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),
|
|
void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=a.MultiplyOperation),void 0!==t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var n=0,r=t.materials.length;n<r;n++)e.materials.push(this.parse(t.materials[n]));return e}}),a.ObjectLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this.texturePath=""},Object.assign(a.ObjectLoader.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,o=new a.XHRLoader(r.manager);o.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(o)}),r=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,i,a);return t.animations&&(o.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(o),o},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new a.JSONLoader,n=new a.BufferGeometryLoader,r=0,o=t.length;r<o;r++){var s,c=t[r];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new a[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new a[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new a[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new a[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new a[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new a[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":s=new a[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new a[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new a[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new a[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new a[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"BufferGeometry":s=n.parse(c);break;case"Geometry":s=i.parse(c.data,this.texturePath).geometry;break;default:continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),e[c.uuid]=s}return e},parseMaterials:function(t,e){var i={};if(void 0!==t){var n=new a.MaterialLoader;n.setTextures(e);for(var r=0,o=t.length;r<o;r++){var s=n.parse(t[r]);i[s.uuid]=s}}return i},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=a.AnimationClip.parse(t[i]);e.push(n)}return e},parseImages:function(t,e){function i(t){return n.manager.itemStart(t),s.load(t,function(){n.manager.itemEnd(t)})}var n=this,r={};if(void 0!==t&&t.length>0){var o=new a.LoadingManager(e),s=new a.ImageLoader(o);s.setCrossOrigin(this.crossOrigin);for(var c=0,h=t.length;c<h;c++){var l=t[c],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.texturePath+l.url;r[l.uuid]=i(u)}}return r},parseTextures:function(t,e){function i(t){return"number"==typeof t?t:a[t]}var n={};if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var s=t[r];void 0===s.image,void 0===e[s.image];var c=new a.Texture(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=i(s.mapping)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=i(s.wrap[0]),c.wrapT=i(s.wrap[1])),void 0!==s.minFilter&&(c.minFilter=i(s.minFilter)),void 0!==s.magFilter&&(c.magFilter=i(s.magFilter)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),n[s.uuid]=c}return n},parseObject:function(){var t=new a.Matrix4;return function(e,i,n){function r(t){return void 0===i[t],i[t]}function o(t){if(void 0!==t)return void 0===n[t],n[t]}var s;switch(e.type){case"Scene":s=new a.Scene;break;case"PerspectiveCamera":s=new a.PerspectiveCamera(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new a.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":s=new a.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":s=new a.DirectionalLight(e.color,e.intensity);break;case"PointLight":s=new a.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":s=new a.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new a.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":var c=r(e.geometry),h=o(e.material);s=c.bones&&c.bones.length>0?new a.SkinnedMesh(c,h):new a.Mesh(c,h);break;case"LOD":s=new a.LOD;break;case"Line":s=new a.Line(r(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":s=new a.Points(r(e.geometry),o(e.material));break;case"Sprite":s=new a.Sprite(o(e.material));break;case"Group":s=new a.Group;break;default:s=new a.Object3D}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.children)for(var l in e.children)s.add(this.parseObject(e.children[l],i,n));if("LOD"===e.type)for(var u=e.levels,d=0;d<u.length;d++){var p=u[d],l=s.getObjectByProperty("uuid",p.object);void 0!==l&&s.addLevel(l,p.distance)}return s}}()}),a.TextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.TextureLoader.prototype,{load:function(t,e,i,n){var r=new a.Texture,o=new a.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(i){var n=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?a.RGBFormat:a.RGBAFormat,r.image=i,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.CubeTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.CubeTextureLoader.prototype,{load:function(t,e,i,n){function r(i){s.load(t[i],function(t){o.images[i]=t,c++,6===c&&(o.needsUpdate=!0,e&&e(o))},void 0,n)}var o=new a.CubeTexture,s=new a.ImageLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var c=0,h=0;h<t.length;++h)r(h);return o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.DataTextureLoader=a.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this._parser=null},Object.assign(a.BinaryTextureLoader.prototype,{load:function(t,e,i,n){var r=this,o=new a.DataTexture,s=new a.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(t,function(t){var i=r._parser(t);i&&(void 0!==i.image?o.image=i.image:void 0!==i.data&&(o.image.width=i.width,o.image.height=i.height,o.image.data=i.data),o.wrapS=void 0!==i.wrapS?i.wrapS:a.ClampToEdgeWrapping,o.wrapT=void 0!==i.wrapT?i.wrapT:a.ClampToEdgeWrapping,o.magFilter=void 0!==i.magFilter?i.magFilter:a.LinearFilter,o.minFilter=void 0!==i.minFilter?i.minFilter:a.LinearMipMapLinearFilter,o.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(o.format=i.format),void 0!==i.type&&(o.type=i.type),void 0!==i.mipmaps&&(o.mipmaps=i.mipmaps),1===i.mipmapCount&&(o.minFilter=a.LinearFilter),o.needsUpdate=!0,e&&e(o,i))},i,n),o}}),a.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this._parser=null},Object.assign(a.CompressedTextureLoader.prototype,{load:function(t,e,i,n){function r(r){h.load(t[r],function(t){var i=o._parser(t,!0);s[r]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=i.format,c.needsUpdate=!0,e&&e(c))},i,n)}var o=this,s=[],c=new a.CompressedTexture;c.image=s;var h=new a.XHRLoader(this.manager);if(h.setPath(this.path),h.setResponseType("arraybuffer"),Array.isArray(t))for(var l=0,u=0,d=t.length;u<d;++u)r(u);else h.load(t,function(t){var i=o._parser(t,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,r=0;r<n;r++){s[r]={mipmaps:[]};for(var h=0;h<i.mipmapCount;h++)s[r].mipmaps.push(i.mipmaps[r*i.mipmapCount+h]),s[r].format=i.format,s[r].width=i.width,s[r].height=i.height}else c.image.width=i.width,c.image.height=i.height,c.mipmaps=i.mipmaps;1===i.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=i.format,c.needsUpdate=!0,e&&e(c)},i,n);return c},setPath:function(t){return this.path=t,this}}),a.Material=function(){Object.defineProperty(this,"id",{value:a.MaterialIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=a.NormalBlending,this.side=a.FrontSide,this.shading=a.SmoothShading,this.vertexColors=a.NoColors,this.opacity=1,this.transparent=!1,this.blendSrc=a.SrcAlphaFactor,this.blendDst=a.OneMinusSrcAlphaFactor,this.blendEquation=a.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=a.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},a.Material.prototype={constructor:a.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){t===!0&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i){var n=this[e];void 0!==n&&(n instanceof a.Color?n.set(i):n instanceof a.Vector3&&i instanceof a.Vector3?n.copy(i):"overdraw"===e?this[e]=Number(i):this[e]=i)}}},toJSON:function(t){function e(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var i=void 0===t;i&&(t={textures:{},images:{}});var n={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color instanceof a.Color&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive instanceof a.Color&&(n.emissive=this.emissive.getHex()),this.specular instanceof a.Color&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),this.map instanceof a.Texture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap instanceof a.Texture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof a.Texture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof a.Texture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap instanceof a.Texture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap instanceof a.Texture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap instanceof a.Texture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof a.Texture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof a.Texture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof a.Texture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof a.Texture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==a.NormalBlending&&(n.blending=this.blending),this.shading!==a.SmoothShading&&(n.shading=this.shading),this.side!==a.FrontSide&&(n.side=this.side),this.vertexColors!==a.NoColors&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),i){var r=e(t.textures),o=e(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(a.Material.prototype,a.EventDispatcher.prototype),a.MaterialIdCount=0,a.LineBasicMaterial=function(t){a.Material.call(this),this.type="LineBasicMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)},a.LineBasicMaterial.prototype=Object.create(a.Material.prototype),a.LineBasicMaterial.prototype.constructor=a.LineBasicMaterial,a.LineBasicMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},a.LineDashedMaterial=function(t){a.Material.call(this),this.type="LineDashedMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)},a.LineDashedMaterial.prototype=Object.create(a.Material.prototype),a.LineDashedMaterial.prototype.constructor=a.LineDashedMaterial,a.LineDashedMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this},a.MeshBasicMaterial=function(t){a.Material.call(this),this.type="MeshBasicMaterial",this.color=new a.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)},a.MeshBasicMaterial.prototype=Object.create(a.Material.prototype),a.MeshBasicMaterial.prototype.constructor=a.MeshBasicMaterial,a.MeshBasicMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},a.MeshDepthMaterial=function(t){a.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=a.BasicDepthPacking,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)},a.MeshDepthMaterial.prototype=Object.create(a.Material.prototype),a.MeshDepthMaterial.prototype.constructor=a.MeshDepthMaterial,a.MeshDepthMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},a.MeshLambertMaterial=function(t){a.Material.call(this),this.type="MeshLambertMaterial",this.color=new a.Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},a.MeshLambertMaterial.prototype=Object.create(a.Material.prototype),a.MeshLambertMaterial.prototype.constructor=a.MeshLambertMaterial,a.MeshLambertMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},a.MeshNormalMaterial=function(t){a.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(t)},a.MeshNormalMaterial.prototype=Object.create(a.Material.prototype),a.MeshNormalMaterial.prototype.constructor=a.MeshNormalMaterial,a.MeshNormalMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},a.MeshPhongMaterial=function(t){a.Material.call(this),this.type="MeshPhongMaterial",this.color=new a.Color(16777215),this.specular=new a.Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new a.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},a.MeshPhongMaterial.prototype=Object.create(a.Material.prototype),a.MeshPhongMaterial.prototype.constructor=a.MeshPhongMaterial,a.MeshPhongMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},a.MeshStandardMaterial=function(t){a.Material.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new a.Color(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new a.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},a.MeshStandardMaterial.prototype=Object.create(a.Material.prototype),a.MeshStandardMaterial.prototype.constructor=a.MeshStandardMaterial,a.MeshStandardMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},a.MeshPhysicalMaterial=function(t){a.MeshStandardMaterial.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)},a.MeshPhysicalMaterial.prototype=Object.create(a.MeshStandardMaterial.prototype),a.MeshPhysicalMaterial.prototype.constructor=a.MeshPhysicalMaterial,a.MeshPhysicalMaterial.prototype.copy=function(t){return a.MeshStandardMaterial.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},a.MultiMaterial=function(t){this.uuid=a.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},a.MultiMaterial.prototype={constructor:a.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,n=0,r=i.length;n<r;n++){var a=i[n].toJSON(t);delete a.metadata,e.materials.push(a)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},a.PointsMaterial=function(t){a.Material.call(this),this.type="PointsMaterial",this.color=new a.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)},a.PointsMaterial.prototype=Object.create(a.Material.prototype),a.PointsMaterial.prototype.constructor=a.PointsMaterial,a.PointsMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},a.ShaderMaterial=function(t){a.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes,this.setValues(t))},a.ShaderMaterial.prototype=Object.create(a.Material.prototype),a.ShaderMaterial.prototype.constructor=a.ShaderMaterial,a.ShaderMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=a.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},a.ShaderMaterial.prototype.toJSON=function(t){var e=a.Material.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},a.RawShaderMaterial=function(t){a.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},a.RawShaderMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.RawShaderMaterial.prototype.constructor=a.RawShaderMaterial,a.SpriteMaterial=function(t){a.Material.call(this),this.type="SpriteMaterial",this.color=new a.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)},a.SpriteMaterial.prototype=Object.create(a.Material.prototype),a.SpriteMaterial.prototype.constructor=a.SpriteMaterial,a.SpriteMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},a.ShadowMaterial=function(){a.ShaderMaterial.call(this,{uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,{opacity:{value:1}}]),vertexShader:a.ShaderChunk.shadow_vert,fragmentShader:a.ShaderChunk.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})},a.ShadowMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.ShadowMaterial.prototype.constructor=a.ShadowMaterial,a.Texture=function(t,e,i,n,r,o,s,c,h,l){Object.defineProperty(this,"id",{value:a.TextureIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:a.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:a.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:a.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:a.ClampToEdgeWrapping,this.magFilter=void 0!==r?r:a.LinearFilter,this.minFilter=void 0!==o?o:a.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==s?s:a.RGBAFormat,this.type=void 0!==c?c:a.UnsignedByteType,this.offset=new a.Vector2(0,0),this.repeat=new a.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:a.LinearEncoding,this.version=0,this.onUpdate=null},a.Texture.DEFAULT_IMAGE=void 0,a.Texture.DEFAULT_MAPPING=a.UVMapping,a.Texture.prototype={constructor:a.Texture,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=a.Math.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===a.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case a.RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case a.ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case a.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case a.RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case a.ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case a.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(a.Texture.prototype,a.EventDispatcher.prototype),a.TextureIdCount=0,a.DepthTexture=function(t,e,i,n,r,o,s,c,h){a.Texture.call(this,null,n,r,o,s,c,a.DepthFormat,i,h),this.image={width:t,height:e},this.type=void 0!==i?i:a.UnsignedShortType,
|
|
this.magFilter=void 0!==s?s:a.NearestFilter,this.minFilter=void 0!==c?c:a.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},a.DepthTexture.prototype=Object.create(a.Texture.prototype),a.DepthTexture.prototype.constructor=a.DepthTexture,a.CanvasTexture=function(t,e,i,n,r,o,s,c,h){a.Texture.call(this,t,e,i,n,r,o,s,c,h),this.needsUpdate=!0},a.CanvasTexture.prototype=Object.create(a.Texture.prototype),a.CanvasTexture.prototype.constructor=a.CanvasTexture,a.CubeTexture=function(t,e,i,n,r,o,s,c,h,l){t=void 0!==t?t:[],e=void 0!==e?e:a.CubeReflectionMapping,a.Texture.call(this,t,e,i,n,r,o,s,c,h,l),this.flipY=!1},a.CubeTexture.prototype=Object.create(a.Texture.prototype),a.CubeTexture.prototype.constructor=a.CubeTexture,Object.defineProperty(a.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),a.CompressedTexture=function(t,e,i,n,r,o,s,c,h,l,u,d){a.Texture.call(this,null,o,s,c,h,l,n,r,u,d),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1},a.CompressedTexture.prototype=Object.create(a.Texture.prototype),a.CompressedTexture.prototype.constructor=a.CompressedTexture,a.DataTexture=function(t,e,i,n,r,o,s,c,h,l,u,d){a.Texture.call(this,null,o,s,c,h,l,n,r,u,d),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:a.NearestFilter,this.minFilter=void 0!==l?l:a.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},a.DataTexture.prototype=Object.create(a.Texture.prototype),a.DataTexture.prototype.constructor=a.DataTexture,a.VideoTexture=function(t,e,i,n,r,o,s,c,h){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}a.Texture.call(this,t,e,i,n,r,o,s,c,h),this.generateMipmaps=!1;var u=this;l()},a.VideoTexture.prototype=Object.create(a.Texture.prototype),a.VideoTexture.prototype.constructor=a.VideoTexture,a.Group=function(){a.Object3D.call(this),this.type="Group"},a.Group.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Group}),a.Points=function(t,e){a.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new a.BufferGeometry,this.material=void 0!==e?e:new a.PointsMaterial({color:16777215*Math.random()})},a.Points.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Points,raycast:function(){var t=new a.Matrix4,e=new a.Ray,i=new a.Sphere;return function(n,r){function o(t,i){var a=e.distanceSqToPoint(t);if(a<d){var o=e.closestPointToPoint(t);o.applyMatrix4(h);var c=n.ray.origin.distanceTo(o);if(c<n.near||c>n.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:o.clone(),index:i,face:null,object:s})}}var s=this,c=this.geometry,h=this.matrixWorld,l=n.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(h),n.ray.intersectsSphere(i)!==!1){t.getInverse(h),e.copy(n.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new a.Vector3;if(c instanceof a.BufferGeometry){var f=c.index,m=c.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,x=v.length;y<x;y++){var b=v[y];p.fromArray(g,3*b),o(p,b)}else for(var y=0,_=g.length/3;y<_;y++)p.fromArray(g,3*y),o(p,y)}else for(var M=c.vertices,y=0,_=M.length;y<_;y++)o(M[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Line=function(t,e,i){return 1===i?new a.LineSegments(t,e):(a.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new a.BufferGeometry,void(this.material=void 0!==e?e:new a.LineBasicMaterial({color:16777215*Math.random()})))},a.Line.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Line,raycast:function(){var t=new a.Matrix4,e=new a.Ray,i=new a.Sphere;return function(n,r){var o=n.linePrecision,s=o*o,c=this.geometry,h=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(h),n.ray.intersectsSphere(i)!==!1){t.getInverse(h),e.copy(n.ray).applyMatrix4(t);var l=new a.Vector3,u=new a.Vector3,d=new a.Vector3,p=new a.Vector3,f=this instanceof a.LineSegments?2:1;if(c instanceof a.BufferGeometry){var m=c.index,g=c.attributes,v=g.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;x<b;x+=f){var _=y[x],M=y[x+1];l.fromArray(v,3*_),u.fromArray(v,3*M);var w=e.distanceSqToSegment(l,u,p,d);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);S<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=v.length/3-1;x<b;x+=f){l.fromArray(v,3*x),u.fromArray(v,3*x+3);var w=e.distanceSqToSegment(l,u,p,d);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);S<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(c instanceof a.Geometry)for(var T=c.vertices,L=T.length,x=0;x<L-1;x+=f){var w=e.distanceSqToSegment(T[x],T[x+1],p,d);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);S<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.LineSegments=function(t,e){a.Line.call(this,t,e),this.type="LineSegments"},a.LineSegments.prototype=Object.assign(Object.create(a.Line.prototype),{constructor:a.LineSegments}),a.Mesh=function(t,e){a.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new a.BufferGeometry,this.material=void 0!==e?e:new a.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=a.TrianglesDrawMode,this.updateMorphTargets()},a.Mesh.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Mesh,setDrawMode:function(t){this.drawMode=t},copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},getMorphTargetIndexByName:function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:0},raycast:function(){function t(t,e,i,n,r,o,s){return a.Triangle.barycoordFromPoint(t,e,i,n,g),r.multiplyScalar(g.x),o.multiplyScalar(g.y),s.multiplyScalar(g.z),r.add(o).add(s),r.clone()}function e(t,e,i,n,r,o,s){var c,h=t.material;if(c=h.side===a.BackSide?i.intersectTriangle(o,r,n,!0,s):i.intersectTriangle(n,r,o,h.side!==a.DoubleSide,s),null===c)return null;y.copy(s),y.applyMatrix4(t.matrixWorld);var l=e.ray.origin.distanceTo(y);return l<e.near||l>e.far?null:{distance:l,point:y.clone(),object:t}}function i(i,n,r,o,l,u,d,g){s.fromArray(o,3*u),c.fromArray(o,3*d),h.fromArray(o,3*g);var y=e(i,n,r,s,c,h,v);return y&&(l&&(p.fromArray(l,2*u),f.fromArray(l,2*d),m.fromArray(l,2*g),y.uv=t(v,s,c,h,p,f,m)),y.face=new a.Face3(u,d,g,a.Triangle.normal(s,c,h)),y.faceIndex=u),y}var n=new a.Matrix4,r=new a.Ray,o=new a.Sphere,s=new a.Vector3,c=new a.Vector3,h=new a.Vector3,l=new a.Vector3,u=new a.Vector3,d=new a.Vector3,p=new a.Vector2,f=new a.Vector2,m=new a.Vector2,g=new a.Vector3,v=new a.Vector3,y=new a.Vector3;return function(g,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),g.ray.intersectsSphere(o)!==!1&&(n.getInverse(_),r.copy(g.ray).applyMatrix4(n),null===x.boundingBox||r.intersectsBox(x.boundingBox)!==!1))){var M,w;if(x instanceof a.BufferGeometry){var S,T,L,A=x.index,C=x.attributes,E=C.position.array;if(void 0!==C.uv&&(M=C.uv.array),null!==A)for(var P=A.array,R=0,D=P.length;R<D;R+=3)S=P[R],T=P[R+1],L=P[R+2],w=i(this,g,r,E,M,S,T,L),w&&(w.faceIndex=Math.floor(R/3),y.push(w));else for(var R=0,D=E.length;R<D;R+=9)S=R/3,T=S+1,L=S+2,w=i(this,g,r,E,M,S,T,L),w&&(w.index=S,y.push(w))}else if(x instanceof a.Geometry){var I,O,B,U=b instanceof a.MultiMaterial,F=U===!0?b.materials:null,N=x.vertices,V=x.faces,G=x.faceVertexUvs[0];G.length>0&&(M=G);for(var z=0,k=V.length;z<k;z++){var j=V[z],W=U===!0?F[j.materialIndex]:b;if(void 0!==W){if(I=N[j.a],O=N[j.b],B=N[j.c],W.morphTargets===!0){var H=x.morphTargets,X=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),h.set(0,0,0);for(var Y=0,q=H.length;Y<q;Y++){var Z=X[Y];if(0!==Z){var K=H[Y].vertices;s.addScaledVector(l.subVectors(K[j.a],I),Z),c.addScaledVector(u.subVectors(K[j.b],O),Z),h.addScaledVector(d.subVectors(K[j.c],B),Z)}}s.add(I),c.add(O),h.add(B),I=s,O=c,B=h}if(w=e(this,g,r,I,O,B,v)){if(M){var Q=M[z];p.copy(Q[0]),f.copy(Q[1]),m.copy(Q[2]),w.uv=t(v,I,O,B,p,f,m)}w.face=j,w.faceIndex=z,y.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Bone=function(t){a.Object3D.call(this),this.type="Bone",this.skin=t},a.Bone.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Bone,copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this}}),a.Skeleton=function(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new a.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=a.Math.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new a.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,a.RGBAFormat,a.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{this.boneInverses=[];for(var r=0,o=this.bones.length;r<o;r++)this.boneInverses.push(new a.Matrix4)}},Object.assign(a.Skeleton.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new a.Matrix4;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var t,e=0,i=this.bones.length;e<i;e++)t=this.bones[e],t&&t.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,i=this.bones.length;e<i;e++)t=this.bones[e],t&&(t.parent instanceof a.Bone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new a.Matrix4;return function(){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(n,this.boneInverses[e]),t.toArray(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new a.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)}}),a.SkinnedMesh=function(t,e,i){a.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new a.Matrix4,this.bindMatrixInverse=new a.Matrix4;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,o,s=0,c=this.geometry.bones.length;s<c;++s)o=this.geometry.bones[s],r=new a.Bone(this),n.push(r),r.name=o.name,r.position.fromArray(o.pos),r.quaternion.fromArray(o.rotq),void 0!==o.scl&&r.scale.fromArray(o.scl);for(var s=0,c=this.geometry.bones.length;s<c;++s)o=this.geometry.bones[s],o.parent!==-1&&null!==o.parent&&void 0!==n[o.parent]?n[o.parent].add(n[s]):this.add(n[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new a.Skeleton(n,(void 0),i),this.matrixWorld)},a.SkinnedMesh.prototype=Object.assign(Object.create(a.Mesh.prototype),{constructor:a.SkinnedMesh,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry instanceof a.Geometry)for(var t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],i=1/e.lengthManhattan();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0)}else if(this.geometry instanceof a.BufferGeometry)for(var n=new a.Vector4,r=this.geometry.attributes.skinWeight,t=0;t<r.count;t++){n.x=r.getX(t),n.y=r.getY(t),n.z=r.getZ(t),n.w=r.getW(t);var i=1/n.lengthManhattan();i!==1/0?n.multiplyScalar(i):n.set(1,0,0,0),r.setXYZW(t,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){a.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode&&this.bindMatrixInverse.getInverse(this.bindMatrix)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}}),a.LOD=function(){a.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})},a.LOD.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.LOD,copy:function(t){a.Object3D.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:function(){var t=new a.Vector3;return function(e,i){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,i)}}(),update:function(){var t=new a.Vector3,e=new a.Vector3;return function(i){var n=this.levels;if(n.length>1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a<o&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;a<o;a++)n[a].object.visible=!1}}}(),toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var o=i[n];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),a.Sprite=function(t){a.Object3D.call(this),this.type="Sprite",this.material=void 0!==t?t:new a.SpriteMaterial},a.Sprite.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Sprite,raycast:function(){var t=new a.Vector3;return function(e,i){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.distanceSqToPoint(t),r=this.scale.x*this.scale.y/4;n>r||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),a.LensFlare=function(t,e,i,n,r){a.Object3D.call(this),this.lensFlares=[],this.positionScreen=new a.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)},a.LensFlare.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.LensFlare,copy:function(t){a.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,i=t.lensFlares.length;e<i;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,i,n,r,o){void 0===e&&(e=-1),void 0===i&&(i=0),void 0===o&&(o=1),void 0===r&&(r=new a.Color(16777215)),void 0===n&&(n=a.NormalBlending),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:t,size:e,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:r,blending:n})},updateLensFlares:function(){var t,e,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<i;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),a.Scene=function(){a.Object3D.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},a.Scene.prototype=Object.create(a.Object3D.prototype),a.Scene.prototype.constructor=a.Scene,a.Scene.prototype.copy=function(t,e){return a.Object3D.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},a.Fog=function(t,e,i){this.name="",this.color=new a.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3},a.Fog.prototype.clone=function(){return new a.Fog(this.color.getHex(),this.near,this.far)},a.FogExp2=function(t,e){this.name="",this.color=new a.Color(t),this.density=void 0!==e?e:25e-5},a.FogExp2.prototype.clone=function(){return new a.FogExp2(this.color.getHex(),this.density)},a.ShaderChunk={},a.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",a.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",a.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",a.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",a.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",a.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",a.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",a.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",a.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",a.ShaderChunk.clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n#endif\n",a.ShaderChunk.clipping_planes_pars_fragment="#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",a.ShaderChunk.clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",a.ShaderChunk.clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",a.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",a.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",a.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",a.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",a.ShaderChunk.common="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",a.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",a.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",a.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",a.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",a.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",a.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",a.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",
|
|
a.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",a.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",a.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",a.ShaderChunk.envmap_pars_vertex="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",a.ShaderChunk.envmap_vertex="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",a.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",a.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",a.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",a.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",a.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",a.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",a.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",a.ShaderChunk.lights_phong_pars_fragment="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",a.ShaderChunk.lights_physical_fragment="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",a.ShaderChunk.lights_physical_pars_fragment="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",a.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",a.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",a.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",a.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",a.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",a.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",a.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",a.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",a.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",a.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",a.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",a.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",a.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",a.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",a.ShaderChunk.normal_flip="#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",a.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",a.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",a.ShaderChunk.packing="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",a.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",a.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",a.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",a.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",a.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",
|
|
a.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",a.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",a.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",a.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",a.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",a.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",a.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",a.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",a.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",a.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",a.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",a.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",a.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",a.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",a.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",a.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",a.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",a.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",a.UniformsUtils={merge:function(t){for(var e={},i=0;i<t.length;i++){var n=this.clone(t[i]);for(var r in n)e[r]=n[r]}return e},clone:function(t){var e={};for(var i in t){e[i]={};for(var n in t[i]){var r=t[i][n];r instanceof a.Color||r instanceof a.Vector2||r instanceof a.Vector3||r instanceof a.Vector4||r instanceof a.Matrix3||r instanceof a.Matrix4||r instanceof a.Texture?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}},a.UniformsLib={common:{diffuse:{value:new a.Color(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a.Vector4(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new a.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new a.Color(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}}},points:{diffuse:{value:new a.Color(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a.Vector4(0,0,1,1)}}},a.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",a.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",a.ShaderChunk.depth_frag="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",a.ShaderChunk.depth_vert="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",a.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",a.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",a.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",a.ShaderChunk.linedashed_frag="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.meshbasic_vert="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n",a.ShaderChunk.meshlambert_frag="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.meshlambert_vert="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n",a.ShaderChunk.meshphong_frag="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.meshphong_vert="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n",a.ShaderChunk.meshphysical_frag="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.meshphysical_vert="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",a.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",a.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",a.ShaderChunk.shadow_frag="uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",a.ShaderChunk.shadow_vert="#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",a.ShaderLib={basic:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.fog]),vertexShader:a.ShaderChunk.meshbasic_vert,fragmentShader:a.ShaderChunk.meshbasic_frag},lambert:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)}}]),vertexShader:a.ShaderChunk.meshlambert_vert,fragmentShader:a.ShaderChunk.meshlambert_frag},phong:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.bumpmap,a.UniformsLib.normalmap,a.UniformsLib.displacementmap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)},specular:{value:new a.Color(1118481)},shininess:{value:30}}]),vertexShader:a.ShaderChunk.meshphong_vert,fragmentShader:a.ShaderChunk.meshphong_frag},standard:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.bumpmap,a.UniformsLib.normalmap,a.UniformsLib.displacementmap,a.UniformsLib.roughnessmap,a.UniformsLib.metalnessmap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:a.ShaderChunk.meshphysical_vert,fragmentShader:a.ShaderChunk.meshphysical_frag},points:{uniforms:a.UniformsUtils.merge([a.UniformsLib.points,a.UniformsLib.fog]),vertexShader:a.ShaderChunk.points_vert,fragmentShader:a.ShaderChunk.points_frag},dashed:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:a.ShaderChunk.linedashed_vert,fragmentShader:a.ShaderChunk.linedashed_frag},depth:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.displacementmap]),vertexShader:a.ShaderChunk.depth_vert,fragmentShader:a.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:a.ShaderChunk.normal_vert,fragmentShader:a.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:a.ShaderChunk.cube_vert,fragmentShader:a.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:a.ShaderChunk.equirect_vert,fragmentShader:a.ShaderChunk.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new a.Vector3}},vertexShader:a.ShaderChunk.distanceRGBA_vert,fragmentShader:a.ShaderChunk.distanceRGBA_frag}},a.ShaderLib.physical={uniforms:a.UniformsUtils.merge([a.ShaderLib.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:a.ShaderChunk.meshphysical_vert,fragmentShader:a.ShaderChunk.meshphysical_frag},a.WebGLRenderer=function(t){function e(){return null===et?ft:1}function i(t,e,i,n){j===!0&&(t*=n,e*=n,i*=n),Dt.clearColor(t,e,i,n)}function n(){Dt.init(),Dt.scissor(ot.copy(mt).multiplyScalar(ft)),Dt.viewport(ct.copy(vt).multiplyScalar(ft)),i(lt.r,lt.g,lt.b,ut)}function r(){tt=null,at=null,rt="",nt=-1,Dt.reset()}function o(t){t.preventDefault(),r(),n(),It.clear()}function s(t){var e=t.target;e.removeEventListener("dispose",s),c(e)}function c(t){h(t),It["delete"](t)}function h(t){var e=It.get(t).program;t.program=void 0,
|
|
void 0!==e&&Ut.releaseProgram(e)}function l(t,e,i,n){var r;if(!(i instanceof a.InstancedBufferGeometry&&(r=Pt.get("ANGLE_instanced_arrays"),null===r))){void 0===n&&(n=0),Dt.initAttributes();var o=i.attributes,s=e.getAttributes(),c=t.defaultAttributeValues;for(var h in s){var l=s[h];if(l>=0){var u=o[h];if(void 0!==u){var d=At.FLOAT,p=u.array,f=u.normalized;p instanceof Float32Array?d=At.FLOAT:p instanceof Float64Array||(p instanceof Uint16Array?d=At.UNSIGNED_SHORT:p instanceof Int16Array?d=At.SHORT:p instanceof Uint32Array?d=At.UNSIGNED_INT:p instanceof Int32Array?d=At.INT:p instanceof Int8Array?d=At.BYTE:p instanceof Uint8Array&&(d=At.UNSIGNED_BYTE));var m=u.itemSize,g=Bt.getAttributeBuffer(u);if(u instanceof a.InterleavedBufferAttribute){var v=u.data,y=v.stride,x=u.offset;v instanceof a.InstancedInterleavedBuffer?(Dt.enableAttributeAndDivisor(l,v.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):Dt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,g),At.vertexAttribPointer(l,m,d,f,y*v.array.BYTES_PER_ELEMENT,(n*y+x)*v.array.BYTES_PER_ELEMENT)}else u instanceof a.InstancedBufferAttribute?(Dt.enableAttributeAndDivisor(l,u.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=u.meshPerAttribute*u.count)):Dt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,g),At.vertexAttribPointer(l,m,d,f,0,n*m*u.array.BYTES_PER_ELEMENT)}else if(void 0!==c){var b=c[h];if(void 0!==b)switch(b.length){case 2:At.vertexAttrib2fv(l,b);break;case 3:At.vertexAttrib3fv(l,b);break;case 4:At.vertexAttrib4fv(l,b);break;default:At.vertexAttrib1fv(l,b)}}}}Dt.disableUnusedAttributes()}}function u(t,e){return Math.abs(e[0])-Math.abs(t[0])}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function p(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,i,n,r){var a,o;i.transparent?(a=q,o=++Z):(a=X,o=++Y);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=St.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:St.z,group:r},a.push(s))}function m(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Mt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),v(Mt)}function g(t){return Mt.center.set(0,0,0),Mt.radius=.7071067811865476,Mt.applyMatrix4(t.matrixWorld),v(Mt)}function v(t){if(!yt.intersectsSphere(t))return!1;var e=xt.numPlanes;if(0===e)return!0;var i=$.clippingPlanes,n=t.center,r=-t.radius,a=0;do if(i[a].distanceToPoint(n)<r)return!1;while(++a!==e);return!0}function y(t,e){if(t.visible!==!1){if(t.layers.test(e.layers))if(t instanceof a.Light)H.push(t);else if(t instanceof a.Sprite)t.frustumCulled!==!1&&g(t)!==!0||Q.push(t);else if(t instanceof a.LensFlare)J.push(t);else if(t instanceof a.ImmediateRenderObject)$.sortObjects===!0&&(St.setFromMatrixPosition(t.matrixWorld),St.applyProjection(wt)),f(t,null,t.material,St.z,null);else if((t instanceof a.Mesh||t instanceof a.Line||t instanceof a.Points)&&(t instanceof a.SkinnedMesh&&t.skeleton.update(),t.frustumCulled===!1||m(t)===!0)){var i=t.material;if(i.visible===!0){$.sortObjects===!0&&(St.setFromMatrixPosition(t.matrixWorld),St.applyProjection(wt));var n=Bt.update(t);if(i instanceof a.MultiMaterial)for(var r=n.groups,o=i.materials,s=0,c=r.length;s<c;s++){var h=r[s],l=o[h.materialIndex];l.visible===!0&&f(t,n,l,St.z,h)}else f(t,n,i,St.z,null)}}for(var u=t.children,s=0,c=u.length;s<c;s++)y(u[s],e)}}function x(t,e,i,n){for(var r=0,o=t.length;r<o;r++){var s=t[r],c=s.object,h=s.geometry,l=void 0===n?s.material:n,u=s.group;if(c.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,c.matrixWorld),c.normalMatrix.getNormalMatrix(c.modelViewMatrix),c instanceof a.ImmediateRenderObject){_(l);var d=M(e,i,l,c);rt="",c.render(function(t){$.renderBufferImmediate(t,d,l)})}else $.renderBufferDirect(e,i,h,l,c,u)}}function b(t,e,i){var n=It.get(t),r=Ut.getParameters(t,Tt,e,xt.numPlanes,i),o=Ut.getProgramCode(t,r),c=n.program,l=!0;if(void 0===c)t.addEventListener("dispose",s);else if(c.code!==o)h(t);else{if(void 0!==r.shaderID)return;l=!1}if(l){if(r.shaderID){var u=a.ShaderLib[r.shaderID];n.__webglShader={name:t.type,uniforms:a.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}else n.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=n.__webglShader,c=Ut.acquireProgram(t,r,o),n.program=c,t.program=c}var d=c.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var p=0;p<$.maxMorphTargets;p++)d["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p<$.maxMorphNormals;p++)d["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var f=n.__webglShader.uniforms;(t instanceof a.ShaderMaterial||t instanceof a.RawShaderMaterial)&&t.clipping!==!0||(n.numClippingPlanes=xt.numPlanes,f.clippingPlanes=xt.uniform),t.lights&&(n.lightsHash=Tt.hash,f.ambientLightColor.value=Tt.ambient,f.directionalLights.value=Tt.directional,f.spotLights.value=Tt.spot,f.pointLights.value=Tt.point,f.hemisphereLights.value=Tt.hemi,f.directionalShadowMap.value=Tt.directionalShadowMap,f.directionalShadowMatrix.value=Tt.directionalShadowMatrix,f.spotShadowMap.value=Tt.spotShadowMap,f.spotShadowMatrix.value=Tt.spotShadowMatrix,f.pointShadowMap.value=Tt.pointShadowMap,f.pointShadowMatrix.value=Tt.pointShadowMatrix);var m=n.program.getUniforms(),g=a.WebGLUniforms.seqWithValue(m.seq,f);n.uniformsList=g,n.dynamicUniforms=a.WebGLUniforms.splitDynamic(g,f)}function _(t){t.side!==a.DoubleSide?Dt.enable(At.CULL_FACE):Dt.disable(At.CULL_FACE),Dt.setFlipSided(t.side===a.BackSide),t.transparent===!0?Dt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Dt.setBlending(a.NoBlending),Dt.setDepthFunc(t.depthFunc),Dt.setDepthTest(t.depthTest),Dt.setDepthWrite(t.depthWrite),Dt.setColorWrite(t.colorWrite),Dt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function M(t,e,i,n){ht=0;var r=It.get(i);if(bt){if(_t||t!==at){var o=t===at&&i.id===nt;xt.setState(i.clippingPlanes,i.clipShadows,t,r,o)}void 0!==r.numClippingPlanes&&r.numClippingPlanes!==xt.numPlanes&&(i.needsUpdate=!0)}void 0===r.program&&(i.needsUpdate=!0),void 0!==r.lightsHash&&r.lightsHash!==Tt.hash&&(i.needsUpdate=!0),i.needsUpdate&&(b(i,e,n),i.needsUpdate=!1);var s=!1,c=!1,h=!1,l=r.program,u=l.getUniforms(),d=r.__webglShader.uniforms;if(l.id!==tt&&(At.useProgram(l.program),tt=l.id,s=!0,c=!0,h=!0),i.id!==nt&&(nt=i.id,c=!0),s||t!==at){if(u.set(At,t,"projectionMatrix"),Rt.logarithmicDepthBuffer&&u.setValue(At,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==at&&(at=t,c=!0,h=!0),i instanceof a.ShaderMaterial||i instanceof a.MeshPhongMaterial||i instanceof a.MeshStandardMaterial||i.envMap){var p=u.map.cameraPosition;void 0!==p&&p.setValue(At,St.setFromMatrixPosition(t.matrixWorld))}(i instanceof a.MeshPhongMaterial||i instanceof a.MeshLambertMaterial||i instanceof a.MeshBasicMaterial||i instanceof a.MeshStandardMaterial||i instanceof a.ShaderMaterial||i.skinning)&&u.setValue(At,"viewMatrix",t.matrixWorldInverse),u.set(At,$,"toneMappingExposure"),u.set(At,$,"toneMappingWhitePoint")}if(i.skinning){u.setOptional(At,n,"bindMatrix"),u.setOptional(At,n,"bindMatrixInverse");var f=n.skeleton;f&&(Rt.floatVertexTextures&&f.useVertexTexture?(u.set(At,f,"boneTexture"),u.set(At,f,"boneTextureWidth"),u.set(At,f,"boneTextureHeight")):u.setOptional(At,f,"boneMatrices"))}c&&(i.lights&&D(d,h),e&&i.fog&&A(d,e),(i instanceof a.MeshBasicMaterial||i instanceof a.MeshLambertMaterial||i instanceof a.MeshPhongMaterial||i instanceof a.MeshStandardMaterial||i instanceof a.MeshDepthMaterial)&&w(d,i),i instanceof a.LineBasicMaterial?S(d,i):i instanceof a.LineDashedMaterial?(S(d,i),T(d,i)):i instanceof a.PointsMaterial?L(d,i):i instanceof a.MeshLambertMaterial?C(d,i):i instanceof a.MeshPhongMaterial?E(d,i):i instanceof a.MeshPhysicalMaterial?R(d,i):i instanceof a.MeshStandardMaterial?P(d,i):i instanceof a.MeshDepthMaterial?i.displacementMap&&(d.displacementMap.value=i.displacementMap,d.displacementScale.value=i.displacementScale,d.displacementBias.value=i.displacementBias):i instanceof a.MeshNormalMaterial&&(d.opacity.value=i.opacity),a.WebGLUniforms.upload(At,r.uniformsList,d,$)),u.set(At,n,"modelViewMatrix"),u.set(At,n,"normalMatrix"),u.setValue(At,"modelMatrix",n.matrixWorld);var m=r.dynamicUniforms;return null!==m&&(a.WebGLUniforms.evalDynamic(m,d,n,t),a.WebGLUniforms.upload(At,m,d,$)),l}function w(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i instanceof a.WebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap instanceof a.CubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function T(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function L(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*ft,t.scale.value=.5*F.clientHeight,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function A(t,e){t.fogColor.value=e.color,e instanceof a.Fog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e instanceof a.FogExp2&&(t.fogDensity.value=e.density)}function C(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function E(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function P(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function R(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,P(t,e)}function D(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function I(t){for(var e=0,i=0,n=t.length;i<n;i++){var r=t[i];r.castShadow&&(Tt.shadows[e++]=r)}Tt.shadows.length=e}function O(t,e){var i,n,r,o,s,c,h,l=0,u=0,d=0,p=e.matrixWorldInverse,f=0,m=0,g=0,v=0;for(i=0,n=t.length;i<n;i++)if(r=t[i],o=r.color,s=r.intensity,c=r.distance,h=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r instanceof a.AmbientLight)l+=o.r*s,u+=o.g*s,d+=o.b*s;else if(r instanceof a.DirectionalLight){var y=Ft.get(r);y.color.copy(r.color).multiplyScalar(r.intensity),y.direction.setFromMatrixPosition(r.matrixWorld),St.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(St),y.direction.transformDirection(p),y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Tt.directionalShadowMap[f]=h,Tt.directionalShadowMatrix[f]=r.shadow.matrix,Tt.directional[f++]=y}else if(r instanceof a.SpotLight){var y=Ft.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(p),y.color.copy(o).multiplyScalar(s),y.distance=c,y.direction.setFromMatrixPosition(r.matrixWorld),St.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(St),y.direction.transformDirection(p),y.coneCos=Math.cos(r.angle),y.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Tt.spotShadowMap[g]=h,Tt.spotShadowMatrix[g]=r.shadow.matrix,Tt.spot[g++]=y}else if(r instanceof a.PointLight){var y=Ft.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(p),y.color.copy(r.color).multiplyScalar(r.intensity),y.distance=r.distance,y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Tt.pointShadowMap[m]=h,void 0===Tt.pointShadowMatrix[m]&&(Tt.pointShadowMatrix[m]=new a.Matrix4),St.setFromMatrixPosition(r.matrixWorld).negate(),Tt.pointShadowMatrix[m].identity().setPosition(St),Tt.point[m++]=y}else if(r instanceof a.HemisphereLight){var y=Ft.get(r);y.direction.setFromMatrixPosition(r.matrixWorld),y.direction.transformDirection(p),y.direction.normalize(),y.skyColor.copy(r.color).multiplyScalar(s),y.groundColor.copy(r.groundColor).multiplyScalar(s),Tt.hemi[v++]=y}Tt.ambient[0]=l,Tt.ambient[1]=u,Tt.ambient[2]=d,Tt.directional.length=f,Tt.spot.length=g,Tt.point.length=m,Tt.hemi.length=v,Tt.hash=f+","+m+","+g+","+v+","+Tt.shadows.length}function B(){var t=ht;return t>=Rt.maxTextures,ht+=1,t}function U(t){var e;if(t===a.RepeatWrapping)return At.REPEAT;if(t===a.ClampToEdgeWrapping)return At.CLAMP_TO_EDGE;if(t===a.MirroredRepeatWrapping)return At.MIRRORED_REPEAT;if(t===a.NearestFilter)return At.NEAREST;if(t===a.NearestMipMapNearestFilter)return At.NEAREST_MIPMAP_NEAREST;if(t===a.NearestMipMapLinearFilter)return At.NEAREST_MIPMAP_LINEAR;if(t===a.LinearFilter)return At.LINEAR;if(t===a.LinearMipMapNearestFilter)return At.LINEAR_MIPMAP_NEAREST;if(t===a.LinearMipMapLinearFilter)return At.LINEAR_MIPMAP_LINEAR;if(t===a.UnsignedByteType)return At.UNSIGNED_BYTE;if(t===a.UnsignedShort4444Type)return At.UNSIGNED_SHORT_4_4_4_4;if(t===a.UnsignedShort5551Type)return At.UNSIGNED_SHORT_5_5_5_1;if(t===a.UnsignedShort565Type)return At.UNSIGNED_SHORT_5_6_5;if(t===a.ByteType)return At.BYTE;if(t===a.ShortType)return At.SHORT;if(t===a.UnsignedShortType)return At.UNSIGNED_SHORT;if(t===a.IntType)return At.INT;if(t===a.UnsignedIntType)return At.UNSIGNED_INT;if(t===a.FloatType)return At.FLOAT;if(e=Pt.get("OES_texture_half_float"),null!==e&&t===a.HalfFloatType)return e.HALF_FLOAT_OES;if(t===a.AlphaFormat)return At.ALPHA;if(t===a.RGBFormat)return At.RGB;if(t===a.RGBAFormat)return At.RGBA;if(t===a.LuminanceFormat)return At.LUMINANCE;if(t===a.LuminanceAlphaFormat)return At.LUMINANCE_ALPHA;if(t===a.DepthFormat)return At.DEPTH_COMPONENT;if(t===a.AddEquation)return At.FUNC_ADD;if(t===a.SubtractEquation)return At.FUNC_SUBTRACT;if(t===a.ReverseSubtractEquation)return At.FUNC_REVERSE_SUBTRACT;if(t===a.ZeroFactor)return At.ZERO;if(t===a.OneFactor)return At.ONE;if(t===a.SrcColorFactor)return At.SRC_COLOR;if(t===a.OneMinusSrcColorFactor)return At.ONE_MINUS_SRC_COLOR;if(t===a.SrcAlphaFactor)return At.SRC_ALPHA;if(t===a.OneMinusSrcAlphaFactor)return At.ONE_MINUS_SRC_ALPHA;if(t===a.DstAlphaFactor)return At.DST_ALPHA;if(t===a.OneMinusDstAlphaFactor)return At.ONE_MINUS_DST_ALPHA;if(t===a.DstColorFactor)return At.DST_COLOR;if(t===a.OneMinusDstColorFactor)return At.ONE_MINUS_DST_COLOR;if(t===a.SrcAlphaSaturateFactor)return At.SRC_ALPHA_SATURATE;if(e=Pt.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===a.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===a.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===a.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===a.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=Pt.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===a.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===a.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===a.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===a.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=Pt.get("WEBGL_compressed_texture_etc1"),null!==e&&t===a.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=Pt.get("EXT_blend_minmax"),null!==e){if(t===a.MinEquation)return e.MIN_EXT;if(t===a.MaxEquation)return e.MAX_EXT}return 0}t=t||{};var F=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),N=void 0!==t.context?t.context:null,V=void 0!==t.alpha&&t.alpha,G=void 0===t.depth||t.depth,z=void 0===t.stencil||t.stencil,k=void 0!==t.antialias&&t.antialias,j=void 0===t.premultipliedAlpha||t.premultipliedAlpha,W=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,H=[],X=[],Y=-1,q=[],Z=-1,K=new Float32Array(8),Q=[],J=[];this.domElement=F,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=a.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var $=this,tt=null,et=null,it=null,nt=-1,rt="",at=null,ot=new a.Vector4,st=null,ct=new a.Vector4,ht=0,lt=new a.Color(0),ut=0,dt=F.width,pt=F.height,ft=1,mt=new a.Vector4(0,0,dt,pt),gt=!1,vt=new a.Vector4(0,0,dt,pt),yt=new a.Frustum,xt=new a.WebGLClipping,bt=!1,_t=!1,Mt=new a.Sphere,wt=new a.Matrix4,St=new a.Vector3,Tt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Lt={calls:0,vertices:0,faces:0,points:0};this.info={render:Lt,memory:{geometries:0,textures:0},programs:null};var At;try{var Ct={alpha:V,depth:G,stencil:z,antialias:k,premultipliedAlpha:j,preserveDrawingBuffer:W};if(At=N||F.getContext("webgl",Ct)||F.getContext("experimental-webgl",Ct),null===At)throw null!==F.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),F.addEventListener("webglcontextlost",o,!1)}catch(Et){}var Pt=new a.WebGLExtensions(At);Pt.get("WEBGL_depth_texture"),Pt.get("OES_texture_float"),Pt.get("OES_texture_float_linear"),Pt.get("OES_texture_half_float"),Pt.get("OES_texture_half_float_linear"),Pt.get("OES_standard_derivatives"),Pt.get("ANGLE_instanced_arrays"),Pt.get("OES_element_index_uint")&&(a.BufferGeometry.MaxIndex=4294967296);var Rt=new a.WebGLCapabilities(At,Pt,t),Dt=new a.WebGLState(At,Pt,U),It=new a.WebGLProperties,Ot=new a.WebGLTextures(At,Pt,Dt,It,Rt,U,this.info),Bt=new a.WebGLObjects(At,It,this.info),Ut=new a.WebGLPrograms(this,Rt),Ft=new a.WebGLLights;this.info.programs=Ut.programs;var Nt=new a.WebGLBufferRenderer(At,Pt,Lt),Vt=new a.WebGLIndexedBufferRenderer(At,Pt,Lt),Gt=new a.OrthographicCamera((-1),1,1,(-1),0,1),zt=new a.PerspectiveCamera,kt=new a.Mesh(new a.PlaneBufferGeometry(2,2),new a.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1})),jt=a.ShaderLib.cube,Wt=new a.Mesh(new a.BoxBufferGeometry(5,5,5),new a.ShaderMaterial({uniforms:jt.uniforms,vertexShader:jt.vertexShader,fragmentShader:jt.fragmentShader,side:a.BackSide,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=At,this.capabilities=Rt,this.extensions=Pt,this.properties=It,this.state=Dt;var Ht=new a.WebGLShadowMap(this,Tt,Bt,Rt);this.shadowMap=Ht;var Xt=new a.SpritePlugin(this,Q),Yt=new a.LensFlarePlugin(this,J);this.getContext=function(){return At},this.getContextAttributes=function(){return At.getContextAttributes()},this.forceContextLoss=function(){Pt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Rt.getMaxAnisotropy()},this.getPrecision=function(){return Rt.precision},this.getPixelRatio=function(){return ft},this.setPixelRatio=function(t){void 0!==t&&(ft=t,this.setSize(vt.z,vt.w,!1))},this.getSize=function(){return{width:dt,height:pt}},this.setSize=function(t,e,i){dt=t,pt=e,F.width=t*ft,F.height=e*ft,i!==!1&&(F.style.width=t+"px",F.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Dt.viewport(vt.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Dt.scissor(mt.set(t,e,i,n))},this.setScissorTest=function(t){Dt.setScissorTest(gt=t)},this.getClearColor=function(){return lt},this.setClearColor=function(t,e){lt.set(t),ut=void 0!==e?e:1,i(lt.r,lt.g,lt.b,ut)},this.getClearAlpha=function(){return ut},this.setClearAlpha=function(t){ut=t,i(lt.r,lt.g,lt.b,ut)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=At.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=At.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=At.STENCIL_BUFFER_BIT),At.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){q=[],Z=-1,X=[],Y=-1,F.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Dt.initAttributes();var n=It.get(t);t.hasPositions&&!n.position&&(n.position=At.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=At.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=At.createBuffer()),t.hasColors&&!n.color&&(n.color=At.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(At.bindBuffer(At.ARRAY_BUFFER,n.position),At.bufferData(At.ARRAY_BUFFER,t.positionArray,At.DYNAMIC_DRAW),Dt.enableAttribute(r.position),At.vertexAttribPointer(r.position,3,At.FLOAT,!1,0,0)),t.hasNormals){if(At.bindBuffer(At.ARRAY_BUFFER,n.normal),"MeshPhongMaterial"!==i.type&&"MeshStandardMaterial"!==i.type&&"MeshPhysicalMaterial"!==i.type&&i.shading===a.FlatShading)for(var o=0,s=3*t.count;o<s;o+=9){var c=t.normalArray,h=(c[o+0]+c[o+3]+c[o+6])/3,l=(c[o+1]+c[o+4]+c[o+7])/3,u=(c[o+2]+c[o+5]+c[o+8])/3;c[o+0]=h,c[o+1]=l,c[o+2]=u,c[o+3]=h,c[o+4]=l,c[o+5]=u,c[o+6]=h,c[o+7]=l,c[o+8]=u}At.bufferData(At.ARRAY_BUFFER,t.normalArray,At.DYNAMIC_DRAW),Dt.enableAttribute(r.normal),At.vertexAttribPointer(r.normal,3,At.FLOAT,!1,0,0)}t.hasUvs&&i.map&&(At.bindBuffer(At.ARRAY_BUFFER,n.uv),At.bufferData(At.ARRAY_BUFFER,t.uvArray,At.DYNAMIC_DRAW),Dt.enableAttribute(r.uv),At.vertexAttribPointer(r.uv,2,At.FLOAT,!1,0,0)),t.hasColors&&i.vertexColors!==a.NoColors&&(At.bindBuffer(At.ARRAY_BUFFER,n.color),At.bufferData(At.ARRAY_BUFFER,t.colorArray,At.DYNAMIC_DRAW),Dt.enableAttribute(r.color),At.vertexAttribPointer(r.color,3,At.FLOAT,!1,0,0)),Dt.disableUnusedAttributes(),At.drawArrays(At.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,i,n,r,o,s){_(r);var c=M(t,i,r,o),h=!1,d=n.id+"_"+c.id+"_"+r.wireframe;d!==rt&&(rt=d,h=!0);var p=o.morphTargetInfluences;if(void 0!==p){for(var f=[],m=0,g=p.length;m<g;m++){var v=p[m];f.push([v,m])}f.sort(u),f.length>8&&(f.length=8);for(var y=n.morphAttributes,m=0,g=f.length;m<g;m++){var v=f[m];if(K[m]=v[0],0!==v[0]){var x=v[1];r.morphTargets===!0&&y.position&&n.addAttribute("morphTarget"+m,y.position[x]),r.morphNormals===!0&&y.normal&&n.addAttribute("morphNormal"+m,y.normal[x])}else r.morphTargets===!0&&n.removeAttribute("morphTarget"+m),r.morphNormals===!0&&n.removeAttribute("morphNormal"+m)}c.getUniforms().setValue(At,"morphTargetInfluences",K),h=!0}var x=n.index,b=n.attributes.position;r.wireframe===!0&&(x=Bt.getWireframeAttribute(n));var w;null!==x?(w=Vt,w.setIndex(x)):w=Nt,h&&(l(r,c,n),null!==x&&At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,Bt.getAttributeBuffer(x)));var S=0,T=1/0;null!==x?T=x.count:void 0!==b&&(T=b.count);var L=n.drawRange.start,A=n.drawRange.count,C=null!==s?s.start:0,E=null!==s?s.count:1/0,P=Math.max(S,L,C),R=Math.min(S+T,L+A,C+E)-1,D=Math.max(0,R-P+1);if(o instanceof a.Mesh)if(r.wireframe===!0)Dt.setLineWidth(r.wireframeLinewidth*e()),w.setMode(At.LINES);else switch(o.drawMode){case a.TrianglesDrawMode:w.setMode(At.TRIANGLES);break;case a.TriangleStripDrawMode:w.setMode(At.TRIANGLE_STRIP);break;case a.TriangleFanDrawMode:w.setMode(At.TRIANGLE_FAN)}else if(o instanceof a.Line){var I=r.linewidth;void 0===I&&(I=1),Dt.setLineWidth(I*e()),o instanceof a.LineSegments?w.setMode(At.LINES):w.setMode(At.LINE_STRIP)}else o instanceof a.Points&&w.setMode(At.POINTS);n instanceof a.InstancedBufferGeometry?n.maxInstancedCount>0&&w.renderInstances(n,P,D):w.render(P,D)},this.render=function(t,e,n,r){if(e instanceof a.Camera!=!1){var o=t.fog;rt="",nt=-1,at=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),wt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),yt.setFromMatrix(wt),H.length=0,Y=-1,Z=-1,Q.length=0,J.length=0,_t=this.localClippingEnabled,bt=xt.init(this.clippingPlanes,_t,e),y(t,e),X.length=Y+1,q.length=Z+1,$.sortObjects===!0&&(X.sort(d),q.sort(p)),bt&&xt.beginShadows(),I(H),Ht.render(t,e),O(H,e),bt&&xt.endShadows(),Lt.calls=0,Lt.vertices=0,Lt.faces=0,Lt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var s=t.background;if(null===s?i(lt.r,lt.g,lt.b,ut):s instanceof a.Color&&i(s.r,s.g,s.b,1),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),s instanceof a.CubeTexture?(zt.projectionMatrix.copy(e.projectionMatrix),zt.matrixWorld.extractRotation(e.matrixWorld),zt.matrixWorldInverse.getInverse(zt.matrixWorld),Wt.material.uniforms.tCube.value=s,Wt.modelViewMatrix.multiplyMatrices(zt.matrixWorldInverse,Wt.matrixWorld),Bt.update(Wt),$.renderBufferDirect(zt,null,Wt.geometry,Wt.material,Wt,null)):s instanceof a.Texture&&(kt.material.map=s,Bt.update(kt),$.renderBufferDirect(Gt,null,kt.geometry,kt.material,kt,null)),t.overrideMaterial){var c=t.overrideMaterial;x(X,e,o,c),x(q,e,o,c)}else Dt.setBlending(a.NoBlending),x(X,e,o),x(q,e,o);Xt.render(t,e),Yt.render(t,e,ct),n&&Ot.updateRenderTargetMipmap(n),Dt.setDepthTest(!0),Dt.setDepthWrite(!0),Dt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){Dt.setCullFace(t),Dt.setFlipSided(e===a.FrontFaceDirectionCW)},this.allocTextureUnit=B,this.setTexture2D=function(){var t=!1;return function(e,i){e instanceof a.WebGLRenderTarget&&(t||(t=!0),e=e.texture),Ot.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(t=!0),Ot.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e instanceof a.WebGLRenderTargetCube&&(t||(t=!0),e=e.texture),e instanceof a.CubeTexture||Array.isArray(e.image)&&6===e.image.length?Ot.setTextureCube(e,i):Ot.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return et},this.setRenderTarget=function(t){et=t,t&&void 0===It.get(t).__webglFramebuffer&&Ot.setupRenderTarget(t);var e,i=t instanceof a.WebGLRenderTargetCube;if(t){var n=It.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ot.copy(t.scissor),st=t.scissorTest,ct.copy(t.viewport)}else e=null,ot.copy(mt).multiplyScalar(ft),st=gt,ct.copy(vt).multiplyScalar(ft);if(it!==e&&(At.bindFramebuffer(At.FRAMEBUFFER,e),it=e),Dt.scissor(ot),Dt.setScissorTest(st),Dt.viewport(ct),i){var r=It.get(t.texture);At.framebufferTexture2D(At.FRAMEBUFFER,At.COLOR_ATTACHMENT0,At.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,o){if(t instanceof a.WebGLRenderTarget!=!1){var s=It.get(t).__webglFramebuffer;if(s){var c=!1;s!==it&&(At.bindFramebuffer(At.FRAMEBUFFER,s),c=!0);try{var h=t.texture;if(h.format!==a.RGBAFormat&&U(h.format)!==At.getParameter(At.IMPLEMENTATION_COLOR_READ_FORMAT))return;if(!(h.type===a.UnsignedByteType||U(h.type)===At.getParameter(At.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===a.FloatType&&Pt.get("WEBGL_color_buffer_float")||h.type===a.HalfFloatType&&Pt.get("EXT_color_buffer_half_float")))return;At.checkFramebufferStatus(At.FRAMEBUFFER)===At.FRAMEBUFFER_COMPLETE&&e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&At.readPixels(e,i,n,r,U(h.format),U(h.type),o)}finally{c&&At.bindFramebuffer(At.FRAMEBUFFER,it)}}}}},a.WebGLRenderTarget=function(t,e,i){this.uuid=a.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new a.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new a.Vector4(0,0,t,e),i=i||{},void 0===i.minFilter&&(i.minFilter=a.LinearFilter),this.texture=new a.Texture((void 0),(void 0),i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=null},Object.assign(a.WebGLRenderTarget.prototype,a.EventDispatcher.prototype,{setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.WebGLRenderTargetCube=function(t,e,i){a.WebGLRenderTarget.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0},a.WebGLRenderTargetCube.prototype=Object.create(a.WebGLRenderTarget.prototype),a.WebGLRenderTargetCube.prototype.constructor=a.WebGLRenderTargetCube,a.WebGLBufferRenderer=function(t,e,i){function n(t){s=t}function r(e,n){t.drawArrays(s,e,n),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function o(n){var r=e.get("ANGLE_instanced_arrays");if(null!==r){var o=n.attributes.position,c=0;o instanceof a.InterleavedBufferAttribute?(c=o.data.count,r.drawArraysInstancedANGLE(s,0,c,n.maxInstancedCount)):(c=o.count,r.drawArraysInstancedANGLE(s,0,c,n.maxInstancedCount)),i.calls++,i.vertices+=c*n.maxInstancedCount,s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*c/3)}}var s;this.setMode=n,this.render=r,this.renderInstances=o},a.WebGLClipping=function(){function t(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),i.numPlanes=r}function e(t,e,n,r){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=l.value,r!==!0||null===o){var s=n+4*a,u=e.matrixWorldInverse;h.getNormalMatrix(u),(null===o||o.length<s)&&(o=new Float32Array(s));for(var d=0,p=n;d!==a;++d,p+=4)c.copy(t[d]).applyMatrix4(u,h),c.normal.toArray(o,p),o[p+3]=c.constant}l.value=o,l.needsUpdate=!0}return i.numPlanes=a,o}var i=this,n=null,r=0,o=!1,s=!1,c=new a.Plane,h=new a.Matrix3,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.init=function(t,i,a){var s=0!==t.length||i||0!==r||o;return o=i,n=e(t,a,0),r=t.length,s},this.beginShadows=function(){s=!0,e(null)},this.endShadows=function(){s=!1,t()},this.setState=function(i,a,c,h,u){if(!o||null===i||0===i.length||s&&!a)s?e(null):t();else{
|
|
var d=s?0:r,p=4*d,f=h.clippingState||null;l.value=f,f=e(i,c,p,u);for(var m=0;m!==p;++m)f[m]=n[m];h.clippingState=f,this.numPlanes+=d}}},a.WebGLIndexedBufferRenderer=function(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,h=4):(c=t.UNSIGNED_SHORT,h=2)}function a(e,n){t.drawElements(s,n,c,e*h),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function o(n,r,a){var o=e.get("ANGLE_instanced_arrays");null!==o&&(o.drawElementsInstancedANGLE(s,a,c,r*h,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3))}var s,c,h;this.setMode=n,this.setIndex=r,this.render=a,this.renderInstances=o},a.WebGLExtensions=function(t){var e={};this.get=function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return e[i]=n,n}},a.WebGLCapabilities=function(t,e,i){function n(){if(void 0!==a)return a;var i=e.get("EXT_texture_filter_anisotropic");return a=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a;this.getMaxAnisotropy=n,this.getMaxPrecision=r,this.precision=void 0!==i.precision?i.precision:"highp",this.logarithmicDepthBuffer=void 0!==i.logarithmicDepthBuffer&&i.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var o=r(this.precision);o!==this.precision&&(this.precision=o),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},a.WebGLGeometries=function(t,e,i){function n(t){var e=t.geometry;if(void 0!==l[e.id])return l[e.id];e.addEventListener("dispose",r);var n;return e instanceof a.BufferGeometry?n=e:e instanceof a.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new a.BufferGeometry).setFromObject(t)),n=e._bufferGeometry),l[e.id]=n,i.memory.geometries++,n}function r(t){var n=t.target,a=l[n.id];null!==a.index&&s(a.index),c(a.attributes),n.removeEventListener("dispose",r),delete l[n.id];var o=e.get(n);o.wireframe&&s(o.wireframe),e["delete"](n);var h=e.get(a);h.wireframe&&s(h.wireframe),e["delete"](a),i.memory.geometries--}function o(t){return t instanceof a.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function s(e){var i=o(e);void 0!==i&&(t.deleteBuffer(i),h(e))}function c(t){for(var e in t)s(t[e])}function h(t){t instanceof a.InterleavedBufferAttribute?e["delete"](t.data):e["delete"](t)}var l={};this.get=n},a.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new a.Vector3,color:new a.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"SpotLight":i={position:new a.Vector3,direction:new a.Vector3,color:new a.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"PointLight":i={position:new a.Vector3,color:new a.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"HemisphereLight":i={direction:new a.Vector3,skyColor:new a.Color,groundColor:new a.Color}}return t[e.id]=i,i}},a.WebGLObjects=function(t,e,i){function n(e){var i=u.get(e);e.geometry instanceof a.Geometry&&i.updateFromObject(e);var n=i.index,o=i.attributes;null!==n&&r(n,t.ELEMENT_ARRAY_BUFFER);for(var s in o)r(o[s],t.ARRAY_BUFFER);var c=i.morphAttributes;for(var s in c)for(var h=c[s],l=0,d=h.length;l<d;l++)r(h[l],t.ARRAY_BUFFER);return i}function r(t,i){var n=t instanceof a.InterleavedBufferAttribute?t.data:t,r=e.get(n);void 0===r.__webglBuffer?o(r,n,i):r.version!==n.version&&s(r,n,i)}function o(e,i,n){e.__webglBuffer=t.createBuffer(),t.bindBuffer(n,e.__webglBuffer);var r=i.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(n,i.array,r),e.version=i.version}function s(e,i,n){t.bindBuffer(n,e.__webglBuffer),i.dynamic===!1||i.updateRange.count===-1?t.bufferSubData(n,0,i.array):0===i.updateRange.count||(t.bufferSubData(n,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),e.version=i.version}function c(t){return t instanceof a.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function h(i){var n=e.get(i);if(void 0!==n.wireframe)return n.wireframe;var o=[],s=i.index,c=i.attributes,h=c.position;if(null!==s)for(var u={},d=s.array,p=0,f=d.length;p<f;p+=3){var m=d[p+0],g=d[p+1],v=d[p+2];l(u,m,g)&&o.push(m,g),l(u,g,v)&&o.push(g,v),l(u,v,m)&&o.push(v,m)}else for(var d=c.position.array,p=0,f=d.length/3-1;p<f;p+=3){var m=p+0,g=p+1,v=p+2;o.push(m,g,g,v,v,m)}var y=h.count>65535?Uint32Array:Uint16Array,x=new a.BufferAttribute(new y(o),1);return r(x,t.ELEMENT_ARRAY_BUFFER),n.wireframe=x,x}function l(t,e,i){if(e>i){var n=e;e=i,i=n}var r=t[e];return void 0===r?(t[e]=[i],!0):r.indexOf(i)===-1&&(r.push(i),!0)}var u=new a.WebGLGeometries(t,e,i);this.getAttributeBuffer=c,this.getWireframeAttribute=h,this.update=n},a.WebGLProgram=function(){function t(t){switch(t){case a.LinearEncoding:return["Linear","( value )"];case a.sRGBEncoding:return["sRGB","( value )"];case a.RGBEEncoding:return["RGBE","( value )"];case a.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case a.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case a.RGBDEncoding:return["RGBD","( value, 256.0 )"];case a.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function e(e,i){var n=t(i);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function i(e,i){var n=t(i);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function n(t,e){var i;switch(e){case a.LinearToneMapping:i="Linear";break;case a.ReinhardToneMapping:i="Reinhard";break;case a.Uncharted2ToneMapping:i="Uncharted2";break;case a.CineonToneMapping:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function r(t,e,i){t=t||{};var n=[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return n.filter(c).join("\n")}function o(t){var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")}function s(t,e,i){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<r;a++){var o=t.getActiveAttrib(e,a),s=o.name;n[s]=t.getAttribLocation(e,s)}return n}function c(t){return""!==t}function h(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function l(t){function e(t,e){var i=a.ShaderChunk[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return l(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function u(t){function e(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(i,e)}var d=0;return function(t,p,f,m){var g=t.context,v=f.extensions,y=f.defines,x=f.__webglShader.vertexShader,b=f.__webglShader.fragmentShader,_="SHADOWMAP_TYPE_BASIC";m.shadowMapType===a.PCFShadowMap?_="SHADOWMAP_TYPE_PCF":m.shadowMapType===a.PCFSoftShadowMap&&(_="SHADOWMAP_TYPE_PCF_SOFT");var M="ENVMAP_TYPE_CUBE",w="ENVMAP_MODE_REFLECTION",S="ENVMAP_BLENDING_MULTIPLY";if(m.envMap){switch(f.envMap.mapping){case a.CubeReflectionMapping:case a.CubeRefractionMapping:M="ENVMAP_TYPE_CUBE";break;case a.CubeUVReflectionMapping:case a.CubeUVRefractionMapping:M="ENVMAP_TYPE_CUBE_UV";break;case a.EquirectangularReflectionMapping:case a.EquirectangularRefractionMapping:M="ENVMAP_TYPE_EQUIREC";break;case a.SphericalReflectionMapping:M="ENVMAP_TYPE_SPHERE"}switch(f.envMap.mapping){case a.CubeRefractionMapping:case a.EquirectangularRefractionMapping:w="ENVMAP_MODE_REFRACTION"}switch(f.combine){case a.MultiplyOperation:S="ENVMAP_BLENDING_MULTIPLY";break;case a.MixOperation:S="ENVMAP_BLENDING_MIX";break;case a.AddOperation:S="ENVMAP_BLENDING_ADD"}}var T,L,A=t.gammaFactor>0?t.gammaFactor:1,C=r(v,m,t.extensions),E=o(y),P=g.createProgram();f instanceof a.RawShaderMaterial?(T=[E].filter(c).join("\n"),L=[E].filter(c).join("\n")):(T=["precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+f.__webglShader.name,E,m.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+A,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+w:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.displacementMap&&m.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.skinning?"#define USE_SKINNING":"",m.useVertexTexture?"#define BONE_TEXTURE":"",m.morphTargets?"#define USE_MORPHTARGETS":"",m.morphNormals&&m.flatShading===!1?"#define USE_MORPHNORMALS":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+m.numClippingPlanes,m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+_:"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(c).join("\n"),L=[C,"precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+f.__webglShader.name,E,m.alphaTest?"#define ALPHATEST "+m.alphaTest:"","#define GAMMA_FACTOR "+A,m.useFog&&m.fog?"#define USE_FOG":"",m.useFog&&m.fogExp?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+M:"",m.envMap?"#define "+w:"",m.envMap?"#define "+S:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+m.numClippingPlanes,m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+_:"",m.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",m.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",m.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",m.toneMapping!==a.NoToneMapping?"#define TONE_MAPPING":"",m.toneMapping!==a.NoToneMapping?a.ShaderChunk.tonemapping_pars_fragment:"",m.toneMapping!==a.NoToneMapping?n("toneMapping",m.toneMapping):"",m.outputEncoding||m.mapEncoding||m.envMapEncoding||m.emissiveMapEncoding?a.ShaderChunk.encodings_pars_fragment:"",m.mapEncoding?e("mapTexelToLinear",m.mapEncoding):"",m.envMapEncoding?e("envMapTexelToLinear",m.envMapEncoding):"",m.emissiveMapEncoding?e("emissiveMapTexelToLinear",m.emissiveMapEncoding):"",m.outputEncoding?i("linearToOutputTexel",m.outputEncoding):"",m.depthPacking?"#define DEPTH_PACKING "+f.depthPacking:"","\n"].filter(c).join("\n")),x=l(x,m),x=h(x,m),b=l(b,m),b=h(b,m),f instanceof a.ShaderMaterial==!1&&(x=u(x),b=u(b));var R=T+x,D=L+b,I=a.WebGLShader(g,g.VERTEX_SHADER,R),O=a.WebGLShader(g,g.FRAGMENT_SHADER,D);g.attachShader(P,I),g.attachShader(P,O),void 0!==f.index0AttributeName?g.bindAttribLocation(P,0,f.index0AttributeName):m.morphTargets===!0&&g.bindAttribLocation(P,0,"position"),g.linkProgram(P);var B=g.getProgramInfoLog(P),U=g.getShaderInfoLog(I),F=g.getShaderInfoLog(O),N=!0,V=!0;g.getProgramParameter(P,g.LINK_STATUS)===!1?N=!1:""!==B||""!==U&&""!==F||(V=!1),V&&(this.diagnostics={runnable:N,material:f,programLog:B,vertexShader:{log:U,prefix:T},fragmentShader:{log:F,prefix:L}}),g.deleteShader(I),g.deleteShader(O);var G;this.getUniforms=function(){return void 0===G&&(G=new a.WebGLUniforms(g,P,t)),G};var z;return this.getAttributes=function(){return void 0===z&&(z=s(g,P)),z},this.destroy=function(){g.deleteProgram(P),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return this.getUniforms()}},attributes:{get:function(){return this.getAttributes()}}}),this.id=d++,this.code=p,this.usedTimes=1,this.program=P,this.vertexShader=I,this.fragmentShader=O,this}}(),a.WebGLPrograms=function(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t instanceof a.SkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r<t.skeleton.bones.length),r}function n(t,e){var i;return t?t instanceof a.Texture?i=t.encoding:t instanceof a.WebGLRenderTarget&&(i=t.texture.encoding):i=a.LinearEncoding,i===a.LinearEncoding&&e&&(i=a.GammaEncoding),i}var r=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","depthPacking"];this.getParameters=function(r,s,c,h,l){var u=o[r.type],d=i(l),p=t.getPrecision();null!==r.precision&&(p=e.getMaxPrecision(r.precision),p!==r.precision);var f=t.getCurrentRenderTarget(),m={shaderID:u,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:n(f?f.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:n(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===a.CubeUVReflectionMapping||r.envMap.mapping===a.CubeUVRefractionMapping),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!c,useFog:r.fog,fogExp:c instanceof a.FogExp2,flatShading:r.shading===a.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:d,useVertexTexture:e.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numHemiLights:s.hemi.length,numClippingPlanes:h,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&s.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===a.DoubleSide,flipSided:r.side===a.BackSide,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return m},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r<s.length;r++)i.push(e[s[r]]);return i.join()},this.acquireProgram=function(e,i,n){for(var o,s=0,c=r.length;s<c;s++){var h=r[s];if(h.code===n){o=h,++o.usedTimes;break}}return void 0===o&&(o=new a.WebGLProgram(t,n,e,i),r.push(o)),o},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r},a.WebGLProperties=function(){var t={};this.get=function(e){var i=e.uuid,n=t[i];return void 0===n&&(n={},t[i]=n),n},this["delete"]=function(e){delete t[e.uuid]},this.clear=function(){t={}}},a.WebGLShader=function(){return function(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)===!1,""!==t.getShaderInfoLog(n),n}}(),a.WebGLShadowMap=function(t,e,i,n){function r(e,i,n,r){var o=e.geometry,s=null,c=b,h=e.customDepthMaterial;if(n&&(c=_,h=e.customDistanceMaterial),h)s=h;else{var l=!1;i.morphTargets&&(o instanceof a.BufferGeometry?l=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o instanceof a.Geometry&&(l=o.morphTargets&&o.morphTargets.length>0));var u=e instanceof a.SkinnedMesh&&i.skinning,d=0;l&&(d|=v),u&&(d|=y),s=c[d]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var p=s.uuid,f=i.uuid,m=M[p];void 0===m&&(m={},M[p]=m);var g=m[f];void 0===g&&(g=s.clone(),m[f]=g),s=g}s.visible=i.visible,s.wireframe=i.wireframe;var x=i.side;return O.renderSingleSided&&x==a.DoubleSide&&(x=a.FrontSide),O.renderReverseSided&&(x===a.FrontSide?x=a.BackSide:x===a.BackSide&&(x=a.FrontSide)),s.side=x,s.clipShadows=i.clipShadows,s.clippingPlanes=i.clippingPlanes,s.wireframeLinewidth=i.wireframeLinewidth,s.linewidth=i.linewidth,n&&void 0!==s.uniforms.lightPos&&s.uniforms.lightPos.value.copy(r),s}function o(t,e,i){if(t.visible!==!1){if(t.layers.test(e.layers)&&(t instanceof a.Mesh||t instanceof a.Line||t instanceof a.Points)&&t.castShadow&&(t.frustumCulled===!1||h.intersectsObject(t)===!0)){var n=t.material;n.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),g.push(t))}for(var r=t.children,s=0,c=r.length;s<c;s++)o(r[s],e,i)}}var s=t.context,c=t.state,h=new a.Frustum,l=new a.Matrix4,u=e.shadows,d=new a.Vector2,p=new a.Vector2(n.maxTextureSize,n.maxTextureSize),f=new a.Vector3,m=new a.Vector3,g=[],v=1,y=2,x=(v|y)+1,b=new Array(x),_=new Array(x),M={},w=[new a.Vector3(1,0,0),new a.Vector3((-1),0,0),new a.Vector3(0,0,1),new a.Vector3(0,0,(-1)),new a.Vector3(0,1,0),new a.Vector3(0,(-1),0)],S=[new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,0,1),new a.Vector3(0,0,(-1))],T=[new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4],L=new a.MeshDepthMaterial;L.depthPacking=a.RGBADepthPacking,L.clipping=!0;for(var A=a.ShaderLib.distanceRGBA,C=a.UniformsUtils.clone(A.uniforms),E=0;E!==x;++E){var P=0!==(E&v),R=0!==(E&y),D=L.clone();D.morphTargets=P,D.skinning=R,b[E]=D;var I=new a.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:A.vertexShader,fragmentShader:A.fragmentShader,morphTargets:P,skinning:R,clipping:!0});_[E]=I}var O=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=a.PCFShadowMap,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,n){if(O.enabled!==!1&&(O.autoUpdate!==!1||O.needsUpdate!==!1)&&0!==u.length){c.clearColor(1,1,1,1),c.disable(s.BLEND),c.setDepthTest(!0),c.setScissorTest(!1);for(var v,y,x=0,b=u.length;x<b;x++){var _=u[x],M=_.shadow;if(void 0!==M){var L=M.camera;if(d.copy(M.mapSize),d.min(p),_ instanceof a.PointLight){v=6,y=!0;var A=d.x,C=d.y;T[0].set(2*A,C,A,C),T[1].set(0,C,A,C),T[2].set(3*A,C,A,C),T[3].set(A,C,A,C),T[4].set(3*A,0,A,C),T[5].set(A,0,A,C),d.x*=4,d.y*=2}else v=1,y=!1;if(null===M.map){var E={minFilter:a.NearestFilter,magFilter:a.NearestFilter,format:a.RGBAFormat};M.map=new a.WebGLRenderTarget(d.x,d.y,E),L.updateProjectionMatrix()}M instanceof a.SpotLightShadow&&M.update(_);var P=M.map,R=M.matrix;m.setFromMatrixPosition(_.matrixWorld),L.position.copy(m),t.setRenderTarget(P),t.clear();for(var D=0;D<v;D++){if(y){f.copy(L.position),f.add(w[D]),L.up.copy(S[D]),L.lookAt(f);var I=T[D];c.viewport(I)}else f.setFromMatrixPosition(_.target.matrixWorld),L.lookAt(f);L.updateMatrixWorld(),L.matrixWorldInverse.getInverse(L.matrixWorld),R.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),R.multiply(L.projectionMatrix),R.multiply(L.matrixWorldInverse),l.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),h.setFromMatrix(l),g.length=0,o(e,n,L);for(var B=0,U=g.length;B<U;B++){var F=g[B],N=i.update(F),V=F.material;if(V instanceof a.MultiMaterial)for(var G=N.groups,z=V.materials,k=0,j=G.length;k<j;k++){var W=G[k],H=z[W.materialIndex];if(H.visible===!0){var X=r(F,H,y,m);t.renderBufferDirect(L,null,N,X,F,W)}}else{var X=r(F,V,y,m);t.renderBufferDirect(L,null,N,X,F,null)}}}}}var Y=t.getClearColor(),q=t.getClearAlpha();t.setClearColor(Y,q),O.needsUpdate=!1}}},a.WebGLState=function(t,e,i){function n(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var o=0;o<n;o++)t.texImage2D(i+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}var r=this;this.buffers={color:new a.WebGLColorBuffer(t,this),depth:new a.WebGLDepthBuffer(t,this),stencil:new a.WebGLStencilBuffer(t,this)};var o=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(o),c=new Uint8Array(o),h=new Uint8Array(o),l={},u=null,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=!1,b=null,_=null,M=null,w=null,S=null,T=null,L=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),A=null,C={},E=new a.Vector4,P=new a.Vector4,R={};R[t.TEXTURE_2D]=n(t.TEXTURE_2D,t.TEXTURE_2D,1),R[t.TEXTURE_CUBE_MAP]=n(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),this.setDepthFunc(a.LessEqualDepth),this.setFlipSided(!1),this.setCullFace(a.CullFaceBack),this.enable(t.CULL_FACE),this.enable(t.BLEND),this.setBlending(a.NormalBlending)},this.initAttributes=function(){for(var t=0,e=s.length;t<e;t++)s[t]=0},this.enableAttribute=function(i){if(s[i]=1,0===c[i]&&(t.enableVertexAttribArray(i),c[i]=1),0!==h[i]){var n=e.get("ANGLE_instanced_arrays");n.vertexAttribDivisorANGLE(i,0),h[i]=0}},this.enableAttributeAndDivisor=function(e,i,n){s[e]=1,0===c[e]&&(t.enableVertexAttribArray(e),c[e]=1),h[e]!==i&&(n.vertexAttribDivisorANGLE(e,i),h[e]=i)},this.disableUnusedAttributes=function(){for(var e=0,i=c.length;e!==i;++e)c[e]!==s[e]&&(t.disableVertexAttribArray(e),c[e]=0)},this.enable=function(e){l[e]!==!0&&(t.enable(e),l[e]=!0)},this.disable=function(e){l[e]!==!1&&(t.disable(e),l[e]=!1)},this.getCompressedTextureFormats=function(){if(null===u&&(u=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var i=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),n=0;n<i.length;n++)u.push(i[n]);return u},this.setBlending=function(e,n,r,o,s,c,h,l){return e===a.NoBlending?(this.disable(t.BLEND),void(d=e)):(this.enable(t.BLEND),e===d&&l===x||(e===a.AdditiveBlending?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===a.SubtractiveBlending?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===a.MultiplyBlending?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),d=e,x=l),void(e===a.CustomBlending?(s=s||n,c=c||r,h=h||o,n===p&&s===g||(t.blendEquationSeparate(i(n),i(s)),p=n,g=s),r===f&&o===m&&c===v&&h===y||(t.blendFuncSeparate(i(r),i(o),i(c),i(h)),f=r,m=o,v=c,y=h)):(p=null,f=null,m=null,g=null,v=null,y=null)))},this.setColorWrite=function(t){this.buffers.color.setMask(t)},this.setDepthTest=function(t){this.buffers.depth.setTest(t)},this.setDepthWrite=function(t){this.buffers.depth.setMask(t)},this.setDepthFunc=function(t){this.buffers.depth.setFunc(t)},this.setStencilTest=function(t){this.buffers.stencil.setTest(t)},this.setStencilWrite=function(t){this.buffers.stencil.setMask(t)},this.setStencilFunc=function(t,e,i){this.buffers.stencil.setFunc(t,e,i)},this.setStencilOp=function(t,e,i){this.buffers.stencil.setOp(t,e,i)},this.setFlipSided=function(e){b!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),b=e)},this.setCullFace=function(e){e!==a.CullFaceNone?(this.enable(t.CULL_FACE),e!==_&&(e===a.CullFaceBack?t.cullFace(t.BACK):e===a.CullFaceFront?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),_=e},this.setLineWidth=function(e){e!==M&&(t.lineWidth(e),M=e)},this.setPolygonOffset=function(e,i,n){e?(this.enable(t.POLYGON_OFFSET_FILL),w===i&&S===n||(t.polygonOffset(i,n),w=i,S=n)):this.disable(t.POLYGON_OFFSET_FILL)},this.getScissorTest=function(){return T},this.setScissorTest=function(e){T=e,e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+L-1),A!==e&&(t.activeTexture(e),A=e)},this.bindTexture=function(e,i){null===A&&r.activeTexture();var n=C[A];void 0===n&&(n={type:void 0,texture:void 0},C[A]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||R[e]),n.type=e,n.texture=i)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(e){}},this.clearColor=function(t,e,i,n){this.buffers.color.setClear(t,e,i,n)},this.clearDepth=function(t){this.buffers.depth.setClear(t)},this.clearStencil=function(t){this.buffers.stencil.setClear(t)},this.scissor=function(e){E.equals(e)===!1&&(t.scissor(e.x,e.y,e.z,e.w),E.copy(e))},this.viewport=function(e){P.equals(e)===!1&&(t.viewport(e.x,e.y,e.z,e.w),P.copy(e))},this.reset=function(){for(var e=0;e<c.length;e++)1===c[e]&&(t.disableVertexAttribArray(e),c[e]=0);l={},u=null,A=null,C={},d=null,b=null,_=null,this.buffers.color.reset(),this.buffers.depth.reset(),this.buffers.stencil.reset()}},a.WebGLColorBuffer=function(t,e){var i=!1,n=new a.Vector4,r=null,o=new a.Vector4;this.setMask=function(e){r===e||i||(t.colorMask(e,e,e,e),r=e)},this.setLocked=function(t){i=t},this.setClear=function(e,i,r,a){n.set(e,i,r,a),o.equals(n)===!1&&(t.clearColor(e,i,r,a),o.copy(n))},this.reset=function(){i=!1,r=null,o=new a.Vector4}},a.WebGLDepthBuffer=function(t,e){var i=!1,n=null,r=null,o=null;this.setTest=function(i){i?e.enable(t.DEPTH_TEST):e.disable(t.DEPTH_TEST)},this.setMask=function(e){n===e||i||(t.depthMask(e),n=e)},this.setFunc=function(e){if(r!==e){if(e)switch(e){case a.NeverDepth:t.depthFunc(t.NEVER);break;case a.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case a.LessDepth:t.depthFunc(t.LESS);break;case a.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case a.EqualDepth:t.depthFunc(t.EQUAL);break;case a.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case a.GreaterDepth:t.depthFunc(t.GREATER);break;case a.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},this.setLocked=function(t){i=t},this.setClear=function(e){o!==e&&(t.clearDepth(e),o=e)},this.reset=function(){i=!1,n=null,r=null,o=null}},a.WebGLStencilBuffer=function(t,e){var i=!1,n=null,r=null,a=null,o=null,s=null,c=null,h=null,l=null;this.setTest=function(i){i?e.enable(t.STENCIL_TEST):e.disable(t.STENCIL_TEST)},this.setMask=function(e){n===e||i||(t.stencilMask(e),n=e)},this.setFunc=function(e,i,n){r===e&&a===i&&o===n||(t.stencilFunc(e,i,n),r=e,a=i,o=n)},this.setOp=function(e,i,n){s===e&&c===i&&h===n||(t.stencilOp(e,i,n),s=e,c=i,h=n)},this.setLocked=function(t){i=t},this.setClear=function(e){l!==e&&(t.clearStencil(e),l=e)},this.reset=function(){i=!1,n=null,r=null,a=null,o=null,s=null,c=null,h=null,l=null}},a.WebGLTextures=function(t,e,i,n,r,o,s){function c(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");
|
|
n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),n}return t}function h(t){return a.Math.isPowerOfTwo(t.width)&&a.Math.isPowerOfTwo(t.height)}function l(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=a.Math.nearestPowerOfTwo(t.width),e.height=a.Math.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),e}return t}function u(t){return t.wrapS!==a.ClampToEdgeWrapping||t.wrapT!==a.ClampToEdgeWrapping||t.minFilter!==a.NearestFilter&&t.minFilter!==a.LinearFilter}function d(e){return e===a.NearestFilter||e===a.NearestMipMapNearestFilter||e===a.NearestMipMapLinearFilter?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),m(e),C.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),g(e),C.textures--}function m(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n["delete"](e)}function g(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e instanceof a.WebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n["delete"](e.texture),n["delete"](e)}}function v(e,r){var a=n.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o);else if(o.complete!==!1)return void _(a,e,r)}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function y(e,s){var l=n.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",p),l.__image__webglTextureCube=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var u=e instanceof a.CompressedTexture,d=e.image[0]instanceof a.DataTexture,f=[],m=0;m<6;m++)u||d?f[m]=d?e.image[m].image:e.image[m]:f[m]=c(e.image[m],r.maxCubemapSize);var g=f[0],v=h(g),y=o(e.format),x=o(e.type);b(t.TEXTURE_CUBE_MAP,e,v);for(var m=0;m<6;m++)if(u)for(var _,M=f[m].mipmaps,w=0,S=M.length;w<S;w++)_=M[w],e.format!==a.RGBAFormat&&e.format!==a.RGBFormat?i.getCompressedTextureFormats().indexOf(y)>-1&&i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,_.width,_.height,0,_.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,_.width,_.height,0,y,x,_.data);else d?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,f[m].width,f[m].height,0,y,x,f[m].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,x,f[m]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function x(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function b(i,s,c){var h;if(c?(t.texParameteri(i,t.TEXTURE_WRAP_S,o(s.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,o(s.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,o(s.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,o(s.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),s.wrapS!==a.ClampToEdgeWrapping||s.wrapT!==a.ClampToEdgeWrapping,t.texParameteri(i,t.TEXTURE_MAG_FILTER,d(s.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,d(s.minFilter)),s.minFilter!==a.NearestFilter&&s.minFilter!==a.LinearFilter),h=e.get("EXT_texture_filter_anisotropic")){if(s.type===a.FloatType&&null===e.get("OES_texture_float_linear"))return;if(s.type===a.HalfFloatType&&null===e.get("OES_texture_half_float_linear"))return;(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(t.texParameterf(i,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function _(e,n,s){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var d=c(n.image,r.maxTextureSize);u(n)&&h(d)===!1&&(d=l(d));var f=h(d),m=o(n.format),g=o(n.type);b(t.TEXTURE_2D,n,f);var v,y=n.mipmaps;if(n instanceof a.DepthTexture){var x=t.DEPTH_COMPONENT;if(n.type===a.FloatType){if(!E)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else E&&(x=t.DEPTH_COMPONENT16);i.texImage2D(t.TEXTURE_2D,0,x,d.width,d.height,0,m,g,null)}else if(n instanceof a.DataTexture)if(y.length>0&&f){for(var _=0,M=y.length;_<M;_++)v=y[_],i.texImage2D(t.TEXTURE_2D,_,m,v.width,v.height,0,m,g,v.data);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,m,d.width,d.height,0,m,g,d.data);else if(n instanceof a.CompressedTexture)for(var _=0,M=y.length;_<M;_++)v=y[_],n.format!==a.RGBAFormat&&n.format!==a.RGBFormat?i.getCompressedTextureFormats().indexOf(m)>-1&&i.compressedTexImage2D(t.TEXTURE_2D,_,m,v.width,v.height,0,v.data):i.texImage2D(t.TEXTURE_2D,_,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&f){for(var _=0,M=y.length;_<M;_++)v=y[_],i.texImage2D(t.TEXTURE_2D,_,m,m,g,v);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,m,m,g,d);n.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function M(e,r,a,s){var c=o(r.texture.format),h=o(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function S(e,i){var r=i instanceof a.WebGLRenderTargetCube;if(r)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!(i.depthTexture instanceof a.DepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),v(i.depthTexture,0);var o=n.get(i.depthTexture).__webglTexture;t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0)}function T(e){var i=n.get(e),r=e instanceof a.WebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");S(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),w(i.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function L(e){var r=n.get(e),o=n.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),C.textures++;var s=e instanceof a.WebGLRenderTargetCube,c=h(e);if(s){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,c);for(var l=0;l<6;l++)M(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,c),M(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&T(e)}function A(e){var r=e.texture;if(r.generateMipmaps&&h(e)&&r.minFilter!==a.NearestFilter&&r.minFilter!==a.LinearFilter){var o=e instanceof a.WebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,s=n.get(r).__webglTexture;i.bindTexture(o,s),t.generateMipmap(o),i.bindTexture(o,null)}}var C=s.memory,E="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=L,this.updateRenderTargetMipmap=A},a.WebGLUniforms=function(){var t=new a.Texture,e=new a.CubeTexture,i=function(){this.seq=[],this.map={}},n=[],r=[],o=function(t,e,i){var r=t[0];if(r<=0||r>0)return t;var a=e*i,o=n[a];if(void 0===o&&(o=new Float32Array(a),n[a]=o),0!==e){r.toArray(o,0);for(var s=1,c=0;s!==e;++s)c+=i,t[s].toArray(o,c)}return o},s=function(t,e){var i=r[e];void 0===i&&(i=new Int32Array(e),r[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i},c=function(t,e){t.uniform1f(this.addr,e)},h=function(t,e){t.uniform1i(this.addr,e)},l=function(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)},u=function(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)},d=function(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)},p=function(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)},f=function(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)},m=function(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)},g=function(e,i,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),n.setTexture2D(i||t,r)},v=function(t,i,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(i||e,r)},y=function(t,e){t.uniform2iv(this.addr,e)},x=function(t,e){t.uniform3iv(this.addr,e)},b=function(t,e){t.uniform4iv(this.addr,e)},_=function(t){switch(t){case 5126:return c;case 35664:return l;case 35665:return u;case 35666:return d;case 35674:return p;case 35675:return f;case 35676:return m;case 35678:return g;case 35680:return v;case 5124:case 35670:return h;case 35667:case 35671:return y;case 35668:case 35672:return x;case 35669:case 35673:return b}},M=function(t,e){t.uniform1fv(this.addr,e)},w=function(t,e){t.uniform1iv(this.addr,e)},S=function(t,e){t.uniform2fv(this.addr,o(e,this.size,2))},T=function(t,e){t.uniform3fv(this.addr,o(e,this.size,3))},L=function(t,e){t.uniform4fv(this.addr,o(e,this.size,4))},A=function(t,e){t.uniformMatrix2fv(this.addr,!1,o(e,this.size,4))},C=function(t,e){t.uniformMatrix3fv(this.addr,!1,o(e,this.size,9))},E=function(t,e){t.uniformMatrix4fv(this.addr,!1,o(e,this.size,16))},P=function(e,i,n){var r=i.length,a=s(n,r);e.uniform1iv(this.addr,a);for(var o=0;o!==r;++o)n.setTexture2D(i[o]||t,a[o])},R=function(t,i,n){var r=i.length,a=s(n,r);t.uniform1iv(this.addr,a);for(var o=0;o!==r;++o)n.setTextureCube(i[o]||e,a[o])},D=function(t){switch(t){case 5126:return M;case 35664:return S;case 35665:return T;case 35666:return L;case 35674:return A;case 35675:return C;case 35676:return E;case 35678:return P;case 35680:return R;case 5124:case 35670:return w;case 35667:case 35671:return y;case 35668:case 35672:return x;case 35669:case 35673:return b}},I=function(t,e,i){this.id=t,this.addr=i,this.setValue=_(e.type)},O=function(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=D(e.type)},B=function(t){this.id=t,i.call(this)};B.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(t,e[a.id])}};var U=/([\w\d_]+)(\])?(\[|\.)?/g,F=function(t,e){t.seq.push(e),t.map[e.id]=e},N=function(t,e,i){var n=t.name,r=n.length;for(U.lastIndex=0;;){var a=U.exec(n),o=U.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s=0|s),void 0===h||"["===h&&o+2===r){F(i,void 0===h?new I(s,t,e):new O(s,t,e));break}var l=i.map,u=l[s];void 0===u&&(u=new B(s),F(i,u)),i=u}},V=function(t,e,n){i.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),a=0;a!==r;++a){var o=t.getActiveUniform(e,a),s=o.name,c=t.getUniformLocation(e,s);N(o,c,this)}};return V.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},V.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},V.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},V.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];s.needsUpdate!==!1&&o.setValue(t,s.value,n)}},V.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i},V.splitDynamic=function(t,e){for(var i=null,n=t.length,r=0,a=0;a!==n;++a){var o=t[a],s=e[o.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(o)):(r<a&&(t[r]=o),++r)}return r<n&&(t.length=r),i},V.evalDynamic=function(t,e,i,n){for(var r=0,a=t.length;r!==a;++r){var o=e[t[r].id],s=o.onUpdateCallback;void 0!==s&&s.call(o,i,n)}},V}(),a.LensFlarePlugin=function(t,e){function i(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);r=p.createBuffer(),o=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,r),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,o),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),u=p.createTexture(),d=p.createTexture(),f.bindTexture(p.TEXTURE_2D,u),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),f.bindTexture(p.TEXTURE_2D,d),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},c=n(s),h={vertex:p.getAttribLocation(c,"position"),uv:p.getAttribLocation(c,"uv")},l={renderType:p.getUniformLocation(c,"renderType"),map:p.getUniformLocation(c,"map"),occlusionMap:p.getUniformLocation(c,"occlusionMap"),opacity:p.getUniformLocation(c,"opacity"),color:p.getUniformLocation(c,"color"),scale:p.getUniformLocation(c,"scale"),rotation:p.getUniformLocation(c,"rotation"),screenPosition:p.getUniformLocation(c,"screenPosition")}}function n(e){var i=p.createProgram(),n=p.createShader(p.FRAGMENT_SHADER),r=p.createShader(p.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return p.shaderSource(n,a+e.fragmentShader),p.shaderSource(r,a+e.vertexShader),p.compileShader(n),p.compileShader(r),p.attachShader(i,n),p.attachShader(i,r),p.linkProgram(i),i}var r,o,s,c,h,l,u,d,p=t.context,f=t.state;this.render=function(n,s,m){if(0!==e.length){var g=new a.Vector3,v=m.w/m.z,y=.5*m.z,x=.5*m.w,b=16/m.w,_=new a.Vector2(b*v,b),M=new a.Vector3(1,1,0),w=new a.Vector2(1,1),S=new a.Box2;S.min.set(0,0),S.max.set(m.z-16,m.w-16),void 0===c&&i(),p.useProgram(c),f.initAttributes(),f.enableAttribute(h.vertex),f.enableAttribute(h.uv),f.disableUnusedAttributes(),p.uniform1i(l.occlusionMap,0),p.uniform1i(l.map,1),p.bindBuffer(p.ARRAY_BUFFER,r),p.vertexAttribPointer(h.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,o),f.disable(p.CULL_FACE),f.setDepthWrite(!1);for(var T=0,L=e.length;T<L;T++){b=16/m.w,_.set(b*v,b);var A=e[T];if(g.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyProjection(s.projectionMatrix),M.copy(g),w.x=m.x+M.x*y+y-8,w.y=m.y+M.y*x+x-8,S.containsPoint(w)===!0){f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,null),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,w.x,w.y,16,16,0),p.uniform1i(l.renderType,0),p.uniform2f(l.scale,_.x,_.y),p.uniform3f(l.screenPosition,M.x,M.y,M.z),f.disable(p.BLEND),f.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,d),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,w.x,w.y,16,16,0),p.uniform1i(l.renderType,1),f.disable(p.DEPTH_TEST),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),A.positionScreen.copy(M),A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares(),p.uniform1i(l.renderType,2),f.enable(p.BLEND);for(var C=0,E=A.lensFlares.length;C<E;C++){var P=A.lensFlares[C];P.opacity>.001&&P.scale>.001&&(M.x=P.x,M.y=P.y,M.z=P.z,b=P.size*P.scale/m.w,_.x=b*v,_.y=b,p.uniform3f(l.screenPosition,M.x,M.y,M.z),p.uniform2f(l.scale,_.x,_.y),p.uniform1f(l.rotation,P.rotation),p.uniform1f(l.opacity,P.opacity),p.uniform3f(l.color,P.color.r,P.color.g,P.color.b),f.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),t.setTexture2D(P.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}f.enable(p.CULL_FACE),f.enable(p.DEPTH_TEST),f.setDepthWrite(!0),t.resetGLState()}}},a.SpritePlugin=function(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=d.createBuffer(),s=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,o),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),c=n(),h={position:d.getAttribLocation(c,"position"),uv:d.getAttribLocation(c,"uv")},l={uvOffset:d.getUniformLocation(c,"uvOffset"),uvScale:d.getUniformLocation(c,"uvScale"),rotation:d.getUniformLocation(c,"rotation"),scale:d.getUniformLocation(c,"scale"),color:d.getUniformLocation(c,"color"),map:d.getUniformLocation(c,"map"),opacity:d.getUniformLocation(c,"opacity"),modelViewMatrix:d.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:d.getUniformLocation(c,"projectionMatrix"),fogType:d.getUniformLocation(c,"fogType"),fogDensity:d.getUniformLocation(c,"fogDensity"),fogNear:d.getUniformLocation(c,"fogNear"),fogFar:d.getUniformLocation(c,"fogFar"),fogColor:d.getUniformLocation(c,"fogColor"),alphaTest:d.getUniformLocation(c,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var r=i.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),u=new a.Texture(i),u.needsUpdate=!0}function n(){var e=d.createProgram(),i=d.createShader(d.VERTEX_SHADER),n=d.createShader(d.FRAGMENT_SHADER);return d.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),d.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),d.compileShader(i),d.compileShader(n),d.attachShader(e,i),d.attachShader(e,n),d.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,s,c,h,l,u,d=t.context,p=t.state,f=new a.Vector3,m=new a.Quaternion,g=new a.Vector3;this.render=function(n,v){if(0!==e.length){void 0===c&&i(),d.useProgram(c),p.initAttributes(),p.enableAttribute(h.position),p.enableAttribute(h.uv),p.disableUnusedAttributes(),p.disable(d.CULL_FACE),p.enable(d.BLEND),d.bindBuffer(d.ARRAY_BUFFER,o),d.vertexAttribPointer(h.position,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),p.activeTexture(d.TEXTURE0),d.uniform1i(l.map,0);var y=0,x=0,b=n.fog;b?(d.uniform3f(l.fogColor,b.color.r,b.color.g,b.color.b),b instanceof a.Fog?(d.uniform1f(l.fogNear,b.near),d.uniform1f(l.fogFar,b.far),d.uniform1i(l.fogType,1),y=1,x=1):b instanceof a.FogExp2&&(d.uniform1f(l.fogDensity,b.density),d.uniform1i(l.fogType,2),y=2,x=2)):(d.uniform1i(l.fogType,0),y=0,x=0);for(var _=0,M=e.length;_<M;_++){var w=e[_];w.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(r);for(var S=[],_=0,M=e.length;_<M;_++){var w=e[_],T=w.material;if(T.visible!==!1){d.uniform1f(l.alphaTest,T.alphaTest),d.uniformMatrix4fv(l.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(f,m,g),S[0]=g.x,S[1]=g.y;var L=0;n.fog&&T.fog&&(L=x),y!==L&&(d.uniform1i(l.fogType,L),y=L),null!==T.map?(d.uniform2f(l.uvOffset,T.map.offset.x,T.map.offset.y),d.uniform2f(l.uvScale,T.map.repeat.x,T.map.repeat.y)):(d.uniform2f(l.uvOffset,0,0),d.uniform2f(l.uvScale,1,1)),d.uniform1f(l.opacity,T.opacity),d.uniform3f(l.color,T.color.r,T.color.g,T.color.b),d.uniform1f(l.rotation,T.rotation),d.uniform2fv(l.scale,S),p.setBlending(T.blending,T.blendEquation,T.blendSrc,T.blendDst),p.setDepthTest(T.depthTest),p.setDepthWrite(T.depthWrite),T.map?t.setTexture2D(T.map,0):t.setTexture2D(u,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}p.enable(d.CULL_FACE),t.resetGLState()}}},Object.assign(a,{Face4:function(t,e,i,n,r,o,s){return new a.Face3(t,e,i,r,o,s)},LineStrip:0,LinePieces:1,MeshFaceMaterial:a.MultiMaterial,PointCloud:function(t,e){return new a.Points(t,e)},Particle:a.Sprite,ParticleSystem:function(t,e){return new a.Points(t,e)},PointCloudMaterial:function(t){return new a.PointsMaterial(t)},ParticleBasicMaterial:function(t){return new a.PointsMaterial(t)},ParticleSystemMaterial:function(t){return new a.PointsMaterial(t)},Vertex:function(t,e,i){return new a.Vector3(t,e,i)}}),Object.assign(a.Box2.prototype,{empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)}}),Object.assign(a.Box3.prototype,{empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)}}),Object.assign(a.Matrix3.prototype,{multiplyVector3:function(t){return t.applyMatrix3(this)},multiplyVector3Array:function(t){return this.applyToVector3Array(t)}}),Object.assign(a.Matrix4.prototype,{extractPosition:function(t){return this.copyPosition(t)},setRotationFromQuaternion:function(t){return this.makeRotationFromQuaternion(t)},multiplyVector3:function(t){return t.applyProjection(this)},multiplyVector4:function(t){return t.applyMatrix4(this)},multiplyVector3Array:function(t){return this.applyToVector3Array(t)},rotateAxis:function(t){t.transformDirection(this)},crossVector:function(t){return t.applyMatrix4(this)},translate:function(t){},rotateX:function(t){},rotateY:function(t){},rotateZ:function(t){},rotateByAxis:function(t,e){}}),Object.assign(a.Plane.prototype,{isIntersectionLine:function(t){return this.intersectsLine(t)}}),Object.assign(a.Quaternion.prototype,{multiplyVector3:function(t){return t.applyQuaternion(this)}}),Object.assign(a.Ray.prototype,{isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionPlane:function(t){return this.intersectsPlane(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)}}),Object.assign(a.Vector3.prototype,{setEulerFromRotationMatrix:function(){},setEulerFromQuaternion:function(){},getPositionFromMatrix:function(t){return this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return this.setFromMatrixColumn(e,t)}}),Object.assign(a.Object3D.prototype,{getChildByName:function(t){return this.getObjectByName(t)},renderDepth:function(t){},translate:function(t,e){return this.translateOnAxis(e,t)}}),Object.defineProperties(a.Object3D.prototype,{eulerOrder:{get:function(){return this.rotation.order},set:function(t){this.rotation.order=t}},useQuaternion:{get:function(){},set:function(t){}}}),Object.defineProperties(a.LOD.prototype,{objects:{get:function(){return this.levels}}}),a.PerspectiveCamera.prototype.setLens=function(t,e){void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(a.Light.prototype,{onlyShadow:{set:function(t){}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(t){}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),Object.defineProperties(a.BufferAttribute.prototype,{length:{get:function(){return this.array.length}}}),Object.assign(a.BufferGeometry.prototype,{addIndex:function(t){this.setIndex(t)},addDrawCall:function(t,e,i){this.addGroup(t,e)},clearDrawCalls:function(){this.clearGroups()},computeTangents:function(){},computeOffsets:function(){}}),Object.defineProperties(a.BufferGeometry.prototype,{drawcalls:{get:function(){return this.groups}},offsets:{get:function(){return this.groups}}}),Object.defineProperties(a.Material.prototype,{wrapAround:{get:function(){},set:function(t){}},wrapRGB:{get:function(){return new a.Color}}}),Object.defineProperties(a.MeshPhongMaterial.prototype,{metal:{get:function(){return!1},set:function(t){}}}),Object.defineProperties(a.ShaderMaterial.prototype,{derivatives:{get:function(){return this.extensions.derivatives},set:function(t){this.extensions.derivatives=t}}}),a.EventDispatcher.prototype=Object.assign(Object.create({constructor:a.EventDispatcher,apply:function(t){Object.assign(t,this)}}),a.EventDispatcher.prototype),Object.assign(a.WebGLRenderer.prototype,{supportsFloatTextures:function(){return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures},supportsInstancedArrays:function(){return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){this.setScissorTest(t)},initMaterial:function(){},addPrePlugin:function(){},addPostPlugin:function(){},updateShadowMap:function(){}}),Object.defineProperties(a.WebGLRenderer.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){this.shadowMap.cullFace=t}}}),Object.defineProperties(a.WebGLShadowMap.prototype,{cullFace:{get:function(){return this.renderReverseSided?a.CullFaceFront:a.CullFaceBack},set:function(t){var e=t!==a.CullFaceBack;this.renderReverseSided=e}}}),Object.defineProperties(a.WebGLRenderTarget.prototype,{wrapS:{get:function(){return this.texture.wrapS},set:function(t){this.texture.wrapS=t}},wrapT:{get:function(){return this.texture.wrapT},set:function(t){this.texture.wrapT=t}},magFilter:{get:function(){return this.texture.magFilter},set:function(t){this.texture.magFilter=t}},minFilter:{get:function(){return this.texture.minFilter},set:function(t){this.texture.minFilter=t}},anisotropy:{get:function(){return this.texture.anisotropy},set:function(t){this.texture.anisotropy=t}},offset:{get:function(){return this.texture.offset},set:function(t){this.texture.offset=t}},repeat:{get:function(){return this.texture.repeat},set:function(t){this.texture.repeat=t}},format:{get:function(){return this.texture.format},set:function(t){this.texture.format=t}},type:{get:function(){return this.texture.type},set:function(t){
|
|
this.texture.type=t}},generateMipmaps:{get:function(){return this.texture.generateMipmaps},set:function(t){this.texture.generateMipmaps=t}}}),Object.assign(a.Audio.prototype,{load:function(t){var e=this,i=new a.AudioLoader;return i.load(t,function(t){e.setBuffer(t)}),this}}),Object.assign(a.AudioAnalyser.prototype,{getData:function(t){return this.getFrequencyData()}}),a.GeometryUtils={merge:function(t,e,i){var n;e instanceof a.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return t.center()}},a.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,i,n){var r=new a.TextureLoader;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},loadTextureCube:function(t,e,i,n){var r=new a.CubeTextureLoader;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},loadCompressedTexture:function(){},loadCompressedTextureCube:function(){}},a.Projector=function(){this.projectVector=function(t,e){t.project(e)},this.unprojectVector=function(t,e){t.unproject(e)},this.pickingRay=function(t,e){}},a.CanvasRenderer=function(){this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},a.CurveUtils={tangentQuadraticBezier:function(t,e,i,n){return 2*(1-t)*(i-e)+2*t*(n-i)},tangentCubicBezier:function(t,e,i,n,r){return-3*e*(1-t)*(1-t)+3*i*(1-t)*(1-t)-6*t*i*(1-t)+6*t*n*(1-t)-3*t*t*n+3*t*t*r},tangentSpline:function(t,e,i,n,r){var a=6*t*t-6*t,o=3*t*t-4*t+1,s=-6*t*t+6*t,c=3*t*t-2*t;return a+o+s+c},interpolate:function(t,e,i,n,r){var a=.5*(i-t),o=.5*(n-e),s=r*r,c=r*s;return(2*e-2*i+a+o)*c+(-3*e+3*i-2*a-o)*s+a*r+e}},a.SceneUtils={createMultiMaterialObject:function(t,e){for(var i=new a.Group,n=0,r=e.length;n<r;n++)i.add(new a.Mesh(t,e[n]));return i},detach:function(t,e,i){t.applyMatrix(e.matrixWorld),e.remove(t),i.add(t)},attach:function(t,e,i){var n=new a.Matrix4;n.getInverse(i.matrixWorld),t.applyMatrix(n),e.remove(t),i.add(t)}},a.ShapeUtils={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},triangulate:function(){function t(t,e,i,n,r,a){var o,s,c,h,l,u,d,p,f;if(s=t[a[e]].x,c=t[a[e]].y,h=t[a[i]].x,l=t[a[i]].y,u=t[a[n]].x,d=t[a[n]].y,Number.EPSILON>(h-s)*(d-c)-(l-c)*(u-s))return!1;var m,g,v,y,x,b,_,M,w,S,T,L,A,C,E;for(m=u-h,g=d-l,v=s-u,y=c-d,x=h-s,b=l-c,o=0;o<r;o++)if(p=t[a[o]].x,f=t[a[o]].y,!(p===s&&f===c||p===h&&f===l||p===u&&f===d)&&(_=p-s,M=f-c,w=p-h,S=f-l,T=p-u,L=f-d,E=m*S-g*w,A=x*M-b*_,C=v*L-y*T,E>=-Number.EPSILON&&C>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,o,s,c=[],h=[],l=[];if(a.ShapeUtils.area(e)>0)for(o=0;o<n;o++)h[o]=o;else for(o=0;o<n;o++)h[o]=n-1-o;var u=n,d=2*u;for(o=u-1;u>2;){if(d--<=0)return i?l:c;if(r=o,u<=r&&(r=0),o=r+1,u<=o&&(o=0),s=o+1,u<=s&&(s=0),t(e,r,o,s,u,h)){var p,f,m,g,v;for(p=h[r],f=h[o],m=h[s],c.push([e[p],e[f],e[m]]),l.push([h[r],h[o],h[s]]),g=o,v=o+1;v<u;g++,v++)h[g]=h[v];u--,d=2*u}}return i?l:c}}(),triangulateShape:function(t,e){function i(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.x<e.x?t.x<=i.x&&i.x<=e.x:e.x<=i.x&&i.x<=t.x:t.y<e.y?t.y<=i.y&&i.y<=e.y:e.y<=i.y&&i.y<=t.y}function r(t,e,i,r,a){var o=e.x-t.x,s=e.y-t.y,c=r.x-i.x,h=r.y-i.y,l=t.x-i.x,u=t.y-i.y,d=s*c-o*h,p=s*l-o*u;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if(f=h*l-c*u,f<0||f>d)return[]}else{if(p>0||p<d)return[];if(f=h*l-c*u,f>0||f<d)return[]}if(0===f)return!a||0!==p&&p!==d?[t]:[];if(f===d)return!a||0!==p&&p!==d?[e]:[];if(0===p)return[i];if(p===d)return[r];var m=f/d;return[{x:t.x+m*o,y:t.y+m*s}]}if(0!==p||h*l!==c*u)return[];var g=0===o&&0===s,v=0===c&&0===h;if(g&&v)return t.x!==i.x||t.y!==i.y?[]:[t];if(g)return n(i,r,t)?[t]:[];if(v)return n(t,e,i)?[i]:[];var y,x,b,_,M,w,S,T;return 0!==o?(t.x<e.x?(y=t,b=t.x,x=e,_=e.x):(y=e,b=e.x,x=t,_=t.x),i.x<r.x?(M=i,S=i.x,w=r,T=r.x):(M=r,S=r.x,w=i,T=i.x)):(t.y<e.y?(y=t,b=t.y,x=e,_=e.y):(y=e,b=e.y,x=t,_=t.y),i.y<r.y?(M=i,S=i.y,w=r,T=r.y):(M=r,S=r.y,w=i,T=i.y)),b<=S?_<S?[]:_===S?a?[]:[M]:_<=T?[M,x]:[M,w]:b>T?[]:b===T?a?[]:[y]:_<=T?[y,x]:[y,w]}function o(t,e,i,n){var r=e.x-t.x,a=e.y-t.y,o=i.x-t.x,s=i.y-t.y,c=n.x-t.x,h=n.y-t.y,l=r*s-a*o,u=r*h-a*c;if(Math.abs(l)>Number.EPSILON){var d=c*s-h*o;return l>0?u>=0&&d>=0:u>=0||d>=0}return u>0}function s(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var a=o(y[t],y[n],y[r],s[e]);if(!a)return!1;var c=s.length-1,h=e-1;h<0&&(h=c);var l=e+1;return l>c&&(l=0),a=o(s[e],s[h],s[l],y[t]),!!a}function n(t,e){var i,n,a;for(i=0;i<y.length;i++)if(n=i+1,n%=y.length,a=r(t,e,y[i],y[n],!0),a.length>0)return!0;return!1}function a(t,i){var n,a,o,s,c;for(n=0;n<x.length;n++)for(a=e[x[n]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=r(t,i,a[o],a[s],!0),c.length>0)return!0;return!1}for(var s,c,h,l,u,d,p,f,m,g,v,y=t.concat(),x=[],b=[],_=0,M=e.length;_<M;_++)x.push(_);for(var w=0,S=2*x.length;x.length>0&&(S--,!(S<0));)for(h=w;h<y.length;h++){l=y[h],c=-1;for(var _=0;_<x.length;_++)if(d=x[_],p=l.x+":"+l.y+":"+d,void 0===b[p]){s=e[d];for(var T=0;T<s.length;T++)if(u=s[T],i(h,T)&&!n(l,u)&&!a(l,u)){c=T,x.splice(_,1),f=y.slice(0,h+1),m=y.slice(h),g=s.slice(c),v=s.slice(0,c+1),y=f.concat(g).concat(v).concat(m),w=h;break}if(c>=0)break;b[p]=!0}if(c>=0)break}return y}i(t),e.forEach(i);for(var c,h,l,u,d,p,f={},m=t.concat(),g=0,v=e.length;g<v;g++)Array.prototype.push.apply(m,e[g]);for(c=0,h=m.length;c<h;c++)d=m[c].x+":"+m[c].y,void 0!==f[d],f[d]=c;var y=s(t,e),x=a.ShapeUtils.triangulate(y,!1);for(c=0,h=x.length;c<h;c++)for(u=x[c],l=0;l<3;l++)d=u[l].x+":"+u[l].y,p=f[d],void 0!==p&&(u[l]=p);return x.concat()},isClockWise:function(t){return a.ShapeUtils.area(t)<0},b2:function(){function t(t,e){var i=1-t;return i*i*e}function e(t,e){return 2*(1-t)*t*e}function i(t,e){return t*t*e}return function(n,r,a,o){return t(n,r)+e(n,a)+i(n,o)}}(),b3:function(){function t(t,e){var i=1-t;return i*i*i*e}function e(t,e){var i=1-t;return 3*i*i*t*e}function i(t,e){var i=1-t;return 3*i*t*t*e}function n(t,e){return t*t*t*e}return function(r,a,o,s,c){return t(r,a)+e(r,o)+i(r,s)+n(r,c)}}()},a.Curve=function(){},a.Curve.prototype={constructor:a.Curve,getPoint:function(t){return null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){t||(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){t||(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)e=this.getPoint(i/t),a+=e.distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e?e:t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if(r=Math.floor(s+(c-s)/2),o=n[r]-i,o<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===i){var h=r/(a-1);return h}var l=n[r],u=n[r+1],d=u-l,p=(i-l)/d,h=(r+p)/(a-1);return h},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),a=this.getPoint(n),o=a.clone().sub(r);return o.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},a.Curve.create=function(t,e){return t.prototype=Object.create(a.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},a.CurvePath=function(){this.curves=[],this.autoClose=!1},a.CurvePath.prototype=Object.assign(Object.create(a.Curve.prototype),{constructor:a.CurvePath,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new a.LineCurve(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){t||(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var o=r[n],s=o instanceof a.EllipseCurve?2*t:o instanceof a.LineCurve?1:o instanceof a.SplineCurve?t*o.points.length:t,c=o.getPoints(s),h=0;h<c.length;h++){var l=c[h];e&&e.equals(l)||(i.push(l),e=l)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new a.Geometry,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new a.Vector3(r.x,r.y,r.z||0))}return e}}),a.Font=function(t){this.data=t},Object.assign(a.Font.prototype,{generateShapes:function(t,e,i){function n(t){for(var i=String(t).split(""),n=e/o.resolution,a=0,s=[],c=0;c<i.length;c++){var h=r(i[c],n,a);a+=h.offset,s.push(h.path)}return s}function r(t,e,n){var r=o.glyphs[t]||o.glyphs["?"];if(r){var s,c,h,l,u,d,p,f,m,g,v,y=new a.ShapePath,x=[],b=a.ShapeUtils.b2,_=a.ShapeUtils.b3;if(r.o)for(var M=r._cachedOutline||(r._cachedOutline=r.o.split(" ")),w=0,S=M.length;w<S;){var T=M[w++];switch(T){case"m":s=M[w++]*e+n,c=M[w++]*e,y.moveTo(s,c);break;case"l":s=M[w++]*e+n,c=M[w++]*e,y.lineTo(s,c);break;case"q":if(h=M[w++]*e+n,l=M[w++]*e,p=M[w++]*e+n,f=M[w++]*e,y.quadraticCurveTo(p,f,h,l),v=x[x.length-1]){u=v.x,d=v.y;for(var L=1;L<=i;L++){var A=L/i;b(A,u,p,h),b(A,d,f,l)}}break;case"b":if(h=M[w++]*e+n,l=M[w++]*e,p=M[w++]*e+n,f=M[w++]*e,m=M[w++]*e+n,g=M[w++]*e,y.bezierCurveTo(p,f,m,g,h,l),v=x[x.length-1]){u=v.x,d=v.y;for(var L=1;L<=i;L++){var A=L/i;_(A,u,p,m,h),_(A,d,f,g,l)}}}}return{offset:r.ha*e,path:y}}}void 0===e&&(e=100),void 0===i&&(i=4);for(var o=this.data,s=n(t),c=[],h=0,l=s.length;h<l;h++)Array.prototype.push.apply(c,s[h].toShapes());return c}}),a.Path=function(t){a.CurvePath.call(this),this.currentPoint=new a.Vector2,t&&this.fromPoints(t)},a.Path.prototype=Object.assign(Object.create(a.CurvePath.prototype),{constructor:a.Path,fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var i=new a.LineCurve(this.currentPoint.clone(),new a.Vector2(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,n){var r=new a.QuadraticBezierCurve(this.currentPoint.clone(),new a.Vector2(t,e),new a.Vector2(i,n));this.curves.push(r),this.currentPoint.set(i,n)},bezierCurveTo:function(t,e,i,n,r,o){var s=new a.CubicBezierCurve(this.currentPoint.clone(),new a.Vector2(t,e),new a.Vector2(i,n),new a.Vector2(r,o));this.curves.push(s),this.currentPoint.set(r,o)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),i=new a.SplineCurve(e);this.curves.push(i),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,o,s,c){var h=new a.EllipseCurve(t,e,i,n,r,o,s,c);if(this.curves.length>0){var l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(h);var u=h.getPoint(1);this.currentPoint.copy(u)}}),a.ShapePath=function(){this.subPaths=[],this.currentPath=null},a.ShapePath.prototype={moveTo:function(t,e){this.currentPath=new a.Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],o=new a.Shape;o.curves=r.curves,e.push(o)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=a.ShapeUtils.isClockWise,o=this.subPaths;if(0===o.length)return[];if(e===!0)return i(o);var s,c,h,l=[];if(1===o.length)return c=o[0],h=new a.Shape,h.curves=c.curves,l.push(h),l;var u=!r(o[0].getPoints());u=t?!u:u;var d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v<y;v++)c=o[v],d=c.getPoints(),s=r(d),s=t?!s:s,s?(!u&&f[g]&&g++,f[g]={s:new a.Shape,p:d},f[g].s.curves=c.curves,u&&g++,m[g]=[]):m[g].push({h:c,p:d[0]});if(!f[0])return i(o);if(f.length>1){for(var x=!1,b=[],_=0,M=f.length;_<M;_++)p[_]=[];for(var _=0,M=f.length;_<M;_++)for(var w=m[_],S=0;S<w.length;S++){for(var T=w[S],L=!0,A=0;A<f.length;A++)n(T.p,f[A].p)&&(_!==A&&b.push({froms:_,tos:A,hole:S}),L?(L=!1,p[A].push(T)):x=!0);L&&p[_].push(T)}b.length>0&&(x||(m=p))}for(var C,v=0,E=f.length;v<E;v++){h=f[v].s,l.push(h),C=m[v];for(var P=0,R=C.length;P<R;P++)h.holes.push(C[P].h)}return l}},a.Shape=function(){a.Path.apply(this,arguments),this.holes=[]},a.Shape.prototype=Object.assign(Object.create(a.Path.prototype),{constructor:a.Shape,extrude:function(t){return new a.ExtrudeGeometry(this,t)},makeGeometry:function(t){return new a.ShapeGeometry(this,t)},getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),a.LineCurve=function(t,e){this.v1=t,this.v2=e},a.LineCurve.prototype=Object.create(a.Curve.prototype),a.LineCurve.prototype.constructor=a.LineCurve,a.LineCurve.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},a.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},a.LineCurve.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},a.QuadraticBezierCurve=function(t,e,i){this.v0=t,this.v1=e,this.v2=i},a.QuadraticBezierCurve.prototype=Object.create(a.Curve.prototype),a.QuadraticBezierCurve.prototype.constructor=a.QuadraticBezierCurve,a.QuadraticBezierCurve.prototype.getPoint=function(t){var e=a.ShapeUtils.b2;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},a.QuadraticBezierCurve.prototype.getTangent=function(t){var e=a.CurveUtils.tangentQuadraticBezier;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},a.CubicBezierCurve=function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},a.CubicBezierCurve.prototype=Object.create(a.Curve.prototype),a.CubicBezierCurve.prototype.constructor=a.CubicBezierCurve,a.CubicBezierCurve.prototype.getPoint=function(t){var e=a.ShapeUtils.b3;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},a.CubicBezierCurve.prototype.getTangent=function(t){var e=a.CurveUtils.tangentCubicBezier;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},a.SplineCurve=function(t){this.points=void 0==t?[]:t},a.SplineCurve.prototype=Object.create(a.Curve.prototype),a.SplineCurve.prototype.constructor=a.SplineCurve,a.SplineCurve.prototype.getPoint=function(t){var e=this.points,i=(e.length-1)*t,n=Math.floor(i),r=i-n,o=e[0===n?n:n-1],s=e[n],c=e[n>e.length-2?e.length-1:n+1],h=e[n>e.length-3?e.length-1:n+2],l=a.CurveUtils.interpolate;return new a.Vector2(l(o.x,s.x,c.x,h.x,r),l(o.y,s.y,c.y,h.y,r))},a.EllipseCurve=function(t,e,i,n,r,a,o,s){this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0},a.EllipseCurve.prototype=Object.create(a.Curve.prototype),a.EllipseCurve.prototype.constructor=a.EllipseCurve,a.EllipseCurve.prototype.getPoint=function(t){for(var e=2*Math.PI,i=this.aEndAngle-this.aStartAngle,n=Math.abs(i)<Number.EPSILON;i<0;)i+=e;for(;i>e;)i-=e;i<Number.EPSILON&&(i=n?0:e),this.aClockwise!==!0||n||(i===e?i=-e:i-=e);var r=this.aStartAngle+t*i,o=this.aX+this.xRadius*Math.cos(r),s=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),l=o-this.aX,u=s-this.aY;o=l*c-u*h+this.aX,s=l*h+u*c+this.aY}return new a.Vector2(o,s)},a.ArcCurve=function(t,e,i,n,r,o){a.EllipseCurve.call(this,t,e,i,i,n,r,o)},a.ArcCurve.prototype=Object.create(a.EllipseCurve.prototype),a.ArcCurve.prototype.constructor=a.ArcCurve,a.LineCurve3=a.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new a.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),a.QuadraticBezierCurve3=a.Curve.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=a.ShapeUtils.b2;return new a.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),a.CubicBezierCurve3=a.Curve.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=a.ShapeUtils.b3;return new a.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),a.SplineCurve3=a.Curve.create(function(t){this.points=void 0==t?[]:t},function(t){var e=this.points,i=(e.length-1)*t,n=Math.floor(i),r=i-n,o=e[0==n?n:n-1],s=e[n],c=e[n>e.length-2?e.length-1:n+1],h=e[n>e.length-3?e.length-1:n+2],l=a.CurveUtils.interpolate;return new a.Vector3(l(o.x,s.x,c.x,h.x,r),l(o.y,s.y,c.y,h.y,r),l(o.z,s.z,c.z,h.z,r))}),a.CatmullRomCurve3=function(){function t(){}var e=new a.Vector3,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,a,o){var s=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;s*=a,c*=a,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},a.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,s,c,h,l=this.points;h=l.length,o=(h-(this.closed?0:1))*t,s=Math.floor(o),c=o-s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/l.length)+1)*l.length:0===c&&s===h-1&&(s=h-2,c=1);var u,d,p,f;if(this.closed||s>0?u=l[(s-1)%h]:(e.subVectors(l[0],l[1]).add(l[0]),u=e),d=l[s%h],p=l[(s+1)%h],this.closed||s+2<h?f=l[(s+2)%h]:(e.subVectors(l[h-1],l[h-2]).add(l[h-1]),f=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,g=Math.pow(u.distanceToSquared(d),m),v=Math.pow(d.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(f),m);v<1e-4&&(v=1),g<1e-4&&(g=v),y<1e-4&&(y=v),i.initNonuniformCatmullRom(u.x,d.x,p.x,f.x,g,v,y),n.initNonuniformCatmullRom(u.y,d.y,p.y,f.y,g,v,y),r.initNonuniformCatmullRom(u.z,d.z,p.z,f.z,g,v,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;i.initCatmullRom(u.x,d.x,p.x,f.x,x),n.initCatmullRom(u.y,d.y,p.y,f.y,x),r.initCatmullRom(u.z,d.z,p.z,f.z,x)}var b=new a.Vector3(i.calc(c),n.calc(c),r.calc(c));return b})}(),a.ClosedSplineCurve3=function(t){a.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},a.ClosedSplineCurve3.prototype=Object.create(a.CatmullRomCurve3.prototype),a.BoxGeometry=function(t,e,i,n,r,o){a.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new a.BoxBufferGeometry(t,e,i,n,r,o)),this.mergeVertices()},a.BoxGeometry.prototype=Object.create(a.Geometry.prototype),a.BoxGeometry.prototype.constructor=a.BoxGeometry,a.CubeGeometry=a.BoxGeometry,a.BoxBufferGeometry=function(t,e,i,n,r,o){function s(t,e,i){var n=0;return n+=(t+1)*(e+1)*2,n+=(t+1)*(i+1)*2,n+=(i+1)*(e+1)*2}function c(t,e,i){var n=0;return n+=t*e*2,n+=t*i*2,n+=i*e*2,6*n}function h(t,e,i,n,r,o,s,c,h,u,d){for(var M=o/h,w=s/u,S=o/2,T=s/2,L=c/2,A=h+1,C=u+1,E=0,P=0,R=new a.Vector3,D=0;D<C;D++)for(var I=D*w-T,O=0;O<A;O++){var B=O*M-S;R[t]=B*n,R[e]=I*r,R[i]=L,f[v]=R.x,f[v+1]=R.y,f[v+2]=R.z,R[t]=0,R[e]=0,R[i]=c>0?1:-1,m[v]=R.x,m[v+1]=R.y,m[v+2]=R.z,g[y]=O/h,g[y+1]=1-D/u,v+=3,y+=2,E+=1}for(D=0;D<u;D++)for(O=0;O<h;O++){var U=b+O+A*D,F=b+O+A*(D+1),N=b+(O+1)+A*(D+1),V=b+(O+1)+A*D;p[x]=U,p[x+1]=F,p[x+2]=V,p[x+3]=F,p[x+4]=N,p[x+5]=V,x+=6,P+=6}l.addGroup(_,P,d),_+=P,b+=E}a.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o};var l=this;n=Math.floor(n)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;var u=s(n,r,o),d=c(n,r,o),p=new(d>65535?Uint32Array:Uint16Array)(d),f=new Float32Array(3*u),m=new Float32Array(3*u),g=new Float32Array(2*u),v=0,y=0,x=0,b=0,_=0;h("z","y","x",-1,-1,i,e,t,o,r,0),h("z","y","x",1,-1,i,e,-t,o,r,1),h("x","z","y",1,1,t,i,e,n,o,2),h("x","z","y",1,-1,t,i,-e,n,o,3),h("x","y","z",1,-1,t,e,i,n,r,4),h("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new a.BufferAttribute(p,1)),this.addAttribute("position",new a.BufferAttribute(f,3)),this.addAttribute("normal",new a.BufferAttribute(m,3)),this.addAttribute("uv",new a.BufferAttribute(g,2))},a.BoxBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.BoxBufferGeometry.prototype.constructor=a.BoxBufferGeometry,a.CircleGeometry=function(t,e,i,n){a.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new a.CircleBufferGeometry(t,e,i,n))},a.CircleGeometry.prototype=Object.create(a.Geometry.prototype),a.CircleGeometry.prototype.constructor=a.CircleGeometry,a.CircleBufferGeometry=function(t,e,i,n){a.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||50,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r=e+2,o=new Float32Array(3*r),s=new Float32Array(3*r),c=new Float32Array(2*r);s[2]=1,c[0]=.5,c[1]=.5;for(var h=0,l=3,u=2;h<=e;h++,l+=3,u+=2){var d=i+h/e*n;o[l]=t*Math.cos(d),o[l+1]=t*Math.sin(d),s[l+2]=1,c[u]=(o[l]/t+1)/2,c[u+1]=(o[l+1]/t+1)/2}for(var p=[],l=1;l<=e;l++)p.push(l,l+1,0);this.setIndex(new a.BufferAttribute(new Uint16Array(p),1)),this.addAttribute("position",new a.BufferAttribute(o,3)),this.addAttribute("normal",new a.BufferAttribute(s,3)),this.addAttribute("uv",new a.BufferAttribute(c,2)),this.boundingSphere=new a.Sphere(new a.Vector3,t)},a.CircleBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.CircleBufferGeometry.prototype.constructor=a.CircleBufferGeometry,a.CylinderBufferGeometry=function(t,e,i,n,r,o,s,c){function h(){var t=(n+1)*(r+1);return o===!1&&(t+=(n+1)*f+n*f),t}function l(){var t=n*r*2*3;return o===!1&&(t+=n*f*3),t}function u(){var o,h,l=new a.Vector3,u=new a.Vector3,d=0,f=(e-t)/i;for(h=0;h<=r;h++){var m=[],g=h/r,L=g*(e-t)+t;for(o=0;o<=n;o++){var A=o/n;u.x=L*Math.sin(A*c+s),u.y=-g*i+S,u.z=L*Math.cos(A*c+s),y.setXYZ(_,u.x,u.y,u.z),l.copy(u),(0===t&&0===h||0===e&&h===r)&&(l.x=Math.sin(A*c+s),l.z=Math.cos(A*c+s)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*f).normalize(),x.setXYZ(_,l.x,l.y,l.z),b.setXY(_,A,1-g),m.push(_),_++}w.push(m)}for(o=0;o<n;o++)for(h=0;h<r;h++){var C=w[h][o],E=w[h+1][o],P=w[h+1][o+1],R=w[h][o+1];v.setX(M,C),M++,v.setX(M,E),M++,v.setX(M,R),M++,v.setX(M,E),M++,v.setX(M,P),M++,v.setX(M,R),M++,d+=6}p.addGroup(T,d,0),T+=d}function d(i){var r,o,h,l=new a.Vector2,u=new a.Vector3,d=0,f=i===!0?t:e,m=i===!0?1:-1;for(o=_,r=1;r<=n;r++)y.setXYZ(_,0,S*m,0),x.setXYZ(_,0,m,0),l.x=.5,l.y=.5,b.setXY(_,l.x,l.y),_++;for(h=_,r=0;r<=n;r++){var g=r/n,w=g*c+s,L=Math.cos(w),A=Math.sin(w);u.x=f*A,u.y=S*m,u.z=f*L,y.setXYZ(_,u.x,u.y,u.z),x.setXYZ(_,0,m,0),l.x=.5*L+.5,l.y=.5*A*m+.5,b.setXY(_,l.x,l.y),_++}for(r=0;r<n;r++){var C=o+r,E=h+r;i===!0?(v.setX(M,E),M++,v.setX(M,E+1),M++,v.setX(M,C),M++):(v.setX(M,E+1),M++,v.setX(M,E),M++,v.setX(M,C),M++),d+=3}p.addGroup(T,d,i===!0?1:2),T+=d}a.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:c};var p=this;t=void 0!==t?t:20,e=void 0!==e?e:20,i=void 0!==i?i:100,n=Math.floor(n)||8,r=Math.floor(r)||1,o=void 0!==o&&o,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var f=0;o===!1&&(t>0&&f++,e>0&&f++);var m=h(),g=l(),v=new a.BufferAttribute(new(g>65535?Uint32Array:Uint16Array)(g),1),y=new a.BufferAttribute(new Float32Array(3*m),3),x=new a.BufferAttribute(new Float32Array(3*m),3),b=new a.BufferAttribute(new Float32Array(2*m),2),_=0,M=0,w=[],S=i/2,T=0;u(),o===!1&&(t>0&&d(!0),e>0&&d(!1)),this.setIndex(v),this.addAttribute("position",y),this.addAttribute("normal",x),this.addAttribute("uv",b)},a.CylinderBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.CylinderBufferGeometry.prototype.constructor=a.CylinderBufferGeometry,a.CylinderGeometry=function(t,e,i,n,r,o,s,c){a.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:c},this.fromBufferGeometry(new a.CylinderBufferGeometry(t,e,i,n,r,o,s,c)),this.mergeVertices()},a.CylinderGeometry.prototype=Object.create(a.Geometry.prototype),a.CylinderGeometry.prototype.constructor=a.CylinderGeometry,a.ConeBufferGeometry=function(t,e,i,n,r,o,s){a.CylinderBufferGeometry.call(this,0,t,e,i,n,r,o,s),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,thetaStart:o,thetaLength:s}},a.ConeBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.ConeBufferGeometry.prototype.constructor=a.ConeBufferGeometry,a.ConeGeometry=function(t,e,i,n,r,o,s){a.CylinderGeometry.call(this,0,t,e,i,n,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:s}},a.ConeGeometry.prototype=Object.create(a.CylinderGeometry.prototype),a.ConeGeometry.prototype.constructor=a.ConeGeometry,a.EdgesGeometry=function(t,e){function i(t,e){return t-e}a.BufferGeometry.call(this),e=void 0!==e?e:1;var n,r=Math.cos(a.Math.DEG2RAD*e),o=[0,0],s={},c=["a","b","c"];t instanceof a.BufferGeometry?(n=new a.Geometry,n.fromBufferGeometry(t)):n=t.clone(),n.mergeVertices(),n.computeFaceNormals();for(var h=n.vertices,l=n.faces,u=0,d=l.length;u<d;u++)for(var p=l[u],f=0;f<3;f++){o[0]=p[c[f]],o[1]=p[c[(f+1)%3]],o.sort(i);var m=o.toString();void 0===s[m]?s[m]={vert1:o[0],vert2:o[1],face1:u,face2:void 0}:s[m].face2=u}var g=[];for(var m in s){var v=s[m];if(void 0===v.face2||l[v.face1].normal.dot(l[v.face2].normal)<=r){var y=h[v.vert1];g.push(y.x),g.push(y.y),g.push(y.z),y=h[v.vert2],g.push(y.x),g.push(y.y),g.push(y.z)}}this.addAttribute("position",new a.BufferAttribute(new Float32Array(g),3))},a.EdgesGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.EdgesGeometry.prototype.constructor=a.EdgesGeometry,a.ExtrudeGeometry=function(t,e){return"undefined"==typeof t?void(t=[]):(a.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())},a.ExtrudeGeometry.prototype=Object.create(a.Geometry.prototype),a.ExtrudeGeometry.prototype.constructor=a.ExtrudeGeometry,a.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var i=t.length,n=0;n<i;n++){var r=t[n];this.addShape(r,e)}},a.ExtrudeGeometry.prototype.addShape=function(t,e){function i(t,e,i){return e.clone().multiplyScalar(i).add(t)}function n(t,e,i){var n,r,o=1,s=t.x-e.x,c=t.y-e.y,h=i.x-t.x,l=i.y-t.y,u=s*s+c*c,d=s*l-c*h;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=e.x-c/p,g=e.y+s/p,v=i.x-l/f,y=i.y+h/f,x=((v-m)*l-(y-g)*h)/(s*l-c*h);n=m+s*x-t.x,r=g+c*x-t.y;var b=n*n+r*r;if(b<=2)return new a.Vector2(n,r);o=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?h>Number.EPSILON&&(_=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(_=!0):Math.sign(c)===Math.sign(l)&&(_=!0),_?(n=-c,r=s,o=Math.sqrt(u)):(n=s,r=c,o=Math.sqrt(u/2))}return new a.Vector2(n/o,r/o)}function r(){if(b){var t=0,e=j*t;for(X=0;X<W;X++)k=B[X],h(k[2]+e,k[1]+e,k[0]+e);for(t=M+2*x,e=j*t,X=0;X<W;X++)k=B[X],h(k[0]+e,k[1]+e,k[2]+e)}else{for(X=0;X<W;X++)k=B[X],h(k[2],k[1],k[0]);for(X=0;X<W;X++)k=B[X],h(k[0]+j*M,k[1]+j*M,k[2]+j*M)}}function o(){var t=0;for(s(U,t),t+=U.length,A=0,C=I.length;A<C;A++)L=I[A],s(L,t),t+=L.length}function s(t,e){var i,n;for(X=t.length;--X>=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,a=M+2*x;for(r=0;r<a;r++){var o=j*r,s=j*(r+1),c=e+i+o,h=e+n+o,u=e+n+s,d=e+i+s;l(c,h,u,d,t,r,a,i,n)}}}function c(t,e,i){E.vertices.push(new a.Vector3(t,e,i))}function h(t,e,i){t+=P,e+=P,i+=P,E.faces.push(new a.Face3(t,e,i,null,null,0));var n=T.generateTopUV(E,t,e,i);E.faceVertexUvs[0].push(n)}function l(t,e,i,n,r,o,s,c,h){t+=P,e+=P,i+=P,n+=P,E.faces.push(new a.Face3(t,e,n,null,null,1)),E.faces.push(new a.Face3(e,i,n,null,null,1));var l=T.generateSideWallUV(E,t,e,i,n);E.faceVertexUvs[0].push([l[0],l[1],l[3]]),E.faceVertexUvs[0].push([l[1],l[2],l[3]])}var u,d,p,f,m,g=void 0!==e.amount?e.amount:100,v=void 0!==e.bevelThickness?e.bevelThickness:6,y=void 0!==e.bevelSize?e.bevelSize:v-2,x=void 0!==e.bevelSegments?e.bevelSegments:3,b=void 0===e.bevelEnabled||e.bevelEnabled,_=void 0!==e.curveSegments?e.curveSegments:12,M=void 0!==e.steps?e.steps:1,w=e.extrudePath,S=!1,T=void 0!==e.UVGenerator?e.UVGenerator:a.ExtrudeGeometry.WorldUVGenerator;w&&(u=w.getSpacedPoints(M),S=!0,b=!1,d=void 0!==e.frames?e.frames:new a.TubeGeometry.FrenetFrames(w,M,(!1)),p=new a.Vector3,f=new a.Vector3,m=new a.Vector3),b||(x=0,v=0,y=0);var L,A,C,E=this,P=this.vertices.length,R=t.extractPoints(_),D=R.shape,I=R.holes,O=!a.ShapeUtils.isClockWise(D);if(O){for(D=D.reverse(),A=0,C=I.length;A<C;A++)L=I[A],a.ShapeUtils.isClockWise(L)&&(I[A]=L.reverse());O=!1}var B=a.ShapeUtils.triangulateShape(D,I),U=D;for(A=0,C=I.length;A<C;A++)L=I[A],D=D.concat(L);for(var F,N,V,G,z,k,j=D.length,W=B.length,H=[],X=0,Y=U.length,q=Y-1,Z=X+1;X<Y;X++,q++,Z++)q===Y&&(q=0),Z===Y&&(Z=0),H[X]=n(U[X],U[q],U[Z]);var K,Q=[],J=H.concat();for(A=0,C=I.length;A<C;A++){for(L=I[A],K=[],X=0,Y=L.length,q=Y-1,Z=X+1;X<Y;X++,q++,Z++)q===Y&&(q=0),Z===Y&&(Z=0),K[X]=n(L[X],L[q],L[Z]);Q.push(K),J=J.concat(K)}for(F=0;F<x;F++){for(V=F/x,G=v*(1-V),N=y*Math.sin(V*Math.PI/2),X=0,Y=U.length;X<Y;X++)z=i(U[X],H[X],N),c(z.x,z.y,-G);for(A=0,C=I.length;A<C;A++)for(L=I[A],K=Q[A],X=0,Y=L.length;X<Y;X++)z=i(L[X],K[X],N),c(z.x,z.y,-G)}for(N=y,X=0;X<j;X++)z=b?i(D[X],J[X],N):D[X],S?(f.copy(d.normals[0]).multiplyScalar(z.x),p.copy(d.binormals[0]).multiplyScalar(z.y),m.copy(u[0]).add(f).add(p),c(m.x,m.y,m.z)):c(z.x,z.y,0);var $;for($=1;$<=M;$++)for(X=0;X<j;X++)z=b?i(D[X],J[X],N):D[X],S?(f.copy(d.normals[$]).multiplyScalar(z.x),p.copy(d.binormals[$]).multiplyScalar(z.y),m.copy(u[$]).add(f).add(p),
|
|
c(m.x,m.y,m.z)):c(z.x,z.y,g/M*$);for(F=x-1;F>=0;F--){for(V=F/x,G=v*(1-V),N=y*Math.sin(V*Math.PI/2),X=0,Y=U.length;X<Y;X++)z=i(U[X],H[X],N),c(z.x,z.y,g+G);for(A=0,C=I.length;A<C;A++)for(L=I[A],K=Q[A],X=0,Y=L.length;X<Y;X++)z=i(L[X],K[X],N),S?c(z.x,z.y+u[M-1].y,u[M-1].x+G):c(z.x,z.y,g+G)}r(),o()},a.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,i,n){var r=t.vertices,o=r[e],s=r[i],c=r[n];return[new a.Vector2(o.x,o.y),new a.Vector2(s.x,s.y),new a.Vector2(c.x,c.y)]},generateSideWallUV:function(t,e,i,n,r){var o=t.vertices,s=o[e],c=o[i],h=o[n],l=o[r];return Math.abs(s.y-c.y)<.01?[new a.Vector2(s.x,1-s.z),new a.Vector2(c.x,1-c.z),new a.Vector2(h.x,1-h.z),new a.Vector2(l.x,1-l.z)]:[new a.Vector2(s.y,1-s.z),new a.Vector2(c.y,1-c.z),new a.Vector2(h.y,1-h.z),new a.Vector2(l.y,1-l.z)]}},a.ShapeGeometry=function(t,e){a.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(t)===!1&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},a.ShapeGeometry.prototype=Object.create(a.Geometry.prototype),a.ShapeGeometry.prototype.constructor=a.ShapeGeometry,a.ShapeGeometry.prototype.addShapeList=function(t,e){for(var i=0,n=t.length;i<n;i++)this.addShape(t[i],e);return this},a.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var i,n,r,o=void 0!==e.curveSegments?e.curveSegments:12,s=e.material,c=void 0===e.UVGenerator?a.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,h=this.vertices.length,l=t.extractPoints(o),u=l.shape,d=l.holes,p=!a.ShapeUtils.isClockWise(u);if(p){for(u=u.reverse(),i=0,n=d.length;i<n;i++)r=d[i],a.ShapeUtils.isClockWise(r)&&(d[i]=r.reverse());p=!1}var f=a.ShapeUtils.triangulateShape(u,d);for(i=0,n=d.length;i<n;i++)r=d[i],u=u.concat(r);var m,g,v=u.length,y=f.length;for(i=0;i<v;i++)m=u[i],this.vertices.push(new a.Vector3(m.x,m.y,0));for(i=0;i<y;i++){g=f[i];var x=g[0]+h,b=g[1]+h,_=g[2]+h;this.faces.push(new a.Face3(x,b,_,null,null,s)),this.faceVertexUvs[0].push(c.generateTopUV(this,x,b,_))}},a.LatheBufferGeometry=function(t,e,i,n){a.BufferGeometry.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=a.Math.clamp(n,0,2*Math.PI);var r,o,s,c=(e+1)*t.length,h=e*t.length*2*3,l=new a.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),u=new a.BufferAttribute(new Float32Array(3*c),3),d=new a.BufferAttribute(new Float32Array(2*c),2),p=0,f=0,m=(1/(t.length-1),1/e),g=new a.Vector3,v=new a.Vector2;for(o=0;o<=e;o++){var y=i+o*m*n,x=Math.sin(y),b=Math.cos(y);for(s=0;s<=t.length-1;s++)g.x=t[s].x*x,g.y=t[s].y,g.z=t[s].x*b,u.setXYZ(p,g.x,g.y,g.z),v.x=o/e,v.y=s/(t.length-1),d.setXY(p,v.x,v.y),p++}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++){r=s+o*t.length;var _=r,M=r+t.length,w=r+t.length+1,S=r+1;l.setX(f,_),f++,l.setX(f,M),f++,l.setX(f,S),f++,l.setX(f,M),f++,l.setX(f,w),f++,l.setX(f,S),f++}if(this.setIndex(l),this.addAttribute("position",u),this.addAttribute("uv",d),this.computeVertexNormals(),n===2*Math.PI){var T=this.attributes.normal.array,L=new a.Vector3,A=new a.Vector3,C=new a.Vector3;for(r=e*t.length*3,o=0,s=0;o<t.length;o++,s+=3)L.x=T[s+0],L.y=T[s+1],L.z=T[s+2],A.x=T[r+s+0],A.y=T[r+s+1],A.z=T[r+s+2],C.addVectors(L,A).normalize(),T[s+0]=T[r+s+0]=C.x,T[s+1]=T[r+s+1]=C.y,T[s+2]=T[r+s+2]=C.z}},a.LatheBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.LatheBufferGeometry.prototype.constructor=a.LatheBufferGeometry,a.LatheGeometry=function(t,e,i,n){a.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new a.LatheBufferGeometry(t,e,i,n)),this.mergeVertices()},a.LatheGeometry.prototype=Object.create(a.Geometry.prototype),a.LatheGeometry.prototype.constructor=a.LatheGeometry,a.PlaneGeometry=function(t,e,i,n){a.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new a.PlaneBufferGeometry(t,e,i,n))},a.PlaneGeometry.prototype=Object.create(a.Geometry.prototype),a.PlaneGeometry.prototype.constructor=a.PlaneGeometry,a.PlaneBufferGeometry=function(t,e,i,n){a.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,o=e/2,s=Math.floor(i)||1,c=Math.floor(n)||1,h=s+1,l=c+1,u=t/s,d=e/c,p=new Float32Array(h*l*3),f=new Float32Array(h*l*3),m=new Float32Array(h*l*2),g=0,v=0,y=0;y<l;y++)for(var x=y*d-o,b=0;b<h;b++){var _=b*u-r;p[g]=_,p[g+1]=-x,f[g+2]=1,m[v]=b/s,m[v+1]=1-y/c,g+=3,v+=2}g=0;for(var M=new(p.length/3>65535?Uint32Array:Uint16Array)(s*c*6),y=0;y<c;y++)for(var b=0;b<s;b++){var w=b+h*y,S=b+h*(y+1),T=b+1+h*(y+1),L=b+1+h*y;M[g]=w,M[g+1]=S,M[g+2]=L,M[g+3]=S,M[g+4]=T,M[g+5]=L,g+=6}this.setIndex(new a.BufferAttribute(M,1)),this.addAttribute("position",new a.BufferAttribute(p,3)),this.addAttribute("normal",new a.BufferAttribute(f,3)),this.addAttribute("uv",new a.BufferAttribute(m,2))},a.PlaneBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.PlaneBufferGeometry.prototype.constructor=a.PlaneBufferGeometry,a.RingBufferGeometry=function(t,e,i,n,r,o){a.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},t=t||20,e=e||50,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?Math.max(3,i):8,n=void 0!==n?Math.max(1,n):1;var s,c,h,l=(i+1)*(n+1),u=i*n*2*3,d=new a.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),p=new a.BufferAttribute(new Float32Array(3*l),3),f=new a.BufferAttribute(new Float32Array(3*l),3),m=new a.BufferAttribute(new Float32Array(2*l),2),g=0,v=0,y=t,x=(e-t)/n,b=new a.Vector3,_=new a.Vector2;for(c=0;c<=n;c++){for(h=0;h<=i;h++)s=r+h/i*o,b.x=y*Math.cos(s),b.y=y*Math.sin(s),p.setXYZ(g,b.x,b.y,b.z),f.setXYZ(g,0,0,1),_.x=(b.x/e+1)/2,_.y=(b.y/e+1)/2,m.setXY(g,_.x,_.y),g++;y+=x}for(c=0;c<n;c++){var M=c*(i+1);for(h=0;h<i;h++){s=h+M;var w=s,S=s+i+1,T=s+i+2,L=s+1;d.setX(v,w),v++,d.setX(v,S),v++,d.setX(v,T),v++,d.setX(v,w),v++,d.setX(v,T),v++,d.setX(v,L),v++}}this.setIndex(d),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",m)},a.RingBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.RingBufferGeometry.prototype.constructor=a.RingBufferGeometry,a.RingGeometry=function(t,e,i,n,r,o){a.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new a.RingBufferGeometry(t,e,i,n,r,o))},a.RingGeometry.prototype=Object.create(a.Geometry.prototype),a.RingGeometry.prototype.constructor=a.RingGeometry,a.SphereGeometry=function(t,e,i,n,r,o,s){a.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new a.SphereBufferGeometry(t,e,i,n,r,o,s))},a.SphereGeometry.prototype=Object.create(a.Geometry.prototype),a.SphereGeometry.prototype.constructor=a.SphereGeometry,a.SphereBufferGeometry=function(t,e,i,n,r,o,s){a.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:s},t=t||50,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,s=void 0!==s?s:Math.PI;for(var c=o+s,h=(e+1)*(i+1),l=new a.BufferAttribute(new Float32Array(3*h),3),u=new a.BufferAttribute(new Float32Array(3*h),3),d=new a.BufferAttribute(new Float32Array(2*h),2),p=0,f=[],m=new a.Vector3,g=0;g<=i;g++){for(var v=[],y=g/i,x=0;x<=e;x++){var b=x/e,_=-t*Math.cos(n+b*r)*Math.sin(o+y*s),M=t*Math.cos(o+y*s),w=t*Math.sin(n+b*r)*Math.sin(o+y*s);m.set(_,M,w).normalize(),l.setXYZ(p,_,M,w),u.setXYZ(p,m.x,m.y,m.z),d.setXY(p,b,1-y),v.push(p),p++}f.push(v)}for(var S=[],g=0;g<i;g++)for(var x=0;x<e;x++){var T=f[g][x+1],L=f[g][x],A=f[g+1][x],C=f[g+1][x+1];(0!==g||o>0)&&S.push(T,L,C),(g!==i-1||c<Math.PI)&&S.push(L,A,C)}this.setIndex(new(l.count>65535?a.Uint32Attribute:a.Uint16Attribute)(S,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",d),this.boundingSphere=new a.Sphere(new a.Vector3,t)},a.SphereBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.SphereBufferGeometry.prototype.constructor=a.SphereBufferGeometry,a.TextGeometry=function(t,e){e=e||{};var i=e.font;if(i instanceof a.Font==!1)return new a.Geometry;var n=i.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),a.ExtrudeGeometry.call(this,n,e),this.type="TextGeometry"},a.TextGeometry.prototype=Object.create(a.ExtrudeGeometry.prototype),a.TextGeometry.prototype.constructor=a.TextGeometry,a.TorusBufferGeometry=function(t,e,i,n,r){a.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var o,s,c=(i+1)*(n+1),h=i*n*2*3,l=new(h>65535?Uint32Array:Uint16Array)(h),u=new Float32Array(3*c),d=new Float32Array(3*c),p=new Float32Array(2*c),f=0,m=0,g=0,v=new a.Vector3,y=new a.Vector3,x=new a.Vector3;for(o=0;o<=i;o++)for(s=0;s<=n;s++){var b=s/n*r,_=o/i*Math.PI*2;y.x=(t+e*Math.cos(_))*Math.cos(b),y.y=(t+e*Math.cos(_))*Math.sin(b),y.z=e*Math.sin(_),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,v.x=t*Math.cos(b),v.y=t*Math.sin(b),x.subVectors(y,v).normalize(),d[f]=x.x,d[f+1]=x.y,d[f+2]=x.z,p[m]=s/n,p[m+1]=o/i,f+=3,m+=2}for(o=1;o<=i;o++)for(s=1;s<=n;s++){var M=(n+1)*o+s-1,w=(n+1)*(o-1)+s-1,S=(n+1)*(o-1)+s,T=(n+1)*o+s;l[g]=M,l[g+1]=w,l[g+2]=T,l[g+3]=w,l[g+4]=S,l[g+5]=T,g+=6}this.setIndex(new a.BufferAttribute(l,1)),this.addAttribute("position",new a.BufferAttribute(u,3)),this.addAttribute("normal",new a.BufferAttribute(d,3)),this.addAttribute("uv",new a.BufferAttribute(p,2))},a.TorusBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.TorusBufferGeometry.prototype.constructor=a.TorusBufferGeometry,a.TorusGeometry=function(t,e,i,n,r){a.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new a.TorusBufferGeometry(t,e,i,n,r))},a.TorusGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusGeometry.prototype.constructor=a.TorusGeometry,a.TorusKnotBufferGeometry=function(t,e,i,n,r,o){function s(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}a.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:o},t=t||100,e=e||40,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,o=o||3;var c,h,l=(n+1)*(i+1),u=n*i*2*3,d=new a.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),p=new a.BufferAttribute(new Float32Array(3*l),3),f=new a.BufferAttribute(new Float32Array(3*l),3),m=new a.BufferAttribute(new Float32Array(2*l),2),g=0,v=0,y=new a.Vector3,x=new a.Vector3,b=new a.Vector2,_=new a.Vector3,M=new a.Vector3,w=new a.Vector3,S=new a.Vector3,T=new a.Vector3;for(c=0;c<=i;++c){var L=c/i*r*Math.PI*2;for(s(L,r,o,t,_),s(L+.01,r,o,t,M),S.subVectors(M,_),T.addVectors(M,_),w.crossVectors(S,T),T.crossVectors(w,S),w.normalize(),T.normalize(),h=0;h<=n;++h){var A=h/n*Math.PI*2,C=-e*Math.cos(A),E=e*Math.sin(A);y.x=_.x+(C*T.x+E*w.x),y.y=_.y+(C*T.y+E*w.y),y.z=_.z+(C*T.z+E*w.z),p.setXYZ(g,y.x,y.y,y.z),x.subVectors(y,_).normalize(),f.setXYZ(g,x.x,x.y,x.z),b.x=c/i,b.y=h/n,m.setXY(g,b.x,b.y),g++}}for(h=1;h<=i;h++)for(c=1;c<=n;c++){var P=(n+1)*(h-1)+(c-1),R=(n+1)*h+(c-1),D=(n+1)*h+c,I=(n+1)*(h-1)+c;d.setX(v,P),v++,d.setX(v,R),v++,d.setX(v,I),v++,d.setX(v,R),v++,d.setX(v,D),v++,d.setX(v,I),v++}this.setIndex(d),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",m)},a.TorusKnotBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.TorusKnotBufferGeometry.prototype.constructor=a.TorusKnotBufferGeometry,a.TorusKnotGeometry=function(t,e,i,n,r,o,s){a.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:o},this.fromBufferGeometry(new a.TorusKnotBufferGeometry(t,e,i,n,r,o)),this.mergeVertices()},a.TorusKnotGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusKnotGeometry.prototype.constructor=a.TorusKnotGeometry,a.TubeGeometry=function(t,e,i,n,r,o){function s(t,e,i){return P.vertices.push(new a.Vector3(t,e,i))-1}a.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:i,radialSegments:n,closed:r,taper:o},e=e||64,i=i||1,n=n||8,r=r||!1,o=o||a.TubeGeometry.NoTaper;var c,h,l,u,d,p,f,m,g,v,y,x,b,_,M,w,S,T,L,A,C,E=[],P=this,R=e+1,D=new a.Vector3,I=new a.TubeGeometry.FrenetFrames(t,e,r),O=I.tangents,B=I.normals,U=I.binormals;for(this.tangents=O,this.normals=B,this.binormals=U,v=0;v<R;v++)for(E[v]=[],u=v/(R-1),g=t.getPointAt(u),c=O[v],h=B[v],l=U[v],p=i*o(u),y=0;y<n;y++)d=y/n*2*Math.PI,f=-p*Math.cos(d),m=p*Math.sin(d),D.copy(g),D.x+=f*h.x+m*l.x,D.y+=f*h.y+m*l.y,D.z+=f*h.z+m*l.z,E[v][y]=s(D.x,D.y,D.z);for(v=0;v<e;v++)for(y=0;y<n;y++)x=r?(v+1)%e:v+1,b=(y+1)%n,_=E[v][y],M=E[x][y],w=E[x][b],S=E[v][b],T=new a.Vector2(v/e,y/n),L=new a.Vector2((v+1)/e,y/n),A=new a.Vector2((v+1)/e,(y+1)/n),C=new a.Vector2(v/e,(y+1)/n),this.faces.push(new a.Face3(_,M,S)),this.faceVertexUvs[0].push([T,L,C]),this.faces.push(new a.Face3(M,w,S)),this.faceVertexUvs[0].push([L.clone(),A,C.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},a.TubeGeometry.prototype=Object.create(a.Geometry.prototype),a.TubeGeometry.prototype.constructor=a.TubeGeometry,a.TubeGeometry.NoTaper=function(t){return 1},a.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},a.TubeGeometry.FrenetFrames=function(t,e,i){function n(){f[0]=new a.Vector3,m[0]=new a.Vector3,o=Number.MAX_VALUE,s=Math.abs(p[0].x),c=Math.abs(p[0].y),h=Math.abs(p[0].z),s<=o&&(o=s,d.set(1,0,0)),c<=o&&(o=c,d.set(0,1,0)),h<=o&&d.set(0,0,1),g.crossVectors(p[0],d).normalize(),f[0].crossVectors(p[0],g),m[0].crossVectors(p[0],f[0])}var r,o,s,c,h,l,u,d=new a.Vector3,p=[],f=[],m=[],g=new a.Vector3,v=new a.Matrix4,y=e+1;for(this.tangents=p,this.normals=f,this.binormals=m,l=0;l<y;l++)u=l/(y-1),p[l]=t.getTangentAt(u),p[l].normalize();for(n(),l=1;l<y;l++)f[l]=f[l-1].clone(),m[l]=m[l-1].clone(),g.crossVectors(p[l-1],p[l]),g.length()>Number.EPSILON&&(g.normalize(),r=Math.acos(a.Math.clamp(p[l-1].dot(p[l]),-1,1)),f[l].applyMatrix4(v.makeRotationAxis(g,r))),m[l].crossVectors(p[l],f[l]);if(i)for(r=Math.acos(a.Math.clamp(f[0].dot(f[y-1]),-1,1)),r/=y-1,p[0].dot(g.crossVectors(f[0],f[y-1]))>0&&(r=-r),l=1;l<y;l++)f[l].applyMatrix4(v.makeRotationAxis(p[l],r*l)),m[l].crossVectors(p[l],f[l])},a.PolyhedronGeometry=function(t,e,i,n){function r(t){var e=t.normalize().clone();e.index=u.vertices.push(e)-1;var i=c(t)/2/Math.PI+.5,n=h(t)/Math.PI+.5;return e.uv=new a.Vector2(i,1-n),e}function o(t,e,i){var n=new a.Face3(t.index,e.index,i.index,[t.clone(),e.clone(),i.clone()]);u.faces.push(n),b.copy(t).add(e).add(i).divideScalar(3);var r=c(b);u.faceVertexUvs[0].push([l(t.uv,t,r),l(e.uv,e,r),l(i.uv,i,r)])}function s(t,e){for(var i=Math.pow(2,e),n=r(u.vertices[t.a]),a=r(u.vertices[t.b]),s=r(u.vertices[t.c]),c=[],h=0;h<=i;h++){c[h]=[];for(var l=r(n.clone().lerp(s,h/i)),d=r(a.clone().lerp(s,h/i)),p=i-h,f=0;f<=p;f++)0===f&&h===i?c[h][f]=l:c[h][f]=r(l.clone().lerp(d,f/p))}for(var h=0;h<i;h++)for(var f=0;f<2*(i-h)-1;f++){var m=Math.floor(f/2);f%2===0?o(c[h][m+1],c[h+1][m],c[h][m]):o(c[h][m+1],c[h+1][m+1],c[h+1][m])}}function c(t){return Math.atan2(t.z,-t.x)}function h(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}function l(t,e,i){return i<0&&1===t.x&&(t=new a.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new a.Vector2(i/2/Math.PI+.5,t.y)),t.clone()}a.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},i=i||1,n=n||0;for(var u=this,d=0,p=t.length;d<p;d+=3)r(new a.Vector3(t[d],t[d+1],t[d+2]));for(var f=this.vertices,m=[],d=0,g=0,p=e.length;d<p;d+=3,g++){var v=f[e[d]],y=f[e[d+1]],x=f[e[d+2]];m[g]=new a.Face3(v.index,y.index,x.index,[v.clone(),y.clone(),x.clone()])}for(var b=new a.Vector3,d=0,p=m.length;d<p;d++)s(m[d],n);for(var d=0,p=this.faceVertexUvs[0].length;d<p;d++){var _=this.faceVertexUvs[0][d],M=_[0].x,w=_[1].x,S=_[2].x,T=Math.max(M,w,S),L=Math.min(M,w,S);T>.9&&L<.1&&(M<.2&&(_[0].x+=1),w<.2&&(_[1].x+=1),S<.2&&(_[2].x+=1))}for(var d=0,p=this.vertices.length;d<p;d++)this.vertices[d].multiplyScalar(i);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new a.Sphere(new a.Vector3,i)},a.PolyhedronGeometry.prototype=Object.create(a.Geometry.prototype),a.PolyhedronGeometry.prototype.constructor=a.PolyhedronGeometry,a.DodecahedronGeometry=function(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];a.PolyhedronGeometry.call(this,r,o,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},a.DodecahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.DodecahedronGeometry.prototype.constructor=a.DodecahedronGeometry,a.IcosahedronGeometry=function(t,e){var i=(1+Math.sqrt(5))/2,n=[-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],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];a.PolyhedronGeometry.call(this,n,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},a.IcosahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.IcosahedronGeometry.prototype.constructor=a.IcosahedronGeometry,a.OctahedronGeometry=function(t,e){var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];a.PolyhedronGeometry.call(this,i,n,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},a.OctahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.OctahedronGeometry.prototype.constructor=a.OctahedronGeometry,a.TetrahedronGeometry=function(t,e){var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];a.PolyhedronGeometry.call(this,i,n,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},a.TetrahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.TetrahedronGeometry.prototype.constructor=a.TetrahedronGeometry,a.ParametricGeometry=function(t,e,i){a.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,o,s,c,h=this.vertices,l=this.faces,u=this.faceVertexUvs[0],d=e+1;for(n=0;n<=i;n++)for(c=n/i,r=0;r<=e;r++)s=r/e,o=t(s,c),h.push(o);var p,f,m,g,v,y,x,b;for(n=0;n<i;n++)for(r=0;r<e;r++)p=n*d+r,f=n*d+r+1,m=(n+1)*d+r+1,g=(n+1)*d+r,v=new a.Vector2(r/e,n/i),y=new a.Vector2((r+1)/e,n/i),x=new a.Vector2((r+1)/e,(n+1)/i),b=new a.Vector2(r/e,(n+1)/i),l.push(new a.Face3(p,f,g)),u.push([v,y,b]),l.push(new a.Face3(f,m,g)),u.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},a.ParametricGeometry.prototype=Object.create(a.Geometry.prototype),a.ParametricGeometry.prototype.constructor=a.ParametricGeometry,a.WireframeGeometry=function(t){function e(t,e){return t-e}a.BufferGeometry.call(this);var i=[0,0],n={},r=["a","b","c"];if(t instanceof a.Geometry){for(var o=t.vertices,s=t.faces,c=0,h=new Uint32Array(6*s.length),l=0,u=s.length;l<u;l++)for(var d=s[l],p=0;p<3;p++){i[0]=d[r[p]],i[1]=d[r[(p+1)%3]],i.sort(e);var f=i.toString();void 0===n[f]&&(h[2*c]=i[0],h[2*c+1]=i[1],n[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;l<u;l++)for(var p=0;p<2;p++){var g=o[h[2*l+p]],v=6*l+3*p;m[v+0]=g.x,m[v+1]=g.y,m[v+2]=g.z}this.addAttribute("position",new a.BufferAttribute(m,3))}else if(t instanceof a.BufferGeometry)if(null!==t.index){var y=t.index.array,o=t.attributes.position,x=t.groups,c=0;0===x.length&&t.addGroup(0,y.length);for(var h=new Uint32Array(2*y.length),b=0,_=x.length;b<_;++b)for(var M=x[b],w=M.start,S=M.count,l=w,T=w+S;l<T;l+=3)for(var p=0;p<3;p++){i[0]=y[l+p],i[1]=y[l+(p+1)%3],i.sort(e);var f=i.toString();void 0===n[f]&&(h[2*c]=i[0],h[2*c+1]=i[1],n[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;l<u;l++)for(var p=0;p<2;p++){var v=6*l+3*p,L=h[2*l+p];m[v+0]=o.getX(L),m[v+1]=o.getY(L),m[v+2]=o.getZ(L)}this.addAttribute("position",new a.BufferAttribute(m,3))}else{for(var o=t.attributes.position.array,c=o.length/3,A=c/3,m=new Float32Array(2*c*3),l=0,u=A;l<u;l++)for(var p=0;p<3;p++){var v=18*l+6*p,C=9*l+3*p;m[v+0]=o[C],m[v+1]=o[C+1],m[v+2]=o[C+2];var L=9*l+3*((p+1)%3);m[v+3]=o[L],m[v+4]=o[L+1],m[v+5]=o[L+2]}this.addAttribute("position",new a.BufferAttribute(m,3))}},a.WireframeGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.WireframeGeometry.prototype.constructor=a.WireframeGeometry,a.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),i=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new a.BufferGeometry;n.addAttribute("position",new a.BufferAttribute(e,3)),n.addAttribute("color",new a.BufferAttribute(i,3));var r=new a.LineBasicMaterial({vertexColors:a.VertexColors});a.LineSegments.call(this,n,r)},a.AxisHelper.prototype=Object.create(a.LineSegments.prototype),a.AxisHelper.prototype.constructor=a.AxisHelper,a.ArrowHelper=function(){var t=new a.BufferGeometry;t.addAttribute("position",new a.Float32Attribute([0,0,0,0,1,0],3));var e=new a.CylinderBufferGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(i,n,r,o,s,c){a.Object3D.call(this),void 0===o&&(o=16776960),void 0===r&&(r=1),void 0===s&&(s=.2*r),void 0===c&&(c=.2*s),this.position.copy(n),this.line=new a.Line(t,new a.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new a.Mesh(e,new a.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(i),this.setLength(r,s,c)}}(),a.ArrowHelper.prototype=Object.create(a.Object3D.prototype),a.ArrowHelper.prototype.constructor=a.ArrowHelper,a.ArrowHelper.prototype.setDirection=function(){var t,e=new a.Vector3;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),a.ArrowHelper.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},a.ArrowHelper.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},a.BoxHelper=function(t,e){void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new a.BufferGeometry;r.setIndex(new a.BufferAttribute(i,1)),r.addAttribute("position",new a.BufferAttribute(n,3)),a.LineSegments.call(this,r,new a.LineBasicMaterial({color:e})),void 0!==t&&this.update(t)},a.BoxHelper.prototype=Object.create(a.LineSegments.prototype),a.BoxHelper.prototype.constructor=a.BoxHelper,a.BoxHelper.prototype.update=function(){var t=new a.Box3;return function(e){if(e instanceof a.Box3?t.copy(e):t.setFromObject(e),!t.isEmpty()){var i=t.min,n=t.max,r=this.geometry.attributes.position,o=r.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=i.x,o[4]=n.y,o[5]=n.z,o[6]=i.x,o[7]=i.y,o[8]=n.z,o[9]=n.x,o[10]=i.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=i.z,o[15]=i.x,o[16]=n.y,o[17]=i.z,o[18]=i.x,o[19]=i.y,o[20]=i.z,o[21]=n.x,o[22]=i.y,o[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),a.BoundingBoxHelper=function(t,e){var i=void 0!==e?e:8947848;this.object=t,this.box=new a.Box3,a.Mesh.call(this,new a.BoxGeometry(1,1,1),new a.MeshBasicMaterial({color:i,wireframe:!0}))},a.BoundingBoxHelper.prototype=Object.create(a.Mesh.prototype),a.BoundingBoxHelper.prototype.constructor=a.BoundingBoxHelper,a.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},a.CameraHelper=function(t){function e(t,e,n){i(t,n),i(e,n)}function i(t,e){n.vertices.push(new a.Vector3),n.colors.push(new a.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(n.vertices.length-1)}var n=new a.Geometry,r=new a.LineBasicMaterial({color:16777215,vertexColors:a.FaceColors}),o={},s=16755200,c=16711680,h=43775,l=16777215,u=3355443;e("n1","n2",s),e("n2","n4",s),e("n4","n3",s),e("n3","n1",s),e("f1","f2",s),e("f2","f4",s),e("f4","f3",s),e("f3","f1",s),e("n1","f1",s),e("n2","f2",s),e("n3","f3",s),e("n4","f4",s),e("p","n1",c),e("p","n2",c),e("p","n3",c),e("p","n4",c),e("u1","u2",h),e("u2","u3",h),e("u3","u1",h),e("c","t",l),e("p","c",u),e("cn1","cn2",u),e("cn3","cn4",u),e("cf1","cf2",u),e("cf3","cf4",u),a.LineSegments.call(this,n,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},a.CameraHelper.prototype=Object.create(a.LineSegments.prototype),a.CameraHelper.prototype.constructor=a.CameraHelper,a.CameraHelper.prototype.update=function(){function t(t,a,o,s){n.set(a,o,s).unproject(r);var c=i[t];if(void 0!==c)for(var h=0,l=c.length;h<l;h++)e.vertices[c[h]].copy(n)}var e,i,n=new a.Vector3,r=new a.Camera;return function(){e=this.geometry,i=this.pointMap;var n=1,a=1;r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-n,-a,-1),t("n2",n,-a,-1),t("n3",-n,a,-1),t("n4",n,a,-1),t("f1",-n,-a,1),t("f2",n,-a,1),t("f3",-n,a,1),t("f4",n,a,1),t("u1",.7*n,1.1*a,-1),t("u2",.7*-n,1.1*a,-1),t("u3",0,2*a,-1),t("cf1",-n,0,1),t("cf2",n,0,1),t("cf3",0,-a,1),t("cf4",0,a,1),t("cn1",-n,0,-1),t("cn2",n,0,-1),t("cn3",0,-a,-1),t("cn4",0,a,-1),e.verticesNeedUpdate=!0}}(),a.DirectionalLightHelper=function(t,e){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var i=new a.BufferGeometry;i.addAttribute("position",new a.Float32Attribute([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new a.LineBasicMaterial({fog:!1});this.add(new a.Line(i,n)),i=new a.BufferGeometry,i.addAttribute("position",new a.Float32Attribute([0,0,0,0,0,1],3)),this.add(new a.Line(i,n)),this.update()},a.DirectionalLightHelper.prototype=Object.create(a.Object3D.prototype),a.DirectionalLightHelper.prototype.constructor=a.DirectionalLightHelper,a.DirectionalLightHelper.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},a.DirectionalLightHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(e,t);var n=this.children[0],r=this.children[1];n.lookAt(i),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(i),r.scale.z=i.length()}}(),a.EdgesHelper=function(t,e,i){var n=void 0!==e?e:16777215;a.LineSegments.call(this,new a.EdgesGeometry(t.geometry,i),new a.LineBasicMaterial({color:n})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},a.EdgesHelper.prototype=Object.create(a.LineSegments.prototype),a.EdgesHelper.prototype.constructor=a.EdgesHelper,a.FaceNormalsHelper=function(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,o=void 0!==n?n:1,s=0,c=this.object.geometry;c instanceof a.Geometry&&(s=c.faces.length);var h=new a.BufferGeometry,l=new a.Float32Attribute(2*s*3,3);h.addAttribute("position",l),a.LineSegments.call(this,h,new a.LineBasicMaterial({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()},a.FaceNormalsHelper.prototype=Object.create(a.LineSegments.prototype),a.FaceNormalsHelper.prototype.constructor=a.FaceNormalsHelper,a.FaceNormalsHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Matrix3;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,h=0,l=s.length;h<l;h++){var u=s[h],d=u.normal;t.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),e.copy(d).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}return r.needsUpdate=!0,this}}(),a.GridHelper=function(t,e,i,n){e=e||1,i=new a.Color(void 0!==i?i:4473924),n=new a.Color(void 0!==n?n:8947848);for(var r=e/2,o=2*t/e,s=[],c=[],h=0,l=0,u=-t;h<=e;h++,u+=o){s.push(-t,0,u,t,0,u),s.push(u,0,-t,u,0,t);var d=h===r?i:n;d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3}var p=new a.BufferGeometry;p.addAttribute("position",new a.Float32Attribute(s,3)),p.addAttribute("color",new a.Float32Attribute(c,3));var f=new a.LineBasicMaterial({vertexColors:a.VertexColors});a.LineSegments.call(this,p,f)},a.GridHelper.prototype=Object.create(a.LineSegments.prototype),a.GridHelper.prototype.constructor=a.GridHelper,a.GridHelper.prototype.setColors=function(){},a.HemisphereLightHelper=function(t,e){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new a.Color,new a.Color];var i=new a.SphereGeometry(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n<r;n++)i.faces[n].color=this.colors[n<4?0:1];var o=new a.MeshBasicMaterial({vertexColors:a.FaceColors,wireframe:!0});this.lightSphere=new a.Mesh(i,o),this.add(this.lightSphere),this.update()},a.HemisphereLightHelper.prototype=Object.create(a.Object3D.prototype),a.HemisphereLightHelper.prototype.constructor=a.HemisphereLightHelper,a.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},a.HemisphereLightHelper.prototype.update=function(){var t=new a.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(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),a.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var i=new a.SphereBufferGeometry(e,4,2),n=new a.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),a.Mesh.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},a.PointLightHelper.prototype=Object.create(a.Mesh.prototype),a.PointLightHelper.prototype.constructor=a.PointLightHelper,a.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},a.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},a.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new a.Geometry,i=0;i<this.bones.length;i++){var n=this.bones[i];n.parent instanceof a.Bone&&(e.vertices.push(new a.Vector3),e.vertices.push(new a.Vector3),e.colors.push(new a.Color(0,0,1)),e.colors.push(new a.Color(0,1,0)))}e.dynamic=!0;var r=new a.LineBasicMaterial({vertexColors:a.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});a.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},a.SkeletonHelper.prototype=Object.create(a.LineSegments.prototype),a.SkeletonHelper.prototype.constructor=a.SkeletonHelper,
|
|
a.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof a.Bone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,this.getBoneList(t.children[i]));return e},a.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new a.Matrix4).getInverse(this.root.matrixWorld),i=new a.Matrix4,n=0,r=0;r<this.bones.length;r++){var o=this.bones[r];o.parent instanceof a.Bone&&(i.multiplyMatrices(e,o.matrixWorld),t.vertices[n].setFromMatrixPosition(i),i.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[n+1].setFromMatrixPosition(i),n+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},a.SpotLightHelper=function(t){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new a.BufferGeometry,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1,o=32;n<o;n++,r++){var s=n/o*Math.PI*2,c=r/o*Math.PI*2;i.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}e.addAttribute("position",new a.Float32Attribute(i,3));var h=new a.LineBasicMaterial({fog:!1});this.cone=new a.LineSegments(e,h),this.add(this.cone),this.update()},a.SpotLightHelper.prototype=Object.create(a.Object3D.prototype),a.SpotLightHelper.prototype.constructor=a.SpotLightHelper,a.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},a.SpotLightHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),a.VertexNormalsHelper=function(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,o=void 0!==n?n:1,s=0,c=this.object.geometry;c instanceof a.Geometry?s=3*c.faces.length:c instanceof a.BufferGeometry&&(s=c.attributes.normal.count);var h=new a.BufferGeometry,l=new a.Float32Attribute(2*s*3,3);h.addAttribute("position",l),a.LineSegments.call(this,h,new a.LineBasicMaterial({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()},a.VertexNormalsHelper.prototype=Object.create(a.LineSegments.prototype),a.VertexNormalsHelper.prototype.constructor=a.VertexNormalsHelper,a.VertexNormalsHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,i=new a.Matrix3;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s instanceof a.Geometry)for(var c=s.vertices,h=s.faces,l=0,u=0,d=h.length;u<d;u++)for(var p=h[u],f=0,m=p.vertexNormals.length;f<m;f++){var g=c[p[n[f]]],v=p.vertexNormals[f];t.copy(g).applyMatrix4(r),e.copy(v).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1}else if(s instanceof a.BufferGeometry)for(var y=s.attributes.position,x=s.attributes.normal,l=0,f=0,m=y.count;f<m;f++)t.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(r),e.set(x.getX(f),x.getY(f),x.getZ(f)),e.applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1;return o.needsUpdate=!0,this}}(),a.WireframeHelper=function(t,e){var i=void 0!==e?e:16777215;a.LineSegments.call(this,new a.WireframeGeometry(t.geometry),new a.LineBasicMaterial({color:i})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},a.WireframeHelper.prototype=Object.create(a.LineSegments.prototype),a.WireframeHelper.prototype.constructor=a.WireframeHelper,a.ImmediateRenderObject=function(t){a.Object3D.call(this),this.material=t,this.render=function(t){}},a.ImmediateRenderObject.prototype=Object.create(a.Object3D.prototype),a.ImmediateRenderObject.prototype.constructor=a.ImmediateRenderObject,a.MorphBlendMesh=function(t,e){a.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n="__default",r=0,o=i-1,s=i/1;this.createAnimation(n,r,o,s),this.setAnimationWeight(n,1)},a.MorphBlendMesh.prototype=Object.create(a.Mesh.prototype),a.MorphBlendMesh.prototype.constructor=a.MorphBlendMesh,a.MorphBlendMesh.prototype.createAnimation=function(t,e,i,n){var r={start:e,end:i,length:i-e+1,fps:n,duration:(i-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},a.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;a<o;a++){var s=r.morphTargets[a],c=s.name.match(i);if(c&&c.length>1){var h=c[1];n[h]||(n[h]={start:1/0,end:-(1/0)});var l=n[h];a<l.start&&(l.start=a),a>l.end&&(l.end=a),e||(e=h)}}for(var h in n){var l=n[h];this.createAnimation(h,l.start,l.end,t)}this.firstAnimation=e},a.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},a.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},a.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var i=this.animationsMap[t];i&&(i.fps=e,i.duration=(i.end-i.start)/i.fps)},a.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var i=this.animationsMap[t];i&&(i.duration=e,i.fps=(i.end-i.start)/i.duration)},a.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var i=this.animationsMap[t];i&&(i.weight=e)},a.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var i=this.animationsMap[t];i&&(i.time=e)},a.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0,i=this.animationsMap[t];return i&&(e=i.time),e},a.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1,i=this.animationsMap[t];return i&&(e=i.duration),e},a.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e&&(e.time=0,e.active=!0)},a.MorphBlendMesh.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},a.MorphBlendMesh.prototype.update=function(t){for(var e=0,i=this.animationsList.length;e<i;e++){var n=this.animationsList[e];if(n.active){var r=n.duration/n.length;n.time+=n.direction*t,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var o=n.start+a.Math.clamp(Math.floor(n.time/r),0,n.length-1),s=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[o]=0,n.lastFrame=n.currentFrame,n.currentFrame=o);var c=n.time%r/r;n.directionBackwards&&(c=1-c),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=c*s,this.morphTargetInfluences[n.lastFrame]=(1-c)*s):this.morphTargetInfluences[n.currentFrame]=s}}}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(2),h=n(c),l=function(){function t(e,i){var n=this;r(this,t),this.container=e,this.scene=i,this.threeRenderer=new s["default"].WebGLRenderer({antialias:!0}),this.threeRenderer.setClearColor(i.fog.color),this.threeRenderer.setPixelRatio(window.devicePixelRatio),e.appendChild(this.threeRenderer.domElement),this.threeRenderer.gammaInput=!0,this.threeRenderer.gammaOutput=!0,this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=s["default"].PCFSoftShadowMap,this.threeRenderer.shadowMapSoft=!0,this.threeRenderer.autoClear=!1,h["default"].maxAnisotropy=this.threeRenderer.getMaxAnisotropy(),this.updateSize(),document.addEventListener("DOMContentLoaded",function(){return n.updateSize()},!1),window.addEventListener("resize",function(){return n.updateSize()},!1)}return a(t,[{key:"updateSize",value:function(){this.threeRenderer.setSize(this.container.offsetWidth,this.container.offsetHeight)}},{key:"render",value:function(t,e){this.threeRenderer.render(t,e)}}]),t}();e["default"]=l},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(2),h=n(c),l=function(){function t(e){var i=this;r(this,t);var n=e.domElement.width,a=e.domElement.height;this.threeCamera=new s["default"].PerspectiveCamera(h["default"].camera.fov,n/a,h["default"].camera.near,h["default"].camera.far),this.threeCamera.position.set(h["default"].camera.posX,h["default"].camera.posY,h["default"].camera.posZ),this.updateSize(e),window.addEventListener("resize",function(){return i.updateSize(e)},!1)}return a(t,[{key:"updateSize",value:function(t){this.threeCamera.aspect=t.domElement.width*h["default"].dpr/(t.domElement.height*h["default"].dpr),this.threeCamera.updateProjectionMatrix()}}]),t}();e["default"]=l},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(2),h=n(c),l=function(){function t(e){r(this,t),this.scene=e,this.init()}return a(t,[{key:"init",value:function(){this.ambientLight=new s["default"].AmbientLight(h["default"].ambientLight.color),this.ambientLight.visible=h["default"].ambientLight.enabled,this.pointLight=new s["default"].PointLight(h["default"].pointLight.color,h["default"].pointLight.intensity,h["default"].pointLight.distance),this.pointLight.position.set(h["default"].pointLight.x,h["default"].pointLight.y,h["default"].pointLight.z),this.pointLight.visible=h["default"].pointLight.enabled,this.directionalLight=new s["default"].DirectionalLight(h["default"].directionalLight.color,h["default"].directionalLight.intensity),this.directionalLight.position.set(h["default"].directionalLight.x,h["default"].directionalLight.y,h["default"].directionalLight.z),this.directionalLight.visible=h["default"].directionalLight.enabled,this.directionalLight.castShadow=h["default"].shadow.enabled,this.directionalLight.shadow.bias=h["default"].shadow.bias,this.directionalLight.shadow.camera.near=h["default"].shadow.near,this.directionalLight.shadow.camera.far=h["default"].shadow.far,this.directionalLight.shadow.camera.left=h["default"].shadow.left,this.directionalLight.shadow.camera.right=h["default"].shadow.right,this.directionalLight.shadow.camera.top=h["default"].shadow.top,this.directionalLight.shadow.camera.bottom=h["default"].shadow.bottom,this.directionalLight.shadow.mapSize.width=h["default"].shadow.mapWidth,this.directionalLight.shadow.mapSize.height=h["default"].shadow.mapHeight,this.directionalLightHelper=new s["default"].CameraHelper(this.directionalLight.shadow.camera),this.directionalLightHelper.visible=h["default"].shadow.helperEnabled,this.hemiLight=new s["default"].HemisphereLight(h["default"].hemiLight.color,h["default"].hemiLight.groundColor,h["default"].hemiLight.intensity),this.hemiLight.position.set(h["default"].hemiLight.x,h["default"].hemiLight.y,h["default"].hemiLight.z),this.hemiLight.visible=h["default"].hemiLight.enabled}},{key:"place",value:function(t){switch(t){case"ambient":this.scene.add(this.ambientLight);break;case"directional":this.scene.add(this.directionalLight),this.scene.add(this.directionalLightHelper);break;case"point":this.scene.add(this.pointLight);break;case"hemi":this.scene.add(this.hemiLight)}}}]),t}();e["default"]=l},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(11),h=n(c),l=i(2),u=n(l),d=function(){function t(e,i){r(this,t);var n=new h["default"](s["default"]);this.threeControls=new n(e,i),this.init()}return a(t,[{key:"init",value:function(){this.threeControls.target.set(u["default"].controls.target.x,u["default"].controls.target.y,u["default"].controls.target.z),this.threeControls.autoRotate=u["default"].controls.autoRotate,this.threeControls.autoRotateSpeed=u["default"].controls.autoRotateSpeed,this.threeControls.rotateSpeed=u["default"].controls.rotateSpeed,this.threeControls.zoomSpeed=u["default"].controls.zoomSpeed,this.threeControls.minDistance=u["default"].controls.minDistance,this.threeControls.maxDistance=u["default"].controls.maxDistance,this.threeControls.minPolarAngle=u["default"].controls.minPolarAngle,this.threeControls.maxPolarAngle=u["default"].controls.maxPolarAngle,this.threeControls.enableDamping=u["default"].controls.enableDamping,this.threeControls.enableZoom=u["default"].controls.enableZoom,this.threeControls.dampingFactor=u["default"].controls.dampingFactor}}]),t}();e["default"]=d},function(t,e){"use strict";t.exports=function(t){function e(e){this.object=e,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var i,n,r=this,a=1e-6,o=0,s=0,c=1,h=new t.Vector3,l=!1;this.getPolarAngle=function(){return n},this.getAzimuthalAngle=function(){return i},this.rotateLeft=function(t){s-=t},this.rotateUp=function(t){o-=t},this.panLeft=function(){var e=new t.Vector3;return function(t){var i=this.object.matrix.elements;e.set(i[0],i[1],i[2]),e.multiplyScalar(-t),h.add(e)}}(),this.panUp=function(){var e=new t.Vector3;return function(t){var i=this.object.matrix.elements;e.set(i[4],i[5],i[6]),e.multiplyScalar(t),h.add(e)}}(),this.pan=function(e,i,n,a){if(r.object instanceof t.PerspectiveCamera){var o=r.object.position,s=o.clone().sub(r.target),c=s.length();c*=Math.tan(r.object.fov/2*Math.PI/180),r.panLeft(2*e*c/a),r.panUp(2*i*c/a)}else r.object instanceof t.OrthographicCamera&&(r.panLeft(e*(r.object.right-r.object.left)/n),r.panUp(i*(r.object.top-r.object.bottom)/a))},this.dollyIn=function(e){r.object instanceof t.PerspectiveCamera?c/=e:r.object instanceof t.OrthographicCamera&&(r.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),r.object.updateProjectionMatrix(),l=!0)},this.dollyOut=function(e){r.object instanceof t.PerspectiveCamera?c*=e:r.object instanceof t.OrthographicCamera&&(r.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),r.object.updateProjectionMatrix(),l=!0)},this.update=function(){var r=new t.Vector3,u=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),d=u.clone().inverse(),p=new t.Vector3,f=new t.Quaternion;return function(){var t=this.object.position;r.copy(t).sub(this.target),r.applyQuaternion(u),i=Math.atan2(r.x,r.z),n=Math.atan2(Math.sqrt(r.x*r.x+r.z*r.z),r.y),i+=s,n+=o,i=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,i)),n=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,n)),n=Math.max(a,Math.min(Math.PI-a,n));var e=r.length()*c;return e=Math.max(this.minDistance,Math.min(this.maxDistance,e)),this.target.add(h),r.x=e*Math.sin(n)*Math.sin(i),r.y=e*Math.cos(n),r.z=e*Math.sin(n)*Math.cos(i),r.applyQuaternion(d),t.copy(this.target).add(r),this.object.lookAt(this.target),this.enableDamping===!0?(s*=1-this.dampingFactor,o*=1-this.dampingFactor):(s=0,o=0),c=1,h.set(0,0,0),!!(l||p.distanceToSquared(this.object.position)>a||8*(1-f.dot(this.object.quaternion))>a)&&(p.copy(this.object.position),f.copy(this.object.quaternion),l=!1,!0)}}()}function i(i,n){function r(t,e){var i=v.domElement===document?v.domElement.body:v.domElement;g.pan(t,e,i.clientWidth,i.clientHeight)}function a(){return 2*Math.PI/60/60*v.autoRotateSpeed}function o(){return Math.pow(.95,v.zoomSpeed)}function s(t){if(v.enabled!==!1){if(t.preventDefault(),t.button===v.mouseButtons.ORBIT){if(v.enableRotate===!1)return;C=A.ROTATE,y.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.ZOOM){if(v.enableZoom===!1)return;C=A.DOLLY,S.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.PAN){if(v.enablePan===!1)return;C=A.PAN,_.set(t.clientX,t.clientY)}C!==A.NONE&&(document.addEventListener("mousemove",c,!1),document.addEventListener("mouseup",h,!1),v.dispatchEvent(P))}}function c(t){if(v.enabled!==!1){t.preventDefault();var e=v.domElement===document?v.domElement.body:v.domElement;if(C===A.ROTATE){if(v.enableRotate===!1)return;x.set(t.clientX,t.clientY),b.subVectors(x,y),g.rotateLeft(2*Math.PI*b.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*b.y/e.clientHeight*v.rotateSpeed),y.copy(x)}else if(C===A.DOLLY){if(v.enableZoom===!1)return;T.set(t.clientX,t.clientY),L.subVectors(T,S),L.y>0?g.dollyIn(o()):L.y<0&&g.dollyOut(o()),S.copy(T)}else if(C===A.PAN){if(v.enablePan===!1)return;M.set(t.clientX,t.clientY),w.subVectors(M,_),r(w.x,w.y),_.copy(M)}C!==A.NONE&&v.update()}}function h(){v.enabled!==!1&&(document.removeEventListener("mousemove",c,!1),document.removeEventListener("mouseup",h,!1),v.dispatchEvent(R),C=A.NONE)}function l(t){if(v.enabled!==!1&&v.enableZoom!==!1&&C===A.NONE){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?g.dollyOut(o()):e<0&&g.dollyIn(o()),v.update(),v.dispatchEvent(P),v.dispatchEvent(R)}}function u(t){if(v.enabled!==!1&&v.enableKeys!==!1&&v.enablePan!==!1)switch(t.keyCode){case v.keys.UP:r(0,v.keyPanSpeed),v.update();break;case v.keys.BOTTOM:r(0,-v.keyPanSpeed),v.update();break;case v.keys.LEFT:r(v.keyPanSpeed,0),v.update();break;case v.keys.RIGHT:r(-v.keyPanSpeed,0),v.update()}}function d(t){if(v.enabled!==!1){switch(t.touches.length){case 1:if(v.enableRotate===!1)return;C=A.TOUCH_ROTATE,y.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(v.enableZoom===!1)return;C=A.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);S.set(0,n);break;case 3:if(v.enablePan===!1)return;C=A.TOUCH_PAN,_.set(t.touches[0].pageX,t.touches[0].pageY);break;default:C=A.NONE}C!==A.NONE&&v.dispatchEvent(P)}}function p(t){if(v.enabled!==!1){t.preventDefault(),t.stopPropagation();var e=v.domElement===document?v.domElement.body:v.domElement;switch(t.touches.length){case 1:if(v.enableRotate===!1)return;if(C!==A.TOUCH_ROTATE)return;x.set(t.touches[0].pageX,t.touches[0].pageY),b.subVectors(x,y),g.rotateLeft(2*Math.PI*b.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*b.y/e.clientHeight*v.rotateSpeed),y.copy(x),v.update();break;case 2:if(v.enableZoom===!1)return;if(C!==A.TOUCH_DOLLY)return;var i=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,a=Math.sqrt(i*i+n*n);T.set(0,a),L.subVectors(T,S),L.y>0?g.dollyOut(o()):L.y<0&&g.dollyIn(o()),S.copy(T),v.update();break;case 3:if(v.enablePan===!1)return;if(C!==A.TOUCH_PAN)return;M.set(t.touches[0].pageX,t.touches[0].pageY),w.subVectors(M,_),r(w.x,w.y),_.copy(M),v.update();break;default:C=A.NONE}}}function f(){v.enabled!==!1&&(v.dispatchEvent(R),C=A.NONE)}function m(t){t.preventDefault()}var g=new e(i);this.domElement=void 0!==n?n:document,Object.defineProperty(this,"constraint",{get:function(){return g}}),this.getPolarAngle=function(){return g.getPolarAngle()},this.getAzimuthalAngle=function(){return g.getAzimuthalAngle()},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:t.MOUSE.LEFT,ZOOM:t.MOUSE.MIDDLE,PAN:t.MOUSE.RIGHT};var v=this,y=new t.Vector2,x=new t.Vector2,b=new t.Vector2,_=new t.Vector2,M=new t.Vector2,w=new t.Vector2,S=new t.Vector2,T=new t.Vector2,L=new t.Vector2,A={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},C=A.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom;var E={type:"change"},P={type:"start"},R={type:"end"};this.update=function(){this.autoRotate&&C===A.NONE&&g.rotateLeft(a()),g.update()===!0&&this.dispatchEvent(E)},this.reset=function(){C=A.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(E),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",m,!1),this.domElement.removeEventListener("mousedown",s,!1),this.domElement.removeEventListener("mousewheel",l,!1),this.domElement.removeEventListener("MozMousePixelScroll",l,!1),this.domElement.removeEventListener("touchstart",d,!1),this.domElement.removeEventListener("touchend",f,!1),this.domElement.removeEventListener("touchmove",p,!1),document.removeEventListener("mousemove",c,!1),document.removeEventListener("mouseup",h,!1),window.removeEventListener("keydown",u,!1)},this.domElement.addEventListener("contextmenu",m,!1),this.domElement.addEventListener("mousedown",s,!1),this.domElement.addEventListener("mousewheel",l,!1),this.domElement.addEventListener("MozMousePixelScroll",l,!1),this.domElement.addEventListener("touchstart",d,!1),this.domElement.addEventListener("touchend",f,!1),this.domElement.addEventListener("touchmove",p,!1),window.addEventListener("keydown",u,!1),this.update()}var n=t.MOUSE;return n||(n={LEFT:0,MIDDLE:1,RIGHT:2}),i.prototype=Object.create(t.EventDispatcher.prototype),i.prototype.constructor=i,Object.defineProperties(i.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(t){this.constraint.target.copy(t)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(t){this.constraint.minDistance=t}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(t){this.constraint.maxDistance=t}},minZoom:{get:function(){return this.constraint.minZoom},set:function(t){this.constraint.minZoom=t}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(t){this.constraint.maxZoom=t}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(t){this.constraint.minPolarAngle=t}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(t){this.constraint.maxPolarAngle=t}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(t){this.constraint.minAzimuthAngle=t}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(t){this.constraint.maxAzimuthAngle=t}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(t){this.constraint.enableDamping=t}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(t){this.constraint.dampingFactor=t}},noZoom:{get:function(){return!this.enableZoom},set:function(t){this.enableZoom=!t}},noRotate:{get:function(){return!this.enableRotate},set:function(t){this.enableRotate=!t}},noPan:{get:function(){return!this.enablePan},set:function(t){this.enablePan=!t}},noKeys:{get:function(){return!this.enableKeys},set:function(t){this.enableKeys=!t}},staticMoving:{get:function(){return!this.constraint.enableDamping},set:function(t){this.constraint.enableDamping=!t}},dynamicDampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(t){this.constraint.dampingFactor=t}}}),i}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(6),c=n(s),h=i(2),l=n(h),u=function(){function t(e){a(this,t),this.scene=e,this.geo=null}return o(t,[{key:"make",value:function(t){var e=this;if("plane"==t)return function(t,i){var n=arguments.length<=2||void 0===arguments[2]?1:arguments[2],r=arguments.length<=3||void 0===arguments[3]?1:arguments[3];e.geo=new c["default"].PlaneGeometry(t,i,n,r)}}},{key:"place",value:function(t,e){var i,n,a=new c["default"].MeshStandardMaterial({color:13421772,side:c["default"].DoubleSide}),o=new c["default"].Mesh(this.geo,a);(i=o.position).set.apply(i,r(t)),(n=o.rotation).set.apply(n,r(e)),l["default"].shadow.enabled&&(o.receiveShadow=!0,o.castShadow=!0),this.scene.add(o)}}]),t}();e["default"]=u},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(14),h=i(2),l=n(h),u=function(){function t(){r(this,t),this.textures={}}return a(t,[{key:"load",value:function(){var t=this,e=new s["default"].TextureLoader,i=l["default"].maxAnisotropy,n=l["default"].texture.imageFiles,r=[];return e.setPath(l["default"].texture.path),n.forEach(function(t){r.push(new c.Promise(function(n,r){e.load(t.image,function(e){e.anisotropy=i;var r={};r[t.name]=e,r[t.name]instanceof s["default"].Texture&&n(r)},function(t){},function(e){r(new Error(e+"An error occurred loading while loading "+t.image))})}))}),c.Promise.all(r).then(function(e){for(var i=0;i<e.length;i++)t.textures[Object.keys(e[i])[0]]=e[i][Object.keys(e[i])[0]]})}}]),t}();e["default"]=u},function(t,e,i){var n;(function(t,r,a){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};(function(){function s(t){return"function"==typeof t||"object"===("undefined"==typeof t?"undefined":o(t))&&null!==t}function c(t){return"function"==typeof t}function h(t){Q=t}function l(t){et=t}function u(){return function(){t.nextTick(g)}}function d(){return function(){K(g)}}function p(){var t=0,e=new rt(g),i=document.createTextNode("");return e.observe(i,{characterData:!0}),function(){i.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=g,function(){t.port2.postMessage(0)}}function m(){return function(){setTimeout(g,1)}}function g(){for(var t=0;t<tt;t+=2){var e=st[t],i=st[t+1];e(i),st[t]=void 0,st[t+1]=void 0}tt=0}function v(){try{var t=i(17);return K=t.runOnLoop||t.runOnContext,d()}catch(e){return m()}}function y(t,e){var i=this,n=new this.constructor(b);void 0===n[lt]&&V(n);var r=i._state;if(r){var a=arguments[r-1];et(function(){U(r,n,a,i._result)})}else D(i,n,t,e);return n}function x(t){var e=this;if(t&&"object"===("undefined"==typeof t?"undefined":o(t))&&t.constructor===e)return t;var i=new e(b);return C(i,t),i}function b(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function M(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return ft.error=e,ft}}function S(t,e,i,n){try{t.call(e,i,n)}catch(r){return r}}function T(t,e,i){et(function(t){var n=!1,r=S(i,e,function(i){n||(n=!0,e!==i?C(t,i):P(t,i))},function(e){n||(n=!0,R(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&r&&(n=!0,R(t,r))},t)}function L(t,e){e._state===dt?P(t,e._result):e._state===pt?R(t,e._result):D(e,void 0,function(e){C(t,e)},function(e){R(t,e)})}function A(t,e,i){e.constructor===t.constructor&&i===ct&&constructor.resolve===ht?L(t,e):i===ft?R(t,ft.error):void 0===i?P(t,e):c(i)?T(t,e,i):P(t,e)}function C(t,e){t===e?R(t,_()):s(e)?A(t,e,w(e)):P(t,e)}function E(t){t._onerror&&t._onerror(t._result),I(t)}function P(t,e){t._state===ut&&(t._result=e,t._state=dt,0!==t._subscribers.length&&et(I,t))}function R(t,e){t._state===ut&&(t._state=pt,t._result=e,et(E,t))}function D(t,e,i,n){var r=t._subscribers,a=r.length;t._onerror=null,r[a]=e,r[a+dt]=i,r[a+pt]=n,0===a&&t._state&&et(I,t)}function I(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var n,r,a=t._result,o=0;o<e.length;o+=3)n=e[o],r=e[o+i],n?U(i,n,r,a):r(a);t._subscribers.length=0}}function O(){this.error=null}function B(t,e){try{return t(e)}catch(i){return mt.error=i,mt}}function U(t,e,i,n){var r,a,o,s,h=c(i);if(h){if(r=B(i,n),r===mt?(s=!0,a=r.error,r=null):o=!0,e===r)return void R(e,M())}else r=n,o=!0;e._state!==ut||(h&&o?C(e,r):s?R(e,a):t===dt?P(e,r):t===pt&&R(e,r))}function F(t,e){try{e(function(e){C(t,e)},function(e){R(t,e)})}catch(i){R(t,i)}}function N(){return gt++}function V(t){t[lt]=gt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function G(t){return new _t(this,t).promise}function z(t){var e=this;return new e($(t)?function(i,n){for(var r=t.length,a=0;a<r;a++)e.resolve(t[a]).then(i,n)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function k(t){var e=this,i=new e(b);return R(i,t),i}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function W(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function H(t){this[lt]=N(),this._result=this._state=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&j(),this instanceof H?F(this,t):W())}function X(t,e){this._instanceConstructor=t,this.promise=new t(b),this.promise[lt]||V(this.promise),$(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&P(this.promise,this._result))):R(this.promise,Y())}function Y(){return new Error("Array Methods must be provided an Array")}function q(){var t;if("undefined"!=typeof r)t=r;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var i=t.Promise;i&&"[object Promise]"===Object.prototype.toString.call(i.resolve())&&!i.cast||(t.Promise=bt)}var Z;Z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var K,Q,J,$=Z,tt=0,et=function(t,e){st[tt]=t,st[tt+1]=e,tt+=2,2===tt&&(Q?Q(g):J())},it="undefined"!=typeof window?window:void 0,nt=it||{},rt=nt.MutationObserver||nt.WebKitMutationObserver,at="undefined"==typeof self&&"undefined"!=typeof t&&"[object process]"==={}.toString.call(t),ot="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,st=new Array(1e3);
|
|
J=at?u():rt?p():ot?f():void 0===it?v():m();var ct=y,ht=x,lt=Math.random().toString(36).substring(16),ut=void 0,dt=1,pt=2,ft=new O,mt=new O,gt=0,vt=G,yt=z,xt=k,bt=H;H.all=vt,H.race=yt,H.resolve=ht,H.reject=xt,H._setScheduler=h,H._setAsap=l,H._asap=et,H.prototype={constructor:H,then:ct,"catch":function(t){return this.then(null,t)}};var _t=X;X.prototype._enumerate=function(){for(var t=this.length,e=this._input,i=0;this._state===ut&&i<t;i++)this._eachEntry(e[i],i)},X.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===ht){var r=w(t);if(r===ct&&t._state!==ut)this._settledAt(t._state,e,t._result);else if("function"!=typeof r)this._remaining--,this._result[e]=t;else if(i===bt){var a=new i(b);A(a,t,r),this._willSettleAt(a,e)}else this._willSettleAt(new i(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},X.prototype._settledAt=function(t,e,i){var n=this.promise;n._state===ut&&(this._remaining--,t===pt?R(n,i):this._result[e]=i),0===this._remaining&&P(n,this._result)},X.prototype._willSettleAt=function(t,e){var i=this;D(t,void 0,function(t){i._settledAt(dt,e,t)},function(t){i._settledAt(pt,e,t)})};var Mt=q,wt={Promise:bt,polyfill:Mt};i(18).amd?(n=function(){return wt}.call(e,i,e,a),!(void 0!==n&&(a.exports=n))):"undefined"!=typeof a&&a.exports?a.exports=wt:"undefined"!=typeof this&&(this.ES6Promise=wt),Mt()}).call(void 0)}).call(e,i(15),function(){return this}(),i(16)(t))},function(t,e){"use strict";function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(t){if(l===setTimeout)return setTimeout(t,0);if((l===i||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function a(t){if(u===clearTimeout)return clearTimeout(t);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}function o(){m&&p&&(m=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!m){var t=r(o);m=!0;for(var e=f.length;e;){for(p=f,f=[];++g<e;)p&&p[g].run();g=-1,e=f.length}p=null,m=!1,a(t)}}function c(t,e){this.fun=t,this.array=e}function h(){}var l,u,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:i}catch(t){l=i}try{u="function"==typeof clearTimeout?clearTimeout:n}catch(t){u=n}}();var p,f=[],m=!1,g=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];f.push(new c(t,e)),1!==f.length||m||r(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=h,d.addListener=h,d.once=h,d.off=h,d.removeListener=h,d.removeAllListeners=h,d.emit=h,d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){},function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=n(o),c=i(20),h=n(c),l=i(21),u=n(l),d=i(2),p=n(d),f=function(){function t(e,i,n){r(this,t),this.scene=e,this.textures=n,this.loader=new s["default"].ObjectLoader(i),this.obj=null}return a(t,[{key:"load",value:function(){var e=this;this.loader.load(p["default"].model.path,function(t){t.traverse(function(t){if(t instanceof s["default"].Mesh){var i=(new h["default"]).standard;i.map=e.textures.UV,t.material=i,p["default"].shadow.enabled&&(t.receiveShadow=!0,t.castShadow=!0)}}),p["default"].isDev&&p["default"].mesh.enableHelper&&new u["default"](e.scene,t),e.obj=t,t.scale.multiplyScalar(p["default"].model.scale),e.scene.add(t)},t.onProgress,t.onError)}}],[{key:"onProgress",value:function(t){if(t.lengthComputable){t.loaded/t.total*100}}},{key:"onError",value:function(t){}}]),t}();e["default"]=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=i(6),o=n(a),s=i(2),c=(n(s),function h(){r(this,h),this.emissive=new o["default"].MeshBasicMaterial({color:15658734,side:o["default"].DoubleSide,fog:!1}),this.standard=new o["default"].MeshStandardMaterial({shading:o["default"].FlatShading,roughness:1,metalness:0,side:o["default"].DoubleSide,fog:!1}),this.wire=new o["default"].MeshBasicMaterial({wireframe:!0})});e["default"]=c},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=i(6),o=n(a),s=function c(t,e){r(this,c);var i=new o["default"].WireframeGeometry(e.geometry),n=new o["default"].LineSegments(i);n.material.depthTest=!1,n.material.opacity=.25,n.material.transparent=!0,e.add(n);var a=new o["default"].EdgesGeometry(e.geometry),s=new o["default"].LineSegments(a);s.material.depthTest=!1,s.material.opacity=.25,s.material.transparent=!0,e.add(s),t.add(new o["default"].BoxHelper(e)),t.add(new o["default"].FaceNormalsHelper(e,2)),t.add(new o["default"].VertexNormalsHelper(e,2))};e["default"]=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(6),s=(n(o),i(23)),c=n(s),h=i(24),l=n(h),u=i(2),d=(n(u),function(){function t(e,i,n,a){var o=this;r(this,t),this.renderer=e,this.scene=i,this.camera=n,this.controls=a,this.keyboard=new c["default"],this.renderer.domElement.addEventListener("mouseup",function(t){return o.onMouseUp(t)},!1),this.renderer.domElement.addEventListener("mousemove",function(t){return l["default"].throttle(o.onMouseMove(t),250)},!1),this.renderer.domElement.addEventListener("mouseenter",function(t){return o.onMouseEnter(t)},!1),this.renderer.domElement.addEventListener("mouseleave",function(t){return o.onMouseLeave(t)},!1),this.renderer.domElement.addEventListener("mouseover",function(t){return o.onMouseOver(t)},!1),this.keyboard.domElement.addEventListener("keydown",function(t){t.repeat||o.keyboard.eventMatches(t,"escape")})}return a(t,[{key:"onMouseEnter",value:function(t){t.preventDefault()}},{key:"onMouseOver",value:function(t){t.preventDefault()}},{key:"onMouseLeave",value:function(t){t.preventDefault()}},{key:"onMouseMove",value:function(t){t.preventDefault()}},{key:"onMouseUp",value:function(t){t.preventDefault()}}]),t}());e["default"]=d},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r={left:37,up:38,right:39,down:40,space:32,pageup:33,pagedown:34,tab:9,escape:27},a=function(){function t(e){var n=this;i(this,t),this.domElement=e||document,this.keyCodes={},this.domElement.addEventListener("keydown",function(){return n.onKeyChange(event)},!1),this.domElement.addEventListener("keyup",function(){return n.onKeyChange(event)},!1),window.addEventListener("blur",function(){return n.onBlur},!1)}return n(t,[{key:"destroy",value:function(){var t=this;this.domElement.removeEventListener("keydown",function(){return t.onKeyChange(event)},!1),this.domElement.removeEventListener("keyup",function(){return t.onKeyChange(event)},!1),window.removeEventListener("blur",function(){return t.onBlur},!1)}},{key:"onBlur",value:function(){for(var t in this.keyCodes)this.keyCodes[t]=!1}},{key:"onKeyChange",value:function(t){var e=t.keyCode;this.keyCodes[e]="keydown"===t.type}},{key:"pressed",value:function e(t){for(var i=t.split("+"),n=0;n<i.length;n++){var a=i[n],e=!1;if(e=Object.keys(r).indexOf(a)!=-1?this.keyCodes[r[a]]:this.keyCodes[a.toUpperCase().charCodeAt(0)],!e)return!1}return!0}},{key:"eventMatches",value:function(t,e){for(var i=r,n=Object.keys(i),a=e.split("+"),o=0;o<a.length;o++){var s=a[o],c=!1;if("shift"===s?c=!!t.shiftKey:"ctrl"===s?c=!!t.ctrlKey:"alt"===s?c=!!t.altKey:"meta"===s?c=!!t.metaKey:n.indexOf(s)!==-1?c=t.keyCode===i[s]:t.keyCode===s.toUpperCase().charCodeAt(0)&&(c=!0),!c)return!1}return!0}}]),t}();e["default"]=a},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(){i(this,t)}return n(t,null,[{key:"throttle",value:function(t,e,i){e||(e=250);var n,r;return function(){var a=i||this,o=+new Date,s=arguments;n&&o<n+e?(clearTimeout(r),r=setTimeout(function(){n=o,t.apply(a,s)},e)):(n=o,t.apply(a,s))}}}]),t}();e["default"]=r},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=i(2),s=n(o),c=function(){function t(e,i){var n=this;r(this,t);var a=new dat.GUI;this.camera=e.camera.threeCamera,this.controls=e.controls.threeControls,this.light=e.light;var o=a.addFolder("Camera"),c=o.add(s["default"].camera,"fov",0,180).name("Camera FOV");c.onChange(function(t){n.controls.enableRotate=!1,n.camera.fov=t}),c.onFinishChange(function(t){n.camera.updateProjectionMatrix(),n.controls.enableRotate=!0});var h=o.add(s["default"].camera,"aspect",0,4).name("Camera Aspect");h.onChange(function(t){n.controls.enableRotate=!1,n.camera.aspect=t}),h.onFinishChange(function(t){n.camera.updateProjectionMatrix(),n.controls.enableRotate=!0});var l=o.addColor(s["default"].fog,"color").name("Fog Color");l.onChange(function(t){e.scene.fog.color.setHex(t)});var u=o.add(s["default"].fog,"near",0,.01).name("Fog Near");u.onChange(function(t){n.controls.enableRotate=!1,e.scene.fog.density=t}),u.onFinishChange(function(t){n.controls.enableRotate=!0});var d=a.addFolder("Controls");d.add(s["default"].controls,"autoRotate").name("Auto Rotate").onChange(function(t){n.controls.autoRotate=t});var p=d.add(s["default"].controls,"autoRotateSpeed",-1,1).name("Rotation Speed");p.onChange(function(t){n.controls.enableRotate=!1,n.controls.autoRotateSpeed=t}),p.onFinishChange(function(t){n.controls.enableRotate=!0});var f=a.addFolder("Mesh");f.add(s["default"].mesh,"translucent",!0).name("Translucent").onChange(function(t){t?(i.material.transparent=!0,i.material.opacity=.5):i.material.opacity=1}),f.add(s["default"].mesh,"wireframe",!0).name("Wireframe").onChange(function(t){i.material.wireframe=t});var m=a.addFolder("Ambient Light");m.add(s["default"].ambientLight,"enabled").name("Enabled").onChange(function(t){n.light.ambientLight.visible=t}),m.addColor(s["default"].ambientLight,"color").name("Color").onChange(function(t){n.light.ambientLight.color.setHex(t)});var g=a.addFolder("Directional Light");g.add(s["default"].directionalLight,"enabled").name("Enabled").onChange(function(t){n.light.directionalLight.visible=t}),g.addColor(s["default"].directionalLight,"color").name("Color").onChange(function(t){n.light.directionalLight.color.setHex(t)});var v=g.add(s["default"].directionalLight,"intensity",0,2).name("Intensity");v.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.intensity=t}),v.onFinishChange(function(t){n.controls.enableRotate=!0});var y=g.add(s["default"].directionalLight,"x",-1e3,1e3).name("Position X");y.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.position.x=t}),y.onFinishChange(function(t){n.controls.enableRotate=!0});var x=g.add(s["default"].directionalLight,"y",-1e3,1e3).name("Position Y");x.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.position.y=t}),x.onFinishChange(function(t){n.controls.enableRotate=!0});var b=g.add(s["default"].directionalLight,"z",-1e3,1e3).name("Position Z");b.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.position.z=t}),b.onFinishChange(function(t){n.controls.enableRotate=!0});var _=a.addFolder("Shadow Map");_.add(s["default"].shadow,"enabled").name("Enabled").onChange(function(t){n.light.directionalLight.castShadow=t}),_.add(s["default"].shadow,"helperEnabled").name("Helper Enabled").onChange(function(t){n.light.directionalLightHelper.visible=t});var M=_.add(s["default"].shadow,"near",0,100).name("Near");M.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.near=t}),M.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var w=_.add(s["default"].shadow,"far",0,1200).name("Far");w.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.far=t}),w.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var S=_.add(s["default"].shadow,"top",-400,400).name("Top");S.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.top=t}),S.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var T=_.add(s["default"].shadow,"right",-400,400).name("Right");T.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.right=t}),T.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var L=_.add(s["default"].shadow,"bottom",-400,400).name("Bottom");L.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.bottom=t}),L.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var A=_.add(s["default"].shadow,"left",-400,400).name("Left");A.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.left=t}),A.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var C=_.add(s["default"].shadow,"bias",-1e-5,1).name("Bias");C.onChange(function(t){n.controls.enableRotate=!1,n.light.directionalLight.shadow.bias=t}),C.onFinishChange(function(t){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()});var E=a.addFolder("Point Light");E.add(s["default"].pointLight,"enabled").name("Enabled").onChange(function(t){n.light.pointLight.visible=t}),E.addColor(s["default"].pointLight,"color").name("Color").onChange(function(t){n.light.pointLight.color.setHex(t)});var P=E.add(s["default"].pointLight,"intensity",0,2).name("Intensity");P.onChange(function(t){n.controls.enableRotate=!1,n.light.pointLight.intensity=t}),P.onFinishChange(function(t){n.controls.enableRotate=!0});var R=E.add(s["default"].pointLight,"distance",0,1e3).name("Distance");R.onChange(function(t){n.controls.enableRotate=!1,n.light.pointLight.distance=t}),R.onFinishChange(function(t){n.controls.enableRotate=!0});var D=E.add(s["default"].pointLight,"x",-1e3,1e3).name("Position X");D.onChange(function(t){n.controls.enableRotate=!1,n.light.pointLight.position.x=t}),D.onFinishChange(function(t){n.controls.enableRotate=!0});var I=E.add(s["default"].pointLight,"y",-1e3,1e3).name("Position Y");I.onChange(function(t){n.controls.enableRotate=!1,n.light.pointLight.position.y=t}),I.onFinishChange(function(t){n.controls.enableRotate=!0});var O=E.add(s["default"].pointLight,"z",-1e3,1e3).name("Position Z");O.onChange(function(t){n.controls.enableRotate=!1,n.light.pointLight.position.z=t}),O.onFinishChange(function(t){n.controls.enableRotate=!0});var B=a.addFolder("Hemi Light");B.add(s["default"].hemiLight,"enabled").name("Enabled").onChange(function(t){n.light.hemiLight.visible=t}),B.addColor(s["default"].hemiLight,"color").name("Color").onChange(function(t){n.light.hemiLight.color.setHex(t)}),B.addColor(s["default"].hemiLight,"groundColor").name("ground Color").onChange(function(t){n.light.hemiLight.groundColor.setHex(t)});var U=B.add(s["default"].hemiLight,"intensity",0,2).name("Intensity");U.onChange(function(t){n.controls.enableRotate=!1,n.light.hemiLight.intensity=t}),U.onFinishChange(function(t){n.controls.enableRotate=!0});var F=B.add(s["default"].hemiLight,"x",-1e3,1e3).name("Position X");F.onChange(function(t){n.controls.enableRotate=!1,n.light.hemiLight.position.x=t}),F.onFinishChange(function(t){n.controls.enableRotate=!0});var N=B.add(s["default"].hemiLight,"y",-500,1e3).name("Position Y");N.onChange(function(t){n.controls.enableRotate=!1,n.light.hemiLight.position.y=t}),N.onFinishChange(function(t){n.controls.enableRotate=!0});var V=B.add(s["default"].hemiLight,"z",-1e3,1e3).name("Position Z");V.onChange(function(t){n.controls.enableRotate=!1,n.light.hemiLight.position.z=t}),V.onFinishChange(function(t){n.controls.enableRotate=!0})}return a(t,[{key:"handleColorChange",value:function(t){return function(e){"string"==typeof e&&(e=e.replace("#","0x")),t.setHex(e)}}},{key:"needsUpdate",value:function(t,e){return function(){t.shading=+t.shading,t.vertexColors=+t.vertexColors,t.side=+t.side,t.needsUpdate=!0,e.verticesNeedUpdate=!0,e.normalsNeedUpdate=!0,e.colorsNeedUpdate=!0}}},{key:"updateTexture",value:function(t,e,i){return function(n){t[e]=i[n],t.needsUpdate=!0}}},{key:"update",value:function(){this.needsUpdate(mesh.material,mesh.geometry)}}]),t}();e["default"]=c}]); |