diff --git a/build/public/assets/css/app.css b/build/public/assets/css/app.css index 3930aaf..614a9e6 100644 --- a/build/public/assets/css/app.css +++ b/build/public/assets/css/app.css @@ -1 +1 @@ -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.main{width:100%;height:100vh} +html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0;font:16px/1 sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}h1,h2,h3,h4,p,blockquote,figure,ol,ul{margin:0;padding:0}main,li{display:block}h1,h2,h3,h4{font-size:inherit}strong{font-weight:bold}a,button{color:inherit;transition:.3s}a{text-decoration:none}button{overflow:visible;border:0;font:inherit;-webkit-font-smoothing:inherit;letter-spacing:inherit;background:none;cursor:pointer}::-moz-focus-inner{padding:0;border:0}:focus{outline:0}img{max-width:100%;height:auto;border:0}body{overflow:hidden}.main{position:relative;width:100%;height:100vh}#loading{position:absolute;top:calc(50% - 8px);left:calc(50% - 35px)} diff --git a/build/public/assets/css/rStats.css b/build/public/assets/css/rStats.css index ccda851..9ad6a6d 100644 --- a/build/public/assets/css/rStats.css +++ b/build/public/assets/css/rStats.css @@ -1,73 +1,86 @@ -.rs-base{ - position: absolute; - z-index: 10000; - padding: 10px; - background-color: #222; - font-size: 10px; - line-height: 1.2em; - width: 350px; - font-family: 'Roboto Condensed', tahoma, sans-serif; - left: 0; - top: 0; - overflow: hidden; +.alarm { + color: #b70000; + text-shadow: 0 0 0 #b70000, + 0 0 1px #ffffff, + 0 0 1px #ffffff, + 0 0 2px #ffffff, + 0 0 2px #ffffff, + 0 0 3px #ffffff, + 0 0 3px #ffffff, + 0 0 4px #ffffff, + 0 0 4px #ffffff; } -.rs-base h1{ +.rs-base { + position: absolute; + top: 0; + left: 0; + z-index: 10000; + overflow: hidden; + padding: 10px; + width: 350px; + background-color: #222222; + font-size: 10px; + font-family: 'Roboto Condensed', tahoma, sans-serif; + line-height: 1.2em; +} + +.rs-base h1 { margin: 0; - padding: 0; - font-size: 1.4em; - color: #fff; margin-bottom: 5px; + padding: 0; + color: #ffffff; + font-size: 1.4em; cursor: pointer; } -.rs-base div.rs-group{ +.rs-base div.rs-group { margin-bottom: 10px; } -.rs-base div.rs-group.hidden{ +.rs-base div.rs-group.hidden { display: none; } -.rs-base div.rs-fraction{ +.rs-base div.rs-fraction { position: relative; margin-bottom: 5px; } -.rs-base div.rs-fraction p{ - width: 120px; - text-align: right; +.rs-base div.rs-fraction p { margin: 0; padding: 0; + width: 120px; + text-align: right; } -.rs-base div.rs-legend{ +.rs-base div.rs-legend { position: absolute; line-height: 1em; } -.rs-base div.rs-counter-base{ +.rs-base div.rs-counter-base { position: relative; margin: 2px 0; height: 1em; } -.rs-base span.rs-counter-id{ +.rs-base span.rs-counter-id { position: absolute; - left: 0; top: 0; + left: 0; } -.rs-base div.rs-counter-value{ +.rs-base div.rs-counter-value { position: absolute; + top: 0; left: 90px; width: 30px; height: 1em; - top: 0; text-align: right; } -.rs-base canvas.rs-canvas{ +.rs-base canvas.rs-canvas { position: absolute; right: 0; } diff --git a/build/public/assets/js/app.js b/build/public/assets/js/app.js index 63dd29e..f267bb3 100644 --- a/build/public/assets/js/app.js +++ b/build/public/assets/js/app.js @@ -1,17 +1,15 @@ -!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();i1?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;S1?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[i1;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 WebGL.
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].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;i0?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>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+(a0?(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,eMath.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)y&&v>x?vx?ythis.max.x||t.ythis.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.xthis.max.x||t.max.ythis.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;sr&&(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;ethis.max.x||t.ythis.max.y||t.zthis.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.xthis.max.x||t.max.ythis.max.y||t.max.zthis.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;r0},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;r0)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=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=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;athis.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(a0?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;ethis.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;t0?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=r)break t;var s=e[1];t=r)break e}a=i,i=0}}for(;i>>1;t1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var a=0;a0&&(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;i0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(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=0;i--){var g=p[i];for(this.faces.splice(g,1),o=0,s=this.faceVertexUvs.length;o0,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;i0,s=r[1]&&r[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l0){u=[];for(var l=0;l0){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;d0){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;s0&&(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;o0)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;t1){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=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],ue;)--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=.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;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t1?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;i1?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;i0)for(var u=s.faces,d=t.morphColors[0].colors,i=0,n=u.length;i0&&(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;n0){var o=new a.LoadingManager(e),s=new a.ImageLoader(o);s.setCrossOrigin(this.crossOrigin);for(var c=0,h=t.length;c0?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;d0||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;h0&&(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;n2048||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(an.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;ys)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);Sn.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;xs)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);Sn.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;xs)){p.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(p);Sn.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;te.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;R0&&(M=G);for(var z=0,k=V.length;z1){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=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;ar||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=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)=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=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;o8&&(f.length=8);for(var y=n.morphAttributes,m=0,g=f.length;m0&&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.length0&&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;l65535?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");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);a0?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),r0,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;r0: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;se||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-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;_-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;_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.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;_(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=-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;o2;){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;v2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.xNumber.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||p0||fT?[]: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;i0)return!0;return!1}function a(t,i){var n,a,o,s,c;for(n=0;n0)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;_0&&(S--,!(S<0));)for(h=w;h=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;g0)){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=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;i1&&!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;i0){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;iNumber.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.ys.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;v1){for(var x=!1,b=[],_=0,M=f.length;_0&&(x||(m=p))}for(var C,v=0,E=f.length;ve.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)e;)i-=e;ie.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+20?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;D65535?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;o0&&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;uNumber.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=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,a=M+2*x;for(r=0;r=0;F--){for(V=F/x,G=v*(1-V),N=y*Math.sin(V*Math.PI/2),X=0,Y=U.length;X65535?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;o65535?Uint32Array:Uint16Array)(s*c*6),y=0;y65535?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;c0)&&S.push(T,L,C),(g!==i-1||c65535?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;vNumber.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.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.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;h1){var h=c[1];n[h]||(n[h]={start:1/0,end:-(1/0)});var l=n[h];al.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;en.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;ia||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);e1)for(var i=1;i1?1:h,_=d(h);for(a in n){var b=i[a]||0,w=n[a];w instanceof Array?e[a]=f(w,_):("string"==typeof w&&(w=b+parseFloat(w,10)),"number"==typeof w&&(e[a]=b+(w-b)*_))}if(null!==y&&y.call(e,_),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 M=r[a];r[a]=n[a],n[a]=M}i[a]=r[a]}return c&&(l=!l),p=t+u,!0}null!==x&&x.call(e);for(var S=0,T=m.length;S1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=a.Interpolation.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},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[i1;n--)i*=n;return t[e]=i,i}}(),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 WebGL.
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].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){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}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;i0}function u(t,e,i,r,a,o,s,c,h,l){t=void 0!==t?t:[],e=void 0!==e?e:pa,n.call(this,t,e,i,r,a,o,s,c,h,l),this.flipY=!1}function p(){this.seq=[],this.map={}}function d(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,a=Io[r];if(void 0===a&&(a=new Float32Array(r),Io[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function f(t,e){var i=Oo[e];void 0===i&&(i=new Int32Array(e),Oo[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function m(t,e){t.uniform1f(this.addr,e)}function g(t,e){t.uniform1i(this.addr,e)}function v(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function y(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)}function x(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function b(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function M(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||Co,n)}function S(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||Ro,n)}function T(t,e){t.uniform2iv(this.addr,e)}function E(t,e){t.uniform3iv(this.addr,e)}function A(t,e){t.uniform4iv(this.addr,e)}function L(t){switch(t){case 5126:return m;case 35664:return v;case 35665:return y;case 35666:return x;case 35674:return _;case 35675:return b;case 35676:return w;case 35678:return M;case 35680:return S;case 5124:case 35670:return g;case 35667:case 35671:return T;case 35668:case 35672:return E;case 35669:case 35673:return A}}function P(t,e){t.uniform1fv(this.addr,e)}function C(t,e){t.uniform1iv(this.addr,e)}function R(t,e){t.uniform2fv(this.addr,d(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,d(e,this.size,3))}function O(t,e){t.uniform4fv(this.addr,d(e,this.size,4))}function U(t,e){t.uniformMatrix2fv(this.addr,!1,d(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,d(e,this.size,9))}function N(t,e){t.uniformMatrix4fv(this.addr,!1,d(e,this.size,16))}function F(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(e[a]||Co,r[a])}function z(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(e[a]||Ro,r[a])}function B(t){switch(t){case 5126:return P;case 35664:return R;case 35665:return I;case 35666:return O;case 35674:return U;case 35675:return D;case 35676:return N;case 35678:return F;case 35680:return z;case 5124:case 35670:return C;case 35667:case 35671:return T;case 35668:case 35672:return E;case 35669:case 35673:return A}}function k(t,e,i){this.id=t,this.addr=i,this.setValue=L(e.type)}function G(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=B(e.type)}function j(t){this.id=t,p.call(this)}function V(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,i){var n=t.name,r=n.length;for(Uo.lastIndex=0;;){var a=Uo.exec(n),o=Uo.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s=0|s),void 0===h||"["===h&&o+2===r){V(i,void 0===h?new k(s,t,e):new G(s,t,e));break}var l=i.map,u=l[s];void 0===u&&(u=new j(s),V(i,u)),i=u}}function H(t,e,i){p.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var a=t.getActiveUniform(e,r),o=a.name,s=t.getUniformLocation(e,o);W(a,s,this)}}function X(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function Y(t,e){this.min=void 0!==t?t:new i((+(1/0)),(+(1/0))),this.max=void 0!==e?e:new i((-(1/0)),(-(1/0)))}function q(t,e){function n(){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]);a=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),p=f.createTexture(),d=f.createTexture(),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.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=r(s),l={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},u={renderType:f.getUniformLocation(c,"renderType"),map:f.getUniformLocation(c,"map"),occlusionMap:f.getUniformLocation(c,"occlusionMap"),opacity:f.getUniformLocation(c,"opacity"),color:f.getUniformLocation(c,"color"),scale:f.getUniformLocation(c,"scale"),rotation:f.getUniformLocation(c,"rotation"),screenPosition:f.getUniformLocation(c,"screenPosition")}}function r(e){var i=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return f.shaderSource(n,a+e.fragmentShader),f.shaderSource(r,a+e.vertexShader),f.compileShader(n),f.compileShader(r),f.attachShader(i,n),f.attachShader(i,r),f.linkProgram(i),i}var a,o,s,c,l,u,p,d,f=t.context,m=t.state;this.render=function(r,s,g){if(0!==e.length){var v=new h,y=g.w/g.z,x=.5*g.z,_=.5*g.w,b=16/g.w,w=new i(b*y,b),M=new h(1,1,0),S=new i(1,1),T=new Y;T.min.set(0,0),T.max.set(g.z-16,g.w-16),void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(l.vertex),m.enableAttribute(l.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(l.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.setDepthWrite(!1);for(var E=0,A=e.length;E.001&&R.scale>.001&&(M.x=R.x,M.y=R.y,M.z=R.z,b=R.size*R.scale/g.w,w.x=b*y,w.y=b,f.uniform3f(u.screenPosition,M.x,M.y,M.z),f.uniform2f(u.scale,w.x,w.y),f.uniform1f(u.rotation,R.rotation),f.uniform1f(u.opacity,R.opacity),f.uniform3f(u.color,R.color.r,R.color.g,R.color.b),m.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function Z(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=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),l=r(),u={position:f.getAttribLocation(l,"position"),uv:f.getAttribLocation(l,"uv")},p={uvOffset:f.getUniformLocation(l,"uvOffset"),uvScale:f.getUniformLocation(l,"uvScale"),rotation:f.getUniformLocation(l,"rotation"),scale:f.getUniformLocation(l,"scale"),color:f.getUniformLocation(l,"color"),map:f.getUniformLocation(l,"map"),opacity:f.getUniformLocation(l,"opacity"),modelViewMatrix:f.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(l,"projectionMatrix"),fogType:f.getUniformLocation(l,"fogType"),fogDensity:f.getUniformLocation(l,"fogDensity"),fogNear:f.getUniformLocation(l,"fogNear"),fogFar:f.getUniformLocation(l,"fogFar"),fogColor:f.getUniformLocation(l,"fogColor"),alphaTest:f.getUniformLocation(l,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var a=i.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),d=new n(i),d.needsUpdate=!0}function r(){var e=f.createProgram(),i=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.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")),f.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")),f.compileShader(i),f.compileShader(n),f.attachShader(e,i),f.attachShader(e,n),f.linkProgram(e),e}function a(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,l,u,p,d,f=t.context,m=t.state,g=new h,v=new c,y=new h;this.render=function(n,r){if(0!==e.length){void 0===l&&i(),f.useProgram(l),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(p.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(p.map,0);var c=0,h=0,x=n.fog;x?(f.uniform3f(p.fogColor,x.color.r,x.color.g,x.color.b),x&&x.isFog?(f.uniform1f(p.fogNear,x.near),f.uniform1f(p.fogFar,x.far),f.uniform1i(p.fogType,1),c=1,h=1):x&&x.isFogExp2&&(f.uniform1f(p.fogDensity,x.density),f.uniform1i(p.fogType,2),c=2,h=2)):(f.uniform1i(p.fogType,0),c=0,h=0);for(var _=0,b=e.length;_0}function nt(t,e){this.normal=void 0!==t?t:new h(1,0,0),this.constant=void 0!==e?e:0}function rt(t,e,i,n,r,a){this.planes=[void 0!==t?t:new nt,void 0!==e?e:new nt,void 0!==i?i:new nt,void 0!==n?n:new nt,void 0!==r?r:new nt,void 0!==a?a:new nt]}function at(e,n,r,s){function c(t,i,n,r){var a=t.geometry,o=null,s=T,c=t.customDepthMaterial;if(n&&(s=E,c=t.customDistanceMaterial),c)o=c;else{var h=!1;i.morphTargets&&(a&&a.isBufferGeometry?h=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(h=a.morphTargets&&a.morphTargets.length>0));var l=t.isSkinnedMesh&&i.skinning,u=0;h&&(u|=w),l&&(u|=M),o=s[u]}if(e.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var p=o.uuid,d=i.uuid,f=A[p];void 0===f&&(f={}, +A[p]=f);var m=f[d];void 0===m&&(m=o.clone(),f[d]=m),o=m}o.visible=i.visible,o.wireframe=i.wireframe;var g=i.side;return B.renderSingleSided&&g==_r&&(g=yr),B.renderReverseSided&&(g===yr?g=xr:g===xr&&(g=yr)),o.side=g,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(r),o}function u(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||f.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),b.push(t))}for(var a=t.children,o=0,s=a.length;o0?1:-1,m[v]=R.x,m[v+1]=R.y,m[v+2]=R.z,g[y]=U/c,g[y+1]=1-I/u,v+=3,y+=2,P+=1}for(I=0;I65535?Uint32Array:Uint16Array)(p),f=new Float32Array(3*u),m=new Float32Array(3*u),g=new Float32Array(2*u),v=0,y=0,x=0,_=0,b=0;c("z","y","x",-1,-1,i,e,t,a,r,0),c("z","y","x",1,-1,i,e,-t,a,r,1),c("x","z","y",1,1,t,i,e,n,a,2),c("x","z","y",1,-1,t,i,-e,n,a,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new mt(d,1)),this.addAttribute("position",new mt(f,3)),this.addAttribute("normal",new mt(m,3)),this.addAttribute("uv",new mt(g,2))}function It(t,e,i,n){Pt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,a=e/2,o=Math.floor(i)||1,s=Math.floor(n)||1,c=o+1,h=s+1,l=t/o,u=e/s,p=new Float32Array(c*h*3),d=new Float32Array(c*h*3),f=new Float32Array(c*h*2),m=0,g=0,v=0;v65535?Uint32Array:Uint16Array)(o*s*6),v=0;v");return Zt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function Jt(t){function e(t,e,i,n){for(var r="",a=parseInt(e);a0?t.gammaFactor:1,g=Wt(a,n,t.extensions),v=Ht(o),y=r.createProgram();i.isRawShaderMaterial?(d=[v,"\n"].filter(Yt).join("\n"),f=[g,v,"\n"].filter(Yt).join("\n")):(d=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.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(Yt).join("\n"),f=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==oa?"#define TONE_MAPPING":"",n.toneMapping!==oa?Ic.tonemapping_pars_fragment:"",n.toneMapping!==oa?Vt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?Ic.encodings_pars_fragment:"",n.mapEncoding?Gt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Gt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Gt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?jt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Yt).join("\n")),s=Zt(s,n),s=qt(s,n),c=Zt(c,n),c=qt(c,n),i.isShaderMaterial||(s=Jt(s),c=Jt(c));var x=d+s,_=f+c,b=Bt(r,r.VERTEX_SHADER,x),w=Bt(r,r.FRAGMENT_SHADER,_);r.attachShader(y,b),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var M=r.getProgramInfoLog(y),S=r.getShaderInfoLog(b),T=r.getShaderInfoLog(w),E=!0,A=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?E=!1:""!==M||""!==S&&""!==T||(A=!1),A&&(this.diagnostics={runnable:E,material:i,programLog:M,vertexShader:{log:S,prefix:d},fragmentShader:{log:T,prefix:f}}),r.deleteShader(b),r.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new H(r,y,t)),L};var P;return this.getAttributes=function(){return void 0===P&&(P=Xt(r,y)),P},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return this.getUniforms()}},attributes:{get:function(){return this.getAttributes()}}}),this.id=zc++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=b,this.fragmentShader=w,this}function Qt(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&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===_r,flipSided:r.side===xr,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return f},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;r65535?Uint32Array:Uint16Array,g=new mt(new m(a),1);return r(g,t.ELEMENT_ARRAY_BUFFER),n.wireframe=g,g}var h=new $t(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function ee(e,i,n,r,a,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(e){return t.Math.isPowerOfTwo(e.width)&&t.Math.isPowerOfTwo(e.height)}function l(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=t.Math.nearestPowerOfTwo(e.width),i.height=t.Math.nearestPowerOfTwo(e.height);var n=i.getContext("2d");return n.drawImage(e,0,0,i.width,i.height),i}return e}function u(t){return t.wrapS!==ba||t.wrapT!==ba||t.minFilter!==Sa&&t.minFilter!==Aa}function p(t){return t===Sa||t===Ta||t===Ea?e.NEAREST:e.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),L.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),g(e),L.textures--}function m(t){var i=r.get(t);if(t.image&&i.__image__webglTextureCube)e.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture)}r["delete"](t)}function g(t){var i=r.get(t),n=r.get(t.texture);if(t){if(void 0!==n.__webglTexture&&e.deleteTexture(n.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t&&t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[a]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer);r["delete"](t.texture),r["delete"](t)}}function v(t,i){var a=r.get(t);if(t.version>0&&a.__version!==t.version){var o=t.image;if(void 0===o);else if(o.complete!==!1)return void b(a,t,i)}n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_2D,a.__webglTexture)}function y(t,i){var s=r.get(t);if(6===t.image.length)if(t.version>0&&s.__version!==t.version){s.__image__webglTextureCube||(t.addEventListener("dispose",d),s.__image__webglTextureCube=e.createTexture(),L.textures++),n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_CUBE_MAP,s.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var l=t&&t.isCompressedTexture,u=t.image[0]&&t.image[0].isDataTexture,p=[],f=0;f<6;f++)l||u?p[f]=u?t.image[f].image:t.image[f]:p[f]=c(t.image[f],a.maxCubemapSize);var m=p[0],g=h(m),v=o(t.format),y=o(t.type);_(e.TEXTURE_CUBE_MAP,t,g);for(var f=0;f<6;f++)if(l)for(var x,b=p[f].mipmaps,w=0,M=b.length;w-1&&n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,v,x.width,x.height,0,x.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,v,x.width,x.height,0,v,y,x.data);else u?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,v,p[f].width,p[f].height,0,v,y,p[f].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,v,v,y,p[f]);t.generateMipmaps&&g&&e.generateMipmap(e.TEXTURE_CUBE_MAP),s.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_CUBE_MAP,s.__image__webglTextureCube)}function x(t,i){n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_CUBE_MAP,r.get(t).__webglTexture)}function _(t,n,s){var c;if(s?(e.texParameteri(t,e.TEXTURE_WRAP_S,o(n.wrapS)),e.texParameteri(t,e.TEXTURE_WRAP_T,o(n.wrapT)),e.texParameteri(t,e.TEXTURE_MAG_FILTER,o(n.magFilter)),e.texParameteri(t,e.TEXTURE_MIN_FILTER,o(n.minFilter))):(e.texParameteri(t,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(t,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n.wrapS!==ba||n.wrapT!==ba,e.texParameteri(t,e.TEXTURE_MAG_FILTER,p(n.magFilter)),e.texParameteri(t,e.TEXTURE_MIN_FILTER,p(n.minFilter)),n.minFilter!==Sa&&n.minFilter!==Aa),c=i.get("EXT_texture_filter_anisotropic")){if(n.type===Fa&&null===i.get("OES_texture_float_linear"))return;if(n.type===za&&null===i.get("OES_texture_half_float_linear"))return;(n.anisotropy>1||r.get(n).__currentAnisotropy)&&(e.texParameterf(t,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n.anisotropy,a.getMaxAnisotropy())),r.get(n).__currentAnisotropy=n.anisotropy)}}function b(t,i,r){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",d),t.__webglTexture=e.createTexture(),L.textures++),n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var s=c(i.image,a.maxTextureSize);u(i)&&h(s)===!1&&(s=l(s));var p=h(s),f=o(i.format),m=o(i.type);_(e.TEXTURE_2D,i,p);var g,v=i.mipmaps;if(i&&i.isDepthTexture){var y=e.DEPTH_COMPONENT;if(i.type===Fa){if(!P)throw new Error("Float Depth Texture only supported in WebGL2.0");y=e.DEPTH_COMPONENT32F}else P&&(y=e.DEPTH_COMPONENT16);i.format===Ja&&(y=e.DEPTH_STENCIL),n.texImage2D(e.TEXTURE_2D,0,y,s.width,s.height,0,f,m,null)}else if(i&&i.isDataTexture)if(v.length>0&&p){for(var x=0,b=v.length;x-1&&n.compressedTexImage2D(e.TEXTURE_2D,x,f,g.width,g.height,0,g.data):n.texImage2D(e.TEXTURE_2D,x,f,g.width,g.height,0,f,m,g.data);else if(v.length>0&&p){for(var x=0,b=v.length;x0&&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,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(o=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=l>0,y=!!e.get("OES_texture_float"),x=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:x}}function ae(t){var e={};return{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}}}function oe(){function t(){h.value!==n&&(h.value=n,h.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=h.value,r!==!0||null===o){var l=n+4*a,u=e.matrixWorldInverse;c.getNormalMatrix(u),(null===o||o.length=0){var l=a[c];if(void 0!==l){var u=qt.FLOAT,p=l.array,d=l.normalized;p instanceof Float32Array?u=qt.FLOAT:p instanceof Float64Array||(p instanceof Uint16Array?u=qt.UNSIGNED_SHORT:p instanceof Int16Array?u=qt.SHORT:p instanceof Uint32Array?u=qt.UNSIGNED_INT:p instanceof Int32Array?u=qt.INT:p instanceof Int8Array?u=qt.BYTE:p instanceof Uint8Array&&(u=qt.UNSIGNED_BYTE));var f=l.itemSize,m=le.getAttributeBuffer(l);if(l&&l.isInterleavedBufferAttribute){var g=l.data,v=g.stride,y=l.offset;g&&g.isInstancedInterleavedBuffer?(se.enableAttributeAndDivisor(h,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):se.enableAttribute(h),qt.bindBuffer(qt.ARRAY_BUFFER,m),qt.vertexAttribPointer(h,f,u,d,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else l&&l.isInstancedBufferAttribute?(se.enableAttributeAndDivisor(h,l.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=l.meshPerAttribute*l.count)):se.enableAttribute(h),qt.bindBuffer(qt.ARRAY_BUFFER,m),qt.vertexAttribPointer(h,f,u,d,0,n*f*l.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var x=s[c];if(void 0!==x)switch(x.length){case 2:qt.vertexAttrib2fv(h,x);break;case 3:qt.vertexAttrib3fv(h,x);break;case 4:qt.vertexAttrib4fv(h,x);break;default:qt.vertexAttrib1fv(h,x)}}}}se.disableUnusedAttributes()}}function f(t,e){return Math.abs(e[0])-Math.abs(t[0])}function m(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 g(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 v(t,e,i,n,r){var a,o;i.transparent?(a=nt,o=++ot):(a=tt,o=++it);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=Ht.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:Ht.z,group:r},a.push(s))}function y(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Vt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),_(Vt)}function x(t){return Vt.center.set(0,0,0),Vt.radius=.7071067811865476,Vt.applyMatrix4(t.matrixWorld),_(Vt)}function _(t){if(!Bt.intersectsSphere(t))return!1;var e=kt.numPlanes;if(0===e)return!0;var i=lt.clippingPlanes,n=t.center,r=-t.radius,a=0;do if(i[a].distanceToPoint(n)=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var d=0;d=0&&e.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&e.clipping!==!0||(r.numClippingPlanes=kt.numPlanes,f.clippingPlanes=kt.uniform),r.fog=i,r.lightsHash=Xt.hash,e.lights&&(f.ambientLightColor.value=Xt.ambient,f.directionalLights.value=Xt.directional,f.spotLights.value=Xt.spot,f.pointLights.value=Xt.point,f.hemisphereLights.value=Xt.hemi,f.directionalShadowMap.value=Xt.directionalShadowMap,f.directionalShadowMatrix.value=Xt.directionalShadowMatrix,f.spotShadowMap.value=Xt.spotShadowMap,f.spotShadowMatrix.value=Xt.spotShadowMatrix,f.pointShadowMap.value=Xt.pointShadowMap,f.pointShadowMatrix.value=Xt.pointShadowMatrix);var m=r.program.getUniforms(),g=H.seqWithValue(m.seq,f);r.uniformsList=g,r.dynamicUniforms=H.splitDynamic(g,f)}function S(t){t.side===_r?se.disable(qt.CULL_FACE):se.enable(qt.CULL_FACE),se.setFlipSided(t.side===xr),t.transparent===!0?se.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):se.setBlending(Er),se.setDepthFunc(t.depthFunc),se.setDepthTest(t.depthTest),se.setDepthWrite(t.depthWrite),se.setColorWrite(t.colorWrite),se.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function T(t,e,i,n){bt=0;var r=ce.get(i);if(Gt&&(jt||t!==vt)){var a=t===vt&&i.id===mt;kt.setState(i.clippingPlanes,i.clipShadows,t,r,a)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==Xt.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==kt.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(M(i,e,n),i.needsUpdate=!1);var o=!1,s=!1,c=!1,h=r.program,l=h.getUniforms(),u=r.__webglShader.uniforms;if(h.id!==ut&&(qt.useProgram(h.program),ut=h.id,o=!0,s=!0,c=!0),i.id!==mt&&(mt=i.id,s=!0),o||t!==vt){if(l.set(qt,t,"projectionMatrix"),$t.logarithmicDepthBuffer&&l.setValue(qt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==vt&&(vt=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(qt,Ht.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&l.setValue(qt,"viewMatrix",t.matrixWorldInverse),l.set(qt,lt,"toneMappingExposure"),l.set(qt,lt,"toneMappingWhitePoint")}if(i.skinning){l.setOptional(qt,n,"bindMatrix"),l.setOptional(qt,n,"bindMatrixInverse");var d=n.skeleton;d&&($t.floatVertexTextures&&d.useVertexTexture?(l.set(qt,d,"boneTexture"),l.set(qt,d,"boneTextureWidth"),l.set(qt,d,"boneTextureHeight")):l.setOptional(qt,d,"boneMatrices"))}s&&(i.lights&&D(u,c),e&&i.fog&&C(u,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&E(u,i),i.isLineBasicMaterial?A(u,i):i.isLineDashedMaterial?(A(u,i),L(u,i)):i.isPointsMaterial?P(u,i):i.isMeshLambertMaterial?R(u,i):i.isMeshPhongMaterial?I(u,i):i.isMeshPhysicalMaterial?U(u,i):i.isMeshStandardMaterial?O(u,i):i.isMeshDepthMaterial?i.displacementMap&&(u.displacementMap.value=i.displacementMap,u.displacementScale.value=i.displacementScale,u.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(u.opacity.value=i.opacity),H.upload(qt,r.uniformsList,u,lt)),l.set(qt,n,"modelViewMatrix"),l.set(qt,n,"normalMatrix"),l.setValue(qt,"modelMatrix",n.matrixWorld);var f=r.dynamicUniforms;return null!==f&&(H.evalDynamic(f,u,n,i,t),H.upload(qt,f,u,lt)),h}function E(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.isWebGLRenderTarget&&(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&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function A(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function L(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function P(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Et,t.scale.value=.5*k.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 C(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function R(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function I(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 O(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 U(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,O(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 N(t){for(var e=0,i=0,n=t.length;i=$t.maxTextures,bt+=1,t}function B(t){var e;if(t===_a)return qt.REPEAT;if(t===ba)return qt.CLAMP_TO_EDGE;if(t===wa)return qt.MIRRORED_REPEAT;if(t===Sa)return qt.NEAREST;if(t===Ta)return qt.NEAREST_MIPMAP_NEAREST;if(t===Ea)return qt.NEAREST_MIPMAP_LINEAR;if(t===Aa)return qt.LINEAR;if(t===La)return qt.LINEAR_MIPMAP_NEAREST;if(t===Pa)return qt.LINEAR_MIPMAP_LINEAR;if(t===Ra)return qt.UNSIGNED_BYTE;if(t===Ba)return qt.UNSIGNED_SHORT_4_4_4_4;if(t===ka)return qt.UNSIGNED_SHORT_5_5_5_1;if(t===Ga)return qt.UNSIGNED_SHORT_5_6_5;if(t===Ia)return qt.BYTE;if(t===Oa)return qt.SHORT;if(t===Ua)return qt.UNSIGNED_SHORT;if(t===Da)return qt.INT;if(t===Na)return qt.UNSIGNED_INT;if(t===Fa)return qt.FLOAT;if(e=Kt.get("OES_texture_half_float"),null!==e&&t===za)return e.HALF_FLOAT_OES;if(t===Va)return qt.ALPHA;if(t===Wa)return qt.RGB;if(t===Ha)return qt.RGBA;if(t===Xa)return qt.LUMINANCE;if(t===Ya)return qt.LUMINANCE_ALPHA;if(t===Za)return qt.DEPTH_COMPONENT;if(t===Ja)return qt.DEPTH_STENCIL;if(t===Or)return qt.FUNC_ADD;if(t===Ur)return qt.FUNC_SUBTRACT;if(t===Dr)return qt.FUNC_REVERSE_SUBTRACT;if(t===zr)return qt.ZERO;if(t===Br)return qt.ONE;if(t===kr)return qt.SRC_COLOR;if(t===Gr)return qt.ONE_MINUS_SRC_COLOR;if(t===jr)return qt.SRC_ALPHA;if(t===Vr)return qt.ONE_MINUS_SRC_ALPHA;if(t===Wr)return qt.DST_ALPHA;if(t===Hr)return qt.ONE_MINUS_DST_ALPHA;if(t===Xr)return qt.DST_COLOR;if(t===Yr)return qt.ONE_MINUS_DST_COLOR;if(t===qr)return qt.SRC_ALPHA_SATURATE;if(e=Kt.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===Ka)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Qa)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===$a)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===to)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=Kt.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===eo)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===io)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===no)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ro)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=Kt.get("WEBGL_compressed_texture_etc1"),null!==e&&t===ao)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=Kt.get("EXT_blend_minmax"),null!==e){if(t===Nr)return e.MIN_EXT;if(t===Fr)return e.MAX_EXT}return e=Kt.get("WEBGL_depth_texture"),null!==e&&t===ja?e.UNSIGNED_INT_24_8_WEBGL:0}e=e||{};var k=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G=void 0!==e.context?e.context:null,j=void 0!==e.alpha&&e.alpha,V=void 0===e.depth||e.depth,W=void 0===e.stencil||e.stencil,Y=void 0!==e.antialias&&e.antialias,J=void 0===e.premultipliedAlpha||e.premultipliedAlpha,K=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,$=[],tt=[],it=-1,nt=[],ot=-1,st=new Float32Array(8),ct=[],ht=[];this.domElement=k,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=sa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var lt=this,ut=null,pt=null,dt=null,mt=-1,gt="",vt=null,yt=new a,xt=null,_t=new a,bt=0,wt=new X(0),Mt=0,St=k.width,Tt=k.height,Et=1,At=new a(0,0,St,Tt),Lt=!1,Ot=new a(0,0,St,Tt),Bt=new rt,kt=new oe,Gt=!1,jt=!1,Vt=new et,Wt=new l,Ht=new h,Xt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Yt={calls:0, +vertices:0,faces:0,points:0};this.info={render:Yt,memory:{geometries:0,textures:0},programs:null};var qt;try{var Zt={alpha:j,depth:V,stencil:W,antialias:Y,premultipliedAlpha:J,preserveDrawingBuffer:K};if(qt=G||k.getContext("webgl",Zt)||k.getContext("experimental-webgl",Zt),null===qt)throw null!==k.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===qt.getShaderPrecisionFormat&&(qt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),k.addEventListener("webglcontextlost",s,!1)}catch(Jt){}var Kt=new ae(qt);Kt.get("WEBGL_depth_texture"),Kt.get("OES_texture_float"),Kt.get("OES_texture_float_linear"),Kt.get("OES_texture_half_float"),Kt.get("OES_texture_half_float_linear"),Kt.get("OES_standard_derivatives"),Kt.get("ANGLE_instanced_arrays"),Kt.get("OES_element_index_uint")&&(Pt.MaxIndex=4294967296);var $t=new re(qt,Kt,e),se=new ne(qt,Kt,B),ce=new ie,he=new ee(qt,Kt,se,ce,$t,B,this.info),le=new te(qt,ce,this.info),ue=new Qt(this,$t),pe=new zt;this.info.programs=ue.programs;var de=new Ft(qt,Kt,Yt),fe=new Nt(qt,Kt,Yt),me=new Dt((-1),1,1,(-1),0,1),ge=new Ut,ve=new Ct(new It(2,2),new ft({depthTest:!1,depthWrite:!1,fog:!1})),ye=Uc.cube,xe=new Ct(new Rt(5,5,5),new Q({uniforms:ye.uniforms,vertexShader:ye.vertexShader,fragmentShader:ye.fragmentShader,side:xr,depthTest:!1,depthWrite:!1,fog:!1}));r(),this.context=qt,this.capabilities=$t,this.extensions=Kt,this.properties=ce,this.state=se;var _e=new at(this,Xt,le,$t);this.shadowMap=_e;var be=new Z(this,ct),we=new q(this,ht);this.getContext=function(){return qt},this.getContextAttributes=function(){return qt.getContextAttributes()},this.forceContextLoss=function(){Kt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return $t.getMaxAnisotropy()},this.getPrecision=function(){return $t.precision},this.getPixelRatio=function(){return Et},this.setPixelRatio=function(t){void 0!==t&&(Et=t,this.setSize(Ot.z,Ot.w,!1))},this.getSize=function(){return{width:St,height:Tt}},this.setSize=function(t,e,i){St=t,Tt=e,k.width=t*Et,k.height=e*Et,i!==!1&&(k.style.width=t+"px",k.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){se.viewport(Ot.set(t,e,i,n))},this.setScissor=function(t,e,i,n){se.scissor(At.set(t,e,i,n))},this.setScissorTest=function(t){se.setScissorTest(Lt=t)},this.getClearColor=function(){return wt},this.setClearColor=function(t,e){wt.set(t),Mt=void 0!==e?e:1,n(wt.r,wt.g,wt.b,Mt)},this.getClearAlpha=function(){return Mt},this.setClearAlpha=function(t){Mt=t,n(wt.r,wt.g,wt.b,Mt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=qt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=qt.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=qt.STENCIL_BUFFER_BIT),qt.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=o,this.dispose=function(){nt=[],ot=-1,tt=[],it=-1,k.removeEventListener("webglcontextlost",s,!1)},this.renderBufferImmediate=function(t,e,i){se.initAttributes();var n=ce.get(t);t.hasPositions&&!n.position&&(n.position=qt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=qt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=qt.createBuffer()),t.hasColors&&!n.color&&(n.color=qt.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(qt.bindBuffer(qt.ARRAY_BUFFER,n.position),qt.bufferData(qt.ARRAY_BUFFER,t.positionArray,qt.DYNAMIC_DRAW),se.enableAttribute(r.position),qt.vertexAttribPointer(r.position,3,qt.FLOAT,!1,0,0)),t.hasNormals){if(qt.bindBuffer(qt.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===br)for(var a=0,o=3*t.count;a8&&(u.length=8);for(var v=n.morphAttributes,p=0,m=u.length;p0&&w.renderInstances(n,C,I):w.render(C,I)}},this.render=function(t,e,i,r){if(void 0===e||e.isCamera===!0){var a=t.fog;gt="",mt=-1,vt=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Wt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Bt.setFromMatrix(Wt),$.length=0,it=-1,ot=-1,ct.length=0,ht.length=0,jt=this.localClippingEnabled,Gt=kt.init(this.clippingPlanes,jt,e),b(t,e),tt.length=it+1,nt.length=ot+1,lt.sortObjects===!0&&(tt.sort(m),nt.sort(g)),Gt&&kt.beginShadows(),N($),_e.render(t,e),F($,e),Gt&&kt.endShadows(),Yt.calls=0,Yt.vertices=0,Yt.faces=0,Yt.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var o=t.background;if(null===o?n(wt.r,wt.g,wt.b,Mt):o&&o.isColor&&(n(o.r,o.g,o.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),o&&o.isCubeTexture?(ge.projectionMatrix.copy(e.projectionMatrix),ge.matrixWorld.extractRotation(e.matrixWorld),ge.matrixWorldInverse.getInverse(ge.matrixWorld),xe.material.uniforms.tCube.value=o,xe.modelViewMatrix.multiplyMatrices(ge.matrixWorldInverse,xe.matrixWorld),le.update(xe),lt.renderBufferDirect(ge,null,xe.geometry,xe.material,xe,null)):o&&o.isTexture&&(ve.material.map=o,le.update(ve),lt.renderBufferDirect(me,null,ve.geometry,ve.material,ve,null)),t.overrideMaterial){var s=t.overrideMaterial;w(tt,e,a,s),w(nt,e,a,s)}else se.setBlending(Er),w(tt,e,a),w(nt,e,a);be.render(t,e),we.render(t,e,_t),i&&he.updateRenderTargetMipmap(i),se.setDepthTest(!0),se.setDepthWrite(!0),se.setColorWrite(!0)}},this.setFaceCulling=function(t,e){se.setCullFace(t),se.setFlipSided(e===dr)},this.allocTextureUnit=z,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(t=!0),e=e.texture),he.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(t=!0),he.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?he.setTextureCube(e,i):he.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return pt},this.setRenderTarget=function(t){pt=t,t&&void 0===ce.get(t).__webglFramebuffer&&he.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=ce.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,yt.copy(t.scissor),xt=t.scissorTest,_t.copy(t.viewport)}else e=null,yt.copy(At).multiplyScalar(Et),xt=Lt,_t.copy(Ot).multiplyScalar(Et);if(dt!==e&&(qt.bindFramebuffer(qt.FRAMEBUFFER,e),dt=e),se.scissor(yt),se.setScissorTest(xt),se.viewport(_t),i){var r=ce.get(t.texture);qt.framebufferTexture2D(qt.FRAMEBUFFER,qt.COLOR_ATTACHMENT0,qt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if((t&&t.isWebGLRenderTarget)!==!1){var o=ce.get(t).__webglFramebuffer;if(o){var s=!1;o!==dt&&(qt.bindFramebuffer(qt.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==Ha&&B(h)!==qt.getParameter(qt.IMPLEMENTATION_COLOR_READ_FORMAT))return;if(!(l===Ra||B(l)===qt.getParameter(qt.IMPLEMENTATION_COLOR_READ_TYPE)||l===Fa&&(Kt.get("OES_texture_float")||Kt.get("WEBGL_color_buffer_float"))||l===za&&Kt.get("EXT_color_buffer_half_float")))return;qt.checkFramebufferStatus(qt.FRAMEBUFFER)===qt.FRAMEBUFFER_COMPLETE&&e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&qt.readPixels(e,i,n,r,B(h),B(l),a)}finally{s&&qt.bindFramebuffer(qt.FRAMEBUFFER,dt)}}}}}function ce(t,e){this.name="",this.color=new X(t),this.density=void 0!==e?e:25e-5}function he(t,e,i){this.name="",this.color=new X(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function le(){ht.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function ue(t,e,i,n,r){ht.call(this),this.lensFlares=[],this.positionScreen=new h,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function pe(t){J.call(this),this.type="SpriteMaterial",this.color=new X(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function de(t){ht.call(this),this.type="Sprite",this.material=void 0!==t?t:new pe}function fe(){ht.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function me(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:Sa,this.minFilter=void 0!==l?l:Sa,this.flipY=!1,this.generateMipmaps=!1}function ge(e,i,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new l,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=t.Math.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new me(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Ha,Fa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===i)this.calculateInverses();else if(this.bones.length===i.length)this.boneInverses=i.slice(0);else{this.boneInverses=[];for(var a=0,o=this.bones.length;a=t.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}n.call(this,t,e,i,r,a,o,s,c,h),this.generateMipmaps=!1;var u=this;l()}function Ee(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ae(t,e,i,r,a,o,s,c,h){n.call(this,t,e,i,r,a,o,s,c,h),this.needsUpdate=!0}function Le(t,e,i,r,a,o,s,c,h,l){if(l=void 0!==l?l:Za,l!==Za&&l!==Ja)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n.call(this,null,r,a,o,s,c,l,i,h),this.image={width:t,height:e},this.type=void 0!==i?i:Ua,this.magFilter=void 0!==s?s:Sa,this.minFilter=void 0!==c?c:Sa,this.flipY=!1,this.generateMipmaps=!1}function Pe(t){function e(t,e){return t-e}Pt.call(this);var i=[0,0],n={},r=["a","b","c"];if(t&&t.isGeometry){for(var a=t.vertices,o=t.faces,s=0,c=new Uint32Array(6*o.length),h=0,l=o.length;h.9&&A<.1&&(M<.2&&(w[0].x+=1),S<.2&&(w[1].x+=1),T<.2&&(w[2].x+=1))}for(var d=0,f=this.vertices.length;d65535?Uint32Array:Uint16Array)(p),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),g=new mt(new Float32Array(2*u),2),v=0,y=0,x=new h,_=new h,b=new i,w=new h,M=new h,S=new h,T=new h,E=new h;for(c=0;c<=n;++c){var A=c/n*a*Math.PI*2;for(s(A,a,o,t,w),s(A+.01,a,o,t,M),T.subVectors(M,w),E.addVectors(M,w),S.crossVectors(T,E),E.crossVectors(S,T),S.normalize(),E.normalize(),l=0;l<=r;++l){var L=l/r*Math.PI*2,P=-e*Math.cos(L),C=e*Math.sin(L);x.x=w.x+(P*E.x+C*S.x),x.y=w.y+(P*E.y+C*S.y),x.z=w.z+(P*E.z+C*S.z),f.setXYZ(v,x.x,x.y,x.z),_.subVectors(x,w).normalize(),m.setXYZ(v,_.x,_.y,_.z),b.x=c/n,b.y=l/r,g.setXY(v,b.x,b.y),v++}}for(l=1;l<=n;l++)for(c=1;c<=r;c++){var R=(r+1)*(l-1)+(c-1),I=(r+1)*l+(c-1),O=(r+1)*l+c,U=(r+1)*(l-1)+c;d.setX(y,R),y++,d.setX(y,I),y++,d.setX(y,U),y++,d.setX(y,I),y++,d.setX(y,O),y++,d.setX(y,U),y++}this.setIndex(d),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",g)}function ze(t,e,i,n,r,a,o){Et.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},this.fromBufferGeometry(new Fe(t,e,i,n,r,a)),this.mergeVertices()}function Be(t,e,i,n,r){Pt.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 a,o,s=(i+1)*(n+1),c=i*n*2*3,l=new(c>65535?Uint32Array:Uint16Array)(c),u=new Float32Array(3*s),p=new Float32Array(3*s),d=new Float32Array(2*s),f=0,m=0,g=0,v=new h,y=new h,x=new h;for(a=0;a<=i;a++)for(o=0;o<=n;o++){var _=o/n*r,b=a/i*Math.PI*2;y.x=(t+e*Math.cos(b))*Math.cos(_),y.y=(t+e*Math.cos(b))*Math.sin(_),y.z=e*Math.sin(b),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,v.x=t*Math.cos(_),v.y=t*Math.sin(_),x.subVectors(y,v).normalize(),p[f]=x.x,p[f+1]=x.y,p[f+2]=x.z,d[m]=o/n,d[m+1]=a/i,f+=3,m+=2}for(a=1;a<=i;a++)for(o=1;o<=n;o++){var w=(n+1)*a+o-1,M=(n+1)*(a-1)+o-1,S=(n+1)*(a-1)+o,T=(n+1)*a+o;l[g]=w,l[g+1]=M,l[g+2]=T,l[g+3]=M,l[g+4]=S,l[g+5]=T,g+=6}this.setIndex(new mt(l,1)),this.addAttribute("position",new mt(u,3)),this.addAttribute("normal",new mt(p,3)),this.addAttribute("uv",new mt(d,2))}function ke(t,e,i,n,r){Et.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Be(t,e,i,n,r))}function Ge(t,e){return"undefined"==typeof t?void(t=[]):(Et.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())}function je(t,e){e=e||{};var i=e.font;if((i&&i.isFont)===!1)return new Et;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),Ge.call(this,n,e),this.type="TextGeometry"}function Ve(t,e,i,n,r,a,o){Pt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},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,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;for(var s=a+o,c=(e+1)*(i+1),l=new mt(new Float32Array(3*c),3),u=new mt(new Float32Array(3*c),3),p=new mt(new Float32Array(2*c),2),d=0,f=[],m=new h,g=0;g<=i;g++){for(var v=[],y=g/i,x=0;x<=e;x++){var _=x/e,b=-t*Math.cos(n+_*r)*Math.sin(a+y*o),w=t*Math.cos(a+y*o),M=t*Math.sin(n+_*r)*Math.sin(a+y*o);m.set(b,w,M).normalize(),l.setXYZ(d,b,w,M),u.setXYZ(d,m.x,m.y,m.z),p.setXY(d,_,1-y),v.push(d),d++}f.push(v)}for(var S=[],g=0;g0)&&S.push(T,E,L),(g!==i-1||s65535?wt:_t)(S,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",p),this.boundingSphere=new et(new h,t)}function We(t,e,i,n,r,a,o){Et.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Ve(t,e,i,n,r,a,o))}function He(t,e,n,r,a,o){Pt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:a,thetaLength:o},t=t||20,e=e||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,c,l,u=(n+1)*(r+1),p=n*r*2*3,d=new mt(new(p>65535?Uint32Array:Uint16Array)(p),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),g=new mt(new Float32Array(2*u),2),v=0,y=0,x=t,_=(e-t)/r,b=new h,w=new i;for(c=0;c<=r;c++){for(l=0;l<=n;l++)s=a+l/n*o,b.x=x*Math.cos(s),b.y=x*Math.sin(s),f.setXYZ(v,b.x,b.y,b.z),m.setXYZ(v,0,0,1),w.x=(b.x/e+1)/2,w.y=(b.y/e+1)/2,g.setXY(v,w.x,w.y),v++;x+=_}for(c=0;c65535?Uint32Array:Uint16Array)(u),1),d=new mt(new Float32Array(3*l),3),f=new mt(new Float32Array(2*l),2),m=0,g=0,v=1/n,y=new h,x=new i;for(s=0;s<=n;s++){var _=r+s*v*a,b=Math.sin(_),w=Math.cos(_);for(c=0;c<=e.length-1;c++)y.x=e[c].x*b,y.y=e[c].y,y.z=e[c].x*w,d.setXYZ(m,y.x,y.y,y.z),x.x=s/n,x.y=c/(e.length-1),f.setXY(m,x.x,x.y),m++}for(s=0;s0&&m++,e>0&&m++);var g=l(),v=u(),y=new mt(new(v>65535?Uint32Array:Uint16Array)(v),1),x=new mt(new Float32Array(3*g),3),_=new mt(new Float32Array(3*g),3),b=new mt(new Float32Array(2*g),2),w=0,M=0,S=[],T=n/2,E=0;p(),o===!1&&(t>0&&d(!0),e>0&&d(!1)),this.setIndex(y),this.addAttribute("position",x),this.addAttribute("normal",_),this.addAttribute("uv",b)}function $e(t,e,i,n,r,a,o,s){Et.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Qe(t,e,i,n,r,a,o,s)),this.mergeVertices()}function ti(t,e,i,n,r,a,o){$e.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function ei(t,e,i,n,r,a,o){Qe.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,thetaStart:a,thetaLength:o}}function ii(t,e,i,n){Pt.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,a=new Float32Array(3*r),o=new Float32Array(3*r),s=new Float32Array(2*r);o[2]=1,s[0]=.5,s[1]=.5;for(var c=0,l=3,u=2;c<=e;c++,l+=3,u+=2){var p=i+c/e*n;a[l]=t*Math.cos(p),a[l+1]=t*Math.sin(p),o[l+2]=1,s[u]=(a[l]/t+1)/2,s[u+1]=(a[l+1]/t+1)/2}for(var d=[],l=1;l<=e;l++)d.push(l,l+1,0);this.setIndex(new mt(new Uint16Array(d),1)),this.addAttribute("position",new mt(a,3)),this.addAttribute("normal",new mt(o,3)),this.addAttribute("uv",new mt(s,2)),this.boundingSphere=new et(new h,t)}function ni(t,e,i,n){Et.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new ii(t,e,i,n))}function ri(t,e,i,n,r,a){Et.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Rt(t,e,i,n,r,a)),this.mergeVertices()}function ai(){Q.call(this,{uniforms:t.UniformsUtils.merge([Oc.lights,{opacity:{value:1}}]),vertexShader:Ic.shadow_vert,fragmentShader:Ic.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}}})}function oi(t){Q.call(this,t),this.type="RawShaderMaterial"}function si(e){this.uuid=t.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0}function ci(t){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(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 X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(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)}function hi(t){ci.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function li(t){J.call(this),this.type="MeshPhongMaterial",this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=na,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ui(t){J.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(t)}function pi(t){J.call(this),this.type="MeshLambertMaterial",this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=na,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function di(t){J.call(this),this.type="LineDashedMaterial",this.color=new X(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function fi(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)}}function mi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function gi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager,this._parser=null}function vi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager,this._parser=null}function yi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function xi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function _i(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function bi(t,e){ht.call(this),this.type="Light",this.color=new X(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function wi(t,e,i){bi.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new X(e)}function Mi(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new l}function Si(){Mi.call(this,new Ut(50,1,.5,500))}function Ti(t,e,i,n,r,a){bi.call(this,t,e),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,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!==a?a:1,this.shadow=new Si}function Ei(t,e,i,n){bi.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 Mi(new Ut(90,1,.5,500))}function Ai(t){Mi.call(this,new Dt((-5),5,5,(-5),.5,500))}function Li(t,e){bi.call(this,t,e),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Ai}function Pi(t,e){bi.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Ci(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}function Ri(t,e,i,n){Ci.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ii(t,e,i,n){Ci.call(this,t,e,i,n)}function Oi(t,e,i,n){Ci.call(this,t,e,i,n)}function Ui(e,i,n,r){if(void 0===e)throw new Error("track name is undefined");if(void 0===i||0===i.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=t.AnimationUtils.convertArray(i,this.TimeBufferType),this.values=t.AnimationUtils.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Di(t,e,i,n){Ui.call(this,t,e,i,n)}function Ni(t,e,i,n){Ci.call(this,t,e,i,n)}function Fi(t,e,i,n){Ui.call(this,t,e,i,n)}function zi(t,e,i,n){Ui.call(this,t,e,i,n)}function Bi(t,e,i,n){Ui.call(this,t,e,i,n)}function ki(t,e,i){Ui.call(this,t,e,i)}function Gi(t,e,i,n){Ui.call(this,t,e,i,n)}function ji(t,e,i,n){Ui.apply(this,arguments)}function Vi(e,i,n){this.name=e,this.tracks=n,this.duration=void 0!==i?i:-1,this.uuid=t.Math.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Wi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager,this.textures={}}function Hi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function Xi(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Yi(e){"boolean"==typeof e&&(e=void 0),this.manager=void 0!==e?e:t.DefaultLoadingManager,this.withCredentials=!1}function qi(e){this.manager=void 0!==e?e:t.DefaultLoadingManager,this.texturePath=""}function Zi(){}function Ji(t,e){this.v1=t,this.v2=e}function Ki(){this.curves=[],this.autoClose=!1}function Qi(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}function $i(t){this.points=void 0===t?[]:t}function tn(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n}function en(t,e,i){this.v0=t,this.v1=e,this.v2=i}function nn(){rn.apply(this,arguments),this.holes=[]}function rn(t){Ki.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function an(){this.subPaths=[],this.currentPath=null}function on(t){this.data=t}function sn(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function cn(){return void 0===Wc&&(Wc=new(window.AudioContext||window.webkitAudioContext)),Wc}function hn(e){this.manager=void 0!==e?e:t.DefaultLoadingManager}function ln(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ut,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ut,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function un(t,e,i){ht.call(this),this.type="CubeCamera";var n=90,r=1,a=new Ut(n,r,t,e);a.up.set(0,-1,0),a.lookAt(new h(1,0,0)),this.add(a);var o=new Ut(n,r,t,e);o.up.set(0,-1,0),o.lookAt(new h((-1),0,0)),this.add(o);var c=new Ut(n,r,t,e);c.up.set(0,0,1),c.lookAt(new h(0,1,0)),this.add(c);var l=new Ut(n,r,t,e);l.up.set(0,0,-1),l.lookAt(new h(0,(-1),0)),this.add(l);var u=new Ut(n,r,t,e);u.up.set(0,-1,0),u.lookAt(new h(0,0,1)),this.add(u);var p=new Ut(n,r,t,e);p.up.set(0,-1,0),p.lookAt(new h(0,0,(-1))),this.add(p);var d={format:Wa,magFilter:Aa,minFilter:Aa};this.renderTarget=new s(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,a,i),i.activeCubeFace=1,t.render(e,o,i),i.activeCubeFace=2,t.render(e,c,i),i.activeCubeFace=3,t.render(e,l,i),i.activeCubeFace=4,t.render(e,u,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,t.render(e,p,i),t.setRenderTarget(null)}}function pn(){ht.call(this),this.type="AudioListener",this.context=cn(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function dn(t){ht.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=[]}function fn(t){dn.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function mn(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)}function gn(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}function vn(t,e,i){this.path=e,this.parsedPath=i||vn.parseTrackName(e),this.node=vn.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function yn(e){this.uuid=t.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var i={};this._indicesByUUID=i;for(var n=0,r=arguments.length;n!==r;++n)i[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var a=this;this.stats={objects:{get total(){return a._objects.length},get inUse(){return this.total-a.nCachedObjects_}},get bindingsPerObject(){return a._bindings.length}}}function xn(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:po,endingEnd:po},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=so,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}function _n(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function bn(t){"string"==typeof t&&(t=arguments[1]),this.value=t,this.dynamic=!1}function wn(){Pt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Mn(e,i,n,r){this.uuid=t.Math.generateUUID(),this.data=e,this.itemSize=i,this.offset=n,this.normalized=r===!0}function Sn(e,i){this.uuid=t.Math.generateUUID(),this.array=e,this.stride=i,this.count=void 0!==e?e.length/i:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Tn(t,e,i){Sn.call(this,t,e),this.meshPerAttribute=i||1}function En(t,e,i){mt.call(this,t,e),this.meshPerAttribute=i||1}function An(t,e,i,n){this.ray=new ot(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return this.Points}}})}function Ln(t,e){return t.distance-e.distance}function Pn(t,e,i,n){if(t.visible!==!1&&(t.raycast(e,i),n===!0))for(var r=t.children,a=0,o=r.length;athis.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,s=this.points[p[0]],c=this.points[p[1]],l=this.points[p[2]],u=this.points[p[3]],a=r*r,o=r*a,d.x=e(s.x,c.x,l.x,u.x,r,a,o),d.y=e(s.y,c.y,l.y,u.y,r,a,o),d.z=e(s.z,c.z,l.z,u.z,r,a,o),d},this.getControlPointsArray=function(){var t,e,i=this.points.length,n=[];for(t=0;t0?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){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>=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(e){return e*t.Math.DEG2RAD},radToDeg:function(e){return e*t.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}},i.prototype={constructor:i,isVector2:!0,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(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n),e.set(r,r),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 Qc(){var Qc=Math.atan2(this.y,this.x);return Qc<0&&(Qc+=2*Math.PI),Qc},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}},n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=ua,n.prototype={constructor:n,isTexture:!0,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(e){function i(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!==e.textures[this.uuid])return e.textures[this.uuid];var n={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 r=this.image;void 0===r.uuid&&(r.uuid=t.Math.generateUUID()),void 0===e.images[r.uuid]&&(e.images[r.uuid]={uuid:r.uuid,url:i(r)}),n.image=r.uuid}return e.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===ua){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case _a:t.x=t.x-Math.floor(t.x);break;case ba:t.x=t.x<0?0:1;break;case wa: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:t.y=t.y-Math.floor(t.y);break;case ba:t.y=t.y<0?0:1;break;case wa: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(n.prototype,e.prototype);var Po=0;a.prototype={constructor:a,isVector4:!0,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],p=s[5],d=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(h-u)y&&v>x?vx?y0?(e=.5/Math.sqrt(p+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 h),e=n.dot(r)+1,eMath.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(c,{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],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,g=s*u+c*p+h*d+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,g*v);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*v;if(s=s*m+u*b,c=c*m+p*b,h=h*m+d*b,l=l*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),h.prototype={constructor:h,isVector3:!0,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&&e.isEuler)===!1,void 0===t&&(t=new c),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new c),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 l),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new l),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 h,e=new h),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 h),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new h),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(e){var i=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(t.Math.clamp(i,-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}},l.prototype={constructor:l,isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,p,d,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]=p,g[7]=d,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 l).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 h);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),a=1/t.setFromMatrixColumn(e,1).length(),o=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]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1;var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m+y*o,e[4]=v*o-g,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=g*o-v,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=v+g*o,e[1]=g+v*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,_=a*c,b=o*s,w=o*c;e[0]=s*h,e[4]=w-x*l,e[8]=b*l+_,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=_*l+b,e[10]=x-w*l}else if("XZY"===t.order){var x=a*s,_=a*c,b=o*s,w=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+w,e[5]=a*h,e[9]=_*l-b,e[2]=b*l-_,e[6]=o*h,e[10]=w*l+x}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,p=n*s,d=n*c,f=r*c,m=a*o,g=a*s,v=a*c;return e[0]=1-(p+f),e[4]=l-v,e[8]=u+g,e[1]=l+v,e[5]=1-(h+f),e[9]=d-m,e[2]=u-g,e[6]=d+m,e[10]=1-(h+p),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,a){void 0===t&&(t=new h,e=new h,i=new h);var o=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(a,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(a,i).normalize()),e.crossVectors(i,t),o[0]=t.x,o[4]=e.x,o[8]=i.x,o[1]=t.y,o[5]=e.y,o[9]=i.y,o[2]=t.z,o[6]=e.z,o[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],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],_=i[15],b=n[0],w=n[4],M=n[8],S=n[12],T=n[1],E=n[5],A=n[9],L=n[13],P=n[2],C=n[6],R=n[10],I=n[14],O=n[3],U=n[7],D=n[11],N=n[15];return r[0]=a*b+o*T+s*P+c*O,r[4]=a*w+o*E+s*C+c*U,r[8]=a*M+o*A+s*R+c*D,r[12]=a*S+o*L+s*I+c*N,r[1]=h*b+l*T+u*P+p*O,r[5]=h*w+l*E+u*C+p*U,r[9]=h*M+l*A+u*R+p*D,r[13]=h*S+l*L+u*I+p*N,r[2]=d*b+f*T+m*P+g*O,r[6]=d*w+f*E+m*C+g*U,r[10]=d*M+f*A+m*R+g*D,r[14]=d*S+f*L+m*I+g*N,r[3]=v*b+y*T+x*P+_*O,r[7]=v*w+y*E+x*C+_*U,r[11]=v*M+y*A+x*R+_*D,r[15]=v*S+y*L+x*I+_*N,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 h),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,a=i;r>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 e(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(i,n,r){if(i=t.Math.euclideanModulo(i,1),n=t.Math.clamp(n,0,1),r=t.Math.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var a=r<=.5?r*(1+n):r+n-r*n,o=2*r-a;this.r=e(o,a,i+1/3),this.g=e(o,a,i),this.b=e(o,a,i-1/3)}return this}}(),setStyle:function(e){function i(t){void 0!==t&&parseFloat(t)<1}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,i(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,i(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,h=parseInt(r[3],10)/100;return i(r[5]),this.setHSL(s,c,h)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[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(e&&e.length>0){var l=t.ColorKeywords[e];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+(athis.max.x||t.ythis.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 n=e||new i;return n.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.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var n=e||new i;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;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)}},J.prototype={constructor:J,isMaterial:!0,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&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?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&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(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!==Ar&&(n.blending=this.blending),this.shading!==wr&&(n.shading=this.shading),this.side!==yr&&(n.side=this.side),this.vertexColors!==Mr&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,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),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),a=e(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}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(J.prototype,e.prototype);var Dc=0;Q.prototype=Object.create(J.prototype),Q.prototype.constructor=Q,Q.prototype.isShaderMaterial=!0,Q.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=t.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Q.prototype.toJSON=function(t){var e=J.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},$.prototype=Object.create(J.prototype),$.prototype.constructor=$,$.prototype.isMeshDepthMaterial=!0,$.prototype.copy=function(t){return J.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},tt.prototype={constructor:tt,isBox3:!0,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;sr&&(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;ethis.max.x||t.ythis.max.y||t.zthis.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 h;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.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new h),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 h;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new h;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new h;return function(e){var i=e||new et;return this.getCenter(i.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 h,new h,new h,new h,new h,new h,new h,new h];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)}},et.prototype={constructor:et,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new tt;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).getCenter(n);for(var r=0,a=0,o=e.length;athis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new tt;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}},it.prototype={constructor:it,isMatrix3:!0,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 h),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,a=i;r1))return n.copy(r).multiplyScalar(o).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 h;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new h,e=new it;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}},rt.prototype={constructor:rt,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],p=i[9],d=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+p,y+g).normalize(),e[3].setComponents(o-r,l-c,f-p,y-g).normalize(), +e[4].setComponents(o-a,l-h,f-d,y-v).normalize(),e[5].setComponents(o+a,l+h,f+d,y+v).normalize(),this},intersectsObject:function(){var t=new et;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 et;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(a0?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}},ot.prototype={constructor:ot,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 h;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 h;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var i=e||new h;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 h;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 h,e=new h,i=new h;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),p=-this.direction.dot(e),d=i.dot(this.direction),f=-i.dot(e),m=i.lengthSq(),g=Math.abs(1-p*p);if(g>0)if(s=p*f-d,c=p*d-f,l=u*g,s>=0)if(c>=-l)if(c<=l){var v=1/g;s*=v,c*=v,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-p*u+d)),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,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),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 h;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=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=0?i:n,e)))},intersectsBox:function(){var t=new h;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new h,e=new h,i=new h,n=new h;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 p=h*this.direction.dot(e.cross(t));if(p<0)return null;if(u+p>l)return null;var d=-h*t.dot(n);return d<0?null:this.at(d/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)}},st.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],st.DefaultOrder="XYZ",st.prototype={constructor:st,isEuler:!0,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(e,i,n){var r=t.Math.clamp,a=e.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],p=a[2],d=a[6],f=a[10];return i=i||this._order,"XYZ"===i?(this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===i?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-p,o),this._z=0)):"ZXY"===i?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,o))):"ZYX"===i?(this._y=Math.asin(-r(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===i?(this._z=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===i&&(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-u,f),this._y=0)),this._order=i,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),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 c;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 h(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},ct.prototype={constructor:ct,set:function(t){this.mask=1<1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var a=0;a0&&(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;i0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),pt.barycoordFromPoint=function(){var t=new h,e=new h,i=new h;return function(n,r,a,o,s){t.subVectors(o,r),e.subVectors(a,r),i.subVectors(n,r);var c=t.dot(t),l=t.dot(e),u=t.dot(i),p=e.dot(e),d=e.dot(i),f=c*p-l*l,m=s||new h;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(p*u-l*d)*g,y=(c*d-l*u)*g;return m.set(1-v-y,y,v)}}(),pt.containsPoint=function(){var t=new h;return function(e,i,n,r){var a=pt.barycoordFromPoint(e,i,n,r,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),pt.prototype={constructor:pt,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 h,e=new h;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 h;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return pt.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new nt;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return pt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return pt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,a){void 0===t&&(t=new nt,e=[new ut,new ut,new ut],i=new h,n=new h);var o=a||new h,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)o.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 c=0;c0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new tt),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new et),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)!==!1){var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,p=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new it).getNormalMatrix(e));for(var d=0,f=o.length;d=0;i--){var g=d[i];for(this.faces.splice(g,1),o=0,s=this.faceVertexUvs.length;o0,w=v.vertexNormals.length>0,M=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,_),T=t(T,4,b),T=t(T,5,w),T=t(T,6,M),T=t(T,7,S),l.push(T),l.push(v.a,v.b,v.c),l.push(v.materialIndex),_){var E=this.faceVertexUvs[0][c];l.push(n(E[0]),n(E[1]),n(E[2]))}if(b&&l.push(e(v.normal)),w){var A=v.vertexNormals;l.push(e(A[0]),e(A[1]),e(A[2]))}if(M&&l.push(i(v.color)),S){var L=v.vertexColors;l.push(i(L[0]),i(L[1]),i(L[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,d.length>0&&(r.data.colors=d),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new Et).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=t.vertices,i=0,n=e.length;i0,s=a[1]&&a[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l0){u=[];for(var l=0;l0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=t.vertices.length>65535?Uint32Array:Uint16Array,s=new o(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var h=[],l=t.morphTargets[c],u=0,p=l.length;u0){var m=new Mt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new Mt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.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 tt);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 tt,e=new h;return function(){null===this.boundingSphere&&(this.boundingSphere=new et);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.getCenter(r);for(var a=0,o=0,s=n.length;o0&&(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 Pt).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;o0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,i=t.length;ee.far?null:{distance:h,point:_.clone(),object:t}}function n(i,n,r,a,o,h,l,p){s.fromArray(a,3*h),c.fromArray(a,3*l),u.fromArray(a,3*p);var d=e(i,n,r,s,c,u,x);return d&&(o&&(m.fromArray(o,2*h),g.fromArray(o,2*l),v.fromArray(o,2*p),d.uv=t(x,s,c,u,m,g,v)),d.face=new dt(h,l,p,pt.normal(s,c,u)),d.faceIndex=h),d}var r=new l,a=new ot,o=new et,s=new h,c=new h,u=new h,p=new h,d=new h,f=new h,m=new i,g=new i,v=new i,y=new h,x=new h,_=new h;return function(i,h){var l=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===l.boundingSphere&&l.computeBoundingSphere(),o.copy(l.boundingSphere),o.applyMatrix4(_),i.ray.intersectsSphere(o)!==!1&&(r.getInverse(_),a.copy(i.ray).applyMatrix4(r),null===l.boundingBox||a.intersectsBox(l.boundingBox)!==!1))){var b,w;if(l&&l.isBufferGeometry){var M,S,T,E=l.index,A=l.attributes,L=A.position.array;if(void 0!==A.uv&&(b=A.uv.array),null!==E)for(var P=E.array,C=0,R=P.length;C0&&(b=B);for(var k=0,G=z.length;kr||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),fe.prototype=Object.assign(Object.create(ht.prototype),{constructor:fe,copy:function(t){ht.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){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=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;ao)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,_=v.length/3-1;x<_;x+=f){l.fromArray(v,3*x),u.fromArray(v,3*x+3);var M=e.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var T=s.vertices,E=T.length,x=0;xo)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),be.prototype=Object.assign(Object.create(_e.prototype),{constructor:be,isLineSegments:!0}),we.prototype=Object.create(J.prototype),we.prototype.constructor=we,we.prototype.isPointsMaterial=!0,we.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Me.prototype=Object.assign(Object.create(ht.prototype),{constructor:Me,isPoints:!0,raycast:function(){var t=new l,e=new ot,i=new et;return function(n,r){function a(t,i){var a=e.distanceSqToPoint(t);if(an.far)return;r.push({distance:h,distanceToRay:Math.sqrt(a),point:s.clone(),index:i,face:null,object:o})}}var o=this,s=this.geometry,c=this.matrixWorld,l=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new h;if(s&&s.isBufferGeometry){var f=s.index,m=s.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,x=v.length;yNumber.EPSILON&&(y.normalize(),a=Math.acos(t.Math.clamp(m[p-1].dot(m[p]),-1,1)),g[p].applyMatrix4(x.makeRotationAxis(y,a))),v[p].crossVectors(m[p],g[p]);if(n)for(a=Math.acos(t.Math.clamp(g[0].dot(g[_-1]),-1,1)),a/=_-1,m[0].dot(y.crossVectors(g[0],g[_-1]))>0&&(a=-a),p=1;p<_;p++)g[p].applyMatrix4(x.makeRotationAxis(m[p],a*p)),v[p].crossVectors(m[p],g[p])},Fe.prototype=Object.create(Pt.prototype),Fe.prototype.constructor=Fe,ze.prototype=Object.create(Et.prototype),ze.prototype.constructor=ze,Be.prototype=Object.create(Pt.prototype),Be.prototype.constructor=Be,ke.prototype=Object.create(Et.prototype),ke.prototype.constructor=ke,t.ShapeUtils={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r(h-s)*(p-c)-(l-c)*(u-s))return!1;var m,g,v,y,x,_,b,w,M,S,T,E,A,L,P;for(m=u-h,g=p-l,v=s-u,y=c-p,x=h-s,_=l-c,o=0;o=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(i,n){var r=i.length;if(r<3)return null;var a,o,s,c=[],h=[],l=[];if(t.ShapeUtils.area(i)>0)for(o=0;o2;){if(p--<=0)return n?l:c;if(a=o,u<=a&&(a=0),o=a+1,u<=o&&(o=0),s=o+1,u<=s&&(s=0),e(i,a,o,s,u,h)){var d,f,m,g,v;for(d=h[a],f=h[o],m=h[s],c.push([i[d],i[f],i[m]]),l.push([h[a],h[o],h[s]]),g=o,v=o+1;v2&&t[e-1].equals(t[0])&&t.pop()}function r(t,e,i){return t.x!==e.x?t.xNumber.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if(f=h*l-c*u,f<0||f>p)return[]}else{if(d>0||d0||fT?[]:_===T?a?[]:[y]:b<=T?[y,x]:[y,M]}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 p=c*s-h*o;return l>0?u>=0&&p>=0:u>=0||p>=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,r;for(i=0;i0)return!0;return!1}function r(t,i){var n,r,o,s,c;for(n=0;n0)return!0;return!1}for(var s,c,h,l,u,p,d,f,m,g,v,y=t.concat(),x=[],_=[],b=0,w=e.length;b0&&(S--,!(S<0));)for(h=M;h=0)break;_[d]=!0}if(c>=0)break}return y}n(e),i.forEach(n);for(var c,h,l,u,p,d,f={},m=e.concat(),g=0,v=i.length;gNumber.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=e.x-c/d,g=e.y+s/d,v=n.x-l/f,y=n.y+h/f,x=((v-m)*l-(y-g)*h)/(s*l-c*h);r=m+s*x-t.x,a=g+c*x-t.y;var _=r*r+a*a;if(_<=2)return new i(r,a);o=Math.sqrt(_/2)}else{var b=!1;s>Number.EPSILON?h>Number.EPSILON&&(b=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(b=!0):Math.sign(c)===Math.sign(l)&&(b=!0),b?(r=-c,a=s,o=Math.sqrt(u)):(r=s,a=c,o=Math.sqrt(u/2))}return new i(r/o,a/o)}function o(){if(w){var t=0,e=H*t;for(q=0;q=0;){i=q,n=q-1,n<0&&(n=t.length-1);var r=0,a=S+2*b;for(r=0;r=0;B--){for(G=B/b,j=x*Math.cos(G*Math.PI/2),k=_*Math.sin(G*Math.PI/2),q=0,Z=z.length;q0||0===t.search(/^data\:image\/jpeg/);a.format=n?Wa:Ha,a.image=i,a.needsUpdate=!0,void 0!==e&&e(a)},i,r),a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),bi.prototype=Object.assign(Object.create(ht.prototype),{constructor:bi,isLight:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ht.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),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),wi.prototype=Object.assign(Object.create(bi.prototype),{constructor:wi,isHemisphereLight:!0,copy:function(t){return bi.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Mi.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)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Si.prototype=Object.assign(Object.create(Mi.prototype),{constructor:Si,isSpotLightShadow:!0,update:function(e){var i=2*t.Math.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,r=e.distance||500,a=this.camera;i===a.fov&&n===a.aspect&&r===a.far||(a.fov=i,a.aspect=n,a.far=r,a.updateProjectionMatrix())}}),Ti.prototype=Object.assign(Object.create(bi.prototype),{constructor:Ti,isSpotLight:!0,copy:function(t){return bi.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}}),Ei.prototype=Object.assign(Object.create(bi.prototype),{constructor:Ei,isPointLight:!0,copy:function(t){return bi.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Ai.prototype=Object.assign(Object.create(Mi.prototype),{constructor:Ai}),Li.prototype=Object.assign(Object.create(bi.prototype),{constructor:Li,isDirectionalLight:!0,copy:function(t){return bi.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Pi.prototype=Object.assign(Object.create(bi.prototype),{constructor:Pi,isAmbientLight:!0}),t.AnimationUtils={arraySlice:function(e,i,n){return t.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(i,n)):e.slice(i,n)},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)}}},Ci.prototype={constructor:Ci,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=r)break t;var s=e[1];t=r)break e}a=i,i=0}}for(;i>>1;ti;)--o;if(++o,0!==a||o!==r){a>=o&&(o=Math.max(o,1),a=o-1);var s=this.getValueSize();this.times=t.AnimationUtils.arraySlice(n,a,o),this.values=t.AnimationUtils.arraySlice(this.values,a*s,o*s)}return this},validate:function(){var e=!0,i=this.getValueSize();i-Math.floor(i)!==0&&(e=!1);var n=this.times,r=this.values,a=n.length;0===a&&(e=!1);for(var o=null,s=0;s!==a;s++){var c=n[s];if("number"==typeof c&&isNaN(c)){e=!1;break}if(null!==o&&o>c){e=!1;break}o=c}if(void 0!==r&&t.AnimationUtils.isTypedArray(r))for(var s=0,h=r.length;s!==h;++s){var l=r[s];if(isNaN(l)){e=!1;break}}return e},optimize:function(){for(var e=this.times,i=this.values,n=this.getValueSize(),r=this.getInterpolation()===uo,a=1,o=e.length-1,s=1;s0){e[a]=e[o];for(var g=o*n,v=a*n,f=0;f!==n;++f)i[v+f]=i[g+f];++a}return a!==e.length&&(this.times=t.AnimationUtils.arraySlice(e,0,a),this.values=t.AnimationUtils.arraySlice(i,0,a*n)),this}},Di.prototype=Object.assign(Object.create(jc),{constructor:Di,ValueTypeName:"vector"}),Ni.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Ni,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=(i-e)/(n-e),l=s+o;s!==l;s+=4)c.slerpFlat(r,0,a,s-o,a,s,h);return r}}),Fi.prototype=Object.assign(Object.create(jc),{constructor:Fi,ValueTypeName:"quaternion",DefaultInterpolation:lo,InterpolantFactoryMethodLinear:function(t){return new Ni(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),zi.prototype=Object.assign(Object.create(jc),{constructor:zi,ValueTypeName:"number"}),Bi.prototype=Object.assign(Object.create(jc),{constructor:Bi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ho,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ki.prototype=Object.assign(Object.create(jc),{constructor:ki,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ho,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Gi.prototype=Object.assign(Object.create(jc),{constructor:Gi,ValueTypeName:"color"}),ji.prototype=jc,jc.constructor=ji,Object.assign(ji,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var i=ji._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],r=[];t.AnimationUtils.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==i.parse?i.parse(e):new i(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var i,n=e.constructor;if(void 0!==n.toJSON)i=n.toJSON(e);else{i={name:e.name,times:t.AnimationUtils.convertArray(e.times,Array),values:t.AnimationUtils.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return zi;case"vector":case"vector2":case"vector3":case"vector4":return Di;case"color":return Gi;case"quaternion":return Fi;case"bool":case"boolean":return ki;case"string":return Bi}throw new Error("Unsupported typeName: "+t)}}),Vi.prototype={constructor:Vi,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;t1){var h=c[1],l=n[h];l||(n[h]=l=[]),l.push(s)}}var u=[];for(var h in n)u.push(Vi.CreateFromMorphTargetSequence(h,n[h],e,i));return u},parseAnimation:function(e,i){if(!e)return null;for(var n=function(e,i,n,r,a){if(0!==n.length){var o=[],s=[];t.AnimationUtils.flattenJSON(n,o,s,r),0!==o.length&&a.push(new e(i,o,s))}},r=[],a=e.name||"default",o=e.length||-1,s=e.fps||30,c=e.hierarchy||[],h=0;h1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,h=e>3?t.skinWeights[i+3]:0;c.skinWeights.push(new a(r,o,s,h))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i1?t.skinIndices[i+1]:0,p=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;c.skinIndices.push(new a(l,u,p,d))}c.bones=t.bones,c.bones&&c.bones.length>0&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)}function o(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i0)for(var u=c.faces,p=t.morphColors[0].colors,i=0,n=u.length;i0&&(c.animations=e)}var c=new Et,l=void 0!==t.scale?1/t.scale:1;if(n(l),r(),o(l),s(),c.computeFaceNormals(),c.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:c};var u=Xi.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:c,materials:u}}}),Object.assign(qi.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,a=new mi(r.manager);a.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 Yi,n=new Hi,r=0,a=t.length;r0){var a=new fi(e),o=new yi(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s0?new ye(s,c):new Ct(s,c);break;case"LOD":o=new fe;break;case"Line":o=new _e(r(e.geometry),a(e.material),e.mode);break;case"LineSegments":o=new be(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":o=new Me(r(e.geometry),a(e.material));break;case"Sprite":o=new de(a(e.material));break;case"Group":o=new Se;break;default:o=new ht}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.children)for(var h in e.children)o.add(this.parseObject(e.children[h],i,n));if("LOD"===e.type)for(var l=e.levels,u=0;u0)){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],p=u-l,d=(i-l)/p,h=(r+d)/(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)}},Zi.create=function(t,e){return t.prototype=Object.create(Zi.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Ji.prototype=Object.create(Zi.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isLineCurve=!0,Ji.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},Ji.prototype.getPointAt=function(t){return this.getPoint(t)},Ji.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},Ki.prototype=Object.assign(Object.create(Zi.prototype),{constructor:Ki,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 Ji(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;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;i1&&!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 Et,i=0,n=t.length;ie;)n-=e;nn.length-2?n.length-1:a+1],l=n[a>n.length-3?n.length-1:a+2],u=t.CurveUtils.interpolate;return new i(u(s.x,c.x,h.x,l.x,o),u(s.y,c.y,h.y,l.y,o))},tn.prototype=Object.create(Zi.prototype),tn.prototype.constructor=tn,tn.prototype.getPoint=function(e){var n=t.ShapeUtils.b3;return new i(n(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},tn.prototype.getTangent=function(e){var n=t.CurveUtils.tangentCubicBezier;return new i(n(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},en.prototype=Object.create(Zi.prototype),en.prototype.constructor=en,en.prototype.getPoint=function(e){var n=t.ShapeUtils.b2;return new i(n(e,this.v0.x,this.v1.x,this.v2.x),n(e,this.v0.y,this.v1.y,this.v2.y))},en.prototype.getTangent=function(e){var n=t.CurveUtils.tangentQuadraticBezier;return new i(n(e,this.v0.x,this.v1.x,this.v2.x),n(e,this.v0.y,this.v1.y,this.v2.y)).normalize()};var Vc=Object.assign(Object.create(Ki.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});nn.prototype=Object.assign(Object.create(Vc),{constructor:nn,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;iNumber.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.ys.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 a=t.ShapeUtils.isClockWise,o=this.subPaths;if(0===o.length)return[];if(i===!0)return n(o);var s,c,h,l=[];if(1===o.length)return c=o[0],h=new nn,h.curves=c.curves,l.push(h),l;var u=!a(o[0].getPoints());u=e?!u:u;var p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v1){for(var x=!1,_=[],b=0,w=f.length;b0&&(x||(m=d))}for(var L,v=0,P=f.length;v0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n,r){c.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}}},vn.prototype={constructor:vn,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=vn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var a=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 o=0;o=i){var u=i++,p=e[u];n[p.uuid]=l,e[l]=p,n[h]=u,e[u]=c;for(var d=0,f=a;d!==f;++d){var m=r[d],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],u0)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===oo){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 a=n===co;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<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===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&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=fo,n.endingEnd=fo):(t?n.endingStart=this.zeroSlopeAtStart?fo:po:n.endingStart=mo,e?n.endingEnd=this.zeroSlopeAtEnd?fo:po:n.endingEnd=mo)},_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}},Object.assign(_n.prototype,e.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Vi.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new xn(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Vi.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o?o.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))}}),Object.assign(_n.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(d=a[l],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;d=new gn(vn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.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&&e1){var h=c[1];n[h]||(n[h]={start:1/0,end:-(1/0)});var l=n[h];al.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},On.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},On.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},On.prototype.setAnimationFPS=function(t,e){var i=this.animationsMap[t];i&&(i.fps=e,i.duration=(i.end-i.start)/i.fps)},On.prototype.setAnimationDuration=function(t,e){var i=this.animationsMap[t];i&&(i.duration=e,i.fps=(i.end-i.start)/i.duration)},On.prototype.setAnimationWeight=function(t,e){var i=this.animationsMap[t];i&&(i.weight=e)},On.prototype.setAnimationTime=function(t,e){var i=this.animationsMap[t];i&&(i.time=e)},On.prototype.getAnimationTime=function(t){var e=0,i=this.animationsMap[t];return i&&(e=i.time),e},On.prototype.getAnimationDuration=function(t){var e=-1,i=this.animationsMap[t];return i&&(e=i.duration),e},On.prototype.playAnimation=function(t){var e=this.animationsMap[t];e&&(e.time=0,e.active=!0)},On.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},On.prototype.update=function(e){for(var i=0,n=this.animationsList.length;ir.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.start+t.Math.clamp(Math.floor(r.time/a),0,r.length-1),s=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var c=r.time%a/a;r.directionBackwards&&(c=1-c),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=c*s,this.morphTargetInfluences[r.lastFrame]=(1-c)*s):this.morphTargetInfluences[r.currentFrame]=s}}},Un.prototype=Object.create(ht.prototype),Un.prototype.constructor=Un,Un.prototype.isImmediateRenderObject=!0,Dn.prototype=Object.create(be.prototype),Dn.prototype.constructor=Dn,Dn.prototype.update=function(){var t=new h,e=new h,i=new it;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,h=0,l=0,u=c.length;l.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))}}(),Xn.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()},Xn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},Yn.prototype=Object.create(be.prototype),Yn.prototype.constructor=Yn,t.CatmullRomCurve3=function(){function t(){}var e=new h,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},Zi.create(function(t){this.points=t||[],this.closed=!1},function(t){var a,o,s,c,l=this.points;c=l.length,a=(c-(this.closed?0:1))*t,o=Math.floor(a),s=a-o,this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/l.length)+1)*l.length:0===s&&o===c-1&&(o=c-2,s=1);var u,p,d,f;if(this.closed||o>0?u=l[(o-1)%c]:(e.subVectors(l[0],l[1]).add(l[0]),u=e),p=l[o%c],d=l[(o+1)%c],this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2],u=t.CurveUtils.interpolate;return new h(u(o.x,s.x,c.x,l.x,a),u(o.y,s.y,c.y,l.y,a),u(o.z,s.z,c.z,l.z,a))});t.CubicBezierCurve3=Zi.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(e){var i=t.ShapeUtils.b3;return new h(i(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),i(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),i(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),t.QuadraticBezierCurve3=Zi.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(e){var i=t.ShapeUtils.b2;return new h(i(e,this.v0.x,this.v1.x,this.v2.x),i(e,this.v0.y,this.v1.y,this.v2.y),i(e,this.v0.z,this.v1.z,this.v2.z))}),t.LineCurve3=Zi.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new h;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),Zn.prototype=Object.create(Qi.prototype),Zn.prototype.constructor=Zn,t.SceneUtils={createMultiMaterialObject:function(t,e){for(var i=new Se,n=0,r=e.length;na||8*(1-f.dot(this.object.quaternion))>a)&&(d.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;L=A.ROTATE,y.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.ZOOM){if(v.enableZoom===!1)return;L=A.DOLLY,S.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.PAN){if(v.enablePan===!1)return;L=A.PAN,b.set(t.clientX,t.clientY)}L!==A.NONE&&(document.addEventListener("mousemove",c,!1),document.addEventListener("mouseup",h,!1),v.dispatchEvent(C))}}function c(t){if(v.enabled!==!1){t.preventDefault();var e=v.domElement===document?v.domElement.body:v.domElement;if(L===A.ROTATE){if(v.enableRotate===!1)return;x.set(t.clientX,t.clientY),_.subVectors(x,y),g.rotateLeft(2*Math.PI*_.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*_.y/e.clientHeight*v.rotateSpeed),y.copy(x)}else if(L===A.DOLLY){if(v.enableZoom===!1)return;T.set(t.clientX,t.clientY),E.subVectors(T,S),E.y>0?g.dollyIn(o()):E.y<0&&g.dollyOut(o()),S.copy(T)}else if(L===A.PAN){if(v.enablePan===!1)return;w.set(t.clientX,t.clientY),M.subVectors(w,b),r(M.x,M.y),b.copy(w)}L!==A.NONE&&v.update()}}function h(){v.enabled!==!1&&(document.removeEventListener("mousemove",c,!1),document.removeEventListener("mouseup",h,!1),v.dispatchEvent(R),L=A.NONE)}function l(t){if(v.enabled!==!1&&v.enableZoom!==!1&&L===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(C),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 p(t){if(v.enabled!==!1){switch(t.touches.length){case 1:if(v.enableRotate===!1)return;L=A.TOUCH_ROTATE,y.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(v.enableZoom===!1)return;L=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;L=A.TOUCH_PAN,b.set(t.touches[0].pageX,t.touches[0].pageY);break;default:L=A.NONE}L!==A.NONE&&v.dispatchEvent(C)}}function d(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(L!==A.TOUCH_ROTATE)return;x.set(t.touches[0].pageX,t.touches[0].pageY), +_.subVectors(x,y),g.rotateLeft(2*Math.PI*_.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*_.y/e.clientHeight*v.rotateSpeed),y.copy(x),v.update();break;case 2:if(v.enableZoom===!1)return;if(L!==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),E.subVectors(T,S),E.y>0?g.dollyOut(o()):E.y<0&&g.dollyIn(o()),S.copy(T),v.update();break;case 3:if(v.enablePan===!1)return;if(L!==A.TOUCH_PAN)return;w.set(t.touches[0].pageX,t.touches[0].pageY),M.subVectors(w,b),r(M.x,M.y),b.copy(w),v.update();break;default:L=A.NONE}}}function f(){v.enabled!==!1&&(v.dispatchEvent(R),L=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,_=new t.Vector2,b=new t.Vector2,w=new t.Vector2,M=new t.Vector2,S=new t.Vector2,T=new t.Vector2,E=new t.Vector2,A={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},L=A.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom;var P={type:"change"},C={type:"start"},R={type:"end"};this.update=function(){this.autoRotate&&L===A.NONE&&g.rotateLeft(a()),g.update()===!0&&this.dispatchEvent(P)},this.reset=function(){L=A.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(P),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",p,!1),this.domElement.removeEventListener("touchend",f,!1),this.domElement.removeEventListener("touchmove",d,!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",p,!1),this.domElement.addEventListener("touchend",f,!1),this.domElement.addEventListener("touchmove",d,!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(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}function a(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;e.geo=new h.PlaneGeometry(t,i,n,r)}:"sphere"==t?function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32;e.geo=new h.SphereGeometry(t,i,n)}:void 0}},{key:"place",value:function(t,e){var i,n,r=new u["default"](15658734).standard,o=new h.Mesh(this.geo,r);(i=o.position).set.apply(i,a(t)),(n=o.rotation).set.apply(n,a(e)),d["default"].shadow.enabled&&(o.receiveShadow=!0),this.scene.add(o)}}]),t}();e["default"]=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}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=i(6),s=r(o),c=i(2),h=(n(c),function l(t){a(this,l),this.basic=new s.MeshBasicMaterial({color:t,side:s.DoubleSide}),this.standard=new s.MeshStandardMaterial({color:t,shading:s.FlatShading,roughness:1,metalness:0,side:s.DoubleSide}),this.wire=new s.MeshBasicMaterial({wireframe:!0})});e["default"]=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}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;i1)for(var i=1;i Three.js Webpack ES6 Boilerplate - + -
-
-
-
+
+
Loading...
+
- - - + + + +