!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).SCOASIS={})}(this,function(t){"use strict";function h(){this.a=0,this.b=0,this.set=function(t,e){this.a=t,this.b=e},this.d2S=function(t){var e=this.a-t.a,n=this.b-t.b;return e*e+n*n}}function l(t,e,n){this.aa=t,this.ab=e,this.ac=n,this.set=function(t,e,n){this.aa=t,this.ab=e,this.ac=n},this.applyMx=function(t){var e=this.aa,n=this.ab,i=this.ac,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.aa=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.ab=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.ac=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},this.addSV=function(t,e){return this.aa+=t.aa*e,this.ab+=t.ab*e,this.ac+=t.ac*e,this},this.d2S=function(t){var e=this.aa-t.aa,n=this.ab-t.ab,i=this.ac-t.ac;return e*e+n*n+i*i}}function e(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.setFA=function(t){for(var e=0;e<16;e++)this.elements[e]=t[e];return this},this.mM4=function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],h=n[12],l=n[1],c=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],C=i[13],L=i[2],P=i[6],R=i[10],O=i[14],k=i[3],z=i[7],I=i[11],D=i[15];return r[0]=o*w+a*T+s*L+h*k,r[4]=o*_+a*E+s*P+h*z,r[8]=o*M+a*A+s*R+h*I,r[12]=o*S+a*C+s*O+h*D,r[1]=l*w+c*T+u*L+p*k,r[5]=l*_+c*E+u*P+p*z,r[9]=l*M+c*A+u*R+p*I,r[13]=l*S+c*C+u*O+p*D,r[2]=d*w+f*T+m*L+v*k,r[6]=d*_+f*E+m*P+v*z,r[10]=d*M+f*A+m*R+v*I,r[14]=d*S+f*C+m*O+v*D,r[3]=g*w+y*T+x*L+b*k,r[7]=g*_+y*E+x*P+b*z,r[11]=g*M+y*A+x*R+b*I,r[15]=g*S+y*C+x*O+b*D,this}}function _t(){this.matrix1=new e,this.matrix2=new e,this.pstn=new l,this.up=new l,this.set=function(t,e,n,i){this.matrix1.setFA(t),this.matrix2.setFA(e),this.pstn.set(n.x,n.y,n.z),this.up.set(i.x,i.y,i.z)},this.compute=function(){var t=new e;return t.mM4(this.matrix1,this.matrix2),t},this.distance=function(t,e,n){var i=t.clone();return i.addSV(this.up,e),t.applyMx(n),i.applyMx(n),t.d2S(i)}}Object.assign(l.prototype,{clone:function(){return new this.constructor(this.aa,this.ab,this.ac)}});var i={_d1:new Date};function Mt(r){var o=1,a=2;this.cPixel=0,this.cw=0;function t(){var t=517376,e=1536,n=7680;return{tt:t>>=8,tm:e>>=8,td:n>>=8}}var s=1;function n(t,e){var n=r.getBoundingClientRect(),i=new h;return 0===n.width||i.set((t-n.left)/n.width*a-o,(e-n.top)/n.height*-a+o),i}i._d1.getFullYear()>8&255]+r[t>>16&255]+r[t>>24&255]+"-"+r[255&e]+r[e>>8&255]+"-"+r[e>>16&15|64]+r[e>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toUpperCase()}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},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*Ye.DEG2RAD},radToDeg:function(t){return t*Ye.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function Ze(t,e){this.x=t||0,this.y=e||0}function Je(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,h=h*m+p*w,l=l*m+d*w,c=c*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+h*h+l*l+c*c);s*=_,h*=_,l*=_,c*=_}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=c}}),Object.defineProperties(Ke.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Ke.prototype,{isQuaternion:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,h=a(n/2),l=a(i/2),c=a(r/2),u=s(n/2),p=s(i/2),d=s(r/2);return"XYZ"===o?(this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d):"YXZ"===o?(this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d):"ZXY"===o?(this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d):"ZYX"===o?(this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d):"YZX"===o?(this._x=u*l*c+h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c-u*p*d):"XZY"===o&&(this._x=u*l*c-h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c+u*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],h=n[9],l=n[2],c=n[6],u=n[10],p=i+s+u;return 0Math.abs(t.z)?y.set(-t.y,t.x,0):y.set(0,-t.z,t.y)):y.crossVectors(t,e),this._x=y.x,this._y=y.y,this._z=y.z,this._w=g,this.normalize()}),angleTo:function(t){return 2*Math.acos(Math.abs(Ye.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n=this.angleTo(t);if(0===n)return this;var i=Math.min(1,e/n);return this.slerp(t,i),this},inverse:function(){return this.conjugate()},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?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,h=e._z,l=e._w;return this._x=n*l+o*a+i*h-r*s,this._y=i*l+o*s+r*a-n*h,this._z=r*l+o*h+n*s-i*a,this._w=o*l-n*a-i*s-r*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var h=1-e;return this._w=h*o+e*this._w,this._x=h*n+e*this._x,this._y=h*i+e*this._y,this._z=h*r+e*this._z,this.normalize()}var l=Math.sqrt(s),c=Math.atan2(l,a),u=Math.sin((1-e)*c)/l,p=Math.sin(e*c)/l;return this._w=o*u+this._w*p,this._x=n*u+this._x*p,this._y=i*u+this._y*p,this._z=r*u+this._z*p,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(Qe.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,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)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),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?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),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?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(T=new Ke,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(T.setFromEuler(t))}),applyAxisAngle:(S=new Ke,function(t,e){return this.applyQuaternion(S.setFromAxisAngle(t,e))}),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,h=s*e+o*i-a*n,l=s*n+a*e-r*i,c=s*i+r*n-o*e,u=-r*e-o*n-a*i;return this.x=h*s+u*-r+l*-a-c*-o,this.y=l*s+u*-o+c*-r-h*-a,this.z=c*s+u*-a+h*-o-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:(M=new Je,function(t){return this.applyMatrix4(M.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld)}),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,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:(w=new Qe,_=new Qe,function(t,e){return w.set(t,t,t),_.set(e,e,e),this.clamp(w,_)}),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,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,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(b=new Qe,function(t){return b.copy(this).projectOnVector(t),this.sub(b)}),reflect:(x=new Qe,function(t){return this.sub(x.copy(t).multiplyScalar(2*this.dot(t)))}),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ye.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){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},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign($e.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,h){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[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},applyToBufferAttribute:(E=new Qe,function(t){for(var e=0,n=t.count;ei)return!1}return!0}function Un(t){var e=t.geometry;if(void 0!==e)if(e.isGeometry){var n=e.vertices;for(yn=0,xn=n.length;ynthis.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){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Qe),e.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:(vn=new Qe,function(t){return this.clampPoint(t.center,vn),vn.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,n;return n=0=-t.constant},intersectsTriangle:(an=new Qe,sn=new Qe,hn=new Qe,ln=new Qe,cn=new Qe,un=new Qe,pn=new Qe,dn=new Qe,fn=new Qe,mn=new Qe,function(t){if(this.isEmpty())return!1;this.getCenter(dn),fn.subVectors(this.max,dn),an.subVectors(t.a,dn),sn.subVectors(t.b,dn),hn.subVectors(t.c,dn),ln.subVectors(sn,an),cn.subVectors(hn,sn),un.subVectors(an,hn);var e=[0,-ln.z,ln.y,0,-cn.z,cn.y,0,-un.z,un.y,ln.z,0,-ln.x,cn.z,0,-cn.x,un.z,0,-un.x,-ln.y,ln.x,0,-cn.y,cn.x,0,-un.y,un.x,0];return!!Fn(e)&&!!Fn(e=[1,0,0,0,1,0,0,0,1])&&(mn.crossVectors(ln,cn),Fn(e=[mn.x,mn.y,mn.z]))}),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Qe),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(on=new Qe,function(t){return on.copy(t).clamp(this.min,this.max).sub(t).length()}),getBoundingSphere:(rn=new Qe,function(t){return void 0===t&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),t=new jn),this.getCenter(t.center),t.radius=.5*this.getSize(rn).length(),t}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(nn=[new Qe,new Qe,new Qe,new Qe,new Qe,new Qe,new Qe,new Qe],function(t){return this.isEmpty()||(nn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),nn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),nn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),nn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),nn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),nn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),nn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),nn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(nn)),this}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(jn.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(_n=new Nn,function(t,e){var n=this.center;void 0!==e?n.copy(e):_n.setFromPoints(t).getCenter(n);for(var i=0,r=0,o=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Nn),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(Vn.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:(En=new Qe,An=new Qe,function(t,e,n){var i=En.subVectors(n,e).cross(An.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Qe),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:(Tn=new Qe,function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Qe);var n=t.delta(Tn),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||1 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif\n",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif\n",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}\n",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}\n",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}\n",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n"},Yn={merge:function(t){for(var e={},n=0;n>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){if(t=Ye.euclideanModulo(t,1),e=Ye.clamp(e,0,1),n=Ye.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=$n(r,i,t+1/3),this.g=$n(r,i,t),this.b=$n(r,i,t-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,h=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,h)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l,c=(l=n[1]).length;if(3===c)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===c)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}e&&0e&&(e=t[n]);return e}Bi.prototype=Object.assign(Object.create(n.prototype),{constructor:Bi,isGeometry:!0,applyMatrix:function(t){for(var e=(new $e).getNormalMatrix(t),n=0,i=this.vertices.length;nn.far?null:{distance:h,point:Jr.clone(),object:t}}function oo(t,e,n,i,r,o,a,s,h){Ur.fromBufferAttribute(r,a),jr.fromBufferAttribute(r,s),Vr.fromBufferAttribute(r,h);var l=ro(t,e,n,i,Ur,jr,Vr,Zr);if(l){o&&(qr.fromBufferAttribute(o,a),Xr.fromBufferAttribute(o,s),Yr.fromBufferAttribute(o,h),l.uv=eo.getUV(Zr,Ur,jr,Vr,qr,Xr,Yr,new Ze));var c=new ai(a,s,h);eo.getNormal(Ur,jr,Vr,c.normal),l.face=c}return l}function ao(o,n,a,i){var s,h,l=new Jn(0),c=0;function u(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return l},setClearColor:function(t,e){l.set(t),u(l,c=void 0!==e?e:1)},getClearAlpha:function(){return c},setClearAlpha:function(t){u(l,c=t)},render:function(t,e,n,i){var r=e.background;null===r?u(l,c):r&&r.isColor&&(u(r,1),i=!0),(o.autoClear||i)&&o.clear(o.autoClearColor,o.autoClearDepth,o.autoClearStencil),r&&(r.isCubeTexture||r.isWebGLRenderTargetCube)?(void 0===h&&((h=new io(new lr(1,1,1),new $r({type:"BackgroundCubeMaterial",uniforms:Yn.clone(ii.cube.uniforms),vertexShader:ii.cube.vertexShader,fragmentShader:ii.cube.fragmentShader,side:St,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),h.geometry.removeAttribute("uv"),h.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.tCube.value}}),a.update(h)),h.material.uniforms.tCube.value=r.isWebGLRenderTargetCube?r.texture:r,h.material.uniforms.tFlip.value=r.isWebGLRenderTargetCube?1:-1,t.push(h,h.geometry,h.material,0,null)):r&&r.isTexture&&(void 0===s&&((s=new io(new ur(2,2),new $r({type:"BackgroundMaterial",uniforms:Yn.clone(ii.background.uniforms),vertexShader:ii.background.vertexShader,fragmentShader:ii.background.fragmentShader,side:D,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(s)),!0===(s.material.uniforms.t2D.value=r).matrixAutoUpdate&&r.updateMatrix(),s.material.uniforms.uvTransform.value.copy(r.matrix),t.push(s,s.geometry,s.material,0,null))}}}function so(r,o,a,s){var h;this.setMode=function(t){h=t},this.render=function(t,e){r.drawArrays(h,t,e),a.update(e,h)},this.renderInstances=function(t,e,n){var i;if(s.isWebGL2)i=r;else if(null===(i=o.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");i[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](h,e,n,t.maxInstancedCount),a.update(n,h,t.maxInstancedCount)}}function ho(e,n,t){var i;function r(t){if("highp"===t){if(0/gm,function(t,e){var n=Xn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ya(n)})}function xa(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,i){for(var r="",o=parseInt(e);oe||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height),i}return t}function M(t){return Ye.isPowerOfTwo(t.width)&&Ye.isPowerOfTwo(t.height)}function S(t,e){return t.generateMipmaps&&e&&t.minFilter!==kt&&t.minFilter!==Bt}function T(t,e,n,i){v.generateMipmap(t),y.get(e).__maxMipLevel=Math.log(Math.max(n,i))*Math.LOG2E}function E(t,e){if(!x.isWebGL2)return t;if(6403===t){if(5126===e)return 33326;if(5131===e)return 33325;if(5121===e)return 33321}if(6407===t){if(5126===e)return 34837;if(5131===e)return 34843;if(5121===e)return 32849}if(6408===t){if(5126===e)return 34836;if(5131===e)return 34842;if(5121===e)return 32856}return t}function a(t){return t===kt||t===zt||t===Dt?9728:9729}function A(t){var e=t.target;e.removeEventListener("dispose",A),function(t){var e=y.get(t);if(t.image&&e.__image__webglTextureCube)v.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)return;v.deleteTexture(e.__webglTexture)}y.remove(t)}(e),e.isVideoTexture&&delete o[e.id],w.memory.textures--}function s(t){var e=t.target;e.removeEventListener("dispose",s),function(t){var e=y.get(t),n=y.get(t.texture);if(!t)return;void 0!==n.__webglTexture&&v.deleteTexture(n.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var i=0;i<6;i++)v.deleteFramebuffer(e.__webglFramebuffer[i]),e.__webglDepthbuffer&&v.deleteRenderbuffer(e.__webglDepthbuffer[i]);else v.deleteFramebuffer(e.__webglFramebuffer),e.__webglDepthbuffer&&v.deleteRenderbuffer(e.__webglDepthbuffer);y.remove(t.texture),y.remove(t)}(e),w.memory.textures--}function h(t,e){var n=y.get(t);if(t.isVideoTexture&&function(t){var e=t.id,n=w.render.frame;o[e]!==n&&(o[e]=n,t.update())}(t),0=T.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+T.maxTextures),V+=1,t},this.setTexture2D=(ut=!1,function(t,e){t&&t.isWebGLRenderTarget&&(ut||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ut=!0),t=t.texture),u.setTexture2D(t,e)}),this.setTexture3D=function(t,e){u.setTexture3D(t,e)},this.setTexture=(pt=!1,function(t,e){pt||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),pt=!0),u.setTexture2D(t,e)}),this.setTextureCube=(dt=!1,function(t,e){t&&t.isWebGLRenderTargetCube&&(dt||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),dt=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?u.setTextureCube(t,e):u.setTextureCubeDynamic(t,e)}),this.setFramebuffer=function(t){b=t},this.getRenderTarget=function(){return k},this.setRenderTarget=function(t){(k=t)&&void 0===_.get(t).__webglFramebuffer&&u.setupRenderTarget(t);var e=b,n=!1;if(t){var i=_.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(e=i[t.activeCubeFace],n=!0):e=i,F.copy(t.viewport),U.copy(t.scissor),j=t.scissorTest}else F.copy(q).multiplyScalar(W),U.copy(X).multiplyScalar(W),j=Y;if(z!==e&&(M.bindFramebuffer(36160,e),z=e),E.viewport(F),E.scissor(U),E.setScissorTest(j),n){var r=_.get(t.texture);M.framebufferTexture2D(36160,36064,34069+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(t&&t.isWebGLRenderTarget){var a=_.get(t).__webglFramebuffer;if(a){var s=!1;a!==z&&(M.bindFramebuffer(36160,a),s=!0);try{var h=t.texture,l=h.format,c=h.type;if(l!==te&&m.convert(l)!==M.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===Ut||m.convert(c)===M.getParameter(35738)||c===qt&&(T.isWebGL2||S.get("OES_texture_float")||S.get("WEBGL_color_buffer_float"))||c===Xt&&(T.isWebGL2?S.get("EXT_color_buffer_float"):S.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===M.checkFramebufferStatus(36160)?0<=e&&e<=t.width-i&&0<=n&&n<=t.height-r&&M.readPixels(e,n,i,r,m.convert(l),m.convert(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&M.bindFramebuffer(36160,z)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){var i=e.image.width,r=e.image.height,o=m.convert(e.format);this.setTexture2D(e,0),M.copyTexImage2D(3553,n||0,o,t.x,t.y,i,r,0)},this.copyTextureToTexture=function(t,e,n,i){var r=e.image.width,o=e.image.height,a=m.convert(n.format),s=m.convert(n.type);this.setTexture2D(n,0),e.isDataTexture?M.texSubImage2D(3553,i||0,t.x,t.y,r,o,a,s,e.image.data):M.texSubImage2D(3553,i||0,t.x,t.y,a,s,e.image)}}function _s(t,e){this.name="",this.color=new Jn(t),this.density=void 0!==e?e:25e-5}function Ms(t,e,n){this.name="",this.color=new Jn(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Ss(){Ci.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Ts(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Es(t,e,n,i){this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function As(t){Qr.call(this),this.type="SpriteMaterial",this.color=new Jn(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(t)}function Cs(t){if(Ci.call(this),this.type="Sprite",void 0===Va){Va=new sr;var e=new Ts(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Va.setIndex([0,1,2,0,2,3]),Va.addAttribute("position",new Es(e,3,0,!1)),Va.addAttribute("uv",new Es(e,2,3,!1))}this.geometry=Va,this.material=void 0!==t?t:new As,this.center=new Ze(.5,.5)}function Ls(t,e,n,i,r,o){qa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Xa.x=o*qa.x-r*qa.y,Xa.y=r*qa.x+o*qa.y):Xa.copy(qa),t.copy(e),t.x+=Xa.x,t.y+=Xa.y,t.applyMatrix4(Ya)}function Ps(){Ci.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Rs(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;nt.far||e.push({distance:s,point:Ga.clone(),uv:eo.getUV(Ga,Za,Ja,Ka,Qa,$a,ts,new Ze),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return Ci.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),Ps.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Ps,copy:function(t){Ci.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(;it.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,v=d.length/3-1;mt.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(i.isGeometry){var x=i.vertices,b=x.length;for(m=0;mt.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}}}}),copy:function(t){return Ci.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),Ds.prototype=Object.assign(Object.create(Is.prototype),{constructor:Ds,isLineSegments:!0,computeLineDistances:(us=new Qe,ps=new Qe,function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],i=0,r=e.count;ir.far)return;o.push({distance:i,distanceToRay:Math.sqrt(n),point:l.clone(),index:e,face:null,object:a})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Us.prototype=Object.assign(Object.create(kn.prototype),{constructor:Us,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((js.prototype=Object.create(kn.prototype)).constructor=js).prototype.isCompressedTexture=!0,((Vs.prototype=Object.create(kn.prototype)).constructor=Vs).prototype.isCanvasTexture=!0,((Gs.prototype=Object.create(kn.prototype)).constructor=Gs).prototype.isDepthTexture=!0,(Hs.prototype=Object.create(sr.prototype)).constructor=Hs,(Ws.prototype=Object.create(Bi.prototype)).constructor=Ws,(qs.prototype=Object.create(sr.prototype)).constructor=qs,(Xs.prototype=Object.create(Bi.prototype)).constructor=Xs,(Ys.prototype=Object.create(sr.prototype)).constructor=Ys,(Zs.prototype=Object.create(Bi.prototype)).constructor=Zs,(Js.prototype=Object.create(Ys.prototype)).constructor=Js,(Ks.prototype=Object.create(Bi.prototype)).constructor=Ks,(Qs.prototype=Object.create(Ys.prototype)).constructor=Qs,($s.prototype=Object.create(Bi.prototype)).constructor=$s,(th.prototype=Object.create(Ys.prototype)).constructor=th,(eh.prototype=Object.create(Bi.prototype)).constructor=eh,(nh.prototype=Object.create(Ys.prototype)).constructor=nh,(ih.prototype=Object.create(Bi.prototype)).constructor=ih,(rh.prototype=Object.create(sr.prototype)).constructor=rh,(oh.prototype=Object.create(Bi.prototype)).constructor=oh,(ah.prototype=Object.create(sr.prototype)).constructor=ah,(sh.prototype=Object.create(Bi.prototype)).constructor=sh,(hh.prototype=Object.create(sr.prototype)).constructor=hh;var lh=function(t,e,n){n=n||2;var i,r,o,a,s,h,l,c=e&&e.length,u=c?e[0]*n:t.length,p=ch(t,0,u,n,!0),d=[];if(!p)return d;if(c&&(p=function(t,e,n,i){var r,o,a,s,h,l=[];for(r=0,o=e.length;r80*n){i=o=t[0],r=a=t[1];for(var f=n;fo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,c=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=xh(s,h,e,n,i),p=xh(l,c,e,n,i),d=t.nextZ;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&wh(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=_h(d.prev,d,d.next))return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&wh(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=_h(d.prev,d,d.next))return!1;d=d.prevZ}return!0}function mh(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!Mh(r,o)&&Sh(r,i,i.next,o)&&Th(r,o)&&Th(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),Ch(i),Ch(i.next),i=t=o),i=i.next}while(i!==t);return i}function vh(t,e,n,i,r,o){var a,s,h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&(s=l,(a=h).next.i!==s.i&&a.prev.i!==s.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Sh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(a,s)&&Th(a,s)&&Th(s,a)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==t;);return i}(a,s))){var c=Eh(h,l);return h=uh(h,h.next),c=uh(c,c.next),ph(h,e,n,i,r,o),void ph(c,e,n,i,r,o)}l=l.next}h=h.next}while(h!==t)}function gh(t,e){return t.x-e.x}function yh(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&a=i.x&&i.x>=c&&r!==i.x&&wh(on.x)&&Th(i,t)&&(n=i,p=h),i=i.next;return n}(t,e)){var n=Eh(e,t);uh(n,n.next)}}function xh(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bh(t){for(var e=t,n=t;e.xNumber.EPSILON){var p=Math.sqrt(c),d=Math.sqrt(h*h+l*l),f=e.x-s/p,m=e.y+a/p,v=((n.x-l/d-f)*l-(n.y+h/d-m)*h)/(a*l-s*h),g=(i=f+a*v-t.x)*i+(r=m+s*v-t.y)*r;if(g<=2)return new Ze(i,r);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?h>Number.EPSILON&&(y=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),o=y?(i=-s,r=a,Math.sqrt(c)):(i=a,r=s,Math.sqrt(c/2))}return new Ze(i/o,r/o)}for(var I=[],D=0,B=S.length,N=B-1,F=D+1;D>>1;te;)--o;if(++o,0!==r||o!==i){o<=r&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=dl.arraySlice(n,r,o),this.values=dl.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&sNumber.EPSILON&&(l.normalize(),r=Math.acos(Ye.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(c.makeRotationAxis(l,r))),h[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Ye.clamp(s[0].dot(s[t]),-1,1)),r/=t,0i.length-2?i.length-1:o+1],c=i[o>i.length-3?i.length-1:o+2];return n.set(Wl(a,s.x,h.x,l.x,c.x),Wl(a,s.y,h.y,l.y,c.y)),n},tc.prototype.copy=function(t){Dl.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;nNumber.EPSILON){if(l<0&&(a=e[o],h=-h,s=e[r],l=-l),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var c=l*(t.x-a.x)-h*(t.y-a.y);if(0==c)return!0;if(c<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i}var r=Ph.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,h,l=[];if(1===o.length)return s=o[0],(h=new rc).curves=s.curves,l.push(h),l;var c=!r(o[0].getPoints());c=t?!c:c;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;gn.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t,n=this._clip.duration,i=this.loop,r=this._loopCount,o=2202===i;if(0===t)return-1===r?e:o&&1==(1&r)?n-e:e;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n<=e)e=n;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{if(-1===r&&(0<=t?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),n<=e||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0this.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){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Ze),e.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){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Ze),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(yu=new Ze,function(t){return yu.copy(t).clamp(this.min,this.max).sub(t).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)}}),Object.assign(hp.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Qe),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Qe),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Qe),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(bu=new Qe,wu=new Qe,function(t,e){bu.subVectors(t,this.start),wu.subVectors(this.end,this.start);var n=wu.dot(wu),i=wu.dot(bu)/n;return e&&(i=Ye.clamp(i,0,1)),i}),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Qe),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),((lp.prototype=Object.create(Ci.prototype)).constructor=lp).prototype.isImmediateRenderObject=!0,((cp.prototype=Object.create(Ds.prototype)).constructor=cp).prototype.update=(_u=new Qe,Mu=new Qe,Su=new $e,function(){var t=["a","b","c"];this.object.updateMatrixWorld(!0),Su.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,n=this.geometry.attributes.position,i=this.object.geometry;if(i&&i.isGeometry)for(var r=i.vertices,o=i.faces,a=0,s=0,h=o.length;sBp.length&&n--,i=Bp.length;return!0},jp={},Vp={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return--t*t*(2.70158*t+1.70158)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((1+e)*t-e)*.5:.5*((t-=2)*t*((1+e)*t+e)+2)}},Bounce:{In:function(t){return 1-Vp.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*Vp.Bounce.In(2*t):.5*Vp.Bounce.Out(2*t-1)+.5}},Stepped:{steps:function(e){return function(t){return(t*e|0)/e}}}},Gp="_chainedTweens",Hp="Callback",Wp="STRING_PROP",qp=/\s+|([A-Za-z?().,{}:""[\]#%]+)|([-+]=+)?([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]=?\d+)?/g;function Xp(t){if(t&&t.nodeType||void 0===t||"object"!==Cp(t))return t;if(Array.isArray(t))return[].concat(t);if("object"!==Cp(t))return t;var e={};for(var n in t)e[n]=Xp(t[n]);return e}var Yp=function(t){return isNaN(+t)||("+"===t[0]||"-"===t[0])&&"="===t[1]||""===t||" "===t},Zp=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,Jp=function(t,e){var n,i,r;3===e.length&&(e=(n=e[0])+n+(i=e[1])+i+(r=e[2])+r);var o=parseInt(e,16);return"rgb("+(n=o>>16&255)+","+(i=o>>8&255)+","+(r=255&o)+")"};function Kp(t){return"string"!=typeof t?t:t.replace(Zp,Jp).match(qp).map(function(t){return Yp(t)?t:+t})}function Qp(n,i,t,e){var r=t[n],o=e[n];if("string"==typeof r||"string"==typeof o){for(var a=Array.isArray(r)&&r[0]===Wp?r:Kp(r),s=Array.isArray(o)&&o[0]===Wp?o:Kp(o),h=1;hr;)h(i,n=e[r++])&&(~W(o,n)||o.push(n));return o}function z(t){return Object(A(t))}var I=v,D={}.toString,B=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==E(t)?t.split(""):Object(t)},N=Math.ceil,F=Math.floor,U=Math.min,j=Math.max,V=Math.min,G=t(function(t){var e="__core-js_shared__",n=b[e]||(b[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:w.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),H=G("keys"),W=R(!1),q=O("IE_PROTO"),X="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Y=Object.keys||function(t){return k(t,X)},Z={f:Object.getOwnPropertySymbols},J={f:{}.propertyIsEnumerable},K=Object.assign,Q=!K||y(function(){var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(t){e[t]=t}),7!=K({},t)[n]||Object.keys(K({},e)).join("")!=i})?function(t,e){for(var n=z(t),i=arguments.length,r=1,o=Z.f,a=J.f;rdocument.F=Object<\/script>"),t.close(),gt=t.F;n--;)delete gt[vt][X[n]];return gt()},yt=Object.create||function(t,e){var n;return null!==t?(lt[vt]=f(t),n=new lt,lt[vt]=null,n[mt]=t):n=gt(),void 0===e?n:pt(n,e)},xt=u.f,bt=rt("toStringTag"),wt={};_(wt,rt("iterator"),function(){return this});function _t(){return this}function Mt(t,e,n,i,r,o,a){function s(t){if(!Ct&&t in f)return f[t];switch(t){case"keys":case Lt:return function(){return new n(this,t)}}return function(){return new n(this,t)}}!function(t,e,n){t.prototype=yt(wt,{next:x(1,n)}),ct(t,e+" Iterator")}(n,e,i);var h,l,c,u=e+" Iterator",p=r==Lt,d=!1,f=t.prototype,m=f[At]||f["@@iterator"]||r&&f[r],v=m||s(r),g=r?p?s("entries"):v:void 0,y="Array"==e&&f.entries||m;if(y&&(c=Et(y.call(new t)))!==Object.prototype&&c.next&&(ct(c,u,!0),"function"!=typeof c[At]&&_(c,At,_t)),p&&m&&m.name!==Lt&&(d=!0,v=function(){return m.call(this)}),!Ct&&!d&&f[At]||_(f,At,v),ut[e]=v,ut[u]=_t,r)if(h={values:p?v:s(Lt),keys:o?v:s("keys"),entries:g},a)for(l in h)l in f||S(f,l,h[l]);else I(I.P+I.F*(Ct||d),e,h);return h}var St=O("IE_PROTO"),Tt=Object.prototype,Et=Object.getPrototypeOf||function(t){return t=z(t),h(t,St)?t[St]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Tt:null},At=rt("iterator"),Ct=!([].keys&&"next"in[].keys()),Lt="values",Pt=Mt(Array,"Array",function(t,e){this._t=C(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,ht(1)):ht(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");ut.Arguments=ut.Array,st("keys"),st("values"),st("entries");var Rt,Ot=(Rt=!0,function(t,e){var n,i,r=String(A(t)),o=L(e),a=r.length;return o<0||a<=o?Rt?"":void 0:(n=r.charCodeAt(o))<55296||56319=e.length?{value:void 0,done:!0}:(t=Ot(e,n),this._i+=t.length,{value:t,done:!1})});function kt(t,e,n){for(var i in e)S(t,i,e[i],n);return t}function zt(t,e,n,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(n+": incorrect invocation!");return t}function It(e,t,n,i){try{return i?t(f(n)[0],n[1]):t(n)}catch(t){var r=e.return;throw void 0!==r&&f(r.call(e)),t}}function Dt(t,e){if(!g(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}function Bt(t,e){var n,i=Yt(e);if("F"!==i)return t._i[i];for(n=t._f;n;n=n.n)if(n.k==e)return n}var Nt=rt("iterator"),Ft=Array.prototype,Ut=rt("toStringTag"),jt="Arguments"==E(function(){return arguments}()),Vt=rt("iterator"),Gt=w.getIteratorMethod=function(t){if(null!=t)return t[Vt]||t["@@iterator"]||ut[function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Ut))?n:jt?E(e):"Object"==(i=E(e))&&"function"==typeof e.callee?"Arguments":i}(t)]},Ht=t(function(t){var p={},d={},e=t.exports=function(t,e,n,i,r){var o,a,s,h,l=r?function(){return t}:Gt(t),c=m(n,i,e?2:1),u=0;if("function"!=typeof l)throw TypeError(t+" is not iterable!");if(function(t){return void 0!==t&&(ut.Array===t||Ft[Nt]===t)}(l)){for(o=P(t.length);ua;)o.call(t,i=r[a++])&&e.push(i);return e}(e=C(e)),r=0,o=i.length;rr;)h(ke,e=n[r++])||e==Le||e==we||i.push(e);return i}function de(t){for(var e,n=t===Ie,i=Se(n?ze:C(t)),r=[],o=0;i.length>o;)!h(ke,e=i[o++])||n&&!h(Ie,e)||r.push(ke[e]);return r}var fe=Array.isArray||function(t){return"Array"==E(t)},me=X.concat("length","prototype"),ve={f:Object.getOwnPropertyNames||function(t){return k(t,me)}},ge=ve.f,ye={}.toString,xe="object"==("undefined"==typeof window?"undefined":ea(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],be={f:function(t){return xe&&"[object Window]"==ye.call(t)?function(t){try{return ge(t)}catch(t){return xe.slice()}}(t):ge(C(t))}},we=qt.KEY,_e=ne.f,Me=u.f,Se=be.f,Te=b.Symbol,Ee=b.JSON,Ae=Ee&&Ee.stringify,Ce="prototype",Le=rt("_hidden"),Pe=rt("toPrimitive"),Re={}.propertyIsEnumerable,Oe=G("symbol-registry"),ke=G("symbols"),ze=G("op-symbols"),Ie=Object[Ce],De="function"==typeof Te,Be=b.QObject,Ne=!Be||!Be[Ce]||!Be[Ce].findChild,Fe=a&&y(function(){return 7!=yt(Me({},"a",{get:function(){return Me(this,"a",{value:7}).a}})).a})?function(t,e,n){var i=_e(Ie,e);i&&delete Ie[e],Me(t,e,n),i&&t!==Ie&&Me(Ie,e,i)}:Me,Ue=De&&"symbol"==ea(Te.iterator)?function(t){return"symbol"==(void 0===t?"undefined":ea(t))}:function(t){return t instanceof Te},je=function(t,e,n){return t===Ie&&je(ze,e,n),f(t),e=c(e,!0),f(n),h(ke,e)?(n.enumerable?(h(t,Le)&&t[Le][e]&&(t[Le][e]=!1),n=yt(n,{enumerable:x(0,!1)})):(h(t,Le)||Me(t,Le,x(1,{})),t[Le][e]=!0),Fe(t,e,n)):Me(t,e,n)};De||(S((Te=function(t){if(this instanceof Te)throw TypeError("Symbol is not a constructor!");var n=l(0Ge;)rt(Ve[Ge++]);for(var He=Y(rt.store),We=0;He.length>We;)oe(He[We++]);I(I.S+I.F*!De,"Symbol",{for:function(t){return h(Oe,t+="")?Oe[t]:Oe[t]=Te(t)},keyFor:function(t){if(!Ue(t))throw TypeError(t+" is not a symbol!");for(var e in Oe)if(Oe[e]===t)return e},useSetter:function(){Ne=!0},useSimple:function(){Ne=!1}}),I(I.S+I.F*!De,"Object",{create:function(t,e){return void 0===e?yt(t):le(yt(t),e)},defineProperty:je,defineProperties:le,getOwnPropertyDescriptor:ue,getOwnPropertyNames:pe,getOwnPropertySymbols:de}),Ee&&I(I.S+I.F*(!De||y(function(){var t=Te();return"[null]"!=Ae([t])||"{}"!=Ae({a:t})||"{}"!=Ae(Object(t))})),"JSON",{stringify:function(t){for(var e,n,i=[t],r=1;r>>0,p=new RegExp(t.source,l+"g");for(g||(i=new RegExp("^"+p.source+"$(?!\\s)",l));(r=p.exec(n))&&!(c<(o=r.index+r[0][v])&&(h.push(n.slice(c,r.index)),!g&&1=u));)p.lastIndex===r.index&&p.lastIndex++;return c===n[v]?!a&&p.test("")||h.push(""):h.push(n.slice(c)),h[v]>u?h.slice(0,u):h}}else"0"[t](void 0,0)[v]&&(a=function(t,e){return void 0===t&&0===e?[]:f.call(this,t,e)});return[function(t,e){var n=r(this),i=null==t?void 0:t[o];return void 0!==i?i.call(t,n,e):a.call(String(n),t,e)},a]});var Hn=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,Wn=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,qn=/rgb\((\d+),(\d+),(\d+)\)/,Xn=/(#[a-z0-9\-_]+)/i,Yn=/\)\s*,?\s*/,Zn=/\s/g,Jn=/^#[a-f0-9]{3,6}$/i,Kn=/^rgb\(/,Qn=/^(\s+)?$/,$n=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ti=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,ei=/[\s,]+/,ni=/([^e])-/gi,ii=/[MLHVCSQTAZ]/gi,ri=/[MLHVCSQTAZ]/i,oi=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,ai=/\./g,si={numberAndUnit:Hn,hex:Wn,rgb:qn,reference:Xn,transforms:Yn,whitespace:Zn,isHex:Jn,isRgb:Kn,isCss:/[^:]+:[^;]+;?/,isBlank:Qn,isNumber:$n,isPercent:/^-?[\d.]+%$/,isImage:ti,delimiter:ei,hyphen:ni,pathLetters:ii,isPathLetter:ri,numbersWithDots:oi,dots:ai};an("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(ei)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),an("Dom",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var h=vn(a.value);n[h]=this.node.style[h]}}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}if("string"==typeof t)return this.node.style[vn(t)];if("object"===it(t))for(var l in t)this.node.style[vn(l)]=null==t[l]||Qn.test(t[l])?"":t[l]}return 2===arguments.length&&(this.node.style[vn(t)]=null==e||Qn.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),an("Dom",{data:function(e,t,n){if("object"===it(e))for(t in e)this.data(t,e[t]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+e))}catch(t){return this.attr("data-"+e)}else this.attr("data-"+e,null===t?null:!0===n||"string"==typeof t||"number"==typeof t?t:JSON.stringify(t));return this}}),an("Dom",{remember:function(t,e){if("object"===it(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var hi=0,li={};function ci(t){var e=t.getEventHolder();return e===An.window&&(e=li),e.events||(e.events={}),e.events}function ui(t){return t.getEventTarget()}function pi(t,e,i,n,r){var o=i.bind(n||t),a=kn(t),s=ci(a),h=ui(a);e=Array.isArray(e)?e:e.split(ei),i._svgjsListenerId||(i._svgjsListenerId=++hi),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";s[e]=s[e]||{},s[e][n]=s[e][n]||{},s[e][n][i._svgjsListenerId]=o,h.addEventListener(e,o,r||!1)})}function di(t,e,o,a){var s=kn(t),h=ci(s),l=ui(s);"function"==typeof o&&!(o=o._svgjsListenerId)||(e=Array.isArray(e)?e:(e||"").split(ei)).forEach(function(t){var e,n,i=t&&t.split(".")[0],r=t&&t.split(".")[1];if(o)h[i]&&h[i][r||"*"]&&(l.removeEventListener(i,h[i][r||"*"][o],a||!1),delete h[i][r||"*"][o]);else if(i&&r){if(h[i]&&h[i][r]){for(n in h[i][r])di(l,[i,r].join("."),n);delete h[i][r]}}else if(r)for(t in h)for(e in h[t])r===e&&di(l,[t,r].join("."));else if(i){if(h[i]){for(e in h[i])di(l,[i,e].join("."));delete h[i]}}else{for(t in h)di(l,t);!function(t){var e=t.getEventHolder();e.events&&(e.events={})}(s)}})}function fi(t,e,n){var i=ui(t);return e instanceof An.window.Event||(e=new An.window.CustomEvent(e,{detail:n,cancelable:!0})),i.dispatchEvent(e),e}function mi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function vi(t,e){for(var n=0;nnr;nr++)h(Ji,tr=er[nr])&&!h(Zi,tr)&&qi(Zi,tr,Wi(Ji,tr));(Zi.prototype=Ki).constructor=Zi,S(b,Yi,Zi)}var ir=function(){function t(){Cn(this,t),this.init.apply(this,arguments)}return gi(t,[{key:"init",value:function(t,e){var n,i=0,r=0;return n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===it(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==n.x?i:n.x,this.y=null==n.y?r:n.y,this}},{key:"clone",value:function(){return new t(this)}},{key:"transform",value:function(t){return this.clone().transformO(t)}},{key:"transformO",value:function(t){or.isMatrixLike(t)||(t=new or(t));var e=this.x,n=this.y;return this.x=t.a*e+t.c*n+t.e,this.y=t.b*e+t.d*n+t.f,this}},{key:"toArray",value:function(){return[this.x,this.y]}}]),t}();function rr(t,e,n){return Math.abs(e-t)<(n||1e-6)}var or=function(){function l(){Cn(this,l),this.init.apply(this,arguments)}return gi(l,[{key:"init",value:function(t){var e=l.fromArray([1,0,0,1,0,0]);return t=t instanceof Mr?t.matrixify():"string"==typeof t?l.fromArray(t.split(ei).map(parseFloat)):Array.isArray(t)?l.fromArray(t):"object"===it(t)&&l.isMatrixLike(t)?t:"object"===it(t)?(new l).transform(t):6===arguments.length?l.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}},{key:"clone",value:function(){return new l(this)}},{key:"transform",value:function(t){if(l.isMatrixLike(t))return new l(t).multiplyO(this);var e=l.formatTransforms(t),n=new ir(e.ox,e.oy).transform(this),i=n.x,r=n.y,o=(new l).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-r).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,r);if(isFinite(e.px)||isFinite(e.py)){var a=new ir(i,r).transform(o),s=e.px?e.px-a.x:0,h=e.py?e.py-a.y:0;o.translateO(s,h)}return o.translateO(e.tx,e.ty),o}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,i=t.scaleX||1,r=t.scaleY||1,o=t.shear||0,a=t.rotate||0,s=t.translateX||0,h=t.translateY||0;return(new l).translateO(-e,-n).scaleO(i,r).shearO(o).rotateO(a).translateO(s,h).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(t,e){var n=0",delay:0},gr={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"},yr={noop:mr,timeline:vr,attrs:gr},xr=cr("SVGArray",Array,function(t){this.init(t)});Vn(xr,{init:function(t){return"number"==typeof t||(this.length=0,this.push.apply(this,re(this.parse(t)))),this},toArray:function(){return Array.prototype.concat.apply([],this)},toString:function(){return this.join(" ")},valueOf:function(){var t=[];return t.push.apply(t,re(this)),t},parse:function(t){var e=0n.x&&e>n.y&&t":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(e,n,i,r){return function(t){return t<0?0=e.time?e.run():Oo.timeouts.push(e),e!==n););for(var i=null,r=Oo.frames.last();i!==r&&(i=Oo.frames.shift());)i.run(t);for(var o=null;o=Oo.immediates.shift();)o();Oo.nextDraw=Oo.timeouts.first()||Oo.frames.first()?An.window.requestAnimationFrame(Oo._draw):null}},ko=function(){function n(){var t,e=0=i;this._lastTime=this._time,r&&this.fire("start",this);var a=this._isDeclarative;if(this.done=!a&&!o&&this._time>=i,this._reseted=!1,n||a){this._initialise(n),this.transforms=new or;var s=this._run(a?t:e);this.fire("step",this)}return this.done=this.done||s&&a,o&&this.fire("finished",this),this}},{key:"reset",value:function(){return this._reseted||(this.time(0),this._reseted=!0),this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new oo(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){if(this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]},this._isDeclarative){var n=this.timeline();n&&n.play()}}},{key:"_tryRetarget",value:function(t,e,n){if(this._history[t]){if(!this._history[t].caller.initialised){var i=this._queue.indexOf(this._history[t].caller);return this._queue.splice(i,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget(e,n):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var r=this.timeline();return r&&r.play(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e>>0;return i});function md(t,e){switch(this.buffer,this.blocks=[],this.bufferSize=32768,this.totalpos=0,this.ip=0,this.bitsbuf=0,this.bitsbuflen=0,this.input=wd?new Uint8Array(t):t,this.output,this.op,this.bfinal=!1,this.bufferType=md.BufferType.ADAPTIVE,this.resize=!1,(e||(e={},0))&&(e.index&&(this.ip=e.index),e.bufferSize&&(this.bufferSize=e.bufferSize),e.bufferType&&(this.bufferType=e.bufferType),e.resize&&(this.resize=e.resize)),this.bufferType){case md.BufferType.BLOCK:this.op=md.MaxBackwardLength,this.output=new(wd?Uint8Array:Array)(md.MaxBackwardLength+this.bufferSize+md.MaxCopyLength);break;case md.BufferType.ADAPTIVE:this.op=0,this.output=new(wd?Uint8Array:Array)(this.bufferSize),this.expandBuffer=this.expandBufferAdaptive,this.concatBuffer=this.concatBufferDynamic,this.decodeHuffman=this.decodeHuffmanAdaptive;break;default:throw new Error("invalid inflate mode")}}var vd,gd,yd,xd,bd,wd="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView,_d=function(t){var e,n,i,r,o,a,s,h,l,c,u,p=t.length,d=0,f=Number.POSITIVE_INFINITY;for(h=0,l=p;hd&&(d=t[h]),t[h]>=1;for(u=i<<16|h,c=a;c>>=1){case 0:this.parseUncompressedBlock();break;case 1:this.parseFixedHuffmanBlock();break;case 2:this.parseDynamicHuffmanBlock();break;default:throw new Error("unknown BTYPE: "+t)}},md.prototype.readBits=function(t){for(var e,n=this.bitsbuf,i=this.bitsbuflen,r=this.input,o=this.ip,a=r.length;i>>=t,i-=t,this.bitsbuf=n,this.bitsbuflen=i,this.ip=o,e},md.prototype.readCodeByTable=function(t){for(var e,n,i=this.bitsbuf,r=this.bitsbuflen,o=this.input,a=this.ip,s=o.length,h=t[0],l=t[1];r>>16))throw new Error("invalid code length: "+n);return this.bitsbuf=i>>n,this.bitsbuflen=r-n,this.ip=a,65535&e},md.prototype.parseUncompressedBlock=function(){var t,e,n=this.input,i=this.ip,r=this.output,o=this.op,a=n.length,s=r.length;if(this.bitsbuf=0,this.bitsbuflen=0,a<=i+1)throw new Error("invalid uncompressed block header: LEN");if(t=n[i++]|n[i++]<<8,a<=i+1)throw new Error("invalid uncompressed block header: NLEN");if(t===~(n[i++]|n[i++]<<8))throw new Error("invalid uncompressed block header: length verify");if(i+t>n.length)throw new Error("input buffer is broken");switch(this.bufferType){case md.BufferType.BLOCK:for(;o+t>r.length;){if(t-=e=s-o,wd)r.set(n.subarray(i,i+e),o),o+=e,i+=e;else for(;e--;)r[o++]=n[i++];this.op=o,r=this.expandBuffer(),o=this.op}break;case md.BufferType.ADAPTIVE:for(;o+t>r.length;)r=this.expandBuffer({fixRatio:2});break;default:throw new Error("invalid inflate mode")}if(wd)r.set(n.subarray(i,i+t),o),o+=t,i+=t;else for(;t--;)r[o++]=n[i++];this.ip=i,this.op=o,this.output=r},md.prototype.parseFixedHuffmanBlock=function(){this.decodeHuffman(md.FixedLiteralLengthTable,md.FixedDistanceTable)},md.prototype.parseDynamicHuffmanBlock=function(){var t,e,n,i,r,o,a,s,h,l=this.readBits(5)+257,c=this.readBits(5)+1,u=this.readBits(4)+4,p=new(wd?Uint8Array:Array)(md.Order.length);for(s=0;se&&(this.output.length=e),t=this.output),this.buffer=t,this.buffer};function Md(t,e){var n,i;switch(this.input=t,this.ip=0,this.rawinflate,this.verify,(e||(e={},0))&&(e.index&&(this.ip=e.index),e.verify&&(this.verify=e.verify)),n=t[this.ip++],i=t[this.ip++],15&n){case Sd:this.method=Sd;break;default:throw new Error("unsupported compression method")}if(((n<<8)+i)%31!=0)throw new Error("invalid fcheck flag:"+((n<<8)+i)%31);if(32&i)throw new Error("fdict flag is not supported");this.rawinflate=new md(t,{index:this.ip,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}var Sd=8;function Td(t){this.manager=void 0!==t?t:Pl}function Ed(){var r={};return{get:function(t){return r[t]},add:function(t,e){r[t]=e},remove:function(t){delete r[t]},removeAll:function(){r={}},update:function(t,e){for(var n in r){var i=r[n];i.update&&i.update(t,e)}}}}Md.BufferType=md.BufferType,Md.prototype.decompress=function(){var t,e=this.input;if(t=this.rawinflate.decompress(),this.ip=this.rawinflate.ip,this.verify&&(e[this.ip++]<<24|e[this.ip++]<<16|e[this.ip++]<<8|e[this.ip++])>>>0!==function(t){return"string"==typeof t&&(t=fd(t)),function(t,e){for(var n,i=65535&t,r=t>>>16&65535,o=e.length,a=0;0>>0}(1,t)}(t))throw new Error("invalid adler-32 checksum");return t},Td.prototype={constructor:Td,crossOrigin:"Anonymous",load:function(t,e,n,i){var r=this,o=this.path&&"string"==typeof this.path?this.path:gc(t),a=new Ol(r.manager);a.setResponseType("arraybuffer"),a.load(t,function(t){try{r.parse(t,o,e,i)}catch(t){i(t.constructor===Error?t:new Error("OASLoader: Unable to parse model."))}},n,i)},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t},parse:function(t,e,o,n){var i,r={};if("oasis"===ef(new Uint8Array(t,0,5))){var a=new Md(new Uint8Array(t,5,t.byteLength-5)).decompress(),s=a.byteLength;t=a.buffer.slice(0,s)}var h=ef(new Uint8Array(t,0,4));i=h===Pd||h===Rd||h===Od?(r[Ad.KHR_BINARY_GLTF]=new Id(t),r[Ad.KHR_BINARY_GLTF].content):ef(new Uint8Array(t));var l=JSON.parse(i);void 0===l.asset||l.asset.version[0]<2?n(new Error("OAS: Unsupported asset. glTF versions >=2.0 are supported.")):(l.extensionsUsed&&(0<=l.extensionsUsed.indexOf(Ad.KHR_LIGHTS)&&(r[Ad.KHR_LIGHTS]=new Cd(l)),0<=l.extensionsUsed.indexOf(Ad.KHR_MATERIALS_COMMON)&&(r[Ad.KHR_MATERIALS_COMMON]=new Ld(l)),0<=l.extensionsUsed.indexOf(Ad.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS)&&(r[Ad.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]=new Dd)),console.time("OASLoader"),new rf(l,r,{path:e||this.path,crossOrigin:this.crossOrigin}).parse(function(t,e,n,i){console.timeEnd("OASLoader");var r={scene:t,scenes:e,cameras:n,animations:i};o(r),r.scene=null,r.scenes=null,r.cameras=null,r.animations=null,r=null},n))}};var Ad={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_LIGHTS:"KHR_lights",KHR_MATERIALS_COMMON:"KHR_materials_common",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness"};function Cd(t){this.name=Ad.KHR_LIGHTS,this.lights={};var e=(t.extensions&&t.extensions[Ad.KHR_LIGHTS]||{}).lights||{};for(var n in e){var i,r=e[n],o=(new Jn).fromArray(r.color);switch(r.type){case"directional":(i=new dc(o)).position.set(0,0,1);break;case"point":i=new cc(o);break;case"spot":(i=new lc(o)).position.set(0,0,1);break;case"ambient":i=new fc(o)}i&&(void 0!==r.constantAttenuation&&(i.intensity=r.constantAttenuation),void 0!==r.linearAttenuation&&(i.distance=1/r.linearAttenuation),void 0!==r.quadraticAttenuation&&(i.decay=r.quadraticAttenuation),void 0!==r.fallOffAngle&&(i.angle=r.fallOffAngle),void 0!==r.fallOffExponent&&console.warn("OASLoader:: light.fallOffExponent not currently supported."),i.name=r.name||"light_"+n,this.lights[n]=i)}}function Ld(t){this.name=Ad.KHR_MATERIALS_COMMON}Ld.prototype.getMaterialType=function(t){switch(t.extensions[this.name].type){case"commonBlinn":case"commonPhong":return al;case"commonLambert":return ll;case"commonConstant":default:return no}},Ld.prototype.extendParams=function(t,e,n){var i=e.extensions[this.name],r=[],o=[];switch(i.type){case"commonBlinn":case"commonPhong":o.push("diffuseFactor","diffuseTexture","specularFactor","specularTexture","shininessFactor");break;case"commonLambert":o.push("diffuseFactor","diffuseTexture")}var a={};return o.forEach(function(t){void 0!==i[t]&&(a[t]=i[t])}),void 0!==a.diffuseFactor&&(t.color=(new Jn).fromArray(a.diffuseFactor),t.opacity=a.diffuseFactor[3]),void 0!==a.diffuseTexture&&r.push(n.assignTexture(t,"map",a.diffuseTexture.index)),void 0!==a.specularFactor&&(t.specular=(new Jn).fromArray(a.specularFactor)),void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularMap",a.specularTexture.index)),void 0!==a.shininessFactor&&(t.shininess=a.shininessFactor),Promise.all(r)};var Pd="ogdw",Rd="glTF",Od="sogd",kd=12,zd={JSON:1313821514,BIN:5130562};function Id(t){this.name=Ad.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,kd);if(this.header={magic:ef(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Pd&&this.header.magic!==Rd&&this.header.magic!==Od)throw new Error("OASLoader: Unsupported header.");if(this.header.version<2)throw new Error("OASLoader: Legacy binary file detected.");for(var n=new DataView(t,kd),i=0;i","").replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include ",a).replace("#include ",s).replace("#include ",h).replace("#include ",l).replace("#include ",c);delete o.roughness,delete o.metalness,delete o.roughnessMap,delete o.metalnessMap,o.specular={value:(new Jn).setHex(1118481)},o.glossiness={value:.5},o.specularMap={value:null},o.glossinessMap={value:null},t.vertexShader=r.vertexShader,t.fragmentShader=u,t.uniforms=o,t.defines={STANDARD:""},t.color=new Jn(1,1,1),t.opacity=1;var p=[];if(Array.isArray(i.diffuseFactor)){var d=i.diffuseFactor;t.color.fromArray(d),t.opacity=d[3]}if(void 0!==i.diffuseTexture&&p.push(n.assignTexture(t,"map",i.diffuseTexture.index)),t.emissive=new Jn(0,0,0),t.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,t.specular=new Jn(1,1,1),Array.isArray(i.specularFactor)&&t.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var f=i.specularGlossinessTexture.index;p.push(n.assignTexture(t,"glossinessMap",f)),p.push(n.assignTexture(t,"specularMap",f))}return Promise.all(p)},createMaterial:function(t){var e=new $r({defines:t.defines,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,fog:!0,lights:!0,opacity:t.opacity,transparent:t.transparent});return e.isGLTFSpecularGlossinessMaterial=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalScale=new Ze(1,1),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e.extensions.derivatives=!0,e},refreshUniforms:function(t,e,n,i,r,o){var a,s=r.uniforms,h=r.defines;if(s.opacity.value=r.opacity,s.diffuse.value.copy(r.color),s.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),s.map.value=r.map,s.specularMap.value=r.specularMap,s.alphaMap.value=r.alphaMap,s.lightMap.value=r.lightMap,s.lightMapIntensity.value=r.lightMapIntensity,s.aoMap.value=r.aoMap,s.aoMapIntensity.value=r.aoMapIntensity,r.map?a=r.map:r.specularMap?a=r.specularMap:r.displacementMap?a=r.displacementMap:r.normalMap?a=r.normalMap:r.bumpMap?a=r.bumpMap:r.glossinessMap?a=r.glossinessMap:r.alphaMap?a=r.alphaMap:r.emissiveMap&&(a=r.emissiveMap),void 0!==a){a.isWebGLRenderTarget&&(a=a.texture);var l=a.offset,c=a.repeat;s.offsetRepeat.value.set(l.x,l.y,c.x,c.y)}s.envMap.value=r.envMap,s.envMapIntensity.value=r.envMapIntensity,s.flipEnvMap.value=r.envMap&&r.envMap.isCubeTexture?-1:1,s.refractionRatio.value=r.refractionRatio,s.specular.value.copy(r.specular),s.glossiness.value=r.glossiness,s.glossinessMap.value=r.glossinessMap,s.emissiveMap.value=r.emissiveMap,s.bumpMap.value=r.bumpMap,s.normalMap.value=r.normalMap,s.displacementMap.value=r.displacementMap,s.displacementScale.value=r.displacementScale,s.displacementBias.value=r.displacementBias,null!==s.glossinessMap.value&&void 0===h.USE_GLOSSINESSMAP&&(h.USE_GLOSSINESSMAP="",h.USE_ROUGHNESSMAP=""),null===s.glossinessMap.value&&void 0!==h.USE_GLOSSINESSMAP&&(delete h.USE_GLOSSINESSMAP,delete h.USE_ROUGHNESSMAP)}}}var Bd=0,Nd=1,Fd=2,Ud=3,jd=4,Vd=5,Gd=6,Hd={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wd={9728:kt,9729:Bt,9984:zt,9985:Nt,9986:Dt,9987:Ft},qd={33071:Rt,33648:Ot,10497:Pt},Xd={6406:Qt,6407:$t,6408:te,6409:ee,6410:ne},Yd={5121:Ut,32819:Yt,32820:Zt,33635:Jt},Zd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Kd={CATMULLROMSPLINE:Re,CUBICSPLINE:Re,LINEAR:Pe,STEP:Le},Qd="OPAQUE";function $d(t,e,n){if(!t)return Promise.resolve();var i,r=[];if("[object Array]"===Object.prototype.toString.call(t)){i=[];for(var o=t.length,a=0;a\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"},((mf.prototype=Object.create($r.prototype)).constructor=mf).prototype.isLineMaterial=!0,mf.prototype.copy=function(t){return $r.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.resolution=t.resolution,this},vf.prototype=Object.assign(Object.create(ep.prototype),{constructor:vf,isLineSegmentsGeometry:!0,applyMatrix:function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(t.applyToBufferAttribute(e),t.applyToBufferAttribute(n),e.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},setPositions:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var n=new np(e,6,1);return this.addAttribute("instanceStart",new Es(n,3,0)),this.addAttribute("instanceEnd",new Es(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},setColors:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var n=new np(e,6,1);return this.addAttribute("instanceColorStart",new Es(n,3,0)),this.addAttribute("instanceColorEnd",new Es(n,3,3)),this},fromWireframeGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromEdgesGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromMesh:function(t){return this.fromWireframeGeometry(new Hs(t.geometry)),this},fromLineSegements:function(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this},computeBoundingBox:(sf=new Nn,function(){null===this.boundingBox&&(this.boundingBox=new Nn);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),sf.setFromBufferAttribute(e),this.boundingBox.union(sf))}),computeBoundingSphere:(af=new Qe,function(){null===this.boundingSphere&&(this.boundingSphere=new jn),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,r=0,o=t.count;r>16&255)+","+(t>>8&255)+","+(255&t)+")"},getUniqueID:function(){return bf++}};function _f(c,u,p,e,n){function d(t,e){var n=c.getBoundingClientRect(),i=new Ze;return i.set((t-n.left)/n.width*2-1,(e-n.top)/n.height*-2+1),i}var f=null,m=null,v=null,g=null,y=120,x=13,b=new Qe,w=new Ze,o=!1,_=null,a=!1,i=!0,s=new Ze;this.cancelHighlight=function(){g.material.color.setHex(13421772),g.material.needsUpdate=!0,n()};function M(t){0==t.button&&(o=!0,s.set(t.clientX,t.clientY),e._currentSelectMeasureID=_)}this.documentMouseMove=function(t){if(o){var e=f.style.left,n=f.style.top;e=e.replace("px",""),n=n.replace("px",""),e=parseInt(e),n=parseInt(n);var i=t.clientX-s.x,r=t.clientY-s.y;(1 y:"+v.position.y.toFixed(4)+"
 z:"+v.position.z.toFixed(4);m.innerHTML=h;var l=wf.getTextWidth(x,h);l=G&&(clearInterval(j),j=void 0,U=!1)}function Ct(t){if(t.preventDefault(),t.stopPropagation(),!U){var e=xt(t.clientX,t.clientY);B.setFromCamera(e,h);var n=new Qe(v.x,v.y,v.z);if(null!=N){var i=B.intersectObject(N,!0);if(0f&&(e*=-1),St(s,e)}(),bt(),bt();else if((p==r||p==a)&&-2!=ht){var n=xt(t.clientX,t.clientY);if(B.setFromCamera(n,h),null!=N){var i=B.intersectObject(N,!0);0=e.length)){var i=e[n].object;if("isSphere"in i)yt(i.uuid)&&(i=t(e,n+1));else{var r=function(t){for(var e=t;"Scene"!=e.type&&"Object3D"!=e.type;)e=e.parent;return e}(i);i=yt(r.name)?t(e,n+1):r}return i}}(a,0);s&&("isSphere"in s?(vt(!0,!0),st(s,!1,!0,!0)):(gt(!0),at(s,!1,!0,!0)),s=null)}else vt(!0,!0),gt(!0)}}}else i==M?P&=~M:r==S&&(P&=~S);P==w&&(L=b,document.removeEventListener("mouseup",t,!1),p==u&&document.removeEventListener("mousemove",Rt,!1)),R=T,r=i=n=null};o.addEventListener("mousedown",Tt,!1),o.addEventListener("contextmenu",Et,!1),o.addEventListener("wheel",Ct,!1);function kt(t){ft&&ft.keydown(t)}function zt(t){ft&&ft.keyup(t)}this.update=function(){var t=pt.getDelta();ct&&ct.update(t),ft&&ft.update(t)},this.startThirdPersonRoam=function(){(dt||(window.addEventListener("keydown",kt,!1),window.addEventListener("keyup",zt,!1)),dt=!0,lt)?(wt(!0),ft&&ft.start()):(new Td).load("model/thirdpersonmodel.glb",function(t){if(t&&void 0!==t&&t.scene&&void 0!==t.scene){if(lt=t.scene,t.animations&&t.animations.length){ct=new $u(lt),ut=t.animations;for(var e=0;e!=ut.length;++e)ct.clipAction(ut[e]).play()}t=null;var n=new Nn;n.setFromObject(lt);var i=new Qe;n.getCenter(i);var r=new Je,o=new Je,a=new Je;o.makeTranslation(-i.x,-i.y,-i.z),a.makeRotationAxis(d,Ye.degToRad(90)),r.multiplyMatrices(a,o),o.makeTranslation(i.x,i.y,i.z);var s=new Je;s.makeTranslation(0,0,1.5),o.multiplyMatrices(o,s),r.multiplyMatrices(o,r),lt.applyMatrix(r),lt&&(l.add(lt),ft||(ft=new of(lt,h)).start()),wt(!0)}},function(t){},function(t){})},this.endThirdPersonRoam=function(){dt&&(window.removeEventListener("keydown",kt,!1),window.removeEventListener("keyup",zt,!1)),dt=!1},this.reset=function(){this.endSelectVertice(),this.endThirdPersonRoam()},this.dispose=function(){reset(),o.removeEventListener("mousedown",Tt,!1),o.removeEventListener("contextmenu",Et,!1),o.removeEventListener("wheel",Ct,!1),document.removeEventListener("mousemove",this.documentMouseMove,!1),document.removeEventListener("mouseup",this.documentMouseUp,!1),U=!1,it=nt=et=tt=$=Q=K=J=Z=Y=X=q=W=H=G=V=j=N=B=D=I=e=z=k=O=x=y=g=v=m=f=s=null},this.onsize=function(t,e){this.cameraRightDeltaAngle=2*Math.PI/(1.5*o.clientWidth),this.cameraUpDeltaAngle=2*Math.PI/(2*o.clientHeight),this.resizeMeasures(t,e)}}function Ef(r,t,e){var o=null,a=null,s=new Qe,h=new Qe,l=null,c=null,n=new Je;n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);var i=new Gn;i.setFromMatrix(n);function u(){h.copy(s),h.project(t),h.x=(h.x+1)/2*r.offsetWidth,h.y=(1-h.y)/2*r.offsetHeight}e=e;this.create=function(t,e,n,i){null==o&&null==a&&(o=document.createElement("div"),(a=document.createElement("img")).className="oas_imgl",l=.5*n,c=i,s.copy(t),u(),o.style.position="absolute",o.appendChild(a),o.style.zIndex="3",a.src=e,o.style.left=h.x-l+"px",o.style.top=h.y-i+"px",a.width=n,a.height=i,r.appendChild(o))},this.edit=function(t,e,n){null!=o&&null!=a&&(a.src=t,e&&(a.width=e),n&&(a.height=n))},this.render=function(){n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),i.setFromMatrix(n),i.containsPoint(s)?o.style.visibility="visible":o.style.visibility="hidden",u(),o.style.left=h.x-l+"px",o.style.top=h.y-c+"px"},this.dispose=function(){o.removeChild(a),r.removeChild(o),n=i=c=l=s=h=a=o=null},this.onClick=function(t){a.onclick=function(){void 0!==e&&t(e)}}}function Af(r,t,e){var o=null,a=null,s=null,h=120,l=new Qe,c=new Qe,n=new Je;n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);function u(){c.copy(l),c.project(t),c.x=(c.x+1)/2*r.offsetWidth,c.y=(1-c.y)/2*r.offsetHeight}var i=new Gn,p=13;this.create=function(t,e,n){if(null==o){n=function(t){return(t=wf.defaultValue(t,{})).opacity=wf.defaultValue(t.opacity,.8),t.fontSize=wf.defaultValue(t.fontSize,13),t.width=wf.defaultValue(t.width,150),t.background=wf.defaultValue(t.background,15658734),t.textColor=wf.defaultValue(t.textColor,0),t.borderColor=wf.defaultValue(t.borderColor,11184810),t}(n),l.copy(t),u(),h=n.width,(o=document.createElement("div")).style.zIndex="3",o.style.opacity=n.opacity.toString(),o.style.position="absolute",a=document.createElement("a"),o.appendChild(a),a.style.fontSize=n.fontSize+"px",p=n.fontSize,a.style.width=h+"px",a.style.display="block",a.style.height="auto",a.style.textAlign="center",a.style.textDecoration="none",a.style.msUserSelect="none",a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.background=wf.hex2CSSRGB(n.background),a.style.color=wf.hex2CSSRGB(n.textColor),a.style.padding="5px 10px",a.style.borderRadius="10px",a.style.border="2px solid",a.style.borderColor=wf.hex2CSSRGB(n.borderColor),a.href="javascript:void(0)",o.style.left=c.x-.5*o.clientWidth+"px",o.style.top=c.y-10-.5*o.clientHeight+"px",a.innerHTML=e,s=document.createElement("div"),o.appendChild(s),s.style.position="relative",s.style.width="0",s.style.height="0",s.style.borderTop="10px solid "+a.style.borderColor,s.style.borderLeft="6px solid transparent",s.style.borderRight="6px solid transparent",s.style.left="50%",s.style.marginLeft="-6px",s.style.top="0px",r.appendChild(o);var i=wf.getTextWidth(p,e);i lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")};function Bf(){var n=[];this.add=function(t){-1==n.indexOf(t)&&n.push(t)},this.remove=function(t){var e=n.indexOf(t);-1!=e&&n.splice(e,1)},this.clear=function(){n=[]},this.isHave=function(t){return-1!=n.indexOf(t)}}function Nf(){var e=this;this.config={ambientLightConfig:{color:13421772,intensity:.95},mainLightConfig:{color:7829367,intensity:.75},front:new Qe(0,-1,0),right:new Qe(1,0,0),top:new Qe(0,0,1)},this._PCamera=new Ua(60,1,.1,1e4),this._PCamera.name="PCamera",this._PCamera.position.set(100,-100,100),this._PCamera.lookAt(new Qe);this.OCamera=new uc(-50,50,100,-100,1,10),this.OCamera.position.z=10,this.OScene=new Ss,this.webglRender=new ws({alpha:!0}),this.webglRender.autoClear=!1,this.webglRender.autoUpdateScene=!1,this.webglRender.setPixelRatio(window.devicePixelRatio),this.webglRender.setClearColor(0,0),this.DivViewer=document.createElement("div"),this.DivViewer.id="oasviewer",this.DivViewer.appendChild(this.webglRender.domElement),this.DivViewer.style.width="100%",this.DivViewer.style.height="100%",this.ambientLight=new fc(this.config.ambientLightConfig.color,this.config.ambientLightConfig.intensity),this.scene=new Ss,this.scene.name="scenes",this.scene.add(this.ambientLight),this.mainLight=new cc(this.config.mainLightConfig.color,this.config.mainLightConfig.intensity),this.scene.add(this.mainLight),this.sceneBox=new Nn,this.sceneBox.min.set(-1,-1,-1),this.sceneBox.max.set(1,1,1),this.rootMeasures=new Ci,this.rootMeasures.name="rootmeasures",this.scene.add(this.rootMeasures),this.root=null,this.rootEx=null,this.humenModel=null,this.rootSprites=null,this.loadManager=new Ll,this.imageLabelsMap={},this.textLabelsMap={},this.globleXYCutPlane=null,this.globleXZCutPlane=null,this.globleYZCutPlane=null,this.globleCutPlaneArray=[],this.webglRender.clippingPlanes=this.globleCutPlaneArray,this.webglRender.enableLocalClipping=!1,this.viewCube=new Cf(this),this.viewCube.setVisible(!0),this.effectComposer=new zf(this.webglRender),this.renderPass=new If(this.scene,this._PCamera),this.effectComposer.addPass(this.renderPass),this.effectFXAA=new Of(Df),this.effectFXAA.uniforms.resolution.value.set(1/this.DivViewer.offsetWidth,1/this.DivViewer.offsetHeight),this.effectFXAA.renderToScreen=!0,this.effectComposer.addPass(this.effectFXAA),this.mainControl=new Tf(this.webglRender.domElement,this._PCamera,this.scene,this.mainLight),this.mainControl.setRender(function(){e.render()}),this.mainControl.setAnimation(function(t){e.setAnimateCamera(t)}),this.mainControl.setSelectCallBack(0,function(t){e.modelSelectEvent.id=t,e.dispatchEvent(e.modelSelectEvent)}),this.mainControl.setSelectCallBack(1,function(t){e.sphereSelectEvent.id=t,e.dispatchEvent(e.sphereSelectEvent)}),this.mainControl.setIsolationCallBack(function(t){return e._isolations.isHave(t)}),this.mainControl.setRootMeasures(this.rootMeasures),this.loadedFiles=[],this.isThirdPersionRoam=!1,this._isolations=new Bf,this.editBackground(0,"#F8F8FF","#87CEFA"),this.modelSelectEvent={type:"ModelSelectEvent",id:""},this.modelLoadEvent={type:"LoadModelEvent",statusText:""},this.imgLabelClickEvent={type:"ImageLabelClickEvent",id:""},this.textLabelClickEvent={type:"TextLabelClickEvent",id:""},this.sphereSelectEvent={type:"SphereSelectEvent",id:""},this.OnLoadProgress=function(t){if(t.lengthComputeable){var e=t.loaded/t.total*100;console.log(Math.round(e,2)+"% downloaded")}},this.OnError=function(t){console.error(t)},this.getCameraTarget=function(){return this.mainControl.getCameraTarget()},this._requestAFID=null,this._startAnimateCamera=function(t){requestAnimationFrame(e._startAnimateCamera),e.isThirdPersionRoam?e.mainControl.update():Up(t),e.webglRender.render(e.scene,e._PCamera)},this.setAnimateCamera=function(t){t?null==this._requestAFID&&(this._requestAFID=requestAnimationFrame(this._startAnimateCamera)):null!=this._requestAFID&&(cancelAnimationFrame(this._requestAFID),this._requestAFID=null)},this.playAnimate=function(t,e){if(!this.isThirdPersionRoam){var n=this;this.setAnimateCamera(!0);var i=new dd(t);i.to(e,500),i.delay(200),i.easing(Vp.Sinusoidal.Out),i.interpolation(ld.Linear),i.repeat(0),i.on("update",function(t){n._PCamera.up.set(t.upx,t.upy,t.upz),n._PCamera.position.set(t.px,t.py,t.pz);var e=new Qe(t.tx,t.ty,t.tz);n.mainControl.setCameraTarget(e),n._PCamera.lookAt(e),n.viewCube.render(e)}),i.on("complete",function(){n.isThirdPersionRoam||n.setAnimateCamera(!1),n.render(),i.stop()}),i.start()}},this.lookTo(cf.FrontRightTop,!1),this.initRoot=function(){null==this.root&&(this.root=new Ci,this.root.name="roots",this.scene.add(this.root))},this.initRootEx=function(){null==this.rootEx&&(this.initRoot(),this.rootEx=new Ci,this.rootEx.name="rootsEx",this.root.add(this.rootEx))},this.initSprites=function(){null==this.rootSprites&&(this.rootSprites=new Ci,this.rootSprites.name="rootSprites",this.OScene.add(this.rootSprites))},this.addChildInRootEx=function(t){this.initRootEx(),this.rootEx.add(t),this.render()},this.findObjectMaxZCoordinate=function(t){var s=new Qe(0,0,-1e7);if(t.traverse(function(t){if(t.geometry){var e=t.geometry;if(e.isGeometry)for(var n=0;n!=e.vertices.length;++n){var i=new Qe;i.copy(e.vertices[n]),i.applyMatrix4(t.matrixWorld),i.z>s.z&&s.copy(i),i=null}else if(e.isBufferGeometry&&"position"in e.attributes)for(n=0;n!=e.attributes.position.count;++n){var r=e.attributes.position.getX(n),o=e.attributes.position.getY(n),a=e.attributes.position.getZ(n);a>s.z&&s.set(r,o,a)}}}),-1e7!=s.z)return s},this.findObjectMaxZCoordinateCloseToCenter=function(t){var e=new Nn;e.setFromObject(t);var o=new Qe;e.getCenter(o);var a=new Qe(0,0,-1e7);if(t.traverse(function(t){if(t instanceof io&&t.geometry){var e=t.geometry;if(e instanceof Bi)for(var n=0;n!=e.vertices.length;++n){var i=new Qe;i.copy(e.vertices[n]),i.applyMatrix4(t.matrixWorld),i.z>a.z?a.copy(i):i.z==a.z&&i.distanceTo(o)a.z)a.copy(r);else if(r.z==a.z){r.distanceTo(o)r&&(d=d.substr(0,d.length-1),f.push(d),m.push(u),d="",v--,p+=u+=h+2)}if(0!=d.length&&(f.push(d),m.push(u),p+=i+10,p+=h),0!=f.length){var g=r;1==f.length&&(g=this.measureText(f[0]).width),g+=20;var y=!e.hasOwnProperty("edge")||e.edge,x=e.hasOwnProperty("edgeSize")?e.edgeSize:2,b=e.hasOwnProperty("edgeColor")?e.edgeColor:{r:0,g:0,b:0,a:1};y&&(g+=x+x,p+=x+x),this.canvas.width=g,this.canvas.height=p;var w=!e.hasOwnProperty("background")||e.background,_=e.hasOwnProperty("backgroundColor")?e.backgroundColor:{r:165,g:165,b:165,a:1},M=e.hasOwnProperty("textColor")?e.textColor:{r:0,g:0,b:0,a:1};this.lineWidth=x,this.font=o+"px sans-serif",this.textBaseline="top",this.textAlign="left";this.beginPath(),this.moveTo(l+6,i),this.lineTo(l+g-6-x,i),this.quadraticCurveTo(l+g-x,i,l+g-x,i+6),this.lineTo(l+g-x,i+p-6-x),this.quadraticCurveTo(l+g-x,i+p-x,l+g-6,i+p-x),this.lineTo(l+6,i+p-x),this.quadraticCurveTo(l,i+p-x,l,i+p-6-x),this.lineTo(l,i+6),this.quadraticCurveTo(l,i,l+6,i),this.closePath(),this.fillStyle="rgba("+_.r+","+_.g+","+_.b+","+_.a+")",w&&this.fill(),this.strokeStyle="rgba("+b.r+","+b.g+","+b.b+","+b.a+")",y&&this.stroke(),this.fillStyle="rgba("+M.r+","+M.g+","+M.b+","+M.a+")";for(var S=0;S!=f.length;++S)this.fillText(f[S],c,m[S]);return{_width:g,_height:p}}}},Nf.prototype=Object.assign(Object.create(n.prototype),{test:function(){var t=new Cs(new As({map:(new Il).load("sprite0.jpg"),sizeAttenuation:!1}));t.position.set(0,0,0);var e=t.position.distanceTo(this._PCamera.position)/1e3;t.scale.set(e,e,1),this.scene.add(t),this.render()},reset:function(){this.removeAllImageLabel(),this.rootMeasures.newdelete(),null!=this.root&&(this.scene.remove(this.root),null!=this.rootEx&&(this.rootEx.newdelete(),this.root.remove(this.rootEx),this.rootEx=null),this.loadedFiles=[],this.root.newdelete(),this.root=null,this.mainControl.reset(),this.viewCube.reset(),this.effectComposer.reset(),this.webglRender.dispose(),this.removeAllImageLabel(),this.sceneBox.min.set(-1,-1,-1),this.sceneBox.max.set(1,1,1),this.render())},render:function(){this.mainLight.position.copy(this._PCamera.position),this.viewCube.render(this.mainControl.getCameraTarget()),this.effectComposer.render(),this.mainControl.updateMeasures();for(var t=Object.values(this.imageLabelsMap),e=0;e!=t.length;++e)t[e].render();t=[];for(var n=Object.values(this.textLabelsMap),i=0;i!=n.length;++i)n[i].render();n=[],this.webglRender.clearDepth(),this.webglRender.render(this.OScene,this.OCamera)},zoomScene:function(t,e){var n=this;if(e=e||wf.defaultValue(e,1.23),null!=this.root)if(void 0===t||""==t){console.log("zoom all scene --\x3e");var i=new Nn;i.setFromObject(n.root),n.sceneBox.copy(i);var r=new Qe;i.getCenter(r);var o=new Qe;o.copy(n.mainControl.getCameraDirect()),n.mainControl.setRotateCenter(r);var a=new Qe;a.subVectors(i.max,i.min),o.multiplyScalar(a.length()*e);var s=new Qe;s.subVectors(r,o),n._PCamera.position.copy(s),n._PCamera.position.x=s.x,n._PCamera.position.y=s.y,n._PCamera.position.z=s.z,n.mainControl.setCameraTarget(r),n._PCamera.up.set(0,0,1),n._PCamera.lookAt(r),n.render(),console.log("zoom all scene --<")}else{var h=n.root.getObjectByName(t);if(void 0===h&&null!=n.rootEx&&(h=n.rootEx.getObjectByProperty("uuid",t)),void 0===h)return;var l={upx:n._PCamera.up.x,upy:n._PCamera.up.y,upz:n._PCamera.up.z,px:n._PCamera.position.x,py:n._PCamera.position.y,pz:n._PCamera.position.z,tx:n.mainControl.getCameraTarget().x,ty:n.mainControl.getCameraTarget().y,tz:n.mainControl.getCameraTarget().z},c=new Nn;c.setFromObject(h);var u=new Qe;c.getCenter(u),n.mainControl.setRotateCenter(u);var p=new Qe;p.copy(n.mainControl.getCameraDirect());var d=new Qe;d.subVectors(c.max,c.min),p.multiplyScalar(d.length()*e);var f=new Qe;f.subVectors(u,p);var m=new Qe;m.copy(n._PCamera.position);var v=new Qe;v.subVectors(f,m);var g=new Qe;g.copy(n.mainControl.getCameraTarget()),g.add(v),n.mainControl.setCameraTarget(g);var y={upx:0,upy:0,upz:1,px:f.x,py:f.y,pz:f.z,tx:g.x,ty:g.y,tz:g.z};n.playAnimate(l,y)}},highlightModel:function(t,e){var n=!1;if(1===(e=wf.defaultValue(e,0))&&(n=!0),null!=this.root)if(Array.isArray(t)){n||this.mainControl.unhighlightAllObjectByInterface();for(var i=0;i!=t.length;++i){var r=this.root.getObjectByName(t[i]);if(void 0===r&&null!=this.rootEx&&(r=this.rootEx.getObjectByProperty("uuid",t[i])),void 0===r)return;this.mainControl.highlightObjectByInterface(r,!0)}this.render()}else{var o=this.root.getObjectByName(t);if(void 0===o&&null!=this.rootEx&&(o=this.rootEx.getObjectByProperty("uuid",t)),void 0===o)return;this.mainControl.highlightObjectByInterface(o,n),this.render()}},addModels:function(t){var r=this;if("files"in t&&Array.isArray(t.files)){var o=t.files.length,a=0;t.files.forEach(function(t){var e=t,n=e;if(-1==r.loadedFiles.indexOf(n)&&"string"==typeof n){var i=e.split(".").pop().toLowerCase();if("ogdw"==i||"glb"==i||"ogd"==i)new Td(r.loadManager).load(n,function(t){t.scene.name=n,r.loadedFiles.push(n),r.initRoot(),r.mainControl.setRootScene(r.root),r.root.add(t.scene),1!=++a&&a!=o||r.zoomScene(),a==o&&(r.modelLoadEvent.statusText="模型加载完成",r.dispatchEvent(r.modelLoadEvent)),t=null},function(){},function(){++a==o&&(r.modelLoadEvent.statusText="模型加载完成",r.dispatchEvent(r.modelLoadEvent)),r.render(),object=null})}})}},addModelByUrl:function(r){if("string"==typeof r&&"json"==r.split(".").pop().toLowerCase()){var t=new XMLHttpRequest;t.open("GET",r,!0),t.addEventListener("load",function(t){var e=this.response,n=wf.convertUint8ArrayToString(new Uint8Array(e)),i=(JSON.parse(n),r.lastIndexOf("/"));-1!=i&&r.slice(0,i+1)},!1),t.addEventListener("progress",function(t){},!1),t.addEventListener("error",function(t){},!1),t.addEventListener("abort",function(t){},!1),t.responseType="arraybuffer",t.overrideMimeType&&t.overrideMimeType("text/plain"),t.send(null)}},removeModels:function(t){var r=this;if(r.mainControl.unhighlightAllObjectByInterface(),"files"in t&&Array.isArray(t.files)){t.files.length;t.files.forEach(function(t){var e=t,n=r.loadedFiles.indexOf(e);if(-1!=n&&r.loadedFiles.splice(n,1),"string"==typeof e&&null!=r.root){var i=r.root.getObjectByName(e);null!=i&&(i.parent.remove(i),i.newdelete(),i=null,r.render())}})}r.webglRender.dispose()},editColor:function(t,e){if(null!=this.root){var n=function(t){"oriemiss"in t.material?(null==t.material.oricolor&&(t.material.oricolor=t.material.oriemiss),t.material.oriemiss=e):(null==t.material.oricolor&&(t.material.oricolor=t.material.color.getHex()),t.material.color.setHex(e)),t.material.needsUpdate=!0};if(""===t)this.root.traverse(function(t){t instanceof io&&n(t)});else{var i=this.root.getObjectByName(t);i&&i.traverse(function(t){t instanceof io&&n(t)})}}this.render()},restoreColor:function(t){if(null!=this.root){var e=function(t){"oricolor"in t.material&&("oriemiss"in t.material?t.material.oriemiss=t.material.oricolor:t.material.color.setHex(t.material.oricolor)),"orialpha"in t.material&&(t.material.needsUpdate=!0)};if(""===t)this.root.traverse(function(t){t instanceof io&&e(t)});else{var n=this.root.getObjectByName(t);n&&n.traverse(function(t){t instanceof io&&e(t)})}}this.render()},editAlpha:function(t,e){if(null!=this.root){var n=function(t){t.material.oriemiss_alpha?("orialpha"in t.material||(t.material.orialpha=t.material.oriemiss_alpha),"oritransparent"in t.material||(t.material.oritransparent=t.material.oriemiss_trans),t.material.oriemiss_alpha=1-e,t.material.oriemiss_trans=!0):("orialpha"in t.material||(t.material.orialpha=t.material.opacity),"oritransparent"in t.material||(t.material.oritransparent=t.material.transparent),t.material.opacity=1-e,t.material.transparent=!0),t.material.needsUpdate=!0};if(""===t)this.root.traverse(function(t){t instanceof io&&n(t)});else{var i=this.root.getObjectByName(t);i&&i.traverse(function(t){t instanceof io&&n(t)})}}this.render()},restoreAlpha:function(t){if(null!=this.root){var e=function(t){"orialpha"in t.material&&("oriemiss_alpha"in t.material?(t.material.oriemiss_alpha=t.material.orialpha,t.material.oriemiss_trans=t.material.oritransparent):(t.material.opacity=t.material.orialpha,t.material.transparent=t.material.oritransparent)),"orialpha"in t.material&&(t.material.needsUpdate=!0)};if(""===t)this.root.traverse(function(t){t instanceof io&&e(t)});else{var n=this.root.getObjectByName(t);n&&n.traverse(function(t){t instanceof io&&e(t)})}}this.render()},editVisibility:function(t,e){if(null!=this.root){var n=this.root.getObjectByName(t);n&&n instanceof Ci&&(n.visible=e)}this.render()},addImageLabel:function(t,e,n,i){var r=this;if(t in this.imageLabelsMap)this.imageLabelsMap[t].edit(e,n,i);else if(null!=this.root){if(a=(a=this.root.getObjectByName(t))||this.rootEx.getObjectByProperty("uuid",t)){a.updateMatrixWorld(!0);var o=void 0;if(o="isSphere"in a?r.findSphereMaxZCoordinate(a):r.findObjectMaxZCoordinateCloseToCenter(a))if(void 0!==o&&-1e7!=o.z)(s=new Ef(r.DivViewer,r._PCamera,t)).create(o,e,n,i),s.onClick(function(t){r.imgLabelClickEvent.id=t,r.dispatchEvent(r.imgLabelClickEvent)}),r.imageLabelsMap[t]=s}}else if(this.rootEx){var a;if(a=this.rootEx.getObjectByProperty("uuid",t)){a.updateMatrixWorld(!0);var s;o=void 0;if(o="isSphere"in a?r.findSphereMaxZCoordinate(a):r.findObjectMaxZCoordinateCloseToCenter(a))if(void 0!==o&&-1e7!=o.z)(s=new Ef(r.DivViewer,r._PCamera,t)).create(o,e,n,i),s.onClick(function(t){r.imgLabelClickEvent.id=t,r.dispatchEvent(r.imgLabelClickEvent)}),r.imageLabelsMap[t]=s}}},editImageLabel:function(t,e,n,i){t in this.imageLabelsMap&&this.imageLabelsMap[t].edit(e,n,i)},removeImageLabel:function(t){t in this.imageLabelsMap&&(this.imageLabelsMap[t].dispose(),this.imageLabelsMap[t]=null,delete this.imageLabelsMap[t])},removeAllImageLabel:function(){for(var t=Object.values(this.imageLabelsMap),e=0;e!=t.length;++e)t[e].dispose(),t[e]=null;t=[],this.imageLabelsMap={}},addTextLabel:function(t,e,n){var i=this;if(t in this.textLabelsMap)this.textLabelsMap[t].edit(e,n);else if(this.root){if(a=(a=this.root.getObjectByName(t))||this.rootEx.getObjectByProperty("uuid",t)){a.updateMatrixWorld(!0);var r=void 0;if((r="isSphere"in a?i.findSphereMaxZCoordinate(a):i.findObjectMaxZCoordinateCloseToCenter(a))&&void 0!==r&&-1e7!=r.z){var o=new Af(i.DivViewer,i._PCamera,t);o.create(r,e,n),o.onClick(function(t){i.textLabelClickEvent.id=t,i.dispatchEvent(i.textLabelClickEvent)}),i.textLabelsMap[t]=o}}}else if(this.rootEx){var a;if(a=this.rootEx.getObjectByProperty("uuid",t)){a.updateMatrixWorld(!0);r=void 0;if((r="isSphere"in a?i.findSphereMaxZCoordinate(a):i.findObjectMaxZCoordinateCloseToCenter(a))&&void 0!==r&&-1e7!=r.z){var s=new Af(i.DivViewer,i._PCamera,t);s.create(r,e,n),s.onClick(function(t){i.textLabelClickEvent.id=t,i.dispatchEvent(i.textLabelClickEvent)}),i.textLabelsMap[t]=s}}}},editTextLabel:function(t,e,n){t in this.textLabelsMap&&this.textLabelsMap[t].edit(e,n)},removeTextLabel:function(t){t in this.textLabelsMap&&(this.textLabelsMap[t].dispose(),this.textLabelsMap[t]=null,delete this.textLabelsMap[t])},removeAllTextLabel:function(){for(var t=Object.values(this.textLabelsMap),e=0;e!=t.length;++e)t[e].dispose(),t[e]=null;t=[],this.textLabelsMap={}},lookTo:function(t,e){if(void 0!==t&&null!=t||(t=cf.FrontRightTop),e=wf.defaultValue(e,!0),void 0!==t){var n=new Qe;this.sceneBox.getCenter(n);var i=new Qe;i.subVectors(this.sceneBox.max,this.sceneBox.min);var r=new Qe;r.copy(this.config.front),r.multiplyScalar(1.23*i.length());var o=r.length(),a=this.mainControl.getCameraTarget(),s={upx:this._PCamera.up.x,upy:this._PCamera.up.y,upz:this._PCamera.up.z,px:this._PCamera.position.x,py:this._PCamera.position.y,pz:this._PCamera.position.z,tx:a.x,ty:a.y,tz:a.z},h={};switch(t){case cf.Front:h.px=n.x+o*this.config.front.x,h.py=n.y+o*this.config.front.y,h.pz=n.z+o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.Back:h.px=n.x-o*this.config.front.x,h.py=n.y-o*this.config.front.y,h.pz=n.z-o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.Left:h.px=n.x-o*this.config.right.x,h.py=n.y-o*this.config.right.y,h.pz=n.z-o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.Right:h.px=n.x+o*this.config.right.x,h.py=n.y+o*this.config.right.y,h.pz=n.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.Top:h.px=n.x+o*this.config.top.x,h.py=n.y+o*this.config.top.y,h.pz=n.z+o*this.config.top.z,h.upx=this.config.front.x,h.upy=-this.config.front.y,h.upz=this.config.front.z;break;case cf.Bottom:h.px=n.x-o*this.config.top.x,h.py=n.y-o*this.config.top.y,h.pz=n.z-o*this.config.top.z,h.upx=this.config.front.x,h.upy=this.config.front.y,h.upz=this.config.front.z;break;case cf.FrontTop:h.px=n.x+o*this.config.front.x+o*this.config.top.x,h.py=n.y+o*this.config.front.y+o*this.config.top.y,h.pz=n.z+o*this.config.front.z+o*this.config.top.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontRight:h.px=n.x+o*this.config.front.x+o*this.config.right.x,h.py=n.y+o*this.config.front.y+o*this.config.right.y,h.pz=n.z+o*this.config.front.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontLeft:h.px=n.x-o*this.config.front.x-o*this.config.right.x,h.py=n.y+o*this.config.front.y+o*this.config.right.y,h.pz=n.z+o*this.config.front.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontBottom:h.px=n.x+o*this.config.front.x+o*this.config.top.x,h.py=n.y+o*this.config.front.y+o*this.config.top.y,h.pz=n.z-o*this.config.front.z-o*this.config.top.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.RightBack:h.px=n.x+o*this.config.front.x+o*this.config.right.x,h.py=n.y-o*this.config.front.y-o*this.config.right.y,h.pz=n.z+o*this.config.front.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.RightBottom:h.px=n.x+o*this.config.top.x+o*this.config.right.x,h.py=n.y-o*this.config.top.y-o*this.config.right.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.RightTop:h.px=n.x+o*this.config.top.x+o*this.config.right.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackLeft:h.px=n.x-o*this.config.front.x-o*this.config.right.x,h.py=n.y-o*this.config.front.y-o*this.config.right.y,h.pz=n.z+o*this.config.front.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackTop:h.px=n.x+o*this.config.front.x+o*this.config.top.x,h.py=n.y-o*this.config.front.y-o*this.config.top.y,h.pz=n.z+o*this.config.front.z+o*this.config.top.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackBottom:h.px=n.x+o*this.config.front.x+o*this.config.top.x,h.py=n.y-o*this.config.front.y-o*this.config.top.y,h.pz=n.z-o*this.config.front.z-o*this.config.top.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.LeftBottom:h.px=n.x-o*this.config.top.x-o*this.config.right.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.LeftTop:h.px=n.x-o*this.config.top.x-o*this.config.right.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontRightTop:h.px=n.x+o*this.config.top.x+o*this.config.right.x+o*this.config.front.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y+o*this.config.front.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z+o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontRightBottom:h.px=n.x+o*this.config.top.x+o*this.config.right.x+o*this.config.front.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y+o*this.config.front.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z-o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontLeftTop:h.px=n.x-o*this.config.top.x-o*this.config.right.x-o*this.config.front.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y+o*this.config.front.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z+o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.FrontLeftBottom:h.px=n.x-o*this.config.top.x-o*this.config.right.x-o*this.config.front.x,h.py=n.y+o*this.config.top.y+o*this.config.right.y+o*this.config.front.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z-o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackRightTop:h.px=n.x+o*this.config.top.x+o*this.config.right.x+o*this.config.front.x,h.py=n.y-o*this.config.top.y-o*this.config.right.y-o*this.config.front.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z+o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackRightBottom:h.px=n.x+o*this.config.top.x+o*this.config.right.x+o*this.config.front.x,h.py=n.y-o*this.config.top.y-o*this.config.right.y-o*this.config.front.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z-o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackLeftTop:h.px=n.x-o*this.config.top.x-o*this.config.right.x-o*this.config.front.x,h.py=n.y-o*this.config.top.y-o*this.config.right.y-o*this.config.front.y,h.pz=n.z+o*this.config.top.z+o*this.config.right.z+o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.BackLeftBottom:h.px=n.x-o*this.config.top.x-o*this.config.right.x-o*this.config.front.x,h.py=n.y-o*this.config.top.y-o*this.config.right.y-o*this.config.front.y,h.pz=n.z-o*this.config.top.z-o*this.config.right.z-o*this.config.front.z,h.upx=this.config.top.x,h.upy=this.config.top.y,h.upz=this.config.top.z;break;case cf.East:h.px=n.x+o*this.config.top.x,h.py=n.y+o*this.config.top.y,h.pz=n.z+o*this.config.top.z,h.upx=this.config.right.x,h.upy=this.config.right.y,h.upz=this.config.right.z;break;case cf.South:h.px=n.x+o*this.config.top.x,h.py=n.y+o*this.config.top.y,h.pz=n.z+o*this.config.top.z,h.upx=this.config.front.x,h.upy=this.config.front.y,h.upz=this.config.front.z;break;case cf.West:h.px=n.x+o*this.config.top.x,h.py=n.y+o*this.config.top.y,h.pz=n.z+o*this.config.top.z,h.upx=-this.config.right.x,h.upy=this.config.right.y,h.upz=this.config.right.z;break;case cf.North:h.px=n.x+o*this.config.top.x,h.py=n.y+o*this.config.top.y,h.pz=n.z+o*this.config.top.z,h.upx=this.config.front.x,h.upy=-this.config.front.y,h.upz=this.config.front.z}if(h.tx=n.x,h.ty=n.y,h.tz=n.z,e)this.playAnimate(s,h);else{this._PCamera.up.set(h.upx,h.upy,h.upz),this._PCamera.position.set(h.px,h.py,h.pz);var l=new Qe(h.tx,h.ty,h.tz);this.mainControl.setCameraTarget(l),this._PCamera.lookAt(l),this.viewCube.render(l)}}},setCuttingPlane:function(t,e){switch(e<0?e=0:100