1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3737],{99477:function(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){let _canvas;__webpack_require__.d(__webpack_exports__,{$V:function(){return Spherical},A5E:function(){return DataUtils},CP7:function(){return WebGLRenderer},D1R:function(){return LinearMipmapLinearFilter},DvJ:function(){return BoxGeometry},EB7:function(){return CompressedTexture},EJi:function(){return MeshPhysicalMaterial},F5T:function(){return Material},FM8:function(){return Vector2},Hw6:function(){return Source},IEO:function(){return DataTexture},ILR:function(){return RGBA_S3TC_DXT5_Format},IOt:function(){return TangentSpaceNormalMap},Ilk:function(){return Color},JUT:function(){return Data3DTexture},Kj0:function(){return Mesh},LY2:function(){return ACESFilmicToneMapping},M8C:function(){return MathUtils},N$j:function(){return Bone},NMF:function(){return InterpolateLinear},OdW:function(){return Skeleton},OoA:function(){return MirroredRepeatWrapping},Ox3:function(){return DirectionalLight},PMe:function(){return SpotLight},Pa4:function(){return Vector3},QRU:function(){return ImageBitmapLoader},SPe:function(){return InstancedMesh},Syv:function(){return InterpolateDiscrete},TUv:function(){return SkinnedMesh},TlE:function(){return BufferAttribute},Tme:function(){return Object3D},TyD:function(){return NearestFilter},USm:function(){return Euler},UY4:function(){return PointsMaterial},UlW:function(){return TriangleStripDrawMode},Vkp:function(){return Matrix3},VzW:function(){return FloatType},Wid:function(){return MeshStandardMaterial},Wl3:function(){return FrontSide},Xcj:function(){return AnimationMixer},YKA:function(){return LoopRepeat},YLQ:function(){return NearestMipmapNearestFilter},ZAu:function(){return Group},Z_g:function(){return CompressedArrayTexture},Zp0:function(){return LoaderUtils},ZzF:function(){return Box3},_12:function(){return PlaneGeometry},_AM:function(){return RGB_PVRTC_4BPPV1_Format},_C8:function(){return Interpolant},_Li:function(){return BackSide},_am:function(){return CubeCamera},_fP:function(){return Quaternion},a$l:function(){return Float32BufferAttribute},aH4:function(){return NearestMipmapLinearFilter},aLr:function(){return Sphere},aNw:function(){return Loader},av9:function(){return RGFormat},blk:function(){return LineLoop},bsb:function(){return RGBA_BPTC_Format},cLu:function(){return HalfFloatType},cPb:function(){return PerspectiveCamera},cek:function(){return PointLight},dSO:function(){return EquirectangularReflectionMapping},dUE:function(){return NumberKeyframeTrack},dd2:function(){return WebGLRenderTarget},dpR:function(){return TextureLoader},eaV:function(){return RGBA_PVRTC_4BPPV1_Format},ehD:function(){return DoubleSide},ejS:function(){return LineSegments},ekQ:function(){return RGBA_ETC2_EAC_Format},fto:function(){return RGB_ETC1_Format},hEm:function(){return RedFormat},hH6:function(){return FileLoader},iKG:function(){return OrthographicCamera},iLg:function(){return QuaternionKeyframeTrack},iMs:function(){return Raycaster},iUV:function(){return PropertyBinding},jAl:function(){return LoopOnce},jFi:function(){return NoBlending},jyz:function(){return ShaderMaterial},kB5:function(){return InterleavedBufferAttribute},knz:function(){return sRGBEncoding},l0P:function(){return RGB_ETC2_Format},lRF:function(){return MeshDepthMaterial},lk7:function(){return LightProbe},m7l:function(){return AnimationClip},nls:function(){return LineBasicMaterial},oAp:function(){return WebGLCubeRenderTarget},pBf:function(){return EventDispatcher},ptH:function(){return RGBA_ASTC_4x4_Format},qyh:function(){return LinearMipmapNearestFilter},rnI:function(){return LinearEncoding},rpg:function(){return RepeatWrapping},u9r:function(){return BufferGeometry},uEv:function(){return LoopPingPong},uL9:function(){return NoToneMapping},uWy:function(){return ClampToEdgeWrapping},vBJ:function(){return MeshBasicMaterial},vpT:function(){return InterleavedBuffer},wem:function(){return LinearFilter},wk1:function(){return RGBAFormat},woe:function(){return Points},wuA:function(){return RGB_S3TC_DXT1_Format},x12:function(){return Line},xEZ:function(){return Texture},xsS:function(){return Scene},yC1:function(){return VectorKeyframeTrack},yGw:function(){return Matrix4},ywz:function(){return UnsignedByteType},yxD:function(){return DataTextureLoader},z$h:function(){return TriangleFanDrawMode}});let FrontSide=0,BackSide=1,DoubleSide=2,NoBlending=0,NoToneMapping=0,ACESFilmicToneMapping=4,EquirectangularReflectionMapping=303,RepeatWrapping=1e3,ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004,NearestMipmapLinearFilter=1005,LinearFilter=1006,LinearMipmapNearestFilter=1007,LinearMipmapLinearFilter=1008,UnsignedByteType=1009,FloatType=1015,HalfFloatType=1016,RGBAFormat=1023,RedFormat=1028,RGFormat=1030,RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGBA_PVRTC_4BPPV1_Format=35842,RGB_ETC1_Format=36196,RGB_
vendor: 29,428 bytes, line 1
1ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,RGBA_ASTC_4x4_Format=37808,RGBA_BPTC_Format=36492,LoopOnce=2200,LoopRepeat=2201,LoopPingPong=2202,InterpolateDiscrete=2300,InterpolateLinear=2301,TriangleStripDrawMode=1,TriangleFanDrawMode=2,LinearEncoding=3e3,sRGBEncoding=3001,TangentSpaceNormalMap=0,SRGBColorSpace="srgb",LinearSRGBColorSpace="srgb-linear",GLSL3="300 es";class EventDispatcher{addEventListener(type,listener){void 0===this._listeners&&(this._listeners={});let listeners=this._listeners;void 0===listeners[type]&&(listeners[type]=[]),-1===listeners[type].indexOf(listener)&&listeners[type].push(listener)}hasEventListener(type,listener){if(void 0===this._listeners)return!1;let listeners=this._listeners;return void 0!==listeners[type]&&-1!==listeners[type].indexOf(listener)}removeEventListener(type,listener){if(void 0===this._listeners)return;let listeners=this._listeners,listenerArray=listeners[type];if(void 0!==listenerArray){let index=listenerArray.indexOf(listener);-1!==index&&listenerArray.splice(index,1)}}dispatchEvent(event){if(void 0===this._listeners)return;let listeners=this._listeners,listenerArray=listeners[event.type];if(void 0!==listenerArray){event.target=this;let array=listenerArray.slice(0);for(let i=0,l=array.length;i<l;i++)array[i].call(this,event);event.target=null}}}let _lut=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],_seed=1234567,DEG2RAD=Math.PI/180,RAD2DEG=180/Math.PI;function generateUUID(){let d0=4294967295*Math.random()|0,d1=4294967295*Math.random()|0,d2=4294967295*Math.random()|0,d3=4294967295*Math.random()|0,uuid=_lut[255&d0]+_lut[d0>>8&255]+_lut[d0>>16&255]+_lut[d0>>24&255]+"-"+_lut[255&d1]+_lut[d1>>8&255]+"-"+_lut[d1>>16&15|64]+_lut[d1>>24&255]+"-"+_lut[63&d2|128]+_lut[d2>>8&255]+"-"+_lut[d2>>16&255]+_lut[d2>>24&255]+_lut[255&d3]+_lut[d3>>8&255]+_lut[d3>>16&255]+_lut[d3>>24&255];return uuid.toLowerCase()}function clamp(value,min,max){return Math.max(min,Math.min(max,value))}function euclideanModulo(n,m){return(n%m+m)%m}function lerp(x,y,t){return(1-t)*x+t*y}function isPowerOfTwo(value){return(value&value-1)==0&&0!==value}function ceilPowerOfTwo(value){return Math.pow(2,Math.ceil(Math.log(value)/Math.LN2))}function floorPowerOfTwo(value){return Math.pow(2,Math.floor(Math.log(value)/Math.LN2))}function denormalize(value,array){switch(array.constructor){case Float32Array:return value;case Uint16Array:return value/65535;case Uint8Array:return value/255;case Int16Array:return Math.max(value/32767,-1);case Int8Array:return Math.max(value/127,-1);default:throw Error("Invalid component type.")}}function normalize(value,array){switch(array.constructor){case Float32Array:return value;case Uint16Array:return Math.round(65535*value);case Uint8Array:return Math.round(255*value);case Int16Array:return Math.round(32767*value);case Int8Array:return Math.round(127*value);default:throw Error("Invalid component type.")}}var MathUtils=Object.freeze({__proto__:null,DEG2RAD:DEG2RAD,RAD2DEG:RAD2DEG,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},inverseLerp:function(x,y,value){return x!==y?(value-x)/(y-x):0},lerp:lerp,damp:function(x,y,lambda,dt){return lerp(x,y,1-Math.exp(-lambda*dt))},pingpong:function(x,length=1){return length-Math.abs(euclideanModulo(x,2*length)-length)},smoothstep:function(x,min,max){return x<=min?0:x>=max?1:(x=(x-min)/(max-min))*x*(3-2*x)},smootherstep:function(x,min,max){return x<=min?0:x>=max?1:(x=(x-min)/(max-min))*x*x*(x*(6*x-15)+10)},randInt:function(low,high){return low+Math.floor(Math.random()*(high-low+1))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},seededRandom:function(s){void 0!==s&&(_seed=s);let t=_seed+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(degrees){return degrees*DEG2RAD},radToDeg:function(radians){return radians*RAD2DEG},isPowerOfTwo:isPowerOfTwo,ceilPowerOfTwo:ceilPowerOfTwo,floorPowerOfTwo:floorPowerOfTwo,setQuaternionFromProperEuler:function(q,a,b,c,order){let cos=Math.cos,sin=Math.sin,c2=cos(b/2),s2=sin(b/2),c13=cos((a+c)/2),s13=sin((a+c)/2),c1_3=cos((a-c)/2),s1_3=sin((a-c)/2),c3_1=cos((c-a)/2),s3_1=sin((c-a)/2);switch(order){case"XYX":q.set(c2*s13,s2*c1_3,s2*s1_3,c2*c13);break;case"YZY":q.set(s2*s1_3,c2*s13,s2*c1_3,c2*c13);break;case"ZXZ":q.set(s2*c1_3,s2*s1_3,c2*s13,c2*c13);break;case"XZX":q.set(c2*s13,s2*s3_1,s2*c3_1,c2*c13);break;case"YXY":q.set(s2*c3_1,c2*s13,s2*s3_1,c2*c13);break;case"ZYZ":q.set(s2*s3_1,s2*c3_1,c2*s13,c2*c13);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+order)}},normalize:normalize,denormalize:denormalize});class Vector2{constructor(x=0,y=0){Vector2.prototype.isVector2=!0,this.x=x,this.y=y}get width(){return this.x}set width(value){this.x=value}get height(){return this.y}set height(value){this.y=value}set(x,y){return this.x=x,this.y=y,this}setScalar(scalar){return this.x=scalar,this.y=scalar,this}setX(x){return this.x=x,this}setY(y){return this.y=y,this}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw Error("index is out of range: "+index)}return this}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+index)}}clone(){return new this.constructor(this.x,this.y)}copy(v){return this.x=v.x,this.y=v.y,this}add(v){return this.x+=v.x,this.y+=v.y,this}addScalar(s){return this.x+=s,this.y+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this}addScaledVector(v,s){return this.x+=v.x*s,this.y+=v.y*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this}subScalar(s){return this.x-=s,this.y-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this}multiply(v){return this.x*=v.x,this.y*=v.y,this}multiplyScalar(scalar){return this.x*=scalar,this.y*=scalar,this}divide(v){return this.x/=v.x,this.y/=v.y,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}applyMatrix3(m){let x=this.x,y=this.y,e=m.elements;return this.x=e[0]*x+e[3]*y+e[6],this.y=e[1]*x+e[4]*y+e[7],this}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min(this.y,v.y),this}max(v){return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y),this}clamp(min,max){return this.x=Math.max(min.x,Math.min(max.x,this.x)),this.y=Math.max(min.y,Math.min(max.y,this.y)),this}clampScalar(minVal,maxVal){return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math.min(maxVal,this.y)),this}clampLength(min,max){let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(v){return this.x*v.x+this.y*v.y}cross(v){return this.x*v.y-this.y*v.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let angle=Math.atan2(-this.y,-this.x)+Math.PI;return angle}distanceTo(v){return Math.sqrt(this.distanceToSquared(v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y-v.y;return dx*dx+dy*dy}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs(this.y-v.y)}setLength(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this}lerpVectors(v1,v2,alpha){return this.x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this}equals(v){return v.x===this.x&&v.y===this.y}fromArray(array,offset=0){return this.x=array[offset],this.y=array[offset+1],this}toArray(array=[],offset=0){return array[offset]=this.x,array[offset+1]=this.y,array}fromBufferAttribute(attribute,index){return this.x=attribute.getX(index),this.y=attribute.getY(index),this}rotateAround(center,angle){let c=Math.cos(angle),s=Math.sin(angle),x=this.x-center.x,y=this.y-center.y;return this.x=x*c-y*s+center.x,this.y=x*s+y*c+center.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(n11,n12,n13,n21,n22,n23,n31,n32,n33){let te=this.elements;return te[0]=n11,te[1]=n21,te[2]=n31,te[3]=n12,te[4]=n22,te[5]=n32,te[6]=n13,te[7]=n23,te[8]=n33,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(m){let te=this.elements,me=m.elements;return te[0]=me[0],te[1]=me[1],te[2]=me[2],te[3]=me[3],te[4]=me[4],te[5]=me[5],te[6]=me[6],te[7]=me[7],te[8]=me[8],this}extractBasis(xAxis,yAxis,zAxis){return xAxis.setFromMatrix3Column(this,0),yAxis.setFromMatrix3Column(this,1),zAxis.setFromMatrix3Column(this,2),this}setFromMatrix4(m){let me=m.elements;return this.set(me[0],me[4],me[8],me[1],me[5],me[9],me[2],me[6],me[10]),this}multiply(m){return this.multiplyMatrices(this,m)}premultiply(m){return this.multiplyMatrices(m,this)}multiplyMatrices(a,b){let ae=a.elements,be=b.elements,te=this.elements,a11=ae[0],a12=ae[3],a13=ae[6],a21=ae[1],a22=ae[4],a23=ae[7],a31=ae[2],a32=ae[5],a33=ae[8],b11=be[0],b12=be[3],b13=be[6],b21=be[1],b22=be[4],b23=be[7],b31=be[2],b32=be[5],b33=be[8];return te[0]=a11*b11+a12*b21+a13*b31,te[3]=a11*b12+a12*b22+a13*b32,te[6]=a11*b13+a12*b23+a13*b33,te[1]=a21*b11+a22*b21+a23*b31,te[4]=a21*b12+a22*b22+a23*b32,te[7]=a21*b13+a22*b23+a23*b33,te[2]=a31*b11+a32*b21+a33*b31,te[5]=a31*b12+a32*b22+a33*b32,te[8]=a31*b13+a32*b23+a33*b33,this}multiplyScalar(s){let te=this.elements;return te[0]*=s,te[3]*=s,te[6]*=s,te[1]*=s,te[4]*=s,te[7]*=s,te[2]*=s,te[5]*=s,te[8]*=s,this}determinant(){let te=this.elements,a=te[0],b=te[1],c=te[2],d=te[3],e=te[4],f=te[5],g=te[6],h=te[7],i=te[8];return a*e*i-a*f*h-b*d*i+b*f*g+c*d*h-c*e*g}invert(){let te=this.elements,n11=te[0],n21=te[1],n31=te[2],n12=te[3],n22=te[4],n32=te[5],n13=te[6],n23=te[7],n33=te[8],t11=n33*n22-n32*n23,t12=n32*n13-n33*n12,t13=n23*n12-n22*n13,det=n11*t11+n21*t12+n31*t13;if(0===det)return this.set(0,0,0,0,0,0,0,0,0);let detInv=1/det;return te[0]=t11*detInv,te[1]=(n31*n23-n33*n21)*detInv,te[2]=(n32*n21-n31*n22)*detInv,te[3]=t12*detInv,te[4]=(n33*n11-n31*n13)*detInv,te[5]=(n31*n12-n32*n11)*detInv,te[6]=t13*detInv,te[7]=(n21*n13-n23*n11)*detInv,te[8]=(n22*n11-n21*n12)*detInv,this}transpose(){let tmp;let m=this.elements;return tmp=m[1],m[1]=m[3],m[3]=tmp,tmp=m[2],m[2]=m[6],m[6]=tmp,tmp=m[5],m[5]=m[7],m[7]=tmp,this}getNormalMatrix(matrix4){return this.setFromMatrix4(matrix4).invert().transpose()}transposeIntoArray(r){let m=this.elements;return r[0]=m[0],r[1]=m[3],r[2]=m[6],r[3]=m[1],r[4]=m[4],r[5]=m[7],r[6]=m[2],r[7]=m[5],r[8]=m[8],this}setUvTransform(tx,ty,sx,sy,rotation,cx,cy){let c=Math.cos(rotation),s=Math.sin(rotation);return this.set(sx*c,sx*s,-sx*(c*cx+s*cy)+cx+tx,-sy*s,sy*c,-sy*(-s*cx+c*cy)+cy+ty,0,0,1),this}scale(sx,sy){let te=this.elements;return te[0]*=sx,te[3]*=sx,te[6]*=sx,te[1]*=sy,te[4]*=sy,te[7]*=sy,this}rotate(theta){let c=Math.cos(theta),s=Math.sin(theta),te=this.elements,a11=te[0],a12=te[3],a13=te[6],a21=te[1],a22=te[4],a23=te[7];return te[0]=c*a11+s*a21,te[3]=c*a12+s*a22,te[6]=c*a13+s*a23,te[1]=-s*a11+c*a21,te[4]=-s*a12+c*a22,te[7]=-s*a13+c*a23,this}translate(tx,ty){let te=this.elements;return te[0]+=tx*te[2],te[3]+=tx*te[5],te[6]+=tx*te[8],te[1]+=ty*te[2],te[4]+=ty*te[5],te[7]+=ty*te[8],this}equals(matrix){let te=this.elements,me=matrix.elements;for(let i=0;i<9;i++)if(te[i]!==me[i])return!1;return!0}fromArray(array,offset=0){for(let i=0;i<9;i++)this.elements[i]=array[i+offset];return this}toArray(array=[],offset=0){let te=this.elements;return array[offset]=te[0],array[offset+1]=te[1],array[offset+2]=te[2],array[offset+3]=te[3],array[offset+4]=te[4],array[offset+5]=te[5],array[offset+6]=te[6],array[offset+7]=te[7],array[offset+8]=te[8],array}clone(){return new this.constructor().fromArray(this.elements)}}function arrayNeedsUint32(array){for(let i=array.length-1;i>=0;--i)if(array[i]>=65535)return!0;return!1}function createElementNS(name){return document.createElementNS("http://www.w3.org/1999/xhtml",name)}function SRGBToLinear(c){return c<.04045?.0773993808*c:Math.pow(.9478672986*c+.0521327014,2.4)}function LinearToSRGB(c){return c<.0031308?12.92*c:1.055*Math.pow(c,.41666)-.055}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let FN={[SRGBColorSpace]:{[LinearSRGBColorSpace]:SRGBToLinear},[LinearSRGBColorSpace]:{[SRGBColorSpace]:LinearToSRGB}},ColorManagement={legacyMode:!0,get workingColorSpace(){return LinearSRGBColorSpace},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(color,sourceColorSpace,targetColorSpace){if(this.legacyMode||sourceColorSpace===targetColorSpace||!sourceColorSpace||!targetColorSpace)return color;if(FN[sourceColorSpace]&&void 0!==FN[sourceColorSpace][targetColorSpace]){let fn=FN[sourceColorSpace][targetColorSpace];return color.r=fn(color.r),color.g=fn(color.g),color.b=fn(color.b),color}throw Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(color,targetColorSpace){return this.convert(color,this.workingColorSpace,targetColorSpace)},toWorkingColorSpace:function(color,sourceColorSpace){return this.convert(color,sourceColorSpace,this.workingColorSpace)}},_colorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_rgb={r:0,g:0,b:0},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(p,q,t){return(t<0&&(t+=1),t>1&&(t-=1),t<1/6)?p+(q-p)*6*t:t<.5?q:t<2/3?p+(q-p)*6*(2/3-t):p}function toComponents(source,target){return target.r=source.r,target.g=source.g,target.b=source.b,target}class Color{constructor(r,g,b){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===g&&void 0===b)return this.set(r);return this.setRGB(r,g,b)}set(value){return value&&value.isColor?this.copy(value):"number"==typeof value?this.setHex(value):"string"==typeof value&&this.setStyle(value),this}setScalar(scalar){return this.r=scalar,this.g=scalar,this.b=scalar,this}setHex(hex,colorSpace1=SRGBColorSpace){return hex=Math.floor(hex),this.r=(hex>>16&255)/255,this.g=(hex>>8&255)/255,this.b=(255&hex)/255,ColorManagement.toWorkingColorSpace(this,colorSpace1),this}setRGB(r,g,b,colorSpace1=LinearSRGBColorSpace){return this.r=r,this.g=g,this.b=b,ColorManagement.toWorkingColorSpace(this,colorSpace1),this}setHSL(h,s,l,colorSpace1=LinearSRGBColorSpace){if(h=euclideanModulo(h,1),s=clamp(s,0,1),l=clamp(l,0,1),0===s)this.r=this.g=this.b=l;else{let p=l<=.5?l*(1+s):l+s-l*s,q=2*l-p;this.r=hue2rgb(q,p,h+1/3),this.g=hue2rgb(q,p,h),this.b=hue2rgb(q,p,h-1/3)}return ColorManagement.toWorkingColorSpace(this,colorSpace1),this}setStyle(style,colorSpace1=SRGBColorSpace){let m;function handleAlpha(string){void 0!==string&&1>parseFloat(string)&&console.warn("THREE.Color: Alpha component of "+style+" will be ignored.")}if(m=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)){let color;let name=m[1],components=m[2];switch(name){case"rgb":case"rgba":if(color=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components))return this.r=Math.min(255,parseInt(color[1],10))/255,this.g=Math.min(255,parseInt(color[2],10))/255,this.b=Math.min(255,parseInt(color[3],10))/255,ColorManagement.toWorkingColorSpace(this,colorSpace1),handleAlpha(color[4]),this;if(color=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components))return this.r=Math.min(100,parseInt(color[1],10))/100,this.g=Math.min(100,parseInt(color[2],10))/100,this.b=Math.min(100,parseInt(color[3],10))/100,ColorManagement.toWorkingColorSpace(this,colorSpace1),handleAlpha(color[4]),this;break;case"hsl":case"hsla":if(color=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)){let h=parseFloat(color[1])/360,s=parseFloat(color[2])/100,l=parseFloat(color[3])/100;return handleAlpha(color[4]),this.setHSL(h,s,l,colorSpace1)}}}else if(m=/^\#([A-Fa-f\d]+)$/.exec(style)){let hex=m[1],size=hex.length;if(3===size)return this.r=parseInt(hex.charAt(0)+hex.charAt(0),16)/255,this.g=parseInt(hex.charAt(1)+hex.charAt(1),16)/255,this.b=parseInt(hex.charAt(2)+hex.charAt(2),16)/255,ColorManagement.toWorkingColorSpace(this,colorSpace1),this;if(6===size)return this.r=parseInt(hex.charAt(0)+hex.charAt(1),16)/255,this.g=parseInt(hex.charAt(2)+hex.charAt(3),16)/255,this.b=parseInt(hex.charAt(4)+hex.charAt(5),16)/255,ColorManagement.toWorkingColorSpace(this,colorSpace1),this}return style&&style.length>0?this.setColorName(style,colorSpace1):this}setColorName(style,colorSpace1=SRGBColorSpace){let hex=_colorKeywords[style.toLowerCase()];return void 0!==hex?this.setHex(hex,colorSpace1):console.warn("THREE.Color: Unknown color "+style),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(color){return this.r=color.r,this.g=color.g,this.b=color.b,this}copySRGBToLinear(color){return this.r=SRGBToLinear(color.r),this.g=SRGBToLinear(color.g),this.b=SRGBToLinear(color.b),this}copyLinearToSRGB(color){return this.r=LinearToSRGB(color.r),this.g=LinearToSRGB(color.g),this.b=LinearToSRGB(color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(colorSpace1=SRGBColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb),colorSpace1),clamp(255*_rgb.r,0,255)<<16^clamp(255*_rgb.g,0,255)<<8^clamp(255*_rgb.b,0,255)<<0}getHexString(colorSpace1=SRGBColorSpace){return("000000"+this.getHex(colorSpace1).toString(16)).slice(-6)}getHSL(target,colorSpace1=LinearSRGBColorSpace){let hue,saturation;ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb),colorSpace1);let r=_rgb.r,g=_rgb.g,b=_rgb.b,max=Math.max(r,g,b),min=Math.min(r,g,b),lightness=(min+max)/2;if(min===max)hue=0,saturation=0;else{let delta=max-min;switch(saturation=lightness<=.5?delta/(max+min):delta/(2-max-min),max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4}hue/=6}return target.h=hue,target.s=saturation,target.l=lightness,target}getRGB(target,colorSpace1=LinearSRGBColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb),colorSpace1),target.r=_rgb.r,target.g=_rgb.g,target.b=_rgb.b,target}getStyle(colorSpace1=SRGBColorSpace){return(ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb),colorSpace1),colorSpace1!==SRGBColorSpace)?`color(${colorSpace1} ${_rgb.r} ${_rgb.g} ${_rgb.b})`:`rgb(${255*_rgb.r|0},${255*_rgb.g|0},${255*_rgb.b|0})`}offsetHSL(h,s,l){return this.getHSL(_hslA),_hslA.h+=h,_hslA.s+=s,_hslA.l+=l,this.setHSL(_hslA.h,_hslA.s,_hslA.l),this}add(color){return this.r+=color.r,this.g+=color.g,this.b+=color.b,this}addColors(color1,color2){return this.r=color1.r+color2.r,this.g=color1.g+color2.g,this.b=color1.b+color2.b,this}addScalar(s){return this.r+=s,this.g+=s,this.b+=s,this}sub(color){return this.r=Math.max(0,this.r-color.r),this.g=Math.max(0,this.g-color.g),this.b=Math.max(0,this.b-color.b),this}multiply(color){return this.r*=color.r,this.g*=color.g,this.b*=color.b,this}multiplyScalar(s){return this.r*=s,this.g*=s,this.b*=s,this}lerp(color,alpha){return this.r+=(color.r-this.r)*alpha,this.g+=(color.g-this.g)*alpha,this.b+=(color.b-this.b)*alpha,this}lerpColors(color1,color2,alpha){return this.r=color1.r+(color2.r-color1.r)*alpha,this.g=color1.g+(color2.g-color1.g)*alpha,this.b=color1.b+(color2.b-color1.b)*alpha,this}lerpHSL(color,alpha){this.getHSL(_hslA),color.getHSL(_hslB);let h=lerp(_hslA.h,_hslB.h,alpha),s=lerp(_hslA.s,_hslB.s,alpha),l=lerp(_hslA.l,_hslB.l,alpha);return this.setHSL(h,s,l),this}equals(c){return c.r===this.r&&c.g===this.g&&c.b===this.b}fromArray(array,offset=0){return this.r=array[offset],this.g=array[offset+1],this.b=array[offset+2],this}toArray(array=[],offset=0){return array[offset]=this.r,array[offset+1]=this.g,array[offset+2]=this.b,array}fromBufferAttribute(attribute,index){return this.r=attribute.getX(index),this.g=attribute.getY(index),this.b=attribute.getZ(index),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Color.NAMES=_colorKeywords;class ImageUtils{static getDataURL(image){let canvas;if(/^data:/i.test(image.src)||"undefined"==typeof HTMLCanvasElement)return image.src;if(image instanceof HTMLCanvasElement)canvas=image;else{void 0===_canvas&&(_canvas=createElementNS("canvas")),_canvas.width=image.width,_canvas.height=image.height;let context=_canvas.getContext("2d");image instanceof ImageData?context.putImageData(image,0,0):context.drawImage(image,0,0,image.width,image.height),canvas=_canvas}return canvas.width>2048||canvas.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",image),canvas.toDataURL("image/jpeg",.6)):canvas.toDataURL("image/png")}static sRGBToLinear(image){if("undefined"!=typeof HTMLImageElement&&image instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&image instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&image instanceof ImageBitmap){let canvas=createElementNS("canvas");canvas.width=image.width,canvas.height=image.height;let context=canvas.getContext("2d");context.drawImage(image,0,0,image.width,image.height);let imageData=context.getImageData(0,0,image.width,image.height),data=imageData.data;for(let i=0;i<data.length;i++)data[i]=255*SRGBToLinear(data[i]/255);return context.putImageData(imageData,0,0),canvas}if(!image.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),image;{let data1=image.data.slice(0);for(let i1=0;i1<data1.length;i1++)data1 instanceof Uint8Array||data1 instanceof Uint8ClampedArray?data1[i1]=Math.floor(255*SRGBToLinear(data1[i1]/255)):data1[i1]=SRGBToLinear(data1[i1]);return{data:data1,width:image.width,height:image.height}}}}class Source{constructor(data=null){this.isSource=!0,this.uuid=generateUUID(),this.data=data,this.version=0}set needsUpdate(value){!0===value&&this.version++}toJSON(meta){let isRootObject=void 0===meta||"string"==typeof meta;if(!isRootObject&&void 0!==meta.images[this.uuid])return meta.images[this.uuid];let output={uuid:this.uuid,url:""},data=this.data;if(null!==data){let url;if(Array.isArray(data)){url=[];for(let i=0,l=data.length;i<l;i++)data[i].isDataTexture?url.push(serializeImage(data[i].image)):url.push(serializeImage(data[i]))}else url=serializeImage(data);output.url=url}return isRootObject||(meta.images[this.uuid]=output),output}}function serializeImage(image){return"undefined"!=typeof HTMLImageElement&&image instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&image instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&image instanceof ImageBitmap?ImageUtils.getDataURL(image):image.data?{data:Array.from(image.data),width:image.width,height:image.height,type:image.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let textureId=0;class Texture extends EventDispatcher{constructor(image=Texture.DEFAULT_IMAGE,mapping=Texture.DEFAULT_MAPPING,wrapS=ClampToEdgeWrapping,wrapT=ClampToEdgeWrapping,magFilter=LinearFilter,minFilter=LinearMipmapLinearFilter,format=RGBAFormat,type=UnsignedByteType,anisotropy=1,encoding=LinearEncoding){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:textureId++}),this.uuid=generateUUID(),this.name="",this.source=new Source(image),this.mipmaps=[],this.mapping=mapping,this.wrapS=wrapS,this.wrapT=wrapT,this.magFilter=magFilter,this.minFilter=minFilter,this.anisotropy=anisotropy,this.format=format,this.internalFormat=null,this.type=type,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=encoding,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(value){this.source.data=value}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(source){return this.name=source.name,this.source=source.source,this.mipmaps=source.mipmaps.slice(0),this.mapping=source.mapping,this.wrapS=source.wrapS,this.wrapT=source.wrapT,this.magFilter=source.magFilter,this.minFilter=source.minFilter,this.anisotropy=source.anisotropy,this.format=source.format,this.internalFormat=source.internalFormat,this.type=source.type,this.offset.copy(source.offset),this.repeat.copy(source.repeat),this.center.copy(source.center),this.rotation=source.rotation,this.matrixAutoUpdate=source.matrixAutoUpdate,this.matrix.copy(source.matrix),this.generateMipmaps=source.generateMipmaps,this.premultiplyAlpha=source.premultiplyAlpha,this.flipY=source.flipY,this.unpackAlignment=source.unpackAlignment,this.encoding=source.encoding,this.userData=JSON.parse(JSON.stringify(source.userData)),this.needsUpdate=!0,this}toJSON(meta){let isRootObject=void 0===meta||"string"==typeof meta;
1if(!isRootObject&&void 0!==meta.textures[this.uuid])return meta.textures[this.uuid];let output={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(meta).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return"{}"!==JSON.stringify(this.userData)&&(output.userData=this.userData),isRootObject||(meta.textures[this.uuid]=output),output}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(uv){if(300!==this.mapping)return uv;if(uv.applyMatrix3(this.matrix),uv.x<0||uv.x>1)switch(this.wrapS){case RepeatWrapping:uv.x=uv.x-Math.floor(uv.x);break;case ClampToEdgeWrapping:uv.x=uv.x<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(uv.x)%2)?uv.x=Math.ceil(uv.x)-uv.x:uv.x=uv.x-Math.floor(uv.x)}if(uv.y<0||uv.y>1)switch(this.wrapT){case RepeatWrapping:uv.y=uv.y-Math.floor(uv.y);break;case ClampToEdgeWrapping:uv.y=uv.y<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(uv.y)%2)?uv.y=Math.ceil(uv.y)-uv.y:uv.y=uv.y-Math.floor(uv.y)}return this.flipY&&(uv.y=1-uv.y),uv}set needsUpdate(value){!0===value&&(this.version++,this.source.needsUpdate=!0)}}Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300;class Vector4{constructor(x=0,y=0,z=0,w=1){Vector4.prototype.isVector4=!0,this.x=x,this.y=y,this.z=z,this.w=w}get width(){return this.z}set width(value){this.z=value}get height(){return this.w}set height(value){this.w=value}set(x,y,z,w){return this.x=x,this.y=y,this.z=z,this.w=w,this}setScalar(scalar){return this.x=scalar,this.y=scalar,this.z=scalar,this.w=scalar,this}setX(x){return this.x=x,this}setY(y){return this.y=y,this}setZ(z){return this.z=z,this}setW(w){return this.w=w,this}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw Error("index is out of range: "+index)}return this}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+index)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(v){return this.x=v.x,this.y=v.y,this.z=v.z,this.w=void 0!==v.w?v.w:1,this}add(v){return this.x+=v.x,this.y+=v.y,this.z+=v.z,this.w+=v.w,this}addScalar(s){return this.x+=s,this.y+=s,this.z+=s,this.w+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this}addScaledVector(v,s){return this.x+=v.x*s,this.y+=v.y*s,this.z+=v.z*s,this.w+=v.w*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this.z-=v.z,this.w-=v.w,this}subScalar(s){return this.x-=s,this.y-=s,this.z-=s,this.w-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this.w=a.w-b.w,this}multiply(v){return this.x*=v.x,this.y*=v.y,this.z*=v.z,this.w*=v.w,this}multiplyScalar(scalar){return this.x*=scalar,this.y*=scalar,this.z*=scalar,this.w*=scalar,this}applyMatrix4(m){let x=this.x,y=this.y,z=this.z,w=this.w,e=m.elements;return this.x=e[0]*x+e[4]*y+e[8]*z+e[12]*w,this.y=e[1]*x+e[5]*y+e[9]*z+e[13]*w,this.z=e[2]*x+e[6]*y+e[10]*z+e[14]*w,this.w=e[3]*x+e[7]*y+e[11]*z+e[15]*w,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}setAxisAngleFromQuaternion(q){this.w=2*Math.acos(q.w);let s=Math.sqrt(1-q.w*q.w);return s<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=q.x/s,this.y=q.y/s,this.z=q.z/s),this}setAxisAngleFromRotationMatrix(m){let x,y,z;let te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(.01>Math.abs(m12-m21)&&.01>Math.abs(m13-m31)&&.01>Math.abs(m23-m32)){if(.1>Math.abs(m12+m21)&&.1>Math.abs(m13+m31)&&.1>Math.abs(m23+m32)&&.1>Math.abs(m11+m22+m33-3))return this.set(1,0,0,0),this;let xx=(m11+1)/2,yy=(m22+1)/2,zz=(m33+1)/2,xy=(m12+m21)/4,xz=(m13+m31)/4,yz=(m23+m32)/4;return xx>yy&&xx>zz?xx<.01?(x=0,y=.707106781,z=.707106781):(y=xy/(x=Math.sqrt(xx)),z=xz/x):yy>zz?yy<.01?(x=.707106781,y=0,z=.707106781):(x=xy/(y=Math.sqrt(yy)),z=yz/y):zz<.01?(
vendor: 6,165 bytes, line 1
1x=.707106781,y=.707106781,z=0):(x=xz/(z=Math.sqrt(zz)),y=yz/z),this.set(x,y,z,Math.PI),this}let s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));return .001>Math.abs(s)&&(s=1),this.x=(m32-m23)/s,this.y=(m13-m31)/s,this.z=(m21-m12)/s,this.w=Math.acos((m11+m22+m33-1)/2),this}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min(this.y,v.y),this.z=Math.min(this.z,v.z),this.w=Math.min(this.w,v.w),this}max(v){return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y),this.z=Math.max(this.z,v.z),this.w=Math.max(this.w,v.w),this}clamp(min,max){return this.x=Math.max(min.x,Math.min(max.x,this.x)),this.y=Math.max(min.y,Math.min(max.y,this.y)),this.z=Math.max(min.z,Math.min(max.z,this.z)),this.w=Math.max(min.w,Math.min(max.w,this.w)),this}clampScalar(minVal,maxVal){return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math.min(maxVal,this.y)),this.z=Math.max(minVal,Math.min(maxVal,this.z)),this.w=Math.max(minVal,Math.min(maxVal,this.w)),this}clampLength(min,max){let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this.z+=(v.z-this.z)*alpha,this.w+=(v.w-this.w)*alpha,this}lerpVectors(v1,v2,alpha){return this.x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha,this.w=v1.w+(v2.w-v1.w)*alpha,this}equals(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this.w}fromArray(array,offset=0){return this.x=array[offset],this.y=array[offset+1],this.z=array[offset+2],this.w=array[offset+3],this}toArray(array=[],offset=0){return array[offset]=this.x,array[offset+1]=this.y,array[offset+2]=this.z,array[offset+3]=this.w,array}fromBufferAttribute(attribute,index){return this.x=attribute.getX(index),this.y=attribute.getY(index),this.z=attribute.getZ(index),this.w=attribute.getW(index),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class WebGLRenderTarget extends EventDispatcher{constructor(width=1,height=1,options={}){super(),this.isWebGLRenderTarget=!0,this.width=width,this.height=height,this.depth=1,this.scissor=new Vector4(0,0,width,height),this.scissorTest=!1,this.viewport=new Vector4(0,0,width,height),this.texture=new Texture({width:width,height:height,depth:1},options.mapping,options.wrapS,options.wrapT,options.magFilter,options.minFilter,options.format,options.type,options.anisotropy,options.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==options.generateMipmaps&&options.generateMipmaps,this.texture.internalFormat=void 0!==options.internalFormat?options.internalFormat:null,this.texture.minFilter=void 0!==options.minFilter?options.minFilter:LinearFilter,this.depthBuffer=void 0===options.depthBuffer||options.depthBuffer,this.stencilBuffer=void 0!==options.stencilBuffer&&options.stencilBuffer,this.depthTexture=void 0!==options.depthTexture?options.depthTexture:null,this.samples=void 0!==options.samples?options.samples:0}setSize(width,height,depth=1){(this.width!==width||this.height!==height||this.depth!==depth)&&(this.width=width,this.height=height,this.depth=depth,this.texture.image.width=width,this.texture.image.height=height,this.texture.image.depth=depth,this.dispose()),this.viewport.set(0,0,width,height),this.scissor.set(0,0,width,height)}clone(){return new this.constructor().copy(this)}copy(source){this.width=source.width,this.height=source.height,this.depth=source.depth,this.viewport.copy(source.viewport),this.texture=source.texture.clone(),this.texture.isRenderTargetTexture=!0;let image=Object.assign({},source.texture.image);return this.texture.source=new Source(image),this.depthBuffer=source.depthBuffer,this.stencilBuffer=source.stencilBuffer,null!==source.depthTexture&&(this.depthTexture=source.depthTexture.clone()),this.samples=source.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class DataArrayTexture extends Texture{constructor(data=null,width=1,height=1,depth=1){super(null),this.isDataArrayTexture=!0,this.image={data,width,height,depth},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Data3DTexture extends Texture{constructor(data=null,width=1,height=1,depth=1){super(null),this.isData3DTexture=!0,this.image={data,width,height,depth},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Quaternion{constructor(x=0,y=0,z=0,w=1){this.isQuaternion=!0,this._x=x,this._y=y,this._z=z,this._w=w}static slerpFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1,t){let x0=src0[srcOffset0+0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+3],x1=src1[srcOffset1+0],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+3];
vendor: 4,232 bytes, line 1
1if(0===t){dst[dstOffset+0]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+3]=w0;return}if(1===t){dst[dstOffset+0]=x1,dst[dstOffset+1]=y1,dst[dstOffset+2]=z1,dst[dstOffset+3]=w1;return}if(w0!==w1||x0!==x1||y0!==y1||z0!==z1){let s=1-t,cos=x0*x1+y0*y1+z0*z1+w0*w1,dir=cos>=0?1:-1,sqrSin=1-cos*cos;if(sqrSin>Number.EPSILON){let sin=Math.sqrt(sqrSin),len=Math.atan2(sin,cos*dir);s=Math.sin(s*len)/sin,t=Math.sin(t*len)/sin}let tDir=t*dir;if(x0=x0*s+x1*tDir,y0=y0*s+y1*tDir,z0=z0*s+z1*tDir,w0=w0*s+w1*tDir,s===1-t){let f=1/Math.sqrt(x0*x0+y0*y0+z0*z0+w0*w0);x0*=f,y0*=f,z0*=f,w0*=f}}dst[dstOffset]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+3]=w0}static multiplyQuaternionsFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1){let x0=src0[srcOffset0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+3],x1=src1[srcOffset1],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+3];return dst[dstOffset]=x0*w1+w0*x1+y0*z1-z0*y1,dst[dstOffset+1]=y0*w1+w0*y1+z0*x1-x0*z1,dst[dstOffset+2]=z0*w1+w0*z1+x0*y1-y0*x1,dst[dstOffset+3]=w0*w1-x0*x1-y0*y1-z0*z1,dst}get x(){return this._x}set x(value){this._x=value,this._onChangeCallback()}get y(){return this._y}set y(value){this._y=value,this._onChangeCallback()}get z(){return this._z}set z(value){this._z=value,this._onChangeCallback()}get w(){return this._w}set w(value){this._w=value,this._onChangeCallback()}set(x,y,z,w){return this._x=x,this._y=y,this._z=z,this._w=w,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(quaternion){return this._x=quaternion.x,this._y=quaternion.y,this._z=quaternion.z,this._w=quaternion.w,this._onChangeCallback(),this}setFromEuler(euler,update){let x=euler._x,y=euler._y,z=euler._z,order=euler._order,cos=Math.cos,sin=Math.sin,c1=cos(x/2),c2=cos(y/2),c3=cos(z/2),s1=sin(x/2),s2=sin(y/2),s3=sin(z/2);switch(order){case"XYZ":this._x=s1*c2*c3+c1*s2*s3,this._y=c1*s2*c3-s1*c2*s3,this._z=c1*c2*s3+s1*s2*c3,this._w=c1*c2*c3-s1*s2*s3;break;case"YXZ":this._x=s1*c2*c3+c1*s2*s3,this._y=c1*s2*c3-s1*c2*s3,this._z=c1*c2*s3-s1*s2*c3,this._w=c1*c2*c3+s1*s2*s3;break;case"ZXY":this._x=s1*c2*c3-c1*s2*s3,this._y=c1*s2*c3+s1*c2*s3,this._z=c1*c2*s3+s1*s2*c3,this._w=c1*c2*c3-s1*s2*s3;break;case"ZYX":this._x=s1*c2*c3-c1*s2*s3,this._y=c1*s2*c3+s1*c2*s3,this._z=c1*c2*s3-s1*s2*c3,this._w=c1*c2*c3+s1*s2*s3;break;case"YZX":this._x=s1*c2*c3+c1*s2*s3,this._y=c1*s2*c3+s1*c2*s3,this._z=c1*c2*s3-s1*s2*c3,this._w=c1*c2*c3-s1*s2*s3;break;case"XZY":this._x=s1*c2*c3-c1*s2*s3,this._y=c1*s2*c3-s1*c2*s3,this._z=c1*c2*s3+s1*s2*c3,this._w=c1*c2*c3+s1*s2*s3;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+order)}return!1!==update&&this._onChangeCallback(),this}setFromAxisAngle(axis,angle){let halfAngle=angle/2,s=Math.sin(halfAngle);return this._x=axis.x*s,this._y=axis.y*s,this._z=axis.z*s,this._w=Math.cos(halfAngle),this._onChangeCallback(),this}setFromRotationMatrix(m){let te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33;if(trace>0){let s=.5/Math.sqrt(trace+1);this._w=.25/s,this._x=(m32-m23)*s,this._y=(m13-m31)*s,this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){let s1=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s1,this._x=.25*s1,this._y=(m12+m21)/s1,this._z=(m13+m31)/s1}else if(m22>m33){let s2=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s2,this._x=(m12+m21)/s2,this._y=.25*s2,this._z=(m23+m32)/s2}else{let s3=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s3,this._x=(m13+m31)/s3,this._y=(m23+m32)/s3,this._z=.25*s3}return this._onChangeCallback(),this}setFromUnitVectors(vFrom,vTo){let r=vFrom.dot(vTo)+1;return r<Number.EPSILON?(r=0,Math.abs(vFrom.x)>Math.abs(vFrom.z)?(this._x=-vFrom.y,this._y=vFrom.x,this._z=0,this._w=r):(this._x=0,this._y=-vFrom.z,this._z=vFrom.y,this._w=r)):(this._x=vFrom.y*vTo.z-vFrom.z*vTo.y,this._y=vFrom.z*vTo.x-vFrom.x*vTo.z,this._z=vFrom.x*vTo.y-vFrom.y*vTo.x,this._w=r),this.normalize()}angleTo(q){return 2*Math.acos(Math.abs(clamp(this.dot(q),-1,1)))}rotateTowards(q,step){let angle=this.angleTo(q);return 0===angle||this.slerp(q,Math.min(1,step/angle)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
vendor: 6,604 bytes, line 1
1conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let l=this.length();return 0===l?(this._x=0,this._y=0,this._z=0,this._w=1):(l=1/l,this._x=this._x*l,this._y=this._y*l,this._z=this._z*l,this._w=this._w*l),this._onChangeCallback(),this}multiply(q){return this.multiplyQuaternions(this,q)}premultiply(q){return this.multiplyQuaternions(q,this)}multiplyQuaternions(a,b){let qax=a._x,qay=a._y,qaz=a._z,qaw=a._w,qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;return this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby,this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz,this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx,this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz,this._onChangeCallback(),this}slerp(qb,t){if(0===t)return this;if(1===t)return this.copy(qb);let x=this._x,y=this._y,z=this._z,w=this._w,cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0?(this._w=-qb._w,this._x=-qb._x,this._y=-qb._y,this._z=-qb._z,cosHalfTheta=-cosHalfTheta):this.copy(qb),cosHalfTheta>=1)return this._w=w,this._x=x,this._y=y,this._z=z,this;let sqrSinHalfTheta=1-cosHalfTheta*cosHalfTheta;if(sqrSinHalfTheta<=Number.EPSILON){let s=1-t;return this._w=s*w+t*this._w,this._x=s*x+t*this._x,this._y=s*y+t*this._y,this._z=s*z+t*this._z,this.normalize(),this._onChangeCallback(),this}let sinHalfTheta=Math.sqrt(sqrSinHalfTheta),halfTheta=Math.atan2(sinHalfTheta,cosHalfTheta),ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;return this._w=w*ratioA+this._w*ratioB,this._x=x*ratioA+this._x*ratioB,this._y=y*ratioA+this._y*ratioB,this._z=z*ratioA+this._z*ratioB,this._onChangeCallback(),this}slerpQuaternions(qa,qb,t){return this.copy(qa).slerp(qb,t)}random(){let u1=Math.random(),sqrt1u1=Math.sqrt(1-u1),sqrtu1=Math.sqrt(u1),u2=2*Math.PI*Math.random(),u3=2*Math.PI*Math.random();return this.set(sqrt1u1*Math.cos(u2),sqrtu1*Math.sin(u3),sqrtu1*Math.cos(u3),sqrt1u1*Math.sin(u2))}equals(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w}fromArray(array,offset=0){return this._x=array[offset],this._y=array[offset+1],this._z=array[offset+2],this._w=array[offset+3],this._onChangeCallback(),this}toArray(array=[],offset=0){return array[offset]=this._x,array[offset+1]=this._y,array[offset+2]=this._z,array[offset+3]=this._w,array}fromBufferAttribute(attribute,index){return this._x=attribute.getX(index),this._y=attribute.getY(index),this._z=attribute.getZ(index),this._w=attribute.getW(index),this}_onChange(callback){return this._onChangeCallback=callback,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3{constructor(x=0,y=0,z=0){Vector3.prototype.isVector3=!0,this.x=x,this.y=y,this.z=z}set(x,y,z){return void 0===z&&(z=this.z),this.x=x,this.y=y,this.z=z,this}setScalar(scalar){return this.x=scalar,this.y=scalar,this.z=scalar,this}setX(x){return this.x=x,this}setY(y){return this.y=y,this}setZ(z){return this.z=z,this}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw Error("index is out of range: "+index)}return this}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+index)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(v){return this.x=v.x,this.y=v.y,this.z=v.z,this}add(v){return this.x+=v.x,this.y+=v.y,this.z+=v.z,this}addScalar(s){return this.x+=s,this.y+=s,this.z+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this}addScaledVector(v,s){return this.x+=v.x*s,this.y+=v.y*s,this.z+=v.z*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this.z-=v.z,this}subScalar(s){return this.x-=s,this.y-=s,this.z-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this}multiply(v){return this.x*=v.x,this.y*=v.y,this.z*=v.z,this}multiplyScalar(scalar){return this.x*=scalar,this.y*=scalar,this.z*=scalar,this}multiplyVectors(a,b){return this.x=a.x*b.x,this.y=a.y*b.y,this.z=a.z*b.z,this}applyEuler(euler){return this.applyQuaternion(_quaternion$4.setFromEuler(euler))}applyAxisAngle(axis,angle){return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis,angle))}applyMatrix3(m){let x=this.x,y=this.y,z=this.z,e=m.elements;return this.x=e[0]*x+e[3]*y+e[6]*z,this.y=e[1]*x+e[4]*y+e[7]*z,this.z=e[2]*x+e[5]*y+e[8]*z,this}applyNormalMatrix(m){return this.applyMatrix3(m).normalize()}applyMatrix4(m){let x=this.x,y=this.y,z=this.z,e=m.elements,w=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);return this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*w,this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*w,this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*w,this}applyQuaternion(q){let x=this.x,y=this.y,z=this.z,qx=q.x,qy=q.y,qz=q.z,qw=q.w,ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;return this.x=ix*qw+-(iw*qx)+-(iy*qz)- -(iz*qy),this.y=iy*qw+-(iw*qy)+-(iz*qx)- -(ix*qz),this.z=iz*qw+-(iw*qz)+-(ix*qy)- -(iy*qx),this}project(camera){return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix)}unproject(camera){return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld)}transformDirection(m){let x=this.x,y=this.y,z=this.z,e=m.elements;return this.x=e[0]*x+e[4]*y+e[8]*z,this.y=e[1]*x+e[5]*y+e[9]*z,this.z=e[2]*x+e[6]*y+e[10]*z,this.normalize()}divide(v){return this.x/=v.x,this.y/=v.y,this.z/=v.z,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min(this.y,v.y),this.z=Math.min(this.z,v.z),this}max(v){return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y),this.z=Math.max(this.z,v.z),this}clamp(min,max){return this.x=Math.max(min.x,Math.min(max.x,this.x)),this.y=Math.max(min.y,Math.min(max.y,this.y)),this.z=Math.max(min.z,Math.min(max.z,this.z)),this}clampScalar(minVal,maxVal){return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math.min(maxVal,this.y)),this.z=Math.max(minVal,Math.min(maxVal,this.z)),this}clampLength(min,max){let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}
vendor: 6,432 bytes, line 1
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this.z+=(v.z-this.z)*alpha,this}lerpVectors(v1,v2,alpha){return this.x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha,this}cross(v){return this.crossVectors(this,v)}crossVectors(a,b){let ax=a.x,ay=a.y,az=a.z,bx=b.x,by=b.y,bz=b.z;return this.x=ay*bz-az*by,this.y=az*bx-ax*bz,this.z=ax*by-ay*bx,this}projectOnVector(v){let denominator=v.lengthSq();if(0===denominator)return this.set(0,0,0);let scalar=v.dot(this)/denominator;return this.copy(v).multiplyScalar(scalar)}projectOnPlane(planeNormal){return _vector$c.copy(this).projectOnVector(planeNormal),this.sub(_vector$c)}reflect(normal){return this.sub(_vector$c.copy(normal).multiplyScalar(2*this.dot(normal)))}angleTo(v){let denominator=Math.sqrt(this.lengthSq()*v.lengthSq());if(0===denominator)return Math.PI/2;let theta=this.dot(v)/denominator;return Math.acos(clamp(theta,-1,1))}distanceTo(v){return Math.sqrt(this.distanceToSquared(v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y-v.y,dz=this.z-v.z;return dx*dx+dy*dy+dz*dz}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs(this.y-v.y)+Math.abs(this.z-v.z)}setFromSpherical(s){return this.setFromSphericalCoords(s.radius,s.phi,s.theta)}setFromSphericalCoords(radius,phi,theta){let sinPhiRadius=Math.sin(phi)*radius;return this.x=sinPhiRadius*Math.sin(theta),this.y=Math.cos(phi)*radius,this.z=sinPhiRadius*Math.cos(theta),this}setFromCylindrical(c){return this.setFromCylindricalCoords(c.radius,c.theta,c.y)}setFromCylindricalCoords(radius,theta,y){return this.x=radius*Math.sin(theta),this.y=y,this.z=radius*Math.cos(theta),this}setFromMatrixPosition(m){let e=m.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(m){let sx=this.setFromMatrixColumn(m,0).length(),sy=this.setFromMatrixColumn(m,1).length(),sz=this.setFromMatrixColumn(m,2).length();return this.x=sx,this.y=sy,this.z=sz,this}setFromMatrixColumn(m,index){return this.fromArray(m.elements,4*index)}setFromMatrix3Column(m,index){return this.fromArray(m.elements,3*index)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(v){return v.x===this.x&&v.y===this.y&&v.z===this.z}fromArray(array,offset=0){return this.x=array[offset],this.y=array[offset+1],this.z=array[offset+2],this}toArray(array=[],offset=0){return array[offset]=this.x,array[offset+1]=this.y,array[offset+2]=this.z,array}fromBufferAttribute(attribute,index){return this.x=attribute.getX(index),this.y=attribute.getY(index),this.z=attribute.getZ(index),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let u=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,f=Math.sqrt(1-u**2);return this.x=f*Math.cos(t),this.y=f*Math.sin(t),this.z=u,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let _vector$c=new Vector3,_quaternion$4=new Quaternion;class Box3{constructor(min=new Vector3(Infinity,Infinity,Infinity),max=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=min,this.max=max}set(min,max){return this.min.copy(min),this.max.copy(max),this}setFromArray(array){let minX=Infinity,minY=Infinity,minZ=Infinity,maxX=-1/0,maxY=-1/0,maxZ=-1/0;for(let i=0,l=array.length;i<l;i+=3){let x=array[i],y=array[i+1],z=array[i+2];x<minX&&(minX=x),y<minY&&(minY=y),z<minZ&&(minZ=z),x>maxX&&(maxX=x),y>maxY&&(maxY=y),z>maxZ&&(maxZ=z)}return this.min.set(minX,minY,minZ),this.max.set(maxX,maxY,maxZ),this}setFromBufferAttribute(attribute){let minX=Infinity,minY=Infinity,minZ=Infinity,maxX=-1/0,maxY=-1/0,maxZ=-1/0;for(let i=0,l=attribute.count;i<l;i++){let x=attribute.getX(i),y=attribute.getY(i),z=attribute.getZ(i);x<minX&&(minX=x),y<minY&&(minY=y),z<minZ&&(minZ=z),x>maxX&&(maxX=x),y>maxY&&(maxY=y),z>maxZ&&(maxZ=z)}return this.min.set(minX,minY,minZ),this.max.set(maxX,maxY,maxZ),this}setFromPoints(points){this.makeEmpty();for(let i=0,il=points.length;i<il;i++)this.expandByPoint(points[i]);return this}setFromCenterAndSize(center,size){let halfSize=_vector$b.copy(size).multiplyScalar(.5);return this.min.copy(center).sub(halfSize),this.max.copy(center).add(halfSize),this}setFromObject(object,precise=!1){return this.makeEmpty(),this.expandByObject(object,precise)}clone(){return new this.constructor().copy(this)}copy(box){return this.min.copy(box.min),this.max.copy(box.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(target){return this.isEmpty()?target.set(0,0,0):target.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(target){return this.isEmpty()?target.set(0,0,0):target.subVectors(this.max,this.min)}expandByPoint(point){return this.min.min(point),this.max.max(point),this}expandByVector(vector){return this.min.sub(vector),this.max.add(vector),this}expandByScalar(scalar){return this.min.addScalar(-scalar),this.max.addScalar(scalar),this}expandByObject(object,precise=!1){object.updateWorldMatrix(!1,!1);let geometry=object.geometry;if(void 0!==geometry){if(precise&&void 0!=geometry.attributes&&void 0!==geometry.attributes.position){let position=geometry.attributes.position;for(let i=0,l=position.count;i<l;i++)_vector$b.fromBufferAttribute(position,i).applyMatrix4(object.matrixWorld),this.expandByPoint(_vector$b)}else null===geometry.boundingBox&&geometry.computeBoundingBox(),_box$3.copy(geometry.boundingBox),_box$3.applyMatrix4(object.matrixWorld),this.union(_box$3)}let children=object.children;for(let i1=0,l1=children.length;i1<l1;i1++)this.expandByObject(children[i1],precise);return this}containsPoint(point){return!(point.x<this.min.x)&&!(point.x>
1this.max.x)&&!(point.y<this.min.y)&&!(point.y>this.max.y)&&!(point.z<this.min.z)&&!(point.z>this.max.z)}containsBox(box){return this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<=box.min.z&&box.max.z<=this.max.z}getParameter(point,target){return target.set((point.x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min.y),(point.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(box){return!(box.max.x<this.min.x)&&!(box.min.x>this.max.x)&&!(box.max.y<this.min.y)&&!(box.min.y>this.max.y)&&!(box.max.z<this.min.z)&&!(box.min.z>this.max.z)}intersectsSphere(sphere){return this.clampPoint(sphere.center,_vector$b),_vector$b.distanceToSquared(sphere.center)<=sphere.radius*sphere.radius}intersectsPlane(plane){let min,max;return plane.normal.x>0?(min=plane.normal.x*this.min.x,max=plane.normal.x*this.max.x):(min=plane.normal.x*this.max.x,max=plane.normal.x*this.min.x),plane.normal.y>0?(min+=plane.normal.y*this.min.y,max+=plane.normal.y*this.max.y):(min+=plane.normal.y*this.max.y,max+=plane.normal.y*this.min.y),plane.normal.z>0?(min+=plane.normal.z*this.min.z,max+=plane.normal.z*this.max.z):(min+=plane.normal.z*this.max.z,max+=plane.normal.z*this.min.z),min<=-plane.constant&&max>=-plane.constant}intersectsTriangle(triangle){if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max,_center),_v0$2.subVectors(triangle.a,_center),_v1$7.subVectors(triangle.b,_center),_v2$4.subVectors(triangle.c,_center),_f0.subVectors(_v1$7,_v0$2),_f1.subVectors(_v2$4,_v1$7),_f2.subVectors(_v0$2,_v2$4);let axes=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0.z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2.x,0];return!!(satForAxes(axes,_v0$2,_v1$7,_v2$4,_extents)&&satForAxes(axes=[1,0,0,0,1,0,0,0,1],_v0$2,_v1$7,_v2$4,_extents))&&(_triangleNormal.crossVectors(_f0,_f1),satForAxes(axes=[_triangleNormal.x,_triangleNormal.y,_triangleNormal.z],_v0$2,_v1$7,_v2$4,_extents))}clampPoint(point,target){return target.copy(point).clamp(this.min,this.max)}distanceToPoint(point){let clampedPoint=_vector$b.copy(point).clamp(this.min,this.max);return clampedPoint.sub(point).length()}getBoundingSphere(target){return this.getCenter(target.center),target.radius=.5*this.getSize(_vector$b).length(),target}intersect(box){return this.min.max(box.min),this.max.min(box.max),this.isEmpty()&&this.makeEmpty(),this}union(box){return this.min.min(box.min),this.max.max(box.max),this}applyMatrix4(matrix){return this.isEmpty()||(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix),_points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix),_points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix),_points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix),_points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix),_points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix),this.setFromPoints(_points)),this}translate(offset){return this.min.add(offset),this.max.add(offset),this}equals(box){return box.min.equals(this.min)&&box.max.equals(this.max)}}let _points=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],_vector$b=new Vector3,_box$3=new Box3,_v0$2=new Vector3,_v1$7=new Vector3,_v2$4=new Vector3,_f0=new Vector3,_f1=new Vector3,_f2=new Vector3,_center=new Vector3,_extents=new Vector3,_triangleNormal=new Vector3,_testAxis=new Vector3;function satForAxes(axes,v0,v1,v2,extents){for(let i=0,j=axes.length-3;i<=j;i+=3){_testAxis.fromArray(axes,i);let r=extents.x*Math.abs(_testAxis.x)+extents.y*Math.abs(_testAxis.y)+extents.z*Math.abs(_testAxis.z),p0=v0.dot(_testAxis),p1=v1.dot(_testAxis),p2=v2.dot(_testAxis);if(Math.max(-Math.max(p0,p1,p2),Math.min(p0,p1,p2))>r)return!1}return!0}let _box$2=new Box3,_v1$6=new Vector3,_v2$3=new Vector3;class Sphere{constructor(center=new Vector3,radius=-1){this.center=center,this.radius=radius}
vendor: 4,132 bytes, line 1
1set(center,radius){return this.center.copy(center),this.radius=radius,this}setFromPoints(points,optionalCenter){let center=this.center;void 0!==optionalCenter?center.copy(optionalCenter):_box$2.setFromPoints(points).getCenter(center);let maxRadiusSq=0;for(let i=0,il=points.length;i<il;i++)maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(points[i]));return this.radius=Math.sqrt(maxRadiusSq),this}copy(sphere){return this.center.copy(sphere.center),this.radius=sphere.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(point){return point.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(point){return point.distanceTo(this.center)-this.radius}intersectsSphere(sphere){let radiusSum=this.radius+sphere.radius;return sphere.center.distanceToSquared(this.center)<=radiusSum*radiusSum}intersectsBox(box){return box.intersectsSphere(this)}intersectsPlane(plane){return Math.abs(plane.distanceToPoint(this.center))<=this.radius}clampPoint(point,target){let deltaLengthSq=this.center.distanceToSquared(point);return target.copy(point),deltaLengthSq>this.radius*this.radius&&(target.sub(this.center).normalize(),target.multiplyScalar(this.radius).add(this.center)),target}getBoundingBox(target){return this.isEmpty()?(target.makeEmpty(),target):(target.set(this.center,this.center),target.expandByScalar(this.radius),target)}applyMatrix4(matrix){return this.center.applyMatrix4(matrix),this.radius=this.radius*matrix.getMaxScaleOnAxis(),this}translate(offset){return this.center.add(offset),this}expandByPoint(point){if(this.isEmpty())return this.center.copy(point),this.radius=0,this;_v1$6.subVectors(point,this.center);let lengthSq=_v1$6.lengthSq();if(lengthSq>this.radius*this.radius){let length=Math.sqrt(lengthSq),delta=(length-this.radius)*.5;this.center.addScaledVector(_v1$6,delta/length),this.radius+=delta}return this}union(sphere){return sphere.isEmpty()?this:this.isEmpty()?(this.copy(sphere),this):(!0===this.center.equals(sphere.center)?this.radius=Math.max(this.radius,sphere.radius):(_v2$3.subVectors(sphere.center,this.center).setLength(sphere.radius),this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3)),this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3))),this)}equals(sphere){return sphere.center.equals(this.center)&&sphere.radius===this.radius}clone(){return new this.constructor().copy(this)}}let _vector$a=new Vector3,_segCenter=new Vector3,_segDir=new Vector3,_diff=new Vector3,_edge1=new Vector3,_edge2=new Vector3,_normal$1=new Vector3;class Ray{constructor(origin=new Vector3,direction=new Vector3(0,0,-1)){this.origin=origin,this.direction=direction}set(origin,direction){return this.origin.copy(origin),this.direction.copy(direction),this}copy(ray){return this.origin.copy(ray.origin),this.direction.copy(ray.direction),this}at(t,target){return target.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(v){return this.direction.copy(v).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,_vector$a)),this}closestPointToPoint(point,target){target.subVectors(point,this.origin);let directionDistance=target.dot(this.direction);return directionDistance<0?target.copy(this.origin):target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin)}distanceToPoint(point){return Math.sqrt(this.distanceSqToPoint(point))}distanceSqToPoint(point){let directionDistance=_vector$a.subVectors(point,this.origin).dot(this.direction);return directionDistance<0?this.origin.distanceToSquared(point):(_vector$a.copy(this.direction).multiplyScalar(directionDistance).add(this.origin),_vector$a.distanceToSquared(point))}distanceSqToSegment(v0,v1,optionalPointOnRay,optionalPointOnSegment){let s0,s1,sqrDist,extDet;_segCenter.copy(v0).add(v1).multiplyScalar(.5),_segDir.copy(v1).sub(v0).normalize(),_diff.copy(this.origin).sub(_segCenter);let segExtent=.5*v0.distanceTo(v1),a01=-this.direction.dot(_segDir),b0=_diff.dot(this.direction),b1=-_diff.dot(_segDir),c=_diff.lengthSq(),det=Math.abs(1-a01*a01);if(det>0){if(s0=a01*b1-b0,s1=a01*b0-b1,extDet=segExtent*det,s0>
1=0){if(s1>=-extDet){if(s1<=extDet){let invDet=1/det;s0*=invDet,s1*=invDet,sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c}else sqrDist=-(s0=Math.max(0,-(a01*(s1=segExtent)+b0)))*s0+s1*(s1+2*b1)+c}else sqrDist=-(s0=Math.max(0,-(a01*(s1=-segExtent)+b0)))*s0+s1*(s1+2*b1)+c}else s1<=-extDet?(s1=(s0=Math.max(0,-(-a01*segExtent+b0)))>0?-segExtent:Math.min(Math.max(-segExtent,-b1),segExtent),sqrDist=-s0*s0+s1*(s1+2*b1)+c):s1<=extDet?(s0=0,sqrDist=(s1=Math.min(Math.max(-segExtent,-b1),segExtent))*(s1+2*b1)+c):(s1=(s0=Math.max(0,-(a01*segExtent+b0)))>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent),sqrDist=-s0*s0+s1*(s1+2*b1)+c)}else s1=a01>0?-segExtent:segExtent,sqrDist=-(s0=Math.max(0,-(a01*s1+b0)))*s0+s1*(s1+2*b1)+c;return optionalPointOnRay&&optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin),optionalPointOnSegment&&optionalPointOnSegment.copy(_segDir).multiplyScalar(s1).add(_segCenter),sqrDist}intersectSphere(sphere,target){_vector$a.subVectors(sphere.center,this.origin);let tca=_vector$a.dot(this.direction),d2=_vector$a.dot(_vector$a)-tca*tca,radius2=sphere.radius*sphere.radius;if(d2>radius2)return null;let thc=Math.sqrt(radius2-d2),t0=tca-thc,t1=tca+thc;return t0<0&&t1<0?null:t0<0?this.at(t1,target):this.at(t0,target)}intersectsSphere(sphere){return this.distanceSqToPoint(sphere.center)<=sphere.radius*sphere.radius}distanceToPlane(plane){let denominator=plane.normal.dot(this.direction);if(0===denominator)return 0===plane.distanceToPoint(this.origin)?0:null;let t=-(this.origin.dot(plane.normal)+plane.constant)/denominator;return t>=0?t:null}intersectPlane(plane,target){let t=this.distanceToPlane(plane);return null===t?null:this.at(t,target)}intersectsPlane(plane){let distToPoint=plane.distanceToPoint(this.origin);if(0===distToPoint)return!0;let denominator=plane.normal.dot(this.direction);return denominator*distToPoint<0}intersectBox(box,target){let tmin,tmax,tymin,tymax,tzmin,tzmax;let invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/this.direction.z,origin=this.origin;return(invdirx>=0?(tmin=(box.min.x-origin.x)*invdirx,tmax=(box.max.x-origin.x)*invdirx):(tmin=(box.max.x-origin.x)*invdirx,tmax=(box.min.x-origin.x)*invdirx),invdiry>=0?(tymin=(box.min.y-origin.y)*invdiry,tymax=(box.max.y-origin.y)*invdiry):(tymin=(box.max.y-origin.y)*invdiry,tymax=(box.min.y-origin.y)*invdiry),tmin>tymax||tymin>tmax)?null:((tymin>tmin||isNaN(tmin))&&(tmin=tymin),(tymax<tmax||isNaN(tmax))&&(tmax=tymax),invdirz>=0?(tzmin=(box.min.z-origin.z)*invdirz,tzmax=(box.max.z-origin.z)*invdirz):(tzmin=(box.max.z-origin.z)*invdirz,tzmax=(box.min.z-origin.z)*invdirz),tmin>tzmax||tzmin>tmax)?null:((tzmin>tmin||tmin!=tmin)&&(tmin=tzmin),(tzmax<tmax||tmax!=tmax)&&(tmax=tzmax),tmax<0)?null:this.at(tmin>=0?tmin:tmax,target)}intersectsBox(box){return null!==this.intersectBox(box,_vector$a)}intersectTriangle(a,b,c,backfaceCulling,target){let sign;_edge1.subVectors(b,a),_edge2.subVectors(c,a),_normal$1.crossVectors(_edge1,_edge2);let DdN=this.direction.dot(_normal$1);if(DdN>0){if(backfaceCulling)return null;sign=1}else{if(!(DdN<0))return null;sign=-1,DdN=-DdN}_diff.subVectors(this.origin,a);let DdQxE2=sign*this.direction.dot(_edge2.crossVectors(_diff,_edge2));if(DdQxE2<0)return null;let DdE1xQ=sign*this.direction.dot(_edge1.cross(_diff));if(DdE1xQ<0||DdQxE2+DdE1xQ>DdN)return null;let QdN=-sign*_diff.dot(_normal$1);return QdN<0?null:this.at(QdN/DdN,target)}applyMatrix4(matrix4){return this.origin.applyMatrix4(matrix4),this.direction.transformDirection(matrix4),this}equals(ray){return ray.origin.equals(this.origin)&&ray.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Matrix4{constructor(){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){let te=this.elements;return te[0]=n11,te[4]=n12,te[8]=n13,te[12]=n14,te[1]=n21,te[5]=n22,te[9]=n23,te[13]=n24,te[2]=n31,te[6]=n32,te[10]=n33,te[14]=n34,te[3]=n41,te[7]=n42,te[11]=n43,te[15]=n44,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Matrix4().fromArray(this.elements)}copy(m){let te=this.elements,me=m.elements;return te[0]=me[0],te[1]=me[1],te[2]=me[2],te[3]=me[3],te[4]=me[4],te[5]=me[5],te[6]=me[6],te[7]=me[7],te[8]=me[8],te[9]=me[9],te[10]=me[10],te[11]=me[11
vendor: 9,435 bytes, line 1
1],te[12]=me[12],te[13]=me[13],te[14]=me[14],te[15]=me[15],this}copyPosition(m){let te=this.elements,me=m.elements;return te[12]=me[12],te[13]=me[13],te[14]=me[14],this}setFromMatrix3(m){let me=m.elements;return this.set(me[0],me[3],me[6],0,me[1],me[4],me[7],0,me[2],me[5],me[8],0,0,0,0,1),this}extractBasis(xAxis,yAxis,zAxis){return xAxis.setFromMatrixColumn(this,0),yAxis.setFromMatrixColumn(this,1),zAxis.setFromMatrixColumn(this,2),this}makeBasis(xAxis,yAxis,zAxis){return this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1),this}extractRotation(m){let te=this.elements,me=m.elements,scaleX=1/_v1$5.setFromMatrixColumn(m,0).length(),scaleY=1/_v1$5.setFromMatrixColumn(m,1).length(),scaleZ=1/_v1$5.setFromMatrixColumn(m,2).length();return te[0]=me[0]*scaleX,te[1]=me[1]*scaleX,te[2]=me[2]*scaleX,te[3]=0,te[4]=me[4]*scaleY,te[5]=me[5]*scaleY,te[6]=me[6]*scaleY,te[7]=0,te[8]=me[8]*scaleZ,te[9]=me[9]*scaleZ,te[10]=me[10]*scaleZ,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]=1,this}makeRotationFromEuler(euler){let te=this.elements,x=euler.x,y=euler.y,z=euler.z,a=Math.cos(x),b=Math.sin(x),c=Math.cos(y),d=Math.sin(y),e=Math.cos(z),f=Math.sin(z);if("XYZ"===euler.order){let ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e,te[4]=-c*f,te[8]=d,te[1]=af+be*d,te[5]=ae-bf*d,te[9]=-b*c,te[2]=bf-ae*d,te[6]=be+af*d,te[10]=a*c}else if("YXZ"===euler.order){let ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b,te[4]=de*b-cf,te[8]=a*d,te[1]=a*f,te[5]=a*e,te[9]=-b,te[2]=cf*b-de,te[6]=df+ce*b,te[10]=a*c}else if("ZXY"===euler.order){let ce1=c*e,cf1=c*f,de1=d*e,df1=d*f;te[0]=ce1-df1*b,te[4]=-a*f,te[8]=de1+cf1*b,te[1]=cf1+de1*b,te[5]=a*e,te[9]=df1-ce1*b,te[2]=-a*d,te[6]=b,te[10]=a*c}else if("ZYX"===euler.order){let ae1=a*e,af1=a*f,be1=b*e,bf1=b*f;te[0]=c*e,te[4]=be1*d-af1,te[8]=ae1*d+bf1,te[1]=c*f,te[5]=bf1*d+ae1,te[9]=af1*d-be1,te[2]=-d,te[6]=b*c,te[10]=a*c}else if("YZX"===euler.order){let ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e,te[4]=bd-ac*f,te[8]=bc*f+ad,te[1]=f,te[5]=a*e,te[9]=-b*e,te[2]=-d*e,te[6]=ad*f+bc,te[10]=ac-bd*f}else if("XZY"===euler.order){let ac1=a*c,ad1=a*d,bc1=b*c,bd1=b*d;te[0]=c*e,te[4]=-f,te[8]=d*e,te[1]=ac1*f+bd1,te[5]=a*e,te[9]=ad1*f-bc1,te[2]=bc1*f-ad1,te[6]=b*e,te[10]=bd1*f+ac1}return te[3]=0,te[7]=0,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]=1,this}makeRotationFromQuaternion(q){return this.compose(_zero,q,_one)}lookAt(eye,target,up){let te=this.elements;return _z.subVectors(eye,target),0===_z.lengthSq()&&(_z.z=1),_z.normalize(),_x.crossVectors(up,_z),0===_x.lengthSq()&&(1===Math.abs(up.z)?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(),_x.crossVectors(up,_z)),_x.normalize(),_y.crossVectors(_z,_x),te[0]=_x.x,te[4]=_y.x,te[8]=_z.x,te[1]=_x.y,te[5]=_y.y,te[9]=_z.y,te[2]=_x.z,te[6]=_y.z,te[10]=_z.z,this}multiply(m){return this.multiplyMatrices(this,m)}premultiply(m){return this.multiplyMatrices(m,this)}multiplyMatrices(a,b){let ae=a.elements,be=b.elements,te=this.elements,a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12],a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13],a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14],a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15],b11=be[0],b12=be[4],b13=be[8],b14=be[12],b21=be[1],b22=be[5],b23=be[9],b24=be[13],b31=be[2],b32=be[6],b33=be[10],b34=be[14],b41=be[3],b42=be[7],b43=be[11],b44=be[15];return te[0]=a11*b11+a12*b21+a13*b31+a14*b41,te[4]=a11*b12+a12*b22+a13*b32+a14*b42,te[8]=a11*b13+a12*b23+a13*b33+a14*b43,te[12]=a11*b14+a12*b24+a13*b34+a14*b44,te[1]=a21*b11+a22*b21+a23*b31+a24*b41,te[5]=a21*b12+a22*b22+a23*b32+a24*b42,te[9]=a21*b13+a22*b23+a23*b33+a24*b43,te[13]=a21*b14+a22*b24+a23*b34+a24*b44,te[2]=a31*b11+a32*b21+a33*b31+a34*b41,te[6]=a31*b12+a32*b22+a33*b32+a34*b42,te[10]=a31*b13+a32*b23+a33*b33+a34*b43,te[14]=a31*b14+a32*b24+a33*b34+a34*b44,te[3]=a41*b11+a42*b21+a43*b31+a44*b41,te[7]=a41*b12+a42*b22+a43*b32+a44*b42,te[11]=a41*b13+a42*b23+a43*b33+a44*b43,te[15]=a41*b14+a42*b24+a43*b34+a44*b44,this}multiplyScalar(s){let te=this.elements;return te[0]*=s,te[4]*=s,te[8]*=s,te[12]*=s,te[1]*=s,te[5]*=s,te[9]*=s,te[13]*=s,te[2]*=s,te[6]*=s,te[10]*=s,te[14]*=s,te[3]*=s,te[7]*=s,te[11]*=s,te[15]*=s,this}determinant(){let te=this.elements,n11=te[0],n12=te[4],n13=te[8],n14=te[12],n21=te[1],n22=te[5],n23=te[9],n24=te[13],n31=te[2],n32=te[6],n33=te[10],n34=te[14],n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)}transpose(){let tmp;let te=this.elements;return tmp=te[1],te[1]=te[4],te[4]=tmp,tmp=te[2],te[2]=te[8],te[8]=tmp,tmp=te[6],te[6]=te[9],te[9]=tmp,tmp=te[3],te[3]=te[12],te[12]=tmp,tmp=te[7],te[7]=te[13],te[13]=tmp,tmp=te[11],te[11]=te[14],te[14]=tmp,this}setPosition(x,y,z){let te=this.elements;return x.isVector3?(te[12]=x.x,te[13]=x.y,te[14]=x.z):(te[12]=x,te[13]=y,te[14]=z),this}invert(){let te=this.elements,n11=te[0],n21=te[1],n31=te[2],n41=te[3],n12=te[4],n22=te[5],n32=te[6],n42=te[7],n13=te[8],n23=te[9],n33=te[10],n43=te[11],n14=te[12],n24=te[13],n34=te[14],n44=te[15],t11=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44,t12=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44,t13=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44,t14=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34,det=n11*t11+n21*t12+n31*t13+n41*t14;if(0===det)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let detInv=1/det;return te[0]=t11*detInv,te[1]=(n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44)*detInv,te[2]=(n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44)*detInv,te[3]=(n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43)*detInv,te[4]=t12*detInv,te[5]=(n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44)*detInv,te[6]=(n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44)*detInv,te[7]=(n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43)*detInv,te[8]=t13*detInv,te[9]=(n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44)*detInv,te[10]=(n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44)*detInv,te[11]=(n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43)*detInv,te[12]=t14*detInv,te[13]=(n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34)*detInv,te[14]=(n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34)*detInv,te[15]=(n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33)*detInv,this}scale(v){let te=this.elements,x=v.x,y=v.y,z=v.z;return te[0]*=x,te[4]*=y,te[8]*=z,te[1]*=x,te[5]*=y,te[9]*=z,te[2]*=x,te[6]*=y,te[10]*=z,te[3]*=x,te[7]*=y,te[11]*=z,this}getMaxScaleOnAxis(){let te=this.elements,scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2],scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6],scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,scaleYSq,scaleZSq))}makeTranslation(x,y,z){return this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1),this}makeRotationX(theta){let c=Math.cos(theta),s=Math.sin(theta);return this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1),this}makeRotationY(theta){let c=Math.cos(theta),s=Math.sin(theta);return this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1),this}makeRotationZ(theta){let c=Math.cos(theta),s=Math.sin(theta);return this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(axis,angle){let c=Math.cos(angle),s=Math.sin(angle),t=1-c,x=axis.x,y=axis.y,z=axis.z,tx=t*x,ty=t*y;return this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1),this}makeScale(x,y,z){return this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1),this}makeShear(xy,xz,yx,yz,zx,zy){return this.set(1,yx,zx,0,xy,1,zy,0,xz,yz,1,0,0,0,0,1),this}compose(position,quaternion,scale){let te=this.elements,x=quaternion._x,y=quaternion._y,z=quaternion._z,w=quaternion._w,x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2,sx=scale.x,sy=scale.y,sz=scale.z;return te[0]=(1-(yy+zz))*sx,te[1]=(xy+wz)*sx,te[2]=(xz-wy)*sx,te[3]=0,te[4]=(xy-wz)*sy,te[5]=(1-(xx+zz))*sy,te[6]=(yz+wx)*sy,te[7]=0,te[8]=(xz+wy)*sz,te[9]=(yz-wx)*sz,te[10]=(1-(xx+yy))*sz,te[11]=0,te[12]=position.x,te[13]=position.y,te[14]=position.z,te[15]=1,this}decompose(position,quaternion,scale){let te=this.elements,sx=_v1$5.set(te[0],te[1],te[2]).length(),sy=_v1$5.set(te[4],te[5],te[6]).length(),sz=_v1$5.set(te[8],te[9],te[10]).length(),det=this.determinant();det<0&&(sx=-sx),position.x=te[12],position.y=te[13],position.z=te[14],_m1$2.copy(this);let invSX=1/sx,invSY=1/sy,invSZ=1/sz;return _m1$2.elements[0]*=invSX,_m1$2.elements[1]*=invSX,_m1$2.elements[2]*=invSX,_m1$2.elements[4]*=invSY,_m1$2.elements[5]*=invSY,_m1$2.elements[6]*=invSY,_m1$2.elements[8]*=invSZ,_m1$2.elements[9]*=invSZ,_m1$2.elements[10]*=invSZ,quaternion.setFromRotationMatrix(_m1$2),scale.x=sx,scale.y=sy,scale.z=sz,this}makePerspective(left,right,top,bottom,near,far){let te=this.elements;return te[0]=2*near/(right-left),te[4]=0,te[8]=(right+left)/(right-left),te[12]=0,te[1]=0,te[5]=2*near/(top-bottom),te[9]=(top+bottom)/(top-bottom),te[13]=0,te[2]=0,te[6]=0,te[10]=-(far+near)/(far-near),te[14]=-2*far*near/(far-near),te[3]=0,te[7]=0,te[11]=-1,te[15]=0,this}
vendor: 4,138 bytes, line 1
1makeOrthographic(left,right,top,bottom,near,far){let te=this.elements,w=1/(right-left),h=1/(top-bottom),p=1/(far-near);return te[0]=2*w,te[4]=0,te[8]=0,te[12]=-((right+left)*w),te[1]=0,te[5]=2*h,te[9]=0,te[13]=-((top+bottom)*h),te[2]=0,te[6]=0,te[10]=-2*p,te[14]=-((far+near)*p),te[3]=0,te[7]=0,te[11]=0,te[15]=1,this}equals(matrix){let te=this.elements,me=matrix.elements;for(let i=0;i<16;i++)if(te[i]!==me[i])return!1;return!0}fromArray(array,offset=0){for(let i=0;i<16;i++)this.elements[i]=array[i+offset];return this}toArray(array=[],offset=0){let te=this.elements;return array[offset]=te[0],array[offset+1]=te[1],array[offset+2]=te[2],array[offset+3]=te[3],array[offset+4]=te[4],array[offset+5]=te[5],array[offset+6]=te[6],array[offset+7]=te[7],array[offset+8]=te[8],array[offset+9]=te[9],array[offset+10]=te[10],array[offset+11]=te[11],array[offset+12]=te[12],array[offset+13]=te[13],array[offset+14]=te[14],array[offset+15]=te[15],array}}let _v1$5=new Vector3,_m1$2=new Matrix4,_zero=new Vector3(0,0,0),_one=new Vector3(1,1,1),_x=new Vector3,_y=new Vector3,_z=new Vector3,_matrix$1=new Matrix4,_quaternion$3=new Quaternion;class Euler{constructor(x=0,y=0,z=0,order=Euler.DefaultOrder){this.isEuler=!0,this._x=x,this._y=y,this._z=z,this._order=order}get x(){return this._x}set x(value){this._x=value,this._onChangeCallback()}get y(){return this._y}set y(value){this._y=value,this._onChangeCallback()}get z(){return this._z}set z(value){this._z=value,this._onChangeCallback()}get order(){return this._order}set order(value){this._order=value,this._onChangeCallback()}set(x,y,z,order=this._order){return this._x=x,this._y=y,this._z=z,this._order=order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(euler){return this._x=euler._x,this._y=euler._y,this._z=euler._z,this._order=euler._order,this._onChangeCallback(),this}setFromRotationMatrix(m,order=this._order,update=!0){let te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];switch(order){case"XYZ":this._y=Math.asin(clamp(m13,-1,1)),.9999999>Math.abs(m13)?(this._x=Math.atan2(-m23,m33),this._z=Math.atan2(-m12,m11)):(this._x=Math.atan2(m32,m22),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(m23,-1,1)),.9999999>Math.abs(m23)?(this._y=Math.atan2(m13,m33),this._z=Math.atan2(m21,m22)):(this._y=Math.atan2(-m31,m11),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(m32,-1,1)),.9999999>Math.abs(m32)?(this._y=Math.atan2(-m31,m33),this._z=Math.atan2(-m12,m22)):(this._y=0,this._z=Math.atan2(m21,m11));break;case"ZYX":this._y=Math.asin(-clamp(m31,-1,1)),.9999999>Math.abs(m31)?(this._x=Math.atan2(m32,m33),this._z=Math.atan2(m21,m11)):(this._x=0,this._z=Math.atan2(-m12,m22));break;case"YZX":this._z=Math.asin(clamp(m21,-1,1)),.9999999>Math.abs(m21)?(this._x=Math.atan2(-m23,m22),this._y=Math.atan2(-m31,m11)):(this._x=0,this._y=Math.atan2(m13,m33));break;case"XZY":this._z=Math.asin(-clamp(m12,-1,1)),.9999999>Math.abs(m12)?(this._x=Math.atan2(m32,m22),this._y=Math.atan2(m13,m11)):(this._x=Math.atan2(-m23,m33),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+order)}return this._order=order,!0===update&&this._onChangeCallback(),this}setFromQuaternion(q,order,update){return _matrix$1.makeRotationFromQuaternion(q),this.setFromRotationMatrix(_matrix$1,order,update)}setFromVector3(v,order=this._order){return this.set(v.x,v.y,v.z,order)}reorder(newOrder){return _quaternion$3.setFromEuler(this),this.setFromQuaternion(_quaternion$3,newOrder)}equals(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order}fromArray(array){return this._x=array[0],this._y=array[1],this._z=array[2],void 0!==array[3]&&(this._order=array[3]),this._onChangeCallback(),this}toArray(array=[],offset=0){return array[offset]=this._x,array[offset+1]=this._y,array[offset+2]=this._z,array[offset+3]=this._order,array}_onChange(callback){return this._onChangeCallback=callback,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}
vendor: 6,692 bytes, line 1
1toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Euler.DefaultOrder="XYZ",Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Layers{constructor(){this.mask=1}set(channel){this.mask=(1<<channel|0)>>>0}enable(channel){this.mask|=1<<channel|0}enableAll(){this.mask=-1}toggle(channel){this.mask^=1<<channel|0}disable(channel){this.mask&=~(1<<channel|0)}disableAll(){this.mask=0}test(layers){return(this.mask&layers.mask)!=0}isEnabled(channel){return(this.mask&(1<<channel|0))!=0}}let _object3DId=0,_v1$4=new Vector3,_q1=new Quaternion,_m1$1=new Matrix4,_target=new Vector3,_position$3=new Vector3,_scale$2=new Vector3,_quaternion$2=new Quaternion,_xAxis=new Vector3(1,0,0),_yAxis=new Vector3(0,1,0),_zAxis=new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DefaultUp.clone();let position=new Vector3,rotation=new Euler,quaternion=new Quaternion,scale=new Vector3(1,1,1);rotation._onChange(function(){quaternion.setFromEuler(rotation,!1)}),quaternion._onChange(function(){rotation.setFromQuaternion(quaternion,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:position},rotation:{configurable:!0,enumerable:!0,value:rotation},quaternion:{configurable:!0,enumerable:!0,value:quaternion},scale:{configurable:!0,enumerable:!0,value:scale},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DefaultMatrixWorldAutoUpdate,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(matrix){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(q){return this.quaternion.premultiply(q),this}setRotationFromAxisAngle(axis,angle){this.quaternion.setFromAxisAngle(axis,angle)}setRotationFromEuler(euler){this.quaternion.setFromEuler(euler,!0)}setRotationFromMatrix(m){this.quaternion.setFromRotationMatrix(m)}setRotationFromQuaternion(q){this.quaternion.copy(q)}rotateOnAxis(axis,angle){return _q1.setFromAxisAngle(axis,angle),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(axis,angle){return _q1.setFromAxisAngle(axis,angle),this.quaternion.premultiply(_q1),this}rotateX(angle){return this.rotateOnAxis(_xAxis,angle)}rotateY(angle){return this.rotateOnAxis(_yAxis,angle)}rotateZ(angle){return this.rotateOnAxis(_zAxis,angle)}translateOnAxis(axis,distance){return _v1$4.copy(axis).applyQuaternion(this.quaternion),this.position.add(_v1$4.multiplyScalar(distance)),this}translateX(distance){return this.translateOnAxis(_xAxis,distance)}translateY(distance){return this.translateOnAxis(_yAxis,distance)}translateZ(distance){return this.translateOnAxis(_zAxis,distance)}localToWorld(vector){return vector.applyMatrix4(this.matrixWorld)}worldToLocal(vector){return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert())}lookAt(x,y,z){x.isVector3?_target.copy(x):_target.set(x,y,z);let parent=this.parent;this.updateWorldMatrix(!0,!1),_position$3.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1$1.lookAt(_position$3,_target,this.up):_m1$1.lookAt(_target,_position$3,this.up),this.quaternion.setFromRotationMatrix(_m1$1),parent&&(_m1$1.extractRotation(parent.matrixWorld),_q1.setFromRotationMatrix(_m1$1),this.quaternion.premultiply(_q1.invert()))}add(object){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}return object===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",object),this):(object&&object.isObject3D?(null!==object.parent&&object.parent.remove(object),object.parent=this,this.children.push(object),object.dispatchEvent(_addedEvent)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",object),this)}remove(object){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let index=this.children.indexOf(object);return -1!==index&&(object.parent=null,this.children.splice(index,1),object.dispatchEvent(_removedEvent)),this}removeFromParent(){let parent=this.parent;return null!==parent&&parent.remove(this),this}clear(){for(let i=0;i<this.children.length;i++){let object=this.children[i];object.parent=null,object.dispatchEvent(_removedEvent)}return this.children.length=0,this}attach(object){return this.updateWorldMatrix(!0,!1),_m1$1.copy(this.matrixWorld).invert(),null!==object.parent&&(object.parent.updateWorldMatrix(!0,!1),_m1$1.multiply(object.parent.matrixWorld)),object.applyMatrix4(_m1$1),this.add(object),object.updateWorldMatrix(!1,!0),this}getObjectById(id){return this.getObjectByProperty("id",id)}getObjectByName(name){return this.getObjectByProperty("name",name)}getObjectByProperty(name,value){if(this[name]===value)return this;for(let i=0,l=this.children.length;i<l;i++){let child=this.children[i],object=child.getObjectByProperty(name,value);if(void 0!==object)return object}}getWorldPosition(target){return this.updateWorldMatrix(!0,!1),target.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(target){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$3,target,_scale$2),target}getWorldScale(target){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$3,_quaternion$2,target),target}getWorldDirection(target){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return target.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(callback){callback(this);let children=this.children;for(let i=0,l=children.length;i<l;i++)children[i].traverse(callback)}traverseVisible(callback){if(!1===this.visible)return;callback(this);let children=this.children;for(let i=0,l=children.length;i<l;i++)children[i].traverseVisible(callback)}traverseAncestors(callback){let parent=this.parent;null!==parent&&(callback(parent),parent.traverseAncestors(callback))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(force){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||force)&&(null===this.parent?this.matrixWorld.copy(this.matrix
vendor: 6,907 bytes, line 1
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,force=!0);let children=this.children;for(let i=0,l=children.length;i<l;i++){let child=children[i];(!0===child.matrixWorldAutoUpdate||!0===force)&&child.updateMatrixWorld(force)}}updateWorldMatrix(updateParents,updateChildren){let parent=this.parent;if(!0===updateParents&&null!==parent&&!0===parent.matrixWorldAutoUpdate&&parent.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===updateChildren){let children=this.children;for(let i=0,l=children.length;i<l;i++){let child=children[i];!0===child.matrixWorldAutoUpdate&&child.updateWorldMatrix(!1,!0)}}}toJSON(meta){let isRootObject=void 0===meta||"string"==typeof meta,output={};isRootObject&&(meta={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},output.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let object={};function serialize(library,element){return void 0===library[element.uuid]&&(library[element.uuid]=element.toJSON(meta)),element.uuid}if(object.uuid=this.uuid,object.type=this.type,""!==this.name&&(object.name=this.name),!0===this.castShadow&&(object.castShadow=!0),!0===this.receiveShadow&&(object.receiveShadow=!0),!1===this.visible&&(object.visible=!1),!1===this.frustumCulled&&(object.frustumCulled=!1),0!==this.renderOrder&&(object.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(object.userData=this.userData),object.layers=this.layers.mask,object.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(object.matrixAutoUpdate=!1),this.isInstancedMesh&&(object.type="InstancedMesh",object.count=this.count,object.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(object.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?object.background=this.background.toJSON():this.background.isTexture&&(object.background=this.background.toJSON(meta).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(object.environment=this.environment.toJSON(meta).uuid);else if(this.isMesh||this.isLine||this.isPoints){object.geometry=serialize(meta.geometries,this.geometry);let parameters=this.geometry.parameters;if(void 0!==parameters&&void 0!==parameters.shapes){let shapes=parameters.shapes;if(Array.isArray(shapes))for(let i=0,l=shapes.length;i<l;i++){let shape=shapes[i];serialize(meta.shapes,shape)}else serialize(meta.shapes,shapes)}}if(this.isSkinnedMesh&&(object.bindMode=this.bindMode,object.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(meta.skeletons,this.skeleton),object.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let uuids=[];for(let i1=0,l1=this.material.length;i1<l1;i1++)uuids.push(serialize(meta.materials,this.material[i1]));object.material=uuids}else object.material=serialize(meta.materials,this.material)}if(this.children.length>0){object.children=[];for(let i2=0;i2<this.children.length;i2++)object.children.push(this.children[i2].toJSON(meta).object)}if(this.animations.length>0){object.animations=[];for(let i3=0;i3<this.animations.length;i3++){let animation=this.animations[i3];object.animations.push(serialize(meta.animations,animation))}}if(isRootObject){let geometries=extractFromCache(meta.geometries),materials=extractFromCache(meta.materials),textures=extractFromCache(meta.textures),images=extractFromCache(meta.images),shapes1=extractFromCache(meta.shapes),skeletons=extractFromCache(meta.skeletons),animations=extractFromCache(meta.animations),nodes=extractFromCache(meta.nodes);geometries.length>0&&(output.geometries=geometries),materials.length>0&&(output.materials=materials),textures.length>0&&(output.textures=textures),images.length>0&&(output.images=images),shapes1.length>0&&(output.shapes=shapes1),skeletons.length>0&&(output.skeletons=skeletons),animations.length>0&&(output.animations=animations),nodes.length>0&&(output.nodes=nodes)}return output.object=object,output;function extractFromCache(cache){let values=[];for(let key in cache){let data=cache[key];delete data.metadata,values.push(data)}return values}}clone(recursive){return new this.constructor().copy(this,recursive)}copy(source,recursive=!0){if(this.name=source.name,this.up.copy(source.up),this.position.copy(source.position),this.rotation.order=source.rotation.order,this.quaternion.copy(source.quaternion),this.scale.copy(source.scale),this.matrix.copy(source.matrix),this.matrixWorld.copy(source.matrixWorld),this.matrixAutoUpdate=source.matrixAutoUpdate,this.matrixWorldNeedsUpdate=source.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=source.matrixWorldAutoUpdate,this.layers.mask=source.layers.mask,this.visible=source.visible,this.castShadow=source.castShadow,this.receiveShadow=source.receiveShadow,this.frustumCulled=source.frustumCulled,this.renderOrder=source.renderOrder,this.userData=JSON.parse(JSON.stringify(source.userData)),!0===recursive)for(let i=0;i<source.children.length;i++){let child=source.children[i];this.add(child.clone())}return this}}Object3D.DefaultUp=new Vector3(0,1,0),Object3D.DefaultMatrixAutoUpdate=!0,Object3D.DefaultMatrixWorldAutoUpdate=!0;let _v0$1=new Vector3,_v1$3=new Vector3,_v2$2=new Vector3,_v3$1=new Vector3,_vab=new Vector3,_vac=new Vector3,_vbc=new Vector3,_vap=new Vector3,_vbp=new Vector3,_vcp=new Vector3;class Triangle{constructor(a=new Vector3,b=new Vector3,c=new Vector3){this.a=a,this.b=b,this.c=c}static getNormal(a,b,c,target){target.subVectors(c,b),_v0$1.subVectors(a,b),target.cross(_v0$1);let targetLengthSq=target.lengthSq();return targetLengthSq>0?target.multiplyScalar(1/Math.sqrt(targetLengthSq)):target.set(0,0,0)}static getBarycoord(point,a,b,c,target){_v0$1.subVectors(c,a),_v1$3.subVectors(b,a),_v2$2.subVectors(point,a);let dot00=_v0$1.dot(_v0$1),dot01=_v0$1.dot(_v1$3),dot02=_v0$1.dot(_v2$2),dot11=_v1$3.dot(_v1$3),dot12=_v1$3.dot(_v2$2),denom=dot00*dot11-dot01*dot01;if(0===denom)return target.set(-2,-1,-1);let invDenom=1/denom,u=(dot11*dot02-dot01*dot12)*invDenom,v=(dot00*dot12-dot01*dot02)*invDenom;return target.set(1-u-v,v,u)}static containsPoint(point,a,b,c){return this.getBarycoord(point,a,b,c,_v3$1),_v3$1.x>=0&&_v3$1.y>=0&&_v3$1.x+_v3$1.y<=1}static getUV(point,p1,p2,p3,uv1,uv2,uv3,target){return this.getBarycoord(point,p1,p2,p3,_v3$1),target.set(0,0),target.addScaledVector(uv1,_v3$1.x),target.addScaledVector(uv2,_v3$1.y),target.addScaledVector(uv3,_v3$1.z),target}static isFrontFacing(a,b,c,direction){return _v0$1.subVectors(c,b),_v1$3.subVectors(a,b),0>_v0$1.cross(_v1$3).dot(direction)}set(a,b,c){return this.a.copy(a),this.b.copy(b),this.c.copy(c),this}setFromPointsAndIndices(points,i0,i1,i2){return this.a.copy(points[i0
vendor: 4,226 bytes, line 1
1]),this.b.copy(points[i1]),this.c.copy(points[i2]),this}setFromAttributeAndIndices(attribute,i0,i1,i2){return this.a.fromBufferAttribute(attribute,i0),this.b.fromBufferAttribute(attribute,i1),this.c.fromBufferAttribute(attribute,i2),this}clone(){return new this.constructor().copy(this)}copy(triangle){return this.a.copy(triangle.a),this.b.copy(triangle.b),this.c.copy(triangle.c),this}getArea(){return _v0$1.subVectors(this.c,this.b),_v1$3.subVectors(this.a,this.b),.5*_v0$1.cross(_v1$3).length()}getMidpoint(target){return target.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(target){return Triangle.getNormal(this.a,this.b,this.c,target)}getPlane(target){return target.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(point,target){return Triangle.getBarycoord(point,this.a,this.b,this.c,target)}getUV(point,uv1,uv2,uv3,target){return Triangle.getUV(point,this.a,this.b,this.c,uv1,uv2,uv3,target)}containsPoint(point){return Triangle.containsPoint(point,this.a,this.b,this.c)}isFrontFacing(direction){return Triangle.isFrontFacing(this.a,this.b,this.c,direction)}intersectsBox(box){return box.intersectsTriangle(this)}closestPointToPoint(p,target){let v,w;let a=this.a,b=this.b,c=this.c;_vab.subVectors(b,a),_vac.subVectors(c,a),_vap.subVectors(p,a);let d1=_vab.dot(_vap),d2=_vac.dot(_vap);if(d1<=0&&d2<=0)return target.copy(a);_vbp.subVectors(p,b);let d3=_vab.dot(_vbp),d4=_vac.dot(_vbp);if(d3>=0&&d4<=d3)return target.copy(b);let vc=d1*d4-d3*d2;if(vc<=0&&d1>=0&&d3<=0)return v=d1/(d1-d3),target.copy(a).addScaledVector(_vab,v);_vcp.subVectors(p,c);let d5=_vab.dot(_vcp),d6=_vac.dot(_vcp);if(d6>=0&&d5<=d6)return target.copy(c);let vb=d5*d2-d1*d6;if(vb<=0&&d2>=0&&d6<=0)return w=d2/(d2-d6),target.copy(a).addScaledVector(_vac,w);let va=d3*d6-d5*d4;if(va<=0&&d4-d3>=0&&d5-d6>=0)return _vbc.subVectors(c,b),w=(d4-d3)/(d4-d3+(d5-d6)),target.copy(b).addScaledVector(_vbc,w);let denom=1/(va+vb+vc);return v=vb*denom,w=vc*denom,target.copy(a).addScaledVector(_vab,v).addScaledVector(_vac,w)}equals(triangle){return triangle.a.equals(this.a)&&triangle.b.equals(this.b)&&triangle.c.equals(this.c)}}let materialId=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:materialId++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=1,this.side=FrontSide,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(value){this._alphaTest>0!=value>0&&this.version++,this._alphaTest=value}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(values){if(void 0!==values)for(let key in values){let newValue=values[key];if(void 0===newValue){console.warn("THREE.Material: '"+key+"' parameter is undefined.");continue}let currentValue=this[key];if(void 0===currentValue){console.warn("THREE."+this.type+": '"+key+"' is not a property of this material.");continue}currentValue&¤tValue.isColor?currentValue.set(newValue):currentValue&¤tValue.isVector3&&newValue&&newValue.isVector3?currentValue.copy(newValue):this[key]=newValue}}toJSON(meta){let isRootObject=void 0===meta||"string"==typeof meta;isRootObject&&(meta={textures:{},images:{}});let data={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function extractFromCache(cache){let values=[];for(let key in cache){let data=cache[key];delete data.metadata,values.push(data)}return values}
vendor: 5,001 bytes, line 1
1if(data.uuid=this.uuid,data.type=this.type,""!==this.name&&(data.name=this.name),this.color&&this.color.isColor&&(data.color=this.color.getHex()),void 0!==this.roughness&&(data.roughness=this.roughness),void 0!==this.metalness&&(data.metalness=this.metalness),void 0!==this.sheen&&(data.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(data.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(data.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(data.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(data.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(data.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(data.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(data.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(data.shininess=this.shininess),void 0!==this.clearcoat&&(data.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(data.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(data.clearcoatMap=this.clearcoatMap.toJSON(meta).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(data.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(meta).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(data.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(meta).uuid,data.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(data.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(data.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(data.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(data.iridescenceMap=this.iridescenceMap.toJSON(meta).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(data.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(meta).uuid),this.map&&this.map.isTexture&&(data.map=this.map.toJSON(meta).uuid),this.matcap&&this.matcap.isTexture&&(data.matcap=this.matcap.toJSON(meta).uuid),this.alphaMap&&this.alphaMap.isTexture&&(data.alphaMap=this.alphaMap.toJSON(meta).uuid),this.lightMap&&this.lightMap.isTexture&&(data.lightMap=this.lightMap.toJSON(meta).uuid,data.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(data.aoMap=this.aoMap.toJSON(meta).uuid,data.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(data.bumpMap=this.bumpMap.toJSON(meta).uuid,data.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(data.normalMap=this.normalMap.toJSON(meta).uuid,data.normalMapType=this.normalMapType,data.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(data.displacementMap=this.displacementMap.toJSON(meta).uuid,data.displacementScale=this.displacementScale,data.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(data.roughnessMap=this.roughnessMap.toJSON(meta).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(data.metalnessMap=this.metalnessMap.toJSON(meta).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(data.emissiveMap=this.emissiveMap.toJSON(meta).uuid),this.specularMap&&this.specularMap.isTexture&&(data.specularMap=this.specularMap.toJSON(meta).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(data.specularIntensityMap=this.specularIntensityMap.toJSON(meta).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(data.specularColorMap=this.specularColorMap.toJSON(meta).uuid),this.envMap&&this.envMap.isTexture&&(data.envMap=this.envMap.toJSON(meta).uuid,void 0!==this.combine&&(data.combine=this.combine)),void 0!==this.envMapIntensity&&(data.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(data.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(data.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(data.gradientMap=this.gradientMap.toJSON(meta).uuid),void 0!==this.transmission&&(data.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(data.transmissionMap=this.transmissionMap.toJSON(meta).uuid),void 0!==this.thickness&&(data.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(data.thicknessMap=this.thicknessMap.toJSON(meta).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(data.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(data.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(data.size=this.size),null!==this.shadowSide&&(data.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(data.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(data.blending=this.blending),this.side!==FrontSide&&(data.side=this.side),this.vertexColors&&(data.vertexColors=!0),this.opacity<1&&(data.op
1acity=this.opacity),!0===this.transparent&&(data.transparent=this.transparent),data.depthFunc=this.depthFunc,data.depthTest=this.depthTest,data.depthWrite=this.depthWrite,data.colorWrite=this.colorWrite,data.stencilWrite=this.stencilWrite,data.stencilWriteMask=this.stencilWriteMask,data.stencilFunc=this.stencilFunc,data.stencilRef=this.stencilRef,data.stencilFuncMask=this.stencilFuncMask,data.stencilFail=this.stencilFail,data.stencilZFail=this.stencilZFail,data.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(data.rotation=this.rotation),!0===this.polygonOffset&&(data.polygonOffset=!0),0!==this.polygonOffsetFactor&&(data.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(data.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(data.linewidth=this.linewidth),void 0!==this.dashSize&&(data.dashSize=this.dashSize),void 0!==this.gapSize&&(data.gapSize=this.gapSize),void 0!==this.scale&&(data.scale=this.scale),!0===this.dithering&&(data.dithering=!0),this.alphaTest>0&&(data.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(data.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(data.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(data.wireframe=this.wireframe),this.wireframeLinewidth>1&&(data.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(data.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(data.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(data.flatShading=this.flatShading),!1===this.visible&&(data.visible=!1),!1===this.toneMapped&&(data.toneMapped=!1),!1===this.fog&&(data.fog=!1),"{}"!==JSON.stringify(this.userData)&&(data.userData=this.userData),isRootObject){let textures=extractFromCache(meta.textures),images=extractFromCache(meta.images);textures.length>0&&(data.textures=textures),images.length>0&&(data.images=images)}return data}clone(){return new this.constructor().copy(this)}copy(source){this.name=source.name,this.blending=source.blending,this.side=source.side,this.vertexColors=source.vertexColors,this.opacity=source.opacity,this.transparent=source.transparent,this.blendSrc=source.blendSrc,this.blendDst=source.blendDst,this.blendEquation=source.blendEquation,this.blendSrcAlpha=source.blendSrcAlpha,this.blendDstAlpha=source.blendDstAlpha,this.blendEquationAlpha=source.blendEquationAlpha,this.depthFunc=source.depthFunc,this.depthTest=source.depthTest,this.depthWrite=source.depthWrite,this.stencilWriteMask=source.stencilWriteMask,this.stencilFunc=source.stencilFunc,this.stencilRef=source.stencilRef,this.stencilFuncMask=source.stencilFuncMask,this.stencilFail=source.stencilFail,this.stencilZFail=source.stencilZFail,this.stencilZPass=source.stencilZPass,this.stencilWrite=source.stencilWrite;let srcPlanes=source.clippingPlanes,dstPlanes=null;if(null!==srcPlanes){let n=srcPlanes.length;dstPlanes=Array(n);for(let i=0;i!==n;++i)dstPlanes[i]=srcPlanes[i].clone()}return this.clippingPlanes=dstPlanes,this.clipIntersection=source.clipIntersection,this.clipShadows=source.clipShadows,this.shadowSide=source.shadowSide,this.colorWrite=source.colorWrite,this.precision=source.precision,this.polygonOffset=source.polygonOffset,this.polygonOffsetFactor=source.polygonOffsetFactor,this.polygonOffsetUnits=source.polygonOffsetUnits,this.dithering=source.dithering,this.alphaTest=source.alphaTest,this.alphaToCoverage=source.alphaToCoverage,this.premultipliedAlpha=source.premultipliedAlpha,this.visible=source.visible,this.toneMapped=source.toneMapped,this.userData=JSON.parse(JSON.stringify(source.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(value){!0===value&&this.version++}}class MeshBasicMaterial extends Material{constructor(parameters){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(parameters)}copy(source){return super.copy(source),this.color.copy(source.color),this.map=source.map,this.lightMap=source.lightMap,this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap,this.aoMapIntensity=source.aoMapIntensity,this.specularMap=source.specularMap,this.alphaMap=source.alphaMap,this.envMap=source.envMap,this.combine=source.combine,this.reflectivity=source.reflectivity,this.refractionRatio=source.refractionRatio,this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin,this.fog=source.fog,this}}let _vector$9=new Vector3,_vector2$1=new Vector2;class BufferAttribute{constructor(array,itemSize,normalized){if(Array.isArray(array))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=array,this.itemSize=itemSize,this.count=void 0!==array?array.length/itemSize:0,this.normalized=!0===normalized,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(value){!0===value&&this.version++}setUsage(value){return this.usage=value,this}copy(source){return this.name=source.name,this.array=new source.array.constructor(source.array),this.itemSize=source.itemSize,this.count=source.count,this.normalized=source.normalized,this.usage=source.usage,this}copyAt(index1,attribute,index2){index1*=this.itemSize,index2*=attribute.itemSize;
vendor: 6,554 bytes, line 1
1for(let i=0,l=this.itemSize;i<l;i++)this.array[index1+i]=attribute.array[index2+i];return this}copyArray(array){return this.array.set(array),this}applyMatrix3(m){if(2===this.itemSize)for(let i=0,l=this.count;i<l;i++)_vector2$1.fromBufferAttribute(this,i),_vector2$1.applyMatrix3(m),this.setXY(i,_vector2$1.x,_vector2$1.y);else if(3===this.itemSize)for(let i1=0,l1=this.count;i1<l1;i1++)_vector$9.fromBufferAttribute(this,i1),_vector$9.applyMatrix3(m),this.setXYZ(i1,_vector$9.x,_vector$9.y,_vector$9.z);return this}applyMatrix4(m){for(let i=0,l=this.count;i<l;i++)_vector$9.fromBufferAttribute(this,i),_vector$9.applyMatrix4(m),this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);return this}applyNormalMatrix(m){for(let i=0,l=this.count;i<l;i++)_vector$9.fromBufferAttribute(this,i),_vector$9.applyNormalMatrix(m),this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);return this}transformDirection(m){for(let i=0,l=this.count;i<l;i++)_vector$9.fromBufferAttribute(this,i),_vector$9.transformDirection(m),this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);return this}set(value,offset=0){return this.array.set(value,offset),this}getX(index){let x=this.array[index*this.itemSize];return this.normalized&&(x=denormalize(x,this.array)),x}setX(index,x){return this.normalized&&(x=normalize(x,this.array)),this.array[index*this.itemSize]=x,this}getY(index){let y=this.array[index*this.itemSize+1];return this.normalized&&(y=denormalize(y,this.array)),y}setY(index,y){return this.normalized&&(y=normalize(y,this.array)),this.array[index*this.itemSize+1]=y,this}getZ(index){let z=this.array[index*this.itemSize+2];return this.normalized&&(z=denormalize(z,this.array)),z}setZ(index,z){return this.normalized&&(z=normalize(z,this.array)),this.array[index*this.itemSize+2]=z,this}getW(index){let w=this.array[index*this.itemSize+3];return this.normalized&&(w=denormalize(w,this.array)),w}setW(index,w){return this.normalized&&(w=normalize(w,this.array)),this.array[index*this.itemSize+3]=w,this}setXY(index,x,y){return index*=this.itemSize,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array)),this.array[index+0]=x,this.array[index+1]=y,this}setXYZ(index,x,y,z){return index*=this.itemSize,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array),z=normalize(z,this.array)),this.array[index+0]=x,this.array[index+1]=y,this.array[index+2]=z,this}setXYZW(index,x,y,z,w){return index*=this.itemSize,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array),z=normalize(z,this.array),w=normalize(w,this.array)),this.array[index+0]=x,this.array[index+1]=y,this.array[index+2]=z,this.array[index+3]=w,this}onUpload(callback){return this.onUploadCallback=callback,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let data={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(data.name=this.name),35044!==this.usage&&(data.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(data.updateRange=this.updateRange),data}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class Uint16BufferAttribute extends BufferAttribute{constructor(array,itemSize,normalized){super(new Uint16Array(array),itemSize,normalized)}}class Uint32BufferAttribute extends BufferAttribute{constructor(array,itemSize,normalized){super(new Uint32Array(array),itemSize,normalized)}}class Float32BufferAttribute extends BufferAttribute{constructor(array,itemSize,normalized){super(new Float32Array(array),itemSize,normalized)}}let _id$1=0,_m1=new Matrix4,_obj=new Object3D,_offset=new Vector3,_box$1=new Box3,_boxMorphTargets=new Box3,_vector$8=new Vector3;class BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_id$1++}),this.uuid=generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(index){return Array.isArray(index)?this.index=new(arrayNeedsUint32(index)?Uint32BufferAttribute:Uint16BufferAttribute)(index,1):this.index=index,this}getAttribute(name){return this.attributes[name]}setAttribute(name,attribute){return this.attributes[name]=attribute,this}deleteAttribute(name){return delete this.attributes[name],this}hasAttribute(name){return void 0!==this.attributes[name]}addGroup(start,count,materialIndex=0){this.groups.push({start:start,count:count,materialIndex:materialIndex})}clearGroups(){this.groups=[]}setDrawRange(start,count){this.drawRange.start=start,this.drawRange.count=count}applyMatrix4(matrix){let position=this.attributes.position;void 0!==position&&(position.applyMatrix4(matrix),position.needsUpdate=!0);let normal=this.attributes.normal;if(void 0!==normal){let normalMatrix=new Matrix3().getNormalMatrix(matrix);normal.applyNormalMatrix(normalMatrix),normal.needsUpdate=!0}let tangent=this.attributes.tangent;return void 0!==tangent&&(tangent.transformDirection(matrix),tangent.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(q){return _m1.makeRotationFromQuaternion(q),this.applyMatrix4(_m1),this}rotateX(angle){return _m1.makeRotationX(angle),this.applyMatrix4(_m1),this}rotateY(angle){return _m1.makeRotationY(angle),this.applyMatrix4(_m1),this}rotateZ(angle){return _m1.makeRotationZ(angle),this.applyMatrix4(_m1),this}translate(x,y,z){return _m1.makeTranslation(x,y,z),this.applyMatrix4(_m1),this}scale(x,y,z){return _m1.makeScale(x,y,z),this.applyMatrix4(_m1),this}lookAt(vector){return _obj.lookAt(vector),_obj.updateMatrix(),this.applyMatrix4(_obj.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_offset).negate(),this.translate(_offset.x,_offset.y,_offset.z),this}setFromPoints(points){let position=[];for(let i=0,l=points.length;i<l;i++){let point=points[i];position.push(point.x,point.y,point.z||0)}return this.setAttribute("position",new Float32BufferAttribute(position,3)),this}
1computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);let position=this.attributes.position,morphAttributesPosition=this.morphAttributes.position;if(position&&position.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(Infinity,Infinity,Infinity));return}if(void 0!==position){if(this.boundingBox.setFromBufferAttribute(position),morphAttributesPosition)for(let i=0,il=morphAttributesPosition.length;i<il;i++){let morphAttribute=morphAttributesPosition[i];_box$1.setFromBufferAttribute(morphAttribute),this.morphTargetsRelative?(_vector$8.addVectors(this.boundingBox.min,_box$1.min),this.boundingBox.expandByPoint(_vector$8),_vector$8.addVectors(this.boundingBox.max,_box$1.max),this.boundingBox.expandByPoint(_vector$8)):(this.boundingBox.expandByPoint(_box$1.min),this.boundingBox.expandByPoint(_box$1.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);let position=this.attributes.position,morphAttributesPosition=this.morphAttributes.position;if(position&&position.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingSphere.set(new Vector3,1/0);return}if(position){let center=this.boundingSphere.center;if(_box$1.setFromBufferAttribute(position),morphAttributesPosition)for(let i=0,il=morphAttributesPosition.length;i<il;i++){let morphAttribute=morphAttributesPosition[i];_boxMorphTargets.setFromBufferAttribute(morphAttribute),this.morphTargetsRelative?(_vector$8.addVectors(_box$1.min,_boxMorphTargets.min),_box$1.expandByPoint(_vector$8),_vector$8.addVectors(_box$1.max,_boxMorphTargets.max),_box$1.expandByPoint(_vector$8)):(_box$1.expandByPoint(_boxMorphTargets.min),_box$1.expandByPoint(_boxMorphTargets.max))}_box$1.getCenter(center);let maxRadiusSq=0;for(let i1=0,il1=position.count;i1<il1;i1++)_vector$8.fromBufferAttribute(position,i1),maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector$8));if(morphAttributesPosition)for(let i2=0,il2=morphAttributesPosition.length;i2<il2;i2++){let morphAttribute1=morphAttributesPosition[i2],morphTargetsRelative=this.morphTargetsRelative;for(let j=0,jl=morphAttribute1.count;j<jl;j++)_vector$8.fromBufferAttribute(morphAttribute1,j),morphTargetsRelative&&(_offset.fromBufferAttribute(position,j),_vector$8.add(_offset)),maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector$8))}this.boundingSphere.radius=Math.sqrt(maxRadiusSq),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let index=this.index,attributes=this.attributes;if(null===index||void 0===attributes.position||void 0===attributes.normal||void 0===attributes.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let indices=index.array,positions=attributes.position.array,normals=attributes.normal.array,uvs=attributes.uv.array,nVertices=positions.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*nVertices),4));let tangents=this.getAttribute("tangent").array,tan1=[],tan2=[];for(let i=0;i<nVertices;i++)tan1[i]=new Vector3,tan2[i]=new Vector3;let vA=new Vector3,vB=new Vector3,vC=new Vector3,uvA=new Vector2,uvB=new Vector2,uvC=new Vector2,sdir=new Vector3,tdir=new Vector3,groups=this.groups;0===groups.length&&(groups=[{start:0,count:indices.length}]);for(let i1=0,il=groups.length;i1<il;++i1){let group=groups[i1],start=group.start,count=group.count;for(let j=start,jl=start+count;j<jl;j+=3)!function(a,b,c){vA.fromArray(positions,3*a),vB.fromArray(positions,3*b),vC.fromArray(positions,3*c),uvA.fromArray(uvs,2*a),uvB.fromArray(uvs,2*b),uvC.fromArray(uvs,2*c),vB.sub(vA),vC.sub(vA),uvB.sub(uvA),uvC.sub(uvA);let r=1/(uvB.x*uvC.y-uvC.x*uvB.y);isFinite(r)&&(sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC,-uvB.y).multiplyScalar(r),tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB,-uvC.x).multiplyScalar(r),tan1[a].add(sdir),tan1[b].add(sdir),tan1[c].add(sdir),tan2[a].add(tdir),tan2[b].add(tdir),tan2[c].add(tdir))}(indices[j+0],indices[j+1],indices[j+2])}let tmp=new Vector3,tmp2=new Vector3,n=new Vector3,n2=new Vector3;function handleVertex(v){n.fromArray(normals,3*v),n2.copy(n);let t=tan1[v];tmp.copy(t),tmp.sub(n.multiplyScalar(n.dot(t))).normalize(),tmp2.crossVectors(n2,t);let test=tmp2.dot(tan2[v]);tangents[4*v]=tmp.x,tangents[4*v+1]=tmp.y,tangents[4*v+2]=tmp.z,tangents[4*v+3]=test<0?-1:1}for(let i2=0,il1=groups.length;i2<il1;++i2){let group1=groups[i2],start1=group1.start,count1=group1.count;for(let j1=start1,jl1=start1+count1;j1<jl1;j1+=3)handleVertex(indices[j1+0]),handleVertex(indices[j1+1]),handleVertex(indices[j1+2])}}computeVertexNormals(){let index=this.index,positionAttribute=this.getAttribute("position");if(void 0!==positionAttribute){let normalAttribute=this.getAttribute("normal");if(void 0===normalAttribute)normalAttribute=new BufferAttribute(new Float32Array(3*positionAttribute.count),3),this.setAttribute("normal",normalAttribute);else for(let i=0,il=normalAttribute.count;i<il;i++)normalAttribute.setXYZ(i,0,0,0);
vendor: 3,037 bytes, line 1
1let pA=new Vector3,pB=new Vector3,pC=new Vector3,nA=new Vector3,nB=new Vector3,nC=new Vector3,cb=new Vector3,ab=new Vector3;if(index)for(let i1=0,il1=index.count;i1<il1;i1+=3){let vA=index.getX(i1+0),vB=index.getX(i1+1),vC=index.getX(i1+2);pA.fromBufferAttribute(positionAttribute,vA),pB.fromBufferAttribute(positionAttribute,vB),pC.fromBufferAttribute(positionAttribute,vC),cb.subVectors(pC,pB),ab.subVectors(pA,pB),cb.cross(ab),nA.fromBufferAttribute(normalAttribute,vA),nB.fromBufferAttribute(normalAttribute,vB),nC.fromBufferAttribute(normalAttribute,vC),nA.add(cb),nB.add(cb),nC.add(cb),normalAttribute.setXYZ(vA,nA.x,nA.y,nA.z),normalAttribute.setXYZ(vB,nB.x,nB.y,nB.z),normalAttribute.setXYZ(vC,nC.x,nC.y,nC.z)}else for(let i2=0,il2=positionAttribute.count;i2<il2;i2+=3)pA.fromBufferAttribute(positionAttribute,i2+0),pB.fromBufferAttribute(positionAttribute,i2+1),pC.fromBufferAttribute(positionAttribute,i2+2),cb.subVectors(pC,pB),ab.subVectors(pA,pB),cb.cross(ab),normalAttribute.setXYZ(i2+0,cb.x,cb.y,cb.z),normalAttribute.setXYZ(i2+1,cb.x,cb.y,cb.z),normalAttribute.setXYZ(i2+2,cb.x,cb.y,cb.z);this.normalizeNormals(),normalAttribute.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){let normals=this.attributes.normal;for(let i=0,il=normals.count;i<il;i++)_vector$8.fromBufferAttribute(normals,i),_vector$8.normalize(),normals.setXYZ(i,_vector$8.x,_vector$8.y,_vector$8.z)}toNonIndexed(){function convertBufferAttribute(attribute,indices){let array=attribute.array,itemSize=attribute.itemSize,normalized=attribute.normalized,array2=new array.constructor(indices.length*itemSize),index=0,index2=0;for(let i=0,l=indices.length;i<l;i++){index=attribute.isInterleavedBufferAttribute?indices[i]*attribute.data.stride+attribute.offset:indices[i]*itemSize;for(let j=0;j<itemSize;j++)array2[index2++]=array[index++]}return new BufferAttribute(array2,itemSize,normalized)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let geometry2=new BufferGeometry,indices=this.index.array,attributes=this.attributes;for(let name in attributes){let attribute=attributes[name],newAttribute=convertBufferAttribute(attribute,indices);geometry2.setAttribute(name,newAttribute)}let morphAttributes=this.morphAttributes;for(let name1 in morphAttributes){let morphArray=[],morphAttribute=morphAttributes[name1];for(let i=0,il=morphAttribute.length;i<il;i++){let attribute1=morphAttribute[i],newAttribute1=convertBufferAttribute(attribute1,indices);morphArray.push(newAttribute1)}geometry2.morphAttributes[name1]=morphArray}geometry2.morphTargetsRelative=this.morphTargetsRelative;let groups=this.groups;for(let i1=0,l=groups.length;i1<l;i1++){let group=groups[i1];geometry2.addGroup(group.start,group.count,group.materialIndex)}return geometry2}toJSON(){let data={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 4,804 bytes, line 1
1if(data.uuid=this.uuid,data.type=this.type,""!==this.name&&(data.name=this.name),Object.keys(this.userData).length>0&&(data.userData=this.userData),void 0!==this.parameters){let parameters=this.parameters;for(let key in parameters)void 0!==parameters[key]&&(data[key]=parameters[key]);return data}data.data={attributes:{}};let index=this.index;null!==index&&(data.data.index={type:index.array.constructor.name,array:Array.prototype.slice.call(index.array)});let attributes=this.attributes;for(let key1 in attributes){let attribute=attributes[key1];data.data.attributes[key1]=attribute.toJSON(data.data)}let morphAttributes={},hasMorphAttributes=!1;for(let key2 in this.morphAttributes){let attributeArray=this.morphAttributes[key2],array=[];for(let i=0,il=attributeArray.length;i<il;i++){let attribute1=attributeArray[i];array.push(attribute1.toJSON(data.data))}array.length>0&&(morphAttributes[key2]=array,hasMorphAttributes=!0)}hasMorphAttributes&&(data.data.morphAttributes=morphAttributes,data.data.morphTargetsRelative=this.morphTargetsRelative);let groups=this.groups;groups.length>0&&(data.data.groups=JSON.parse(JSON.stringify(groups)));let boundingSphere=this.boundingSphere;return null!==boundingSphere&&(data.data.boundingSphere={center:boundingSphere.center.toArray(),radius:boundingSphere.radius}),data}clone(){return new this.constructor().copy(this)}copy(source){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let data={};this.name=source.name;let index=source.index;null!==index&&this.setIndex(index.clone(data));let attributes=source.attributes;for(let name in attributes){let attribute=attributes[name];this.setAttribute(name,attribute.clone(data))}let morphAttributes=source.morphAttributes;for(let name1 in morphAttributes){let array=[],morphAttribute=morphAttributes[name1];for(let i=0,l=morphAttribute.length;i<l;i++)array.push(morphAttribute[i].clone(data));this.morphAttributes[name1]=array}this.morphTargetsRelative=source.morphTargetsRelative;let groups=source.groups;for(let i1=0,l1=groups.length;i1<l1;i1++){let group=groups[i1];this.addGroup(group.start,group.count,group.materialIndex)}let boundingBox=source.boundingBox;null!==boundingBox&&(this.boundingBox=boundingBox.clone());let boundingSphere=source.boundingSphere;return null!==boundingSphere&&(this.boundingSphere=boundingSphere.clone()),this.drawRange.start=source.drawRange.start,this.drawRange.count=source.drawRange.count,this.userData=source.userData,void 0!==source.parameters&&(this.parameters=Object.assign({},source.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}let _inverseMatrix$2=new Matrix4,_ray$2=new Ray,_sphere$3=new Sphere,_vA$1=new Vector3,_vB$1=new Vector3,_vC$1=new Vector3,_tempA=new Vector3,_tempB=new Vector3,_tempC=new Vector3,_morphA=new Vector3,_morphB=new Vector3,_morphC=new Vector3,_uvA$1=new Vector2,_uvB$1=new Vector2,_uvC$1=new Vector2,_intersectionPoint=new Vector3,_intersectionPointWorld=new Vector3;class Mesh extends Object3D{constructor(geometry=new BufferGeometry,material=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=geometry,this.material=material,this.updateMorphTargets()}copy(source,recursive){return super.copy(source,recursive),void 0!==source.morphTargetInfluences&&(this.morphTargetInfluences=source.morphTargetInfluences.slice()),void 0!==source.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},source.morphTargetDictionary)),this.material=source.material,this.geometry=source.geometry,this}updateMorphTargets(){let geometry=this.geometry,morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(keys.length>0){let morphAttribute=morphAttributes[keys[0]];if(void 0!==morphAttribute){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){let name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m}}}}raycast(raycaster,intersects){let intersection;let geometry=this.geometry,material=this.material,matrixWorld=this.matrixWorld;if(void 0===material||(null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere$3.copy(geometry.boundingSphere),_sphere$3.applyMatrix4(matrixWorld),!1===raycaster.ray.intersectsSphere(_sphere$3))||(_inverseMatrix$2.copy(matrixWorld).invert(),_ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2),null!==geometry.boundingBox&&!1===_ray$2.intersectsBox(geometry.boundingBox)))return;let index=geometry.index,position=geometry.attributes.position,morphPosition=geometry.morphAttributes.position,morphTargetsRelative=geometry.morphTargetsRelative,uv=geometry.attributes.uv,uv2=geometry.attributes.uv2,groups=geometry.groups,drawRange=geometry.drawRange;
1if(null!==index){if(Array.isArray(material))for(let i=0,il=groups.length;i<il;i++){let group=groups[i],groupMaterial=material[group.materialIndex],start=Math.max(group.start,drawRange.start),end=Math.min(index.count,Math.min(group.start+group.count,drawRange.start+drawRange.count));for(let j=start;j<end;j+=3){let a=index.getX(j),b=index.getX(j+1),c=index.getX(j+2);(intersection=checkBufferGeometryIntersection(this,groupMaterial,raycaster,_ray$2,position,morphPosition,morphTargetsRelative,uv,uv2,a,b,c))&&(intersection.faceIndex=Math.floor(j/3),intersection.face.materialIndex=group.materialIndex,intersects.push(intersection))}}else{let start1=Math.max(0,drawRange.start),end1=Math.min(index.count,drawRange.start+drawRange.count);for(let i1=start1;i1<end1;i1+=3){let a1=index.getX(i1),b1=index.getX(i1+1),c1=index.getX(i1+2);(intersection=checkBufferGeometryIntersection(this,material,raycaster,_ray$2,position,morphPosition,morphTargetsRelative,uv,uv2,a1,b1,c1))&&(intersection.faceIndex=Math.floor(i1/3),intersects.push(intersection))}}}else if(void 0!==position){if(Array.isArray(material))for(let i2=0,il1=groups.length;i2<il1;i2++){let group1=groups[i2],groupMaterial1=material[group1.materialIndex],start2=Math.max(group1.start,drawRange.start),end2=Math.min(position.count,Math.min(group1.start+group1.count,drawRange.start+drawRange.count));for(let j1=start2;j1<end2;j1+=3){let a2=j1,b2=j1+1,c2=j1+2;(intersection=checkBufferGeometryIntersection(this,groupMaterial1,raycaster,_ray$2,position,morphPosition,morphTargetsRelative,uv,uv2,a2,b2,c2))&&(intersection.faceIndex=Math.floor(j1/3),intersection.face.materialIndex=group1.materialIndex,intersects.push(intersection))}}else{let start3=Math.max(0,drawRange.start),end3=Math.min(position.count,drawRange.start+drawRange.count);for(let i3=start3;i3<end3;i3+=3){let a3=i3,b3=i3+1,c3=i3+2;(intersection=checkBufferGeometryIntersection(this,material,raycaster,_ray$2,position,morphPosition,morphTargetsRelative,uv,uv2,a3,b3,c3))&&(intersection.faceIndex=Math.floor(i3/3),intersects.push(intersection))}}}}}function checkBufferGeometryIntersection(object,material,raycaster,ray,position,morphPosition,morphTargetsRelative,uv,uv2,a,b,c){_vA$1.fromBufferAttribute(position,a),_vB$1.fromBufferAttribute(position,b),_vC$1.fromBufferAttribute(position,c);let morphInfluences=object.morphTargetInfluences;if(morphPosition&&morphInfluences){_morphA.set(0,0,0),_morphB.set(0,0,0),_morphC.set(0,0,0);for(let i=0,il=morphPosition.length;i<il;i++){let influence=morphInfluences[i],morphAttribute=morphPosition[i];0!==influence&&(_tempA.fromBufferAttribute(morphAttribute,a),_tempB.fromBufferAttribute(morphAttribute,b),_tempC.fromBufferAttribute(morphAttribute,c),morphTargetsRelative?(_morphA.addScaledVector(_tempA,influence),_morphB.addScaledVector(_tempB,influence),_morphC.addScaledVector(_tempC,influence)):(_morphA.addScaledVector(_tempA.sub(_vA$1),influence),_morphB.addScaledVector(_tempB.sub(_vB$1),influence),_morphC.addScaledVector(_tempC.sub(_vC$1),influence)))}_vA$1.add(_morphA),_vB$1.add(_morphB),_vC$1.add(_morphC)}object.isSkinnedMesh&&(object.boneTransform(a,_vA$1),object.boneTransform(b,_vB$1),object.boneTransform(c,_vC$1));let intersection=function(object,material,raycaster,ray,pA,pB,pC,point){if(null===(material.side===BackSide?ray.intersectTriangle(pC,pB,pA,!0,point):ray.intersectTriangle(pA,pB,pC,material.side!==DoubleSide,point)))return null;_intersectionPointWorld.copy(point),_intersectionPointWorld.applyMatrix4(object.matrixWorld);let distance=raycaster.ray.origin.distanceTo(_intersectionPointWorld);return distance<raycaster.near||distance>raycaster.far?null:{distance:distance,point:_intersectionPointWorld.clone(),object:object}}(object,material,raycaster,ray,_vA$1,_vB$1,_vC$1,_intersectionPoint);if(intersection){uv&&(_uvA$1.fromBufferAttribute(uv,a),_uvB$1.fromBufferAttribute(uv,b),_uvC$1.fromBufferAttribute(uv,c),intersection.uv=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2)),uv2&&(_uvA$1.fromBufferAttribute(uv2,a),_uvB$1.fromBufferAttribute(uv2,b),_uvC$1.fromBufferAttribute(uv2,c),intersection.uv2=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2));let face={a:a,b:b,c:c,normal:new Vector3,materialIndex:0};Triangle.getNormal(_vA$1,_vB$1,_vC$1,face.normal),intersection.face=face}return intersection}class BoxGeometry extends BufferGeometry{constructor(width=1,height=1,depth=1,widthSegments=1,heightSegments=1,depthSegments=1){super(),this.type="BoxGeometry",this.parameters={width:width,height:height,depth:depth,widthSegments:widthSegments,heightSegments:heightSegments,depthSegments:depthSegments};let scope=this;widthSegments=Math.floor(widthSegments),heightSegments=Math.floor(heightSegments),depthSegments=Math.floor(depthSegments);let indices=[],vertices=[],normals=[],uvs=[],numberOfVertices=0,groupStart=0;function buildPlane(u,v,w,udir,vdir,width,height,depth,gridX,gridY,materialIndex){let segmentWidth=width/gridX,segmentHeight=height/gridY,widthHalf=width/2,heightHalf=height/2,depthHalf=
1depth/2,gridX1=gridX+1,gridY1=gridY+1,vertexCounter=0,groupCount=0,vector=new Vector3;for(let iy=0;iy<gridY1;iy++){let y=iy*segmentHeight-heightHalf;for(let ix=0;ix<gridX1;ix++){let x=ix*segmentWidth-widthHalf;vector[u]=x*udir,vector[v]=y*vdir,vector[w]=depthHalf,vertices.push(vector.x,vector.y,vector.z),vector[u]=0,vector[v]=0,vector[w]=depth>0?1:-1,normals.push(vector.x,vector.y,vector.z),uvs.push(ix/gridX),uvs.push(1-iy/gridY),vertexCounter+=1}}for(let iy1=0;iy1<gridY;iy1++)for(let ix1=0;ix1<gridX;ix1++){let a=numberOfVertices+ix1+gridX1*iy1,b=numberOfVertices+ix1+gridX1*(iy1+1),c=numberOfVertices+(ix1+1)+gridX1*(iy1+1),d=numberOfVertices+(ix1+1)+gridX1*iy1;indices.push(a,b,d),indices.push(b,c,d),groupCount+=6}scope.addGroup(groupStart,groupCount,materialIndex),groupStart+=groupCount,numberOfVertices+=vertexCounter}buildPlane("z","y","x",-1,-1,depth,height,width,depthSegments,heightSegments,0),buildPlane("z","y","x",1,-1,depth,height,-width,depthSegments,heightSegments,1),buildPlane("x","z","y",1,1,width,depth,height,widthSegments,depthSegments,2),buildPlane("x","z","y",1,-1,width,depth,-height,widthSegments,depthSegments,3),buildPlane("x","y","z",1,-1,width,height,depth,widthSegments,heightSegments,4),buildPlane("x","y","z",-1,-1,width,height,-depth,widthSegments,heightSegments,5),this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new BoxGeometry(data.width,data.height,data.depth,data.widthSegments,data.heightSegments,data.depthSegments)}}function cloneUniforms(src){let dst={};for(let u in src)for(let p in dst[u]={},src[u]){let property=src[u][p];property&&(property.isColor||property.isMatrix3||property.isMatrix4||property.isVector2||property.isVector3||property.isVector4||property.isTexture||property.isQuaternion)?dst[u][p]=property.clone():Array.isArray(property)?dst[u][p]=property.slice():dst[u][p]=property}return dst}function mergeUniforms(uniforms){let merged={};for(let u=0;u<uniforms.length;u++){let tmp=cloneUniforms(uniforms[u]);for(let p in tmp)merged[p]=tmp[p]}return merged}let UniformsUtils={clone:cloneUniforms,merge:mergeUniforms};class ShaderMaterial extends Material{constructor(parameters){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==parameters&&this.setValues(parameters)}copy(source){return super.copy(source),this.fragmentShader=source.fragmentShader,this.vertexShader=source.vertexShader,this.uniforms=cloneUniforms(source.uniforms),this.uniformsGroups=function(src){let dst=[];for(let u=0;u<src.length;u++)dst.push(src[u].clone());return dst}(source.uniformsGroups),this.defines=Object.assign({},source.defines),this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.fog=source.fog,this.lights=source.lights,this.clipping=source.clipping,this.extensions=Object.assign({},source.extensions),this.glslVersion=source.glslVersion,this}toJSON(meta){let data=super.toJSON(meta);for(let name in data.glslVersion=this.glslVersion,data.uniforms={},this.uniforms){let uniform=this.uniforms[name],value=uniform.value;value&&value.isTexture?data.uniforms[name]={type:"t",value:value.toJSON(meta).uuid}:value&&value.isColor?data.uniforms[name]={type:"c",value:value.getHex()}:value&&value.isVector2?data.uniforms[name]={type:"v2",value:value.toArray()}:value&&value.isVector3?data.uniforms[name]={type:"v3",value:value.toArray()}:value&&value.isVector4?data.uniforms[name]={type:"v4",value:value.toArray()}:value&&value.isMatrix3?data.uniforms[name]={type:"m3",value:value.toArray()}:value&&value.isMatrix4?data.uniforms[name]={type:"m4",value:value.toArray()}:data.uniforms[name]={value:value}}Object.keys(this.defines).length>0&&(data.defines=this.defines),data.vertexShader=this.vertexShader,data.fragmentShader=this.fragmentShader;let extensions={};for(let key in this.extensions)!0===this.extensions[key]&&(extensions[key]=!0);return Object.keys(extensions).length>0&&(data.extensions=extensions),data}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4}copy(source,recursive){return super.copy(source,recursive),this.matrixWorldInverse.copy(source.matrixWorldInverse),this.projectionMatrix.copy(source.projectionMatrix),this.projectionMatrixInverse.copy(source.projectionMatrixInverse),this}getWorldDirection(target){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return target.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(force){super.updateMatrixWorld(force),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(updateParents,updateChildren){super.updateWorldMatrix(updateParents,updateChildren),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class PerspectiveCamera extends Camera{constructor(fov=50,aspect=1,near=.1,far=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=fov,this.zoom=1,this.near=near,this.far=far,this.focus=10,this.aspect=aspect,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(source,recursive){return super.copy(source,recursive),this.fov=source.fov,this.zoom=source.zoom,this.near=source.near,this.far=source.far,this.focus=source.focu
1s,this.aspect=source.aspect,this.view=null===source.view?null:Object.assign({},source.view),this.filmGauge=source.filmGauge,this.filmOffset=source.filmOffset,this}setFocalLength(focalLength){let vExtentSlope=.5*this.getFilmHeight()/focalLength;this.fov=2*RAD2DEG*Math.atan(vExtentSlope),this.updateProjectionMatrix()}getFocalLength(){let vExtentSlope=Math.tan(.5*DEG2RAD*this.fov);return .5*this.getFilmHeight()/vExtentSlope}getEffectiveFOV(){return 2*RAD2DEG*Math.atan(Math.tan(.5*DEG2RAD*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(fullWidth,fullHeight,x,y,width,height){this.aspect=fullWidth/fullHeight,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=fullWidth,this.view.fullHeight=fullHeight,this.view.offsetX=x,this.view.offsetY=y,this.view.width=width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let near=this.near,top=near*Math.tan(.5*DEG2RAD*this.fov)/this.zoom,height=2*top,width=this.aspect*height,left=-.5*width,view=this.view;if(null!==this.view&&this.view.enabled){let fullWidth=view.fullWidth,fullHeight=view.fullHeight;left+=view.offsetX*width/fullWidth,top-=view.offsetY*height/fullHeight,width*=view.width/fullWidth,height*=view.height/fullHeight}let skew=this.filmOffset;0!==skew&&(left+=near*skew/this.getFilmWidth()),this.projectionMatrix.makePerspective(left,left+width,top,top-height,near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(meta){let data=super.toJSON(meta);return data.object.fov=this.fov,data.object.zoom=this.zoom,data.object.near=this.near,data.object.far=this.far,data.object.focus=this.focus,data.object.aspect=this.aspect,null!==this.view&&(data.object.view=Object.assign({},this.view)),data.object.filmGauge=this.filmGauge,data.object.filmOffset=this.filmOffset,data}}class CubeCamera extends Object3D{constructor(near,far,renderTarget){super(),this.type="CubeCamera",this.renderTarget=renderTarget;let cameraPX=new PerspectiveCamera(90,1,near,far);cameraPX.layers=this.layers,cameraPX.up.set(0,-1,0),cameraPX.lookAt(new Vector3(1,0,0)),this.add(cameraPX);let cameraNX=new PerspectiveCamera(90,1,near,far);cameraNX.layers=this.layers,cameraNX.up.set(0,-1,0),cameraNX.lookAt(new Vector3(-1,0,0)),this.add(cameraNX);let cameraPY=new PerspectiveCamera(90,1,near,far);cameraPY.layers=this.layers,cameraPY.up.set(0,0,1),cameraPY.lookAt(new Vector3(0,1,0)),this.add(cameraPY);let cameraNY=new PerspectiveCamera(90,1,near,far);cameraNY.layers=this.layers,cameraNY.up.set(0,0,-1),cameraNY.lookAt(new Vector3(0,-1,0)),this.add(cameraNY);let cameraPZ=new PerspectiveCamera(90,1,near,far);cameraPZ.layers=this.layers,cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new Vector3(0,0,1)),this.add(cameraPZ);let cameraNZ=new PerspectiveCamera(90,1,near,far);cameraNZ.layers=this.layers,cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new Vector3(0,0,-1)),this.add(cameraNZ)}update(renderer,scene){null===this.parent&&this.updateMatrixWorld();let renderTarget=this.renderTarget,[cameraPX,cameraNX,cameraPY,cameraNY,cameraPZ,cameraNZ]=this.children,currentRenderTarget=renderer.getRenderTarget(),currentToneMapping=renderer.toneMapping,currentXrEnabled=renderer.xr.enabled;renderer.toneMapping=NoToneMapping,renderer.xr.enabled=!1;let generateMipmaps=renderTarget.texture.generateMipmaps;renderTarget.texture.generateMipmaps=!1,renderer.setRenderTarget(renderTarget,0),renderer.render(scene,cameraPX),renderer.setRenderTarget(renderTarget,1),renderer.render(scene,cameraNX),renderer.setRenderTarget(renderTarget,2),renderer.render(scene,cameraPY),renderer.setRenderTarget(renderTarget,3),renderer.render(scene,cameraNY),renderer.setRenderTarget(renderTarget,4),renderer.render(scene,cameraPZ),renderTarget.texture.generateMipmaps=generateMipmaps,renderer.setRenderTarget(renderTarget,5),renderer.render(scene,cameraNZ),renderer.setRenderTarget(currentRenderTarget),renderer.toneMapping=currentToneMapping,renderer.xr.enabled=currentXrEnabled,renderTarget.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(images,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,encoding){super(images=void 0!==images?images:[],mapping=void 0!==mapping?mapping:301,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,encoding),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(value){this.image=value}}
1class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(size=1,options={}){super(size,size,options),this.isWebGLCubeRenderTarget=!0;let image={width:size,height:size,depth:1};this.texture=new CubeTexture([image,image,image,image,image,image],options.mapping,options.wrapS,options.wrapT,options.magFilter,options.minFilter,options.format,options.type,options.anisotropy,options.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==options.generateMipmaps&&options.generateMipmaps,this.texture.minFilter=void 0!==options.minFilter?options.minFilter:LinearFilter}fromEquirectangularTexture(renderer,texture){this.texture.type=texture.type,this.texture.encoding=texture.encoding,this.texture.generateMipmaps=texture.generateMipmaps,this.texture.minFilter=texture.minFilter,this.texture.magFilter=texture.magFilter;let shader={uniforms:{tEquirect:{value:null}},vertexShader:` 2 3 varying vec3 vWorldDirection; 4 5 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 6 7 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 8 9 } 10 11 void main() { 12 13 vWorldDirection = transformDirection( position, modelMatrix ); 14 15 #include <begin_vertex> 16 #include <project_vertex> 17 18 } 19 `,fragmentShader:` 20 21 uniform sampler2D tEquirect; 22 23 varying vec3 vWorldDirection; 24 25 #include <common> 26 27 void main() { 28 29 vec3 direction = normalize( vWorldDirection ); 30 31 vec2 sampleUV = equirectUv( direction ); 32 33 gl_FragColor = texture2D( tEquirect, sampleUV ); 34 35 } 36 `},geometry=new BoxGeometry(5,5,5),material=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(shader.uniforms),vertexShader:shader.vertexShader,fragmentShader:shader.fragmentShader,side:BackSide,blending:NoBlending});material.uniforms.tEquirect.value=texture;let mesh=new Mesh(geometry,material),currentMinFilter=texture.minFilter;texture.minFilter===LinearMipmapLinearFilter&&(texture.minFilter=LinearFilter);let camera=new CubeCamera(1,10,this);return camera.update(renderer,mesh),texture.minFilter=currentMinFilter,mesh.geometry.dispose(),mesh.material.dispose(),this}clear(renderer,color,depth,stencil){let currentRenderTarget=renderer.getRenderTarget();for(let i=0;i<6;i++)renderer.setRenderTarget(this,i),renderer.clear(color,depth,stencil);renderer.setRenderTarget(currentRenderTarget)}}let _vector1=new Vector3,_vector2=new Vector3,_normalMatrix=new Matrix3;class Plane{constructor(normal=new Vector3(1,0,0),constant=0){this.isPlane=!0,this.normal=normal,this.constant=constant}set(normal,constant){return this.normal.copy(normal),this.constant=constant,this}setComponents(x,y,z,w){return this.normal.set(x,y,z),this.constant=w,this}setFromNormalAndCoplanarPoint(normal,point){return this.normal.copy(normal),this.constant=-point.dot(this.normal),this}setFromCoplanarPoints(a,b,c){let normal=_vector1.subVectors(c,b).cross(_vector2.subVectors(a,b)).normalize();return this.setFromNormalAndCoplanarPoint(normal,a),this}copy(plane){return this.normal.copy(plane.normal),this.constant=plane.constant,this}normalize(){let inverseNormalLength=1/this.normal.length();return this.normal.multiplyScalar(inverseNormalLength),this.constant*=inverseNormalLength,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(point){return this.normal.dot(point)+this.constant}distanceToSphere(sphere){return this.distanceToPoint(sphere.center)-sphere.radius}projectPoint(point,target){return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point)}intersectLine(line,target){let direction=line.delta(_vector1),denominator=this.normal.dot(direction);if(0===denominator)return 0===this.distanceToPoint(line.start)?target.copy(line.start):null;let t=-(line.start.dot(this.normal)+this.constant)/denominator;return t<0||t>1?null:target.copy(direction).multiplyScalar(t).add(line.start)}intersectsLine(line){let startSign=this.distanceToPoint(line.start),endSign=this.distanceToPoint(line.end);return startSign<0&&endSign>0||endSign<0&&startSign>0}intersectsBox(box){return box.intersectsPlane(this)}intersectsSphere(sphere){return sphere.intersectsPlane(this)}coplanarPoint(target){return target.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(matrix,optionalNormalMatrix){let normalMatrix=optionalNormalMatrix||_normalMatrix.getNormalMatrix(matrix),referencePoint=this.coplanarPoint(_vector1).applyMatrix4(matrix),normal=this.normal.applyM
36atrix3(normalMatrix).normalize();return this.constant=-referencePoint.dot(normal),this}translate(offset){return this.constant-=offset.dot(this.normal),this}equals(plane){return plane.normal.equals(this.normal)&&plane.constant===this.constant}clone(){return new this.constructor().copy(this)}}let _sphere$2=new Sphere,_vector$7=new Vector3;class Frustum{constructor(p0=new Plane,p1=new Plane,p2=new Plane,p3=new Plane,p4=new Plane,p5=new Plane){this.planes=[p0,p1,p2,p3,p4,p5]}set(p0,p1,p2,p3,p4,p5){let planes=this.planes;return planes[0].copy(p0),planes[1].copy(p1),planes[2].copy(p2),planes[3].copy(p3),planes[4].copy(p4),planes[5].copy(p5),this}copy(frustum){let planes=this.planes;for(let i=0;i<6;i++)planes[i].copy(frustum.planes[i]);return this}setFromProjectionMatrix(m){let planes=this.planes,me=m.elements,me0=me[0],me1=me[1],me2=me[2],me3=me[3],me4=me[4],me5=me[5],me6=me[6],me7=me[7],me8=me[8],me9=me[9],me10=me[10],me11=me[11],me12=me[12],me13=me[13],me14=me[14],me15=me[15];return planes[0].setComponents(me3-me0,me7-me4,me11-me8,me15-me12).normalize(),planes[1].setComponents(me3+me0,me7+me4,me11+me8,me15+me12).normalize(),planes[2].setComponents(me3+me1,me7+me5,me11+me9,me15+me13).normalize(),planes[3].setComponents(me3-me1,me7-me5,me11-me9,me15-me13).normalize(),planes[4].setComponents(me3-me2,me7-me6,me11-me10,me15-me14).normalize(),planes[5].setComponents(me3+me2,me7+me6,me11+me10,me15+me14).normalize(),this}intersectsObject(object){let geometry=object.geometry;return null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere$2.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSprite(sprite){return _sphere$2.center.set(0,0,0),_sphere$2.radius=.7071067811865476,_sphere$2.applyMatrix4(sprite.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSphere(sphere){let planes=this.planes,center=sphere.center,negRadius=-s
36phere.radius;for(let i=0;i<6;i++){let distance=planes[i].distanceToPoint(center);if(distance<negRadius)return!1}return!0}intersectsBox(box){let planes=this.planes;for(let i=0;i<6;i++){let plane=planes[i];if(_vector$7.x=plane.normal.x>0?box.max.x:box.min.x,_vector$7.y=plane.normal.y>0?box.max.y:box.min.y,_vector$7.z=plane.normal.z>0?box.max.z:box.min.z,0>plane.distanceToPoint(_vector$7))return!1}return!0}containsPoint(point){let planes=this.planes;for(let i=0;i<6;i++)if(0>planes[i].distanceToPoint(point))return!1;return!0}clone(){return new this.constructor().copy(this)}}function WebGLAnimation(){let context=null,isAnimating=!1,animationLoop=null,requestId=null;function onAnimationFrame(time,frame){animationLoop(time,frame),requestId=context.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==isAnimating&&null!==animationLoop&&(requestId=context.requestAnimationFrame(onAnimationFrame),isAnimating=!0)},stop:function(){context.cancelAnimationFrame(requestId),isAnimating=!1},setAnimationLoop:function(callback){animationLoop=callback},setContext:function(value){context=value}}}function WebGLAttributes(gl,capabilities){let isWebGL2=capabilities.isWebGL2,buffers=new WeakMap;return{get:function(attribute){return attribute.isInterleavedBufferAttribute&&(attribute=attribute.data),buffers.get(attribute)},remove:function(attribute){attribute.isInterleavedBufferAttribute&&(attribute=attribute.data);let data=buffers.get(attribute);data&&(gl.deleteBuffer(data.buffer),buffers.delete(attribute))},update:function(attribute,bufferType){if(attribute.isGLBufferAttribute){let cached=buffers.get(attribute);(!cached||cached.version<attribute.version)&&buffers.set(attribute,{buffer:attribute.buffer,type:attribute.type,bytesPerElement:attribute.elementSize,version:attribute.version});return}attribute.isInterleavedBufferAttribute&&(attribute=attribute.data);let data=buffers.get(attribute);void 0===data?buffers.set(attribute,function(attribute,bufferType){let type;let array=attribute.array,usage=attribute.usage,buffer=gl.createBuffer();if(gl.bindBuffer(bufferType,buffer),gl.bufferData(bufferType,array,usage),attribute.onUploadCallback(),array instanceof Float32Array)type=5126;else if(array instanceof Uint16Array){if(attribute.isFloat16BufferAttribute){if(isWebGL2)type=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else type=5123}else if(array instanceof Int16Array)type=5122;else if(array instanceof Uint32Array)type=5125;else if(array instanceof Int32Array)type=5124;else if(array instanceof Int8Array)type=5120;else if(array instanceof Uint8Array)type=5121;else if(array instanceof Uint8ClampedArray)type=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+array);return{buffer:buffer,type:type,bytesPerElement:array.BYTES_PER_ELEMENT,version:attribute.version}}(attribute,bufferType)):data.version<attribute.version&&(!function(buffer,attribute,bufferType){let array=attribute.array,updateRange=attribute.updateRange;gl.bindBuffer(bufferType,buffer),-1===updateRange.count?gl.bufferSubData(bufferType,0,array):(isWebGL2?gl.bufferSubData(bufferType,updateRange.offset*array.BYTES_PER_ELEMENT,array,updateRange.offset,updateRange.count):gl.bufferSubData(bufferType,updateRange.offset*array.BYTES_PER_ELEMENT,array.subarray(updateRange.offset,updateRange.offset+updateRange.count)),updateRange.count=-1)}(data.buffer,attribute,bufferType),data.version=attribute.version)}}}class PlaneGeometry extends BufferGeometry{constructor(width=1,height=1,widthSegments=1,heightSegments=1){super(),this.type="PlaneGeometry",this.parameters={width:width,height:height,widthSegments:widthSegments,heightSegments:heightSegments};let width_half=width/2,height_half=height/2,gridX=Math.floor(widthSegments),gridY=Math.floor(heightSegments),gridX1=gridX+1,gridY1=gridY+1,segment_width=width/gridX,segment_height=height/gridY,indices=[],vertices=[],normals=[],uvs=[];for(let iy=0;iy<gridY1;iy++){let y=iy*segment_height-height_half;for(let ix=0;ix<gridX1;ix++){let x=ix*segment_width-width_half;
vendor: 4,514 bytes, line 36
36vertices.push(x,-y,0),normals.push(0,0,1),uvs.push(ix/gridX),uvs.push(1-iy/gridY)}}for(let iy1=0;iy1<gridY;iy1++)for(let ix1=0;ix1<gridX;ix1++){let a=ix1+gridX1*iy1,b=ix1+gridX1*(iy1+1),c=ix1+1+gridX1*(iy1+1),d=ix1+1+gridX1*iy1;indices.push(a,b,d),indices.push(b,c,d)}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new PlaneGeometry(data.width,data.height,data.widthSegments,data.heightSegments)}}let ShaderChunk={alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;
36\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
36\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float R21 = R12;\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
36placementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #if defined( ENVMAP_TYPE_CUBE_UV )\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #if defined( ENVMAP_TYPE_CUBE_UV )\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n }
36 else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material ) (0)",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #else\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometry.position;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }
36\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometry.position;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material ) (0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULARINTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n #endif\n #ifdef USE_SPECULARCOLORMAP\n specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;
36\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEENCOLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEENROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n #endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;
36\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n #endif\n #ifdef USE_IRIDESCENCE\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n #else\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat c
36omputeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometry, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometry.normal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * faceDirection;\n bitangent = bitangent * faceDirection;\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );
36\n #else\n normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n #endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;
36\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;
36\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
36\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
36\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmission = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n #ifdef texture2DLodEXT\n return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n #else\n return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n #endif\n }\n vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return radiance;\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n }\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
36IGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n #endif\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
36\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n #ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;
36\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
36\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}"},UniformsLib={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Matrix3},uv2Transform:{value:new Matrix3},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Vector2(1,1)}}
vendor: 5,913 bytes, line 36
36,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}}},ShaderLib={basic:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.fog]),vertexShader:ShaderChunk.meshbasic_vert,fragmentShader:ShaderChunk.meshbasic_frag},lambert:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshlambert_vert,fragmentShader:ShaderChunk.meshlambert_frag},phong:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:ShaderChunk.meshphong_vert,fragmentShader:ShaderChunk.meshphong_frag},standard:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.roughnessmap,UniformsLib.metalnessmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag},toon:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.gradientmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshtoon_vert,fragmentShader:ShaderChunk.meshtoon_frag},matcap:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk.meshmatcap_vert,fragmentShader:ShaderChunk.meshmatcap_frag},points:{uniforms:mergeUniforms([UniformsLib.points,UniformsLib.fog]),vertexShader:ShaderChunk.points_vert,fragmentShader:ShaderChunk.points_frag},dashed:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk.linedashed_vert,fragmentShader:ShaderChunk.linedashed_frag},depth:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap]),vertexShader:ShaderChunk.depth_vert,fragmentShader:ShaderChunk.depth_frag},normal:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,{opacity:{value:1}}]),vertexShader:ShaderChunk.meshnormal_vert,fragmentShader:ShaderChunk.meshnormal_frag},sprite:{uniforms:mergeUniforms([UniformsLib.sprite,UniformsLib.fog]),vertexShader:ShaderChunk.sprite_vert,fragmentShader:ShaderChunk.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null}},vertexShader:ShaderChunk.background_vert,fragmentShader:ShaderChunk.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0}},vertexShader:ShaderChunk.backgroundCube_vert,fragmentShader:ShaderChunk.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ShaderChunk.cube_vert,fragmentShader:ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ShaderChunk.equirect_vert,fragmentShader:ShaderChunk.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ShaderChunk.distanceRGBA_vert,fragmentShader:ShaderChunk.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([UniformsLib.lights,UniformsLib.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:ShaderChunk.shadow_vert,fragmentShader:ShaderChunk.shadow_frag}};
36function WebGLBackground(renderer,cubemaps,cubeuvmaps,state,objects,alpha,premultipliedAlpha){let planeMesh,boxMesh;let clearColor=new Color(0),clearAlpha=!0===alpha?0:1,currentBackground=null,currentBackgroundVersion=0,currentTonemapping=null;function setClear(color,alpha){state.buffers.color.setClear(color.r,color.g,color.b,alpha,premultipliedAlpha)}return{getClearColor:function(){return clearColor},setClearColor:function(color,alpha=1){clearColor.set(color),setClear(clearColor,clearAlpha=alpha)},getClearAlpha:function(){return clearAlpha},setClearAlpha:function(alpha){setClear(clearColor,clearAlpha=alpha)},render:function(renderList,scene){let forceClear=!1,background=!0===scene.isScene?scene.background:null;if(background&&background.isTexture){let usePMREM=scene.backgroundBlurriness>0;background=(usePMREM?cubeuvmaps:cubemaps).get(background)}let xr=renderer.xr,session=xr.getSession&&xr.getSession();session&&"additive"===session.environmentBlendMode&&(background=null),null===background?setClear(clearColor,clearAlpha):background&&background.isColor&&(setClear(background,1),forceClear=!0),(renderer.autoClear||forceClear)&&renderer.clear(renderer.autoClearColor,renderer.autoClearDepth,renderer.autoClearStencil),background&&(background.isCubeTexture||306===background.mapping)?(void 0===boxMesh&&((boxMesh=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(ShaderLib.backgroundCube.uniforms),vertexShader:ShaderLib.backgroundCube.vertexShader,fragmentShader:ShaderLib.backgroundCube.fragmentShader,side:BackSide,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),boxMesh.geometry.deleteAttribute("uv"),boxMesh.onBeforeRender=function(renderer,scene,camera){this.matrixWorld.copyPosition(camera.matrixWorld)},Object.defineProperty(boxMesh.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),objects.update(boxMesh)),boxMesh.material.uniforms.envMap.value=background,boxMesh.material.uniforms.flipEnvMap.value=background.isCubeTexture&&!1===background.isRenderTargetTexture?-1:1,boxMesh.material.uniforms.backgroundBlurriness.value=scene.backgroundBlurriness,(currentBackground!==background||currentBackgroundVersion!==background.version||currentTonemapping!==renderer.toneMapping)&&(boxMesh.material.needsUpdate=!0,currentBackground=background,currentBackgroundVersion=background.version,currentTonemapping=renderer.toneMapping),boxMesh.layers.enableAll(),renderList.unshift(boxMesh,boxMesh.geometry,boxMesh.material,0,0,null)):background&&background.isTexture&&(void 0===planeMesh&&((planeMesh=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(ShaderLib.background.uniforms),vertexShader:ShaderLib.background.vertexShader,fragmentShader:ShaderLib.background.fragmentShader,side:FrontSide,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(planeMesh.material,"map",{get:function(){return this.uniforms.t2D.value}}),objects.update(planeMesh)),planeMesh.material.uniforms.t2D.value=background,!0===background.matrixAutoUpdate&&background.updateMatrix(),planeMesh.material.uniforms.uvTransform.value.copy(background.matrix),(currentBackground!==background||currentBackgroundVersion!==background.version||currentTonemapping!==renderer.toneMapping)&&(planeMesh.material.needsUpdate=!0,currentBackground=background,currentBackgroundVersion=background.version,currentTonemapping=renderer.toneMapping),planeMesh.layers.enableAll(),renderList.unshift(planeMesh,planeMesh.geometry,planeMesh.material,0,0,null))}}}function WebGLBindingStates(gl,extensions,attributes,capabilities){let maxVertexAttributes=gl.getParameter(34921),extension=capabilities.isWebGL2?null:extensions.get("OES_vertex_array_object"),vaoAvailable=capabilities.isWebGL2||null!==extension,bindingStates={},defaultState=createBindingState(null),currentState=defaultState,forceUpdate=!1;function bindVertexArrayObject(vao){return capabilities.isWebGL2?gl.bindVertexArray(vao):extension.bindVertexArrayOES(vao)}function deleteVertexArrayObject(vao){return capabilities.isWebGL2?gl.deleteVertexArray(vao):extension.deleteVertexArrayOES(vao)}function createBindingState(vao){let newAttributes=[],enabledAttributes=[],attributeDivisors=[];for(let i=0;i<maxVertexAttributes;i++)newAttributes[i]=0,enabledAttributes[i]=0,attributeDivisors[i]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:newAttributes,enabledAttributes:enabledAttributes,attributeDivisors:attributeDivisors,object:vao,attributes:{},index:null}}function initAttributes(){let newAttributes=currentState.newAttributes;for(let i=0,il=newAttributes.length;i<il;i++)newAttributes[i]=0}function enableAttribute(attribute){enableAttributeAndDivisor(attribute,0)}function enableAttributeAndDivisor(attribute,meshPerAttribute){let newAttributes=currentState.newAttributes,enabledAttributes=currentState.enabledAttributes,attributeDivisors=currentState.attributeDivisors;if(newAttributes[attribute]=1,0===enabledAttributes[attribute]&&(gl.enableVertexAttribArray(attribute),enabledAttributes[attribute]=1),attributeDivisors[attribute]!==meshPerAttribute){let extension=capabilities.isWebGL2?gl:extensions.get("ANGLE_instanced_arrays");extension[capabilities.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](attribute,meshPerAttribute),attributeDivisors[attribute]=meshPerAttribute}}function disableUnusedAttributes(){let newAttributes=currentState.newAttributes,enabledAttributes=currentState.enabledAttributes;for(let i=0,il=enabledAttributes.length;i<il;i++)enabledAttributes[i]!==newAttributes[i]&&(gl.disableVertexAttribArray(i),enabledAttributes[i]=0)}function vertexAttribPointer(index,size,type,normalized,stride,offset){!0===capabilities.isWebGL2&&(5124===type||5125===type)?gl.vertexAttribIPointer(index,size,type,stride,offset):gl.vertexAttribPointer(index,size,type,normalized,stride,offset)}function reset(){resetDefaultState(),forceUpdate=!0,currentState!==defaultState&&bindVertexArrayObject((currentState=defaultState).object)}function resetDefaultState(){defaultState.geometry=null,defaultState.program=null,defaultState.wireframe=!1}return{setup:function(object,material,program,geometry,index){let updateBuffers=!1;if(vaoAvailable){let state=function(geometry,program,material){let wireframe=!0===material.wireframe,programMap=bindingStates[geometry.id];void 0===programMap&&(programMap={},bindingStates[geometry.id]=programMap);let stateMap=programMap[program.id];void 0===stateMap&&(stateMap={},programMap[program.id]=stateMap);let state=stateMap[wireframe];return void 0===state&&(state=createBindingState(capabilities.isWebGL2?gl.createVertexArray():extension.createVertexArrayOES()),stateMap[wireframe]=state),state}(geometry,program,material);currentState!==state&&bindVertexArrayObject((currentState=state).object),(updateBuffers=function(object,geometry,program,index){let cachedAttributes=currentState.attributes,geometryAttributes=geometry.attributes,attributesNum=0,programAttributes=program.getAttributes();for(let name in programAttributes){let programAttribute=programAttributes[name];if(programAttribute.location>=0){let cachedAttribute=cachedAttributes[name],geometryAttribute=geometryAttributes[name];if(void 0===geometryAttribute&&("instanceMatrix"===name&&object.instanceMatrix&&(geometryAttribute=object.instanceMatrix),"instanceColor"===name&&object.instanceColor&&(geometryAttribute=object.instanceColor)),void 0===cachedAttribute||cachedAttribute.attribute!==geometryAttribute||geometryAttribute&&cachedAttribute.data!==geometryAttribute.data)return!0;attributesNum++}}return currentState.attributesNum!==attributesNum||currentState.index!==index}(object,geometry,program,index))&&function(object,geometry,program,index){let cache={},attributes=geometry.attributes,attributesNum=0,programAttributes=program.getAttributes();for(let name in programAttributes){let programAttribute=programAttributes[name];if(programAttribute.location>=0){let attribute=attributes[name];void 0===attribute&&("instanceMatrix"===name&&object.instanceMatrix&&(attribute=object.instanceMatrix),"instanceColor"===name&&object.instanceColor&&(attribute=object.instanceColor));let data={};data.attribute=attribute,attribute&&attribute.data&&(data.data=attribute.data),cache[name]=data,attributesNum++}}currentState.attributes=cache,currentState.attributesNum=attributesNum,currentState.index=index}(object,geometry,program,index)}else{let wireframe=!0===material.wireframe;(currentState.geometry!==geometry.id||currentState.program!==program.id||currentState.wireframe
36!==wireframe)&&(currentState.geometry=geometry.id,currentState.program=program.id,currentState.wireframe=wireframe,updateBuffers=!0)}null!==index&&attributes.update(index,34963),(updateBuffers||forceUpdate)&&(forceUpdate=!1,function(object,material,program,geometry){if(!1===capabilities.isWebGL2&&(object.isInstancedMesh||geometry.isInstancedBufferGeometry)&&null===extensions.get("ANGLE_instanced_arrays"))return;initAttributes();let geometryAttributes=geometry.attributes,programAttributes=program.getAttributes(),materialDefaultAttributeValues=material.defaultAttributeValues;for(let name in programAttributes){let programAttribute=programAttributes[name];if(programAttribute.location>=0){let geometryAttribute=geometryAttributes[name];if(void 0===geometryAttribute&&("instanceMatrix"===name&&object.instanceMatrix&&(geometryAttribute=object.instanceMatrix),"instanceColor"===name&&object.instanceColor&&(geometryAttribute=object.instanceColor)),void 0!==geometryAttribute){let normalized=geometryAttribute.normalized,size=geometryAttribute.itemSize,attribute=attributes.get(geometryAttribute);if(void 0===attribute)continue;let buffer=attribute.buffer,type=attribute.type,bytesPerElement=attribute.bytesPerElement;if(geometryAttribute.isInterleavedBufferAttribute){let data=geometryAttribute.data,stride=data.stride,offset=geometryAttribute.offset;if(data.isInstancedInterleavedBuffer){for(let i=0;i<programAttribute.locationSize;i++)enableAttributeAndDivisor(programAttribute.location+i,data.meshPerAttribute);!0!==object.isInstancedMesh&&void 0===geometry._maxInstanceCount&&(geometry._maxInstanceCount=data.meshPerAttribute*data.count)}else for(let i1=0;i1<programAttribute.locationSize;i1++)enableAttribute(programAttribute.location+i1);gl.bindBuffer(34962,buffer);for(let i2=0;i2<programAttribute.locationSize;i2++)vertexAttribPointer(programAttribute.location+i2,size/programAttribute.locationSize,type,normalized,stride*bytesPerElement,(offset+size/programAttribute.locationSize*i2)*bytesPerElement)}else{if(geometryAttribute.isInstancedBufferAttribute){for(let i3=0;i3<programAttribute.locationSize;i3++)enableAttributeAndDivisor(programAttribute.location+i3,geometryAttribute.meshPerAttribute);!0!==object.isInstancedMesh&&void 0===geometry._maxInstanceCount&&(geometry._maxInstanceCount=geometryAttribute.meshPerAttribute*geometryAttribute.count)}else for(let i4=0;i4<programAttribute.locationSize;i4++)enableAttribute(programAttribute.location+i4);gl.bindBuffer(34962,buffer);for(let i5=0;i5<programAttribute.locationSize;i5++)vertexAttribPointer(programAttribute.location+i5,size/programAttribute.locationSize,type,normalized,size*bytesPerElement,size/programAttribute.locationSize*i5*bytesPerElement)}}else if(void 0!==materialDefaultAttributeValues){let value=materialDefaultAttributeValues[name];if(void 0!==value)switch(value.length){case 2:gl.vertexAttrib2fv(programAttribute.location,value);break;case 3:gl.vertexAttrib3fv(programAttribute.location,value);break;case 4:gl.vertexAttrib4fv(programAttribute.location,value);break;default:gl.vertexAttrib1fv(programAttribute.location,value)}}}}disableUnusedAttributes()}(object,material,program,geometry),null!==index&&gl.bindBuffer(34963,attributes.get(index).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){for(let geometryId in reset(),bindingStates){let programMap=bindingStates[geometryId];for(let programId in programMap){let stateMap=programMap[programId];for(let wireframe in stateMap)deleteVertexArrayObject(stateMap[wireframe].object),delete stateMap[wireframe];delete programMap[programId]}delete bindingStates[geometryId]}},releaseStatesOfGeometry:function(geometry){if(void 0===bindingStates[geometry.id])return;let programMap=bindingStates[geometry.id];for(let programId in programMap){let stateMap=programMap[programId];for(let wireframe in stateMap)deleteVertexArrayObject(stateMap[wireframe].object),delete stateMap[wireframe];delete programMap[programId]}delete bindingStates[geometry.id]},releaseStatesOfProgram:function(program){for(let geometryId in bindingStates){let programMap=bindingStates[geometryId];if(void 0===programMap[program.id])continue;let stateMap=programMap[program.id];for(let wireframe in stateMap)deleteVertexArrayObject(stateMap[wireframe].object),delete stateMap[wireframe];delete programMap[program.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(gl,extensions,info,capabilities){let mode;
36let isWebGL2=capabilities.isWebGL2;this.setMode=function(value){mode=value},this.render=function(start,count){gl.drawArrays(mode,start,count),info.update(count,mode,1)},this.renderInstances=function(start,count,primcount){let extension,methodName;if(0!==primcount){if(isWebGL2)extension=gl,methodName="drawArraysInstanced";else if(extension=extensions.get("ANGLE_instanced_arrays"),methodName="drawArraysInstancedANGLE",null===extension){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}extension[methodName](mode,start,count,primcount),info.update(count,mode,primcount)}}}function WebGLCapabilities(gl,extensions,parameters){let maxAnisotropy;function getMaxPrecision(precision){if("highp"===precision){if(gl.getShaderPrecisionFormat(35633,36338).precision>0&&gl.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";precision="mediump"}return"mediump"===precision&&gl.getShaderPrecisionFormat(35633,36337).precision>0&&gl.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let isWebGL2="undefined"!=typeof WebGL2RenderingContext&&gl instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&gl instanceof WebGL2ComputeRenderingContext,precision=void 0!==parameters.precision?parameters.precision:"highp",maxPrecision=getMaxPrecision(precision);maxPrecision!==precision&&(console.warn("THREE.WebGLRenderer:",precision,"not supported, using",maxPrecision,"instead."),precision=maxPrecision);let drawBuffers=isWebGL2||extensions.has("WEBGL_draw_buffers"),logarithmicDepthBuffer=!0===parameters.logarithmicDepthBuffer,maxTextures=gl.getParameter(34930),maxVertexTextures=gl.getParameter(35660),maxTextureSize=gl.getParameter(3379),maxCubemapSize=gl.getParameter(34076),maxAttributes=gl.getParameter(34921),maxVertexUniforms=gl.getParameter(36347),maxVaryings=gl.getParameter(36348),maxFragmentUniforms=gl.getParameter(36349),vertexTextures=maxVertexTextures>0,floatFragmentTextures=isWebGL2||extensions.has("OES_texture_float"),maxSamples=isWebGL2?gl.getParameter(36183):0;return{isWebGL2:isWebGL2,drawBuffers:drawBuffers,getMaxAnisotropy:function(){if(void 0!==maxAnisotropy)return maxAnisotropy;if(!0===extensions.has("EXT_texture_filter_anisotropic")){let extension=extensions.get("EXT_texture_filter_anisotropic");maxAnisotropy=gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else maxAnisotropy=0;return maxAnisotropy},getMaxPrecision:getMaxPrecision,precision:precision,logarithmicDepthBuffer:logarithmicDepthBuffer,maxTextures:maxTextures,maxVertexTextures:maxVertexTextures,maxTextureSize:maxTextureSize,maxCubemapSize:maxCubemapSize,maxAttributes:maxAttributes,maxVertexUniforms:maxVertexUniforms,maxVaryings:maxVaryings,maxFragmentUniforms:maxFragmentUniforms,vertexTextures:vertexTextures,floatFragmentTextures:floatFragmentTextures,floatVertexTextures:vertexTextures&&floatFragmentTextures,maxSamples:maxSamples}}function WebGLClipping(properties){let scope=this,globalState=null,numGlobalPlanes=0,localClippingEnabled=!1,renderingShadows=!1,plane=new Plane,viewNormalMatrix=new Matrix3,uniform={value:null,needsUpdate:!1};function resetGlobalState(){uniform.value!==globalState&&(uniform.value=globalState,uniform.needsUpdate=numGlobalPlanes>0),scope.numPlanes=numGlobalPlanes,scope.numIntersection=0}function projectPlanes(planes,camera,dstOffset,skipTransform){let nPlanes=null!==planes?planes.length:0,dstArray=null;if(0!==nPlanes){if(dstArray=uniform.value,!0!==skipTransform||null===dstArray){let flatSize=dstOffset+4*nPlanes,viewMatrix=camera.matrixWorldInverse;viewNormalMatrix.getNormalMatrix(viewMatrix),(null===dstArray||dstArray.length<flatSize)&&(dstArray=new Float32Array(flatSize));for(let i=0,i4=dstOffset;i!==nPlanes;++i,i4+=4)plane.copy(planes[i]).applyMatrix4(viewMatrix,viewNormalMatrix),plane.normal.toArray(dstArray,i4),dstArray[i4+3]=plane.constant}uniform.value=dstArray,uniform.needsUpdate=!0}return scope.numPlanes=nPlanes,scope.numIntersection=0,dstArray}this.uniform=uniform,this.numPlanes=0,this.numIntersection=0,this.init=function(planes,enableLocalClipping,camera){let enabled=0!==planes.length||enableLocalClipping||0!==numGlobalPlanes||localClippingEnabled;return localClippingEnabled=enableLocalClipping,globalState=projectPlanes(planes,camera,0),numGlobalPlanes=planes.length,enabled},this.beginShadows=function(){renderingShadows=!0,projectPlanes(null)},this.endShadows=function(){renderingShadows=!1,resetGlobalState()},this.setState=function(material,camera,useCache){let planes=material.clippingPlanes,clipIntersection=material.clipIntersection,clipShadows=material.clipSh
36adows,materialProperties=properties.get(material);if(localClippingEnabled&&null!==planes&&0!==planes.length&&(!renderingShadows||clipShadows)){let nGlobal=renderingShadows?0:numGlobalPlanes,lGlobal=4*nGlobal,dstArray=materialProperties.clippingState||null;uniform.value=dstArray,dstArray=projectPlanes(planes,camera,lGlobal,useCache);for(let i=0;i!==lGlobal;++i)dstArray[i]=globalState[i];materialProperties.clippingState=dstArray,this.numIntersection=clipIntersection?this.numPlanes:0,this.numPlanes+=nGlobal}else renderingShadows?projectPlanes(null):resetGlobalState()}}function WebGLCubeMaps(renderer){let cubemaps=new WeakMap;function mapTextureMapping(texture,mapping){return mapping===EquirectangularReflectionMapping?texture.mapping=301:304===mapping&&(texture.mapping=302),texture}function onTextureDispose(event){let texture=event.target;texture.removeEventListener("dispose",onTextureDispose);let cubemap=cubemaps.get(texture);void 0!==cubemap&&(cubemaps.delete(texture),cubemap.dispose())}return{get:function(texture){if(texture&&texture.isTexture&&!1===texture.isRenderTargetTexture){let mapping=texture.mapping;if(mapping===EquirectangularReflectionMapping||304===mapping){if(cubemaps.has(texture)){let cubemap=cubemaps.get(texture).texture;return mapTextureMapping(cubemap,texture.mapping)}{let image=texture.image;if(!image||!(image.height>0))return null;{let renderTarget=new WebGLCubeRenderTarget(image.height/2);return renderTarget.fromEquirectangularTexture(renderer,texture),cubemaps.set(texture,renderTarget),texture.addEventListener("dispose",onTextureDispose),mapTextureMapping(renderTarget.texture,texture.mapping)}}}}return texture},dispose:function(){cubemaps=new WeakMap}}}ShaderLib.physical={uniforms:mergeUniforms([ShaderLib.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag};class OrthographicCamera extends Camera{constructor(left=-1,right=1,top=1,bottom=-1,near=.1,far=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=left,this.right=right,this.top=top,this.bottom=bottom,this.near=near,this.far=far,this.updateProjectionMatrix()}copy(source,recursive){return super.copy(source,recursive),this.left=source.left,this.right=source.right,this.top=source.top,this.bottom=source.bottom,this.near=source.near,this.far=source.far,this.zoom=source.zoom,this.view=null===source.view?null:Object.assign({},source.view),this}setViewOffset(fullWidth,fullHeight,x,y,width,height){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=fullWidth,this.view.fullHeight=fullHeight,this.view.offsetX=x,this.view.offsetY=y,this.view.width=width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let dx=(this.right-this.left)/(2*this.zoom),dy=(this.top-this.bottom)/(2*this.zoom),cx=(this.right+this.left)/2,cy=(this.top+this.bottom)/2,left=cx-dx,right=cx+dx,top=cy+dy,bottom=cy-dy;if(null!==this.view&&this.view.enabled){let scaleW=(this.right-this.left)/this.view.fullWidth/this.zoom,scaleH=(this.top-this.bottom)/this.view.fullHeight/this.zoom;left+=scaleW*this.view.offsetX,right=left+scaleW*this.view.width,top-=scaleH*this.view.offsetY,bottom=top-scaleH*this.view.height}
36this.projectionMatrix.makeOrthographic(left,right,top,bottom,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(meta){let data=super.toJSON(meta);return data.object.zoom=this.zoom,data.object.left=this.left,data.object.right=this.right,data.object.top=this.top,data.object.bottom=this.bottom,data.object.near=this.near,data.object.far=this.far,null!==this.view&&(data.object.view=Object.assign({},this.view)),data}}let EXTRA_LOD_SIGMA=[.125,.215,.35,.446,.526,.582],_flatCamera=new OrthographicCamera,_clearColor=new Color,_oldTarget=null,PHI=(1+Math.sqrt(5))/2,INV_PHI=1/PHI,_axisDirections=[new Vector3(1,1,1),new Vector3(-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,PHI,INV_PHI),new Vector3(0,PHI,-INV_PHI),new Vector3(INV_PHI,0,PHI),new Vector3(-INV_PHI,0,PHI),new Vector3(PHI,INV_PHI,0),new Vector3(-PHI,INV_PHI,0)];class PMREMGenerator{constructor(renderer){this._renderer=renderer,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(scene,sigma=0,near=.1,far=100){_oldTarget=this._renderer.getRenderTarget(),this._setSize(256);let cubeUVRenderTarget=this._allocateTargets();return cubeUVRenderTarget.depthBuffer=!0,this._sceneToCubeUV(scene,near,far,cubeUVRenderTarget),sigma>0&&this._blur(cubeUVRenderTarget,0,0,sigma),this._applyPMREM(cubeUVRenderTarget),this._cleanup(cubeUVRenderTarget),cubeUVRenderTarget}fromEquirectangular(equirectangular,renderTarget=null){return this._fromTexture(equirectangular,renderTarget)}fromCubemap(cubemap,renderTarget=null){return this._fromTexture(cubemap,renderTarget)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(cubeSize){this._lodMax=Math.floor(Math.log2(cubeSize)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let i=0;i<this._lodPlanes.length;i++)this._lodPlanes[i].dispose()}_cleanup(outputTarget){this._renderer.setRenderTarget(_oldTarget),outputTarget.scissorTest=!1,_setViewport(outputTarget,0,0,outputTarget.width,outputTarget.height)}_fromTexture(texture,renderTarget){301===texture.mapping||302===texture.mapping?this._setSize(0===texture.image.length?16:texture.image[0].width||texture.image[0].image.width):this._setSize(texture.image.width/4),_oldTarget=this._renderer.getRenderTarget();let cubeUVRenderTarget=renderTarget||this._allocateTargets();return this._textureToCubeUV(texture,cubeUVRenderTarget),this._applyPMREM(cubeUVRenderTarget),this._cleanup(cubeUVRenderTarget),cubeUVRenderTarget}_allocateTargets(){let width=3*Math.max(this._cubeSize,112),height=4*this._cubeSize,params={magFilter:LinearFilter,minFilter:LinearFilter,generateMipmaps:!1,type:HalfFloatType,format:RGBAFormat,encoding:LinearEncoding,depthBuffer:!1},cubeUVRenderTarget=_createRenderTarget(width,height,params);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==width){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(width,height,params);let{_lodMax}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(lodMax){let lodPlanes=[],sizeLods=[],sigmas=[],lod=lodMax,totalLods=lodMax-4+1+EXTRA_LOD_SIGMA.length;for(let i=0;i<totalLods;i++){let sizeLod=Math.pow(2,lod);sizeLods.push(sizeLod);let sigma=1/sizeLod;i>lodMax-4?sigma=EXTRA_LOD_SIGMA[i-lodMax+4-1]:0===i&&(sigma=0),sigmas.push(sigma);let texelSize=1/(sizeLod-2),min=-texelSize,max=1+texelSize,uv1=[min,min,max,min,max,max,min,min,max,max,min,max],position=new Float32Array(108),uv=new Float32Array(72),faceIndex=new Float32Array(36);for(let face=0;face<6;face++){let x=face%3*2/3-1,y=face>2?0:-1,coordinates=[x,y,0,x+2/3,y,0,x+2/3,y+1,0,x,y,0,x+2/3,y+1,0,x,y+1,0];position.set(coordinates,18*face),uv.set(uv1,12*face);let fill=[face,face,face,face,face,face];faceIndex.set(fill,6*face)}let planes=new BufferGeometry;planes.setAttribute("position",new BufferAttribute(position,3)),planes.setAttribute("uv",new BufferAttribute(uv,2)),planes.setAttribute("faceIndex",new BufferAttribute(faceIndex,1)),lodPlanes.push(planes),lod>4&&lod--}return{lodPlanes,sizeLods,sigmas}}(_lodMax)),this._blurMaterial=function(lodMax,width,height){let weights=new Float32Array(20),poleAxis=new Vector3(0,1,0),shaderMaterial=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/width,CUBEUV_TEXEL_HEIGHT:1/height,CUBEUV_MAX_MIP:`${lodMax}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:weights},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:poleAxis}},vertexShader:_getCommonVertexShader(),fragmentShader:` 37 38 precision mediump float; 39 precision mediump int; 40 41 varying vec3 vOutputDirection; 42 43 uniform sampler2D envMap; 44 uniform int samples; 45 uniform float weights[ n ]; 46 uniform bool latitudinal; 47 uniform float dTheta; 48 uniform float mipInt; 49 uniform vec3 poleAxis; 50 51 #define ENVMAP_TYPE_CUBE_UV 52 #include <cube_uv_reflection_fragment> 53 54 vec3 getSample( float theta, vec3 axis ) { 55 56 float cosTheta = cos( theta ); 57 // Rodrigues' axis-angle rotation 58 vec3 sampleDirection = vOutputDirection * cosTheta 59 + cross( axis, vOutputDirection ) * sin( theta ) 60 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 61 62 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 63 64 } 65 66 void main() { 67 68 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 69 70 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 71 72 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 73 74 } 75 76 axis = normalize( axis ); 77 78 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 79 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 80 81 for ( int i = 1; i < n; i++ ) { 82 83 if ( i >= samples ) { 84 85 break; 86 87 } 88 89 float theta = dTheta * float( i ); 90 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 91 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 92 93 } 94 95 } 96 `,blending:NoBlending,depthTest:!1,depthWrite:!1});return shaderMaterial}(_lodMax,width,height)}return cubeUVRenderTarget}_compileMaterial(material){let tmpMesh=new Mesh(this._lodPlanes[0],material);this._renderer.compile(tmpMesh,_flatCamera)}_sceneToCubeUV(scene,near,far,cubeUVRenderTarget){let cubeCamera=new PerspectiveCamera(90,1,near,far),upSign=[1,-1,1,1,1,1],forwardSign=[1,1,1,-1,-1,-1],renderer=this._renderer,originalAutoClear=renderer.autoClear,toneMapping=renderer.toneMapping;renderer.getClearColor(_clearColor),renderer.toneMapping=NoToneMapping,renderer.autoClear=!1;let backgroundMaterial=new MeshBasicMaterial({name:"PMREM.Backgroun
96d",side:BackSide,depthWrite:!1,depthTest:!1}),backgroundBox=new Mesh(new BoxGeometry,backgroundMaterial),useSolidColor=!1,background=scene.background;background?background.isColor&&(backgroundMaterial.color.copy(background),scene.background=null,useSolidColor=!0):(backgroundMaterial.color.copy(_clearColor),useSolidColor=!0);for(let i=0;i<6;i++){let col=i%3;0===col?(cubeCamera.up.set(0,upSign[i],0),cubeCamera.lookAt(forwardSign[i],0,0)):1===col?(cubeCamera.up.set(0,0,upSign[i]),cubeCamera.lookAt(0,forwardSign[i],0)):(cubeCamera.up.set(0,upSign[i],0),cubeCamera.lookAt(0,0,forwardSign[i]));let size=this._cubeSize;_setViewport(cubeUVRenderTarget,col*size,i>2?size:0,size,size),renderer.setRenderTarget(cubeUVRenderTarget),useSolidColor&&renderer.render(backgroundBox,cubeCamera),renderer.render(scene,cubeCamera)}backgroundBox.geometry.dispose(),backgroundBox.material.dispose(),renderer.toneMapping=toneMapping,renderer.autoClear=originalAutoClear,scene.background=background}_textureToCubeUV(texture,cubeUVRenderTarget){let renderer=this._renderer,isCubeTexture=301===texture.mapping||302===texture.mapping;isCubeTexture?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===texture.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());let material=isCubeTexture?this._cubemapMaterial:this._equirectMaterial,mesh=new Mesh(this._lodPlanes[0],material),uniforms=material.uniforms;uniforms.envMap.value=texture;let size=this._cubeSize;_setViewport(cubeUVRenderTarget,0,0,3*size,2*size),renderer.setRenderTarget(cubeUVRenderTarget),renderer.render(mesh,_flatCamera)}_applyPMREM(cubeUVRenderTarget){let renderer=this._renderer,autoClear=renderer.autoClear;renderer.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){let sigma=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),poleAxis=_axisDirections[(i-1)%_axisDirections.length];this._blur(cubeUVRenderTarget,i-1,i,sigma,poleAxis)}renderer.autoClear=autoClear}_blur(cubeUVRenderTarget,lodIn,lodOut,sigma,poleAxis){let pingPongRenderTarget=this._pingPongRenderTarget;this._halfBlur(cubeUVRenderTarget,pingPongRenderTarget,lodIn,lodOut,sigma,"latitudinal",poleAxis),this._halfBlur(pingPongRenderTarget,cubeUVRenderTarget,lodOut,lodOut,sigma,"longitudinal",poleAxis)}_halfBlur(targetIn,targetOut,lodIn,lodOut,sigmaRadians,direction,poleAxis){let renderer=this._renderer,blurMaterial=this._blurMaterial;"latitudinal"!==direction&&"longitudinal"!==direction&&console.error("blur direction must be either latitudinal or longitudinal!");let blurMesh=new Mesh(this._lodPlanes[lodOut],blurMaterial),blurUniforms=blurMaterial.uniforms,pixels=this._sizeLods[lodIn]-1,radiansPerPixel=isFinite(sigmaRadians)?Math.PI/(2*pixels):2*Math.PI/39,sigmaPixels=sigmaRadians/radiansPerPixel,samples=isFinite(sigmaRadians)?1+Math.floor(3*sigmaPixels):20;samples>20&&console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to 20`);let weights=[],sum=0;for(let i=0;i<20;++i){let x=i/sigmaPixels,weight=Math.exp(-x*x/2);weights.push(weight),0===i?sum+=weight:i<samples&&(sum+=2*weight)}for(let i1=0;i1<weights.length;i1++)weights[i1]=weights[i1]/sum;blurUniforms.envMap.value=targetIn.texture,blurUniforms.samples.value=samples,blurUniforms.weights.value=weights,blurUniforms.latitudinal.value="latitudinal"===direction,poleAxis&&(blurUniforms.poleAxis.value=poleAxis);let{_lodMax}=this;blurUniforms.dTheta.value=radiansPerPixel,blurUniforms.mipInt.value=_lodMax-lodIn;let outputSize=this._sizeLods[lodOut],y=4*(this._cubeSize-outputSize);_setViewport(targetOut,3*outputSize*(lodOut>_lodMax-4?lodOut-_lodMax+4:0),y,3*outputSize,2*outputSize),renderer.setRenderTarget(targetOut),renderer.render(blurMesh,_flatCamera)}}function _createRenderTarget(width,height,params){let cubeUVRenderTarget=new WebGLRenderTarget(width,height,params);return cubeUVRenderTarget.texture.mapping=306,cubeUVRenderTarget.texture.name="PMREM.cubeUv",cubeUVRenderTarget.scissorTest=!0,cubeUVRenderTarget}function _setViewport(target,x,y,width,height){target.viewport.set(x,y,width,height),target.scissor.set(x,y,width,height)}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:` 97 98 precision mediump float; 99 precision mediump int; 100 101 varying vec3 vOutputDirection; 102 103 uniform sampler2D envMap; 104 105 #include <common> 106 107 void main() { 108 109 vec3 outputDirection = normalize( vOutputDirection ); 110 vec2 uv = equirectUv( outputDirection ); 111
112 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 113 114 } 115 `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:` 116 117 precision mediump float; 118 precision mediump int; 119 120 uniform float flipEnvMap; 121 122 varying vec3 vOutputDirection; 123 124 uniform samplerCube envMap; 125 126 void main() { 127 128 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 129 130 } 131 `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return` 132 133 precision mediump float; 134 precision mediump int; 135 136 attribute float faceIndex; 137 138 varying vec3 vOutputDirection; 139 140 // RH coordinate system; PMREM face-indexing convention 141 vec3 getDirection( vec2 uv, float face ) { 142 143 uv = 2.0 * uv - 1.0; 144 145 vec3 direction = vec3( uv, 1.0 ); 146 147 if ( face == 0.0 ) { 148 149 direction = direction.zyx; // ( 1, v, u ) pos x 150 151 } else if ( face == 1.0 ) { 152 153 direction = direction.xzy; 154 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 155 156 } else if ( face == 2.0 ) { 157 158 direction.x *= -1.0; // ( -u, v, 1 ) pos z 159 160 } else if ( face == 3.0 ) { 161 162 direction = direction.zyx; 163 direction.xz *= -1.0; // ( -1, v, -u ) neg x 164 165 } else if ( face == 4.0 ) { 166 167 direction = direction.xzy; 168 direction.xy *= -1.0; // ( -u, -1, v ) neg y 169 170 } else if ( face == 5.0 ) { 171 172 direction.z *= -1.0; // ( u, v, -1 ) neg z 173 174 } 175 176 return direction; 177 178 } 179 180 void main() { 181 182 vOutputDirection = getDirection( uv, faceIndex ); 183 gl_Position = vec4( position, 1.0 ); 184 185 } 186 `}function WebGLCubeUVMaps(renderer){let cubeUVmaps=new WeakMap,pmremGenerator=null;function onTextureDispose(event){let texture=event.target;texture.removeEventListener("dispose",onTextureDispose);let cubemapUV=cubeUVmaps.get(texture);void 0!==cubemapUV&&(cubeUVmaps.delete(texture),cubemapUV.dispose())}return{get:function(texture){if(texture&&texture.isTexture){let mapping=texture.mapping,isEquirectMap=mapping===EquirectangularReflectionMapping||304===mapping,isCubeMap=301===mapping||302===mapping;if(isEquirectMap||isCubeMap){if(texture.isRenderTargetTexture&&!0===texture.needsPMREMUpdate){texture.needsPMREMUpdate=!1;let renderTarget=cubeUVmaps.get(texture);return null===pmremGenerator&&(pmremGenerator=new PMREMGenerator(renderer)),renderTarget=isEquirectMap?pmremGenerator.fromEquirectangular(texture,renderTarget):pmremGenerator.fromCubemap(texture,renderTarget),cubeUVmaps.set(texture,renderTarget),renderTarget.texture}if(cubeUVmaps.has(texture))return cubeUVmaps.get(texture).texture;{let image=texture.image;if(!(isEquirectMap&&image&&image.height>0||isCubeMap&&image&&function(image){let count=0;for(let i=0;i<6;i++)void 0!==image[i]&&count++;return 6===count}(image)))return null;{null===pmremGenerator&&(pmremGenerator=new PMREMGenerator(renderer));let renderTarget1=isEquirectMap?pmremGenerator.fromEquirectangular(texture):pmremGenerator.fromCubemap(texture);return cubeUVmaps.set(texture,renderTarget1),texture.addEventListener("dispose",onTextureDispose),renderTarget1.texture}}}}return texture},dispose:function(){cubeUVmaps=new WeakMap,null!==pmremGenerator&&(pmremGenerator.dispose(),pmremGenerator=null)}}}function WebGLExtensions(gl){let extensions={};function getExtension(name){let extension;if(void 0!==extensions[name])return extensions[name];switch(name){case"WEBGL_depth_texture":extension=gl.getExtension("WEBGL_depth_texture")||gl.getExtension("MOZ_WEBGL_depth_texture")||gl.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":extension=gl.getExtension("EXT_texture_filter_anisotropic")||gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":extension=gl.getExtension("WEBGL_compressed_texture_s3tc")||gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":extension=gl.getExtension("WEBGL_compressed_texture_pvrtc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:extension=gl.getExtension(name)}return extensions[name]=extension,extension}return{has:function(name){return null!==getExtension(name)},init:function(capabilities){capabilities.isWebGL2?getExtension("EXT_color_buffer_float"):(getExtension("WEBGL_depth_texture"),getExtension("OES_texture_float"),getExtension("OES_texture_half_float"),getExtension("OES_texture_half_float_linear"),getExtension("OES_standard_derivatives"),getExtension("OES_element_index_uint"),getExtension("OES_vertex_array_object"),getExtension("ANGLE_instanced_arrays")),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture")},get:function(name){let extension=getExtension(name);return null===extension&&console.warn("THREE.WebGLRenderer: "+name+" extension not supported."),extension}}}function WebGLGeometries(gl,attributes,info,bindingStates){let geometries={},wireframeAttributes=new WeakMap;function onGeometryDispose(event){let geometry=event.target;for(let name in null!==geometry.index&&attributes.remove(geometry.index),geometry.attributes)attributes.remove(geometry.attributes[name]);geometry.removeEventListener("dispose",onGeometryDispose),delete geometries[geometry.id];let attribute=wireframeAttributes.get(geometry);attribute&&(attributes.remove(attribute),wireframeAttributes.delete(geometry)),bindingStates.releaseStatesOfGeometry(geometry),!0===geometry.isInstancedBufferGeometry&&delete geometry._maxInstanceCount,info.memory.geometries--}function updateWireframeAttribute(geometry){let indices=[],geometryIndex=geometry.index,geometryPosition=geometry.attributes.position,version=0;if(null!==geometryIndex){let array=geometryIndex.array;version=geometryIndex.version;for(let i=0,l=array.length;i<l;i+=3){let a=array[i+0],b=array[i+1],c=array[i+2];indices.push(a,b,b,c,c,a)}}else{let array1=geometryPosition.array;version=geometryPosition.version;for(let i1=0,l1=array1.length/3-1;i1<l1;i1+=3){let a1=i1+0,b1=i1+1,c1=i1+2;indices.push(a1,b1,b1,c1,c1,a1)}}let attribute=new(arrayNeedsUint32(indices)?Uint32BufferAttribute:Uint16BufferAttribute)(indices,1);attribute.version=version;let previousAttribute=wireframeAttributes.get(geometry);previousAttribute&&attributes.remove(previousAttribute),wireframeAttributes.set(geometry,attribute)}return{get:function(object,geometry){return!0===geometries[geometry.id]||(geometry.addEventListener("dispose",onGeometryDispose),geometries[geometry.id]=!0,info.memory.geometries++),geometry},update:function(geometry){let geometryAttributes=geometry.attributes;for(let name in geometryAttributes)attributes.update(geometryAttributes[name],34962);let morphAttributes=geometry.morphAttributes;for(let name1 in morphAttributes){let array=morphAttributes[name1];for(let i=0,l=array.length;i<l;i++)attributes.update(array[i],34962)}},getWireframeAttribute:function(geometry){let currentAttribute=wireframeAttributes.get(geometry);if(currentAttribute){let geometryIndex=geometry.index;
186null!==geometryIndex&¤tAttribute.version<geometryIndex.version&&updateWireframeAttribute(geometry)}else updateWireframeAttribute(geometry);return wireframeAttributes.get(geometry)}}}function WebGLIndexedBufferRenderer(gl,extensions,info,capabilities){let mode,type,bytesPerElement;let isWebGL2=capabilities.isWebGL2;this.setMode=function(value){mode=value},this.setIndex=function(value){type=value.type,bytesPerElement=value.bytesPerElement},this.render=function(start,count){gl.drawElements(mode,count,type,start*bytesPerElement),info.update(count,mode,1)},this.renderInstances=function(start,count,primcount){let extension,methodName;if(0!==primcount){if(isWebGL2)extension=gl,methodName="drawElementsInstanced";else if(extension=extensions.get("ANGLE_instanced_arrays"),methodName="drawElementsInstancedANGLE",null===extension){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}extension[methodName](mode,count,type,start*bytesPerElement,primcount),info.update(count,mode,primcount)}}}function WebGLInfo(gl){let render={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:render,programs:null,autoReset:!0,reset:function(){render.frame++,render.calls=0,render.triangles=0,render.points=0,render.lines=0},update:function(count,mode,instanceCount){switch(render.calls++,mode){case 4:render.triangles+=instanceCount*(count/3);break;case 1:render.lines+=instanceCount*(count/2);break;case 3:render.lines+=instanceCount*(count-1);break;case 2:render.lines+=instanceCount*count;break;case 0:render.points+=instanceCount*count;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",mode)}}}}function numericalSort(a,b){return a[0]-b[0]}function absNumericalSort(a,b){return Math.abs(b[1])-Math.abs(a[1])}function WebGLMorphtargets(gl,capabilities,textures){let influencesList={},morphInfluences=new Float32Array(8),morphTextures=new WeakMap,morph=new Vector4,workInfluences=[];for(let i=0;i<8;i++)workInfluences[i]=[i,0];return{update:function(object,geometry,material,program){let objectInfluences=object.morphTargetInfluences;if(!0===capabilities.isWebGL2){let morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color,morphTargetsCount=void 0!==morphAttribute?morphAttribute.length:0,entry=morphTextures.get(geometry);if(void 0===entry||entry.count!==morphTargetsCount){void 0!==entry&&entry.texture.dispose();let hasMorphPosition=void 0!==geometry.morphAttributes.position,hasMorphNormals=void 0!==geometry.morphAttributes.normal,hasMorphColors=void 0!==geometry.morphAttributes.color,morphTargets=geometry.morphAttributes.position||[],morphNormals=geometry.morphAttributes.normal||[],morphColors=geometry.morphAttributes.color||[],vertexDataCount=0;!0===hasMorphPosition&&(vertexDataCount=1),!0===hasMorphNormals&&(vertexDataCount=2),!0===hasMorphColors&&(vertexDataCount=3);let width=geometry.attributes.position.count*vertexDataCount,height=1;width>capabilities.maxTextureSize&&(height=Math.ceil(width/capabilities.maxTextureSize),width=capabilities.maxTextureSize);let buffer=new Float32Array(width*height*4*morphTargetsCount),texture=new DataArrayTexture(buffer,width,height,morphTargetsCount);texture.type=FloatType,texture.needsUpdate=!0;let vertexDataStride=4*vertexDataCount;for(let i=0;i<morphTargetsCount;i++){let morphTarget=morphTargets[i],morphNormal=morphNormals[i],morphColor=morphColors[i],offset=width*height*4*i;for(let j=0;j<morphTarget.count;j++){let stride=j*vertexDataStride;!0===hasMorphPosition&&(morph.fromBufferAttribute(morphTarget,j),buffer[offset+stride+0]=morph.x,buffer[offset+stride+1]=morph.y,buffer[offset+stride+2]=morph.z,buffer[offset+stride+3]=0),!0===hasMorphNormals&&(morph.fromBufferAttribute(morphNormal,j),buffer[offset+stride+4]=morph.x,buffer[offset+stride+5]=morph.y,buffer[offset+stride+6]=morph.z,buffer[offset+stride+7]=0),!0===hasMorphColors&&(morph.fromBufferAttribute(morphColor,j),buffer[offset+stride+8]=morph.x,buffer[offset+stride+9]=morph.y,buffer[offset+stride+10]=morph.z,buffer[offset+stride+11]=4===morphColor.itemSize?morph.w:1)}}entry={count:morphTargetsCount,texture:texture,size:new Vector2(width,height)},morphTextures.set(geometry,entry),geometry.addEventListener("dispose",function disposeTexture(){texture.dispose(),morphTextures.delete(geometry),geometry.removeEventListener("dispose",disposeTexture)})}let morphInfluencesSum=0;for(let i1=0;i1<objectInfluences.length;i1++)morphInfluencesSum+=objectInfluences[i1];let morphBaseInfluence=geometry.morphTargetsRelative?1:1-morphInfluencesSum;program.getUniforms().setValue(gl,"morphTargetBaseInfluence",morphBaseInfluence),program.getUniforms().setValue(gl,"morphTargetInfluences",objectInfluences),program.getUniforms().setValue(gl,"morphTargetsTexture",entry.texture,textures),program.getUniforms().setValue(gl,"morphTargetsTextureSize",entry.size)}else{let length=void 0===objectInfluences?0:objectInfluences.length,influences=influencesList[geometry.id];if(void 0===influences||influences.length!==length){influences=[];for(let i2=0;i2<length;i2++)influences[i2]=[i2,0];influencesList[geometry.id]=influences}for(let i3=0;i3<length;i3++){let influence=influences[i3];influence[0]=i3,influence[1]=objectInfluences[i3]}influences.sort(absNumericalSort);for(let i4=0;i4<8;i4++)i4<length&&influences[i4][1]?(workInfluences[i4][0]=influences[i4][0],workInfluences[i4][1]=influences[i4][1]):(workInfluences[i4][0]=Number.MAX_SAFE_INTEGER,workInfluences[i4][1]=0);workInfluences.sort(numericalSort);let morphTargets1=geometry.morphAttributes.position,morphNormals1=geometry.morphAttributes.normal,morphInfluencesSum1=0;for(let i5=0;i5<8;i5++){let influence1=workInfluences[i5],index=influence1[0],value=influence1[1];index!==Number.MAX_SAFE_INTEGER&&value?(morphTargets1&&geometry.getAttribute("morphTarget"+i
vendor: 2,786 bytes, line 186
1865)!==morphTargets1[index]&&geometry.setAttribute("morphTarget"+i5,morphTargets1[index]),morphNormals1&&geometry.getAttribute("morphNormal"+i5)!==morphNormals1[index]&&geometry.setAttribute("morphNormal"+i5,morphNormals1[index]),morphInfluences[i5]=value,morphInfluencesSum1+=value):(morphTargets1&&!0===geometry.hasAttribute("morphTarget"+i5)&&geometry.deleteAttribute("morphTarget"+i5),morphNormals1&&!0===geometry.hasAttribute("morphNormal"+i5)&&geometry.deleteAttribute("morphNormal"+i5),morphInfluences[i5]=0)}let morphBaseInfluence1=geometry.morphTargetsRelative?1:1-morphInfluencesSum1;program.getUniforms().setValue(gl,"morphTargetBaseInfluence",morphBaseInfluence1),program.getUniforms().setValue(gl,"morphTargetInfluences",morphInfluences)}}}}function WebGLObjects(gl,geometries,attributes,info){let updateMap=new WeakMap;function onInstancedMeshDispose(event){let instancedMesh=event.target;instancedMesh.removeEventListener("dispose",onInstancedMeshDispose),attributes.remove(instancedMesh.instanceMatrix),null!==instancedMesh.instanceColor&&attributes.remove(instancedMesh.instanceColor)}return{update:function(object){let frame=info.render.frame,geometry=object.geometry,buffergeometry=geometries.get(object,geometry);return updateMap.get(buffergeometry)!==frame&&(geometries.update(buffergeometry),updateMap.set(buffergeometry,frame)),object.isInstancedMesh&&(!1===object.hasEventListener("dispose",onInstancedMeshDispose)&&object.addEventListener("dispose",onInstancedMeshDispose),attributes.update(object.instanceMatrix,34962),null!==object.instanceColor&&attributes.update(object.instanceColor,34962)),buffergeometry},dispose:function(){updateMap=new WeakMap}}}let emptyTexture=new Texture,emptyArrayTexture=new DataArrayTexture,empty3dTexture=new Data3DTexture,emptyCubeTexture=new CubeTexture,arrayCacheF32=[],arrayCacheI32=[],mat4array=new Float32Array(16),mat3array=new Float32Array(9),mat2array=new Float32Array(4);function flatten(array,nBlocks,blockSize){let firstElem=array[0];if(firstElem<=0||firstElem>0)return array;let n=nBlocks*blockSize,r=arrayCacheF32[n];if(void 0===r&&(r=new Float32Array(n),arrayCacheF32[n]=r),0!==nBlocks){firstElem.toArray(r,0);for(let i=1,offset=0;i!==nBlocks;++i)offset+=blockSize,array[i].toArray(r,offset)}return r}function arraysEqual(a,b){if(a.length!==b.length)return!1;for(let i=0,l=a.length;i<l;i++)if(a[i]!==b[i])return!1;return!0}function copyArray(a,b){for(let i=0,l=b.length;i<l;i++)a[i]=b[i]}function allocTexUnits(textures,n){let r=arrayCacheI32[n];void 0===r&&(r=new Int32Array(n),arrayCacheI32[n]=r);for(let i=0;i!==n;++i)r[i]=textures.allocateTextureUnit();return r}function setValueV1f(gl,v){let cache=this.cache;cache[0]!==v&&(gl.uniform1f(this.addr,v),cache[0]=v)}function setValueV2f(gl,v){let cache=this.cache;
vendor: 2,010 bytes, line 186
186if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y)&&(gl.uniform2f(this.addr,v.x,v.y),cache[0]=v.x,cache[1]=v.y);else{if(arraysEqual(cache,v))return;gl.uniform2fv(this.addr,v),copyArray(cache,v)}}function setValueV3f(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z)&&(gl.uniform3f(this.addr,v.x,v.y,v.z),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z);else if(void 0!==v.r)(cache[0]!==v.r||cache[1]!==v.g||cache[2]!==v.b)&&(gl.uniform3f(this.addr,v.r,v.g,v.b),cache[0]=v.r,cache[1]=v.g,cache[2]=v.b);else{if(arraysEqual(cache,v))return;gl.uniform3fv(this.addr,v),copyArray(cache,v)}}function setValueV4f(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w)&&(gl.uniform4f(this.addr,v.x,v.y,v.z,v.w),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z,cache[3]=v.w);else{if(arraysEqual(cache,v))return;gl.uniform4fv(this.addr,v),copyArray(cache,v)}}function setValueM2(gl,v){let cache=this.cache,elements=v.elements;if(void 0===elements){if(arraysEqual(cache,v))return;gl.uniformMatrix2fv(this.addr,!1,v),copyArray(cache,v)}else{if(arraysEqual(cache,elements))return;mat2array.set(elements),gl.uniformMatrix2fv(this.addr,!1,mat2array),copyArray(cache,elements)}}function setValueM3(gl,v){let cache=this.cache,elements=v.elements;if(void 0===elements){if(arraysEqual(cache,v))return;gl.uniformMatrix3fv(this.addr,!1,v),copyArray(cache,v)}else{if(arraysEqual(cache,elements))return;mat3array.set(elements),gl.uniformMatrix3fv(this.addr,!1,mat3array),copyArray(cache,elements)}}function setValueM4(gl,v){let cache=this.cache,elements=v.elements;if(void 0===elements){if(arraysEqual(cache,v))return;gl.uniformMatrix4fv(this.addr,!1,v),copyArray(cache,v)}else{if(arraysEqual(cache,elements))return;mat4array.set(elements),gl.uniformMatrix4fv(this.addr,!1,mat4array),copyArray(cache,elements)}}function setValueV1i(gl,v){let cache=this.cache;cache[0]!==v&&(gl.uniform1i(this.addr,v),cache[0]=v)}function setValueV2i(gl,v){let cache=this.cache;
vendor: 8,345 bytes, line 186
186if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y)&&(gl.uniform2i(this.addr,v.x,v.y),cache[0]=v.x,cache[1]=v.y);else{if(arraysEqual(cache,v))return;gl.uniform2iv(this.addr,v),copyArray(cache,v)}}function setValueV3i(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z)&&(gl.uniform3i(this.addr,v.x,v.y,v.z),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z);else{if(arraysEqual(cache,v))return;gl.uniform3iv(this.addr,v),copyArray(cache,v)}}function setValueV4i(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w)&&(gl.uniform4i(this.addr,v.x,v.y,v.z,v.w),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z,cache[3]=v.w);else{if(arraysEqual(cache,v))return;gl.uniform4iv(this.addr,v),copyArray(cache,v)}}function setValueV1ui(gl,v){let cache=this.cache;cache[0]!==v&&(gl.uniform1ui(this.addr,v),cache[0]=v)}function setValueV2ui(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y)&&(gl.uniform2ui(this.addr,v.x,v.y),cache[0]=v.x,cache[1]=v.y);else{if(arraysEqual(cache,v))return;gl.uniform2uiv(this.addr,v),copyArray(cache,v)}}function setValueV3ui(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z)&&(gl.uniform3ui(this.addr,v.x,v.y,v.z),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z);else{if(arraysEqual(cache,v))return;gl.uniform3uiv(this.addr,v),copyArray(cache,v)}}function setValueV4ui(gl,v){let cache=this.cache;if(void 0!==v.x)(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w)&&(gl.uniform4ui(this.addr,v.x,v.y,v.z,v.w),cache[0]=v.x,cache[1]=v.y,cache[2]=v.z,cache[3]=v.w);else{if(arraysEqual(cache,v))return;gl.uniform4uiv(this.addr,v),copyArray(cache,v)}}function setValueT1(gl,v,textures){let cache=this.cache,unit=textures.allocateTextureUnit();cache[0]!==unit&&(gl.uniform1i(this.addr,unit),cache[0]=unit),textures.setTexture2D(v||emptyTexture,unit)}function setValueT3D1(gl,v,textures){let cache=this.cache,unit=textures.allocateTextureUnit();cache[0]!==unit&&(gl.uniform1i(this.addr,unit),cache[0]=unit),textures.setTexture3D(v||empty3dTexture,unit)}function setValueT6(gl,v,textures){let cache=this.cache,unit=textures.allocateTextureUnit();cache[0]!==unit&&(gl.uniform1i(this.addr,unit),cache[0]=unit),textures.setTextureCube(v||emptyCubeTexture,unit)}function setValueT2DArray1(gl,v,textures){let cache=this.cache,unit=textures.allocateTextureUnit();cache[0]!==unit&&(gl.uniform1i(this.addr,unit),cache[0]=unit),textures.setTexture2DArray(v||emptyArrayTexture,unit)}function setValueV1fArray(gl,v){gl.uniform1fv(this.addr,v)}function setValueV2fArray(gl,v){let data=flatten(v,this.size,2);gl.uniform2fv(this.addr,data)}function setValueV3fArray(gl,v){let data=flatten(v,this.size,3);gl.uniform3fv(this.addr,data)}function setValueV4fArray(gl,v){let data=flatten(v,this.size,4);gl.uniform4fv(this.addr,data)}function setValueM2Array(gl,v){let data=flatten(v,this.size,4);gl.uniformMatrix2fv(this.addr,!1,data)}function setValueM3Array(gl,v){let data=flatten(v,this.size,9);gl.uniformMatrix3fv(this.addr,!1,data)}function setValueM4Array(gl,v){let data=flatten(v,this.size,16);gl.uniformMatrix4fv(this.addr,!1,data)}function setValueV1iArray(gl,v){gl.uniform1iv(this.addr,v)}function setValueV2iArray(gl,v){gl.uniform2iv(this.addr,v)}function setValueV3iArray(gl,v){gl.uniform3iv(this.addr,v)}function setValueV4iArray(gl,v){gl.uniform4iv(this.addr,v)}function setValueV1uiArray(gl,v){gl.uniform1uiv(this.addr,v)}function setValueV2uiArray(gl,v){gl.uniform2uiv(this.addr,v)}function setValueV3uiArray(gl,v){gl.uniform3uiv(this.addr,v)}function setValueV4uiArray(gl,v){gl.uniform4uiv(this.addr,v)}function setValueT1Array(gl,v,textures){let cache=this.cache,n=v.length,units=allocTexUnits(textures,n);arraysEqual(cache,units)||(gl.uniform1iv(this.addr,units),copyArray(cache,units));for(let i=0;i!==n;++i)textures.setTexture2D(v[i]||emptyTexture,units[i])}function setValueT3DArray(gl,v,textures){let cache=this.cache,n=v.length,units=allocTexUnits(textures,n);arraysEqual(cache,units)||(gl.uniform1iv(this.addr,units),copyArray(cache,units));for(let i=0;i!==n;++i)textures.setTexture3D(v[i]||empty3dTexture,units[i])}function setValueT6Array(gl,v,textures){let cache=this.cache,n=v.length,units=allocTexUnits(textures,n);arraysEqual(cache,units)||(gl.uniform1iv(this.addr,units),copyArray(cache,units));for(let i=0;i!==n;++i)textures.setTextureCube(v[i]||emptyCubeTexture,units[i])}function setValueT2DArrayArray(gl,v,textures){let cache=this.cache,n=v.length,units=allocTexUnits(textures,n);arraysEqual(cache,units)||(gl.uniform1iv(this.addr,units),copyArray(cache,units));for(let i=0;i!==n;++i)textures.setTexture2DArray(v[i]||emptyArrayTexture,units[i])}class SingleUniform{constructor(id,activeInfo,addr){this.id=id,this.addr=addr,this.cache=[],this.setValue=function(type){switch(type){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(activeInfo.type)}}class PureArrayUniform{constructor(id,activeInfo,addr){this.id=id,this.addr=addr,this.cache=[],this.size=activeInfo.size,this.setValue=function(type){switch(type){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(activeInfo.type)}}class StructuredUniform{constructor(id){this.id=id,this.seq=[],this.map={}}setValue(gl,value,textures){let seq=this.seq;for(let i=0,n=seq.length;i!==n;++i){let u=seq[i];u.setValue(gl,value[u.id],textures)}}}let RePathPart=/(\w+)(\])?(\[|\.)?/g;function addUniform(container,uniformObject){container.seq.push(uniformObject),container.map[uniformObject.id]=uniformObject}class WebGLUniforms{constructor(gl,program){this.seq=[],this.map={};let n=gl.getProgramParameter(program,35718);for(let i=0;i<n;++i){let info=gl.getActiveUniform(program,i),addr=gl.getUniformLocation(program,info.name);!function(activeInfo,addr,container){let path=activeInfo.name,pathLength=path.length;for(RePathPart.lastIndex=0;;){let match=RePathPart.exec(path),matchEnd=RePathPart.lastIndex,id=match[1],idIsIndex="]"===match[2],subscript=match[3];if(idIsIndex&&(id|=0),void 0===subscript||"["===subscript&&matchEnd+2===pathLength){addUniform(container,void 0===subscript?new SingleUniform(id,activeInfo,addr):new PureArrayUniform(id,activeInfo,addr));break}{let map=container.map,next=map[id];void 0===next&&addUniform(container,next=new StructuredUniform(id)),container=next}}}(info,addr,this)}}setValue(gl,name,value,textures){let u=this.map[name];void 0!==u&&u.setValue(gl,value,textures)}setOptional(gl,object,name){let v=object[name];void 0!==v&&this.setValue(gl,name,v)}static upload(gl,seq,values,textures){for(let i=0,n=seq.length;i!==n;++i){let u=seq[i],v=values[u.id];!1!==v.needsUpdate&&u.setValue(gl,v.value,textures)}}static seqWithValue(seq,values){let r=[];for(let i=0,n=seq.length;i!==n;++i){let u=seq[i];u.id in values&&r.push(u)}return r}}function WebGLShader(gl,type,string){let shader=gl.createShader(type);
186return gl.shaderSource(shader,string),gl.compileShader(shader),shader}let programIdCount=0;function getShaderErrors(gl,shader,type){let status=gl.getShaderParameter(shader,35713),errors=gl.getShaderInfoLog(shader).trim();if(status&&""===errors)return"";let errorMatches=/ERROR: 0:(\d+)/.exec(errors);if(!errorMatches)return errors;{let errorLine=parseInt(errorMatches[1]);return type.toUpperCase()+"\n\n"+errors+"\n\n"+function(string,errorLine){let lines=string.split("\n"),lines2=[],from=Math.max(errorLine-6,0),to=Math.min(errorLine+6,lines.length);for(let i=from;i<to;i++){let line=i+1;lines2.push(`${line===errorLine?">":" "} ${line}: ${lines[i]}`)}return lines2.join("\n")}(gl.getShaderSource(shader),errorLine)}}function filterEmptyLine(string){return""!==string}function replaceLightNums(string,parameters){let numSpotLightCoords=parameters.numSpotLightShadows+parameters.numSpotLightMaps-parameters.numSpotLightShadowsWithMaps;return string.replace(/NUM_DIR_LIGHTS/g,parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g,parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g,parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g,parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,parameters.numPointLightShadows)}function replaceClippingPlaneNums(string,parameters){return string.replace(/NUM_CLIPPING_PLANES/g,parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,parameters.numClippingPlanes-parameters.numClipIntersection)}let includePattern=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(string){return string.replace(includePattern,includeReplacer)}function includeReplacer(match,include){let string=ShaderChunk[include];if(void 0===string)throw Error("Can not resolve #include <"+include+">");return resolveIncludes(string)}let unrollLoopPattern=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function unrollLoops(string){return string.replace(unrollLoopPattern,loopReplacer)}function loopReplacer(match,start,end,snippet){let string="";for(let i=parseInt(start);i<parseInt(end);i++)string+=snippet.replace(/\[\s*i\s*\]/g,"[ "+i+" ]").replace(/UNROLLED_LOOP_INDEX/g,i);return string}function generatePrecision(parameters){let precisionstring="precision "+parameters.precision+" float;\nprecision "+parameters.precision+" int;";return"highp"===parameters.precision?precisionstring+="\n#define HIGH_PRECISION":"mediump"===parameters.precision?precisionstring+="\n#define MEDIUM_PRECISION":"lowp"===parameters.precision&&(precisionstring+="\n#define LOW_PRECISION"),precisionstring}function WebGLProgram(renderer,cacheKey,parameters,bindingStates){let prefixVertex,prefixFragment,cachedUniforms,cachedAttributes,shadowMapTypeDefine,envMapModeDefine;let gl=renderer.getContext(),defines=parameters.defines,vertexShader=parameters.vertexShader,fragmentShader=parameters.fragmentShader,shadowMapTypeDefine1=(shadowMapTypeDefine="SHADOWMAP_TYPE_BASIC",1===parameters.shadowMapType?shadowMapTypeDefine="SHADOWMAP_TYPE_PCF":2===parameters.shadowMapType?shadowMapTypeDefine="SHADOWMAP_TYPE_PCF_SOFT":3===parameters.shadowMapType&&(shadowMapTypeDefine="SHADOWMAP_TYPE_VSM"),shadowMapTypeDefine),envMapTypeDefine=function(parameters){let envMapTypeDefine="ENVMAP_TYPE_CUBE";if(parameters.envMap)switch(parameters.envMapMode){case 301:case 302:envMapTypeDefine="ENVMAP_TYPE_CUBE";break;case 306:envMapTypeDefine="ENVMAP_TYPE_CUBE_UV"}return envMapTypeDefine}(parameters),envMapModeDefine1=(envMapModeDefine="ENVMAP_MODE_REFLECTION",parameters.envMap&&302===parameters.envMapMode&&(envMapModeDefine="ENVMAP_MODE_REFRACTION"),envMapModeDefine),envMapBlendingDefine=function(parameters){let envMapBlendingDefine="ENVMAP_BLENDING_NONE";if(parameters.envMap)switch(parameters.combine){case 0:envMapBlendingDefine="ENVMAP_BLENDING_MULTIPLY";break;case 1:envMapBlendingDefine="ENVMAP_BLENDING_MIX";break;case 2:envMapBlendingDefine="ENVMAP_BLENDING_ADD"}return envMapBlendingDefine}(parameters),envMapCubeUVSize=function(parameters){let imageHeight=parameters.envMapCubeUVHeight;if(null===imageHeight)return null;let maxMip=Math.log2(imageHeight)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,maxMip),112)),texelHeight:1/imageHeight,maxMip}}(parameters),customExtensions=parameters.isWebGL2?"":function(parameters){let chunks=[parameters.extensionDerivatives||parameters.envMapCubeUVHeight||parameters.bumpMap||parameters.tangentSpaceNormalMap||parameters.clearcoatNormalMap||parameters.flatShading||"physical"===parameters.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(parameters.extensionFragDepth||parameters.logarithmicDepthBuffer)&¶meters.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",parameters.extensionDrawBuffers&¶meters.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(parameters.extensionShaderTextureLOD||parameters.envMap||parameters.transmission)&¶meters.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return chunks.filter(filterEmptyLine).join("\n")}(parameters),customDefines=function(defines){let chunks=[];for(let name in defines){let value=defines[name];!1!==value&&chunks.push("#define "+name+" "+value)}return chunks.join("\n")}(defines),program=gl.createProgram(),versionString=parameters.glslVersion?"#version "+parameters.glslVersion+"\n":"";parameters.isRawShaderMaterial?((prefixVertex=[customDefines].filter(filterEmptyLine).join("\n")).length>0&&(prefixVertex+="\n"),(prefixFragment=[customExtensions,customDefines].filter(filterEmptyLine).join("\n")).length>0&&(prefixFragment+="\n")):(prefixVertex=[generatePrecision(parameters),"#define SHADER_NAME "+parameters.shaderName,customDefines,parameters.instancing?"#define USE_INSTANCING":"",parameters.instancingColor?"#define USE_INSTANCING_COLOR":"",parameters.supportsVertexTextures?"#define VERTEX_TEXTURES":"",parameters.useFog&¶meters.fog?"#define USE_FOG":"",parameters.useFog&¶meters.fogExp2?"#define FOG_EXP2":"",parameters.map?"#define USE_MAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap?"#define "+envMapMo
vendor: 4,330 bytes, line 186
186deDefine1:"",parameters.lightMap?"#define USE_LIGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP":"",parameters.bumpMap?"#define USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMap&¶meters.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",parameters.normalMap&¶meters.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",parameters.clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",parameters.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",parameters.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",parameters.displacementMap&¶meters.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",parameters.specularColorMap?"#define USE_SPECULARCOLORMAP":"",parameters.roughnessMap?"#define USE_ROUGHNESSMAP":"",parameters.metalnessMap?"#define USE_METALNESSMAP":"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.transmission?"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSIONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.sheenColorMap?"#define USE_SHEENCOLORMAP":"",parameters.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",parameters.vertexTangents?"#define USE_TANGENT":"",parameters.vertexColors?"#define USE_COLOR":"",parameters.vertexAlphas?"#define USE_COLOR_ALPHA":"",parameters.vertexUvs?"#define USE_UV":"",parameters.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",parameters.flatShading?"#define FLAT_SHADED":"",parameters.skinning?"#define USE_SKINNING":"",parameters.morphTargets?"#define USE_MORPHTARGETS":"",parameters.morphNormals&&!1===parameters.flatShading?"#define USE_MORPHNORMALS":"",parameters.morphColors&¶meters.isWebGL2?"#define USE_MORPHCOLORS":"",parameters.morphTargetsCount>0&¶meters.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",parameters.morphTargetsCount>0&¶meters.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+parameters.morphTextureStride:"",parameters.morphTargetsCount>0&¶meters.isWebGL2?"#define MORPHTARGETS_COUNT "+parameters.morphTargetsCount:"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine1:"",parameters.sizeAttenuation?"#define USE_SIZEATTENUATION":"",parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&¶meters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),prefixFragment=[customExtensions,generatePrecision(parameters),"#define SHADER_NAME "+parameters.shaderName,customDefines,parameters.useFog&¶meters.fog?"#define USE_FOG":"",parameters.useFog&¶meters.fogExp2?"#define FOG_EXP2":"",parameters.map?"#define USE_MAP":"",parameters.matc
186ap?"#define USE_MATCAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap?"#define "+envMapTypeDefine:"",parameters.envMap?"#define "+envMapModeDefine1:"",parameters.envMap?"#define "+envMapBlendingDefine:"",envMapCubeUVSize?"#define CUBEUV_TEXEL_WIDTH "+envMapCubeUVSize.texelWidth:"",envMapCubeUVSize?"#define CUBEUV_TEXEL_HEIGHT "+envMapCubeUVSize.texelHeight:"",envMapCubeUVSize?"#define CUBEUV_MAX_MIP "+envMapCubeUVSize.maxMip+".0":"",parameters.lightMap?"#define USE_LIGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP":"",parameters.bumpMap?"#define USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMap&¶meters.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",parameters.normalMap&¶meters.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",parameters.clearcoat?"#define USE_CLEARCOAT":"",parameters.clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",parameters.iridescence?"#define USE_IRIDESCENCE":"",parameters.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",parameters.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",parameters.specularColorMap?"#define USE_SPECULARCOLORMAP":"",parameters.roughnessMap?"#define USE_ROUGHNESSMAP":"",parameters.metalnessMap?"#define USE_METALNESSMAP":"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.alphaTest?"#define USE_ALPHATEST":"",parameters.sheen?"#define USE_SHEEN":"",parameters.sheenColorMap?"#define USE_SHEENCOLORMAP":"",parameters.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",parameters.transmission?"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSIONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",parameters.vertexTangents?"#define USE_TANGENT":"",parameters.vertexColors||parameters.instancingColor?"#define USE_COLOR":"",parameters.vertexAlphas?"#define USE_COLOR_ALPHA":"",parameters.vertexUvs?"#define USE_UV":"",parameters.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",parameters.gradientMap?"#define USE_GRADIENTMAP":"",parameters.flatShading?"#define FLAT_SHADED":"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine1:"",parameters.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",parameters.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&¶meters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",parameters.toneMapping!==NoToneMapping?"#define TONE_MAPPING":"",parameters.toneMapping!==NoToneMapping?ShaderChunk.tonemapping_pars_fragment:"",parameters.toneMapping!==NoToneMapping?function(functionName,toneMapping){let toneMappingName;switch(toneMapping){case 1:toneMappingName="Linear";break;case 2:toneMappingName="Reinhard";break;case 3:toneMappingName="OptimizedCineon";break;case ACESFilmicToneMapping:toneMappingName="ACESFilmic";break;case 5:toneMappingName="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",toneMapping),toneMappingName="Linear"}return"vec3 "+functionName+"( vec3 color ) { return "+toneMappingName+"ToneMapping( color ); }"}("toneMapping",parameters.toneMapping):"",parameters.dithering?"#define DITHERING":"",parameters.opaque?"#define OPAQUE":"",ShaderChunk.encodings_pars_fragment,function(functionName,encoding){let components=function(encoding){switch(encoding){case LinearEncoding:return["Linear","( value )"];case sRGBEncoding:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",encoding),["Linear","( value )"]}}(encoding);return"vec4 "+functionName+"( vec4 value ) { return LinearTo"+components[0]+components[1]+"; }"}("linearToOutputTexel",parameters.outputEncoding),parameters.useDepthPacking?"#define DEPTH_PACKING "+parameters.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),vertexShader=replaceClippingPlaneNums(vertexShader=replaceLightNums(vertexShader=resolveIncludes(vertexShader),parameters),parameters),fragmentShader=replaceClippingPlaneNums(fragmentShader=replaceLightNums(fragmentShader=resolveIncludes(fragmentShader),parameters),parameters),vertexShader=unrollLoops(vertexShader),fragmentShader=unrollLoops(fragmentShader),parameters.isWebGL2&&!0!==parameters.isRawShaderMaterial&&(versionString="#version 300 es\n",prefixVertex="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+prefixVertex,prefixFragment=["#define varying in",parameters.glslVersion===GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",parameters.glslVersion===GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+prefixFragment);let vertexGlsl=versionString+prefixVertex+vertexShader,fragmentGlsl=versionString+prefixFragment+fragmentShader,glVertexShader=WebGLShader(gl,35633,vertexGlsl),glFragmentShader=WebGLShader(gl,35632,fragmentGlsl);if(gl.attachShader(program,glVertexShader),gl.attachShader(program,glFragmentShader),void 0!==parameters.index0AttributeName?gl.bindAttribLocation(program,0,parameters.index0AttributeName):!0===parameters.morphTargets&&gl.bindAttribLocation(program,0,"position"),gl.linkProgram(program),renderer.debug.checkSha
186derErrors){let programLog=gl.getProgramInfoLog(program).trim(),vertexLog=gl.getShaderInfoLog(glVertexShader).trim(),fragmentLog=gl.getShaderInfoLog(glFragmentShader).trim(),runnable=!0,haveDiagnostics=!0;if(!1===gl.getProgramParameter(program,35714)){runnable=!1;let vertexErrors=getShaderErrors(gl,glVertexShader,"vertex"),fragmentErrors=getShaderErrors(gl,glFragmentShader,"fragment");console.error("THREE.WebGLProgram: Shader Error "+gl.getError()+" - VALIDATE_STATUS "+gl.getProgramParameter(program,35715)+"\n\nProgram Info Log: "+programLog+"\n"+vertexErrors+"\n"+fragmentErrors)}else""!==programLog?console.warn("THREE.WebGLProgram: Program Info Log:",programLog):(""===vertexLog||""===fragmentLog)&&(haveDiagnostics=!1);haveDiagnostics&&(this.diagnostics={runnable:runnable,programLog:programLog,vertexShader:{log:vertexLog,prefix:prefixVertex},fragmentShader:{log:fragmentLog,prefix:prefixFragment}})}return gl.deleteShader(glVertexShader),gl.deleteShader(glFragmentShader),this.getUniforms=function(){return void 0===cachedUniforms&&(cachedUniforms=new WebGLUniforms(gl,program)),cachedUniforms},this.getAttributes=function(){return void 0===cachedAttributes&&(cachedAttributes=function(gl,program){let attributes={},n=gl.getProgramParameter(program,35721);for(let i=0;i<n;i++){let info=gl.getActiveAttrib(program,i),name=info.name,locationSize=1;35674===info.type&&(locationSize=2),35675===info.type&&(locationSize=3),35676===info.type&&(locationSize=4),attributes[name]={type:info.type,location:gl.getAttribLocation(program,name),locationSize:locationSize}}return attributes}(gl,program)),cachedAttributes},this.destroy=function(){bindingStates.releaseStatesOfProgram(this),gl.deleteProgram(program),this.program=void 0},this.name=parameters.shaderName,this.id=programIdCount++,this.cacheKey=cacheKey,this.usedTimes=1,this.program=program,this.vertexShader=glVertexShader,this.fragmentShader=glFragmentShader,this}let _id=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(material){let vertexShader=material.vertexShader,fragmentShader=material.fragmentShader,vertexShaderStage=this._getShaderStage(vertexShader),fragmentShaderStage=this._getShaderStage(fragmentShader),materialShaders=this._getShaderCacheForMaterial(material);return!1===materialShaders.has(vertexShaderStage)&&(materialShaders.add(vertexShaderStage),vertexShaderStage.usedTimes++),!1===materialShaders.has(fragmentShaderStage)&&(materialShaders.add(fragmentShaderStage),fragmentShaderStage.usedTimes++),this}remove(material){let materialShaders=this.materialCache.get(material);for(let shaderStage of materialShaders)shaderStage.usedTimes--,0===shaderStage.usedTimes&&this.shaderCache.delete(shaderStage.code);return this.materialCache.delete(material),this}getVertexShaderID(material){return this._getShaderStage(material.vertexShader).id}getFragmentShaderID(material){return this._getShaderStage(material.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(material){let cache=this.materialCache,set=cache.get(material);return void 0===set&&(set=new Set,cache.set(material,set)),set}_getShaderStage(code){let cache=this.shaderCache,stage=cache.get(code);return void 0===stage&&(stage=new WebGLShaderStage(code),cache.set(code,stage)),stage}}class WebGLShaderStage{constructor(code){this.id=_id++,this.code=code,this.usedTimes=0}}function WebGLPrograms(renderer,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping){let _programLayers=new Layers,_customShaders=new WebGLShaderCache,programs=[],isWebGL2=capabilities.isWebGL2,logarithmicDepthBuffer=capabilities.logarithmicDepthBuffer,vertexTextures=capabilities.vertexTextures,precision=capabilities.precision,shaderIDs={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(material,lights,shadows,scene,object){let vertexShader,fragmentShader,customVertexShaderID,customFragmentShaderID;let fog=scene.fog,geometry=object.geometry,environment=material.isMeshStandardMaterial?scene.environment:null,envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||environment),envMapCubeUVHeight=envMap&&306===envMap.mapping?envMap.image.height:null,shaderID=shaderIDs[material.type];null!==material.precision&&(precision=capabilities.getMaxPrecision(material.precision))!==material.precision&&console.warn("THREE.WebGLProgram.getParameters:",material.precision,"not supported, using",precision,"instead.");let morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color,morphTargetsCount=void 0!==morphAttribute?morphAttribute.length:0,morphTextureStride=0;if(void 0!==geometry.morphAttributes.position&&(morphTextureStride=1),void 0!==geometry.morphAttributes.normal&&(morphTextureStride=2),void 0!==geometry.morphAttributes.color&&(morphTextureStride=3),shaderID){let shader=ShaderLib[shaderID];
186vertexShader=shader.vertexShader,fragmentShader=shader.fragmentShader}else vertexShader=material.vertexShader,fragmentShader=material.fragmentShader,_customShaders.update(material),customVertexShaderID=_customShaders.getVertexShaderID(material),customFragmentShaderID=_customShaders.getFragmentShaderID(material);let currentRenderTarget=renderer.getRenderTarget(),useAlphaTest=material.alphaTest>0,useClearcoat=material.clearcoat>0,useIridescence=material.iridescence>0,parameters={isWebGL2:isWebGL2,shaderID:shaderID,shaderName:material.type,vertexShader:vertexShader,fragmentShader:fragmentShader,defines:material.defines,customVertexShaderID:customVertexShaderID,customFragmentShaderID:customFragmentShaderID,isRawShaderMaterial:!0===material.isRawShaderMaterial,glslVersion:material.glslVersion,precision:precision,instancing:!0===object.isInstancedMesh,instancingColor:!0===object.isInstancedMesh&&null!==object.instanceColor,supportsVertexTextures:vertexTextures,outputEncoding:null===currentRenderTarget?renderer.outputEncoding:!0===currentRenderTarget.isXRRenderTarget?currentRenderTarget.texture.encoding:LinearEncoding,map:!!material.map,matcap:!!material.matcap,envMap:!!envMap,envMapMode:envMap&&envMap.mapping,envMapCubeUVHeight:envMapCubeUVHeight,lightMap:!!material.lightMap,aoMap:!!material.aoMap,emissiveMap:!!material.emissiveMap,bumpMap:!!material.bumpMap,normalMap:!!material.normalMap,objectSpaceNormalMap:1===material.normalMapType,tangentSpaceNormalMap:material.normalMapType===TangentSpaceNormalMap,decodeVideoTexture:!!material.map&&!0===material.map.isVideoTexture&&material.map.encoding===sRGBEncoding,clearcoat:useClearcoat,clearcoatMap:useClearcoat&&!!material.clearcoatMap,clearcoatRoughnessMap:useClearcoat&&!!material.clearcoatRoughnessMap,clearcoatNormalMap:useClearcoat&&!!material.clearcoatNormalMap,iridescence:useIridescence,iridescenceMap:useIridescence&&!!material.iridescenceMap,iridescenceThicknessMap:useIridescence&&!!material.iridescenceThicknessMap,displacementMap:!!material.displacementMap,roughnessMap:!!material.roughnessMap,metalnessMap:!!material.metalnessMap,specularMap:!!material.specularMap,specularIntensityMap:!!material.specularIntensityMap,specularColorMap:!!material.specularColorMap,opaque:!1===material.transparent&&1===material.blending,alphaMap:!!material.alphaMap,alphaTest:useAlphaTest,gradientMap:!!material.gradientMap,sheen:material.sheen>0,sheenColorMap:!!material.sheenColorMap,sheenRoughnessMap:!!material.sheenRoughnessMap,transmission:material.transmission>0,transmissionMap:!!material.transmissionMap,thicknessMap:!!material.thicknessMap,combine:material.combine,vertexTangents:!!material.normalMap&&!!geometry.attributes.tangent,vertexColors:material.vertexColors,vertexAlphas:!0===material.vertexColors&&!!geometry.attributes.color&&4===geometry.attributes.color.itemSize,vertexUvs:!!material.map||!!material.bumpMap||!!material.normalMap||!!material.specularMap||!!material.alphaMap||!!material.emissiveMap||!!material.roughnessMap||!!material.metalnessMap||!!material.clearcoatMap||!!material.clearcoatRoughnessMap||!!material.clearcoatNormalMap||!!material.iridescenceMap||!!material.iridescenceThicknessMap||!!material.displacementMap||!!material.transmissionMap||!!material.thicknessMap||!!material.specularIntensityMap||!!material.specularColorMap||!!material.sheenColorMap||!!material.sheenRoughnessMap,uvsVertexOnly:!(material.map||material.bumpMap||material.normalMap||material.specularMap||material.alphaMap||material.emissiveMap||material.roughnessMap||material.metalnessMap||material.clearcoatNormalMap||material.iridescenceMap||material.iridescenceThicknessMap||material.transmission>0||material.transmissionMap||material.thicknessMap||material.specularIntensityMap||material.specularColorMap||material.sheen>0||material.sheenColorMap||material.sheenRoughnessMap)&&!!material.displacementMap,fog:!!fog,useFog:!0===material.fog,fogExp2:fog&&fog.isFogExp2,flatShading:!!material.flatShading,sizeAttenuation:material.sizeAttenuation,logarithmicDepthBuffer:logarithmicDepthBuffer,skinning:!0===object.isSkinnedMesh,morphTargets:void 0!==geometry.morphAttributes.position,morphNormals:void 0!==geometry.morphAttributes.normal,morphColors:void 0!==geometry.morphAttributes.color,morphTargetsCount:morphTargetsCount,morphTextureStride:morphTextureStride,numDirLights:lights.directional.length,numPointLights:lights.point.length,numSpotLights:lights.spot.length,numSpotLightMaps:lights.spotLightMap.length,numRectAreaLights:lights.rectArea.length,numHemiLights:lights.hemi.length,numDirLightShadows:lights.directionalShadowMap.length,numPointLightShadows:lights.pointShadowMap.length,numSpotLightShadows:lights.spotShadowMap.length,numSpotLightShadowsWithMaps:lights.numSpotLightShadowsWithMaps,numClippingPlanes:clipping.numPlanes,numClipIntersection:clipping.numIntersection,dithering:material.dithering,shadowMapEnabled:renderer.shadowMap.enabled&&shadows.length>0,shadowMapType:renderer.shadowMap.type,toneMapping:material.toneMapped?renderer.toneMapping:NoToneMapping,physicallyCorrectLights:renderer.physicallyCorrectLights,premultipliedAlpha:material.premultipliedAlpha,doubleSided:material.side===DoubleSide,flipSided:material.side===BackSide,useDepthPacking:!!material.depthPacking,depthPacking:material.depthPacking||0,index0AttributeName:material.index0AttributeName,extensionDerivatives:material.extensions&&material.extensions.derivatives,extensionFragDepth:material.extensions&&material.extensions.fragDepth,extensionDrawBuffers:material.extensions&&material.extensions.drawBuffers,extensionShaderTextureLOD:material.extensions&&material.extensions.shaderTextureLOD,rendererExtensionFragDepth:isWebGL2||extensions.has("EXT_frag_depth"),rendererExtensionDrawBuffers:isWebGL2||extensions.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:isWebGL2||extensions.has("EXT_shader_texture_lod"),customProgramCacheKey:material.customProgramCacheKey()};return parameters},getProgramCacheKey:function(parameters){let array=[];if(parameters.shaderID?array.push(parameters.shaderID):(array.push(parameters.customVertexShaderID),array.push(parameters.customFragmentShaderID)),void 0!==parameters.defines)for(let name in parameters.defines)array.push(name),array.push(parameters.defines[name]);return!1===parameters.isRawShaderMaterial&&(array.push(parameters.precision),array.push(parameters.outputEncoding),array.push(parameters.envMapMode),array.push(parameters.envMapCubeUVHeight),array.push(parameters.combine),array.push(parameters.vertexUvs),array.push(parameters.fogExp2),array.push(parameters.sizeAttenuation),array.push(parameters.morphTargetsCount),array.push(parameters.morphAttributeCount),array.push(parameters.numDirLights),array.push(parameters.numPointLights),array.push(parameters.numSpotLights),array.push(parameters.numSpotLightMaps),array.push(parameters.numHemiLights),array.push(parameters.numRectAreaLights),array.push(parameters.numDirLightShadows),array.push(parameters.numPointLightShadows),array.push(parameters.numSpotLightShadows),array.push(parameters.numSpotLightShadowsWithMaps),array.push(parameters.shadowMapType),array.push(parameters.toneMapping),array.push(parameters.numClippingPlanes),array.push(parameters.numClipIntersection),array.push(parameters.depthPacking),_programLayers.disableAll(),parameters.isWebGL2&&_programLayers.enable(0),parameters.supportsVertexTextures&&_programLayers.enable(1),parameters.instancing&&_programLayers.enable(2),parameters.instancingColor&&_programLayers.enable(3),parameters.map&&_programLayers.enable(4),parameters.matc
vendor: 6,716 bytes, line 186
186ap&&_programLayers.enable(5),parameters.envMap&&_programLayers.enable(6),parameters.lightMap&&_programLayers.enable(7),parameters.aoMap&&_programLayers.enable(8),parameters.emissiveMap&&_programLayers.enable(9),parameters.bumpMap&&_programLayers.enable(10),parameters.normalMap&&_programLayers.enable(11),parameters.objectSpaceNormalMap&&_programLayers.enable(12),parameters.tangentSpaceNormalMap&&_programLayers.enable(13),parameters.clearcoat&&_programLayers.enable(14),parameters.clearcoatMap&&_programLayers.enable(15),parameters.clearcoatRoughnessMap&&_programLayers.enable(16),parameters.clearcoatNormalMap&&_programLayers.enable(17),parameters.iridescence&&_programLayers.enable(18),parameters.iridescenceMap&&_programLayers.enable(19),parameters.iridescenceThicknessMap&&_programLayers.enable(20),parameters.displacementMap&&_programLayers.enable(21),parameters.specularMap&&_programLayers.enable(22),parameters.roughnessMap&&_programLayers.enable(23),parameters.metalnessMap&&_programLayers.enable(24),parameters.gradientMap&&_programLayers.enable(25),parameters.alphaMap&&_programLayers.enable(26),parameters.alphaTest&&_programLayers.enable(27),parameters.vertexColors&&_programLayers.enable(28),parameters.vertexAlphas&&_programLayers.enable(29),parameters.vertexUvs&&_programLayers.enable(30),parameters.vertexTangents&&_programLayers.enable(31),parameters.uvsVertexOnly&&_programLayers.enable(32),array.push(_programLayers.mask),_programLayers.disableAll(),parameters.fog&&_programLayers.enable(0),parameters.useFog&&_programLayers.enable(1),parameters.flatShading&&_programLayers.enable(2),parameters.logarithmicDepthBuffer&&_programLayers.enable(3),parameters.skinning&&_programLayers.enable(4),parameters.morphTargets&&_programLayers.enable(5),parameters.morphNormals&&_programLayers.enable(6),parameters.morphColors&&_programLayers.enable(7),parameters.premultipliedAlpha&&_programLayers.enable(8),parameters.shadowMapEnabled&&_programLayers.enable(9),parameters.physicallyCorrectLights&&_programLayers.enable(10),parameters.doubleSided&&_programLayers.enable(11),parameters.flipSided&&_programLayers.enable(12),parameters.useDepthPacking&&_programLayers.enable(13),parameters.dithering&&_programLayers.enable(14),parameters.specularIntensityMap&&_programLayers.enable(15),parameters.specularColorMap&&_programLayers.enable(16),parameters.transmission&&_programLayers.enable(17),parameters.transmissionMap&&_programLayers.enable(18),parameters.thicknessMap&&_programLayers.enable(19),parameters.sheen&&_programLayers.enable(20),parameters.sheenColorMap&&_programLayers.enable(21),parameters.sheenRoughnessMap&&_programLayers.enable(22),parameters.decodeVideoTexture&&_programLayers.enable(23),parameters.opaque&&_programLayers.enable(24),array.push(_programLayers.mask),array.push(renderer.outputEncoding)),array.push(parameters.customProgramCacheKey),array.join()},getUniforms:function(material){let uniforms;let shaderID=shaderIDs[material.type];if(shaderID){let shader=ShaderLib[shaderID];uniforms=UniformsUtils.clone(shader.uniforms)}else uniforms=material.uniforms;return uniforms},acquireProgram:function(parameters,cacheKey){let program;for(let p=0,pl=programs.length;p<pl;p++){let preexistingProgram=programs[p];if(preexistingProgram.cacheKey===cacheKey){program=preexistingProgram,++program.usedTimes;break}}return void 0===program&&(program=new WebGLProgram(renderer,cacheKey,parameters,bindingStates),programs.push(program)),program},releaseProgram:function(program){if(0==--program.usedTimes){let i=programs.indexOf(program);programs[i]=programs[programs.length-1],programs.pop(),program.destroy()}},releaseShaderCache:function(material){_customShaders.remove(material)},programs:programs,dispose:function(){_customShaders.dispose()}}}function WebGLProperties(){let properties=new WeakMap;return{get:function(object){let map=properties.get(object);return void 0===map&&(map={},properties.set(object,map)),map},remove:function(object){properties.delete(object)},update:function(object,key,value){properties.get(object)[key]=value},dispose:function(){properties=new WeakMap}}}function painterSortStable(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function reversePainterSortStable(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function WebGLRenderList(){let renderItems=[],renderItemsIndex=0,opaque=[],transmissive=[],transparent=[];function getNextRenderItem(object,geometry,material,groupOrder,z,group){let renderItem=renderItems[renderItemsIndex];return void 0===renderItem?(renderItem={id:object.id,object:object,geometry:geometry,material:material,groupOrder:groupOrder,renderOrder:object.renderOrder,z:z,group:group},renderItems[renderItemsIndex]=renderItem):(renderItem.id=object.id,renderItem.object=object,renderItem.geometry=geometry,renderItem.material=material,renderItem.groupOrder=groupOrder,renderItem.renderOrder=object.renderOrder,renderItem.z=z,renderItem.group=group),renderItemsIndex++,renderItem}return{opaque:opaque,transmissive:transmissive,transparent:transparent,init:function(){renderItemsIndex=0,opaque.length=0,transmissive.length=0,transparent.length=0},push:function(object,geometry,material,groupOrder,z,group){let renderItem=getNextRenderItem(object,geometry,material,groupOrder,z,group);material.transmission>0?transmissive.push(renderItem):!0===material.transparent?transparent.push(renderItem):opaque.push(renderItem)},unshift:function(object,geometry,material,groupOrder,z,group){let renderItem=getNextRenderItem(object,geometry,material,groupOrder,z,group);material.transmission>0?transmissive.unshift(renderItem):!0===material.transparent?transparent.unshift(renderItem):opaque.unshift(renderItem)},finish:function(){for(let i=renderItemsIndex,il=renderItems.length;i<il;i++){let renderItem=renderItems[i];if(null===renderItem.id)break;renderItem.id=null,renderItem.object=null,renderItem.geometry=null,renderItem.material=null,renderItem.group=null}},sort:function(customOpaqueSort,customTransparentSort){opaque.length>1&&opaque.sort(customOpaqueSort||painterSortStable),transmissive.length>1&&transmissive.sort(customTransparentSort||reversePainterSortStable),transparent.length>1&&transparent.sort(customTransparentSort||reversePainterSortStable)}}}function WebGLRenderLists(){let lists=new WeakMap;return{get:function(scene,renderCallDepth){let list;let listArray=lists.get(scene);return void 0===listArray?(list=new WebGLRenderList,lists.set(scene,[list])):renderCallDepth>
vendor: 4,287 bytes, line 186
186=listArray.length?(list=new WebGLRenderList,listArray.push(list)):list=listArray[renderCallDepth],list},dispose:function(){lists=new WeakMap}}}function UniformsCache(){let lights={};return{get:function(light){let uniforms;if(void 0!==lights[light.id])return lights[light.id];switch(light.type){case"DirectionalLight":uniforms={direction:new Vector3,color:new Color};break;case"SpotLight":uniforms={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":uniforms={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":uniforms={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":uniforms={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return lights[light.id]=uniforms,uniforms}}}let nextVersion=0;function shadowCastingAndTexturingLightsFirst(lightA,lightB){return(lightB.castShadow?2:0)-(lightA.castShadow?2:0)+(lightB.map?1:0)-(lightA.map?1:0)}function WebGLLights(extensions,capabilities){let cache=new UniformsCache,shadowCache=function(){let lights={};return{get:function(light){let uniforms;if(void 0!==lights[light.id])return lights[light.id];switch(light.type){case"DirectionalLight":case"SpotLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return lights[light.id]=uniforms,uniforms}}}(),state={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let i=0;i<9;i++)state.probe.push(new Vector3);let vector3=new Vector3,matrix4=new Matrix4,matrix42=new Matrix4;return{setup:function(lights,physicallyCorrectLights){let r=0,g=0,b=0;for(let i=0;i<9;i++)state.probe[i].set(0,0,0);let directionalLength=0,pointLength=0,spotLength=0,rectAreaLength=0,hemiLength=0,numDirectionalShadows=0,numPointShadows=0,numSpotShadows=0,numSpotMaps=0,numSpotShadowsWithMaps=0;lights.sort(shadowCastingAndTexturingLightsFirst);let scaleFactor=!0!==physicallyCorrectLights?Math.PI:1;for(let i1=0,l=lights.length;i1<l;i1++){let light=lights[i1],color=light.color,intensity=light.intensity,distance=light.distance,shadowMap=light.shadow&&light.shadow.map?light.shadow.map.texture:null;if(light.isAmbientLight)r+=color.r*intensity*scaleFactor,g+=color.g*intensity*scaleFactor,b+=color.b*intensity*scaleFactor;else if(light.isLightProbe)for(let j=0;j<9;j++)state.probe[j].addScaledVector(light.sh.coefficients[j],intensity);else if(light.isDirectionalLight){let uniforms=cache.get(light);if(uniforms.color.copy(light.color).multiplyScalar(light.intensity*scaleFactor),light.castShadow){let shadow=light.shadow,shadowUniforms=shadowCache.get(light);shadowUniforms.shadowBias=shadow.bias,shadowUniforms.shadowNormalBias=shadow.normalBias,shadowUniforms.shadowRadius=shadow.radius,shadowUniforms.shadowMapSize=shadow.mapSize,state.directionalShadow[directionalLength]=shadowUniforms,state.directionalShadowMap[directionalLength]=shadowMap,state.directionalShadowMatrix[directionalLength]=light.shadow.matrix,numDirectionalShadows++}state.directional[directionalLength]=uniforms,directionalLength++}else if(light.isSpotLight){let uniforms1=cache.get(light);uniforms1.position.setFromMatrixPosition(light.matrixWorld),uniforms1.color.copy(color).multiplyScalar(intensity*scaleFactor),uniforms1.distance=distance,uniforms1.coneCos=Math.cos(light.angle),uniforms1.penumbraCos=Math.cos(light.angle*(1-light.penumbra)),uniforms1.decay=light.decay,state.spot[spotLength]=uniforms1;let shadow1=light.shadow;if(light.map&&(state.spotLightMap[numSpotMaps]=light.map,numSpotMaps++,shadow1.updateMatrices(light),light.castShadow&&numSpotShadowsWithMaps++),state.spotLightMatrix[spotLength]=sha
186dow1.matrix,light.castShadow){let shadowUniforms1=shadowCache.get(light);shadowUniforms1.shadowBias=shadow1.bias,shadowUniforms1.shadowNormalBias=shadow1.normalBias,shadowUniforms1.shadowRadius=shadow1.radius,shadowUniforms1.shadowMapSize=shadow1.mapSize,state.spotShadow[spotLength]=shadowUniforms1,state.spotShadowMap[spotLength]=shadowMap,numSpotShadows++}spotLength++}else if(light.isRectAreaLight){let uniforms2=cache.get(light);uniforms2.color.copy(color).multiplyScalar(intensity),uniforms2.halfWidth.set(.5*light.width,0,0),uniforms2.halfHeight.set(0,.5*light.height,0),state.rectArea[rectAreaLength]=uniforms2,rectAreaLength++}else if(light.isPointLight){let uniforms3=cache.get(light);if(uniforms3.color.copy(light.color).multiplyScalar(light.intensity*scaleFactor),uniforms3.distance=light.distance,uniforms3.decay=light.decay,light.castShadow){let shadow2=light.shadow,shadowUniforms2=shadowCache.get(light);shadowUniforms2.shadowBias=shadow2.bias,shadowUniforms2.shadowNormalBias=shadow2.normalBias,shadowUniforms2.shadowRadius=shadow2.radius,shadowUniforms2.shadowMapSize=shadow2.mapSize,shadowUniforms2.shadowCameraNear=shadow2.camera.near,shadowUniforms2.shadowCameraFar=shadow2.camera.far,state.pointShadow[pointLength]=shadowUniforms2,state.pointShadowMap[pointLength]=shadowMap,state.pointShadowMatrix[pointLength]=light.shadow.matrix,numPointShadows++}state.point[pointLength]=uniforms3,pointLength++}else if(light.isHemisphereLight){let uniforms4=cache.get(light);uniforms4.skyColor.copy(light.color).multiplyScalar(intensity*scaleFactor),uniforms4.groundColor.copy(light.groundColor).multiplyScalar(intensity*scaleFactor),state.hemi[hemiLength]=uniforms4,hemiLength++}}rectAreaLength>0&&(capabilities.isWebGL2?(state.rectAreaLTC1=UniformsLib.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib.LTC_FLOAT_2):!0===extensions.has("OES_texture_float_linear")?(state.rectAreaLTC1=UniformsLib.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib.LTC_FLOAT_2):!0===extensions.has("OES_texture_half_float_linear")?(state.rectAreaLTC1=UniformsLib.LTC_HALF_1,state.rectAreaLTC2=UniformsLib.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),state.ambient[0]=r,state.ambient[1]=g,state.ambient[2]=b;let hash=state.hash;(hash.directionalLength!==directionalLength||hash.pointLength!==pointLength||hash.spotLength!==spotLength||hash.rectAreaLength!==rectAreaLength||hash.hemiLength!==hemiLength||hash.numDirectionalShadows!==numDirectionalShadows||hash.numPointShadows!==numPointShadows||hash.numSpotShadows!==numSpotShadows||hash.numSpotMaps!==numSpotMaps)&&(state.directional.length=directionalLength,state.spot.length=spotLength,state.rectArea.length=rectAreaLength,state.point.length=pointLength,state.hemi.length=hemiLength,state.directionalShadow.length=numDirectionalShadows,state.directionalShadowMap.length=numDirectionalShadows,state.pointShadow.length=numPointShadows,state.pointShadowMap.length=numPointShadows,state.spotShadow.length=numSpotShadows,state.spotShadowMap.length=numSpotShadows,state.directionalShadowMatrix.length=numDirectionalShadows,state.pointShadowMatrix.length=numPointShadows,state.spotLightMatrix.length=numSpotShadows+numSpotMaps-numSpotShadowsWithMaps,state.spotLightMap.length=numSpotMaps,state.numSpotLightShadowsWithMaps=numSpotShadowsWithMaps,hash.directionalLength=directionalLength,hash.pointLength=pointLength,hash.spotLength=spotLength,hash.rectAreaLength=rectAreaLength,hash.hemiLength=hemiLength,hash.numDirectionalShadows=numDirectionalShadows,hash.numPointShadows=numPointShadows,hash.numSpotShadows=numSpotShadows,hash.numSpotMaps=numSpotMaps,state.version=nextVersion++)},setupView:function(lights,camera){let directionalLength=0,pointLength=0,spotLength=0,rectAreaLength=0,hemiLength=0,viewMatrix=camera.matrixWorldInverse;for(let i=0,l=lights.length;i<l;i++){let light=lights[i];if(light.isDirectionalLight){let uniforms=state.directional[directionalLength];uniforms.direction.setFromMatrixPosition(light.matrixWorld),vector3.setFromMatrixPosition(light.target.matrixWorld),uniforms.direction.sub(vector3),uniforms.direction.transformDirection(viewMatrix),directionalLength++}else if(light.isSpotLight){let uniforms1=state.spot[spotLength];uniforms1.position.setFromMatrixPosition(light.matrixWorld),uniforms1.position.applyMatrix4(viewMatrix),uniforms1.direction.setFromMatrixPosition(light.matrixWorld),vector3.setFromMatrixPosition(light.target.matrixWorld),uniforms1.direction.sub(vector3),uniforms1.direction.transformDirection(viewMatrix),spotLength++}else if(light.isRectAreaLight){let uniforms2=state.rectArea[rectAreaLength];uniforms2.position.setFromMatrixPosition(light.matrixWorld),uniforms2.position.applyMatrix4(viewMatrix),matrix42.identity(),matrix4.copy(light.matrixWorld),matrix4.premultiply(viewMatrix),matrix42.extractRotation(matrix4),uniforms2.halfWidth.set(.5*light.width,0,0),uniforms2.halfHeight.set(0,.5*light.height,0),uniforms2.halfWidth.applyMatrix4(matrix42),uniforms2.halfHeight.applyMatrix4(matrix42),rectAreaLength++}else if(light.isPointLight){let uniforms3=state.point[pointLength];uniforms3.position.setFromMatrixPosition(light.matrixWorld),uniforms3.position.applyMatrix4(viewMatrix),pointLength++}else if(light.isHemisphereLight){let uniforms4=state.hemi[hemiLength];uniforms4.direction.setFromMatrixPosition(light.matrixWorld),uniforms4.direction.transformDirection(viewMatrix),hemiLength++}}},state:state}}function WebGLRenderState(extensions,capabilities){let lights=new WebGLLights(extensions,capabilities),lightsArray=[],shadowsArray=[];return{init:function(){lightsArray.length=0,shadowsArray.length=0},state:{lightsArray:lightsArray,shadowsArray:shadowsArray,lights:lights},setupLights:function(physicallyCorrectLights){lights.setup(lightsArray,physicallyCorrectLights)},setupLightsView:function(camera){lights.setupView(lightsArray,camera)},pushLight:function(light){lightsArray.push(light)},pushShadow:function(shadowLight){shadowsArray.push(shadowLight)}}}function WebGLRenderStates(extensions,capabilities){let renderStates=new WeakMap;return{get:function(scene,renderCallDepth=0){let renderState;let renderStateArray=renderStates.get(scene);return void 0===renderStateArray?(renderState=new WebGLRenderState(extensions,capabilities),renderStates.set(scene,[render
vendor: 4,028 bytes, line 186
186State])):renderCallDepth>=renderStateArray.length?(renderState=new WebGLRenderState(extensions,capabilities),renderStateArray.push(renderState)):renderState=renderStateArray[renderCallDepth],renderState},dispose:function(){renderStates=new WeakMap}}}class MeshDepthMaterial extends Material{constructor(parameters){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(parameters)}copy(source){return super.copy(source),this.depthPacking=source.depthPacking,this.map=source.map,this.alphaMap=source.alphaMap,this.displacementMap=source.displacementMap,this.displacementScale=source.displacementScale,this.displacementBias=source.displacementBias,this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this}}class MeshDistanceMaterial extends Material{constructor(parameters){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Vector3,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(parameters)}copy(source){return super.copy(source),this.referencePosition.copy(source.referencePosition),this.nearDistance=source.nearDistance,this.farDistance=source.farDistance,this.map=source.map,this.alphaMap=source.alphaMap,this.displacementMap=source.displacementMap,this.displacementScale=source.displacementScale,this.displacementBias=source.displacementBias,this}}function WebGLShadowMap(_renderer,_objects,_capabilities){let _frustum=new Frustum,_shadowMapSize=new Vector2,_viewportSize=new Vector2,_viewport=new Vector4,_depthMaterial=new MeshDepthMaterial({depthPacking:3201}),_distanceMaterial=new MeshDistanceMaterial,_materialCache={},_maxTextureSize=_capabilities.maxTextureSize,shadowSide={0:BackSide,1:FrontSide,2:DoubleSide},shadowMaterialVertical=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),shadowMaterialHorizontal=shadowMaterialVertical.clone();shadowMaterialHorizontal.defines.HORIZONTAL_PASS=1;let fullScreenTri=new BufferGeometry;fullScreenTri.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let fullScreenMesh=new Mesh(fullScreenTri,shadowMaterialVertical),scope=this;function getDepthMaterial(object,material,light,shadowCameraNear,shadowCameraFar,type){let result=null,customMaterial=!0===light.isPointLight?object.customDistanceMaterial:object.customDepthMaterial;if(result=void 0!==customMaterial?customMaterial:!0===light.isPointLight?_distanceMaterial:_depthMaterial,_renderer.localClippingEnabled&&!0===material.clipSh
186adows&&Array.isArray(material.clippingPlanes)&&0!==material.clippingPlanes.length||material.displacementMap&&0!==material.displacementScale||material.alphaMap&&material.alphaTest>0){let keyA=result.uuid,keyB=material.uuid,materialsForVariant=_materialCache[keyA];void 0===materialsForVariant&&(materialsForVariant={},_materialCache[keyA]=materialsForVariant);let cachedMaterial=materialsForVariant[keyB];void 0===cachedMaterial&&(cachedMaterial=result.clone(),materialsForVariant[keyB]=cachedMaterial),result=cachedMaterial}return result.visible=material.visible,result.wireframe=material.wireframe,3===type?result.side=null!==material.shadowSide?material.shadowSide:material.side:result.side=null!==material.shadowSide?material.shadowSide:shadowSide[material.side],result.alphaMap=material.alphaMap,result.alphaTest=material.alphaTest,result.clipShadows=material.clipShadows,result.clippingPlanes=material.clippingPlanes,result.clipIntersection=material.clipIntersection,result.displacementMap=material.displacementMap,result.displacementScale=material.displacementScale,result.displacementBias=material.displacementBias,result.wireframeLinewidth=material.wireframeLinewidth,result.linewidth=material.linewidth,!0===light.isPointLight&&!0===result.isMeshDistanceMaterial&&(result.referencePosition.setFromMatrixPosition(light.matrixWorld),result.nearDistance=shadowCameraNear,result.farDistance=shadowCameraFar),result}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(lights,scene,camera){if(!1===scope.enabled||!1===scope.autoUpdate&&!1===scope.needsUpdate||0===lights.length)return;let currentRenderTarget=_renderer.getRenderTarget(),activeCubeFace=_renderer.getActiveCubeFace(),activeMipmapLevel=_renderer.getActiveMipmapLevel(),_state=_renderer.state;_state.setBlending(NoBlending),_state.buffers.color.setClear(1,1,1,1),_state.buffers.depth.setTest(!0),_state.setScissorTest(!1);for(let i=0,il=lights.length;i<il;i++){let light=lights[i],shadow=light.shadow;if(void 0===shadow){console.warn("THREE.WebGLShadowMap:",light,"has no shadow.");continue}if(!1===shadow.autoUpdate&&!1===shadow.needsUpdate)continue;_shadowMapSize.copy(shadow.mapSize);let shadowFrameExtents=shadow.getFrameExtents();if(_shadowMapSize.multiply(shadowFrameExtents),_viewportSize.copy(shadow.mapSize),(_shadowMapSize.x>_maxTextureSize||_shadowMapSize.y>_maxTextureSize)&&(_shadowMapSize.x>_maxTextureSize&&(_viewportSize.x=Math.floor(_maxTextureSize/shadowFrameExtents.x),_shadowMapSize.x=_viewportSize.x*shadowFrameExtents.x,shadow.mapSize.x=_viewportSize.x),_shadowMapSize.y>_maxTextureSize&&(_viewportSize.y=Math.floor(_maxTextureSize/shadowFrameExtents.y),_shadowMapSize.y=_viewportSize.y*shadowFrameExtents.y,shadow.mapSize.y=_viewportSize.y)),null===shadow.map){let pars=3!==this.type?{minFilter:NearestFilter,magFilter:NearestFilter}:{};shadow.map=new WebGLRenderTarget(_shadowMapSize.x,_shadowMapSize.y,pars),shadow.map.texture.name=light.name+".shadowMap",shadow.camera.updateProjectionMatrix()}_renderer.setRenderTarget(shadow.map),_renderer.clear();let viewportCount=shadow.getViewportCount();for(let vp=0;vp<viewportCount;vp++){let viewport=shadow.getViewport(vp);_viewport.set(_viewportSize.x*viewport.x,_viewportSize.y*viewport.y,_viewportSize.x*viewport.z,_viewportSize.y*viewport.w),_state.viewport(_viewport),shadow.updateMatrices(light,vp),_frustum=shadow.getFrustum(),function renderObject(object,camera,shadowCamera,light,type){if(!1===object.visible)return;let visible=object.layers.test(camera.layers);if(visible&&(object.isMesh||object.isLine||object.isPoints)&&(object.castShadow||object.receiveShadow&&3===type)&&(!object.frustumCulled||_frustum.intersectsObject(object))){object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld);let geometry=_objects.update(object),material=object.material;if(Array.isArray(material)){let groups=geometry.groups;for(let k=0,kl=groups.length;k<kl;k++){let group=groups[k],groupMaterial=material[group.materialIndex];if(groupMaterial&&groupMaterial.visible){let depthMaterial=getDepthMaterial(object,groupMaterial,light,shadowCamera.near,shadowCamera.far,type);_renderer.renderBufferDirect(shadowCamera,null,geometry,depthMaterial,object,group)}}}else if(material.visible){let depthMaterial1=getDepthMaterial(object,material,light,shadowCamera.near,shadowCamera.far,type);_renderer.renderBufferDirect(shadowCamera,null,geometry,depthMaterial1,object,null)}}let children=object.children;for(let i=0,l=children.length;i<l;i++)renderObject(children[i],camera,shadowCamera,light,type)}(scene,camera,shadow.camera,light,this.type)}!0!==shadow.isPointLightShadow&&3===this.type&&function(shadow,camera){let geometry=_objects.update(fullScreenMesh);shadowMaterialVertical.defines.VSM_SAMPLES!==shadow.blurSamples&&(shadowMaterialVertical.defines.VSM_SAMPLES=shadow.blurSamples,shadowMaterialHorizontal.defines.VSM_SAMPLES=shadow.blurSamples,shadowMaterialVertical.needsUpdate=!0,shadowMaterialHorizontal.needsUpdate=!0),null===shadow.mapPass&&(shadow.mapPass=new WebGLRenderTarget(_shadowMapSize.x,_shadowMapSize.y)),shadowMaterialVertical.uniforms.shadow_pass.value=shadow.map.texture,shadowMaterialVertical.uniforms.resolution.value=shadow.mapSize,shadowMaterialVertical.uniforms.radius.value=shadow.radius,_renderer.setRenderTarget(shadow.mapPass),_renderer.clear(),_renderer.renderBufferDirect(camera,null,geometry,shadowMaterialVertical,fullScreenMesh,null),shadowMaterialHorizontal.uniforms.shadow_pass.value=shadow.mapPass.texture,shadowMaterialHorizontal.uniforms.resolution.value=shadow.mapSize,shadowMaterialHorizontal.uniforms.radius.value=shadow.radius,_renderer.setRenderTarget(shadow.map),_renderer.clear(),_renderer.renderBufferDirect(camera,null,geometry,shadowMaterialHorizontal,fullScreenMesh,null)}(shadow,camera),shadow.needsUpdate=!1}scope.needsUpdate=!1,_renderer.setRenderTarget(currentRenderTarget,activeCubeFace,activeMipmapLevel)}}
186function WebGLState(gl,extensions,capabilities){let isWebGL2=capabilities.isWebGL2,colorBuffer=new function(){let locked=!1,color=new Vector4,currentColorMask=null,currentColorClear=new Vector4(0,0,0,0);return{setMask:function(colorMask){currentColorMask===colorMask||locked||(gl.colorMask(colorMask,colorMask,colorMask,colorMask),currentColorMask=colorMask)},setLocked:function(lock){locked=lock},setClear:function(r,g,b,a,premultipliedAlpha){!0===premultipliedAlpha&&(r*=a,g*=a,b*=a),color.set(r,g,b,a),!1===currentColorClear.equals(color)&&(gl.clearColor(r,g,b,a),currentColorClear.copy(color))},reset:function(){locked=!1,currentColorMask=null,currentColorClear.set(-1,0,0,0)}}},depthBuffer=new function(){let locked=!1,currentDepthMask=null,currentDepthFunc=null,currentDepthClear=null;return{setTest:function(depthTest){depthTest?enable(2929):disable(2929)},setMask:function(depthMask){currentDepthMask===depthMask||locked||(gl.depthMask(depthMask),currentDepthMask=depthMask)},setFunc:function(depthFunc){if(currentDepthFunc!==depthFunc){switch(depthFunc){case 0:gl.depthFunc(512);break;case 1:gl.depthFunc(519);break;case 2:gl.depthFunc(513);break;case 3:default:gl.depthFunc(515);break;case 4:gl.depthFunc(514);break;case 5:gl.depthFunc(518);break;case 6:gl.depthFunc(516);break;case 7:gl.depthFunc(517)}currentDepthFunc=depthFunc}},setLocked:function(lock){locked=lock},setClear:function(depth){currentDepthClear!==depth&&(gl.clearDepth(depth),currentDepthClear=depth)},reset:function(){locked=!1,currentDepthMask=null,currentDepthFunc=null,currentDepthClear=null}}},stencilBuffer=new function(){let locked=!1,currentStencilMask=null,currentStencilFunc=null,currentStencilRef=null,currentStencilFuncMask=null,currentStencilFail=null,currentStencilZFail=null,currentStencilZPass=null,currentStencilClear=null;return{setTest:function(stencilTest){locked||(stencilTest?enable(2960):disable(2960))},setMask:function(stencilMask){currentStencilMask===stencilMask||locked||(gl.stencilMask(stencilMask),currentStencilMask=stencilMask)},setFunc:function(stencilFunc,stencilRef,stencilMask){(currentStencilFunc!==stencilFunc||currentStencilRef!==stencilRef||currentStencilFuncMask!==stencilMask)&&(gl.stencilFunc(stencilFunc,stencilRef,stencilMask),currentStencilFunc=stencilFunc,currentStencilRef=stencilRef,currentStencilFuncMask=stencilMask)},setOp:function(stencilFail,stencilZFail,stencilZPass){(currentStencilFail!==stencilFail||currentStencilZFail!==stencilZFail||currentStencilZPass!==stencilZPass)&&(gl.stencilOp(stencilFail,stencilZFail,stencilZPass),currentStencilFail=stencilFail,currentStencilZFail=stencilZFail,currentStencilZPass=stencilZPass)},setLocked:function(lock){locked=lock},setClear:function(stencil){currentStencilClear!==stencil&&(gl.clearStencil(stencil),currentStencilClear=stencil)},reset:function(){locked=!1,currentStencilMask=null,currentStencilFunc=null,currentStencilRef=null,currentStencilFuncMask=null,currentStencilFail=null,currentStencilZFail=null,currentStencilZPass=null,currentStencilClear=null}}},uboBindings=new WeakMap,uboProgamMap=new WeakMap,enabledCapabilities={},currentBoundFramebuffers={},currentDrawbuffers=new WeakMap,defaultDrawbuffers=[],currentProgram=null,currentBlendingEnabled=!1,currentBlending=null,currentBlendEquation=null,currentBlendSrc=null,currentBlendDst=null,currentBlendEquationAlpha=null,currentBlendSrcAlpha=null,currentBlendDstAlpha=null,currentPremultipledAlpha=!1,currentFlipSided=null,currentCullFace=null,currentLineWidth=null,currentPolygonOffsetFactor=null,currentPolygonOffsetUnits=null,maxTextures=gl.getParameter(35661),lineWidthAvailable=!1,glVersion=gl.getParameter(7938);-1!==glVersion.indexOf("WebGL")?lineWidthAvailable=parseFloat(/^WebGL (\d)/.exec(glVersion)[1])>=1:-1!==glVersion.indexOf("OpenGL ES")&&(lineWidthAvailable=parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1])>=2);let currentTextureSlot=null,currentBoundTextures={},scissorParam=gl.getParameter(3088),viewportParam=gl.getParameter(2978),currentScissor=new Vector4().fromArray(scissorParam),currentViewport=new Vector4().fromArray(viewportParam);function createTexture(type,target,count){let data=new Uint8Array(4),texture=gl.createTexture();gl.bindTexture(type,texture),gl.texParameteri(type,10241,9728),gl.texParameteri(type,10240,9728);for(let i=0;i<count;i++)gl.texImage2D(target+i,0,6408,1,1,0,6408,5121,data);return texture}let emptyTextures={};function enable(id){!0!==enabledCapabilities[id]&&(gl.enable(id),enabledCapabilities[id]=!0)}function disable(id){!1!==enabledCapabilities[id]&&(gl.disable(id),enabledCapabilities[id]=!1)}emptyTextures[3553]=createTexture(3553,3553,1),emptyTextures[34067]=createTexture(34067,34069,6),colorBuffer.setClear(0,0,0,1),depthBuffer.setClear(1),stencilBuffer.setClear(0),enable(2929),depthBuffer.setFunc(3),setFlipSided(!1),setCullFace(1),enable(2884),setBlending(NoBlending);let equationToGL={100:32774,101:32778,102:32779};if(isWebGL2)equationToGL[103]=32775,equationToGL[104]=32776;else{let extension=extensions.get("EXT_blend_minmax");null!==extension&&(equationToGL[103]=extension.MIN_EXT,equationToGL[104]=extension.MAX_EXT)}let factorToGL={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function setBlending(blending,blendEquation,blendSrc,blendDst,blendEquationAlpha,blendSrcAlpha,blendDstAlpha,premultipliedAlpha){if(blending===NoBlending){!0===currentBlendingEnabled&&(disable(3042),currentBlendingEnabled=!1);return}if(!1===currentBlendingEnabled&&(enable(3042),currentBlendingEnabled=!0),5!==blending){if(blending!==currentBlending||premultipliedAlpha!==currentPremultipledAlpha){if((100!==currentBlendEquation||100!==currentBlendEquationAlpha)&&(gl.blendEquation(32774),currentBlendEquation=100,currentBlendEquationAlpha=100),premultipliedAlpha)switch(blending){case 1:gl.blendFuncSeparate(1,771,1,771);break;case 2:gl.blendFunc(1,1);break;case 3:gl.blendFuncSeparate(0,769,0,1);break;case 4:gl.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",blending)}else switch(blending){case 1:gl.blendFuncSeparate(770,771,1,771);break;case 2:gl.blendFunc(770,1);break;case 3:gl.blendFuncSeparate(0,769,0,1);break;case 4:gl.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",blending)}currentBlendSrc=null,currentBlendDst=null,currentBlendSrcAlpha=null,currentBlendDstAlpha=null,currentBlending=blending,currentPremultipledAlpha=premultipliedAlpha}return}blendEquationAlpha=blendEquationAlpha||blendEquation,blendSrcAlpha=blendSr
186cAlpha||blendSrc,blendDstAlpha=blendDstAlpha||blendDst,(blendEquation!==currentBlendEquation||blendEquationAlpha!==currentBlendEquationAlpha)&&(gl.blendEquationSeparate(equationToGL[blendEquation],equationToGL[blendEquationAlpha]),currentBlendEquation=blendEquation,currentBlendEquationAlpha=blendEquationAlpha),(blendSrc!==currentBlendSrc||blendDst!==currentBlendDst||blendSrcAlpha!==currentBlendSrcAlpha||blendDstAlpha!==currentBlendDstAlpha)&&(gl.blendFuncSeparate(factorToGL[blendSrc],factorToGL[blendDst],factorToGL[blendSrcAlpha],factorToGL[blendDstAlpha]),currentBlendSrc=blendSrc,currentBlendDst=blendDst,currentBlendSrcAlpha=blendSrcAlpha,currentBlendDstAlpha=blendDstAlpha),currentBlending=blending,currentPremultipledAlpha=null}function setFlipSided(flipSided){currentFlipSided!==flipSided&&(flipSided?gl.frontFace(2304):gl.frontFace(2305),currentFlipSided=flipSided)}function setCullFace(cullFace){0!==cullFace?(enable(2884),cullFace!==currentCullFace&&(1===cullFace?gl.cullFace(1029):2===cullFace?gl.cullFace(1028):gl.cullFace(1032))):disable(2884),currentCullFace=cullFace}function setPolygonOffset(polygonOffset,factor,units){polygonOffset?(enable(32823),(currentPolygonOffsetFactor!==factor||currentPolygonOffsetUnits!==units)&&(gl.polygonOffset(factor,units),currentPolygonOffsetFactor=factor,currentPolygonOffsetUnits=units)):disable(32823)}return{buffers:{color:colorBuffer,depth:depthBuffer,stencil:stencilBuffer},enable:enable,disable:disable,bindFramebuffer:function(target,framebuffer){return currentBoundFramebuffers[target]!==framebuffer&&(gl.bindFramebuffer(target,framebuffer),currentBoundFramebuffers[target]=framebuffer,isWebGL2&&(36009===target&&(currentBoundFramebuffers[36160]=framebuffer),36160===target&&(currentBoundFramebuffers[36009]=framebuffer)),!0)},drawBuffers:function(renderTarget,framebuffer){let drawBuffers=defaultDrawbuffers,needsUpdate=!1;if(renderTarget){if(void 0===(drawBuffers=currentDrawbuffers.get(framebuffer))&&(drawBuffers=[],currentDrawbuffers.set(framebuffer,drawBuffers)),renderTarget.isWebGLMultipleRenderTargets){let textures=renderTarget.texture;if(drawBuffers.length!==textures.length||36064!==drawBuffers[0]){for(let i=0,il=textures.length;i<il;i++)drawBuffers[i]=36064+i;drawBuffers.length=textures.length,needsUpdate=!0}}else 36064!==drawBuffers[0]&&(drawBuffers[0]=36064,needsUpdate=!0)}else 1029!==drawBuffers[0]&&(drawBuffers[0]=1029,needsUpdate=!0);needsUpdate&&(capabilities.isWebGL2?gl.drawBuffers(drawBuffers):extensions.get("WEBGL_draw_buffers").drawBuffersWEBGL(drawBuffers))},useProgram:function(program){return currentProgram!==program&&(gl.useProgram(program),currentProgram=program,!0)},setBlending:setBlending,setMaterial:function(material,frontFaceCW){material.side===DoubleSide?disable(2884):enable(2884);let flipSided=material.side===BackSide;frontFaceCW&&(flipSided=!flipSided),setFlipSided(flipSided),1===material.blending&&!1===material.transparent?setBlending(NoBlending):setBlending(material.blending,material.blendEquation,material.blendSrc,material.blendDst,material.blendEquationAlpha,material.blendSrcAlpha,material.blendDstAlpha,material.premultipliedAlpha),depthBuffer.setFunc(material.depthFunc),depthBuffer.setTest(material.depthTest),depthBuffer.setMask(material.depthWrite),colorBuffer.setMask(material.colorWrite);let stencilWrite=material.stencilWrite;stencilBuffer.setTest(stencilWrite),stencilWrite&&(stencilBuffer.setMask(material.stencilWriteMask),stencilBuffer.setFunc(material.stencilFunc,material.stencilRef,material.stencilFuncMask),stencilBuffer.setOp(material.stencilFail,material.stencilZFail,material.stencilZPass)),setPolygonOffset(material.polygonOffset,material.polygonOffsetFactor,material.polygonOffsetUnits),!0===material.alphaToCoverage?enable(32926):disable(32926)},setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(width){width!==currentLineWidth&&(lineWidthAvailable&&gl.lineWidth(width),currentLineWidth=width)},setPolygonOffset:setPolygonOffset,setScissorTest:function(scissorTest){scissorTest?enable(3089):disable(3089)},activeTexture:function(webglSlot){void 0===webglSlot&&(webglSlot=33984+maxTextures-1),currentTextureSlot!==webglSlot&&(gl.activeTexture(webglSlot),currentTextureSlot=webglSlot)},bindTexture:function(webglType,webglTexture,webglSlot){void 0===webglSlot&&(webglSlot=null===currentTextureSlot?33984+maxTextures-1:currentTextureSlot);let boundTexture=currentBoundTextures[webglSlot];void 0===boundTexture&&(boundTexture={type:void 0,texture:void 0},currentBoundTextures[webglSlot]=boundTexture),(boundTexture.type!==webglType||boundTexture.texture!==webglTexture)&&(currentTextureSlot!==webglSlot&&(gl.activeTexture(webglSlot),currentTextureSlot=webglSlot),gl.bindTexture(webglType,webglTexture||emptyTextures[webglType]),boundTexture.type=webglType,boundTexture.texture=webglTexture)},unbindTexture:function(){let boundTexture=currentBoundTextures[currentTextureSlot];void 0!==boundTexture&&void 0!==boundTexture.type&&(gl.bindTexture(boundTexture.type,null),boundTexture.type=void 0,boundTexture.texture=void 0)},compressedTexImage2D:function(){try{gl.compressedTexImage2D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},compressedTexImage3D:function(){try{gl.compressedTexImage3D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},texImage2D:function(){try{gl.texImage2D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},texImage3D:function(){try{gl.texImage3D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},updateUBOMapping:function(uniformsGroup,program){let mapping=uboProgamMap.get(program);void 0===mapping&&(mapping=new WeakMap,uboProgamMap.set(program,mapping));let blockIndex=mapping.get(uniformsGroup);void 0===blockIndex&&(blockIndex=gl.getUniformBlockIndex(program,uniformsGroup.name),mapping.set(uniformsGroup,blockIndex))},uniformBlockBinding:function(uniformsGroup,program){let mapping=uboProgamMap.get(program),blockIndex=mapping.get(uniformsGroup);uboBindings.get(uniformsGroup)!==blockIndex&&(gl.uniformBlockBinding(program,blockIndex,uniformsGroup.__bindingPointIndex),uboBindings.set(uniformsGroup,blockIndex))},texStorage2D:function(){try{gl.texStorage2D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},texStorage3D:function(){try{gl.texStorage3D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},texSubImage2D:function(){try{gl.texSubImage2D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},texSubImage3D:function(){try{gl.texSubImage3D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},compressedTexSubImage2D:function(){try{gl.compressedTexSubImage2D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},compressedTexSubImage3D:function(){try{gl.compressedTexSubImage3D.apply(gl,arguments)}catch(error){console.error("THREE.WebGLState:",error)}},scissor:function(scissor){!1===currentScissor.equals(scissor)&&(gl.scissor(scissor.x,scissor.y,scissor.z,scissor.w),currentScissor.copy(scissor))},viewport:function(viewport){!1===currentViewport.equals(viewport)&&(gl.viewport(viewport.x,viewport.y,viewport.z,viewport.w),currentViewport.copy(viewport))},reset:function(){gl.disable(3042),gl.disable(2884),gl.disable(2929),gl.disable(32823),gl.disable(3089),gl.disable(2960),gl.disable(32926),gl.blendEquation(32774),gl.blendFunc(1,0),gl.blendFuncSeparate(1,0,1,0),gl.colorMask(!0,!0,
vendor: 4,544 bytes, line 186
186!0,!0),gl.clearColor(0,0,0,0),gl.depthMask(!0),gl.depthFunc(513),gl.clearDepth(1),gl.stencilMask(4294967295),gl.stencilFunc(519,0,4294967295),gl.stencilOp(7680,7680,7680),gl.clearStencil(0),gl.cullFace(1029),gl.frontFace(2305),gl.polygonOffset(0,0),gl.activeTexture(33984),gl.bindFramebuffer(36160,null),!0===isWebGL2&&(gl.bindFramebuffer(36009,null),gl.bindFramebuffer(36008,null)),gl.useProgram(null),gl.lineWidth(1),gl.scissor(0,0,gl.canvas.width,gl.canvas.height),gl.viewport(0,0,gl.canvas.width,gl.canvas.height),enabledCapabilities={},currentTextureSlot=null,currentBoundTextures={},currentBoundFramebuffers={},currentDrawbuffers=new WeakMap,defaultDrawbuffers=[],currentProgram=null,currentBlendingEnabled=!1,currentBlending=null,currentBlendEquation=null,currentBlendSrc=null,currentBlendDst=null,currentBlendEquationAlpha=null,currentBlendSrcAlpha=null,currentBlendDstAlpha=null,currentPremultipledAlpha=!1,currentFlipSided=null,currentCullFace=null,currentLineWidth=null,currentPolygonOffsetFactor=null,currentPolygonOffsetUnits=null,currentScissor.set(0,0,gl.canvas.width,gl.canvas.height),currentViewport.set(0,0,gl.canvas.width,gl.canvas.height),colorBuffer.reset(),depthBuffer.reset(),stencilBuffer.reset()}}}function WebGLTextures(_gl,extensions,state,properties,capabilities,utils,info){let _canvas;let isWebGL2=capabilities.isWebGL2,maxTextures=capabilities.maxTextures,maxCubemapSize=capabilities.maxCubemapSize,maxTextureSize=capabilities.maxTextureSize,maxSamples=capabilities.maxSamples,multisampledRTTExt=extensions.has("WEBGL_multisampled_render_to_texture")?extensions.get("WEBGL_multisampled_render_to_texture"):null,supportsInvalidateFramebuffer=/OculusBrowser/g.test("undefined"==typeof navigator?"":navigator.userAgent),_videoTextures=new WeakMap,_sources=new WeakMap,useOffscreenCanvas=!1;try{useOffscreenCanvas="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(err){}function createCanvas(width,height){return useOffscreenCanvas?new OffscreenCanvas(width,height):createElementNS("canvas")}function resizeImage(image,needsPowerOfTwo,needsNewCanvas,maxSize){let scale=1;if((image.width>maxSize||image.height>maxSize)&&(scale=maxSize/Math.max(image.width,image.height)),scale<1||!0===needsPowerOfTwo){if("undefined"!=typeof HTMLImageElement&&image instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&image instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&image instanceof ImageBitmap){let floor=needsPowerOfTwo?floorPowerOfTwo:Math.floor,width=floor(scale*image.width),height=floor(scale*image.height);void 0===_canvas&&(_canvas=createCanvas(width,height));let canvas=needsNewCanvas?createCanvas(width,height):_canvas;canvas.width=width,canvas.height=height;let context=canvas.getContext("2d");return context.drawImage(image,0,0,width,height),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+image.width+"x"+image.height+") to ("+width+"x"+height+")."),canvas}"data"in image&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+image.width+"x"+image.height+").")}return image}function isPowerOfTwo$1(image){return isPowerOfTwo(image.width)&&isPowerOfTwo(image.height)}function textureNeedsGenerateMipmaps(texture,supportsMips){return texture.generateMipmaps&&supportsMips&&texture.minFilter!==NearestFilter&&texture.minFilter!==LinearFilter}function generateMipmap(target){_gl.generateMipmap(target)}function getInternalFormat(internalFormatName,glFormat,glType,encoding,forceLinearEncoding=!1){if(!1===isWebGL2)return glFormat;if(null!==internalFormatName){if(void 0!==_gl[internalFormatName])return _gl[internalFormatName];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+internalFormatName+"'")}let internalFormat=glFormat;return 6403===glFormat&&(5126===glType&&(internalFormat=33326),5131===glType&&(internalFormat=33325),5121===glType&&(internalFormat=33321)),33319===glFormat&&(5126===glType&&(internalFormat=33328),5131===glType&&(internalFormat=33327),5121===glType&&(internalFormat=33323)),6408===glFormat&&(5126===glType&&(internalFormat=34836),5131===glType&&(internalFormat=34842),5121===glType&&(internalFormat=encoding===sRGBEncoding&&!1===forceLinearEncoding?35907:32856),32819===glType&&(internalFormat=32854),32820===glType&&(internalFormat=32855)),(33325===internalFormat||33326===internalFormat||33327===internalFormat||33328===internalFormat||34842===internalFormat||34836===internalFormat)&&extensions.get("EXT_color_buffer_float"),internalFormat}
186function getMipLevels(texture,image,supportsMips){return!0===textureNeedsGenerateMipmaps(texture,supportsMips)||texture.isFramebufferTexture&&texture.minFilter!==NearestFilter&&texture.minFilter!==LinearFilter?Math.log2(Math.max(image.width,image.height))+1:void 0!==texture.mipmaps&&texture.mipmaps.length>0?texture.mipmaps.length:texture.isCompressedTexture&&Array.isArray(texture.image)?image.mipmaps.length:1}function filterFallback(f){return f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter?9728:9729}function onTextureDispose(event){let texture=event.target;texture.removeEventListener("dispose",onTextureDispose),function(texture){let textureProperties=properties.get(texture);if(void 0===textureProperties.__webglInit)return;let source=texture.source,webglTextures=_sources.get(source);if(webglTextures){let webglTexture=webglTextures[textureProperties.__cacheKey];webglTexture.usedTimes--,0===webglTexture.usedTimes&&deleteTexture(texture),0===Object.keys(webglTextures).length&&_sources.delete(source)}properties.remove(texture)}(texture),texture.isVideoTexture&&_videoTextures.delete(texture)}function onRenderTargetDispose(event){let renderTarget=event.target;renderTarget.removeEventListener("dispose",onRenderTargetDispose),function(renderTarget){let texture=renderTarget.texture,renderTargetProperties=properties.get(renderTarget),textureProperties=properties.get(texture);if(void 0!==textureProperties.__webglTexture&&(_gl.deleteTexture(textureProperties.__webglTexture),info.memory.textures--),renderTarget.depthTexture&&renderTarget.depthTexture.dispose(),renderTarget.isWebGLCubeRenderTarget)for(let i=0;i<6;i++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]),renderTargetProperties.__webglDepthbuffer&&_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);else{if(_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer),renderTargetProperties.__webglDepthbuffer&&_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer),renderTargetProperties.__webglMultisampledFramebuffer&&_gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer),renderTargetProperties.__webglColorRenderbuffer)for(let i1=0;i1<renderTargetProperties.__webglColorRenderbuffer.length;i1++)renderTargetProperties.__webglColorRenderbuffer[i1]&&_gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i1]);renderTargetProperties.__webglDepthRenderbuffer&&_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer)}if(renderTarget.isWebGLMultipleRenderTargets)for(let i2=0,il=texture.length;i2<il;i2++){let attachmentProperties=properties.get(texture[i2]);attachmentProperties.__webglTexture&&(_gl.deleteTexture(attachmentProperties.__webglTexture),info.memory.textures--),properties.remove(texture[i2])}properties.remove(texture),properties.remove(renderTarget)}(renderTarget)}function deleteTexture(texture){let textureProperties=properties.get(texture);_gl.deleteTexture(textureProperties.__webglTexture);let source=texture.source,webglTextures=_sources.get(source);delete webglTextures[textureProperties.__cacheKey],info.memory.textures--}let textureUnits=0;function setTexture2D(texture,slot){let textureProperties=properties.get(texture);if(texture.isVideoTexture&&function(texture){let frame=info.render.frame;_videoTextures.get(texture)!==frame&&(_videoTextures.set(texture,frame),texture.update())}(texture),!1===texture.isRenderTargetTexture&&texture.version>0&&textureProperties.__version!==texture.version){let image=texture.image;if(null===image)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===image.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{uploadTexture(textureProperties,texture,slot);return}}state.bindTexture(3553,textureProperties.__webglTexture,33984+slot)}let wrappingToGL={[RepeatWrapping]:10497,[ClampToEdgeWrapping]:33071,[MirroredRepeatWrapping]:33648},filterToGL={[NearestFilter]:9728,[NearestMipmapNearestFilter]:9984,[NearestMipmapLinearFilter]:9986,[LinearFilter]:9729,[LinearMipmapNearestFilter]:9985,[LinearMipmapLinearFilter]:9987};function setTextureParameters(textureType,texture,supportsMips){if(supportsMips?(_gl.texParameteri(textureType,10242,wrappingToGL[texture.wrapS]),_gl.texParameteri(textureType,10243,wrappingToGL[texture.wrapT]),(32879===textureType||35866===textureType)&&_gl.texParameteri(textureType,32882,wrappingToGL[texture.wrapR]),_gl.texParameteri(textureType,10240,filterToGL[texture.magFilter]),_gl.texParameteri(textureType,10241,filterToGL[texture.minFilter])):(_gl.texParameteri(textureType,10242,33071),_gl.texParameteri(textureType,10243,33071),(32879===textureType||35866===textureType)&&_gl.texParameteri(textureType,32882,33071),(texture.wrapS!==ClampToEdgeWrapping||texture.wrapT!==ClampToEdgeWrapping)&&
186console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),_gl.texParameteri(textureType,10240,filterFallback(texture.magFilter)),_gl.texParameteri(textureType,10241,filterFallback(texture.minFilter)),texture.minFilter!==NearestFilter&&texture.minFilter!==LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===extensions.has("EXT_texture_filter_anisotropic")){let extension=extensions.get("EXT_texture_filter_anisotropic");(texture.type!==FloatType||!1!==extensions.has("OES_texture_float_linear"))&&(!1!==isWebGL2||texture.type!==HalfFloatType||!1!==extensions.has("OES_texture_half_float_linear"))&&(texture.anisotropy>1||properties.get(texture).__currentAnisotropy)&&(_gl.texParameterf(textureType,extension.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(texture.anisotropy,capabilities.getMaxAnisotropy())),properties.get(texture).__currentAnisotropy=texture.anisotropy)}}function initTexture(textureProperties,texture){let forceUpload=!1;void 0===textureProperties.__webglInit&&(textureProperties.__webglInit=!0,texture.addEventListener("dispose",onTextureDispose));let source=texture.source,webglTextures=_sources.get(source);void 0===webglTextures&&(webglTextures={},_sources.set(source,webglTextures));let textureCacheKey=function(texture){let array=[];return array.push(texture.wrapS),array.push(texture.wrapT),array.push(texture.wrapR||0),array.push(texture.magFilter),array.push(texture.minFilter),array.push(texture.anisotropy),array.push(texture.internalFormat),array.push(texture.format),array.push(texture.type),array.push(texture.generateMipmaps),array.push(texture.premultiplyAlpha),array.push(texture.flipY),array.push(texture.unpackAlignment),array.push(texture.encoding),array.join()}(texture);if(textureCacheKey!==textureProperties.__cacheKey){void 0===webglTextures[textureCacheKey]&&(webglTextures[textureCacheKey]={texture:_gl.createTexture(),usedTimes:0},info.memory.textures++,forceUpload=!0),webglTextures[textureCacheKey].usedTimes++;let webglTexture=webglTextures[textureProperties.__cacheKey];void 0!==webglTexture&&(webglTextures[textureProperties.__cacheKey].usedTimes--,0===webglTexture.usedTimes&&deleteTexture(texture)),textureProperties.__cacheKey=textureCacheKey,textureProperties.__webglTexture=webglTextures[textureCacheKey].texture}return forceUpload}function uploadTexture(textureProperties,texture,slot){let textureType=3553;(texture.isDataArrayTexture||texture.isCompressedArrayTexture)&&(textureType=35866),texture.isData3DTexture&&(textureType=32879);let forceUpload=initTexture(textureProperties,texture),source=texture.source;state.bindTexture(textureType,textureProperties.__webglTexture,33984+slot);let sourceProperties=properties.get(source);if(source.version!==sourceProperties.__version||!0===forceUpload){let mipmap;state.activeTexture(33984+slot),_gl.pixelStorei(37440,texture.flipY),_gl.pixelStorei(37441,texture.premultiplyAlpha),_gl.pixelStorei(3317,texture.unpackAlignment),_gl.pixelStorei(37443,0);let needsPowerOfTwo=!isWebGL2&&(texture.wrapS!==ClampToEdgeWrapping||texture.wrapT!==ClampToEdgeWrapping||texture.minFilter!==NearestFilter&&texture.minFilter!==LinearFilter)&&!1===isPowerOfTwo$1(texture.image),image=resizeImage(texture.image,needsPowerOfTwo,!1,maxTextureSize);image=verifyColorSpace(texture,image);let supportsMips=isPowerOfTwo$1(image)||isWebGL2,glFormat=utils.convert(texture.format,texture.encoding),glType=utils.convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.encoding,texture.isVideoTexture);setTextureParameters(textureType,texture,supportsMips);let mipmaps=texture.mipmaps,useTexStorage=isWebGL2&&!0!==texture.isVideoTexture,allocateMemory=void 0===sourceProperties.__version||!0===forceUpload,levels=getMipLevels(texture,image,supportsMips);if(texture.isDepthTexture)glInternalFormat=6402,isWebGL2?glInternalFormat=texture.type===FloatType?36012:1014===texture.type?33190:1020===texture.type?35056:33189:texture.type===FloatType&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===texture.format&&6402===glInternalFormat&&1012!==texture.type&&1014!==texture.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),texture.type=1014,glType=utils.convert(texture.type)),1027===texture.format&&6402===glInternalFormat&&(glInternalFormat=34041,1020!==texture.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),texture.type=1020,glType=utils.convert(texture.type))),allocateMemory&&(useTexStorage?state.texStorage2D(3553,1,glInternalFormat,image.width,image.height):state.texImage2D(3553,0,glInternalFormat,image.width,image.height,0,glFormat,glType,null));else if(texture.isDataTexture){if(mipmaps.length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(3553,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i=0,il=mipmaps.length;i<il;i++)mipmap=mipmaps[i],useTexStorage?state.texSubImage2D(3553,i,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data):state.texImage2D(3553,i,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data);texture.generateMipmaps=!1}else useTexStorage?(allocateMemory&&state.texStorage2D(3553,levels,glInternalFormat,image.width,image.height),state.texSubImage2D(3553,0,0,0,image.width,image.height,glFormat,glType,image.data)):state.texImage2D(3553,0,glInternalFormat,image.width,image.height,0,glFormat,glType,image.data)}else if(texture.isCompressedTexture){if(texture.isCompressedArrayTexture){useTexStorage&&allocateMemory&&state.texStorage3D(35866,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height,image.depth);for(let i1=0,il1=mipmaps.length;i1<il1;i1++)mipmap=mipmaps[i1],texture.format!==RGBAFormat?null!==glFormat?useTexStorage?state.compressedTexSubImage3D(35866,i1,0,0,0,mipmap.width,mipmap.height,image.depth,glFormat,mipmap.data,0,0):state.compressedTexImage3D(35866,i1,glInternalFormat,mipmap.width,mipmap.height,image.depth,0,mipmap.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):useTexStorage?state.texSubImage3D(35866,i1,0,0,0,mipmap.width,mipmap.height,image.depth,glFormat,glType,mipmap.data):state.texImage3D(35866,i1,glInternalFormat,mipmap.width,mipmap.height,image.depth,0,glFormat,glType,mipmap.data)}else{useTexStorage&&allocateMemory&&state.texStorage2D(3553,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i2=0,il2=mipmaps.length;i2<il2;i2++)mipmap=mipmaps[i2],texture.format!==RGBAFormat?null!==glFormat?useTexStorage?state.compressedTexSubImage2D(3553,i2,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data):state.compressedTexImage2D(3553,i2,glInternalFormat,mipmap.width,mipmap.height,0,mipmap.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):useTexStorage?state.texSubImage2D(3553,i2,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data):state.texImage2D(3553,i2,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data)}}else if(texture.isDataArrayTexture)useTexStorage?(allocateMemory&&state.texStorage3D(35866,levels,glInternalFormat,image.width,image.height,image.depth),state.texSubImage3D(35866,0,0,0,0,image.width,image.height,image.depth,glFormat,glType,image.data)):state.texImage3D(35866,0,glInternalFormat,image.width,image.height,image.depth,0,glFormat,glType,image.data);else if(texture.isData3DTexture)useTexStorage?(allocateMemory&&state.texStorage3D(32879,levels,glInternalFormat,image.width,image.height,image.depth),state.texSubImage3D(32879,0,0,0,0,image.width,image.height,image.depth,glFormat,glType,image.data)):state.texImage3D(32879,0,glInternalFormat,image.width,image.height,image.depth,0,glFormat,glType,image.data);
186else if(texture.isFramebufferTexture){if(allocateMemory){if(useTexStorage)state.texStorage2D(3553,levels,glInternalFormat,image.width,image.height);else{let width=image.width,height=image.height;for(let i3=0;i3<levels;i3++)state.texImage2D(3553,i3,glInternalFormat,width,height,0,glFormat,glType,null),width>>=1,height>>=1}}}else if(mipmaps.length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(3553,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i4=0,il3=mipmaps.length;i4<il3;i4++)mipmap=mipmaps[i4],useTexStorage?state.texSubImage2D(3553,i4,0,0,glFormat,glType,mipmap):state.texImage2D(3553,i4,glInternalFormat,glFormat,glType,mipmap);texture.generateMipmaps=!1}else useTexStorage?(allocateMemory&&state.texStorage2D(3553,levels,glInternalFormat,image.width,image.height),state.texSubImage2D(3553,0,0,0,glFormat,glType,image)):state.texImage2D(3553,0,glInternalFormat,glFormat,glType,image);textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap(textureType),sourceProperties.__version=source.version,texture.onUpdate&&texture.onUpdate(texture)}textureProperties.__version=texture.version}function setupFrameBufferTexture(framebuffer,renderTarget,texture,attachment,textureTarget){let glFormat=utils.convert(texture.format,texture.encoding),glType=utils.convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.encoding),renderTargetProperties=properties.get(renderTarget);renderTargetProperties.__hasExternalTextures||(32879===textureTarget||35866===textureTarget?state.texImage3D(textureTarget,0,glInternalFormat,renderTarget.width,renderTarget.height,renderTarget.depth,0,glFormat,glType,null):state.texImage2D(textureTarget,0,glInternalFormat,renderTarget.width,renderTarget.height,0,glFormat,glType,null)),state.bindFramebuffer(36160,framebuffer),useMultisampledRTT(renderTarget)?multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160,attachment,textureTarget,properties.get(texture).__webglTexture,0,getRenderTargetSamples(renderTarget)):(3553===textureTarget||textureTarget>=34069&&textureTarget<=34074)&&_gl.framebufferTexture2D(36160,attachment,textureTarget,properties.get(texture).__webglTexture,0),state.bindFramebuffer(36160,null)}function setupRenderBufferStorage(renderbuffer,renderTarget,isMultisample){if(_gl.bindRenderbuffer(36161,renderbuffer),renderTarget.depthBuffer&&!renderTarget.stencilBuffer){let glInternalFormat=33189;if(isMultisample||useMultisampledRTT(renderTarget)){let depthTexture=renderTarget.depthTexture;depthTexture&&depthTexture.isDepthTexture&&(depthTexture.type===FloatType?glInternalFormat=36012:1014===depthTexture.type&&(glInternalFormat=33190));let samples=getRenderTargetSamples(renderTarget);useMultisampledRTT(renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT(36161,samples,glInternalFormat,renderTarget.width,renderTarget.height):_gl.renderbufferStorageMultisample(36161,samples,glInternalFormat,renderTarget.width,renderTarget.height)}else _gl.renderbufferStorage(36161,glInternalFormat,renderTarget.width,renderTarget.height);_gl.framebufferRenderbuffer(36160,36096,36161,renderbuffer)}else if(renderTarget.depthBuffer&&renderTarget.stencilBuffer){let samples1=getRenderTargetSamples(renderTarget);isMultisample&&!1===useMultisampledRTT(renderTarget)?_gl.renderbufferStorageMultisample(36161,samples1,35056,renderTarget.width,renderTarget.height):useMultisampledRTT(renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT(36161,samples1,35056,renderTarget.width,renderTarget.height):_gl.renderbufferStorage(36161,34041,renderTarget.width,renderTarget.height),_gl.framebufferRenderbuffer(36160,33306,36161,renderbuffer)}else{let textures=!0===renderTarget.isWebGLMultipleRenderTargets?renderTarget.texture:[renderTarget.texture];for(let i=0;i<textures.length;i++){let texture=textures[i],glFormat=utils.convert(texture.format,texture.encoding),glType=utils.convert(texture.type),glInternalFormat1=getInternalFormat(texture.internalFormat,glFormat,glType,texture.encoding),samples2=getRenderTargetSamples(renderTarget);isMultisample&&!1===useMultisampledRTT(renderTarget)?_gl.renderbufferStorageMultisample(36161,samples2,glInternalFormat1,renderTarget.width,renderTarget.height):useMultisampledRTT(renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT(36161,samples2,glInternalFormat1,renderTarget.width,renderTarget.height):_gl.renderbufferStorage(36161,glInternalFormat1,renderTarget.width,renderTarget.height)}}_gl.bindRenderbuffer(36161,null)}function setupDepthRenderbuffer(renderTarget){let renderTargetProperties=properties.get(renderTarget),isCube=!0===renderTarget.isWebGLCubeRen
186derTarget;if(renderTarget.depthTexture&&!renderTargetProperties.__autoAllocateDepthBuffer){if(isCube)throw Error("target.depthTexture not supported in Cube render targets");!function(framebuffer,renderTarget){let isCube=renderTarget&&renderTarget.isWebGLCubeRenderTarget;if(isCube)throw Error("Depth Texture with cube render targets is not supported");if(state.bindFramebuffer(36160,framebuffer),!(renderTarget.depthTexture&&renderTarget.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");properties.get(renderTarget.depthTexture).__webglTexture&&renderTarget.depthTexture.image.width===renderTarget.width&&renderTarget.depthTexture.image.height===renderTarget.height||(renderTarget.depthTexture.image.width=renderTarget.width,renderTarget.depthTexture.image.height=renderTarget.height,renderTarget.depthTexture.needsUpdate=!0),setTexture2D(renderTarget.depthTexture,0);let webglDepthTexture=properties.get(renderTarget.depthTexture).__webglTexture,samples=getRenderTargetSamples(renderTarget);if(1026===renderTarget.depthTexture.format)useMultisampledRTT(renderTarget)?multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160,36096,3553,webglDepthTexture,0,samples):_gl.framebufferTexture2D(36160,36096,3553,webglDepthTexture,0);else if(1027===renderTarget.depthTexture.format)useMultisampledRTT(renderTarget)?multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160,33306,3553,webglDepthTexture,0,samples):_gl.framebufferTexture2D(36160,33306,3553,webglDepthTexture,0);else throw Error("Unknown depthTexture format")}(renderTargetProperties.__webglFramebuffer,renderTarget)}else if(isCube){renderTargetProperties.__webglDepthbuffer=[];for(let i=0;i<6;i++)state.bindFramebuffer(36160,renderTargetProperties.__webglFramebuffer[i]),renderTargetProperties.__webglDepthbuffer[i]=_gl.createRenderbuffer(),setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i],renderTarget,!1)}else state.bindFramebuffer(36160,renderTargetProperties.__webglFramebuffer),renderTargetProperties.__webglDepthbuffer=_gl.createRenderbuffer(),setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer,renderTarget,!1);state.bindFramebuffer(36160,null)}function getRenderTargetSamples(renderTarget){return Math.min(maxSamples,renderTarget.samples)}function useMultisampledRTT(renderTarget){let renderTargetProperties=properties.get(renderTarget);return isWebGL2&&renderTarget.samples>0&&!0===extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==renderTargetProperties.__useRenderToTexture}function verifyColorSpace(texture,image){let encoding=texture.encoding,format=texture.format,type=texture.type;return!0===texture.isCompressedTexture||!0===texture.isVideoTexture||1035===texture.format||encoding!==LinearEncoding&&(encoding===sRGBEncoding?!1===isWebGL2?!0===extensions.has("EXT_sRGB")&&format===RGBAFormat?(texture.format=1035,texture.minFilter=LinearFilter,texture.generateMipmaps=!1):image=ImageUtils.sRGBToLinear(image):(format!==RGBAFormat||type!==UnsignedByteType)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",encoding)),image}this.allocateTextureUnit=function(){let textureUnit=textureUnits;return textureUnit>=maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+textureUnit+" texture units while this GPU supports only "+maxTextures),textureUnits+=1,textureUnit},this.resetTextureUnits=function(){textureUnits=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(texture,slot){let textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadTexture(textureProperties,texture,slot);return}state.bindTexture(35866,textureProperties.__webglTexture,33984+slot)},this.setTexture3D=function(texture,slot){let textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadTexture(textureProperties,texture,slot);return}state.bindTexture(32879,textureProperties.__webglTexture,33984+slot)},this.setTextureCube=function(texture,slot){let textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){(function(textureProperties,texture,slot){if(6!==texture.image.length)return;let forceUpload=initTexture(textureProperties,texture),source=texture.source;state.bindTexture(34067,textureProperties.__webglTexture,33984+slot);let sourceProperties=properties.get(source);if(source.version!==sourceProperties.__version||!0===forceUpload){let mipmaps;state.activeTexture(33984+slot),_gl.pixelStorei(37440,texture.flipY),_gl.pixelStorei(37441,texture.premultiplyAlpha),_gl.pixelStorei(3317,texture.unpackAlignment),_gl.pixelStorei(37443,0);let isCompressed=texture.isCompressedTexture||texture.image[0].isCompressedTexture,isDataTexture=texture.image[0]&&texture.image[0].isDataTexture,cubeImage=[];for(let i=0;i<6;i++)isCompressed||isDataTexture?cubeImage[i]=isDataTexture?texture.image[i].image:texture.image[i]:cubeImage[i]=resizeImage(texture.image[i],!1,!0,maxCubemapSize),cubeImage[i]=verifyColorSpace(texture,cubeImage[i]);let image=cubeImage[0],supportsMips=isPowerOfTwo$1(image)||isWebG
vendor: 8,706 bytes, line 186
186L2,glFormat=utils.convert(texture.format,texture.encoding),glType=utils.convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.encoding),useTexStorage=isWebGL2&&!0!==texture.isVideoTexture,allocateMemory=void 0===sourceProperties.__version||!0===forceUpload,levels=getMipLevels(texture,image,supportsMips);if(setTextureParameters(34067,texture,supportsMips),isCompressed){useTexStorage&&allocateMemory&&state.texStorage2D(34067,levels,glInternalFormat,image.width,image.height);for(let i1=0;i1<6;i1++){mipmaps=cubeImage[i1].mipmaps;for(let j=0;j<mipmaps.length;j++){let mipmap=mipmaps[j];texture.format!==RGBAFormat?null!==glFormat?useTexStorage?state.compressedTexSubImage2D(34069+i1,j,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data):state.compressedTexImage2D(34069+i1,j,glInternalFormat,mipmap.width,mipmap.height,0,mipmap.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):useTexStorage?state.texSubImage2D(34069+i1,j,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data):state.texImage2D(34069+i1,j,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data)}}}else{mipmaps=texture.mipmaps,useTexStorage&&allocateMemory&&(mipmaps.length>0&&levels++,state.texStorage2D(34067,levels,glInternalFormat,cubeImage[0].width,cubeImage[0].height));for(let i2=0;i2<6;i2++)if(isDataTexture){useTexStorage?state.texSubImage2D(34069+i2,0,0,0,cubeImage[i2].width,cubeImage[i2].height,glFormat,glType,cubeImage[i2].data):state.texImage2D(34069+i2,0,glInternalFormat,cubeImage[i2].width,cubeImage[i2].height,0,glFormat,glType,cubeImage[i2].data);for(let j1=0;j1<mipmaps.length;j1++){let mipmap1=mipmaps[j1],mipmapImage=mipmap1.image[i2].image;useTexStorage?state.texSubImage2D(34069+i2,j1+1,0,0,mipmapImage.width,mipmapImage.height,glFormat,glType,mipmapImage.data):state.texImage2D(34069+i2,j1+1,glInternalFormat,mipmapImage.width,mipmapImage.height,0,glFormat,glType,mipmapImage.data)}}else{useTexStorage?state.texSubImage2D(34069+i2,0,0,0,glFormat,glType,cubeImage[i2]):state.texImage2D(34069+i2,0,glInternalFormat,glFormat,glType,cubeImage[i2]);for(let j2=0;j2<mipmaps.length;j2++){let mipmap2=mipmaps[j2];useTexStorage?state.texSubImage2D(34069+i2,j2+1,0,0,glFormat,glType,mipmap2.image[i2]):state.texImage2D(34069+i2,j2+1,glInternalFormat,glFormat,glType,mipmap2.image[i2])}}}textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap(34067),sourceProperties.__version=source.version,texture.onUpdate&&texture.onUpdate(texture)}textureProperties.__version=texture.version})(textureProperties,texture,slot);return}state.bindTexture(34067,textureProperties.__webglTexture,33984+slot)},this.rebindTextures=function(renderTarget,colorTexture,depthTexture){let renderTargetProperties=properties.get(renderTarget);void 0!==colorTexture&&setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,renderTarget.texture,36064,3553),void 0!==depthTexture&&setupDepthRenderbuffer(renderTarget)},this.setupRenderTarget=function(renderTarget){let texture=renderTarget.texture,renderTargetProperties=properties.get(renderTarget),textureProperties=properties.get(texture);renderTarget.addEventListener("dispose",onRenderTargetDispose),!0!==renderTarget.isWebGLMultipleRenderTargets&&(void 0===textureProperties.__webglTexture&&(textureProperties.__webglTexture=_gl.createTexture()),textureProperties.__version=texture.version,info.memory.textures++);let isCube=!0===renderTarget.isWebGLCubeRenderTarget,isMultipleRenderTargets=!0===renderTarget.isWebGLMultipleRenderTargets,supportsMips=isPowerOfTwo$1(renderTarget)||isWebGL2;if(isCube){renderTargetProperties.__webglFramebuffer=[];for(let i=0;i<6;i++)renderTargetProperties.__webglFramebuffer[i]=_gl.createFramebuffer()}else{if(renderTargetProperties.__webglFramebuffer=_gl.createFramebuffer(),isMultipleRenderTargets){if(capabilities.drawBuffers){let textures=renderTarget.texture;for(let i1=0,il=textures.length;i1<il;i1++){let attachmentProperties=properties.get(textures[i1]);void 0===attachmentProperties.__webglTexture&&(attachmentProperties.__webglTexture=_gl.createTexture(),info.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.")}if(isWebGL2&&renderTarget.samples>0&&!1===useMultisampledRTT(renderTarget)){let textures1=isMultipleRenderTargets?texture:[texture];renderTargetProperties.__webglMultisampledFramebuffer=_gl.createFramebuffer(),renderTargetProperties.__webglColorRenderbuffer=[],state.bindFramebuffer(36160,renderTargetProperties.__webglMultisampledFramebuffer);for(let i2=0;i2<textures1.length;i2++){let texture1=textures1[i2];renderTargetProperties.__webglColorRenderbuffer[i2]=_gl.createRenderbuffer(),_gl.bindRenderbuffer(36161,renderTargetProperties.__webglColorRenderbuffer[i2]);let glFormat=utils.convert(texture1.format,texture1.encoding),glType=utils.convert(texture1.type),glInternalFormat=getInternalFormat(texture1.internalFormat,glFormat,glType,texture1.encoding,!0===renderTarget.isXRRenderTarget),samples=getRenderTargetSamples(renderTarget);_gl.renderbufferStorageMultisample(36161,samples,glInternalFormat,renderTarget.width,renderTarget.height),_gl.framebufferRenderbuffer(36160,36064+i2,36161,renderTargetProperties.__webglColorRenderbuffer[i2])}_gl.bindRenderbuffer(36161,null),renderTarget.depthBuffer&&(renderTargetProperties.__webglDepthRenderbuffer=_gl.createRenderbuffer(),setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer,renderTarget,!0)),state.bindFramebuffer(36160,null)}}if(isCube){state.bindTexture(34067,textureProperties.__webglTexture),setTextureParameters(34067,texture,supportsMips);for(let i3=0;i3<6;i3++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i3],renderTarget,texture,36064,34069+i3);textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap(34067),state.unbindTexture()}else if(isMultipleRenderTargets){let textures2=renderTarget.texture;for(let i4=0,il1=textures2.length;i4<il1;i4++){let attachment=textures2[i4],attachmentProperties1=properties.get(attachment);state.bindTexture(3553,attachmentProperties1.__webglTexture),setTextureParameters(3553,attachment,supportsMips),setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,attachment,36064+i4,3553),textureNeedsGenerateMipmaps(attachment,supportsMips)&&generateMipmap(3553)}state.unbindTexture()}else{let glTextureType=3553;(renderTarget.isWebGL3DRenderTarget||renderTarget.isWebGLArrayRenderTarget)&&(isWebGL2?glTextureType=renderTarget.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),state.bindTexture(glTextureType,textureProperties.__webglTexture),setTextureParameters(glTextureType,texture,supportsMips),setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,texture,36064,glTextureType),textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap(glTextureType),state.unbindTexture()}renderTarget.depthBuffer&&setupDepthRenderbuffer(renderTarget)},this.updateRenderTargetMipmap=function(renderTarget){let supportsMips=isPowerOfTwo$1(renderTarget)||isWebGL2,textures=!0===renderTarget.isWebGLMultipleRenderTargets?renderTarget.texture:[renderTarget.texture];for(let i=0,il=textures.length;i<il;i++){let texture=textures[i];if(textureNeedsGenerateMipmaps(texture,supportsMips)){let target=renderTarget.isWebGLCubeRenderTarget?34067:3553,webglTexture=properties.get(texture).__webglTexture;state.bindTexture(target,webglTexture),generateMipmap(target),state.unbindTexture()}}},this.updateMultisampleRenderTarget=function(renderTarget){if(isWebGL2&&renderTarget.samples>0&&!1===useMultisampledRTT(renderTarget)){let textures=renderTarget.isWebGLMultipleRenderTargets?renderTarget.texture:[renderTarget.texture],width=renderTarget.width,height=renderTarget.height,mask=16384,invalidationArray=[],depthStyle=renderTarget.stencilBuffer?33306:36096,renderTargetProperties=properties.get(renderTarget),isMultipleRenderTargets=!0===renderTarget.isWebGLMultipleRenderTargets;if(isMultipleRenderTargets)for(let i=0;i<textures.length;i++)state.bindFramebuffer(36160,renderTargetProperties.__webglMultisampledFramebuffer),_gl.framebufferRenderbuffer(36160,36064+i,36161,null),state.bindFramebuffer(36160,renderTargetProperties.__webglFramebuffer),_gl.framebufferTexture2D(36009,36064+i,3553,null,0);state.bindFramebuffer(36008,renderTargetProperties.__webglMultisampledFramebuffer),state.bindFramebuffer(36009,renderTargetProperties.__webglFramebuffer);for(let i1=0;i1<textures.length;
186i1++){invalidationArray.push(36064+i1),renderTarget.depthBuffer&&invalidationArray.push(depthStyle);let ignoreDepthValues=void 0!==renderTargetProperties.__ignoreDepthValues&&renderTargetProperties.__ignoreDepthValues;if(!1===ignoreDepthValues&&(renderTarget.depthBuffer&&(mask|=256),renderTarget.stencilBuffer&&(mask|=1024)),isMultipleRenderTargets&&_gl.framebufferRenderbuffer(36008,36064,36161,renderTargetProperties.__webglColorRenderbuffer[i1]),!0===ignoreDepthValues&&(_gl.invalidateFramebuffer(36008,[depthStyle]),_gl.invalidateFramebuffer(36009,[depthStyle])),isMultipleRenderTargets){let webglTexture=properties.get(textures[i1]).__webglTexture;_gl.framebufferTexture2D(36009,36064,3553,webglTexture,0)}_gl.blitFramebuffer(0,0,width,height,0,0,width,height,mask,9728),supportsInvalidateFramebuffer&&_gl.invalidateFramebuffer(36008,invalidationArray)}if(state.bindFramebuffer(36008,null),state.bindFramebuffer(36009,null),isMultipleRenderTargets)for(let i2=0;i2<textures.length;i2++){state.bindFramebuffer(36160,renderTargetProperties.__webglMultisampledFramebuffer),_gl.framebufferRenderbuffer(36160,36064+i2,36161,renderTargetProperties.__webglColorRenderbuffer[i2]);let webglTexture1=properties.get(textures[i2]).__webglTexture;state.bindFramebuffer(36160,renderTargetProperties.__webglFramebuffer),_gl.framebufferTexture2D(36009,36064+i2,3553,webglTexture1,0)}state.bindFramebuffer(36009,renderTargetProperties.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(gl,extensions,capabilities){let isWebGL2=capabilities.isWebGL2;return{convert:function(p,encoding=null){let extension;if(p===UnsignedByteType)return 5121;if(1017===p)return 32819;if(1018===p)return 32820;if(1010===p)return 5120;if(1011===p)return 5122;if(1012===p)return 5123;if(1013===p)return 5124;if(1014===p)return 5125;if(p===FloatType)return 5126;if(p===HalfFloatType)return isWebGL2?5131:null!==(extension=extensions.get("OES_texture_half_float"))?extension.HALF_FLOAT_OES:null;if(1021===p)return 6406;if(p===RGBAFormat)return 6408;if(1024===p)return 6409;if(1025===p)return 6410;if(1026===p)return 6402;if(1027===p)return 34041;if(p===RedFormat)return 6403;if(1022===p)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(1035===p)return null!==(extension=extensions.get("EXT_sRGB"))?extension.SRGB_ALPHA_EXT:null;if(1029===p)return 36244;if(p===RGFormat)return 33319;if(1031===p)return 33320;if(1033===p)return 36249;if(p===RGB_S3TC_DXT1_Format||33777===p||33778===p||p===RGBA_S3TC_DXT5_Format){if(encoding===sRGBEncoding){if(null===(extension=extensions.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(p===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===p)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===p)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(p===RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(extension=extensions.get("WEBGL_compressed_texture_s3tc")))return null;if(p===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===p)return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===p)return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p===RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(p===RGB_PVRTC_4BPPV1_Format||35841===p||p===RGBA_PVRTC_4BPPV1_Format||35843===p){if(null===(extension=extensions.get("WEBGL_compressed_texture_pvrtc")))return null;if(p===RGB_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===p)return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(p===RGBA_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===p)return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(p===RGB_ETC1_Format)return null!==(extension=extensions.get("WEBGL_compressed_texture_etc1"))?extension.COMPRESSED_RGB_ETC1_WEBGL:null;if(p===RGB_ETC2_Format||p===RGBA_ETC2_EAC_Format){if(null===(extension=extensions.get("WEBGL_compressed_texture_etc")))return null;if(p===RGB_ETC2_Format)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ETC2:extension.COMPRESSED_RGB8_ETC2;if(p===RGBA_ETC2_EAC_Format)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:extension.COMPRESSED_RGBA8_ETC2_EAC}if(p===RGBA_ASTC_4x4_Format||37809===p||37810===p||37811===p||37812===p||37813===p||37814===p||37815===p||37816===
186p||37817===p||37818===p||37819===p||37820===p||37821===p){if(null===(extension=extensions.get("WEBGL_compressed_texture_astc")))return null;if(p===RGBA_ASTC_4x4_Format)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:extension.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:extension.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:extension.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:extension.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:extension.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:extension.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:extension.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:extension.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:extension.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:extension.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:extension.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:extension.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:extension.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===p)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:extension.COMPRESSED_RGBA_ASTC_12x12_KHR}if(p===RGBA_BPTC_Format){if(null===(extension=extensions.get("EXT_texture_compression_bptc")))return null;if(p===RGBA_BPTC_Format)return encoding===sRGBEncoding?extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:extension.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===p?isWebGL2?34042:null!==(extension=extensions.get("WEBGL_depth_texture"))?extension.UNSIGNED_INT_24_8_WEBGL:null:void 0!==gl[p]?gl[p]:null}}}class ArrayCamera extends PerspectiveCamera{constructor(array=[]){super(),this.isArrayCamera=!0,this.cameras=array}}class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}}let _moveEvent={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(event){return null!==this._targetRay&&this._targetRay.dispatchEvent(event),null!==this._grip&&this._grip.dispatchEvent(event),null!==this._hand&&this._hand.dispatchEvent(event),this}disconnect(inputSource){return this.dispatchEvent({type:"disconnected",data:inputSource}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(inputSource,frame,referenceSpace){let inputPose=null,gripPose=null,handPose=null,targetRay=this._targetRay,grip=this._grip,hand=this._hand;if(inputSource&&"visible-blurred"!==frame.session.visibilityState){if(hand&&inputSource.hand){for(let inputjoint of(handPose=!0,inputSource.hand.values())
186){let jointPose=frame.getJointPose(inputjoint,referenceSpace);if(void 0===hand.joints[inputjoint.jointName]){let joint=new Group;joint.matrixAutoUpdate=!1,joint.visible=!1,hand.joints[inputjoint.jointName]=joint,hand.add(joint)}let joint1=hand.joints[inputjoint.jointName];null!==jointPose&&(joint1.matrix.fromArray(jointPose.transform.matrix),joint1.matrix.decompose(joint1.position,joint1.rotation,joint1.scale),joint1.jointRadius=jointPose.radius),joint1.visible=null!==jointPose}let indexTip=hand.joints["index-finger-tip"],thumbTip=hand.joints["thumb-tip"],distance=indexTip.position.distanceTo(thumbTip.position);hand.inputState.pinching&&distance>.025?(hand.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:inputSource.handedness,target:this})):!hand.inputState.pinching&&distance<=.015&&(hand.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:inputSource.handedness,target:this}))}else null!==grip&&inputSource.gripSpace&&null!==(gripPose=frame.getPose(inputSource.gripSpace,referenceSpace))&&(grip.matrix.fromArray(gripPose.transform.matrix),grip.matrix.decompose(grip.position,grip.rotation,grip.scale),gripPose.linearVelocity?(grip.hasLinearVelocity=!0,grip.linearVelocity.copy(gripPose.linearVelocity)):grip.hasLinearVelocity=!1,gripPose.angularVelocity?(grip.hasAngularVelocity=!0,grip.angularVelocity.copy(gripPose.angularVelocity)):grip.hasAngularVelocity=!1);null!==targetRay&&(null===(inputPose=frame.getPose(inputSource.targetRaySpace,referenceSpace))&&null!==gripPose&&(inputPose=gripPose),null!==inputPose&&(targetRay.matrix.fromArray(inputPose.transform.matrix),targetRay.matrix.decompose(targetRay.position,targetRay.rotation,targetRay.scale),inputPose.linearVelocity?(targetRay.hasLinearVelocity=!0,targetRay.linearVelocity.copy(inputPose.linearVelocity)):targetRay.hasLinearVelocity=!1,inputPose.angularVelocity?(targetRay.hasAngularVelocity=!0,targetRay.angularVelocity.copy(inputPose.angularVelocity)):targetRay.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return null!==targetRay&&(targetRay.visible=null!==inputPose),null!==grip&&(grip.visible=null!==gripPose),null!==hand&&(hand.visible=null!==handPose),this}}class DepthTexture extends Texture{constructor(width,height,type,mapping,wrapS,wrapT,magFilter,minFilter,anisotropy,format){if(1026!==(format=void 0!==format?format:1026)&&1027!==format)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===type&&1026===format&&(type=1014),void 0===type&&1027===format&&(type=1020),super(null,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy),this.isDepthTexture=!0,this.image={width:width,height:height},this.magFilter=void 0!==magFilter?magFilter:NearestFilter,this.minFilter=void 0!==minFilter?minFilter:NearestFilter,this.flipY=!1,this.generateMipmaps=!1}}class WebXRManager extends EventDispatcher{constructor(renderer,gl){super();let scope=this,session=null,framebufferScaleFactor=1,referenceSpace=null,referenceSpaceType="local-floor",customReferenceSpace=null,pose=null,glBinding=null,glProjLayer=null,glBaseLayer=null,xrFrame=null,attributes=gl.getContextAttributes(),initialRenderTarget=null,newRenderTarget=null,controllers=[],controllerInputSources=[],cameraL=new PerspectiveCamera;cameraL.layers.enable(1),cameraL.viewport=new Vector4;let cameraR=new PerspectiveCamera;cameraR.layers.enable(2),cameraR.viewport=new Vector4;let cameras=[cameraL,cameraR],cameraVR=new ArrayCamera;cameraVR.layers.enable(1),cameraVR.layers.enable(2);let _currentDepthNear=null,_currentDepthFar=null;function onSessionEvent(event){let controllerIndex=controllerInputSources.indexOf(event.inputSource);if(-1===controllerIndex)return;let controller=controllers[controllerIndex];void 0!==controller&&controller.dispatchEvent({type:event.type,data:event.inputSource})}function onSessionEnd(){session.removeEventListener("select",onSessionEvent),session.removeEventListener("selectstart",onSessionEvent),session.removeEventListener("selectend",onSessionEvent),session.removeEventListener("squeeze",onSessionEvent),session.removeEventListener("squeezestart",onSessionEvent),session.removeEventListener("squeezeend",onSessionEvent),session.removeEventListener("end",onSessionEnd),session.removeEventListener("inputsourceschange",onInputSourcesChange);for(let i=0;i<controllers.length;i++){let inputSource=controllerInputSources[i];null!==inputSource&&(controllerInputSources[i]=null,controllers[i].disconnect(inputSource))}_currentDepthNear=null,_currentDepthFar=null,renderer.setRenderTarget(initialRenderTarget),glBaseLayer=null,glProjLayer=null,glBinding=null,session=null,newRenderTarget=null,animation.stop(),scope.isPresenting=!1,scope.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(event){for(let i=0;i<event.removed.length;i++){let inputSource=event.removed[i],index=controllerInputSources.indexOf(inputSource);index>=0&&(controllerInputSources[index]=null,controllers[index].dispatchEvent({type:"disconnected",data:inputSource}))}for(let i1=0;i1<event.added.length;i1++){let inputSource1=event.added[i1],controllerIndex=controllerInputSources.indexOf(inputSource1);if(-1===controllerIndex){for(let i2=0;i2<controllers.length;i2++){if(i2>=controllerInputSources.length){controllerInputSources.push(inputSource1),controllerIndex=i2;break}if(null===controllerInputSources[i2]){controllerInputSources[i2]=inputSource1,controllerIndex=i2;break}}if(-1===controllerIndex)break}let controller=controllers[controllerIndex];controller&&controller.dispatchEvent({type:"connected",data:inputSource1})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(index){let controller=controllers[index];return void 0===controller&&(controller=new WebXRController,controllers[index]=controller),controller.getTargetRaySpace()},this.getControllerGrip=function(index){let controller=controllers[index];return void 0===controller&&(controller=new WebXRController,controllers[index]=controller),controller.getGripSpace()},this.getHand=function(index){let controller=controllers[index];return void 0===controller&&(controller=new WebXRController,controllers[index]=controller),controller.getHandSpace()},this.setFramebufferScaleFactor=function(value){framebufferScaleFactor=value,!0===scope.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(value){referenceSpaceType=value,!0===scope.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return customReferenceSpace||referenceSpace},this.setReferenceSpace=function(space){customReferenceSpace=space},this.getBaseLayer=function(){return null!==glProjLayer?glProjLayer:glBaseLayer},this.getBinding=function(){return glBinding},this.getFrame=function(){return xrFrame}
186,this.getSession=function(){return session},this.setSession=async function(value){if(null!==(session=value)){if(initialRenderTarget=renderer.getRenderTarget(),session.addEventListener("select",onSessionEvent),session.addEventListener("selectstart",onSessionEvent),session.addEventListener("selectend",onSessionEvent),session.addEventListener("squeeze",onSessionEvent),session.addEventListener("squeezestart",onSessionEvent),session.addEventListener("squeezeend",onSessionEvent),session.addEventListener("end",onSessionEnd),session.addEventListener("inputsourceschange",onInputSourcesChange),!0!==attributes.xrCompatible&&await gl.makeXRCompatible(),void 0===session.renderState.layers||!1===renderer.capabilities.isWebGL2){let layerInit={antialias:void 0!==session.renderState.layers||attributes.antialias,alpha:attributes.alpha,depth:attributes.depth,stencil:attributes.stencil,framebufferScaleFactor:framebufferScaleFactor};glBaseLayer=new XRWebGLLayer(session,gl,layerInit),session.updateRenderState({baseLayer:glBaseLayer}),newRenderTarget=new WebGLRenderTarget(glBaseLayer.framebufferWidth,glBaseLayer.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,encoding:renderer.outputEncoding,stencilBuffer:attributes.stencil})}else{let depthFormat=null,depthType=null,glDepthFormat=null;attributes.depth&&(glDepthFormat=attributes.stencil?35056:33190,depthFormat=attributes.stencil?1027:1026,depthType=attributes.stencil?1020:1014);let projectionlayerInit={colorFormat:32856,depthFormat:glDepthFormat,scaleFactor:framebufferScaleFactor};glProjLayer=(glBinding=new XRWebGLBinding(session,gl)).createProjectionLayer(projectionlayerInit),session.updateRenderState({layers:[glProjLayer]}),newRenderTarget=new WebGLRenderTarget(glProjLayer.textureWidth,glProjLayer.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(glProjLayer.textureWidth,glProjLayer.textureHeight,depthType,void 0,void 0,void 0,void 0,void 0,void 0,depthFormat),stencilBuffer:attributes.stencil,encoding:renderer.outputEncoding,samples:attributes.antialias?4:0});let renderTargetProperties=renderer.properties.get(newRenderTarget);renderTargetProperties.__ignoreDepthValues=glProjLayer.ignoreDepthValues}newRenderTarget.isXRRenderTarget=!0,this.setFoveation(1),customReferenceSpace=null,referenceSpace=await session.requestReferenceSpace(referenceSpaceType),animation.setContext(session),animation.start(),scope.isPresenting=!0,scope.dispatchEvent({type:"sessionstart"})}};let cameraLPos=new Vector3,cameraRPos=new Vector3;function updateCamera(camera,parent){null===parent?camera.matrixWorld.copy(camera.matrix):camera.matrixWorld.multiplyMatrices(parent.matrixWorld,camera.matrix),camera.matrixWorldInverse.copy(camera.matrixWorld).invert()}this.updateCamera=function(camera){if(null===session)return;cameraVR.near=cameraR.near=cameraL.near=camera.near,cameraVR.far=cameraR.far=cameraL.far=camera.far,(_currentDepthNear!==cameraVR.near||_currentDepthFar!==cameraVR.far)&&(session.updateRenderState({depthNear:cameraVR.near,depthFar:cameraVR.far}),_currentDepthNear=cameraVR.near,_currentDepthFar=cameraVR.far);let parent=camera.parent,cameras=cameraVR.cameras;updateCamera(cameraVR,parent);for(let i=0;i<cameras.length;i++)updateCamera(cameras[i],parent);cameraVR.matrixWorld.decompose(cameraVR.position,cameraVR.quaternion,cameraVR.scale),camera.matrix.copy(cameraVR.matrix),camera.matrix.decompose(camera.position,camera.quaternion,camera.scale);let children=camera.children;for(let i1=0,l=children.length;i1<l;i1++)children[i1].updateMatrixWorld(!0);2===cameras.length?function(camera,cameraL,cameraR){cameraLPos.setFromMatrixPosition(cameraL.matrixWorld),cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);let ipd=cameraLPos.distanceTo(cameraRPos),projL=cameraL.projectionMatrix.elements,projR=cameraR.projectionMatrix.elements,near=projL[14]/(projL[10]-1),far=projL[14]/(projL[10]+1),topFov=(projL[9]+1)/projL[5],bottomFov=(projL[9]-1)/projL[5],leftFov=(projL[8]-1)/projL[0],rightFov=(projR[8]+1)/projR[0],zOffset=ipd/(-leftFov+rightFov),xOffset=-(zOffset*leftFov);cameraL.matrixWorld.decompose(camera.position,camera.quaternion,camera.scale),camera.translateX(xOffset),camera.translateZ(zOffset),camera.matrixWorld.compose(camera.position,camera.quaternion,camera.scale),camera.matrixWorldInverse.copy(camera.matrixWorld).invert();let near2=near+zOffset,far2=far+zOffset;camera.projectionMatrix.makePerspective(near*leftFov-xOffset,near*rightFov+(ipd-xOffset),topFov*far/far2*near2,bottomFov*far/far2*near2,near2,far2)}(cameraVR,cameraL,cameraR):cameraVR.projectionMatrix.copy(cameraL.projectionMatrix)},this.getCamera=function(){return cameraVR},this.getFoveation=function(){return null!==glProjLayer?glProjLayer.fixedFoveation:null!==glBaseLayer?glBaseLayer.fixedFoveation:void 0},this.setFoveation=function(foveation){null!==glProjLayer&&(glProjLayer.fixedFoveation=foveation),null!==glBaseLayer&&void 0!==glBaseLayer.fixedFoveation&&(glBaseLayer.fixedFoveation=foveation)};let onAnimationFrameCallback=null,animation=new WebGLAnimation;animation.setAnimationLoop(function(time,frame){if(pose=frame.getViewerPose(customReferenceSpace||referenceSpace),xrFrame=frame,null!==pose){let views=pose.views;null!==glBaseLayer&&(renderer.setRenderTargetFramebuffer(newRenderTarget,glBaseLayer.framebuffer),renderer.setRenderTarget(newRenderTarget));let cameraVRNeedsUpdate=!1;views.length!==cameraVR.cameras.length&&(cameraVR.cameras.length=0,cameraVRNeedsUpdate=!0);for(let i=0;i<views.length;i++){let view=views[i],viewport=null;if(null!==glBaseLayer)viewport=glBaseLayer.getViewport(view);else{let glSubImage=glBinding.getViewSubImage(glProjLayer,view);viewport=glSubImage.viewport,0===i&&(renderer.setRenderTargetTextures(new
186RenderTarget,glSubImage.colorTexture,glProjLayer.ignoreDepthValues?void 0:glSubImage.depthStencilTexture),renderer.setRenderTarget(newRenderTarget))}let camera=cameras[i];void 0===camera&&((camera=new PerspectiveCamera).layers.enable(i),camera.viewport=new Vector4,cameras[i]=camera),camera.matrix.fromArray(view.transform.matrix),camera.projectionMatrix.fromArray(view.projectionMatrix),camera.viewport.set(viewport.x,viewport.y,viewport.width,viewport.height),0===i&&cameraVR.matrix.copy(camera.matrix),!0===cameraVRNeedsUpdate&&cameraVR.cameras.push(camera)}}for(let i1=0;i1<controllers.length;i1++){let inputSource=controllerInputSources[i1],controller=controllers[i1];null!==inputSource&&void 0!==controller&&controller.update(inputSource,frame,customReferenceSpace||referenceSpace)}onAnimationFrameCallback&&onAnimationFrameCallback(time,frame),xrFrame=null}),this.setAnimationLoop=function(callback){onAnimationFrameCallback=callback},this.dispose=function(){}}}function WebGLMaterials(renderer,properties){function refreshUniformsCommon(uniforms,material){let uvScaleMap,uv2ScaleMap;uniforms.opacity.value=material.opacity,material.color&&uniforms.diffuse.value.copy(material.color),material.emissive&&uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity),material.map&&(uniforms.map.value=material.map),material.alphaMap&&(uniforms.alphaMap.value=material.alphaMap),material.bumpMap&&(uniforms.bumpMap.value=material.bumpMap,uniforms.bumpScale.value=material.bumpScale,material.side===BackSide&&(uniforms.bumpScale.value*=-1)),material.displacementMap&&(uniforms.displacementMap.value=material.displacementMap,uniforms.displacementScale.value=material.displacementScale,uniforms.displacementBias.value=material.displacementBias),material.emissiveMap&&(uniforms.emissiveMap.value=material.emissiveMap),material.normalMap&&(uniforms.normalMap.value=material.normalMap,uniforms.normalScale.value.copy(material.normalScale),material.side===BackSide&&uniforms.normalScale.value.negate()),material.specularMap&&(uniforms.specularMap.value=material.specularMap),material.alphaTest>0&&(uniforms.alphaTest.value=material.alphaTest);let envMap=properties.get(material).envMap;if(envMap&&(uniforms.envMap.value=envMap,uniforms.flipEnvMap.value=envMap.isCubeTexture&&!1===envMap.isRenderTargetTexture?-1:1,uniforms.reflectivity.value=material.reflectivity,uniforms.ior.value=material.ior,uniforms.refractionRatio.value=material.refractionRatio),material.lightMap){uniforms.lightMap.value=material.lightMap;let scaleFactor=!0!==renderer.physicallyCorrectLights?Math.PI:1;uniforms.lightMapIntensity.value=material.lightMapIntensity*scaleFactor}material.aoMap&&(uniforms.aoMap.value=material.aoMap,uniforms.aoMapIntensity.value=material.aoMapIntensity),material.map?uvScaleMap=material.map:material.specularMap?uvScaleMap=material.specularMap:material.displacementMap?uvScaleMap=material.displacementMap:material.normalMap?uvScaleMap=material.normalMap:material.bumpMap?uvScaleMap=material.bumpMap:material.roughnessMap?uvScaleMap=material.roughnessMap:material.metalnessMap?uvScaleMap=material.metalnessMap:material.alphaMap?uvScaleMap=material.alphaMap:material.emissiveMap?uvScaleMap=material.emissiveMap:material.clearcoatMap?uvScaleMap=material.clearcoatMap:material.clearcoatNormalMap?uvScaleMap=material.clearcoatNormalMap:material.clearcoatRoughnessMap?uvScaleMap=material.clearcoatRoughnessMap:material.iridescenceMap?uvScaleMap=material.iridescenceMap:material.iridescenceThicknessMap?uvScaleMap=material.iridescenceThicknessMap:material.specularIntensityMap?uvScaleMap=material.specularIntensityMap:material.specularColorMap?uvScaleMap=material.specularColorMap:material.transmissionMap?uvScaleMap=material.transmissionMap:material.thicknessMap?uvScaleMap=material.thicknessMap:material.sheenColorMap?uvScaleMap=material.sheenColorMap:material.sheenRoughnessMap&&(uvScaleMap=material.sheenRoughnessMap),void 0!==uvScaleMap&&(uvScaleMap.isWebGLRenderTarget&&(uvScaleMap=uvScaleMap.texture),!0===uvScaleMap.matrixAutoUpdate&&uvScaleMap.updateMatrix(),uniforms.uvTransform.value.copy(uvScaleMap.matrix)),material.aoMap?uv2ScaleMap=material.aoMap:material.lightMap&&(uv2ScaleMap=material.lightMap),void 0!==uv2ScaleMap&&(uv2ScaleMap.isWebGLRenderTarget&&(uv2ScaleMap=uv2ScaleMap.texture),!0===uv2ScaleMap.matrixAutoUpdate&&uv2ScaleMap.updateMatrix(),uniforms.uv2Transform.value.copy(uv2ScaleMap.matrix))}return{refreshFogUniforms:function(uniforms,fog){uniforms.fogColor.value.copy(fog.color),fog.isFog?(uniforms.fogNear.value=fog.near,uniforms.fogFar.value=fog.far):fog.isFogExp2&&(uniforms.fogDensity.value=fog.density)},refreshMaterialUniforms:function(uniforms,material,pixelRatio,height,transmissionRenderTarget){var uniforms1,uniforms2,uniforms3,uniforms4,uniforms5,uniforms6,uniforms7,uniforms8,uniforms9;let uvScaleMap,uvScaleMap1;material.isMeshBasicMaterial?refreshUniformsCommon(uniforms,material):material.isMeshLambertMaterial?refreshUniformsCommon(uniforms,material):material.isMeshToonMaterial?(refreshUniformsCommon(uniforms,material),uniforms1=uniforms,material.gradientMap&&(uniforms1.gradientMap.value=material.gradientMap)):material.isMeshPhongMaterial?(refreshUniformsCommon(uniforms,material),(uniforms2=uniforms).specular.value.copy(material.specular),uniforms2.shininess.value=Math.max(material.shininess,1e-4)):material.isMeshStandardMaterial?(refreshUniformsCommon(uniforms,material),function(uniforms,material){uniforms.roughness.value=material.roughness,uniforms.metalness.value=material.metalness,material.roughnessMap&&(uniforms.roughnessMap.value=material.roughnessMap),material.metalnessMap&&(uniforms.metalnessMap.value=material.metalnessMap);let envMap=properties.get(material).envMap;envMap&&(uniforms.envMapIntensity.value=material.envMapIntensity)}(uniforms,material),material.isMeshPhysicalMaterial&&((uniforms3=uniforms).ior.value=material.ior,material.sheen>0&&(uniforms3.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen),uniforms3.sheenRoughness.value=material.sheenRoughness,material.sheenColorMap&&(uniforms3.sheenColorMap.value=material.sheenColorMap),material.sheenRoughnessMap&&(uniforms3.sheenRoughnessMap.value=material.sheenRoughnessMap)),material.clearcoat>0&&(uniforms3.clearcoat.value=material.clearcoat,uniforms3.clearcoatRoughness.value=material.clearcoatRoughness,material.clearcoatMap&&(uniforms3.clearcoatMap.value=material.clearcoatMap),material.clearcoatRoughnessMap&&(uniforms3.clearcoatRoughnessMap.value=material.clearcoatRoughnessMap),material.clearcoatNormalMap&&(uniforms3.clearcoatNormalScale.value.copy(material.clearcoatNormalScale),uniforms3.clearcoatNormalMap.value=material.clearcoatNormalMap,material.side===BackSide&&uniforms3.clearcoatNormalScale.value.negate())),material.iridescence>0&&(uniforms3.iridescence.value=material.iridescence,uniforms3.iridescenceIOR.value=material.iridescenceIOR,uniforms3.iridescenceThicknessMinimum.value=material.iridescenceThicknessRange[0],uniforms3.iridescenceThicknessMaximum.value=material.iridescenceThicknessRange[1],material.iridescenceMap&&(uniforms3.iridescenceMap.value=material.iridescenceMap),material.iridescenceThicknessMap&&(uniforms3.iridescenceThicknessMap.value=material.iridescenceThicknessMap)),material.transmission>0&&(uniforms3.transmission.value=material.transmission,uniforms3.transmissionSamplerMap.value=transmissionRenderTarget.texture,uniforms3.transmissionSamplerSize.value.set(transmissionRenderTarget.width,transmissionRenderTarget.height),material.transmissionMap&&(uniforms3.transmissionMap.value=material.transmissionMap),uniforms3.thickness.value=material.thickness,material.thicknessMap&&(uniforms3.thicknessMap.value=material.thicknessMap),uniforms3.attenuationDistance.value=material.attenuationDistance,uniforms3.attenuationColor.value.copy(material.attenuationColor)),uniforms3.specularIntensity.value=material.specularIntensity,uniforms3.specularColor.value.copy(material.specularColor),material.specularIntensityMap&&(uniforms3.specularIntensityMap.value=material.specularIntensityMap),material.specularColorMap&&(uniforms3.specularColorMap.value=material.specularColorMap))):material.isMeshMat
186capMaterial?(refreshUniformsCommon(uniforms,material),uniforms4=uniforms,material.matcap&&(uniforms4.matcap.value=material.matcap)):material.isMeshDepthMaterial?refreshUniformsCommon(uniforms,material):material.isMeshDistanceMaterial?(refreshUniformsCommon(uniforms,material),(uniforms5=uniforms).referencePosition.value.copy(material.referencePosition),uniforms5.nearDistance.value=material.nearDistance,uniforms5.farDistance.value=material.farDistance):material.isMeshNormalMaterial?refreshUniformsCommon(uniforms,material):material.isLineBasicMaterial?((uniforms6=uniforms).diffuse.value.copy(material.color),uniforms6.opacity.value=material.opacity,material.isLineDashedMaterial&&((uniforms7=uniforms).dashSize.value=material.dashSize,uniforms7.totalSize.value=material.dashSize+material.gapSize,uniforms7.scale.value=material.scale)):material.isPointsMaterial?((uniforms8=uniforms).diffuse.value.copy(material.color),uniforms8.opacity.value=material.opacity,uniforms8.size.value=material.size*pixelRatio,uniforms8.scale.value=.5*height,material.map&&(uniforms8.map.value=material.map),material.alphaMap&&(uniforms8.alphaMap.value=material.alphaMap),material.alphaTest>0&&(uniforms8.alphaTest.value=material.alphaTest),material.map?uvScaleMap=material.map:material.alphaMap&&(uvScaleMap=material.alphaMap),void 0!==uvScaleMap&&(!0===uvScaleMap.matrixAutoUpdate&&uvScaleMap.updateMatrix(),uniforms8.uvTransform.value.copy(uvScaleMap.matrix))):material.isSpriteMaterial?((uniforms9=uniforms).diffuse.value.copy(material.color),uniforms9.opacity.value=material.opacity,uniforms9.rotation.value=material.rotation,material.map&&(uniforms9.map.value=material.map),material.alphaMap&&(uniforms9.alphaMap.value=material.alphaMap),material.alphaTest>0&&(uniforms9.alphaTest.value=material.alphaTest),material.map?uvScaleMap1=material.map:material.alphaMap&&(uvScaleMap1=material.alphaMap),void 0!==uvScaleMap1&&(!0===uvScaleMap1.matrixAutoUpdate&&uvScaleMap1.updateMatrix(),uniforms9.uvTransform.value.copy(uvScaleMap1.matrix))):material.isShadowMaterial?(uniforms.color.value.copy(material.color),uniforms.opacity.value=material.opacity):material.isShaderMaterial&&(material.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(gl,info,capabilities,state){let buffers={},updateList={},allocatedBindingPoints=[],maxBindingPoints=capabilities.isWebGL2?gl.getParameter(35375):0;function onUniformsGroupsDispose(event){let uniformsGroup=event.target;uniformsGroup.removeEventListener("dispose",onUniformsGroupsDispose);let index=allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);allocatedBindingPoints.splice(index,1),gl.deleteBuffer(buffers[uniformsGroup.id]),delete buffers[uniformsGroup.id],delete updateList[uniformsGroup.id]}return{bind:function(uniformsGroup,program){let webglProgram=program.program;state.uniformBlockBinding(uniformsGroup,webglProgram)},update:function(uniformsGroup,program){let buffer=buffers[uniformsGroup.id];void 0===buffer&&(function(uniformsGroup){let uniforms=uniformsGroup.uniforms,offset=0,chunkOffset=0;for(let i=0,l=uniforms.length;i<l;i++){let uniform=uniforms[i],info=function(uniform){let value=uniform.value,info={boundary:0,storage:0};return"number"==typeof value?(info.boundary=4,info.storage=4):value.isVector2?(info.boundary=8,info.storage=8):value.isVector3||value.isColor?(info.boundary=16,info.storage=12):value.isVector4?(info.boundary=16,info.storage=16):value.isMatrix3?(info.boundary=48,info.storage=48):value.isMatrix4?(info.boundary=64,info.storage=64):value.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",value),info}(uniform);if(uniform.__data=new Float32Array(info.storage/Float32Array.BYTES_PER_ELEMENT),uniform.__offset=offset,i>0){chunkOffset=offset%16;let remainingSizeInChunk=16-chunkOffset;0!==chunkOffset&&remainingSizeInChunk-info.boundary<0&&(offset+=16-chunkOffset,uniform.__offset=offset)}offset+=info.storage}(chunkOffset=offset%16)>0&&(offset+=16-chunkOffset),uniformsGroup.__size=offset,uniformsGroup.__cache={}}(uniformsGroup),buffer=function(uniformsGroup){let bindingPointIndex=function(){for(let i=0;i<maxBindingPoints;i++)if(-1===allocatedBindingPoints.indexOf(i))return allocatedBindingPoints.push(i),i;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();uniformsGroup.__bindingPointIndex=bindingPointIndex;let buffer=gl.createBuffer(),size=uniformsGroup.__size,usage=uniformsGroup.usage;return gl.bindBuffer(35345,buffer),gl.bufferData(35345,size,usage),gl.bindBuffer(35345,null),gl.bindBufferBase(35345,bindingPointIndex,buffer),buffer}(uniformsGroup),buffers[uniformsGroup.id]=buffer,uniformsGroup.addEventListener("dispose",onUniformsGroupsDispose));let webglProgram=program.program;state.updateUBOMapping(uniformsGroup,webglProgram);let frame=info.render.frame;updateList[uniformsGroup.id]!==frame&&(function(uniformsGroup){let buffer=buffers[uniformsGroup.id],uniforms=uniformsGroup.uniforms,cache=uniformsGroup.__cache;gl.bindBuffer(35345,buffer);for(let i=0,il=uniforms.length;i<il;i++){let uniform=uniforms[i];if(!0===function(uniform,index,cache){let value=uniform.value;if(void 0===cache[index])return"number"==typeof value?cache[index]=value:cache[index]=value.clone(),!0;if("number"==typeof value){if(cache[index]!==value)return cache[index]=value,!0}else{let cachedObject=cache[index];if(!1===cachedObject.equals(value))return cachedObject.copy(value),!0}return!1}(uniform,i,cache)){let value=uniform.value,offset=uniform.__offset;"number"==typeof value?(uniform.__data[0]=value,gl.bufferSubData(35345,offset,uniform.__data)):(uniform.value.isMatrix3?(uniform.__data[0]=uniform.value.elements[0],uniform.__data[1]=uniform.value.elements[1],uniform.__data[2]=uniform.value.elements[2],uniform.__data[3]=uniform.value.elements[0],uniform.__data[4]=uniform.value.elements[3],uniform.__data[5]=uniform.value.elements[4],uniform.__data[6]=uniform.value.elements[5],uniform.__data[7]=uniform.value.elements[0],uniform.__data[8]=uniform.value.elements[6],uniform.__data[9]=uniform.value.elements[7],uniform.__data[10]=uniform.value.elements[8],uniform.__data[11]=uniform.value.elements[0]):value.toArray(uniform.__data),gl.bufferSubData(35345,offset,uniform.__data))}}gl.bindBuffer(35345,null)}(uniformsGroup),updateList[uniformsGroup.id]=frame)},dispose:function(){for(let id in buffers)gl.deleteBuffer(buffers[id]);allocatedBindingPoints=[],buffers={},updateList={}}}}function WebGLRenderer(parameters={}){let _alpha,extensions,capabilities,state,info,properties,textures,cubemaps,cubeuvmaps,attributes,geometries,objects,programCache,materials,renderLists,renderStates,clipping,shadowMap,background,morphtargets,bufferRenderer,indexedBufferRenderer,utils,bindingStates,uniformsGroups;
186this.isWebGLRenderer=!0;let _canvas=void 0!==parameters.canvas?parameters.canvas:function(){let canvas=createElementNS("canvas");return canvas.style.display="block",canvas}(),_context=void 0!==parameters.context?parameters.context:null,_depth=void 0===parameters.depth||parameters.depth,_stencil=void 0===parameters.stencil||parameters.stencil,_antialias=void 0!==parameters.antialias&¶meters.antialias,_premultipliedAlpha=void 0===parameters.premultipliedAlpha||parameters.premultipliedAlpha,_preserveDrawingBuffer=void 0!==parameters.preserveDrawingBuffer&¶meters.preserveDrawingBuffer,_powerPreference=void 0!==parameters.powerPreference?parameters.powerPreference:"default",_failIfMajorPerformanceCaveat=void 0!==parameters.failIfMajorPerformanceCaveat&¶meters.failIfMajorPerformanceCaveat;_alpha=null!==_context?_context.getContextAttributes().alpha:void 0!==parameters.alpha&¶meters.alpha;let currentRenderList=null,currentRenderState=null,renderListStack=[],renderStateStack=[];this.domElement=_canvas,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=LinearEncoding,this.physicallyCorrectLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});let _this=this,_isContextLost=!1,_currentActiveCubeFace=0,_currentActiveMipmapLevel=0,_currentRenderTarget=null,_currentMaterialId=-1,_currentCamera=null,_currentViewport=new Vector4,_currentScissor=new Vector4,_currentScissorTest=null,_width=_canvas.width,_height=_canvas.height,_pixelRatio=1,_opaqueSort=null,_transparentSort=null,_viewport=new Vector4(0,0,_width,_height),_scissor=new Vector4(0,0,_width,_height),_scissorTest=!1,_frustum=new Frustum,_clippingEnabled=!1,_localClippingEnabled=!1,_transmissionRenderTarget=null,_projScreenMatrix=new Matrix4,_vector2=new Vector2,_vector3=new Vector3,_emptyScene={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){return null===_currentRenderTarget?_pixelRatio:1}let _gl=_context;function getContext(contextNames,contextAttributes){for(let i=0;i<contextNames.length;i++){let contextName=contextNames[i],context=_canvas.getContext(contextName,contextAttributes);if(null!==context)return context}return null}try{if("setAttribute"in _canvas&&_canvas.setAttribute("data-engine","three.js r146"),_canvas.addEventListener("webglcontextlost",onContextLost,!1),_canvas.addEventListener("webglcontextrestored",onContextRestore,!1),_canvas.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===_gl){let contextNames=["webgl2","webgl","experimental-webgl"];if(!0===_this.isWebGL1Renderer&&contextNames.shift(),_gl=getContext(contextNames,{alpha:!0,depth:_depth,stencil:_stencil,antialias:_antialias,premultipliedAlpha:_premultipliedAlpha,preserveDrawingBuffer:_preserveDrawingBuffer,powerPreference:_powerPreference,failIfMajorPerformanceCaveat:_failIfMajorPerformanceCaveat}),null===_gl){if(getContext(contextNames))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}}void 0===_gl.getShaderPrecisionFormat&&(_gl.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(error){throw console.error("THREE.WebGLRenderer: "+error.message),error}function initGLContext(){extensions=new WebGLExtensions(_gl),capabilities=new WebGLCapabilities(_gl,extensions,parameters),extensions.init(capabilities),utils=new WebGLUtils(_gl,extensions,capabilities),state=new WebGLState(_gl,extensions,capabilities),info=new WebGLInfo,properties=new WebGLProperties,textures=new WebGLTextures(_gl,extensions,state,properties,capabilities,utils,info),cubemaps=new WebGLCubeMaps(_this),cubeuvmaps=new WebGLCubeUVMaps(_this),attributes=new WebGLAttributes(_gl,capabilities),bindingStates=new WebGLBindingStates(_gl,extensions,attributes,capabilities),geometries=new WebGLGeometries(_gl,attributes,info,bindingStates),objects=new WebGLObjects(_gl,geometries,attributes,info),morphtargets=new WebGLMorphtargets(_gl,capabilities,textures),clipping=new WebGLClipping(properties),programCache=new WebGLPrograms(_this,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping),materials=new WebGLMaterials(_this,properties),renderLists=new WebGLRenderLists,renderStates=new WebGLRenderStates(extensions,capabilities),background=new WebGLBackgroun
vendor: 6,897 bytes, line 186
186d(_this,cubemaps,cubeuvmaps,state,objects,_alpha,_premultipliedAlpha),shadowMap=new WebGLShadowMap(_this,objects,capabilities),uniformsGroups=new WebGLUniformsGroups(_gl,info,capabilities,state),bufferRenderer=new WebGLBufferRenderer(_gl,extensions,info,capabilities),indexedBufferRenderer=new WebGLIndexedBufferRenderer(_gl,extensions,info,capabilities),info.programs=programCache.programs,_this.capabilities=capabilities,_this.extensions=extensions,_this.properties=properties,_this.renderLists=renderLists,_this.shadowMap=shadowMap,_this.state=state,_this.info=info}initGLContext();let xr=new WebXRManager(_this,_gl);function onContextLost(event){event.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_isContextLost=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),_isContextLost=!1;let infoAutoReset=info.autoReset,shadowMapEnabled=shadowMap.enabled,shadowMapAutoUpdate=shadowMap.autoUpdate,shadowMapNeedsUpdate=shadowMap.needsUpdate,shadowMapType=shadowMap.type;initGLContext(),info.autoReset=infoAutoReset,shadowMap.enabled=shadowMapEnabled,shadowMap.autoUpdate=shadowMapAutoUpdate,shadowMap.needsUpdate=shadowMapNeedsUpdate,shadowMap.type=shadowMapType}function onContextCreationError(event){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",event.statusMessage)}function onMaterialDispose(event){let material=event.target;material.removeEventListener("dispose",onMaterialDispose),function(material){let programs=properties.get(material).programs;void 0!==programs&&(programs.forEach(function(program){programCache.releaseProgram(program)}),material.isShaderMaterial&&programCache.releaseShaderCache(material))}(material),properties.remove(material)}this.xr=xr,this.getContext=function(){return _gl},this.getContextAttributes=function(){return _gl.getContextAttributes()},this.forceContextLoss=function(){let extension=extensions.get("WEBGL_lose_context");extension&&extension.loseContext()},this.forceContextRestore=function(){let extension=extensions.get("WEBGL_lose_context");extension&&extension.restoreContext()},this.getPixelRatio=function(){return _pixelRatio},this.setPixelRatio=function(value){void 0!==value&&(_pixelRatio=value,this.setSize(_width,_height,!1))},this.getSize=function(target){return target.set(_width,_height)},this.setSize=function(width,height,updateStyle){if(xr.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}_width=width,_height=height,_canvas.width=Math.floor(width*_pixelRatio),_canvas.height=Math.floor(height*_pixelRatio),!1!==updateStyle&&(_canvas.style.width=width+"px",_canvas.style.height=height+"px"),this.setViewport(0,0,width,height)},this.getDrawingBufferSize=function(target){return target.set(_width*_pixelRatio,_height*_pixelRatio).floor()},this.setDrawingBufferSize=function(width,height,pixelRatio){_width=width,_height=height,_pixelRatio=pixelRatio,_canvas.width=Math.floor(width*pixelRatio),_canvas.height=Math.floor(height*pixelRatio),this.setViewport(0,0,width,height)},this.getCurrentViewport=function(target){return target.copy(_currentViewport)},this.getViewport=function(target){return target.copy(_viewport)},this.setViewport=function(x,y,width,height){x.isVector4?_viewport.set(x.x,x.y,x.z,x.w):_viewport.set(x,y,width,height),state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor())},this.getScissor=function(target){return target.copy(_scissor)},this.setScissor=function(x,y,width,height){x.isVector4?_scissor.set(x.x,x.y,x.z,x.w):_scissor.set(x,y,width,height),state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor())},this.getScissorTest=function(){return _scissorTest},this.setScissorTest=function(boolean){state.setScissorTest(_scissorTest=boolean)},this.setOpaqueSort=function(method){_opaqueSort=method},this.setTransparentSort=function(method){_transparentSort=method},this.getClearColor=function(target){return target.copy(background.getClearColor())},this.setClearColor=function(){background.setClearColor.apply(background,arguments)},this.getClearAlpha=function(){return background.getClearAlpha()},this.setClearAlpha=function(){background.setClearAlpha.apply(background,arguments)},this.clear=function(color=!0,depth=!0,stencil=!0){let bits=0;color&&(bits|=16384),depth&&(bits|=256),stencil&&(bits|=1024),_gl.clear(bits)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){_canvas.removeEventListener("webglcontextlost",onContextLost,!1),_canvas.removeEventListener("webglcontextrestored",onContextRestore,!1),_canvas.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),renderLists.dispose(),renderStates.dispose(),properties.dispose(),cubemaps.dispose(),cubeuvmaps.dispose(),objects.dispose(),bindingStates.dispose(),uniformsGroups.dispose(),programCache.dispose(),xr.dispose(),xr.removeEventListener("sessionstart",onXRSessionStart),xr.removeEventListener("sessionend",onXRSessionEnd),_transmissionRenderTarget&&(_transmissionRenderTarget.dispose(),_transmissionRenderTarget=null),animation.stop()},this.renderBufferDirect=function(camera,scene,geometry,material,object,group){let attribute;null===scene&&(scene=_emptyScene);let frontFaceCW=object.isMesh&&0>object.matrixWorld.determinant(),program=function(camera,scene,geometry,material,object){var uniforms,value;!0!==scene.isScene&&(scene=_emptyScene),textures.resetTextureUnits();let fog=scene.fog,environment=material.isMeshStandardMaterial?scene.environment:null,encoding=null===_currentRenderTarget?_this.outputEncoding:!0===_currentRenderTarget.isXRRenderTarget?_currentRenderTarget.texture.encoding:LinearEncoding,envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||environment),vertexAlphas=!0===material.vertexColors&&!!geometry.attributes.color&&4===geometry.attributes.color.itemSize,vertexTangents=!!material.normalMap&&!!geometry.attributes.tangent,morphTargets=!!geometry.morphAttributes.position,morphNormals=!!geometry.morphAttributes.normal,morphColors=!!geometry.morphAttributes.color,toneMapping=material.toneMapped?_this.toneMapping:NoToneMapping,morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color,morphTargetsCount=void 0!==morphAttribute?morphAttribute.length:0,materialProperties=properties.get(material),lights=currentRenderState.state.lights;if(!0===_clippingEnabled&&(!0===_localClippingEnabled||camera!==_currentCamera)){let useCache=camera===_currentCamera&&material.id===_currentMaterialId;clipping.setState(material,camera,useCache)}let needsProgramChange=!1;material.version===materialProperties.__version?materialProperties.needsLights&&materialProperties.lightsStateVersion!==lights.state.ver
186sion?needsProgramChange=!0:materialProperties.outputEncoding!==encoding?needsProgramChange=!0:object.isInstancedMesh&&!1===materialProperties.instancing?needsProgramChange=!0:object.isInstancedMesh||!0!==materialProperties.instancing?object.isSkinnedMesh&&!1===materialProperties.skinning?needsProgramChange=!0:object.isSkinnedMesh||!0!==materialProperties.skinning?materialProperties.envMap!==envMap?needsProgramChange=!0:!0===material.fog&&materialProperties.fog!==fog?needsProgramChange=!0:void 0!==materialProperties.numClippingPlanes&&(materialProperties.numClippingPlanes!==clipping.numPlanes||materialProperties.numIntersection!==clipping.numIntersection)?needsProgramChange=!0:materialProperties.vertexAlphas!==vertexAlphas?needsProgramChange=!0:materialProperties.vertexTangents!==vertexTangents?needsProgramChange=!0:materialProperties.morphTargets!==morphTargets?needsProgramChange=!0:materialProperties.morphNormals!==morphNormals?needsProgramChange=!0:materialProperties.morphColors!==morphColors?needsProgramChange=!0:materialProperties.toneMapping!==toneMapping?needsProgramChange=!0:!0===capabilities.isWebGL2&&materialProperties.morphTargetsCount!==morphTargetsCount&&(needsProgramChange=!0):needsProgramChange=!0:needsProgramChange=!0:(needsProgramChange=!0,materialProperties.__version=material.version);let program=materialProperties.currentProgram;!0===needsProgramChange&&(program=getProgram(material,scene,object));let refreshProgram=!1,refreshMaterial=!1,refreshLights=!1,p_uniforms=program.getUniforms(),m_uniforms=materialProperties.uniforms;if(state.useProgram(program.program)&&(refreshProgram=!0,refreshMaterial=!0,refreshLights=!0),material.id!==_currentMaterialId&&(_currentMaterialId=material.id,refreshMaterial=!0),refreshProgram||_currentCamera!==camera){if(p_uniforms.setValue(_gl,"projectionMatrix",camera.projectionMatrix),capabilities.logarithmicDepthBuffer&&p_uniforms.setValue(_gl,"logDepthBufFC",2/(Math.log(camera.far+1)/Math.LN2)),_currentCamera!==camera&&(_currentCamera=camera,refreshMaterial=!0,refreshLights=!0),material.isShaderMaterial||material.isMeshPhongMaterial||material.isMeshToonMaterial||material.isMeshStandardMaterial||material.envMap){let uCamPos=p_uniforms.map.cameraPosition;void 0!==uCamPos&&uCamPos.setValue(_gl,_vector3.setFromMatrixPosition(camera.matrixWorld))}(material.isMeshPhongMaterial||material.isMeshToonMaterial||material.isMeshLambertMaterial||material.isMeshBasicMaterial||material.isMeshStandardMaterial||material.isShaderMaterial)&&p_uniforms.setValue(_gl,"isOrthographic",!0===camera.isOrthographicCamera),(material.isMeshPhongMaterial||material.isMeshToonMaterial||material.isMeshLambertMaterial||material.isMeshBasicMaterial||material.isMeshStandardMaterial||material.isShaderMaterial||material.isShadowMaterial||object.isSkinnedMesh)&&p_uniforms.setValue(_gl,"viewMatrix",camera.matrixWorldInverse)}if(object.isSkinnedMesh){p_uniforms.setOptional(_gl,object,"bindMatrix"),p_uniforms.setOptional(_gl,object,"bindMatrixInverse");let skeleton=object.skeleton;skeleton&&(capabilities.floatVertexTextures?(null===skeleton.boneTexture&&skeleton.computeBoneTexture(),p_uniforms.setValue(_gl,"boneTexture",skeleton.boneTexture,textures),p_uniforms.setValue(_gl,"boneTextureSize",skeleton.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let morphAttributes=geometry.morphAttributes;if((void 0!==morphAttributes.position||void 0!==morphAttributes.normal||void 0!==morphAttributes.color&&!0===capabilities.isWebGL2)&&morphtargets.update(object,geometry,material,program),(refreshMaterial||materialProperties.receiveShadow!==object.receiveShadow)&&(materialProperties.receiveShadow=object.receiveShadow,p_uniforms.setValue(_gl,"receiveShadow",object.receiveShadow)),material.isMeshGouraudMaterial&&null!==material.envMap&&(m_uniforms.envMap.value=envMap,m_uniforms.flipEnvMap.value=envMap.isCubeTexture&&!1===envMap.isRenderTargetTexture?-1:1),refreshMaterial&&(p_uniforms.setValue(_gl,"toneMappingExposure",_this.toneMappingExposure),materialProperties.needsLights&&(uniforms=m_uniforms,value=refreshLights,uniforms.ambientLightColor.needsUpdate=value,uniforms.lightProbe.needsUpdate=value,uniforms.directionalLights.needsUpdate=value,uniforms.directionalLightShadows.needsUpdate=value,uniforms.pointLights.needsUpdate=value,uniforms.pointLightShadows.needsUpdate=value,uniforms.spotLights.needsUpdate=value,uniforms.spotLightShadows.needsUpdate=value,uniforms.rectAreaLights.needsUpdate=value,uniforms.hemisphereLights.needsUpdate=value),fog&&!0===material.fog&&materials.refreshFogUniforms(m_uniforms,fog),materials.refreshMaterialUniforms(m_uniforms,material,_pixelRatio,_height,_transmissionRenderTarget),WebGLUniforms.upload(_gl,materialProperties.uniformsList,m_uniforms,textures)),material.isShaderMaterial&&!0===material.uniformsNeedUpdate&&(WebGLUniforms.upload(_gl,materialProperties.uniformsList,m_uniforms,textures),material.uniformsNeedUpdate=!1),material.isSpriteMaterial&&p_uniforms.setValue(_gl,"center",object.center),p_uniforms.setValue(_gl,"modelViewMatrix",object.modelViewMatrix),p_uniforms.setValue(_gl,"normalMatrix",object.normalMatrix),p_uniforms.setValue(_gl,"modelMatrix",object.matrixWorld),material.isShaderMaterial||material.isRawShaderMaterial){let groups=material.uniformsGroups;for(let i=0,l=groups.length;i<l;i++)if(capabilities.isWebGL2){let group=groups[i];uniformsGroups.update(group,program),uniformsGroups.bind(group,program)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return program}(camera,scene,geometry,material,object);state.setMaterial(material,frontFaceCW);let index=geometry.index,position=geometry.attributes.position;
186if(null===index){if(void 0===position||0===position.count)return}else if(0===index.count)return;let rangeFactor=1;!0===material.wireframe&&(index=geometries.getWireframeAttribute(geometry),rangeFactor=2),bindingStates.setup(object,material,program,geometry,index);let renderer=bufferRenderer;null!==index&&(attribute=attributes.get(index),(renderer=indexedBufferRenderer).setIndex(attribute));let dataCount=null!==index?index.count:position.count,rangeStart=geometry.drawRange.start*rangeFactor,rangeCount=geometry.drawRange.count*rangeFactor,groupStart=null!==group?group.start*rangeFactor:0,groupCount=null!==group?group.count*rangeFactor:1/0,drawStart=Math.max(rangeStart,groupStart),drawCount=Math.max(0,Math.min(dataCount,rangeStart+rangeCount,groupStart+groupCount)-1-drawStart+1);if(0!==drawCount){if(object.isMesh)!0===material.wireframe?(state.setLineWidth(material.wireframeLinewidth*getTargetPixelRatio()),renderer.setMode(1)):renderer.setMode(4);else if(object.isLine){let lineWidth=material.linewidth;void 0===lineWidth&&(lineWidth=1),state.setLineWidth(lineWidth*getTargetPixelRatio()),object.isLineSegments?renderer.setMode(1):object.isLineLoop?renderer.setMode(2):renderer.setMode(3)}else object.isPoints?renderer.setMode(0):object.isSprite&&renderer.setMode(4);if(object.isInstancedMesh)renderer.renderInstances(drawStart,drawCount,object.count);else if(geometry.isInstancedBufferGeometry){let instanceCount=Math.min(geometry.instanceCount,geometry._maxInstanceCount);renderer.renderInstances(drawStart,drawCount,instanceCount)}else renderer.render(drawStart,drawCount)}},this.compile=function(scene,camera){function prepare(material,scene,object){!0===material.transparent&&material.side===DoubleSide?(material.side=BackSide,material.needsUpdate=!0,getProgram(material,scene,object),material.side=FrontSide,material.needsUpdate=!0,getProgram(material,scene,object),material.side=DoubleSide):getProgram(material,scene,object)}(currentRenderState=renderStates.get(scene)).init(),renderStateStack.push(currentRenderState),scene.traverseVisible(function(object){object.isLight&&object.layers.test(camera.layers)&&(currentRenderState.pushLight(object),object.castShadow&¤tRenderState.pushShadow(object))}),currentRenderState.setupLights(_this.physicallyCorrectLights),scene.traverse(function(object){let material=object.material;if(material){if(Array.isArray(material))for(let i=0;i<material.length;i++){let material2=material[i];prepare(material2,scene,object)}else prepare(material,scene,object)}}),renderStateStack.pop(),currentRenderState=null};let onAnimationFrameCallback=null;function onXRSessionStart(){animation.stop()}function onXRSessionEnd(){animation.start()}let animation=new WebGLAnimation;
186function renderScene(currentRenderList,scene,camera,viewport){let opaqueObjects=currentRenderList.opaque,transmissiveObjects=currentRenderList.transmissive,transparentObjects=currentRenderList.transparent;currentRenderState.setupLightsView(camera),transmissiveObjects.length>0&&function(opaqueObjects,scene,camera){let isWebGL2=capabilities.isWebGL2;null===_transmissionRenderTarget&&(_transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:extensions.has("EXT_color_buffer_half_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:isWebGL2&&!0===_antialias?4:0})),_this.getDrawingBufferSize(_vector2),isWebGL2?_transmissionRenderTarget.setSize(_vector2.x,_vector2.y):_transmissionRenderTarget.setSize(floorPowerOfTwo(_vector2.x),floorPowerOfTwo(_vector2.y));let currentRenderTarget=_this.getRenderTarget();_this.setRenderTarget(_transmissionRenderTarget),_this.clear();let currentToneMapping=_this.toneMapping;_this.toneMapping=NoToneMapping,renderObjects(opaqueObjects,scene,camera),_this.toneMapping=currentToneMapping,textures.updateMultisampleRenderTarget(_transmissionRenderTarget),textures.updateRenderTargetMipmap(_transmissionRenderTarget),_this.setRenderTarget(currentRenderTarget)}(opaqueObjects,scene,camera),viewport&&state.viewport(_currentViewport.copy(viewport)),opaqueObjects.length>0&&renderObjects(opaqueObjects,scene,camera),transmissiveObjects.length>0&&renderObjects(transmissiveObjects,scene,camera),transparentObjects.length>0&&renderObjects(transparentObjects,scene,camera),state.buffers.depth.setTest(!0),state.buffers.depth.setMask(!0),state.buffers.color.setMask(!0),state.setPolygonOffset(!1)}function renderObjects(renderList,scene,camera){let overrideMaterial=!0===scene.isScene?scene.overrideMaterial:null;for(let i=0,l=renderList.length;i<l;i++){var material;let renderItem=renderList[i],object=renderItem.object,geometry=renderItem.geometry,material1=null===overrideMaterial?renderItem.material:overrideMaterial,group=renderItem.group;object.layers.test(camera.layers)&&(material=material1,object.onBeforeRender(_this,scene,camera,geometry,material,group),object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse,object.matrixWorld),object.normalMatrix.getNormalMatrix(object.modelViewMatrix),material.onBeforeRender(_this,scene,camera,geometry,object,group),!0===material.transparent&&material.side===DoubleSide?(material.side=BackSide,material.needsUpdate=!0,_this.renderBufferDirect(camera,scene,geometry,material,object,group),material.side=FrontSide,material.needsUpdate=!0,_this.renderBufferDirect(camera,scene,geometry,material,object,group),material.side=DoubleSide):_this.renderBufferDirect(camera,scene,geometry,material,object,group),object.onAfterRender(_this,scene,camera,geometry,material,group))}}function getProgram(material,scene,object){!0!==scene.isScene&&(scene=_emptyScene);let materialProperties=properties.get(material),lights=currentRenderState.state.lights,shadowsArray=currentRenderState.state.shadowsArray,lightsStateVersion=lights.state.version,parameters=programCache.getParameters(material,lights.state,shadowsArray,scene,object),programCacheKey=programCache.getProgramCacheKey(parameters),programs=materialProperties.programs;materialProperties.environment=material.isMeshStandardMaterial?scene.environment:null,materialProperties.fog=scene.fog,materialProperties.envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||materialProperties.environment),void 0===programs&&(material.addEventListener("dispose",onMaterialDispose),programs=new Map,materialProperties.programs=programs);let program=programs.get(programCacheKey);if(void 0!==program){if(materialProperties.currentProgram===program&&materialProperties.lightsStateVersion===lightsStateVersion)return updateCommonMaterialProperties(material,parameters),program}else parameters.uniforms=programCache.getUniforms(material),material.onBuild(object,parameters,_this),material.onBeforeCompile(parameters,_this),program=programCache.acquireProgram(parameters,programCacheKey),programs.set(programCacheKey,program),materialProperties.uniforms=parameters.uniforms;let uniforms=materialProperties.uniforms;(material.isShaderMaterial||material.isRawShaderMaterial)&&!0!==material.clipping||(uniforms.clippingPlanes=clipping.uniform),updateCommonMaterialProperties(material,parameters),materialProperties.needsLights=material.isMeshLambertMaterial||material.isMeshToonMaterial||material.isMeshPhongMaterial||material.isMeshStandardMaterial||material.isShadowMaterial||material.isShaderMaterial&&!0===material.lights,materialProperties.lightsStateVersion=lightsStateVersion,materialProperties.needsLights&&(uniforms.ambientLightColor.value=lights.state.ambient,uniforms.lightProbe.value=lights.state.probe,uniforms.directionalLights.value=lights.state.directional,uniforms.directionalLightShadows.value=lights.state.directionalShadow,uniforms.spotLights.value=lights.state.spot,uniforms.spotLightShadows.value=lights.state.spotShadow,uniforms.rectAreaLights.value=lights.state.rectArea,uniforms.ltc_1.value=lights.state.rectAreaLTC1,uniforms.ltc_2.value=lights.state.rectAreaLTC2,uniforms.pointLights.value=lights.state.point,uniforms.pointLightShadows.value=lights.state.pointShadow,uniforms.hemisphereLights.value=lights.state.hemi,uniforms.directionalShadowMap.value=lights.state.directionalShadowMap,uniforms.directionalShadowMatrix.value=lights.state.directionalShadowMatrix,uniforms.spotShadowMap.value=lights.state.spotShadowMap,uniforms.spotLightMatrix.value=lights.state.spotLightMatrix,uniforms.spotLightMap.value=lights.state.spotLightMap,uniforms.pointShadowMap.value=lights.state.pointShadowMap,uniforms.pointShadowMatrix.value=lights.state.pointShadowMatrix);let progUniforms=program.getUniforms(),uniformsList=WebGLUniforms.seqWithValue(progUniforms.seq,uniforms);return materialProperties.currentProgram=program,materialProperties.uniformsList=uniformsList,program}function updateCommonMaterialProperties(material,parameters){let materialProperties=properties.get(material);materialProperties.outputEncoding=parameters.outputEncoding,materialProperties.instancing=parameters.instancing,materialProperties.skinning=parameters.skinning,materialProperties.morphTargets=parameters.morphTargets,materialProperties.morphNormals=parameters.morphNormals,materialProperties.morphColors=parameters.morphColors,materialProperties.morphTargetsCount=parameters.morphTargetsCount,materialProperties.numClippingPlanes=parameters.numClippingPlanes,materialProperties.numIntersection=parameters.numClipIntersection,materialProperties.vertexAlphas=parameters.vertexAlphas,materialProperties.vertexTangents=parameters.vertexTangents,materialProperties.toneMapping=parameters.toneMapping}animation.setAnimationLoop(function(time){onAnimationFrameCallback&&onAnimationFrameCallback(time)}),"undefined"!=typeof self&&animation.setContext(self),this.setAnimationLoop=function(callback){onAnimationFrameCallback=callback,xr.setAnimationLoop(callback),null===callback?animation.stop():animation.start()},xr.addEventListener("sessionstart",onXRSessionStart),xr.addEventListener("sessionend",onXRSessionEnd),this.render=function(scene,camera){
186if(void 0!==camera&&!0!==camera.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===_isContextLost)return;!0===scene.matrixWorldAutoUpdate&&scene.updateMatrixWorld(),null===camera.parent&&!0===camera.matrixWorldAutoUpdate&&camera.updateMatrixWorld(),!0===xr.enabled&&!0===xr.isPresenting&&(!0===xr.cameraAutoUpdate&&xr.updateCamera(camera),camera=xr.getCamera()),!0===scene.isScene&&scene.onBeforeRender(_this,scene,camera,_currentRenderTarget),(currentRenderState=renderStates.get(scene,renderStateStack.length)).init(),renderStateStack.push(currentRenderState),_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse),_frustum.setFromProjectionMatrix(_projScreenMatrix),_localClippingEnabled=this.localClippingEnabled,_clippingEnabled=clipping.init(this.clippingPlanes,_localClippingEnabled,camera),(currentRenderList=renderLists.get(scene,renderListStack.length)).init(),renderListStack.push(currentRenderList),function projectObject(object,camera,groupOrder,sortObjects){if(!1===object.visible)return;let visible=object.layers.test(camera.layers);if(visible){if(object.isGroup)groupOrder=object.renderOrder;else if(object.isLOD)!0===object.autoUpdate&&object.update(camera);else if(object.isLight)currentRenderState.pushLight(object),object.castShadow&¤tRenderState.pushShadow(object);else if(object.isSprite){if(!object.frustumCulled||_frustum.intersectsSprite(object)){sortObjects&&_vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);let geometry=objects.update(object),material=object.material;material.visible&¤tRenderList.push(object,geometry,material,groupOrder,_vector3.z,null)}}else if((object.isMesh||object.isLine||object.isPoints)&&(object.isSkinnedMesh&&object.skeleton.frame!==info.render.frame&&(object.skeleton.update(),object.skeleton.frame=info.render.frame),!object.frustumCulled||_frustum.intersectsObject(object))){sortObjects&&_vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);let geometry1=objects.update(object),material1=object.material;if(Array.isArray(material1)){let groups=geometry1.groups;for(let i=0,l=groups.length;i<l;i++){let group=groups[i],groupMaterial=material1[group.materialIndex];groupMaterial&&groupMaterial.visible&¤tRenderList.push(object,geometry1,groupMaterial,groupOrder,_vector3.z,group)}}else material1.visible&¤tRenderList.push(object,geometry1,material1,groupOrder,_vector3.z,null)}}let children=object.children;for(let i1=0,l1=children.length;i1<l1;i1++)projectObject(children[i1],camera,groupOrder,sortObjects)}(scene,camera,0,_this.sortObjects),currentRenderList.finish(),!0===_this.sortObjects&¤tRenderList.sort(_opaqueSort,_transparentSort),!0===_clippingEnabled&&clipping.beginShadows();let shadowsArray=currentRenderState.state.shadowsArray;if(shadowMap.render(shadowsArray,scene,camera),!0===_clippingEnabled&&clipping.endShadows(),!0===this.info.autoReset&&this.info.reset(),background.render(currentRenderList,scene),currentRenderState.setupLights(_this.physicallyCorrectLights),camera.isArrayCamera){let cameras=camera.cameras;for(let i=0,l=cameras.length;i<l;i++){let camera2=cameras[i];renderScene(currentRenderList,scene,camera2,camera2.viewport)}}else renderScene(currentRenderList,scene,camera);null!==_currentRenderTarget&&(textures.updateMultisampleRenderTarget(_currentRenderTarget),textures.updateRenderTargetMipmap(_currentRenderTarget)),!0===scene.isScene&&scene.onAfterRender(_this,scene,camera),bindingStates.resetDefaultState(),_currentMaterialId=-1,_currentCamera=null,renderStateStack.pop(),currentRenderState=renderStateStack.length>0?renderStateStack[renderStateStack.length-1]:null,renderListStack.pop(),currentRenderList=renderListStack.length>0?renderListStack[renderListStack.length-1]:null},this.getActiveCubeFace=function(){return _currentActiveCubeFace},this.getActiveMipmapLevel=function(){return _currentActiveMipmapLevel},this.getRenderTarget=function(){return _currentRenderTarget},this.setRenderTargetTextures=function(renderTarget,colorTexture,depthTexture){properties.get(renderTarget.texture).__webglTexture=colorTexture,properties.get(renderTarget.depthTexture).__webglTexture=depthTexture;let renderTargetProperties=properties.get(renderTarget);renderTargetProperties.__hasExternalTextures=!0,renderTargetProperties.__hasExternalTextures&&(renderTargetProperties.__autoAllocateDepthBuffer=void 0===depthTexture,renderTargetProperties.__autoAllocateDepthBuffer||!0!==extensions.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),renderTargetProperties.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(renderTarget,defaultFramebuffer){let renderTargetProperties=properties.get(renderTarget);renderTargetProperties.__webglFramebuffer=defaultFramebuffer,renderTargetProperties.__useDefaultFramebuffer=void 0===defaultFramebuffer},this.setRenderTarget=function(renderTarget,activeCubeFace=0,activeMipmapLevel=0){_currentRenderTarget=renderTarget,_currentActiveCubeFace=activeCubeFace,_currentActiveMipmapLevel=activeMipmapLevel;let useDefaultFramebuffer=!0,framebuffer=null,isCube=!1,isRenderTarget3D=!1;if(renderTarget){let renderTargetProperties=properties.get(renderTarget);void 0!==renderTargetProperties.__useDefaultFramebuffer?(state.bindFramebuffer(36160,null),useDefaultFramebuffer=!1):void 0===renderTargetProperties.__webglFramebuffer?textures.setupRenderTarget(renderTarget):renderTargetProperties.__hasExternalTextures&&textures.rebindTextures(renderTarget,properties.get(renderTarget.texture).__webglTexture,properties.get(renderTarget.depthTexture).__webglTexture);let texture=renderTarget.texture;(texture.isData3DTexture||texture.isDataArrayTexture||texture.isCompressedArrayTexture)&&(isRenderTarget3D=!0);let __webglFramebuffer=properties.get(renderTarget).__webglFramebuffer;
186renderTarget.isWebGLCubeRenderTarget?(framebuffer=__webglFramebuffer[activeCubeFace],isCube=!0):framebuffer=capabilities.isWebGL2&&renderTarget.samples>0&&!1===textures.useMultisampledRTT(renderTarget)?properties.get(renderTarget).__webglMultisampledFramebuffer:__webglFramebuffer,_currentViewport.copy(renderTarget.viewport),_currentScissor.copy(renderTarget.scissor),_currentScissorTest=renderTarget.scissorTest}else _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor(),_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor(),_currentScissorTest=_scissorTest;let framebufferBound=state.bindFramebuffer(36160,framebuffer);if(framebufferBound&&capabilities.drawBuffers&&useDefaultFramebuffer&&state.drawBuffers(renderTarget,framebuffer),state.viewport(_currentViewport),state.scissor(_currentScissor),state.setScissorTest(_currentScissorTest),isCube){let textureProperties=properties.get(renderTarget.texture);_gl.framebufferTexture2D(36160,36064,34069+activeCubeFace,textureProperties.__webglTexture,activeMipmapLevel)}else if(isRenderTarget3D){let textureProperties1=properties.get(renderTarget.texture);_gl.framebufferTextureLayer(36160,36064,textureProperties1.__webglTexture,activeMipmapLevel||0,activeCubeFace||0)}_currentMaterialId=-1},this.readRenderTargetPixels=function(renderTarget,x,y,width,height,buffer,activeCubeFaceIndex){if(!(renderTarget&&renderTarget.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let framebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget.isWebGLCubeRenderTarget&&void 0!==activeCubeFaceIndex&&(framebuffer=framebuffer[activeCubeFaceIndex]),framebuffer){state.bindFramebuffer(36160,framebuffer);try{let texture=renderTarget.texture,textureFormat=texture.format,textureType=texture.type;if(textureFormat!==RGBAFormat&&utils.convert(textureFormat)!==_gl.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let halfFloatSupportedByExt=textureType===HalfFloatType&&(extensions.has("EXT_color_buffer_half_float")||capabilities.isWebGL2&&extensions.has("EXT_color_buffer_float"));if(textureType!==UnsignedByteType&&utils.convert(textureType)!==_gl.getParameter(35738)&&!(textureType===FloatType&&(capabilities.isWebGL2||extensions.has("OES_texture_float")||extensions.has("WEBGL_color_buffer_float")))&&!halfFloatSupportedByExt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}x>=0&&x<=renderTarget.width-width&&y>=0&&y<=renderTarget.height-height&&_gl.readPixels(x,y,width,height,utils.convert(textureFormat),utils.convert(textureType),buffer)}finally{let framebuffer1=null!==_currentRenderTarget?properties.get(_currentRenderTarget).__webglFramebuffer:null;state.bindFramebuffer(36160,framebuffer1)}}},this.copyFramebufferToTexture=function(position,texture,level=0){let levelScale=Math.pow(2,-level),width=Math.floor(texture.image.width*levelScale),height=Math.floor(texture.image.height*levelScale);textures.setTexture2D(texture,0),_gl.copyTexSubImage2D(3553,level,0,0,position.x,position.y,width,height),state.unbindTexture()},this.copyTextureToTexture=function(position,srcTexture,dstTexture,level=0){let width=srcTexture.image.width,height=srcTexture.image.height,glFormat=utils.convert(dstTexture.format),glType=utils.convert(dstTexture.type);textures.setTexture2D(dstTexture,0),_gl.pixelStorei(37440,dstTexture.flipY),_gl.pixelStorei(37441,dstTexture.premultiplyAlpha),_gl.pixelStorei(3317,dstTexture.unpackAlignment),srcTexture.isDataTexture?_gl.texSubImage2D(3553,level,position.x,position.y,width,height,glFormat,glType,srcTexture.image.data):srcTexture.isCompressedTexture?_gl.compressedTexSubImage2D(3553,level,position.x,position.y,srcTexture.mipmaps[0].width,srcTexture.mipmaps[0].height,glFormat,srcTexture.mipmaps[0].data):_gl.texSubImage2D(3553,level,position.x,position.y,glFormat,glType,srcTexture.image),0===level&&dstTexture.generateMipmaps&&_gl.generateMipmap(3553),state.unbindTexture()},this.copyTextureToTexture3D=function(sourceBox,position,srcTexture,dstTexture,level=0){let glTarget;
vendor: 11,724 bytes, line 186
186if(_this.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let width=sourceBox.max.x-sourceBox.min.x+1,height=sourceBox.max.y-sourceBox.min.y+1,depth=sourceBox.max.z-sourceBox.min.z+1,glFormat=utils.convert(dstTexture.format),glType=utils.convert(dstTexture.type);if(dstTexture.isData3DTexture)textures.setTexture3D(dstTexture,0),glTarget=32879;else if(dstTexture.isDataArrayTexture)textures.setTexture2DArray(dstTexture,0),glTarget=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}_gl.pixelStorei(37440,dstTexture.flipY),_gl.pixelStorei(37441,dstTexture.premultiplyAlpha),_gl.pixelStorei(3317,dstTexture.unpackAlignment);let unpackRowLen=_gl.getParameter(3314),unpackImageHeight=_gl.getParameter(32878),unpackSkipPixels=_gl.getParameter(3316),unpackSkipRows=_gl.getParameter(3315),unpackSkipImages=_gl.getParameter(32877),image=srcTexture.isCompressedTexture?srcTexture.mipmaps[0]:srcTexture.image;_gl.pixelStorei(3314,image.width),_gl.pixelStorei(32878,image.height),_gl.pixelStorei(3316,sourceBox.min.x),_gl.pixelStorei(3315,sourceBox.min.y),_gl.pixelStorei(32877,sourceBox.min.z),srcTexture.isDataTexture||srcTexture.isData3DTexture?_gl.texSubImage3D(glTarget,level,position.x,position.y,position.z,width,height,depth,glFormat,glType,image.data):srcTexture.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_gl.compressedTexSubImage3D(glTarget,level,position.x,position.y,position.z,width,height,depth,glFormat,image.data)):_gl.texSubImage3D(glTarget,level,position.x,position.y,position.z,width,height,depth,glFormat,glType,image),_gl.pixelStorei(3314,unpackRowLen),_gl.pixelStorei(32878,unpackImageHeight),_gl.pixelStorei(3316,unpackSkipPixels),_gl.pixelStorei(3315,unpackSkipRows),_gl.pixelStorei(32877,unpackSkipImages),0===level&&dstTexture.generateMipmaps&&_gl.generateMipmap(glTarget),state.unbindTexture()},this.initTexture=function(texture){texture.isCubeTexture?textures.setTextureCube(texture,0):texture.isData3DTexture?textures.setTexture3D(texture,0):texture.isDataArrayTexture||texture.isCompressedArrayTexture?textures.setTexture2DArray(texture,0):textures.setTexture2D(texture,0),state.unbindTexture()},this.resetState=function(){_currentActiveCubeFace=0,_currentActiveMipmapLevel=0,_currentRenderTarget=null,state.reset(),bindingStates.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends WebGLRenderer{}).prototype.isWebGL1Renderer=!0;class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(source,recursive){return super.copy(source,recursive),null!==source.background&&(this.background=source.background.clone()),null!==source.environment&&(this.environment=source.environment.clone()),null!==source.fog&&(this.fog=source.fog.clone()),this.backgroundBlurriness=source.backgroundBlurriness,null!==source.overrideMaterial&&(this.overrideMaterial=source.overrideMaterial.clone()),this.matrixAutoUpdate=source.matrixAutoUpdate,this}toJSON(meta){let data=super.toJSON(meta);return null!==this.fog&&(data.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(data.backgroundBlurriness=this.backgroundBlurriness),data}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(value){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=value}}class InterleavedBuffer{constructor(array,stride){this.isInterleavedBuffer=!0,this.array=array,this.stride=stride,this.count=void 0!==array?array.length/stride:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(value){!0===value&&this.version++}setUsage(value){return this.usage=value,this}copy(source){return this.array=new source.array.constructor(source.array),this.count=source.count,this.stride=source.stride,this.usage=source.usage,this}copyAt(index1,attribute,index2){index1*=this.stride,index2*=attribute.stride;for(let i=0,l=this.stride;i<l;i++)this.array[index1+i]=attribute.array[index2+i];return this}set(value,offset=0){return this.array.set(value,offset),this}clone(data){void 0===data.arrayBuffers&&(data.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===data.arrayBuffers[this.array.buffer._uuid]&&(data.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let array=new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]),ib=new this.constructor(array,this.stride);return ib.setUsage(this.usage),ib}onUpload(callback){return this.onUploadCallback=callback,this}toJSON(data){return void 0===data.arrayBuffers&&(data.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===data.arrayBuffers[this.array.buffer._uuid]&&(data.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let _vector$6=new Vector3;class InterleavedBufferAttribute{constructor(interleavedBuffer,itemSize,offset,normalized=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=interleavedBuffer,this.itemSize=itemSize,this.offset=offset,this.normalized=!0===normalized}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(value){this.data.needsUpdate=value}applyMatrix4(m){for(let i=0,l=this.data.count;i<l;i++)_vector$6.fromBufferAttribute(this,i),_vector$6.applyMatrix4(m),this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(m){for(let i=0,l=this.count;i<l;i++)_vector$6.fromBufferAttribute(this,i),_vector$6.applyNormalMatrix(m),this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(m){for(let i=0,l=this.count;i<l;i++)_vector$6.fromBufferAttribute(this,i),_vector$6.transformDirection(m),this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);return this}setX(index,x){return this.normalized&&(x=normalize(x,this.array)),this.data.array[index*this.data.stride+this.offset]=x,this}setY(index,y){return this.normalized&&(y=normalize(y,this.array)),this.data.array[index*this.data.stride+this.offset+1]=y,this}setZ(index,z){return this.normalized&&(z=normalize(z,this.array)),this.data.array[index*this.data.stride+this.offset+2]=z,this}setW(index,w){return this.normalized&&(w=normalize(w,this.array)),this.data.array[index*this.data.stride+this.offset+3]=w,this}getX(index){let x=this.data.array[index*this.data.stride+this.offset];return this.normalized&&(x=denormalize(x,this.array)),x}getY(index){let y=this.data.array[index*this.data.stride+this.offset+1];return this.normalized&&(y=denormalize(y,this.array)),y}getZ(index){let z=this.data.array[index*this.data.stride+this.offset+2];return this.normalized&&(z=denormalize(z,this.array)),z}getW(index){let w=this.data.array[index*this.data.stride+this.offset+3];return this.normalized&&(w=denormalize(w,this.array)),w}setXY(index,x,y){return index=index*this.data.stride+this.offset,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array)),this.data.array[index+0]=x,this.data.array[index+1]=y,this}setXYZ(index,x,y,z){return index=index*this.data.stride+this.offset,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array),z=normalize(z,this.array)),this.data.array[index+0]=x,this.data.array[index+1]=y,this.data.array[index+2]=z,this}setXYZW(index,x,y,z,w){return index=index*this.data.stride+this.offset,this.normalized&&(x=normalize(x,this.array),y=normalize(y,this.array),z=normalize(z,this.array),w=normalize(w,this.array)),this.data.array[index+0]=x,this.data.array[index+1]=y,this.data.array[index+2]=z,this.data.array[index+3]=w,this}clone(data){if(void 0!==data)return void 0===data.interleavedBuffers&&(data.interleavedBuffers={}),void 0===data.interleavedBuffers[this.data.uuid]&&(data.interleavedBuffers[this.data.uuid]=this.data.clone(data)),new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");let array=[];for(let i=0;i<this.count;i++){let index=i*this.data.stride+this.offset;for(let j=0;j<this.itemSize;j++)array.push(this.data.array[index+j])}return new BufferAttribute(new this.array.constructor(array),this.itemSize,this.normalized)}}toJSON(data){if(void 0!==data)return void 0===data.interleavedBuffers&&(data.interleavedBuffers={}),void 0===data.interleavedBuffers[this.data.uuid]&&(data.interleavedBuffers[this.data.uuid]=this.data.toJSON(data)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");let array=[];for(let i=0;i<this.count;i++){let index=i*this.data.stride+this.offset;for(let j=0;j<this.itemSize;j++)array.push(this.data.array[index+j])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:array,normalized:this.normalized}}}}let _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector$5=new Vector3,_matrix=new Matrix4;class SkinnedMesh extends Mesh{constructor(geometry,material){super(geometry,material),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4}copy(source,recursive){return super.copy(source,recursive),this.bindMode=source.bindMode,this.bindMatrix.copy(source.bindMatrix),this.bindMatrixInverse.copy(source.bindMatrixInverse),this.skeleton=source.skeleton,this}bind(skeleton,bindMatrix){this.skeleton=skeleton,void 0===bindMatrix&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),bindMatrix=this.matrixWorld),this.bindMatrix.copy(bindMatrix),this.bindMatrixInverse.copy(bindMatrix).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let vector=new Vector4,skinWeight=this.geometry.attributes.skinWeight;for(let i=0,l=skinWeight.count;i<l;i++){vector.fromBufferAttribute(skinWeight,i);let scale=1/vector.manhattanLength();scale!==1/0?vector.multiplyScalar(scale):vector.set(1,0,0,0),skinWeight.setXYZW(i,vector.x,vector.y,vector.z,vector.w)}}updateMatrixWorld(force){super.updateMatrixWorld(force),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(index,target){let skeleton=this.skeleton,geometry=this.geometry;_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex,index),_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight,index),_basePosition.copy(target).applyMatrix4(this.bindMatrix),target.set(0,0,0);for(let i=0;i<4;i++){let weight=_skinWeight.getComponent(i);if(0!==weight){let boneIndex=_skinIndex.getComponent(i);_matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld,skeleton.boneInverses[boneIndex]),target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix),weight)}}
vendor: 4,747 bytes, line 186
186return target.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(data=null,width=1,height=1,format,type,mapping,wrapS,wrapT,magFilter=NearestFilter,minFilter=NearestFilter,anisotropy,encoding){super(null,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,encoding),this.isDataTexture=!0,this.image={data:data,width:width,height:height},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let _offsetMatrix=new Matrix4,_identityMatrix=new Matrix4;class Skeleton{constructor(bones=[],boneInverses=[]){this.uuid=generateUUID(),this.bones=bones.slice(0),this.boneInverses=boneInverses,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let bones=this.bones,boneInverses=this.boneInverses;if(this.boneMatrices=new Float32Array(16*bones.length),0===boneInverses.length)this.calculateInverses();else if(bones.length!==boneInverses.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,il=this.bones.length;i<il;i++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let i=0,il=this.bones.length;i<il;i++){let inverse=new Matrix4;this.bones[i]&&inverse.copy(this.bones[i].matrixWorld).invert(),this.boneInverses.push(inverse)}}pose(){for(let i=0,il=this.bones.length;i<il;i++){let bone=this.bones[i];bone&&bone.matrixWorld.copy(this.boneInverses[i]).invert()}for(let i1=0,il1=this.bones.length;i1<il1;i1++){let bone1=this.bones[i1];bone1&&(bone1.parent&&bone1.parent.isBone?(bone1.matrix.copy(bone1.parent.matrixWorld).invert(),bone1.matrix.multiply(bone1.matrixWorld)):bone1.matrix.copy(bone1.matrixWorld),bone1.matrix.decompose(bone1.position,bone1.quaternion,bone1.scale))}}update(){let bones=this.bones,boneInverses=this.boneInverses,boneMatrices=this.boneMatrices,boneTexture=this.boneTexture;for(let i=0,il=bones.length;i<il;i++){let matrix=bones[i]?bones[i].matrixWorld:_identityMatrix;_offsetMatrix.multiplyMatrices(matrix,boneInverses[i]),_offsetMatrix.toArray(boneMatrices,16*i)}null!==boneTexture&&(boneTexture.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let size=Math.sqrt(4*this.bones.length);size=Math.max(size=ceilPowerOfTwo(size),4);let boneMatrices=new Float32Array(size*size*4);boneMatrices.set(this.boneMatrices);let boneTexture=new DataTexture(boneMatrices,size,size,RGBAFormat,FloatType);return boneTexture.needsUpdate=!0,this.boneMatrices=boneMatrices,this.boneTexture=boneTexture,this.boneTextureSize=size,this}getBoneByName(name){for(let i=0,il=this.bones.length;i<il;i++){let bone=this.bones[i];if(bone.name===name)return bone}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(json,bones){this.uuid=json.uuid;for(let i=0,l=json.bones.length;i<l;i++){let uuid=json.bones[i],bone=bones[uuid];void 0===bone&&(console.warn("THREE.Skeleton: No bone found with UUID:",uuid),bone=new Bone),this.bones.push(bone),this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i]))}return this.init(),this}toJSON(){let data={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};data.uuid=this.uuid;let bones=this.bones,boneInverses=this.boneInverses;for(let i=0,l=bones.length;i<l;i++){let bone=bones[i];data.bones.push(bone.uuid);let boneInverse=boneInverses[i];data.boneInverses.push(boneInverse.toArray())}return data}}class InstancedBufferAttribute extends BufferAttribute{constructor(array,itemSize,normalized,meshPerAttribute=1){super(array,itemSize,normalized),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=meshPerAttribute}copy(source){return super.copy(source),this.meshPerAttribute=source.meshPerAttribute,this}toJSON(){let data=super.toJSON();return data.meshPerAttribute=this.meshPerAttribute,data.isInstancedBufferAttribute=!0,data}}let _instanceLocalMatrix=new Matrix4,_instanceWorldMatrix=new Matrix4,_instanceIntersects=[],_identity=new Matrix4,_mesh=new Mesh;class InstancedMesh extends Mesh{constructor(geometry,material,count){super(geometry,material),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(16*count),16),this.instanceColor=null,this.count=count,this.frustumCulled=!1;for(let i=0;i<count;i++)this.setMatrixAt(i,_identity)}copy(source,recursive){return super.copy(source,recursive),this.instanceMatrix.copy(source.instanceMatrix),null!==source.instanceColor&&(this.instanceColor=source.instanceColor.clone()),this.count=source.count,this}getColorAt(index,color){color.fromArray(this.instanceColor.array,3*index)}
vendor: 10,017 bytes, line 186
186getMatrixAt(index,matrix){matrix.fromArray(this.instanceMatrix.array,16*index)}raycast(raycaster,intersects){let matrixWorld=this.matrixWorld,raycastTimes=this.count;if(_mesh.geometry=this.geometry,_mesh.material=this.material,void 0!==_mesh.material)for(let instanceId=0;instanceId<raycastTimes;instanceId++){this.getMatrixAt(instanceId,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(matrixWorld,_instanceLocalMatrix),_mesh.matrixWorld=_instanceWorldMatrix,_mesh.raycast(raycaster,_instanceIntersects);for(let i=0,l=_instanceIntersects.length;i<l;i++){let intersect=_instanceIntersects[i];intersect.instanceId=instanceId,intersect.object=this,intersects.push(intersect)}_instanceIntersects.length=0}}setColorAt(index,color){null===this.instanceColor&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(3*this.instanceMatrix.count),3)),color.toArray(this.instanceColor.array,3*index)}setMatrixAt(index,matrix){matrix.toArray(this.instanceMatrix.array,16*index)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class LineBasicMaterial extends Material{constructor(parameters){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(parameters)}copy(source){return super.copy(source),this.color.copy(source.color),this.linewidth=source.linewidth,this.linecap=source.linecap,this.linejoin=source.linejoin,this.fog=source.fog,this}}let _start$1=new Vector3,_end$1=new Vector3,_inverseMatrix$1=new Matrix4,_ray$1=new Ray,_sphere$1=new Sphere;class Line extends Object3D{constructor(geometry=new BufferGeometry,material=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=geometry,this.material=material,this.updateMorphTargets()}copy(source,recursive){return super.copy(source,recursive),this.material=source.material,this.geometry=source.geometry,this}computeLineDistances(){let geometry=this.geometry;if(null===geometry.index){let positionAttribute=geometry.attributes.position,lineDistances=[0];for(let i=1,l=positionAttribute.count;i<l;i++)_start$1.fromBufferAttribute(positionAttribute,i-1),_end$1.fromBufferAttribute(positionAttribute,i),lineDistances[i]=lineDistances[i-1],lineDistances[i]+=_start$1.distanceTo(_end$1);geometry.setAttribute("lineDistance",new Float32BufferAttribute(lineDistances,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(raycaster,intersects){let geometry=this.geometry,matrixWorld=this.matrixWorld,threshold=raycaster.params.Line.threshold,drawRange=geometry.drawRange;if(null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere$1.copy(geometry.boundingSphere),_sphere$1.applyMatrix4(matrixWorld),_sphere$1.radius+=threshold,!1===raycaster.ray.intersectsSphere(_sphere$1))return;_inverseMatrix$1.copy(matrixWorld).invert(),_ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);let localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3),localThresholdSq=localThreshold*localThreshold,vStart=new Vector3,vEnd=new Vector3,interSegment=new Vector3,interRay=new Vector3,step=this.isLineSegments?2:1,index=geometry.index,attributes=geometry.attributes,positionAttribute=attributes.position;if(null!==index){let start=Math.max(0,drawRange.start),end=Math.min(index.count,drawRange.start+drawRange.count);for(let i=start,l=end-1;i<l;i+=step){let a=index.getX(i),b=index.getX(i+1);vStart.fromBufferAttribute(positionAttribute,a),vEnd.fromBufferAttribute(positionAttribute,b);let distSq=_ray$1.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(distSq>localThresholdSq)continue;interRay.applyMatrix4(this.matrixWorld);let distance=raycaster.ray.origin.distanceTo(interRay);distance<raycaster.near||distance>raycaster.far||intersects.push({distance:distance,point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{let start1=Math.max(0,drawRange.start),end1=Math.min(positionAttribute.count,drawRange.start+drawRange.count);for(let i1=start1,l1=end1-1;i1<l1;i1+=step){vStart.fromBufferAttribute(positionAttribute,i1),vEnd.fromBufferAttribute(positionAttribute,i1+1);let distSq1=_ray$1.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(distSq1>localThresholdSq)continue;interRay.applyMatrix4(this.matrixWorld);let distance1=raycaster.ray.origin.distanceTo(interRay);distance1<raycaster.near||distance1>raycaster.far||intersects.push({distance:distance1,point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i1,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let geometry=this.geometry,morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(keys.length>0){let morphAttribute=morphAttributes[keys[0]];if(void 0!==morphAttribute){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){let name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m}}}}}let _start=new Vector3,_end=new Vector3;class LineSegments extends Line{constructor(geometry,material){super(geometry,material),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let geometry=this.geometry;if(null===geometry.index){let positionAttribute=geometry.attributes.position,lineDistances=[];for(let i=0,l=positionAttribute.count;i<l;i+=2)_start.fromBufferAttribute(positionAttribute,i),_end.fromBufferAttribute(positionAttribute,i+1),lineDistances[i]=0===i?0:lineDistances[i-1],lineDistances[i+1]=lineDistances[i]+_start.distanceTo(_end);geometry.setAttribute("lineDistance",new Float32BufferAttribute(lineDistances,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(geometry,material){super(geometry,material),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(parameters){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(parameters)}copy(source){return super.copy(source),this.color.copy(source.color),this.map=source.map,this.alphaMap=source.alphaMap,this.size=source.size,this.sizeAttenuation=source.sizeAttenuation,this.fog=source.fog,this}}let _inverseMatrix=new Matrix4,_ray=new Ray,_sphere=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(geometry=new BufferGeometry,material=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=geometry,this.material=material,this.updateMorphTargets()}copy(source,recursive){return super.copy(source,recursive),this.material=source.material,this.geometry=source.geometry,this}raycast(raycaster,intersects){let geometry=this.geometry,matrixWorld=this.matrixWorld,threshold=raycaster.params.Points.threshold,drawRange=geometry.drawRange;if(null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere.copy(geometry.boundingSphere),_sphere.applyMatrix4(matrixWorld),_sphere.radius+=threshold,!1===raycaster.ray.intersectsSphere(_sphere))return;_inverseMatrix.copy(matrixWorld).invert(),_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);let localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3),localThresholdSq=localThreshold*localThreshold,index=geometry.index,attributes=geometry.attributes,positionAttribute=attributes.position;if(null!==index){let start=Math.max(0,drawRange.start),end=Math.min(index.count,drawRange.start+drawRange.count);for(let i=start;i<end;i++){let a=index.getX(i);_position$2.fromBufferAttribute(positionAttribute,a),testPoint(_position$2,a,localThresholdSq,matrixWorld,raycaster,intersects,this)}}else{let start1=Math.max(0,drawRange.start),end1=Math.min(positionAttribute.count,drawRange.start+drawRange.count);for(let i1=start1;i1<end1;i1++)_position$2.fromBufferAttribute(positionAttribute,i1),testPoint(_position$2,i1,localThresholdSq,matrixWorld,raycaster,intersects,this)}}updateMorphTargets(){let geometry=this.geometry,morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(keys.length>0){let morphAttribute=morphAttributes[keys[0]];if(void 0!==morphAttribute){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){let name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m}}}}}function testPoint(point,index,localThresholdSq,matrixWorld,raycaster,intersects,object){let rayPointDistanceSq=_ray.distanceSqToPoint(point);if(rayPointDistanceSq<localThresholdSq){let intersectPoint=new Vector3;_ray.closestPointToPoint(point,intersectPoint),intersectPoint.applyMatrix4(matrixWorld);let distance=raycaster.ray.origin.distanceTo(intersectPoint);if(distance<raycaster.near||distance>raycaster.far)return;intersects.push({distance:distance,distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint,index:index,face:null,object:object})}}class CompressedTexture extends Texture{constructor(mipmaps,width,height,format,type,mapping,wrapS,wrapT,magFilter,minFilter,anisotropy,encoding){super(null,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,encoding),this.isCompressedTexture=!0,this.image={width:width,height:height},this.mipmaps=mipmaps,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(mipmaps,width,height,depth,format,type){super(mipmaps,width,height,format,type),this.isCompressedArrayTexture=!0,this.image.depth=depth,this.wrapR=ClampToEdgeWrapping}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(u,optionalTarget){let t=this.getUtoTmapping(u);return this.getPoint(t,optionalTarget)}
186getPoints(divisions=5){let points=[];for(let d=0;d<=divisions;d++)points.push(this.getPoint(d/divisions));return points}getSpacedPoints(divisions=5){let points=[];for(let d=0;d<=divisions;d++)points.push(this.getPointAt(d/divisions));return points}getLength(){let lengths=this.getLengths();return lengths[lengths.length-1]}getLengths(divisions=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===divisions+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let cache=[],current,last=this.getPoint(0),sum=0;cache.push(0);for(let p=1;p<=divisions;p++)cache.push(sum+=(current=this.getPoint(p/divisions)).distanceTo(last)),last=current;return this.cacheArcLengths=cache,cache}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(u,distance){let targetArcLength;let arcLengths=this.getLengths(),i=0,il=arcLengths.length;targetArcLength=distance||u*arcLengths[il-1];let low=0,high=il-1,comparison;for(;low<=high;)if((comparison=arcLengths[i=Math.floor(low+(high-low)/2)]-targetArcLength)<0)low=i+1;else if(comparison>0)high=i-1;else{high=i;break}if(arcLengths[i=high]===targetArcLength)return i/(il-1);let lengthBefore=arcLengths[i],lengthAfter=arcLengths[i+1],t=(i+(targetArcLength-lengthBefore)/(lengthAfter-lengthBefore))/(il-1);return t}getTangent(t,optionalTarget){let t1=t-1e-4,t2=t+1e-4;t1<0&&(t1=0),t2>1&&(t2=1);let pt1=this.getPoint(t1),pt2=this.getPoint(t2),tangent=optionalTarget||(pt1.isVector2?new Vector2:new Vector3);return tangent.copy(pt2).sub(pt1).normalize(),tangent}getTangentAt(u,optionalTarget){let t=this.getUtoTmapping(u);return this.getTangent(t,optionalTarget)}computeFrenetFrames(segments,closed){let normal=new Vector3,tangents=[],normals=[],binormals=[],vec=new Vector3,mat=new Matrix4;for(let i=0;i<=segments;i++){let u=i/segments;tangents[i]=this.getTangentAt(u,new Vector3)}normals[0]=new Vector3,binormals[0]=new Vector3;let min=Number.MAX_VALUE,tx=Math.abs(tangents[0].x),ty=Math.abs(tangents[0].y),tz=Math.abs(tangents[0].z);tx<=min&&(min=tx,normal.set(1,0,0)),ty<=min&&(min=ty,normal.set(0,1,0)),tz<=min&&normal.set(0,0,1),vec.crossVectors(tangents[0],normal).normalize(),normals[0].crossVectors(tangents[0],vec),binormals[0].crossVectors(tangents[0],normals[0]);for(let i1=1;i1<=segments;i1++){if(normals[i1]=normals[i1-1].clone(),binormals[i1]=binormals[i1-1].clone(),vec.crossVectors(tangents[i1-1],tangents[i1]),vec.length()>Number.EPSILON){vec.normalize();let theta=Math.acos(clamp(tangents[i1-1].dot(tangents[i1]),-1,1));normals[i1].applyMatrix4(mat.makeRotationAxis(vec,theta))}binormals[i1].crossVectors(tangents[i1],normals[i1])}if(!0===closed){let theta1=Math.acos(clamp(normals[0].dot(normals[segments]),-1,1));theta1/=segments,tangents[0].dot(vec.crossVectors(normals[0],normals[segments]))>0&&(theta1=-theta1);for(let i2=1;i2<=segments;i2++)normals[i2].applyMatrix4(mat.makeRotationAxis(tangents[i2],theta1*i2)),binormals[i2].crossVectors(tangents[i2],normals[i2])}return{tangents:tangents,normals:normals,binormals:binormals}}clone(){return new this.constructor().copy(this)}copy(source){return this.arcLengthDivisions=source.arcLengthDivisions,this}toJSON(){let data={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return data.arcLengthDivisions=this.arcLengthDivisions,data.type=this.t
186ype,data}fromJSON(json){return this.arcLengthDivisions=json.arcLengthDivisions,this}}class EllipseCurve extends Curve{constructor(aX=0,aY=0,xRadius=1,yRadius=1,aStartAngle=0,aEndAngle=2*Math.PI,aClockwise=!1,aRotation=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=aX,this.aY=aY,this.xRadius=xRadius,this.yRadius=yRadius,this.aStartAngle=aStartAngle,this.aEndAngle=aEndAngle,this.aClockwise=aClockwise,this.aRotation=aRotation}getPoint(t,optionalTarget){let point=optionalTarget||new Vector2,twoPi=2*Math.PI,deltaAngle=this.aEndAngle-this.aStartAngle,samePoints=Math.abs(deltaAngle)<Number.EPSILON;for(;deltaAngle<0;)deltaAngle+=twoPi;for(;deltaAngle>twoPi;)deltaAngle-=twoPi;deltaAngle<Number.EPSILON&&(deltaAngle=samePoints?0:twoPi),!0!==this.aClockwise||samePoints||(deltaAngle===twoPi?deltaAngle=-twoPi:deltaAngle-=twoPi);let angle=this.aStartAngle+t*deltaAngle,x=this.aX+this.xRadius*Math.cos(angle),y=this.aY+this.yRadius*Math.sin(angle);if(0!==this.aRotation){let cos=Math.cos(this.aRotation),sin=Math.sin(this.aRotation),tx=x-this.aX,ty=y-this.aY;x=tx*cos-ty*sin+this.aX,y=tx*sin+ty*cos+this.aY}return point.set(x,y)}copy(source){return super.copy(source),this.aX=source.aX,this.aY=source.aY,this.xRadius=source.xRadius,this.yRadius=source.yRadius,this.aStartAngle=source.aStartAngle,this.aEndAngle=source.aEndAngle,this.aClockwise=source.aClockwise,this.aRotation=source.aRotation,this}toJSON(){let data=super.toJSON();return data.aX=this.aX,data.aY=this.aY,data.xRadius=this.xRadius,data.yRadius=this.yRadius,data.aStartAngle=this.aStartAngle,data.aEndAngle=this.aEndAngle,data.aClockwise=this.aClockwise,data.aRotation=this.aRotation,data}fromJSON(json){return super.fromJSON(json),this.aX=json.aX,this.aY=json.aY,this.xRadius=json.xRadius,this.yRadius=json.yRadius,this.aStartAngle=json.aStartAngle,this.aEndAngle=json.aEndAngle,this.aClockwise=json.aClockwise,this.aRotation=json.aRotation,this}}function CubicPoly(){let c0=0,c1=0,c2=0,c3=0;function init(x0,x1,t0,t1){c0=x0,c1=t0,c2=-3*x0+3*x1-2*t0-t1,c3=2*x0-2*x1+t0+t1}return{initCatmullRom:function(x0,x1,x2,x3,tension){init(x1,x2,tension*(x2-x0),tension*(x3-x1))},initNonuniformCatmullRom:function(x0,x1,x2,x3,dt0,dt1,dt2){let t1=(x1-x0)/dt0-(x2-x0)/(dt0+dt1)+(x2-x1)/dt1,t2=(x2-x1)/dt1-(x3-x1)/(dt1+dt2)+(x3-x2)/dt2;init(x1,x2,t1*=dt1,t2*=dt1)},calc:function(t){let t2=t*t;return c0+c1*t+c2*t2+c3*(t2*t)}}}let tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;function CatmullRom(t,p0,p1,p2,p3){let v0=(p2-p0)*.5,v1=(p3-p1)*.5,t2=t*t;return(2*p1-2*p2+v0+v1)*(t*t2)+(-3*p1+3*p2-2*v0-v1)*t2+v0*t+p1}function QuadraticBezier(t,p0,p1,p2){return function(t,p){let k=1-t;return k*k*p}(t,p0)+2*(1-t)*t*p1+t*t*p2}function CubicBezier(t,p0,p1,p2,p3){return function(t,p){let k=1-t;return k*k*k*p}(t,p0)+function(t,p){let k=1-t;return 3*k*k*t*p}(t,p1)+3*(1-t)*t*t*p2+t*t*t*p3}class CubicBezierCurve extends Curve{constructor(v0=new Vector2,v1=new Vector2,v2=new Vector2,v3=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=v0,this.v1=v1,this.v2=v2,this.v3=v3}getPoint(t,optionalTarget=new Vector2){let v0=this.v0,v1=this.v1,v2=this.v2,v3=this.v3;return optionalTarget.set(CubicBezier(t,v0.x,v1.x,v2.x,v3.x),CubicBezier(t,v0.y,v1.y,v2.y,v3.y)),optionalTarget}copy(source){return super.copy(source),this.v0.copy(source.v0),this.v1.copy(source.v1),this.v2.copy(source.v2),this.v3.copy(source.v3),this}toJSON(){let data=super.toJSON();return data.v0=this.v0.toArray(),data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data.v3=this.v3.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v0.fromArray(json.v0),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this.v3.fromArray(json.v3),this}}class LineCurve extends Curve{constructor(v1=new Vector2,v2=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=v1,this.v2=v2}getPoint(t,optionalTarget=new Vector2){return 1===t?optionalTarget.copy(this.v2):(optionalTarget.copy(this.v2).sub(this.v1),optionalTarget.multiplyScalar(t).add(this.v1)),optionalTarget}getPointAt(u,optionalTarget){return this.getPoint(u,optionalTarget)}getTangent(t,optionalTarget){let tangent=optionalTarget||new Vector2;return tangent.copy(this.v2).sub(this.v1).normalize(),tangent}copy(source){return super.copy(source),this.v1.copy(source.v1),this.v2.copy(source.v2),this}toJSON(){let data=super.toJSON();return data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this}}class QuadraticBezierCurve extends Curve{constructor(v0=new Vector2,v1=new Vector2,v2=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=v0,this.v1=v1,this.v2=v2}getPoint(t,optionalTarget=new Vector2){let v0=this.v0,v1=this.v1,v2=this.v2;return optionalTarget.set(QuadraticBezier(t,v0.x,v1.x,v2.x),QuadraticBezier(t,v0.y,v1.y,v2.y)),optionalTarget}copy(source){return super.copy(source),this.v0.copy(source.v0),this.v1.copy(source.v1),this.v2.copy(source.v2),this}toJSON(){let data=super.toJSON();return data.v0=this.v0.toArray(),data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v0.fromArray(json.v0),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this}}class QuadraticBezierCurve3 extends Curve{constructor(v0=new Vector3,v1=new Vector3,v2=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=v0,this.v1=v1,this.v2=v2}getPoint(t,optionalTarget=new Vector3){let v0=this.v0,v1=this.v1,v2=this.v2;return optionalTarget.set(QuadraticBezier(t,v0.x,v1.x,v2.x),QuadraticBezier(t,v0.y,v1.y,v2.y),QuadraticBezier(t,v0.z,v1.z,v2.z)),optionalTarget}copy(source){return super.copy(source),this.v0.copy(source.v0),this.v1.copy(source.v1),this.v2.copy(source.v2),this}toJSON(){let data=super.toJSON();return data.v0=this.v0.toArray(),data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v0.fromArray(json.v0),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this}}class SplineCurve extends Curve{constructor(points=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=points}getPoint(t,optionalTarget=new Vector2){let points=this.points,p=(points.length-1)*t,intPoint=Math.floor(p),weight=p-intPoint,p0=points[0===intPoint?intPoint:intPoint-1],p1=points[intPoint],p2=points[intPoint>points.length-2?points.length-1:intPoint+1],p3=points[intPoint>points.length-3?points.length-1:intPoint+2];return optionalTarget.set(CatmullRom(weight,p0.x,p1.x,p2.x,p3.x),CatmullRom(weight,p0.y,p1.y,p2.y,p3.y)),optionalTarget}copy(source){super.copy(source),this.points=[];for(let i=0,l=source.points.length;i<l;i++){let point=source.points[i];this.points.push(point.clone())}return this}toJSON(){let data=super.toJSON();data.points=[];for(let i=0,l=this.points.length;i<l;i++){let point=this.points[i];data.points.push(point.toArray())}return data}fromJSON(json){super.fromJSON(json),this.points=[];for(let i=0,l=json.points.length;i<l;i++){let point=json.points[i];this.points.push(new Vector2().fromArray(point))}return this}}var Curves=Object.freeze({__proto__:null,ArcCurve:class extends
vendor: 9,184 bytes, line 186
186EllipseCurve{constructor(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){super(aX,aY,aRadius,aRadius,aStartAngle,aEndAngle,aClockwise),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Curve{constructor(points=[],closed=!1,curveType="centripetal",tension=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=points,this.closed=closed,this.curveType=curveType,this.tension=tension}getPoint(t,optionalTarget=new Vector3){let p0,p3;let points=this.points,l=points.length,p=(l-(this.closed?0:1))*t,intPoint=Math.floor(p),weight=p-intPoint;this.closed?intPoint+=intPoint>0?0:(Math.floor(Math.abs(intPoint)/l)+1)*l:0===weight&&intPoint===l-1&&(intPoint=l-2,weight=1),this.closed||intPoint>0?p0=points[(intPoint-1)%l]:(tmp.subVectors(points[0],points[1]).add(points[0]),p0=tmp);let p1=points[intPoint%l],p2=points[(intPoint+1)%l];if(this.closed||intPoint+2<l?p3=points[(intPoint+2)%l]:(tmp.subVectors(points[l-1],points[l-2]).add(points[l-1]),p3=tmp),"centripetal"===this.curveType||"chordal"===this.curveType){let pow="chordal"===this.curveType?.5:.25,dt0=Math.pow(p0.distanceToSquared(p1),pow),dt1=Math.pow(p1.distanceToSquared(p2),pow),dt2=Math.pow(p2.distanceToSquared(p3),pow);dt1<1e-4&&(dt1=1),dt0<1e-4&&(dt0=dt1),dt2<1e-4&&(dt2=dt1),px.initNonuniformCatmullRom(p0.x,p1.x,p2.x,p3.x,dt0,dt1,dt2),py.initNonuniformCatmullRom(p0.y,p1.y,p2.y,p3.y,dt0,dt1,dt2),pz.initNonuniformCatmullRom(p0.z,p1.z,p2.z,p3.z,dt0,dt1,dt2)}else"catmullrom"===this.curveType&&(px.initCatmullRom(p0.x,p1.x,p2.x,p3.x,this.tension),py.initCatmullRom(p0.y,p1.y,p2.y,p3.y,this.tension),pz.initCatmullRom(p0.z,p1.z,p2.z,p3.z,this.tension));return optionalTarget.set(px.calc(weight),py.calc(weight),pz.calc(weight)),optionalTarget}copy(source){super.copy(source),this.points=[];for(let i=0,l=source.points.length;i<l;i++){let point=source.points[i];this.points.push(point.clone())}return this.closed=source.closed,this.curveType=source.curveType,this.tension=source.tension,this}toJSON(){let data=super.toJSON();data.points=[];for(let i=0,l=this.points.length;i<l;i++){let point=this.points[i];data.points.push(point.toArray())}return data.closed=this.closed,data.curveType=this.curveType,data.tension=this.tension,data}fromJSON(json){super.fromJSON(json),this.points=[];for(let i=0,l=json.points.length;i<l;i++){let point=json.points[i];this.points.push(new Vector3().fromArray(point))}return this.closed=json.closed,this.curveType=json.curveType,this.tension=json.tension,this}},CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:class extends Curve{constructor(v0=new Vector3,v1=new Vector3,v2=new Vector3,v3=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=v0,this.v1=v1,this.v2=v2,this.v3=v3}getPoint(t,optionalTarget=new Vector3){let v0=this.v0,v1=this.v1,v2=this.v2,v3=this.v3;return optionalTarget.set(CubicBezier(t,v0.x,v1.x,v2.x,v3.x),CubicBezier(t,v0.y,v1.y,v2.y,v3.y),CubicBezier(t,v0.z,v1.z,v2.z,v3.z)),optionalTarget}copy(source){return super.copy(source),this.v0.copy(source.v0),this.v1.copy(source.v1),this.v2.copy(source.v2),this.v3.copy(source.v3),this}toJSON(){let data=super.toJSON();return data.v0=this.v0.toArray(),data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data.v3=this.v3.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v0.fromArray(json.v0),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this.v3.fromArray(json.v3),this}},EllipseCurve:EllipseCurve,LineCurve:LineCurve,LineCurve3:class extends Curve{constructor(v1=new Vector3,v2=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=v1,this.v2=v2}getPoint(t,optionalTarget=new Vector3){return 1===t?optionalTarget.copy(this.v2):(optionalTarget.copy(this.v2).sub(this.v1),optionalTarget.multiplyScalar(t).add(this.v1)),optionalTarget}getPointAt(u,optionalTarget){return this.getPoint(u,optionalTarget)}copy(source){return super.copy(source),this.v1.copy(source.v1),this.v2.copy(source.v2),this}toJSON(){let data=super.toJSON();return data.v1=this.v1.toArray(),data.v2=this.v2.toArray(),data}fromJSON(json){return super.fromJSON(json),this.v1.fromArray(json.v1),this.v2.fromArray(json.v2),this}},QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,SplineCurve:SplineCurve});class CurvePath extends Curve{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(curve){this.curves.push(curve)}closePath(){let startPoint=this.curves[0].getPoint(0),endPoint=this.curves[this.curves.length-1].getPoint(1);startPoint.equals(endPoint)||this.curves.push(new LineCurve(endPoint,startPoint))}getPoint(t,optionalTarget){let d=t*this.getLength(),curveLengths=this.getCurveLengths(),i=0;for(;i<curveLengths.length;){if(curveLengths[i]>=d){let diff=curveLengths[i]-d,curve=this.curves[i],segmentLength=curve.getLength(),u=0===segmentLength?0:1-diff/segmentLength;return curve.getPointAt(u,optionalTarget)}i++}return null}getLength(){let lens=this.getCurveLengths();return lens[lens.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let lengths=[],sums=0;for(let i=0,l=this.curves.length;i<l;i++)lengths.push(sums+=this.curves[i].getLength());return this.cacheLengths=lengths,lengths}getSpacedPoints(divisions=40){let points=[];for(let i=0;i<=divisions;i++)points.push(this.getPoint(i/divisions));return this.autoClose&&points.push(points[0]),points}getPoints(divisions=12){let last;let points=[];for(let i=0,curves=this.curves;i<curves.length;i++){let curve=curves[i],resolution=curve.isEllipseCurve?2*divisions:curve.isLineCurve||curve.isLineCurve3?1:curve.isSplineCurve?divisions*curve.points.length:divisions,pts=curve.getPoints(resolution);for(let j=0;j<pts.length;j++){let point=pts[j];last&&last.equals(point)||(points.push(point),last=point)}}return this.autoClose&&points.length>1&&!points[points.length-1].equals(points[0])&&points.push(points[0]),points}copy(source){super.copy(source),this.curves=[];for(let i=0,l=source.curves.length;i<l;i++){let curve=source.curves[i];this.curves.push(curve.clone())}return this.autoClose=source.autoClose,this}toJSON(){let data=super.toJSON();data.autoClose=this.autoClose,data.curves=[];for(let i=0,l=this.curves.length;i<l;i++){let curve=this.curves[i];data.curves.push(curve.toJSON())}return data}fromJSON(json){super.fromJSON(json),this.autoClose=json.autoClose,this.curves=[];for(let i=0,l=json.curves.length;i<l;i++){let curve=json.curves[i];this.curves.push(new Curves[curve.type]().fromJSON(curve))}return this}}class Path extends CurvePath{constructor(points){super(),this.type="Path",this.currentPoint=new Vector2,points&&this.setFromPoints(points)}setFromPoints(points){this.moveTo(points[0].x,points[0].y);for(let i=1,l=points.length;i<l;i++)this.lineTo(points[i].x,points[i].y);return this}moveTo(x,y){return this.currentPoint.set(x,y),this}lineTo(x,y){let curve=new LineCurve(this.currentPoint.clone(),new Vector2(x,y));return this.curves.push(curve),this.currentPoint.set(x,y),this}quadraticCurveTo(aCPx,aCPy,aX,aY){let curve=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(aCPx,aCPy),new Vector2(aX,aY));return this.curves.push(curve),this.currentPoint.set(aX,aY),this}bezierCurveTo(aCP1x,aCP1y,aCP2x,aCP2y,aX,aY){let curve=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(aCP1x,aCP1y),new Vector2(aCP2x,aCP2y),new Vector2(aX,aY));return this.curves.push(curve),this.currentPoint.set(aX,aY),this}splineThru(pts){let npts=[this.currentPoint.clone()].concat(pts),curve=new SplineCurve(npts);return this.curves.push(curve),this.currentPoint.copy(pts[pts.length-1]),this}arc(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){let x0=this.currentPoint.x,y0=this.currentPoint.y;return this.absarc(aX+x0,aY+y0,aRadius,aStartAngle,aEndAngle,aClockwise),this}absarc(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){return this.absellipse(aX,aY,aRadius,aRadius,aStartAngle,aEndAngle,aClockwise),this}ellipse(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation){let x0=this.currentPoint.x,y0=this.currentPoint.y;return this.absellipse(aX+x0,aY+y0,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation),this}absellipse(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation){let curve=new EllipseCurve(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation);if(this.curves.length>0){let firstPoint=curve.getPoint(0);firstPoint.equals(this.currentPoint)||this.lineTo(firstPoint.x,firstPoint.y)}this.curves.push(curve);let lastPoint=curve.getPoint(1);return this.currentPoint.copy(lastPoint),this}copy(source){return super.copy(source),this.currentPoint.copy(source.currentPoint),this}toJSON(){let data=super.toJSON();return data.currentPoint=this.currentPoint.toArray(),data}fromJSON(json){return super.fromJSON(json),this.currentPoint.fromArray(json.currentPoint),this}}class LatheGeometry extends BufferGeometry{constructor(points=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],segments=12,phiStart=0,phiLength=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:p
186oints,segments:segments,phiStart:phiStart,phiLength:phiLength},segments=Math.floor(segments),phiLength=clamp(phiLength,0,2*Math.PI);let indices=[],vertices=[],uvs=[],initNormals=[],normals=[],inverseSegments=1/segments,vertex=new Vector3,uv=new Vector2,normal=new Vector3,curNormal=new Vector3,prevNormal=new Vector3,dx=0,dy=0;for(let j=0;j<=points.length-1;j++)switch(j){case 0:dx=points[j+1].x-points[j].x,dy=points[j+1].y-points[j].y,normal.x=1*dy,normal.y=-dx,normal.z=0*dy,prevNormal.copy(normal),normal.normalize(),initNormals.push(normal.x,normal.y,normal.z);break;case points.length-1:initNormals.push(prevNormal.x,prevNormal.y,prevNormal.z);break;default:dx=points[j+1].x-points[j].x,dy=points[j+1].y-points[j].y,normal.x=1*dy,normal.y=-dx,normal.z=0*dy,curNormal.copy(normal),normal.x+=prevNormal.x,normal.y+=prevNormal.y,normal.z+=prevNormal.z,normal.normalize(),initNormals.push(normal.x,normal.y,normal.z),prevNormal.copy(curNormal)}for(let i=0;i<=segments;i++){let phi=phiStart+i*inverseSegments*phiLength,sin=Math.sin(phi),cos=Math.cos(phi);for(let j1=0;j1<=points.length-1;j1++){vertex.x=points[j1].x*sin,vertex.y=points[j1].y,vertex.z=points[j1].x*cos,vertices.push(vertex.x,vertex.y,vertex.z),uv.x=i/segments,uv.y=j1/(points.length-1),uvs.push(uv.x,uv.y);let x=initNormals[3*j1+0]*sin,y=initNormals[3*j1+1],z=initNormals[3*j1+0]*cos;normals.push(x,y,z)}}for(let i1=0;i1<segments;i1++)for(let j2=0;j2<points.length-1;j2++){let base=j2+i1*points.length,b=base+points.length,c=base+points.length+1,d=base+1;indices.push(base,b,d),indices.push(c,d,b)}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2)),this.setAttribute("normal",new Float32BufferAttribute(normals,3))}static fromJSON(data){return new LatheGeometry(data.points,data.segments,data.phiStart,data.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(radius=1,length=1,capSegments=4,radialSegments=8){let path=new Path;path.absarc(0,-length/2,radius,1.5*Math.PI,0),path.absarc(0,length/2,radius,0,.5*Math.PI),super(path.getPoints(capSegments),radialSegments),this.type="CapsuleGeometry",this.parameters={radius:radius,height:length,capSegments:capSegments,radialSegments:radialSegments}}static fromJSON(data){return new CapsuleGeometry(data.radius,data.length,data.capSegments,data.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(radius=1,segments=8,thetaStart=0,thetaLength=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:radius,segments:segments,thetaStart:thetaStart,thetaLength:thetaLength},segments=Math.max(3,segments);let indices=[],vertices=[],normals=[],uvs=[],vertex=new Vector3,uv=new Vector2;vertices.push(0,0,0),normals.push(0,0,1),uvs.push(.5,.5);for(let s=0,i=3;s<=segments;s++,i+=3){let segment=thetaStart+s/segments*thetaLength;vertex.x=radius*Math.cos(segment),vertex.y=radius*Math.sin(segment),vertices.push(vertex.x,vertex.y,vertex.z),normals.push(0,0,1),uv.x=(vertices[i]/radius+1)/2,uv.y=(vertices[i+1]/radius+1)/2,uvs.push(uv.x,uv.y)}for(let i1=1;i1<=segments;i1++)indices.push(i1,i1+1,0);this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new CircleGeometry(data.radius,data.segments,data.thetaStart,data.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(radiusTop=1,radiusBottom=1,height=1,radialSegments=8,heightSegments=1,openEnded=!1,thetaStart=0,thetaLength=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:radiusTop,radiusBottom:radiusBottom,height:height,radialSegments:radialSegments,heightSegments:heightSegments,openEnded:openEnded,thetaStart:thetaStart,thetaLength:thetaLength};let scope=this;radialSegments=Math.floor(radialSegments),heightSegments=Math.floor(heightSegments);let indices=[],vertices=[],normals=[],uvs=[],index=0,indexArray=[],halfHeight=height/2,groupStart=0;function generateCap(top){let centerIndexStart=index,uv=new Vector2,vertex=new Vector3,groupCount=0,radius=!0===top?radiu
vendor: 2,417 bytes, line 186
186sTop:radiusBottom,sign=!0===top?1:-1;for(let x=1;x<=radialSegments;x++)vertices.push(0,halfHeight*sign,0),normals.push(0,sign,0),uvs.push(.5,.5),index++;let centerIndexEnd=index;for(let x1=0;x1<=radialSegments;x1++){let u=x1/radialSegments,theta=u*thetaLength+thetaStart,cosTheta=Math.cos(theta),sinTheta=Math.sin(theta);vertex.x=radius*sinTheta,vertex.y=halfHeight*sign,vertex.z=radius*cosTheta,vertices.push(vertex.x,vertex.y,vertex.z),normals.push(0,sign,0),uv.x=.5*cosTheta+.5,uv.y=.5*sinTheta*sign+.5,uvs.push(uv.x,uv.y),index++}for(let x2=0;x2<radialSegments;x2++){let c=centerIndexStart+x2,i=centerIndexEnd+x2;!0===top?indices.push(i,i+1,c):indices.push(i+1,i,c),groupCount+=3}scope.addGroup(groupStart,groupCount,!0===top?1:2),groupStart+=groupCount}(function(){let normal=new Vector3,vertex=new Vector3,groupCount=0,slope=(radiusBottom-radiusTop)/height;for(let y=0;y<=heightSegments;y++){let indexRow=[],v=y/heightSegments,radius=v*(radiusBottom-radiusTop)+radiusTop;for(let x=0;x<=radialSegments;x++){let u=x/radialSegments,theta=u*thetaLength+thetaStart,sinTheta=Math.sin(theta),cosTheta=Math.cos(theta);vertex.x=radius*sinTheta,vertex.y=-v*height+halfHeight,vertex.z=radius*cosTheta,vertices.push(vertex.x,vertex.y,vertex.z),normal.set(sinTheta,slope,cosTheta).normalize(),normals.push(normal.x,normal.y,normal.z),uvs.push(u,1-v),indexRow.push(index++)}indexArray.push(indexRow)}for(let x1=0;x1<radialSegments;x1++)for(let y1=0;y1<heightSegments;y1++){let a=indexArray[y1][x1],b=indexArray[y1+1][x1],c=indexArray[y1+1][x1+1],d=indexArray[y1][x1+1];indices.push(a,b,d),indices.push(b,c,d),groupCount+=6}scope.addGroup(groupStart,groupCount,0),groupStart+=groupCount})(),!1===openEnded&&(radiusTop>0&&generateCap(!0),radiusBottom>0&&generateCap(!1)),this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new CylinderGeometry(data.radiusTop,data.radiusBottom,data.height,data.radialSegments,data.heightSegments,data.openEnded,data.thetaStart,data.thetaLength)}}class ConeGeometry extends CylinderGeometry{constructor(radius=1,height=1,radialSegments=8,heightSegments=1,openEnded=!1,thetaStart=0,thetaLength=2*Math.PI){super(0,radius,height,radialSegments,heightSegments,openEnded,thetaStart,thetaLength),this.type="C
186oneGeometry",this.parameters={radius:radius,height:height,radialSegments:radialSegments,heightSegments:heightSegments,openEnded:openEnded,thetaStart:thetaStart,thetaLength:thetaLength}}static fromJSON(data){return new ConeGeometry(data.radius,data.height,data.radialSegments,data.heightSegments,data.openEnded,data.thetaStart,data.thetaLength)}}class PolyhedronGeometry extends BufferGeometry{constructor(vertices=[],indices=[],radius=1,detail=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:vertices,indices:indices,radius:radius,detail:detail};let vertexBuffer=[],uvBuffer=[];function pushVertex(vertex){vertexBuffer.push(vertex.x,vertex.y,vertex.z)}function getVertexByIndex(index,vertex){let stride=3*index;vertex.x=vertices[stride+0],vertex.y=vertices[stride+1],vertex.z=vertices[stride+2]}function correctUV(uv,stride,vector,azimuth){azimuth<0&&1===uv.x&&(uvBuffer[stride]=uv.x-1),0===vector.x&&0===vector.z&&(uvBuffer[stride]=azimuth/2/Math.PI+.5)}function azimuth(vector){return Math.atan2(vector.z,-vector.x)}(function(detail){let a=new Vector3,b=new Vector3,c=new Vector3;for(let i=0;i<indices.length;i+=3)getVertexByIndex(indices[i+0],a),getVertexByIndex(indices[i+1],b),getVertexByIndex(indices[i+2],c),function(a,b,c,detail){let cols=detail+1,v=[];for(let i=0;i<=cols;i++){v[i]=[];let aj=a.clone().lerp(c,i/cols),bj=b.clone().lerp(c,i/cols),rows=cols-i;for(let j=0;j<=rows;j++)0===j&&i===cols?v[i][j]=aj:v[i][j]=aj.clone().lerp(bj,j/rows)}for(let i1=0;i1<cols;i1++)for(let j1=0;j1<2*(cols-i1)-1;j1++){let k=Math.floor(j1/2);j1%2==0?(pushVertex(v[i1][k+1]),pushVertex(v[i1+1][k]),pushVertex(v[i1][k])):(pushVertex(v[i1][k+1]),pushVertex(v[i1+1][k+1]),pushVertex(v[i1+1][k]))}}(a,b,c,detail)})(detail),function(radius){let vertex=new Vector3;for(let i=0;i<vertexBuffer.length;i+=3)vertex.x=vertexBuffer[i+0],vertex.y=vertexBuffer[i+1],vertex.z=vertexBuffer[i+2],vertex.normalize().multiplyScalar(radius),vertexBuffer[i+0]=vertex.x,vertexBuffer[i+1]=vertex.y,vertexBuffer[i+2]=vertex.z}(radius),function(){let vertex=new Vector3;for(let i=0;i<vertexBuffer.length;i+=3){vertex.x=vertexBuffer[i+0],vertex.y=vertexBuffer[i+1],vertex.z=vertexBuffer[i+2];let u=azimuth(vertex)/2/Math.PI+.5,v=Math.atan2(-vertex.y,Math.sqrt(vertex.x*vertex.x+vertex.z*vertex.z))/Math.PI+.5;uvBuffer.push(u,1-v)}(function(){let a=new Vector3,b=new Vector3,c=new Vector3,centroid=new Vector3,uvA=new Vector2,uvB=new Vector2,uvC=new Vector2;for(let i=0,j=0;i<vertexBuffer.length;i+=9,j+=6){a.set(vertexBuffer[i+0],vertexBuffer[i+1],vertexBuffer[i+2]),b.set(vertexBuffer[i+3],vertexBuffer[i+4],vertexBuffer[i+5]),c.set(vertexBuffer[i+6],vertexBuffer[i+7],vertexBuffer[i+8]),uvA.set(uvBuffer[j+0],uvBuffer[j+1]),uvB.set(uvBuffer[j+2],uvBuffer[j+3]),uvC.set(uvBuffer[j+4],uvBuffer[j+5]),centroid.copy(a).add(b).add(c).divideScalar(3);let azi=azimuth(centroid);correctUV(uvA,j+0,a,azi),correctUV(uvB,j+2,b,azi),correctUV(uvC,j+4,c,azi)}})(),function(){for(let i=0;i<uvBuffer.length;i+=6){let x0=uvBuffer[i+0],x1=uvBuffer[i+2],x2=uvBuffer[i+4],max=Math.max(x0,x1,x2),min=Math.min(x0,x1,x2);max>.9&&min<.1&&(x0<.2&&(uvBuffer[i+0]+=1),x1<.2&&(uvBuffer[i+2]+=1),x2<.2&&(uvBuffer[i+4]+=1))}}()}(),this.setAttribute("position",new Float32BufferAttribute(vertexBuffer,3)),this.setAttribute("normal",new Float32BufferAttribute(vertexBuffer.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(uvBuffer,2)),0===detail?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(data){return new PolyhedronGeometry(data.vertices,data.indices,data.radius,data.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(radius=1,detail=0){let t=(1+Math.sqrt(5))/2,r=1/t;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-t,0,-r,t,0,r,-t,0,r,t,-r,-t,0,-r,t,0,r,-t,0,r,t,0,-t,0,-r,t,0,-r,-t,0,r,t,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
18619,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],radius,detail),this.type="DodecahedronGeometry",this.parameters={radius:radius,detail:detail}}static fromJSON(data){return new DodecahedronGeometry(data.radius,data.detail)}}class Shape extends Path{constructor(points){super(points),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(divisions){let holesPts=[];for(let i=0,l=this.holes.length;i<l;i++)holesPts[i]=this.holes[i].getPoints(divisions);return holesPts}extractPoints(divisions){return{shape:this.getPoints(divisions),holes:this.getPointsHoles(divisions)}}copy(source){super.copy(source),this.holes=[];for(let i=0,l=source.holes.length;i<l;i++){let hole=source.holes[i];this.holes.push(hole.clone())}return this}toJSON(){let data=super.toJSON();data.uuid=this.uuid,data.holes=[];for(let i=0,l=this.holes.length;i<l;i++){let hole=this.holes[i];data.holes.push(hole.toJSON())}return data}fromJSON(json){super.fromJSON(json),this.uuid=json.uuid,this.holes=[];for(let i=0,l=json.holes.length;i<l;i++){let hole=json.holes[i];this.holes.push(new Path().fromJSON(hole))}return this}}let Earcut={triangulate:function(data,holeIndices,dim=2){let minX,minY,maxX,maxY,x,y,invSize;let hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,!0),triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;if(hasHoles&&(outerNode=function(data,holeIndices,outerNode,dim){let i,len,start,end,list;let queue=[];for(i=0,len=holeIndices.length;i<len;i++)start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length,(list=linkedList(data,start,end,dim,!1))===list.next&&(list.steiner=!0),queue.push(function(start){let p=start,leftmost=start;do(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)&&(leftmost=p),p=p.next;while(p!==start);return leftmost}(list));for(queue.sort(compareX),i=0;i<queue.length;i++)outerNode=function(hole,outerNode){let bridge=function(hole,outerNode){let p=outerNode,qx=-1/0,m,hx=hole.x,hy=hole.y;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){let x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx&&(qx=x,m=p.x<p.next.x?p:p.next,x===hx))return m}p=p.next}while(p!==outerNode);if(!m)return null;let stop=m,mx=m.x,my=m.y,tanMin=1/0,tan;p=m;do{var m1,p1;hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)&&(tan=Math.abs(hy-p.y)/(hx-p.x),locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&&(m1=m,p1=p,0>area(m1.prev,m1,p1.prev)&&0>area(p1.next,m1,m1.next))))&&(m=p,tanMin=tan)),p=p.next}while(p!==stop);return m}(hole,outerNode);if(!bridge)return outerNode;let bridgeReverse=splitPolygon(bridge,hole);return filterPoints(bridgeReverse,bridgeReverse.next),filterPoints(bridge,bridge.next)}(queue[i],outerNode);return outerNode}(data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY=data[1];for(let i=dim;i<outerLen;i+=dim)x=data[i],y=data[i+1],x<minX&&(minX=x),y<minY&&(minY=y),x>maxX&&(maxX=x),y>maxY&&(maxY=y);invSize=0!==(invSize=Math.max(maxX-minX,maxY-minY))?32767/invSize:0}return function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(!ear)return;!pass&&invSize&&function(start,minX,minY,invSize){let p=start;do 0===p.z&&(p.z=zOrder(p.x,p.y,minX,minY,invSize)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next;while(p!==start);p.prevZ.nextZ=null,p.prevZ=null,function(list){let i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p=list,list=null,tail=null,numMerges=0;p;){for(numMerges++,q=p,pSize=0,i=0;i<inSize&&(pSize++,q=q.nextZ);i++);for(qSize=inSize;pSize>0||qSize>0&&q;)0!==pSize&&(0===qSize||!q||p.z<=q.z)?(e=p,p=p.nextZ,pSize--):(e=q,q=q.nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail,tail=e;p=q}tail.nextZ=null,inSize*=2}while(numMerges>1)}(p)}(ear,minX,minY,invSize);let stop=ear,prev,next;for(;ear.prev!==ear.next;){if(prev=ear.prev,next=ear.next,invSize?function(ear,minX,minY,invSize){let a=ear.prev,c=ear.next;if(area(a,ear,c)>=0)return!1;let ax=a.x,bx=ear.x,cx=c.x,ay=a.y,by=ear.y,cy=c.y,x0=ax<bx?ax<cx?ax:cx:bx<cx?bx:cx,y0=ay<by?ay<cy?ay:cy:by<cy?by:cy,x1=ax>bx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy,minZ=zOrder(x0,y0,minX,minY,invSize),maxZ=zOrder(x1,y1,minX,minY,invSize),p=ear.prevZ,n=ear.nextZ;for(;p&&p.z>=minZ&&n&&n.z<=maxZ;){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&p!==a&&p!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0||(p=p.prevZ,n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0))return!1;n=n.nextZ}for(;p&&p.z>=minZ;){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&p!==a&&p!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;n&&n.z<=maxZ;){if(n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}(ear,minX,minY,invSize):function(ear){let a=ear.prev,c=ear.next;if(area(a,ear,c)>=0)return!1;let ax=a.x,bx=ear.x,cx=c.x,ay=a.y,by=ear.y,cy=c.y,x0=ax<bx?ax<cx?ax:cx:bx<cx?bx:cx,y0=ay<by?ay<cy?ay:cy:by<cy?by:cy,x1=ax>bx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy,p=c.next;for(;p!==a;){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(ear)){triangles.push(prev.i/dim|0),triangles.push(ear.i/dim|0),triangles.push(next.i/dim|0),removeNode(ear),ear=next.next,stop=next.next;continue}if((ear=next)===stop){pass?1===pass?earcutLinked(ear=function(start,triangles,dim){let p=start;do{let a=p.prev,b=p.next.next;!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)&&(triangles.push(a.i/dim|0),triangles.push(p.i/dim|0),triangles.push(b.i/dim|0),removeNode(p),removeNode(p.next),p=start=b),p=p.next}while(p!==start);return filterPoints(p)}(filterPoints(ear),triangles,dim),triangles,dim,minX,minY,invSize,2):2===pass&&function(start,triangles,dim,minX,minY,invSize){let a=start;do{let b=a.next.next;for(;b!==a.prev;){var a1,b1;if(a.i!==b.i&&(a1=a,b1=b,a1.next.i!==b1.i&&a1.prev.i!==b1.i&&!function(a,b){let p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return!0;p=p.next}while(p!==a);return!1}(a1,b1)&&(locallyInside(a1,b1)&&locallyInside(b1,a1)&&function(a,b){let p=a,inside=!1,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do p.y>py!=p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x&&(inside=!inside),p=p.next;while(p!==a);return inside}(a1,b1)&&(area(a1.prev,a1,b1.prev)||area(a1,b1.prev,b1))||equals(a1,b1)&&area(a1.prev,a1,a1.next)>0&&area(b1.prev,b1,b1.next)>0))){let c=splitPolygon(a,b);a=filterPoints(a,a.next),c=filterPoints(c,c.next),earcutLinked(a,triangles,dim,minX,minY,invSize,0),earcutLinked(c,triangles,dim,minX,minY,invSize,0);return}b=b.next}a=a.next}while(a!==start)}(ear,triangles,dim,minX,minY,invSize):earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1);break}}}(outerNode,triangles,dim,minX,minY,invSize,0),triangles}};function linkedList(data,start,end,dim,clockwise){let i,last;if(clockwise===function(data,start,end,dim){let sum=0;for(let i=start,j=end-dim;i<end;i+=dim)sum+=(data[j]-data[i])*(data[i+1]+data[j+1]),j=i;return sum}(data,start,end,dim)>0)for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last);else for(i=end-dim;i>=start;i-=dim)last=insertNode(i,data[i],data[i+1],last);return last&&equals(last,last.next)&&(removeNode(last),last=last.next),last}function filterPoints(start,end){if(!start)return start;end||(end=start);let p=start,again;do if(again=!1,!p.steiner&&(equals(p,p.next)||0===area(p.prev,p,p.next))){if(removeNode(p),(p=end=p.prev)===p.next)break;again=!0}else p=p.next;while(again||p!==end);return end}function compareX(a,b){return a.x-b.x}function zOrder(x,y,minX,minY,invSize){return(x=((x=((x=((x=((x=(x-minX)*invSize|0)|x<<8)&16711935)|x<<4)&252645135)|x<<2)&858993459)|x<<1)&1431655765)|(y=((y=((y=((y=((y=(y-minY)*invSize|0)|y<<8)&16711935)|y<<4)&252645135)|y<<2)&858993459)|y<<1)&1431655765)<<1}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)>=(ax-px)*(cy-py)&&(ax-px)*(by-py)>=(bx-px)*(ay-py)&&(bx-px)*(cy-py)>=(cx-px)*(by-py)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){let o1=sign(area(p1,q1,p2)),o2=sign(area(p1,q1,q2)),o3=sign(area(p2,q2,p1)),o4=sign(area(p2,q2,q1));
186return!!(o1!==o2&&o3!==o4||0===o1&&onSegment(p1,p2,q1)||0===o2&&onSegment(p1,q2,q1)||0===o3&&onSegment(p2,p1,q2)||0===o4&&onSegment(p2,q1,q2))}function onSegment(p,q,r){return q.x<=Math.max(p.x,r.x)&&q.x>=Math.min(p.x,r.x)&&q.y<=Math.max(p.y,r.y)&&q.y>=Math.min(p.y,r.y)}function sign(num){return num>0?1:num<0?-1:0}function locallyInside(a,b){return 0>area(a.prev,a,a.next)?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:0>area(a,b,a.prev)||0>area(a,a.next,b)}function splitPolygon(a,b){let a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;return a.next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp,b2}function insertNode(i,x,y,last){let p=new Node(i,x,y);return last?(p.next=last.next,p.prev=last,last.next.prev=p,last.next=p):(p.prev=p,p.next=p),p}function removeNode(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Node(i,x,y){this.i=i,this.x=x,this.y=y,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class ShapeUtils{static area(contour){let n=contour.length,a=0;for(let p=n-1,q=0;q<n;p=q++)a+=contour[p].x*contour[q].y-contour[q].x*contour[p].y;return .5*a}static isClockWise(pts){return 0>ShapeUtils.area(pts)}static triangulateShape(contour,holes){let vertices=[],holeIndices=[],faces=[];removeDupEndPts(contour),addContour(vertices,contour);let holeIndex=contour.length;holes.forEach(removeDupEndPts);for(let i=0;i<holes.length;i++)holeIndices.push(holeIndex),holeIndex+=holes[i].length,addContour(vertices,holes[i]);let triangles=Earcut.triangulate(vertices,holeIndices);for(let i1=0;i1<triangles.length;i1+=3)faces.push(triangles.slice(i1,i1+3));return faces}}function removeDupEndPts(points){let l=points.length;l>2&&points[l-1].equals(points[0])&&points.pop()}function addContour(vertices,contour){for(let i=0;i<contour.length;i++)vertices.push(contour[i].x),vertices.push(contour[i].y)}class ExtrudeGeometry extends BufferGeometry{constructor(shapes=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),options={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:shapes,options:options},shapes=Array.isArray(shapes)?shapes:[shapes];let scope=this,verticesArray=[],uvArray=[];for(let i=0,l=shapes.length;i<l;i++){let shape=shapes[i];!function(shape){let splineTube,binormal,normal,position2;let placeholder=[],curveSegments=void 0!==options.curveSegments?options.curveSegments:12,steps=void 0!==options.steps?options.steps:1,depth=void 0!==options.depth?options.depth:1,bevelEnabled=void 0===options.bevelEnabled||options.bevelEnabled,bevelThickness=void 0!==options.bevelThickness?options.bevelThickness:.2,bevelSize=void 0!==options.bevelSize?options.bevelSize:bevelThickness-.1,bevelOffset=void 0!==options.bevelOffset?options.bevelOffset:0,bevelSegments=void 0!==options.bevelSegments?options.bevelSegments:3,extrudePath=options.extrudePath,uvgen=void 0!==options.UVGenerator?options.UVGenerator:WorldUVGenerator,extrudePts,extrudeByPath=!1;
vendor: 4,627 bytes, line 186
186extrudePath&&(extrudePts=extrudePath.getSpacedPoints(steps),extrudeByPath=!0,bevelEnabled=!1,splineTube=extrudePath.computeFrenetFrames(steps,!1),binormal=new Vector3,normal=new Vector3,position2=new Vector3),bevelEnabled||(bevelSegments=0,bevelThickness=0,bevelSize=0,bevelOffset=0);let shapePoints=shape.extractPoints(curveSegments),vertices=shapePoints.shape,holes=shapePoints.holes,reverse=!ShapeUtils.isClockWise(vertices);if(reverse){vertices=vertices.reverse();for(let h=0,hl=holes.length;h<hl;h++){let ahole=holes[h];ShapeUtils.isClockWise(ahole)&&(holes[h]=ahole.reverse())}}let faces=ShapeUtils.triangulateShape(vertices,holes),contour=vertices;for(let h1=0,hl1=holes.length;h1<hl1;h1++){let ahole1=holes[h1];vertices=vertices.concat(ahole1)}function scalePt2(pt,vec,size){return vec||console.error("THREE.ExtrudeGeometry: vec does not exist"),vec.clone().multiplyScalar(size).add(pt)}let vlen=vertices.length,flen=faces.length;function getBevelVec(inPt,inPrev,inNext){let v_trans_x,v_trans_y,shrink_by;let v_prev_x=inPt.x-inPrev.x,v_prev_y=inPt.y-inPrev.y,v_next_x=inNext.x-inPt.x,v_next_y=inNext.y-inPt.y,v_prev_lensq=v_prev_x*v_prev_x+v_prev_y*v_prev_y;if(Math.abs(v_prev_x*v_next_y-v_prev_y*v_next_x)>Number.EPSILON){let v_prev_len=Math.sqrt(v_prev_lensq),v_next_len=Math.sqrt(v_next_x*v_next_x+v_next_y*v_next_y),ptPrevShift_x=inPrev.x-v_prev_y/v_prev_len,ptPrevShift_y=inPrev.y+v_prev_x/v_prev_len,ptNextShift_x=inNext.x-v_next_y/v_next_len,ptNextShift_y=inNext.y+v_next_x/v_next_len,sf=((ptNextShift_x-ptPrevShift_x)*v_next_y-(ptNextShift_y-ptPrevShift_y)*v_next_x)/(v_prev_x*v_next_y-v_prev_y*v_next_x);v_trans_x=ptPrevShift_x+v_prev_x*sf-inPt.x,v_trans_y=ptPrevShift_y+v_prev_y*sf-inPt.y;let v_trans_lensq=v_trans_x*v_trans_x+v_trans_y*v_trans_y;if(v_trans_lensq<=2)return new Vector2(v_trans_x,v_trans_y);shrink_by=Math.sqrt(v_trans_lensq/2)}else{let direction_eq=!1;v_prev_x>Number.EPSILON?v_next_x>Number.EPSILON&&(direction_eq=!0):v_prev_x<-Number.EPSILON?v_next_x<-Number.EPSILON&&(direction_eq=!0):Math.sign(v_prev_y)===Math.sign(v_next_y)&&(direction_eq=!0),direction_eq?(v_trans_x=-v_prev_y,v_trans_y=v_prev_x,shrink_by=Math.sqrt(v_prev_lensq)):(v_trans_x=v_prev_x,v_trans_y=v_prev_y,shrink_by=Math.sqrt(v_prev_lensq/2))}return new Vector2(v_trans_x/shrink_by,v_trans_y/shrink_by)}let contourMovements=[];for(let i=0,il=contour.length,j=il-1,k=i+1;i<il;i++,j++,k++)j===il&&(j=0),k===il&&(k=0),contourMovements[i]=getBevelVec(contour[i],contour[j],contour[k]);let holesMovements=[],oneHoleMovements,verticesMovements=contourMovements.concat();for(let h2=0,hl2=holes.length;h2<hl2;h2++){let ahole2=holes[h2];oneHoleMovements=[];for(let i1=0,il1=ahole2.length,j1=il1-1,k1=i1+1;i1<il1;i1++,j1++,k1++)j1===il1&&(j1=0),k1===il1&&(k1=0),oneHoleMovements[i1]=getBevelVec(ahole2[i1],ahole2[j1],ahole2[k1]);holesMovements.push(oneHoleMovements),verticesMovements=verticesMovements.concat(oneHoleMovements)}for(let b=0;b<bevelSegments;b++){let t=b/bevelSegments,z=bevelThickness*Math.cos(t*Math.PI/2),bs=bevelSize*Math.sin(t*Math.PI/2)+bevelOffset;for(let i2=0,il2=contour.length;i2<il2;i2++){let vert=scalePt2(contour[i2],contourMovements[i2],bs);v(vert.x,vert.y,-z)}for(let h3=0,hl3=holes.length;h3<hl3;h3++){let ahole3=holes[h3];oneHoleMovements=holesMovements[h3];for(let i3=0,il3=ahole3.length;i3<il3;i3++){let vert1=scalePt2(ahole3[i3],oneHoleMovements[i3],bs);v(vert1.x,vert1.y,-z)}}}let bs1=bevelSize+bevelOffset;for(let i4=0;i4<vlen;i4++){let vert2=bevelEnabled?scalePt2(vertices[i4],verticesMovements[i4],bs1):vertices[i4];extrudeByPath?(normal.copy(splineTube.normals[0]).multiplyScalar(vert2.x),binormal.copy(splineTube.binormals[0]).multiplyScalar(vert2.y),position2.copy(extrudePts[0]).add(normal).add(binormal),v(position2.x,position2.y,position2.z)):v(vert2.x,vert2.y,0)}for(let s=1;s<=steps;s++)for(let i5=0;i5<vlen;i5++){let vert3=bevelEnabled?scalePt2(vertices[i5],verticesMovements[i5],bs1):vertices[i5];extrudeByPath?(normal.copy(splineTube.normals[s]).multiplyScalar(vert3.x),binormal.copy(splineTube.binormals[s]).multiplyScalar(vert3.y),position2.copy(extrudePts[s]).add(normal).add(binormal),v(position2.x,position2.y,position2.z)):v(vert3.x,vert3.y,depth/steps*s)}for(let b1=bevelSegments-1;b1>=0;b1--){let t1=b1/bevelSegments,z1=bevelThickness*Math.cos(t1*Math.PI/2),bs2=bevelSize*Math.sin(t1*Math.PI/2)+bevelOffset;for(let i6=0,il4=contour.length;i6<il4;i6++){let vert4=scalePt2(contour[i6],contourMovements[i6],bs2);v(vert4.x,vert4.y,depth+z1)}for(let h4=0,hl4=holes.length;h4<hl4;h4++){let ahole4=holes[h4];oneHoleMovements=holesMovements[h4];for(let i7=0,il5=ahole4.length;i7<il5;
186i7++){let vert5=scalePt2(ahole4[i7],oneHoleMovements[i7],bs2);extrudeByPath?v(vert5.x,vert5.y+extrudePts[steps-1].y,extrudePts[steps-1].x+z1):v(vert5.x,vert5.y,depth+z1)}}}function sidewalls(contour,layeroffset){let i=contour.length;for(;--i>=0;){let j=i,k=i-1;k<0&&(k=contour.length-1);for(let s=0,sl=steps+2*bevelSegments;s<sl;s++){let slen1=vlen*s,slen2=vlen*(s+1),a=layeroffset+j+slen1,b=layeroffset+k+slen1,c=layeroffset+k+slen2,d=layeroffset+j+slen2;!function(a,b,c,d){addVertex(a),addVertex(b),addVertex(d),addVertex(b),addVertex(c),addVertex(d);let nextIndex=verticesArray.length/3,uvs=uvgen.generateSideWallUV(scope,verticesArray,nextIndex-6,nextIndex-3,nextIndex-2,nextIndex-1);addUV(uvs[0]),addUV(uvs[1]),addUV(uvs[3]),addUV(uvs[1]),addUV(uvs[2]),addUV(uvs[3])}(a,b,c,d)}}}function v(x,y,z){placeholder.push(x),placeholder.push(y),placeholder.push(z)}function f3(a,b,c){addVertex(a),addVertex(b),addVertex(c);let nextIndex=verticesArray.length/3,uvs=uvgen.generateTopUV(scope,verticesArray,nextIndex-3,nextIndex-2,nextIndex-1);addUV(uvs[0]),addUV(uvs[1]),addUV(uvs[2])}function addVertex(index){verticesArray.push(placeholder[3*index+0]),verticesArray.push(placeholder[3*index+1]),verticesArray.push(placeholder[3*index+2])}function addUV(vector2){uvArray.push(vector2.x),uvArray.push(vector2.y)}(function(){let start=verticesArray.length/3;if(bevelEnabled){let offset=0*vlen;for(let i=0;i<flen;i++){let face=faces[i];f3(face[2]+offset,face[1]+offset,face[0]+offset)}offset=vlen*(steps+2*bevelSegments);for(let i1=0;i1<flen;i1++){let face1=faces[i1];f3(face1[0]+offset,face1[1]+offset,face1[2]+offset)}}else{for(let i2=0;i2<flen;i2++){let face2=faces[i2];f3(face2[2],face2[1],face2[0])}for(let i3=0;i3<flen;i3++){let face3=faces[i3];f3(face3[0]+vlen*steps,face3[1]+vlen*steps,face3[2]+vlen*steps)}}scope.addGroup(start,verticesArray.length/3-start,0)})(),function(){let start=verticesArray.length/3,layeroffset=0;sidewalls(contour,0),layeroffset+=contour.length;for(let h=0,hl=holes.length;h<hl;h++){let ahole=holes[h];sidewalls(ahole,layeroffset),layeroffset+=ahole.length}scope.addGroup(start,verticesArray.length/3-start,1)}()}(shape)}this.setAttribute("position",new Float32BufferAttribute(verticesArray,3)),this.setAttribute("uv",new Float32BufferAttribute(uvArray,2)),this.computeVertexNormals()}toJSON(){let data=super.toJSON(),shapes=this.parameters.shapes,options=this.parameters.options;return function(shapes,options,data){if(data.shapes=[],Array.isArray(shapes))for(let i=0,l=shapes.length;i<l;i++){let shape=shapes[i];data.shapes.push(shape.uuid)}else data.shapes.push(shapes.uuid);return data.options=Object.assign({},options),void 0!==options.extrudePath&&(data.options.extrudePath=options.extrudePath.toJSON()),data}(shapes,options,data)}static fromJSON(data,shapes){let geometryShapes=[];for(let j=0,jl=data.shapes.length;j<jl;j++){let shape=shapes[data.shapes[j]];geometryShapes.push(shape)}let extrudePath=data.options.extrudePath;return void 0!==extrudePath&&(data.options.extrudePath=new Curves[extrudePath.type]().fromJSON(extrudePath)),new ExtrudeGeometry(geometryShapes,data.options)}}let WorldUVGenerator={generateTopUV:function(geometry,vertices,indexA,indexB,indexC){let a_x=vertices[3*indexA],a_y=vertices[3*indexA+1],b_x=vertices[3*indexB],b_y=vertices[3*indexB+1],c_x=vertices[3*indexC],c_y=vertices[3*indexC+1];return[new Vector2(a_x,a_y),new Vector2(b_x,b_y),new Vector2(c_x,c_y)]},generateSideWallUV:function(geometry,vertices,indexA,indexB,indexC,indexD){let a_x=vertices[3*indexA],a_y=vertices[3*indexA+1],a_z=vertices[3*indexA+2],b_x=vertices[3*indexB],b_y=vertices[3*indexB+1],b_z=vertices[3*indexB+2],c_x=vertices[3*indexC],c_y=vertices[3*indexC+1],c_z=vertices[3*indexC+2],d_x=vertices[3*indexD],d_y=vertices[3*indexD+1],d_z=vertices[3*indexD+2];return Math.abs(a_y-b_y)<Math.abs(a_x-b_x)?[new Vector2(a_x,1-a_z),new Vector2(b_x,1-b_z),new Vector2(c_x,1-c_z),new Vector2(d_x,1-d_z)]:[new Vector2(a_y,1-a_z),new Vector2(b_y,1-b_z),new Vector2(c_y,1-c_z),new Vector2(d_y,1-d_z)]}};class IcosahedronGeometry extends PolyhedronGeometry{constructor(radius=1,detail=0){let t=(1+Math.sqrt(5))/2;super([-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],radius,detail),this.type="IcosahedronGeometry",this.parameters={radiu
186s:radius,detail:detail}}static fromJSON(data){return new IcosahedronGeometry(data.radius,data.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(radius=1,detail=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],radius,detail),this.type="OctahedronGeometry",this.parameters={radius:radius,detail:detail}}static fromJSON(data){return new OctahedronGeometry(data.radius,data.detail)}}class RingGeometry extends BufferGeometry{constructor(innerRadius=.5,outerRadius=1,thetaSegments=8,phiSegments=1,thetaStart=0,thetaLength=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:innerRadius,outerRadius:outerRadius,thetaSegments:thetaSegments,phiSegments:phiSegments,thetaStart:thetaStart,thetaLength:thetaLength},thetaSegments=Math.max(3,thetaSegments),phiSegments=Math.max(1,phiSegments);let indices=[],vertices=[],normals=[],uvs=[],radius=innerRadius,radiusStep=(outerRadius-innerRadius)/phiSegments,vertex=new Vector3,uv=new Vector2;for(let j=0;j<=phiSegments;j++){for(let i=0;i<=thetaSegments;i++){let segment=thetaStart+i/thetaSegments*thetaLength;vertex.x=radius*Math.cos(segment),vertex.y=radius*Math.sin(segment),vertices.push(vertex.x,vertex.y,vertex.z),normals.push(0,0,1),uv.x=(vertex.x/outerRadius+1)/2,uv.y=(vertex.y/outerRadius+1)/2,uvs.push(uv.x,uv.y)}radius+=radiusStep}for(let j1=0;j1<phiSegments;j1++){let thetaSegmentLevel=j1*(thetaSegments+1);for(let i1=0;i1<thetaSegments;i1++){let segment1=i1+thetaSegmentLevel,b=segment1+thetaSegments+1,c=segment1+thetaSegments+2,d=segment1+1;indices.push(segment1,b,d),indices.push(b,c,d)}}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new RingGeometry(data.innerRadius,data.outerRadius,data.thetaSegments,data.phiSegments,data.thetaStart,data.thetaLength)}}class ShapeGeometry extends BufferGeometry{constructor(shapes=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),curveSegments=12){super(),this.type="ShapeGeometry",this.parameters={shapes:shapes,curveSegments:curveSegments};let indices=[],vertices=[],normals=[],uvs=[],groupStart=0,groupCount=0;if(!1===Array.isArray(shapes))addShape(shapes);else for(let i=0;i<shapes.length;i++)addShape(shapes[i]),this.addGroup(groupStart,groupCount,i),groupStart+=groupCount,groupCount=0;function addShape(shape){let indexOffset=vertices.length/3,points=shape.extractPoints(curveSegments),shapeVertices=points.shape,shapeHoles=points.holes;!1===ShapeUtils.isClockWise(shapeVertices)&&(shapeVertices=shapeVertices.reverse());for(let i=0,l=shapeHoles.length;i<l;i++){let shapeHole=shapeHoles[i];!0===ShapeUtils.isClockWise(shapeHole)&&(shapeHoles[i]=shapeHole.reverse())}let faces=ShapeUtils.triangulateShape(shapeVertices,shapeHoles);for(let i1=0,l1=shapeHoles.length;i1<l1;i1++){let shapeHole1=shapeHoles[i1];shapeVertices=shapeVertices.concat(shapeHole1)}for(let i2=0,l2=shapeVertices.length;i2<l2;i2++){let vertex=shapeVertices[i2];vertices.push(vertex.x,vertex.y,0),normals.push(0,0,1),uvs.push(vertex.x,vertex.y)}for(let i3=0,l3=faces.length;i3<l3;i3++){let face=faces[i3],a=face[0]+indexOffset,b=face[1]+indexOffset,c=face[2]+indexOffset;indices.push(a,b,c),groupCount+=3}}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}toJSON(){let data=super.toJSON(),shapes=this.parameters.shapes;return function(shapes,data){if(data.shapes=[],Array.isArray(shapes))for(let i=0,l=shapes.length;i<l;i++){let shape=shapes[i];data.shapes.push(shape.uuid)}else data.shapes.push(shapes.uuid);return data}(shapes,data)}static fromJSON(data,shapes){let geometryShapes=[];for(let j=0,jl=data.shapes.length;j<jl;j++){let shape=shapes[data.shapes[j]];geometryShapes.push(shape)}return new ShapeGeometry(geometryShapes,data.curveSegments)}}class SphereGeometry extends BufferGeometry{constructor(radius=1,widthSegments=32,heightSegments=16,phiStart=0,phiLength=2*Math.PI,thetaStart=0,thetaLength=Math.PI){super(),this.type="SphereGeometry",this.parameters={radiu
vendor: 4,770 bytes, line 186
186s:radius,widthSegments:widthSegments,heightSegments:heightSegments,phiStart:phiStart,phiLength:phiLength,thetaStart:thetaStart,thetaLength:thetaLength},widthSegments=Math.max(3,Math.floor(widthSegments)),heightSegments=Math.max(2,Math.floor(heightSegments));let thetaEnd=Math.min(thetaStart+thetaLength,Math.PI),index=0,grid=[],vertex=new Vector3,normal=new Vector3,indices=[],vertices=[],normals=[],uvs=[];for(let iy=0;iy<=heightSegments;iy++){let verticesRow=[],v=iy/heightSegments,uOffset=0;0==iy&&0==thetaStart?uOffset=.5/widthSegments:iy==heightSegments&&thetaEnd==Math.PI&&(uOffset=-.5/widthSegments);for(let ix=0;ix<=widthSegments;ix++){let u=ix/widthSegments;vertex.x=-radius*Math.cos(phiStart+u*phiLength)*Math.sin(thetaStart+v*thetaLength),vertex.y=radius*Math.cos(thetaStart+v*thetaLength),vertex.z=radius*Math.sin(phiStart+u*phiLength)*Math.sin(thetaStart+v*thetaLength),vertices.push(vertex.x,vertex.y,vertex.z),normal.copy(vertex).normalize(),normals.push(normal.x,normal.y,normal.z),uvs.push(u+uOffset,1-v),verticesRow.push(index++)}grid.push(verticesRow)}for(let iy1=0;iy1<heightSegments;iy1++)for(let ix1=0;ix1<widthSegments;ix1++){let a=grid[iy1][ix1+1],b=grid[iy1][ix1],c=grid[iy1+1][ix1],d=grid[iy1+1][ix1+1];(0!==iy1||thetaStart>0)&&indices.push(a,b,d),(iy1!==heightSegments-1||thetaEnd<Math.PI)&&indices.push(b,c,d)}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new SphereGeometry(data.radius,data.widthSegments,data.heightSegments,data.phiStart,data.phiLength,data.thetaStart,data.thetaLength)}}class TetrahedronGeometry extends PolyhedronGeometry{constructor(radius=1,detail=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],radius,detail),this.type="TetrahedronGeometry",this.parameters={radius:radius,detail:detail}}static fromJSON(data){return new TetrahedronGeometry(data.radius,data.detail)}}class TorusGeometry extends BufferGeometry{constructor(radius=1,tube=.4,radialSegments=8,tubularSegments=6,arc=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:radius,tube:tube,radialSegments:radialSegments,tubularSegments:tubularSegments,arc:arc},radialSegments=Math.floor(radialSegments),tubularSegments=Math.floor(tubularSegments);let indices=[],vertices=[],normals=[],uvs=[],center=new Vector3,vertex=new Vector3,normal=new Vector3;for(let j=0;j<=radialSegments;j++)for(let i=0;i<=tubularSegments;i++){let u=i/tubularSegments*arc,v=j/radialSegments*Math.PI*2;vertex.x=(radius+tube*Math.cos(v))*Math.cos(u),vertex.y=(radius+tube*Math.cos(v))*Math.sin(u),vertex.z=tube*Math.sin(v),vertices.push(vertex.x,vertex.y,vertex.z),center.x=radius*Math.cos(u),center.y=radius*Math.sin(u),normal.subVectors(vertex,center).normalize(),normals.push(normal.x,normal.y,normal.z),uvs.push(i/tubularSegments),uvs.push(j/radialSegments)}for(let j1=1;j1<=radialSegments;j1++)for(let i1=1;i1<=tubularSegments;i1++){let a=(tubularSegments+1)*j1+i1-1,b=(tubularSegments+1)*(j1-1)+i1-1,c=(tubularSegments+1)*(j1-1)+i1,d=(tubularSegments+1)*j1+i1;indices.push(a,b,d),indices.push(b,c,d)}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new TorusGeometry(data.radius,data.tube,data.radialSegments,data.tubularSegments,data.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(radius=1,tube=.4,tubularSegments=64,radialSegments=8,p=2,q=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:radius,tube:tube,tubularSegments:tubularSegments,radialSegments:radialSegments,p:p,q:q},tubularSegments=Math.floor(tubularSegments),radialSegments=Math.floor(radialSegments);let indices=[],vertices=[],normals=[],uvs=[],vertex=new Vector3,normal=new Vector3,P1=new Vector3,P2=new Vector3,B=new Vector3,T=new Vector3,N=new Vector3;for(let i=0;i<=tubularSegments;++i){let u=i/tubularSegments*p*Math.PI*2;calculatePositionOnCurve(u,p,q,radius,P1),calculatePositionOnCurve(u+.01,p,q,radius,P2),T.subVectors(P2,P1),N.addVectors(P2,P1),B.crossVectors(T,N),N.crossVectors(B,T),B.normalize(),N.normalize();for(let j=0;j<=radialSegments;++j){let v=j/radialSegments*Math.PI*2,cx=-tube*Math.cos(v),cy=tube*Math.sin(v);vertex.x=P1.x+(cx*N.x+cy*B.x),vertex.y=P1.y+(cx*N.y+cy*B.y),vertex.z=P1.z+(cx*N.z+cy*B.z),vertices.push(vertex.x,vertex.y,vertex.z),normal.subVectors(vertex,P1).normalize(),normals.push(normal.x,normal.y,normal.z),uvs.push(i/tubularSegments),uvs.push(j/radialSegments)}}for(let j1=1;j1<=tubularSegments;j1++)for(let i1=1;
vendor: 8,010 bytes, line 186
186i1<=radialSegments;i1++){let a=(radialSegments+1)*(j1-1)+(i1-1),b=(radialSegments+1)*j1+(i1-1),c=(radialSegments+1)*j1+i1,d=(radialSegments+1)*(j1-1)+i1;indices.push(a,b,d),indices.push(b,c,d)}function calculatePositionOnCurve(u,p,q,radius,position){let quOverP=q/p*u,cs=Math.cos(quOverP);position.x=radius*(2+cs)*.5*Math.cos(u),position.y=radius*(2+cs)*Math.sin(u)*.5,position.z=radius*Math.sin(quOverP)*.5}this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}static fromJSON(data){return new TorusKnotGeometry(data.radius,data.tube,data.tubularSegments,data.radialSegments,data.p,data.q)}}class TubeGeometry extends BufferGeometry{constructor(path=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),tubularSegments=64,radius=1,radialSegments=8,closed=!1){super(),this.type="TubeGeometry",this.parameters={path:path,tubularSegments:tubularSegments,radius:radius,radialSegments:radialSegments,closed:closed};let frames=path.computeFrenetFrames(tubularSegments,closed);this.tangents=frames.tangents,this.normals=frames.normals,this.binormals=frames.binormals;let vertex=new Vector3,normal=new Vector3,uv=new Vector2,P=new Vector3,vertices=[],normals=[],uvs=[],indices=[];function generateSegment(i){P=path.getPointAt(i/tubularSegments,P);let N=frames.normals[i],B=frames.binormals[i];for(let j=0;j<=radialSegments;j++){let v=j/radialSegments*Math.PI*2,sin=Math.sin(v),cos=-Math.cos(v);normal.x=cos*N.x+sin*B.x,normal.y=cos*N.y+sin*B.y,normal.z=cos*N.z+sin*B.z,normal.normalize(),normals.push(normal.x,normal.y,normal.z),vertex.x=P.x+radius*normal.x,vertex.y=P.y+radius*normal.y,vertex.z=P.z+radius*normal.z,vertices.push(vertex.x,vertex.y,vertex.z)}}(function(){for(let i=0;i<tubularSegments;i++)generateSegment(i);generateSegment(!1===closed?tubularSegments:0),function(){for(let i=0;i<=tubularSegments;i++)for(let j=0;j<=radialSegments;j++)uv.x=i/tubularSegments,uv.y=j/radialSegments,uvs.push(uv.x,uv.y)}(),function(){for(let j=1;j<=tubularSegments;j++)for(let i=1;i<=radialSegments;i++){let a=(radialSegments+1)*(j-1)+(i-1),b=(radialSegments+1)*j+(i-1),c=(radialSegments+1)*j+i,d=(radialSegments+1)*(j-1)+i;indices.push(a,b,d),indices.push(b,c,d)}}()})(),this.setIndex(indices),this.setAttribute("position",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute(normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}toJSON(){let data=super.toJSON();return data.path=this.parameters.path.toJSON(),data}static fromJSON(data){return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path),data.tubularSegments,data.radius,data.radialSegments,data.closed)}}class MeshStandardMaterial extends Material{constructor(parameters){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(parameters)}copy(source){return super.copy(source),this.defines={STANDARD:""},this.color.copy(source.color),this.roughness=source.roughness,this.metalness=source.metalness,this.map=source.map,this.lightMap=source.lightMap,this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap,this.aoMapIntensity=source.aoMapIntensity,this.emissive.copy(source.emissive),this.emissiveMap=source.emissiveMap,this.emissiveIntensity=source.emissiveIntensity,this.bumpMap=source.bumpMap,this.bumpScale=source.bumpScale,this.normalMap=source.normalMap,this.normalMapType=source.normalMapType,this.normalScale.copy(source.normalScale),this.displacementMap=source.displacementMap,this.displacementScale=source.displacementScale,this.displacementBias=source.displacementBias,this.roughnessMap=source.roughnessMap,this.metalnessMap=source.metalnessMap,this.alphaMap=source.alphaMap,this.envMap=source.envMap,this.envMapIntensity=source.envMapIntensity,this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin,this.flatShading=source.flatShading,this.fog=source.fog,this}}class MeshPhysicalMaterial extends MeshStandardMaterial{constructor(parameters){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(reflectivity){this.ior=(1+.4*reflectivity)/(1-.4*reflectivity)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(parameters)}get sheen(){return this._sheen}set sheen(value){this._sheen>0!=value>0&&this.version++,this._sheen=value}get clearcoat(){return this._clearcoat}set clearcoat(value){this._clearcoat>0!=value>0&&this.version++,this._clearcoat=value}get iridescence(){return this._iridescence}set iridescence(value){this._iridescence>0!=value>0&&this.version++,this._iridescence=value}get transmission(){return this._transmission}set transmission(value){this._transmission>0!=value>0&&this.version++,this._transmission=value}copy(source){return super.copy(source),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=source.clearcoat,this.clearcoatMap=source.clearcoatMap,this.clearcoatRoughness=source.clearcoatRoughness,this.clearcoatRoughnessMap=source.clearcoatRoughnessMap,this.clearcoatNormalMap=source.clearcoatNormalMap,this.clearcoatNormalScale.copy(source.clearcoatNormalScale),this.ior=source.ior,this.iridescence=source.iridescence,this.iridescenceMap=source.iridescenceMap,this.iridescenceIOR=source.iridescenceIOR,this.iridescenceThicknessRange=[...source.iridescenceThicknessRange],this.iridescenceThicknessMap=source.iridescenceThicknessMap,this.sheen=source.sheen,this.sheenColor.copy(source.sheenColor),this.sheenColorMap=source.sheenColorMap,this.sheenRoughness=source.sheenRoughness,this.sheenRoughnessMap=source.sheenRoughnessMap,this.transmission=source.transmission,this.transmissionMap=source.transmissionMap,this.thickness=source.thickness,this.thicknessMap=source.thicknessMap,this.attenuationDistance=source.attenuationDistance,this.attenuationColor.copy(source.attenuationColor),this.specularIntensity=source.specularIntensity,this.specularIntensityMap=source.specularIntensityMap,this.specularColor.copy(source.specularColor),this.specularColorMap=source.specularColorMap,this}}function arraySlice(array,from,to){return isTypedArray(array)?new array.constructor(array.subarray(from,void 0!==to?to:array.length)):array.slice(from,to)}function convertArray(array,type,forceClone){return array&&(forceClone||array.
186constructor!==type)?"number"==typeof type.BYTES_PER_ELEMENT?new type(array):Array.prototype.slice.call(array):array}function isTypedArray(object){return ArrayBuffer.isView(object)&&!(object instanceof DataView)}function sortedArray(values,stride,order){let nValues=values.length,result=new values.constructor(nValues);for(let i=0,dstOffset=0;dstOffset!==nValues;++i){let srcOffset=order[i]*stride;for(let j=0;j!==stride;++j)result[dstOffset++]=values[srcOffset+j]}return result}function flattenJSON(jsonKeys,times,values,valuePropertyName){let i=1,key=jsonKeys[0];for(;void 0!==key&&void 0===key[valuePropertyName];)key=jsonKeys[i++];if(void 0===key)return;let value=key[valuePropertyName];if(void 0!==value){if(Array.isArray(value))do void 0!==(value=key[valuePropertyName])&&(times.push(key.time),values.push.apply(values,value)),key=jsonKeys[i++];while(void 0!==key);else if(void 0!==value.toArray)do void 0!==(value=key[valuePropertyName])&&(times.push(key.time),value.toArray(values,values.length)),key=jsonKeys[i++];while(void 0!==key);else do void 0!==(value=key[valuePropertyName])&&(times.push(key.time),values.push(value)),key=jsonKeys[i++];while(void 0!==key)}}class Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){this.parameterPositions=parameterPositions,this._cachedIndex=0,this.resultBuffer=void 0!==resultBuffer?resultBuffer:new sampleValues.constructor(sampleSize),this.sampleValues=sampleValues,this.valueSize=sampleSize,this.settings=null,this.DefaultSettings_={}}evaluate(t){let pp=this.parameterPositions,i1=this._cachedIndex,t1=pp[i1],t0=pp[i1-1];validate_interval:{seek:{let right;linear_scan:{forward_scan:if(!(t<t1)){for(let giveUpAt=i1+2;;){if(void 0===t1){if(t<t0)break forward_scan;return i1=pp.length,this._cachedIndex=i1,this.copySampleValue_(i1-1)}if(i1===giveUpAt)break;if(t0=t1,t<(t1=pp[++i1]))break seek}right=pp.length;break linear_scan}if(!(t>=t0)){let t1global=pp[1];t<t1global&&(i1=2,t0=t1global);for(let giveUpAt1=i1-2;;){if(void 0===t0)return this._cachedIndex=0,this.copySampleValue_(0);if(i1===giveUpAt1)break;if(t1=t0,t>=(t0=pp[--i1-1]))break seek}right=i1,i1=0;break linear_scan}break validate_interval}for(;i1<right;){let mid=i1+right>>>1;t<pp[mid]?right=mid:i1=mid+1}if(t1=pp[i1],void 0===(t0=pp[i1-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===t1)return i1=pp.length,this._cachedIndex=i1,this.copySampleValue_(i1-1)}this._cachedIndex=i1,this.intervalChanged_(i1,t0,t1)}return this.interpolate_(i1,t0,t,t1)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(index){let result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,offset=index*stride;for(let i=0;i!==stride;++i)result[i]=values[offset+i];return result}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(i1,t0,t1){let pp=this.parameterPositions,iPrev=i1-2,iNext=i1+1,tPrev=pp[iPrev],tNext=pp[iNext];if(void 0===tPrev)switch(this.getSettings_().endingStart){case 2401:iPrev=i1,tPrev=2*t0-t1;break;case 2402:tPrev=t0+pp[iPrev=pp.length-2]-pp[iPrev+1];break;default:iPrev=i1,tPrev=t1}if(void 0===tNext)switch(this.getSettings_().endingEnd){case 2401:iNext=i1,tNext=2*t1-t0;break;case 2402:iNext=1,tNext=t1+pp[1]-pp[0];break;default:iNext=i1-1,tNext=t0}let halfDt=(t1-t0)*.5,stride=this.valueSize;this._weightPrev=halfDt/(t0-tPrev),this._weightNext=halfDt/(tNext-t1),this._offsetPrev=iPrev*stride,this._offsetNext=iNext*stride}interpolate_(i1,t0,t,t1){let result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,o1=i1*stride,o0=o1-stride,oP=this._offsetPrev,oN=this._offsetNext,wP=this._weightPrev,wN=this._weightNext,p=(t-t0)/(t1-t0),pp=p*p,ppp=pp*p,sP=-wP*ppp+2*wP*pp-wP*p,s0=(1+wP)*ppp+(-1.5-2*wP)*pp+(-.5+wP)*p+1,s1=(-1-wN)*ppp+(1.5+wN)*pp+.5*p,sN=wN*ppp-wN*pp;for(let i=0;i!==stride;++i)result[i]=sP*values[oP+i]+s0*values[o0+i]+s1*values[o1+i]+sN*values[oN+i];return result}}
186class LinearInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer)}interpolate_(i1,t0,t,t1){let result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,offset1=i1*stride,offset0=offset1-stride,weight1=(t-t0)/(t1-t0),weight0=1-weight1;for(let i=0;i!==stride;++i)result[i]=values[offset0+i]*weight0+values[offset1+i]*weight1;return result}}class DiscreteInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer)}interpolate_(i1){return this.copySampleValue_(i1-1)}}class KeyframeTrack{constructor(name,times,values,interpolation){if(void 0===name)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===times||0===times.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+name);this.name=name,this.times=convertArray(times,this.TimeBufferType),this.values=convertArray(values,this.ValueBufferType),this.setInterpolation(interpolation||this.DefaultInterpolation)}static toJSON(track){let json;let trackType=track.constructor;if(trackType.toJSON!==this.toJSON)json=trackType.toJSON(track);else{json={name:track.name,times:convertArray(track.times,Array),values:convertArray(track.values,Array)};let interpolation=track.getInterpolation();interpolation!==track.DefaultInterpolation&&(json.interpolation=interpolation)}return json.type=track.ValueTypeName,json}InterpolantFactoryMethodDiscrete(result){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),result)}InterpolantFactoryMethodLinear(result){return new LinearInterpolant(this.times,this.values,this.getValueSize(),result)}InterpolantFactoryMethodSmooth(result){return new CubicInterpolant(this.times,this.values,this.getValueSize(),result)}setInterpolation(interpolation){let factoryMethod;switch(interpolation){case InterpolateDiscrete:factoryMethod=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:factoryMethod=this.InterpolantFactoryMethodLinear;break;case 2302:factoryMethod=this.InterpolantFactoryMethodSmooth}if(void 0===factoryMethod){let message="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(interpolation!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(message)}return console.warn("THREE.KeyframeTrack:",message),this}return this.createInterpolant=factoryMethod,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(timeOffset){if(0!==timeOffset){let times=this.times;for(let i=0,n=times.length;i!==n;++i)times[i]+=timeOffset}return this}scale(timeScale){if(1!==timeScale){let times=this.times;for(let i=0,n=times.length;i!==n;++i)times[i]*=timeScale}return this}trim(startTime,endTime){let times=this.times,nKeys=times.length,from=0,to=nKeys-1;for(;from!==nKeys&×[from]<startTime;)++from;for(;-1!==to&×[to]>endTime;)--to;if(++to,0!==from||to!==nKeys){from>=to&&(from=(to=Math.max(to,1))-1);let stride=this.getValueSize();this.times=arraySlice(times,from,to),this.values=arraySlice(this.values,from*stride,to*stride)}return this}validate(){let valid=!0,valueSize=this.getValueSize();valueSize-Math.floor(valueSize)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),valid=!1);let times=this.times,values=this.values,nKeys=times.length;0===nKeys&&(console.error("THREE.KeyframeTrack: Track is empty.",this),valid=!1);let prevTime=null;for(let i=0;i!==nKeys;i++){let currTime=times[i];if("number"==typeof currTime&&isNaN(currTime)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,i,currTime),valid=!1;break}if(null!==prevTime&&prevTime>currTime){console.error("THREE.KeyframeTrack: Out of order keys.",this,i,currTime,prevTime),valid=!1;break}prevTime=currTime}if(void 0!==values&&isTypedArray(values))for(let i1=0,n=values.length;i1!==n;++i1){let value=values[i1];if(isNaN(value)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,i1,value),valid=!1;break}}return valid}optimize(){let times=arraySlice(this.times),values=arraySlice(this.values),stride=this.getValueSize(),smoothInterpolation=2302===this.getInterpolation(),lastIndex=times.length-1,writeIndex=1;for(let i=1;i<lastIndex;++i){let keep=!1,time=times[i],timeNext=times[i+1];if(time!==timeNext&&(1!==i||time!==times[0])){if(smoothInterpolation)keep=!0;else{let offset=i*stride,offsetP=offset-stride,offsetN=offset+stride;for(let j=0;j!==stride;++j){let value=values[offset+j];if(value!==values[offsetP+j]||value!==values[offsetN+j]){keep=!0;break}}}}if(keep){if(i!==writeIndex){times[writeIndex]=times[i];let readOffset=i*stride,writeOffset=writeIndex*stride;for(let j1=0;j1!==stride;++j1)values[writeOffset+j1]=values[readOffset+j1]}++writeIndex}}if(lastIndex>0){times[writeIndex]=times[lastIndex];for(let readOffset1=lastIndex*stride,writeOffset1=writeIndex*stride,j2=0;j2!==stride;++j2)values[writeOffset1+j2]=values[readOffset1+j2];++writeIndex}return writeIndex!==times.length?(this.times=arraySlice(times,0,writeIndex),this.values=arraySlice(values,0,writeIndex*stride)):(this.times=times,this.values=values),this}clone(){let times=arraySlice(this.times,0),values=arraySlice(this.values,0),TypedKeyframeTrack=this.constructor,track=new TypedKeyframeTrack(this.name,times,values);return track.createInterpolant=this.createInterpolant,track}}KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";
186class QuaternionLinearInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer)}interpolate_(i1,t0,t,t1){let result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,alpha=(t-t0)/(t1-t0),offset=i1*stride;for(let end=offset+stride;offset!==end;offset+=4)Quaternion.slerpFlat(result,0,values,offset-stride,values,offset,alpha);return result}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(result){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),result)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear,QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";class AnimationClip{constructor(name,duration=-1,tracks,blendMode=2500){this.name=name,this.tracks=tracks,this.duration=duration,this.blendMode=blendMode,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(json){let tracks=[],jsonTracks=json.tracks,frameTime=1/(json.fps||1);for(let i=0,n=jsonTracks.length;i!==n;++i)tracks.push((function(json){if(void 0===json.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let trackType=function(typeName){switch(typeName.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+typeName)}(json.type);if(void 0===json.times){let times=[],values=[];flattenJSON(json.keys,times,values,"value"),json.times=times,json.values=values}return void 0!==trackType.parse?trackType.parse(json):new trackType(json.name,json.times,json.values,json.interpolation)})(jsonTracks[i]).scale(frameTime));let clip=new this(json.name,json.duration,tracks,json.blendMode);return clip.uuid=json.uuid,clip}static toJSON(clip){let tracks=[],clipTracks=clip.tracks,json={name:clip.name,duration:clip.duration,tracks:tracks,uuid:clip.uuid,blendMode:clip.blendMode};for(let i=0,n=clipTracks.length;i!==n;++i)tracks.push(KeyframeTrack.toJSON(clipTracks[i]));return json}static CreateFromMorphTargetSequence(name,morphTargetSequence,fps,noLoop){let numMorphTargets=morphTargetSequence.length,tracks=[];for(let i=0;i<numMorphTargets;i++){let times=[],values=[];times.push((i+numMorphTargets-1)%numMorphTargets,i,(i+1)%numMorphTargets),values.push(0,1,0);let order=function(times){let n=times.length,result=Array(n);for(let i=0;i!==n;++i)result[i]=i;return result.sort(function(i,j){return times[i]-times[j]}),result}(times);times=sortedArray(times,1,order),values=sortedArray(values,1,order),noLoop||0!==times[0]||(times.push(numMorphTargets),values.push(values[0])),tracks.push(new NumberKeyframeTrack(".morphTargetInfluences["+morphTargetSequence[i].name+"]",times,values).scale(1/fps))}return new this(name,-1,tracks)}static findByName(objectOrClipArray,name){let clipArray=objectOrClipArray;Array.isArray(objectOrClipArray)||(clipArray=objectOrClipArray.geometry&&objectOrClipArray.geometry.animations||objectOrClipArray.animations);for(let i=0;i<clipArray.length;i++)if(clipArray[i].name===name)return clipArray[i];return null}static CreateClipsFromMorphTargetSequences(morphTargets,fps,noLoop){let animationToMorphTargets={},pattern=/^([\w-]*?)([\d]+)$/;for(let i=0,il=morphTargets.length;i<il;i++){let morphTarget=morphTargets[i],parts=morphTarget.name.match(pattern);if(parts&&parts.length>1){let name=parts[1],animationMorphTargets=animationToMorphTargets[name];animationMorphTargets||(animationToMorphTargets[name]=animationMorphTargets=[]),animationMorphTargets.push(morphTarget)}}let clips=[];for(let name1 in animationToMorphTargets)clips.push(this.CreateFromMorphTargetSequence(name1,animationToMorphTargets[name1],fps,noLoop));return clips}static parseAnimation(animation,bones){if(!animation)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let addNonemptyTrack=function(trackType,trackName,animationKeys,propertyName,destTracks){if(0!==animationKeys.length){let times=[],values=[];flattenJSON(animationKeys,times,values,propertyName),0!==times.length&&destTracks.push(new trackType(trackName,times,values))}},tracks=[],clipName=animation.name||"default",fps=animation.fps||30,blendMode=animation.blendMode,duration=animation.length||-1,hierarchyTracks=animation.hierarchy||[];for(let h=0;h<hierarchyTracks.length;h++){let animationKeys=hierarchyTracks[h].keys;if(animationKeys&&0!==animationKeys.length){if(animationKeys[0].morphTargets){let k;let morphTargetNames={};for(k=0;k<animationKeys.length;k++)if(animationKeys[k].morphTargets)for(let m=0;m<animationKeys[k].morphTargets.length;m++)morphTargetNames[animationKeys[k].morphTargets[m]]=-1;for(let morphTargetName in morphTargetNames){let times=[],values=[];for(let m1=0;m1!==animationKeys[k].morphTargets.length;++m1){let animationKey=animationKeys[k];times.push(animationKey.time),values.push(animationKey.morphTarget===morphTargetName?1:0)}tracks.push(new NumberKeyframeTrack(".morphTargetInfluence["+morphTargetName+"]",times,values))}duration=morphTargetNames.length*fps}else{let boneName=".bones["+bones[h].name+"]";addNonemptyTrack(VectorKeyframeTrack,boneName+".position",animationKeys,"pos",tracks),addNonemptyTrack(QuaternionKeyframeTrack,boneName+".quaternion",animationKeys,"rot",tracks),addNonemptyTrack(VectorKeyframeTrack,boneName+".scale",animationKeys,"scl",tracks)}}}if(0===tracks.length)return null;
186let clip=new this(clipName,duration,tracks,blendMode);return clip}resetDuration(){let tracks=this.tracks,duration=0;for(let i=0,n=tracks.length;i!==n;++i){let track=this.tracks[i];duration=Math.max(duration,track.times[track.times.length-1])}return this.duration=duration,this}trim(){for(let i=0;i<this.tracks.length;i++)this.tracks[i].trim(0,this.duration);return this}validate(){let valid=!0;for(let i=0;i<this.tracks.length;i++)valid=valid&&this.tracks[i].validate();return valid}optimize(){for(let i=0;i<this.tracks.length;i++)this.tracks[i].optimize();return this}clone(){let tracks=[];for(let i=0;i<this.tracks.length;i++)tracks.push(this.tracks[i].clone());return new this.constructor(this.name,this.duration,tracks,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}let Cache={enabled:!1,files:{},add:function(key,file){!1!==this.enabled&&(this.files[key]=file)},get:function(key){if(!1!==this.enabled)return this.files[key]},remove:function(key){delete this.files[key]},clear:function(){this.files={}}},DefaultLoadingManager=new class{constructor(onLoad,onProgress,onError){let urlModifier;let scope=this,isLoading=!1,itemsLoaded=0,itemsTotal=0,handlers=[];this.onStart=void 0,this.onLoad=onLoad,this.onProgress=onProgress,this.onError=onError,this.itemStart=function(url){itemsTotal++,!1===isLoading&&void 0!==scope.onStart&&scope.onStart(url,itemsLoaded,itemsTotal),isLoading=!0},this.itemEnd=function(url){itemsLoaded++,void 0!==scope.onProgress&&scope.onProgress(url,itemsLoaded,itemsTotal),itemsLoaded===itemsTotal&&(isLoading=!1,void 0!==scope.onLoad&&scope.onLoad())},this.itemError=function(url){void 0!==scope.onError&&scope.onError(url)},this.resolveURL=function(url){return urlModifier?urlModifier(url):url},this.setURLModifier=function(transform){return urlModifier=transform,this},this.addHandler=function(regex,loader){return handlers.push(regex,loader),this},this.removeHandler=function(regex){let index=handlers.indexOf(regex);return -1!==index&&handlers.splice(index,2),this},this.getHandler=function(file){for(let i=0,l=handlers.length;i<l;i+=2){let regex=handlers[i],loader=handlers[i+1];if(regex.global&&(regex.lastIndex=0),regex.test(file))return loader}return null}}};class Loader{constructor(manager){this.manager=void 0!==manager?manager:DefaultLoadingManager,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(url,onProgress){let scope=this;return new Promise(function(resolve,reject){scope.load(url,resolve,onProgress,reject)})}parse(){}setCrossOrigin(crossOrigin){return this.crossOrigin=crossOrigin,this}setWithCredentials(value){return this.withCredentials=value,this}setPath(path){return this.path=path,this}setResourcePath(resourcePath){return this.resourcePath=resourcePath,this}setRequestHeader(requestHeader){return this.requestHeader=requestHeader,this}}let loading={};class HttpError extends Error{constructor(message,response){super(message),this.response=response}}class FileLoader extends Loader{constructor(manager){super(manager)}load(url,onLoad,onProgress,onError){void 0===url&&(url=""),void 0!==this.path&&(url=this.path+url),url=this.manager.resolveURL(url);let cached=Cache.get(url);if(void 0!==cached)return this.manager.itemStart(url),setTimeout(()=>{onLoad&&onLoad(cached),this.manager.itemEnd(url)},0),cached;if(void 0!==loading[url]){loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});return}loading[url]=[],loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});let req=new Request(url,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),mimeType=this.mimeType,responseType=this.responseType;fetch(req).then(response=>{if(200===response.status||0===response.status){if(0===response.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===response.body||void 0===response.body.getReader)return response;let callbacks=loading[url],reader=response.body.getReader(),contentLength=response.headers.get("Content-Length"),total=contentLength?parseInt(contentLength):0,lengthComputable=0!==total,loaded=0,stream=new ReadableStream({start(controller){(function readData(){reader.read().then(({done,value})=>{if(done)controller.close();else{loaded+=value.byteLength;let event=new ProgressEvent("progress",{lengthComputable,loaded,total});for(let i=0,il=callbacks.length;i<il;i++){let callback=callbacks[i];
vendor: 6,495 bytes, line 186
186callback.onProgress&&callback.onProgress(event)}controller.enqueue(value),readData()}})})()}});return new Response(stream)}throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`,response)}).then(response=>{switch(responseType){case"arraybuffer":return response.arrayBuffer();case"blob":return response.blob();case"document":return response.text().then(text=>{let parser=new DOMParser;return parser.parseFromString(text,mimeType)});case"json":return response.json();default:if(void 0===mimeType)return response.text();{let exec=/charset="?([^;"\s]*)"?/i.exec(mimeType),label=exec&&exec[1]?exec[1].toLowerCase():void 0,decoder=new TextDecoder(label);return response.arrayBuffer().then(ab=>decoder.decode(ab))}}}).then(data=>{Cache.add(url,data);let callbacks=loading[url];delete loading[url];for(let i=0,il=callbacks.length;i<il;i++){let callback=callbacks[i];callback.onLoad&&callback.onLoad(data)}}).catch(err=>{let callbacks=loading[url];if(void 0===callbacks)throw this.manager.itemError(url),err;delete loading[url];for(let i=0,il=callbacks.length;i<il;i++){let callback=callbacks[i];callback.onError&&callback.onError(err)}this.manager.itemError(url)}).finally(()=>{this.manager.itemEnd(url)}),this.manager.itemStart(url)}setResponseType(value){return this.responseType=value,this}setMimeType(value){return this.mimeType=value,this}}class ImageLoader extends Loader{constructor(manager){super(manager)}load(url,onLoad,onProgress,onError){void 0!==this.path&&(url=this.path+url),url=this.manager.resolveURL(url);let scope=this,cached=Cache.get(url);if(void 0!==cached)return scope.manager.itemStart(url),setTimeout(function(){onLoad&&onLoad(cached),scope.manager.itemEnd(url)},0),cached;let image=createElementNS("img");function onImageLoad(){removeEventListeners(),Cache.add(url,this),onLoad&&onLoad(this),scope.manager.itemEnd(url)}function onImageError(event){removeEventListeners(),onError&&onError(event),scope.manager.itemError(url),scope.manager.itemEnd(url)}function removeEventListeners(){image.removeEventListener("load",onImageLoad,!1),image.removeEventListener("error",onImageError,!1)}return image.addEventListener("load",onImageLoad,!1),image.addEventListener("error",onImageError,!1),"data:"!==url.slice(0,5)&&void 0!==this.crossOrigin&&(image.crossOrigin=this.crossOrigin),scope.manager.itemStart(url),image.src=url,image}}class DataTextureLoader extends Loader{constructor(manager){super(manager)}load(url,onLoad,onProgress,onError){let scope=this,texture=new DataTexture,loader=new FileLoader(this.manager);return loader.setResponseType("arraybuffer"),loader.setRequestHeader(this.requestHeader),loader.setPath(this.path),loader.setWithCredentials(scope.withCredentials),loader.load(url,function(buffer){let texData=scope.parse(buffer);texData&&(void 0!==texData.image?texture.image=texData.image:void 0!==texData.data&&(texture.image.width=texData.width,texture.image.height=texData.height,texture.image.data=texData.data),texture.wrapS=void 0!==texData.wrapS?texData.wrapS:ClampToEdgeWrapping,texture.wrapT=void 0!==texData.wrapT?texData.wrapT:ClampToEdgeWrapping,texture.magFilter=void 0!==texData.magFilter?texData.magFilter:LinearFilter,texture.minFilter=void 0!==texData.minFilter?texData.minFilter:LinearFilter,texture.anisotropy=void 0!==texData.anisotropy?texData.anisotropy:1,void 0!==texData.encoding&&(texture.encoding=texData.encoding),void 0!==texData.flipY&&(texture.flipY=texData.flipY),void 0!==texData.format&&(texture.format=texData.format),void 0!==texData.type&&(texture.type=texData.type),void 0!==texData.mipmaps&&(texture.mipmaps=texData.mipmaps,texture.minFilter=LinearMipmapLinearFilter),1===texData.mipmapCount&&(texture.minFilter=LinearFilter),void 0!==texData.generateMipmaps&&(texture.generateMipmaps=texData.generateMipmaps),texture.needsUpdate=!0,onLoad&&onLoad(texture,texData))},onProgress,onError),texture}}class TextureLoader extends Loader{constructor(manager){super(manager)}load(url,onLoad,onProgress,onError){let texture=new Texture,loader=new ImageLoader(this.manager);return loader.setCrossOrigin(this.crossOrigin),loader.setPath(this.path),loader.load(url,function(image){texture.image=image,texture.needsUpdate=!0,void 0!==onLoad&&onLoad(texture)},onProgress,onError),texture}}class Light extends Object3D{constructor(color,intensity=1){super(),this.isLight=!0,this.type="Light",this.color=new Color(color),this.intensity=intensity}dispose(){}copy(source,recursive){return super.copy(source,recursive),this.color.copy(source.color),this.intensity=source.intensity,this}toJSON(meta){let data=super.toJSON(meta);return data.object.color=this.color.getHex(),data.object.intensity=this.intensity,void 0!==this.groundColor&&(data.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(data.object.distance=this.distance),void 0!==this.angle&&(data.object.angle=this.angle),void 0!==this.decay&&(data.object.decay=this.decay),void 0!==this.penumbra&&(data.object.penumbra=this.penumbra),void 0!==this.shadow&&(data.object.shadow=this.shadow.toJSON()),data}}let _projScreenMatrix$1=new Matrix4,_lightPositionWorld$1=new Vector3,_lookTarget$1=new Vector3;class LightShadow{constructor(camera){this.camera=camera,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(light){let shadowCamera=this.camera,shadowMatrix=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld),shadowCamera.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(light.target.matrixWorld),shadowCamera.lookAt(_lookTarget$1),shadowCamera.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix,shadowCamera.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),shadowMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),shadowMatrix.multiply(_projScreenMatrix$1)}getViewport(viewportIndex){return this._viewports[viewportIndex]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(source){return this.camera=source.camera.clone(),this.bias=source.bias,this.radius=source.radiu
vendor: 5,825 bytes, line 186
186s,this.mapSize.copy(source.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let object={};return 0!==this.bias&&(object.bias=this.bias),0!==this.normalBias&&(object.normalBias=this.normalBias),1!==this.radius&&(object.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(object.mapSize=this.mapSize.toArray()),object.camera=this.camera.toJSON(!1).object,delete object.camera.matrix,object}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(light){let camera=this.camera,fov=2*RAD2DEG*light.angle*this.focus,aspect=this.mapSize.width/this.mapSize.height,far=light.distance||camera.far;(fov!==camera.fov||aspect!==camera.aspect||far!==camera.far)&&(camera.fov=fov,camera.aspect=aspect,camera.far=far,camera.updateProjectionMatrix()),super.updateMatrices(light)}copy(source){return super.copy(source),this.focus=source.focus,this}}class SpotLight extends Light{constructor(color,intensity,distance=0,angle=Math.PI/3,penumbra=0,decay=1){super(color,intensity),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DefaultUp),this.updateMatrix(),this.target=new Object3D,this.distance=distance,this.angle=angle,this.penumbra=penumbra,this.decay=decay,this.map=null,this.shadow=new SpotLightShadow}get power(){return this.intensity*Math.PI}set power(power){this.intensity=power/Math.PI}dispose(){this.shadow.dispose()}copy(source,recursive){return super.copy(source,recursive),this.distance=source.distance,this.angle=source.angle,this.penumbra=source.penumbra,this.decay=source.decay,this.target=source.target.clone(),this.shadow=source.shadow.clone(),this}}let _projScreenMatrix=new Matrix4,_lightPositionWorld=new Vector3,_lookTarget=new Vector3;class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}updateMatrices(light,viewportIndex=0){let camera=this.camera,shadowMatrix=this.matrix,far=light.distance||camera.far;far!==camera.far&&(camera.far=far,camera.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(light.matrixWorld),camera.position.copy(_lightPositionWorld),_lookTarget.copy(camera.position),_lookTarget.add(this._cubeDirections[viewportIndex]),camera.up.copy(this._cubeUps[viewportIndex]),camera.lookAt(_lookTarget),camera.updateMatrixWorld(),shadowMatrix.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(color,intensity,distance=0,decay=1){super(color,intensity),this.isPointLight=!0,this.type="PointLight",this.distance=distance,this.decay=decay,this.shadow=new PointLightShadow}get power(){return 4*this.intensity*Math.PI}set power(power){this.intensity=power/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(source,recursive){return super.copy(source,recursive),this.distance=source.distance,this.decay=source.decay,this.shadow=source.shadow.clone(),this}}class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DirectionalLight extends Light{constructor(color,intensity){super(color,intensity),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DefaultUp),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}dispose(){this.shadow.dispose()}copy(source){return super.copy(source),this.target=source.target.clone(),this.shadow=source.shadow.clone(),this}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let i=0;i<9;i++)this.coefficients.push(new Vector3)}set(coefficients){for(let i=0;i<9;i++)this.coefficients[i].copy(coefficients[i]);return this}zero(){for(let i=0;i<9;i++)this.coefficients[i].set(0,0,0);return this}getAt(normal,target){let x=normal.x,y=normal.y,z=normal.z,coeff=this.coefficients;return target.copy(coeff[0]).multiplyScalar(.282095),target.addScaledVector(coeff[1],.488603*y),target.addScaledVector(coeff[2],.488603*z),target.addScaledVector(coeff[3],.488603*x),target.addScaledVector(coeff[4],1.092548*(x*y)),target.addScaledVector(coeff[5],1.092548*(y*z)),target.addScaledVector(coeff[6],.315392*(3*z*z-1)),target.addScaledVector(coeff[7],1.092548*(x*z)),target.addScaledVector(coeff[8],.546274*(x*x-y*y)),target}getIrradianceAt(normal,target){let x=normal.x,y=normal.y,z=normal.z,coeff=this.coefficients;return target.copy(coeff[0]).multiplyScalar(.886227),target.addScaledVector(coeff[1],1.023328*y),target.addScaledVector(coeff[2],1.023328*z),target.addScaledVector(coeff[3],1.023328*x),target.addScaledVector(coeff[4],.858086*x*y),target.addScaledVector(coeff[5],.858086*y*z),target.addScaledVector(coeff[6],.743125*z*z-.247708),target.addScaledVector(coeff[7],.858086*x*z),target.addScaledVector(coeff[8],.429043*(x*x-y*y)),target}add(sh){for(let i=0;i<9;i++)this.coefficients[i].add(sh.coefficients[i]);return this}addScaledSH(sh,s){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(sh.coefficients[i],s);return this}scale(s){for(let i=0;i<9;i++)this.coefficients[i].multiplyScalar(s);return this}lerp(sh,alpha){for(let i=0;i<9;
186i++)this.coefficients[i].lerp(sh.coefficients[i],alpha);return this}equals(sh){for(let i=0;i<9;i++)if(!this.coefficients[i].equals(sh.coefficients[i]))return!1;return!0}copy(sh){return this.set(sh.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(array,offset=0){let coefficients=this.coefficients;for(let i=0;i<9;i++)coefficients[i].fromArray(array,offset+3*i);return this}toArray(array=[],offset=0){let coefficients=this.coefficients;for(let i=0;i<9;i++)coefficients[i].toArray(array,offset+3*i);return array}static getBasisAt(normal,shBasis){let x=normal.x,y=normal.y,z=normal.z;shBasis[0]=.282095,shBasis[1]=.488603*y,shBasis[2]=.488603*z,shBasis[3]=.488603*x,shBasis[4]=1.092548*x*y,shBasis[5]=1.092548*y*z,shBasis[6]=.315392*(3*z*z-1),shBasis[7]=1.092548*x*z,shBasis[8]=.546274*(x*x-y*y)}}class LightProbe extends Light{constructor(sh=new SphericalHarmonics3,intensity=1){super(void 0,intensity),this.isLightProbe=!0,this.sh=sh}copy(source){return super.copy(source),this.sh.copy(source.sh),this}fromJSON(json){return this.intensity=json.intensity,this.sh.fromArray(json.sh),this}toJSON(meta){let data=super.toJSON(meta);return data.object.sh=this.sh.toArray(),data}}class LoaderUtils{static decodeText(array){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(array);let s="";for(let i=0,il=array.length;i<il;i++)s+=String.fromCharCode(array[i]);try{return decodeURIComponent(escape(s))}catch(e){return s}}static extractUrlBase(url){let index=url.lastIndexOf("/");return -1===index?"./":url.slice(0,index+1)}static resolveURL(url,path){return"string"!=typeof url||""===url?"":(/^https?:\/\//i.test(path)&&/^\//.test(url)&&(path=path.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(url)||/^data:.*,.*$/i.test(url)||/^blob:.*$/i.test(url))?url:path+url}}class ImageBitmapLoader extends Loader{constructor(manager){super(manager),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(options){return this.options=options,this}load(url,onLoad,onProgress,onError){void 0===url&&(url=""),void 0!==this.path&&(url=this.path+url),url=this.manager.resolveURL(url);let scope=this,cached=Cache.get(url);if(void 0!==cached)return scope.manager.itemStart(url),setTimeout(function(){onLoad&&onLoad(cached),scope.manager.itemEnd(url)},0),cached;let fetchOptions={};fetchOptions.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetchOptions.headers=this.requestHeader,fetch(url,fetchOptions).then(function(res){return res.blob()}).then(function(blob){return createImageBitmap(blob,Object.assign(scope.options,{colorSpaceConversion:"none"}))}).then(function(imageBitmap){Cache.add(url,imageBitmap),onLoad&&onLoad(imageBitmap),scope.manager.itemEnd(url)}).catch(function(e){onError&&onError(e),scope.manager.itemError(url),scope.manager.itemEnd(url)}),scope.manager.itemStart(url)}}class PropertyMixer{constructor(binding,typeName,valueSize){let mixFunction,mixFunctionAdditive,setIdentity;switch(this.binding=binding,this.valueSize=valueSize,typeName){case"quaternion":mixFunction=this._slerp,mixFunctionAdditive=this._slerpAdditive,setIdentity=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*valueSize),this._workIndex=5;break;case"string":case"bool":mixFunction=this._select,mixFunctionAdditive=this._select,setIdentity=this._setAdditiveIdentityOther,this.buffer=Array(5*valueSize);break;default:mixFunction=this._lerp,mixFunctionAdditive=this._lerpAdditive,setIdentity=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*valueSize)}this._mixBufferRegion=mixFunction,this._mixBufferRegionAdditive=mixFunctionAdditive,this._setIdentity=setIdentity,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(accuIndex,weight){let buffer=this.buffer,stride=this.valueSize,offset=accuIndex*stride+stride,currentWeight=this.cumulativeWeight;if(0===currentWeight){for(let i=0;i!==stride;++i)buffer[offset+i]=buffer[i];currentWeight=weight}else{currentWeight+=weight;let mix=weight/currentWeight;this._mixBufferRegion(buffer,offset,0,mix,stride)}this.cumulativeWeight=currentWeight}accumulateAdditive(weight){let buffer=this.buffer,stride=this.valueSize,offset=stride*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(buffer,offset,0,weight,stride),this.cumulativeWeightAdditive+=weight}apply(accuIndex){let stride=this.valueSize,buffer=this.buffer,offset=accuIndex*stride+stride,weight=this.cumulativeWeight,weightAdditive=this.cumulativeWeightAdditive,binding=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,weight<1){let originalValueOffset=stride*this._origIndex;this._mixBufferRegion(buffer,offset,originalValueOffset,1-weight,stride)}weightAdditive>0&&this._mixBufferRegionAdditive(buffer,offset,this._addIndex*stride,1,stride);
vendor: 5,422 bytes, line 186
186for(let i=stride,e=stride+stride;i!==e;++i)if(buffer[i]!==buffer[i+stride]){binding.setValue(buffer,offset);break}}saveOriginalState(){let binding=this.binding,buffer=this.buffer,stride=this.valueSize,originalValueOffset=stride*this._origIndex;binding.getValue(buffer,originalValueOffset);for(let i=stride;i!==originalValueOffset;++i)buffer[i]=buffer[originalValueOffset+i%stride];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let originalValueOffset=3*this.valueSize;this.binding.setValue(this.buffer,originalValueOffset)}_setAdditiveIdentityNumeric(){let startIndex=this._addIndex*this.valueSize,endIndex=startIndex+this.valueSize;for(let i=startIndex;i<endIndex;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let startIndex=this._origIndex*this.valueSize,targetIndex=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[targetIndex+i]=this.buffer[startIndex+i]}_select(buffer,dstOffset,srcOffset,t,stride){if(t>=.5)for(let i=0;i!==stride;++i)buffer[dstOffset+i]=buffer[srcOffset+i]}_slerp(buffer,dstOffset,srcOffset,t){Quaternion.slerpFlat(buffer,dstOffset,buffer,dstOffset,buffer,srcOffset,t)}_slerpAdditive(buffer,dstOffset,srcOffset,t,stride){let workOffset=this._workIndex*stride;Quaternion.multiplyQuaternionsFlat(buffer,workOffset,buffer,dstOffset,buffer,srcOffset),Quaternion.slerpFlat(buffer,dstOffset,buffer,dstOffset,buffer,workOffset,t)}_lerp(buffer,dstOffset,srcOffset,t,stride){let s=1-t;for(let i=0;i!==stride;++i){let j=dstOffset+i;buffer[j]=buffer[j]*s+buffer[srcOffset+i]*t}}_lerpAdditive(buffer,dstOffset,srcOffset,t,stride){for(let i=0;i!==stride;++i){let j=dstOffset+i;buffer[j]=buffer[j]+buffer[srcOffset+i]*t}}}let _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=RegExp("["+_RESERVED_CHARS_RE+"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE.replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar),_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_wordChar),_trackRe=RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+"$"),_supportedObjectNames=["material","materials","bones","map"];class PropertyBinding{constructor(rootNode,path,parsedPath){this.path=path,this.parsedPath=parsedPath||PropertyBinding.parseTrackName(path),this.node=PropertyBinding.findNode(rootNode,this.parsedPath.nodeName)||rootNode,this.rootNode=rootNode,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(root,path,parsedPath){return root&&root.isAnimationObjectGroup?new PropertyBinding.Composite(root,path,parsedPath):new PropertyBinding(root,path,parsedPath)}static sanitizeNodeName(name){return name.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(trackName){let matches=_trackRe.exec(trackName);if(null===matches)throw Error("PropertyBinding: Cannot parse trackName: "+trackName);let results={nodeName:matches[2],objectName:matches[3],objectIndex:matches[4],propertyName:matches[5],propertyIndex:matches[6]},lastDot=results.nodeName&&results.nodeName.lastIndexOf(".");if(void 0!==lastDot&&-1!==lastDot){let objectName=results.nodeName.substring(lastDot+1);-1!==_supportedObjectNames.indexOf(objectName)&&(results.nodeName=results.nodeName.substring(0,lastDot),results.objectName=objectName)}if(null===results.propertyName||0===results.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+trackName);return results}static findNode(root,nodeName){if(void 0===nodeName||""===nodeName||"."===nodeName||-1===nodeName||nodeName===root.name||nodeName===root.uuid)return root;if(root.skeleton){let bone=root.skeleton.getBoneByName(nodeName);if(void 0!==bone)return bone}if(root.children){let searchNodeSubtree=function(children){for(let i=0;i<children.length;i++){let childNode=children[i];if(childNode.name===nodeName||childNode.uuid===nodeName)return childNode;let result=searchNodeSubtree(childNode.children);if(result)return result}return null},subTreeNode=searchNodeSubtree(root.children);if(subTreeNode)return subTreeNode}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(buffer,offset){buffer[offset]=this.targetObject[this.propertyName]}_getValue_array(buffer,offset){let source=this.resolvedProperty;for(let i=0,n=source.length;i!==n;++i)buffer[offset++]=source[i]}_getValue_arrayElement(buffer,offset){buffer[offset]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(buffer,offset){this.resolvedProperty.toArray(buffer,offset)}_setValue_direct(buffer,offset){this.targetObject[this.propertyName]=buffer[offset]}_setValue_direct_setNeedsUpdate(buffer,offset){this.targetObject[this.propertyName]=buffer[offset],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(buffer,offset){this.targetObject[this.propertyName]=buffer[offset],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(buffer,offset){let dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i)dest[i]=buffer[offset++]}_setValue_array_setNeedsUpdate(buffer,offset){let dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i)dest[i]=buffer[offset++];this.targetObject.needsUpdate=!0}
186_setValue_array_setMatrixWorldNeedsUpdate(buffer,offset){let dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i)dest[i]=buffer[offset++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset]}_setValue_arrayElement_setNeedsUpdate(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(buffer,offset){this.resolvedProperty.fromArray(buffer,offset)}_setValue_fromArray_setNeedsUpdate(buffer,offset){this.resolvedProperty.fromArray(buffer,offset),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(buffer,offset){this.resolvedProperty.fromArray(buffer,offset),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(targetArray,offset){this.bind(),this.getValue(targetArray,offset)}_setValue_unbound(sourceArray,offset){this.bind(),this.setValue(sourceArray,offset)}bind(){let targetObject=this.node,parsedPath=this.parsedPath,objectName=parsedPath.objectName,propertyName=parsedPath.propertyName,propertyIndex=parsedPath.propertyIndex;if(targetObject||(targetObject=PropertyBinding.findNode(this.rootNode,parsedPath.nodeName)||this.rootNode,this.node=targetObject),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!targetObject){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(objectName){let objectIndex=parsedPath.objectIndex;switch(objectName){case"materials":if(!targetObject.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!targetObject.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}targetObject=targetObject.material.materials;break;case"bones":if(!targetObject.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}targetObject=targetObject.skeleton.bones;for(let i=0;i<targetObject.length;i++)if(targetObject[i].name===objectIndex){objectIndex=i;break}break;case"map":if("map"in targetObject){targetObject=targetObject.map;break}if(!targetObject.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!targetObject.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}targetObject=targetObject.material.map;break;default:if(void 0===targetObject[objectName]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}targetObject=targetObject[objectName]}if(void 0!==objectIndex){if(void 0===targetObject[objectIndex]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,targetObject);return}targetObject=targetObject[objectIndex]}}let nodeProperty=targetObject[propertyName];if(void 0===nodeProperty){let nodeName=parsedPath.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+nodeName+"."+propertyName+" but it wasn't found.",targetObject);return}let versioning=this.Versioning.None;this.targetObject=targetObject,void 0!==targetObject.needsUpdate?versioning=this.Versioning.NeedsUpdate:void 0!==targetObject.matrixWorldNeedsUpdate&&(versioning=this.Versioning.MatrixWorldNeedsUpdate);let bindingType=this.BindingType.Direct;if(void 0!==propertyIndex){if("morphTargetInfluences"===propertyName){if(!targetObject.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!targetObject.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==targetObject.morphTargetDictionary[propertyIndex]&&(propertyIndex=targetObject.morphTargetDictionary[propertyIndex])}bindingType=this.BindingType.ArrayElement,this.resolvedProperty=nodeProperty,this.propertyIndex=propertyIndex}else void 0!==nodeProperty.fromArray&&void 0!==nodeProperty.toArray?(bindingType=this.BindingType.HasFromToArray,this.resolvedProperty=nodeProperty):Array.isArray(nodeProperty)?(bindingType=this.BindingType.EntireArray,this.resolvedProperty=nodeProperty):this.propertyName=propertyName;this.getValue=this.GetterByBindingType[bindingType],this.setValue=this.SetterByBindingTypeAndVersioning[bindingType][versioning]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=class{constructor(targetGroup,path,optionalParsedPath){let parsedPath=optionalParsedPath||PropertyBinding.parseTrackName(path);this._targetGroup=targetGroup,this._bindings=targetGroup.subscribe_(path,parsedPath)}getValue(array,offset){this.bind();
vendor: 5,326 bytes, line 186
186let firstValidIndex=this._targetGroup.nCachedObjects_,binding=this._bindings[firstValidIndex];void 0!==binding&&binding.getValue(array,offset)}setValue(array,offset){let bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i)bindings[i].setValue(array,offset)}bind(){let bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i)bindings[i].bind()}unbind(){let bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i)bindings[i].unbind()}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AnimationAction{constructor(mixer,clip,localRoot=null,blendMode=clip.blendMode){this._mixer=mixer,this._clip=clip,this._localRoot=localRoot,this.blendMode=blendMode;let tracks=clip.tracks,nTracks=tracks.length,interpolants=Array(nTracks),interpolantSettings={endingStart:2400,endingEnd:2400};for(let i=0;i!==nTracks;++i){let interpolant=tracks[i].createInterpolant(null);interpolants[i]=interpolant,interpolant.settings=interpolantSettings}this._interpolantSettings=interpolantSettings,this._interpolants=interpolants,this._propertyBindings=Array(nTracks),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(time){return this._startTime=time,this}setLoop(mode,repetitions){return this.loop=mode,this.repetitions=repetitions,this}setEffectiveWeight(weight){return this.weight=weight,this._effectiveWeight=this.enabled?weight:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(duration){return this._scheduleFading(duration,0,1)}fadeOut(duration){return this._scheduleFading(duration,1,0)}crossFadeFrom(fadeOutAction,duration,warp){if(fadeOutAction.fadeOut(duration),this.fadeIn(duration),warp){let fadeInDuration=this._clip.duration,fadeOutDuration=fadeOutAction._clip.duration;fadeOutAction.warp(1,fadeOutDuration/fadeInDuration,duration),this.warp(fadeInDuration/fadeOutDuration,1,duration)}return this}crossFadeTo(fadeInAction,duration,warp){return fadeInAction.crossFadeFrom(this,duration,warp)}stopFading(){let weightInterpolant=this._weightInterpolant;return null!==weightInterpolant&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(weightInterpolant)),this}setEffectiveTimeScale(timeScale){return this.timeScale=timeScale,this._effectiveTimeScale=this.paused?0:timeScale,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(duration){return this.timeScale=this._clip.duration/duration,this.stopWarping()}syncWith(action){return this.time=action.time,this.timeScale=action.timeScale,this.stopWarping()}halt(duration){return this.warp(this._effectiveTimeScale,0,duration)}warp(startTimeScale,endTimeScale,duration){let mixer=this._mixer,now=mixer.time,timeScale=this.timeScale,interpolant=this._timeScaleInterpolant;null===interpolant&&(interpolant=mixer._lendControlInterpolant(),this._timeScaleInterpolant=interpolant);let times=interpolant.parameterPositions,values=interpolant.sampleValues;return times[0]=now,times[1]=now+duration,values[0]=startTimeScale/timeScale,values[1]=endTimeScale/timeScale,this}stopWarping(){let timeScaleInterpolant=this._timeScaleInterpolant;return null!==timeScaleInterpolant&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(timeScaleInterpolant)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}
186_update(time,deltaTime,timeDirection,accuIndex){if(!this.enabled){this._updateWeight(time);return}let startTime=this._startTime;if(null!==startTime){let timeRunning=(time-startTime)*timeDirection;timeRunning<0||0===timeDirection?deltaTime=0:(this._startTime=null,deltaTime=timeDirection*timeRunning)}deltaTime*=this._updateTimeScale(time);let clipTime=this._updateTime(deltaTime),weight=this._updateWeight(time);if(weight>0){let interpolants=this._interpolants,propertyMixers=this._propertyBindings;if(2501===this.blendMode)for(let j=0,m=interpolants.length;j!==m;++j)interpolants[j].evaluate(clipTime),propertyMixers[j].accumulateAdditive(weight);else for(let j1=0,m1=interpolants.length;j1!==m1;++j1)interpolants[j1].evaluate(clipTime),propertyMixers[j1].accumulate(accuIndex,weight)}}_updateWeight(time){let weight=0;if(this.enabled){weight=this.weight;let interpolant=this._weightInterpolant;if(null!==interpolant){let interpolantValue=interpolant.evaluate(time)[0];weight*=interpolantValue,time>interpolant.parameterPositions[1]&&(this.stopFading(),0===interpolantValue&&(this.enabled=!1))}}return this._effectiveWeight=weight,weight}_updateTimeScale(time){let timeScale=0;if(!this.paused){timeScale=this.timeScale;let interpolant=this._timeScaleInterpolant;if(null!==interpolant){let interpolantValue=interpolant.evaluate(time)[0];timeScale*=interpolantValue,time>interpolant.parameterPositions[1]&&(this.stopWarping(),0===timeScale?this.paused=!0:this.timeScale=timeScale)}}return this._effectiveTimeScale=timeScale,timeScale}_updateTime(deltaTime){let duration=this._clip.duration,loop=this.loop,time=this.time+deltaTime,loopCount=this._loopCount,pingPong=loop===LoopPingPong;if(0===deltaTime)return -1===loopCount?time:pingPong&&(1&loopCount)==1?duration-time:time;if(loop===LoopOnce){-1===loopCount&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(time>=duration)time=duration;else if(time<0)time=0;else{this.time=time;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=time,this._mixer.dispatchEvent({type:"finished",action:this,direction:deltaTime<0?-1:1})}}else{if(-1===loopCount&&(deltaTime>=0?(loopCount=0,this._setEndings(!0,0===this.repetitions,pingPong)):this._setEndings(0===this.repetitions,!0,pingPong)),time>=duration||time<0){let loopDelta=Math.floor(time/duration);time-=duration*loopDelta,loopCount+=Math.abs(loopDelta);let pending=this.repetitions-loopCount;if(pending<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,time=deltaTime>0?duration:0,this.time=time,this._mixer.dispatchEvent({type:"finished",action:this,direction:deltaTime>0?1:-1});else{if(1===pending){let atStart=deltaTime<0;this._setEndings(atStart,!atStart,pingPong)}else this._setEndings(!1,!1,pingPong);this._loopCount=loopCount,this.time=time,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:loopDelta})}}else this.time=time;if(pingPong&&(1&loopCount)==1)return duration-time}return time}_setEndings(atStart,atEnd,pingPong){let settings=this._interpolantSettings;pingPong?(settings.endingStart=2401,settings.endingEnd=2401):(atStart?settings.endingStart=this.zeroSlopeAtStart?2401:2400:settings.endingStart=2402,atEnd?settings.endingEnd=this.zeroSlopeAtEnd?2401:2400:settings.endingEnd=2402)}_scheduleFading(duration,weightNow,weightThen){let mixer=this._mixer,now=mixer.time,interpolant=this._weightInterpolant;null===interpolant&&(interpolant=mixer._lendControlInterpolant(),this._weightInterpolant=interpolant);let times=interpolant.parameterPositions,values=interpolant.sampleValues;return times[0]=now,values[0]=weightNow,times[1]=now+duration,values[1]=weightThen,this}}let _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher{constructor(root){super(),this._root=root,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(action,prototypeAction){let root=action._localRoot||this._root,tracks=action._clip.tracks,nTracks=tracks.length,bindings=action._propertyBindings,interpolants=action._interpolants,rootUuid=root.uuid,bindingsByRoot=this._bindingsByRootAndName,bindingsByName=bindingsByRoot[rootUuid];void 0===bindingsByName&&(bindingsByName={},bindingsByRoot[rootUuid]=bindingsByName);for(let i=0;i!==nTracks;++i){let track=tracks[i],trackName=track.name,binding=bindingsByName[trackName];if(void 0!==binding)++binding.referenceCount,bindings[i]=binding;else{if(void 0!==(binding=bindings[i])){null===binding._cacheIndex&&(++binding.referenceCount,this._addInactiveBinding(binding,rootUuid,trackName));continue}let path=prototypeAction&&prototypeAction._propertyBindings[i].binding.parsedPath;binding=new PropertyMixer(PropertyBinding.create(root,trackName,path),track.ValueTypeName,track.getValueSize()),++binding.referenceCount,this._addInactiveBinding(binding,rootUuid,trackName),bindings[i]=binding}interpolants[i].resultBuffer=binding.buffer}}
vendor: 9,695 bytes, line 186
186_activateAction(action){if(!this._isActiveAction(action)){if(null===action._cacheIndex){let rootUuid=(action._localRoot||this._root).uuid,clipUuid=action._clip.uuid,actionsForClip=this._actionsByClip[clipUuid];this._bindAction(action,actionsForClip&&actionsForClip.knownActions[0]),this._addInactiveAction(action,clipUuid,rootUuid)}let bindings=action._propertyBindings;for(let i=0,n=bindings.length;i!==n;++i){let binding=bindings[i];0==binding.useCount++&&(this._lendBinding(binding),binding.saveOriginalState())}this._lendAction(action)}}_deactivateAction(action){if(this._isActiveAction(action)){let bindings=action._propertyBindings;for(let i=0,n=bindings.length;i!==n;++i){let binding=bindings[i];0==--binding.useCount&&(binding.restoreOriginalState(),this._takeBackBinding(binding))}this._takeBackAction(action)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let scope=this;this.stats={actions:{get total(){return scope._actions.length},get inUse(){return scope._nActiveActions}},bindings:{get total(){return scope._bindings.length},get inUse(){return scope._nActiveBindings}},controlInterpolants:{get total(){return scope._controlInterpolants.length},get inUse(){return scope._nActiveControlInterpolants}}}}_isActiveAction(action){let index=action._cacheIndex;return null!==index&&index<this._nActiveActions}_addInactiveAction(action,clipUuid,rootUuid){let actions=this._actions,actionsByClip=this._actionsByClip,actionsForClip=actionsByClip[clipUuid];if(void 0===actionsForClip)actionsForClip={knownActions:[action],actionByRoot:{}},action._byClipCacheIndex=0,actionsByClip[clipUuid]=actionsForClip;else{let knownActions=actionsForClip.knownActions;action._byClipCacheIndex=knownActions.length,knownActions.push(action)}action._cacheIndex=actions.length,actions.push(action),actionsForClip.actionByRoot[rootUuid]=action}_removeInactiveAction(action){let actions=this._actions,lastInactiveAction=actions[actions.length-1],cacheIndex=action._cacheIndex;lastInactiveAction._cacheIndex=cacheIndex,actions[cacheIndex]=lastInactiveAction,actions.pop(),action._cacheIndex=null;let clipUuid=action._clip.uuid,actionsByClip=this._actionsByClip,actionsForClip=actionsByClip[clipUuid],knownActionsForClip=actionsForClip.knownActions,lastKnownAction=knownActionsForClip[knownActionsForClip.length-1],byClipCacheIndex=action._byClipCacheIndex;lastKnownAction._byClipCacheIndex=byClipCacheIndex,knownActionsForClip[byClipCacheIndex]=lastKnownAction,knownActionsForClip.pop(),action._byClipCacheIndex=null;let actionByRoot=actionsForClip.actionByRoot,rootUuid=(action._localRoot||this._root).uuid;delete actionByRoot[rootUuid],0===knownActionsForClip.length&&delete actionsByClip[clipUuid],this._removeInactiveBindingsForAction(action)}_removeInactiveBindingsForAction(action){let bindings=action._propertyBindings;for(let i=0,n=bindings.length;i!==n;++i){let binding=bindings[i];0==--binding.referenceCount&&this._removeInactiveBinding(binding)}}_lendAction(action){let actions=this._actions,prevIndex=action._cacheIndex,lastActiveIndex=this._nActiveActions++,firstInactiveAction=actions[lastActiveIndex];action._cacheIndex=lastActiveIndex,actions[lastActiveIndex]=action,firstInactiveAction._cacheIndex=prevIndex,actions[prevIndex]=firstInactiveAction}_takeBackAction(action){let actions=this._actions,prevIndex=action._cacheIndex,firstInactiveIndex=--this._nActiveActions,lastActiveAction=actions[firstInactiveIndex];action._cacheIndex=firstInactiveIndex,actions[firstInactiveIndex]=action,lastActiveAction._cacheIndex=prevIndex,actions[prevIndex]=lastActiveAction}_addInactiveBinding(binding,rootUuid,trackName){let bindingsByRoot=this._bindingsByRootAndName,bindings=this._bindings,bindingByName=bindingsByRoot[rootUuid];void 0===bindingByName&&(bindingByName={},bindingsByRoot[rootUuid]=bindingByName),bindingByName[trackName]=binding,binding._cacheIndex=bindings.length,bindings.push(binding)}_removeInactiveBinding(binding){let bindings=this._bindings,propBinding=binding.binding,rootUuid=propBinding.rootNode.uuid,trackName=propBinding.path,bindingsByRoot=this._bindingsByRootAndName,bindingByName=bindingsByRoot[rootUuid],lastInactiveBinding=bindings[bindings.length-1],cacheIndex=binding._cacheIndex;lastInactiveBinding._cacheIndex=cacheIndex,bindings[cacheIndex]=lastInactiveBinding,bindings.pop(),delete bindingByName[trackName],0===Object.keys(bindingByName).length&&delete bindingsByRoot[rootUuid]}_lendBinding(binding){let bindings=this._bindings,prevIndex=binding._cacheIndex,lastActiveIndex=this._nActiveBindings++,firstInactiveBinding=bindings[lastActiveIndex];binding._cacheIndex=lastActiveIndex,bindings[lastActiveIndex]=binding,firstInactiveBinding._cacheIndex=prevIndex,bindings[prevIndex]=firstInactiveBinding}_takeBackBinding(binding){let bindings=this._bindings,prevIndex=binding._cacheIndex,firstInactiveIndex=--this._nActiveBindings,lastActiveBinding=bindings[firstInactiveIndex];binding._cacheIndex=firstInactiveIndex,bindings[firstInactiveIndex]=binding,lastActiveBinding._cacheIndex=prevIndex,bindings[prevIndex]=lastActiveBinding}_lendControlInterpolant(){let interpolants=this._controlInterpolants,lastActiveIndex=this._nActiveControlInterpolants++,interpolant=interpolants[lastActiveIndex];return void 0===interpolant&&((interpolant=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer)).__cacheIndex=lastActiveIndex,interpolants[lastActiveIndex]=interpolant),interpolant}_takeBackControlInterpolant(interpolant){let interpolants=this._controlInterpolants,prevIndex=interpolant.__cacheIndex,firstInactiveIndex=--this._nActiveControlInterpolants,lastActiveInterpolant=interpolants[firstInactiveIndex];interpolant.__cacheIndex=firstInactiveIndex,interpolants[firstInactiveIndex]=interpolant,lastActiveInterpolant.__cacheIndex=prevIndex,interpolants[prevIndex]=lastActiveInterpolant}clipAction(clip,optionalRoot,blendMode){let root=optionalRoot||this._root,rootUuid=root.uuid,clipObject="string"==typeof clip?AnimationClip.findByName(root,clip):clip,clipUuid=null!==clipObject?clipObject.uuid:clip,actionsForClip=this._actionsByClip[clipUuid],prototypeAction=null;if(void 0===blendMode&&(blendMode=null!==clipObject?clipObject.blendMode:2500),void 0!==actionsForClip){let existingAction=actionsForClip.actionByRoot[rootUuid];if(void 0!==existingAction&&existingAction.blendMode===blendMode)return existingAction;prototypeAction=actionsForClip.knownActions[0],null===clipObject&&(clipObject=prototypeAction._clip)}if(null===clipObject)return null;let newAction=new AnimationAction(this,clipObject,optionalRoot,blendMode);return this._bindAction(newAction,prototypeAction),this._addInactiveAction(newAction,clipUuid,rootUuid),newAction}existingAction(clip,optionalRoot){let root=optionalRoot||this._root,rootUuid=root.uuid,clipObject="string"==typeof clip?AnimationClip.findByName(root,clip):clip,clipUuid=clipObject?clipObject.uuid:clip,actionsForClip=this._actionsByClip[clipUuid];return void 0!==actionsForClip&&actionsForClip.actionByRoot[rootUuid]||null}stopAllAction(){let actions=this._actions,nActions=this._nActiveActions;for(let i=nActions-1;i>=0;--i)actions[i].stop();return this}update(deltaTime){deltaTime*=this.timeScale;let actions=this._actions,nActions=this._nActiveActions,time=this.time+=deltaTime,timeDirection=Math.sign(deltaTime),accuIndex=this._accuIndex^=1;for(let i=0;i!==nActions;++i){let action=actions[i];action._update(time,deltaTime,timeDirection,accuIndex)}let bindings=this._bindings,nBindings=this._nActiveBindings;for(let i1=0;i1!==nBindings;++i1)bindings[i1].apply(accuIndex);return this}setTime(timeInSeconds){this.time=0;for(let i=0;i<this._actions.length;i++)this._actions[i].time=0;return this.update(timeInSeconds)}getRoot(){return this._root}uncacheClip(clip){let actions=this._actions,clipUuid=clip.uuid,actionsByClip=this._actionsByClip,actionsForClip=actionsByClip[clipUuid];if(void 0!==actionsForClip){let actionsToRemove=actionsForClip.knownActions;for(let i=0,n=actionsToRemove.length;i!==n;++i){let action=actionsToRemove[i];this._deactivateAction(action);let cacheIndex=action._cacheIndex,lastInactiveAction=actions[actions.length-1];action._cacheIndex=null,action._byClipCacheIndex=null,lastInactiveAction._cacheIndex=cacheIndex,actions[cacheIndex]=lastInactiveAction,actions.pop(),this._removeInactiveBindingsForAction(action)}delete actionsByClip[clipUuid]}}uncacheRoot(root){let rootUuid=root.uuid,actionsByClip=this._actionsByClip;for(let clipUuid in actionsByClip){let actionByRoot=actionsByClip[clipUuid].actionByRoot,action=actionByRoot[rootUuid];void 0!==action&&(this._deactivateAction(action),this._removeInactiveAction(action))}let bindingsByRoot=this._bindingsByRootAndName,bindingByName=bindingsByRoot[rootUuid];if(void 0!==bindingByName)for(let trackName in bindingByName){let binding=bindingByName[trackName];binding.restoreOriginalState(),this._removeInactiveBinding(binding)}}uncacheAction(clip,optionalRoot){let action=this.existingAction(clip,optionalRoot);null!==action&&(this._deactivateAction(action),this._removeInactiveAction(action))}}class Raycaster{constructor(origin,direction,near=0,far=1/0){this.ray=new Ray(origin,direction),this.near=near,this.far=far,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(origin,direction){this.ray.set(origin,direction)}setFromCamera(coords,camera){camera.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(camera.matrixWorld),this.ray.direction.set(coords.x,
186coords.y,.5).unproject(camera).sub(this.ray.origin).normalize(),this.camera=camera):camera.isOrthographicCamera?(this.ray.origin.set(coords.x,coords.y,(camera.near+camera.far)/(camera.near-camera.far)).unproject(camera),this.ray.direction.set(0,0,-1).transformDirection(camera.matrixWorld),this.camera=camera):console.error("THREE.Raycaster: Unsupported camera type: "+camera.type)}intersectObject(object,recursive=!0,intersects=[]){return intersectObject(object,this,intersects,recursive),intersects.sort(ascSort),intersects}intersectObjects(objects,recursive=!0,intersects=[]){for(let i=0,l=objects.length;i<l;i++)intersectObject(objects[i],this,intersects,recursive);return intersects.sort(ascSort),intersects}}function ascSort(a,b){return a.distance-b.distance}function intersectObject(object,raycaster,intersects,recursive){if(object.layers.test(raycaster.layers)&&object.raycast(raycaster,intersects),!0===recursive){let children=object.children;for(let i=0,l=children.length;i<l;i++)intersectObject(children[i],raycaster,intersects,!0)}}class Spherical{constructor(radius=1,phi=0,theta=0){return this.radius=radius,this.phi=phi,this.theta=theta,this}set(radius,phi,theta){return this.radius=radius,this.phi=phi,this.theta=theta,this}copy(other){return this.radius=other.radius,this.phi=other.phi,this.theta=other.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(v){return this.setFromCartesianCoords(v.x,v.y,v.z)}setFromCartesianCoords(x,y,z){return this.radius=Math.sqrt(x*x+y*y+z*z),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(x,z),this.phi=Math.acos(clamp(y/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}let _tables=function(){let buffer=new ArrayBuffer(4),floatView=new Float32Array(buffer),uint32View=new Uint32Array(buffer),baseTable=new Uint32Array(512),shiftTable=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(baseTable[i]=0,baseTable[256|i]=32768,shiftTable[i]=24,shiftTable[256|i]=24):e<-14?(baseTable[i]=1024>>-e-14,baseTable[256|i]=1024>>-e-14|32768,shiftTable[i]=-e-1,shiftTable[256|i]=-e-1):e<=15?(baseTable[i]=e+15<<10,baseTable[256|i]=e+15<<10|32768,shiftTable[i]=13,shiftTable[256|i]=13):e<128?(baseTable[i]=31744,baseTable[256|i]=64512,shiftTable[i]=24,shiftTable[256|i]=24):(baseTable[i]=31744,baseTable[256|i]=64512,shiftTable[i]=13,shiftTable[256|i]=13)}let mantissaTable=new Uint32Array(2048),exponentTable=new Uint32Array(64),offsetTable=new Uint32Array(64);for(let i1=1;i1<1024;++i1){let m=i1<<13,e1=0;for(;(8388608&m)==0;)m<<=1,e1-=8388608;m&=-8388609,e1+=947912704,mantissaTable[i1]=m|e1}for(let i2=1024;i2<2048;++i2)mantissaTable[i2]=939524096+(i2-1024<<13);for(let i3=1;i3<31;++i3)exponentTable[i3]=i3<<23;exponentTable[31]=1199570944,exponentTable[32]=2147483648;for(let i4=33;i4<63;++i4)exponentTable[i4]=2147483648+(i4-32<<23);exponentTable[63]=3347054592;for(let i5=1;i5<64;++i5)32!==i5&&(offsetTable[i5]=1024);return{floatView:floatView,uint32View:uint32View,baseTable:baseTable,shiftTable:shiftTable,mantissaTable:mantissaTable,exponentTable:exponentTable,offsetTable:offsetTable}}();var DataUtils=Object.freeze({__proto__:null,toHalfFloat:function(val){Math.abs(val)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),val=clamp(val,-65504,65504),_tables.floatView[0]=val;let f=_tables.uint32View[0],e=f>>23&511;return _tables.baseTable[e]+((8388607&f)>>_tables.shiftTable[e])},fromHalfFloat:function(val){let m=val>>10;return _tables.uint32View[0]=_tables.mantissaTable[_tables.offsetTable[m]+(1023&val)]+_tables.exponentTable[m],_tables.floatView[0]}});"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"146"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="146")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.