vendor: 4,170 bytes, lines 1-5
1/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Vx="170",Hx={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Gx={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},wu=0,kl=1,Cu=2,Wx=3,Xx=0,Rh=1,Ru=2,vn=3,Gn=0,Oe=1,yn=2,Vn=0,qi=1,Vl=2,Hl=3,Gl=4,Iu=5,ci=100,Pu=101,Lu=102,Du=103,Uu=104,Nu=200,Fu=201,Ou=202,Bu=203,so=204,ro=205,zu=206,ku=207,Vu=208,Hu=209,Gu=210,Wu=211,Xu=212,qu=213,Yu=214,ao=0,oo=1,lo=2,$i=3,co=4,ho=5,uo=6,fo=7,na=0,Zu=1,Ju=2,Hn=0,$u=1,Ku=2,Qu=3,ju=4,td=5,ed=6,nd=7,Wl="attached",id="detached",Zo=300,Wn=301,fi=302,kr=303,Vr=304,Ns=306,Hr=1e3,sn=1001,Gr=1002,we=1003,Ih=1004,qx=1004,Ms=1005,Yx=1005,Me=1006,Dr=1007,Zx=1007,Sn=1008,Jx=1008,wn=1009,Ph=1010,Lh=1011,Rs=1012,Jo=1013,Xn=1014,Xe=1015,Fs=1016,$o=1017,Ko=1018,Ki=1020,Dh=35902,Uh=1021,Nh=1022,Fe=1023,Fh=1024,Oh=1025,Yi=1026,Qi=1027,Qo=1028,ia=1029,Bh=1030,jo=1031,$x=1032,tl=1033,Ur=33776,Nr=33777,Fr=33778,Or=33779,po=35840,mo=35841,go=35842,_o=35843,xo=36196,vo=37492,yo=37496,Mo=37808,So=37809,bo=37810,Eo=37811,To=37812,Ao=37813,wo=37814,Co=37815,Ro=37816,Io=37817,Po=37818,Lo=37819,Do=37820,Uo=37821,Br=36492,No=36494,Fo=36495,zh=36283,Oo=36284,Bo=36285,zo=36286,sd=2200,rd=2201,ad=2202,Wr=2300,ko=2301,ma=2302,ki=2400,Vi=2401,Xr=2402,el=2500,kh=2501,Kx=0,Qx=1,jx=2,od=3200,ld=3201,tv=3202,ev=3203,gi=0,cd=1,zn="",Ge="srgb",ns="srgb-linear",sa="linear",se="srgb",nv=0,Mi=7680,iv=7681,sv=7682,rv=7683,av=34055,ov=34056,lv=5386,cv=512,hv=513,uv=514,dv=515,fv=516,pv=517,mv=518,Xl=519,hd=512,ud=513,dd=514,Vh=515,fd=516,pd=517,md=518,gd=519,qr=35044,gv=35048,_v=35040,xv=35045,vv=35049,yv=35041,Mv=35046,Sv=35050,bv=35042,Ev="100",ql="300 es",bn=2e3,Yr=2001;class Cn{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,t);t.target=null}}}const be=["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"];let Yl=1234567;const di=Math.PI/180,ji=180/Math.PI;function qe(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(be[s&255]+be[s>>8&255]+be[s>>16&255]+be[s>>24&255]+"-"+be[t&255]+be[t>>8&255]+"-"+be[t>>16&15|64]+be[t>>24&255]+"-"+be[e&63|128]+be[e>>8&255]+"-"+be[e>>16&255]+be[e>>24&255]+be[n&255]+be[n>>8&255]+be[n>>16&255]+be[n>>24&255]).toLowerCase()}function fe(s,t,e){return Math.max(t,Math.min(e,s))}function nl(s,t){return(s%t+t)%t}function _d(s,t,e,n,i){return n+(s-t)*(i-n)/(e-t)}
vendor: 4,382 bytes, line 5
5function xd(s,t,e){return s!==t?(e-s)/(t-s):0}function As(s,t,e){return(1-e)*s+e*t}function vd(s,t,e,n){return As(s,t,1-Math.exp(-e*n))}function yd(s,t=1){return t-Math.abs(nl(s,t*2)-t)}function Md(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*(3-2*s))}function Sd(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*s*(s*(s*6-15)+10))}function bd(s,t){return s+Math.floor(Math.random()*(t-s+1))}function Ed(s,t){return s+Math.random()*(t-s)}function Td(s){return s*(.5-Math.random())}function Ad(s){s!==void 0&&(Yl=s);let t=Yl+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function wd(s){return s*di}function Cd(s){return s*ji}function Rd(s){return(s&s-1)===0&&s!==0}function Id(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Pd(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Ld(s,t,e,n,i){const r=Math.cos,a=Math.sin,o=r(e/2),l=a(e/2),c=r((t+n)/2),h=a((t+n)/2),u=r((t-n)/2),d=a((t-n)/2),f=r((n-t)/2),m=a((n-t)/2);switch(i){case"XYX":s.set(o*h,l*u,l*d,o*c);break;case"YZY":s.set(l*d,o*h,l*u,o*c);break;case"ZXZ":s.set(l*u,l*d,o*h,o*c);break;case"XZX":s.set(o*h,l*m,l*f,o*c);break;case"YXY":s.set(l*f,o*h,l*m,o*c);break;case"ZYZ":s.set(l*m,l*f,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ie(s,t){switch(t.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function kt(s,t){switch(t.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Tv={DEG2RAD:di,RAD2DEG:ji,generateUUID:qe,clamp:fe,euclideanModulo:nl,mapLinear:_d,inverseLerp:xd,lerp:As,damp:vd,pingpong:yd,smoothstep:Md,smootherstep:Sd,randInt:bd,randFloat:Ed,randFloatSpread:Td,seededRandom:Ad,degToRad:wd,radToDeg:Cd,isPowerOfTwo:Rd,ceilPowerOfTwo:Id,floorPowerOfTwo:Pd,setQuaternionFromProperEuler:Ld,normalize:kt,denormalize:Ie};class ${constructor(t=0,e=0){$.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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}
vendor: 11,389 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(fe(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zt{constructor(t,e,n,i,r,a,o,l,c){zt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,r,a,o,l,c)}set(t,e,n,i,r,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=r,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],y=i[1],v=i[4],x=i[7],P=i[2],T=i[5],C=i[8];return r[0]=a*_+o*y+l*P,r[3]=a*g+o*v+l*T,r[6]=a*p+o*x+l*C,r[1]=c*_+h*y+u*P,r[4]=c*g+h*v+u*T,r[7]=c*p+h*x+u*C,r[2]=d*_+f*y+m*P,r[5]=d*g+f*v+m*T,r[8]=d*p+f*x+m*C,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*r*h+n*o*l+i*r*c-i*a*l}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,d=o*l-h*r,f=c*r-a*l,m=e*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return t[0]=u*_,t[1]=(i*c-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=d*_,t[4]=(h*e-i*l)*_,t[5]=(i*r-o*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*r)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-i*c,i*l,-i*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(ga.makeScale(t,e)),this}rotate(t){return this.premultiply(ga.makeRotation(-t)),this}translate(t,e){return this.premultiply(ga.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const ga=new zt;function Hh(s){for(let t=s.length-1;t>=0;--t)if(s[t]>=65535)return!0;return!1}const Dd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Hi(s,t){return new Dd[s](t)}function Is(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Ud(){const s=Is("canvas");return s.style.display="block",s}const Zl={};function Ss(s){s in Zl||(Zl[s]=!0,console.warn(s))}function Nd(s,t,e){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(t,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}function Fd(s){const t=s.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function Od(s){const t=s.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}const Zt={enabled:!0,workingColorSpace:ns,spaces:{},convert:function(s,t,e){return this.enabled===!1||t===e||!t||!e||(this.spaces[t].transfer===se&&(s.r=En(s.r),s.g=En(s.g),s.b=En(s.b)),this.spaces[t].primaries!==this.spaces[e].primaries&&(s.applyMatrix3(this.spaces[t].toXYZ),s.applyMatrix3(this.spaces[e].fromXYZ)),this.spaces[e].transfer===se&&(s.r=Zi(s.r),s.g=Zi(s.g),s.b=Zi(s.b))),s},fromWorkingColorSpace:function(s,t){return this.convert(s,this.workingColorSpace,t)},toWorkingColorSpace:function(s,t){return this.convert(s,t,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===zn?sa:this.spaces[s].transfer},getLuminanceCoefficients:function(s,t=this.workingColorSpace){return s.fromArray(this.spaces[t].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,t,e){return s.copy(this.spaces[t].toXYZ).multiply(this.spaces[e].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}};function En(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Zi(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}const Jl=[.64,.33,.3,.6,.15,.06],$l=[.2126,.7152,.0722],Kl=[.3127,.329],Ql=new zt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),jl=new zt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Zt.define({[ns]:{primaries:Jl,whitePoint:Kl,transfer:sa,toXYZ:Ql,fromXYZ:jl,luminanceCoefficients:$l,workingColorSpaceConfig:{unpackColorSpace:Ge},outputColorSpaceConfig:{drawingBufferColorSpace:Ge}},[Ge]:{primaries:Jl,whitePoint:Kl,transfer:se,toXYZ:Ql,fromXYZ:jl,luminanceCoefficients:$l,outputColorSpaceConfig:{drawingBufferColorSpace:Ge}}});let Si;class Bd{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Si===void 0&&(Si=Is("canvas")),Si.width=t.width,Si.height=t.height;const n=Si.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Si}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Is("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=En(r[a]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){const e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(En(e[n]/255)*255):e[n]=En(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let zd=0;class Gi{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zd++}),this.uuid=qe(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(_a(i[a].image)):r.push(_a(i[a]))}else r=_a(i);n.url=r}return e||(t.images[this.uuid]=n),n}}function _a(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?Bd.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let kd=0;class me extends Cn{constructor(t=me.DEFAULT_IMAGE,e=me.DEFAULT_MAPPING,n=sn,i=sn,r=Me,a=Sn,o=Fe,l=wn,c=me.DEFAULT_ANISOTROPY,h=zn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:kd++}),this.uuid=qe(),this.name="",this.source=new Gi(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new $(0,0),this.repeat=new $(1,1),this.center=new $(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace
vendor: 19,529 bytes, line 5
5=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Zo)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Hr:t.x=t.x-Math.floor(t.x);break;case sn:t.x=t.x<0?0:1;break;case Gr:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Hr:t.y=t.y-Math.floor(t.y);break;case sn:t.y=t.y<0?0:1;break;case Gr:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}me.DEFAULT_IMAGE=null;me.DEFAULT_MAPPING=Zo;me.DEFAULT_ANISOTROPY=1;class Qt{constructor(t=0,e=0,n=0,i=1){Qt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const l=t.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const v=(c+1)/2,x=(f+1)/2,P=(p+1)/2,T=(h+d)/4,C=(u+_)/4,R=(m+g)/4;return v>x&&v>P?v<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(v),i=T/n,r=C/n):x>P?x<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(x),n=T/i,r=R/i):P<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(P),n=C/r,i=R/r),this.set(n,i,r,e),this}let y=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(u-_)/y,this.z=(d-h)/y,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Vd extends Cn{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Qt(0,0,t,e),this.scissorTest=!1,this.viewport=new Qt(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Me,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new me(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let n=0,i=t.textures.length;n<i;n++)this.textures[n]=t.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new Gi(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class on extends Vd{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class il extends me{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=we,this.minFilter=we,this.wrapR=sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Av extends on{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new il(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class Gh extends me{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=we,this.minFilter=we,this.wrapR=sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class wv extends on{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Gh(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class Ye{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=r[a+0],f=r[a+1],m=r[a+2],_=r[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u;return}if(o===1){t[e+0]=d,t[e+1]=f,t[e+2]=m,t[e+3]=_;return}if(u!==_||l!==d||c!==f||h!==m){let g=1-o;const p=l*d+c*f+h*m+u*_,y=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const P=Math.sqrt(v),T=Math.atan2(P,p*y);g=Math.sin(g*T)/P,o=Math.sin(o*T)/P}const x=o*y;if(l=l*g+d*x,c=c*g+f*x,h=h*g+m*x,u=u*g+_*x,g===1-o){const P=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=P,c*=P,h*=P,u*=P}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,r,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=r[a],d=r[a+1],f=r[a+2],m=r[a+3];return t[e]=o*m+h*u+l*f-c*d,t[e+1]=l*m+h*d+c*u-o*f,t[e+2]=c*m+h*f+o*d-l*u,t[e+3]=h*m-o*u-l*d-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(r/2),d=l(n/2),f=l(i/2),m=l(r/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(r-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(r-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(r+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(fe(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+i*c-r*l,this._y=i*h+a*l+r*o-n*c,this._z=r*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-e;return this._w=f*a+e*this._w,this._x=f*n+e*this._x,this._y=f*i+e*this._y,this._z=f*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,d=Math.sin(e*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class w{constructor(t=0,e=0,n=0){w.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(tc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(tc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*i-o*n),h=2*(o*e-r*i),u=2*(r*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-r*u,this.z=i+l*u+r*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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,929 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-r*o,this.y=r*a-n*l,this.z=n*o-i*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return xa.copy(this).projectOnVector(t),this.sub(xa)}reflect(t){return this.sub(xa.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(fe(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const xa=new w,tc=new Ye;class Be{constructor(t=new w(1/0,1/0,1/0),e=new w(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(tn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(tn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=tn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(n!==void 0){const r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,tn):tn.fromBufferAttribute(r,a),tn.applyMatrix4(t.matrixWorld),this.expandByPoint(tn);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Hs.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Hs.copy(n.boundingBox)),Hs.applyMatrix4(t.matrixWorld),this.union(Hs)}const i=t.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tn),tn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(cs),Gs.subVectors(this.max,cs),bi.subVectors(t.a,cs),Ei.subVectors(t.b,cs),Ti.subVectors(t.c,cs),Ln.subVectors(Ei,bi),Dn.subVectors(Ti,Ei),Zn.subVectors(bi,Ti);let e=[0,-Ln.z,Ln.y,0,-Dn.z,Dn.y,0,-Zn.z,Zn.y,Ln.z,0,-Ln.x,Dn.z,0,-Dn.x,Zn.z,0,-Zn.x,-Ln.y,Ln.x,0,-Dn.y,Dn.x,0,-Zn.y,Zn.x,0];return!va(e,bi,Ei,Ti,Gs)||(e=[1,0,0,0,1,0,0,0,1],!va(e,bi,Ei,Ti,Gs))?!1:(Ws.crossVectors(Ln,Dn),e=[Ws.x,Ws.y,Ws.z],va(e,bi,Ei,Ti,Gs))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radiu
vendor: 20,428 bytes, line 5
5s=this.getSize(tn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(fn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const fn=[new w,new w,new w,new w,new w,new w,new w,new w],tn=new w,Hs=new Be,bi=new w,Ei=new w,Ti=new w,Ln=new w,Dn=new w,Zn=new w,cs=new w,Gs=new w,Ws=new w,Jn=new w;function va(s,t,e,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Jn.fromArray(s,r);const o=i.x*Math.abs(Jn.x)+i.y*Math.abs(Jn.y)+i.z*Math.abs(Jn.z),l=t.dot(Jn),c=e.dot(Jn),h=n.dot(Jn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Hd=new Be,hs=new w,ya=new w;class Pe{constructor(t=new w,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):Hd.setFromPoints(t).getCenter(n);let i=0;for(let r=0,a=t.length;r<a;r++)i=Math.max(i,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;hs.subVectors(t,this.center);const e=hs.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(hs,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(ya.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(hs.copy(t.center).add(ya)),this.expandByPoint(hs.copy(t.center).sub(ya))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const pn=new w,Ma=new w,Xs=new w,Un=new w,Sa=new w,qs=new w,ba=new w;class Os{constructor(t=new w,e=new w(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,pn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=pn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(pn.copy(this.origin).addScaledVector(this.direction,e),pn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Ma.copy(t).add(e).multiplyScalar(.5),Xs.copy(e).sub(t).normalize(),Un.copy(this.origin).sub(Ma);const r=t.distanceTo(e)*.5,a=-this.direction.dot(Xs),o=Un.dot(this.direction),l=-Un.dot(Xs),c=Un.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=r*h,u>=0)if(d>=-m)if(d<=m){const _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-l),r),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-r,-l),r),f=d*(d+2*l)+c):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-l),r),f=-u*u+d*(d+2*l)+c);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Ma).addScaledVector(Xs,d),f}intersectSphere(t,e){pn.subVectors(t.center,this.origin);const n=pn.dot(this.direction),i=pn.dot(pn)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,i=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,i=(t.min.x-d.x)*c),h>=0?(r=(t.min.y-d.y)*h,a=(t.max.y-d.y)*h):(r=(t.max.y-d.y)*h,a=(t.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(t.min.z-d.z)*u,l=(t.max.z-d.z)*u):(o=(t.max.z-d.z)*u,l=(t.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,pn)!==null}intersectTriangle(t,e,n,i,r){Sa.subVectors(e,t),qs.subVectors(n,t),ba.crossVectors(Sa,qs);let a=this.direction.dot(ba),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Un.subVectors(this.origin,t);const l=o*this.direction.dot(qs.crossVectors(Un,qs));if(l<0)return null;const c=o*this.direction.dot(Sa.cross(Un));if(c<0||l+c>a)return null;const h=-o*Un.dot(ba);return h<0?null:this.at(h/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ut{constructor(t,e,n,i,r,a,o,l,c,h,u,d,f,m,_,g){Ut.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,r,a,o,l,c,h,u,d,f,m,_,g)}set(t,e,n,i,r,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=t,p[4]=e,p[8]=n,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 Ut().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Ai.setFromMatrixColumn(t,0).length(),r=1/Ai.setFromMatrixColumn(t,1).length(),a=1/Ai.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(t.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=f+m*c,e[5]=d-_*c,e[9]=-o*l,e[2]=_-d*c,e[6]=m+f*c,e[10]=a*l}else if(t.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d+_*o,e[4]=m*o-f,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=f*o-m,e[6]=_+d*o,e[10]=a*l}else if(t.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d-_*o,e[4]=-a*u,e[8]=m+f*o,e[1]=f+m*o,e[5]=a*h,e[9]=_-d*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=m*c-f,e[8]=d*c+_,e[1]=l*u,e[5]=_*c+d,e[9]=f*c-m,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=_-d*u,e[8]=m*u+f,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=f*u+m,e[10]=d-_*u}else if(t.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+_,e[5]=a*h,e[9]=f*u-m,e[2]=m*u-f,e[6]=o*h,e[10]=_*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Gd,t,Wd)}lookAt(t,e,n){const i=this.elements;return Ve.subVectors(t,e),Ve.lengthSq()===0&&(Ve.z=1),Ve.normalize(),Nn.crossVectors(n,Ve),Nn.lengthSq()===0&&(Math.abs(n.z)===1?Ve.x+=1e-4:Ve.z+=1e-4,Ve.normalize(),Nn.crossVectors(n,Ve)),Nn.normalize(),Ys.crossVectors(Ve,Nn),i[0]=Nn.x,i[4]=Ys.x,i[8]=Ve.x,i[1]=Nn.y,i[5]=Ys.y,i[9]=Ve.y,i[2]=Nn.z,i[6]=Ys.z,i[10]=Ve.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],y=n[3],v=n[7],x=n[11],P=n[15],T=i[0],C=i[4],R=i[8],b=i[12],M=i[1],L=i[5],k=i[9],O=i[13],V=i[2],Z=i[6],H=i[10],et=i[14],G=i[3],ot=i[7],pt=i[11],Mt=i[15];return r[0]=a*T+o*M+l*V+c*G,r[4]=a*C+o*L+l*Z+c*ot,r[8]=a*R+o*k+l*H+c*pt,r[12]=a*b+o*O+l*et+c*Mt,r[1]=h*T+u*M+d*V+f*G,r[5]=h*C+u*L+d*Z+f*ot,r[9]=h*R+u*k+d*H+f*pt,r[13]=h*b+u*O+d*et+f*Mt,r[2]=m*T+_*M+g*V+p*G,r[6]=m*C+_*L+g*Z+p*ot,r[10]=m*R+_*k+g*H+p*pt,r[14]=m*b+_*O+g*et+p*Mt,r[3]=y*T+v*M+x*V+P*G,r[7]=y*C+v*L+x*Z+P*ot,r[11]=y*R+v*k+x*H+P*pt,r[15]=y*b+v*O+x*et+P*Mt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],f=t[14],m=t[3],_=t[7],g=t[11],p=t[15];return m*(+r*l*u-i*c*u-r*o*d+n*c*d+i*o*f-n*l*f)+_*(+e*l*f-e*c*d+r*a*d-i*a*f+i*c*h-r*l*h)+g*(+e*c*u-e*o*f-r*a*u+n*a*f+r*o*h-n*c*h)+p*(-i*o*h-e*l*u+e*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],f=t[11],m=t[12],_=t[13],g=t[14],p=t[15],y=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,v=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,x=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,P=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,T=e*y+n*v+i*x+r*P;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/T;return t[0]=y*C,t[1]=(_*d*r-u*g*r-_*i*f+n*g*f+u*i*p-n*d*p)*C,t[2]=(o*g*r-_*l*r+_*i*c-n*g*c-o*i*p+n*l*p)*C,t[3]=(u*l*r-o*d*r-u*i*c+n*d*c+o*i*f-n*l*f)*C,t[4]=v*C,t[5]=(h*g*r-m*d*r+m*i*f-e*g*f-h*i*p+e*d*p)*C,t[6]=(m*l*r-a*g*r-m*i*c+e*g*c+a*i*p-e*l*p)*C,t[7]=(a*d*r-h*l*r+h*i*c-e*d*c-a*i*f+e*l*f)*C,t[8]=x*C,t[9]=(m*u*r-h*_*r-m*n*f+e*_*f+h*n*p-e*u*p)*C,t[10]=(a*_*r-m*o*r+m*n*c-e*_*c-a*n*p+e*o*p)*C,t[11]=(h*o*r-a*u*r-h*n*c+e*u*c+a*n*f-e*o*f)*C,t[12]=P*C,t[13]=(h*_*i-m*u*i+m*n*d-e*_*d-h*n*g+e*u*g)*C,t[14]=(m*o*i-a*_*i-m*n*l+e*_*l+a*n*g-e*o*g)*C,t[15]=(a*u*i-h*o*i+h*n*l-e*u*l-a*n*d+e*o*d)*C,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,o=t.y,l=t.z,c=r*a,h=r*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,r*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,o=e._z,l=e._w,c=r+r,h=a+a,u=o+o,d=r*c,f=r*h,m=r*u,_=a*h,g=a*u,p=o*u,y=l*c,v=l*h,x=l*u,P=n.x,T=n.y,C=n.z;return i[0]=(1-(_+p))*P,i[1]=(f+x)*P,i[2]=(m-v)*P,i[3]=0,i[4]=(f-x)*T,i[5]=(1-(d+p))*T,i[6]=(g+y)*T,i[7]=0,i[8]=(m+v)*C,i[9]=(g-y)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Ai.set(i[0],i[1],i[2]).length();const a=Ai.set(i[4],i[5],i[6]).length(),o=Ai.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],en.copy(this);const c=1/r,h=1/a,u=1/o;return en.elements[0]*=c,en.elements[1]*=c,en.elements[2]*=c,en.elements[4]*=h,en.elements[5]*=h,en.elements[6]*=h,en.elements[8]*=u,en.elements[9]*=u,en.elements[10]*=u,e.setFromRotationMatrix(en),n.x=r,n.y=a,n.z=o,this}makePerspective(t,e,n,i,r,a,o=bn){const l=this.elements,c=2*r/(e-t),h=2*r/(n-i),u=(e+t)/(e-t),d=(n+i)/(n-i);let f,m;if(o===bn)f=-(a+r)/(a-r),m=-2*a*r/(a-r);else if(o===Yr)f=-a/(a-r),m=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,r,a,o=bn){const l=this.elements,c=1/(e-t),h=1/(n-i),u=1/(a-r),d=(e+t)*c,f=(n+i)*h;let m,_;if(o===bn)m=(a+r)*u,_=-2*u;else if(o===Yr)m=r*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Ai=new w,en=new Ut,Gd=new w(0,0,0),Wd=new w(1,1,1),Nn=new w,Ys=new w,Ve=new w,ec=new Ut,nc=new Ye;class Ke{constructor(t=0,e=0,n=0,i=Ke.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin(fe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-fe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(fe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-fe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(fe(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-fe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ec.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ec,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return nc.setFromEuler(this),this.setFromQuaternion(nc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ke.DEFAULT_ORDER="XYZ";class sl{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Xd=0;const ic=new w,wi=new Ye,mn=new Ut,Zs=new w,us=new w,qd=new w,Yd=new Ye,sc=new w(1,0,0),rc=new w(0,1,0),ac=new w(0,0,1),oc={type:"added"},Zd={type:"removed"},Ci={type:"childadded",child:null},Ea={type:"childremoved",child:null};class jt extends Cn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xd++}),this.uuid=qe(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=jt.DEFAULT_UP.clone();const t=new w,e=new Ke,n=new Ye,i=new w(1,1,1);function r(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ut},normalMatrix:{value:new zt}}),this.matrix=new Ut,this.matrixWorld=new Ut,this.matrixAutoUpdate=jt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new sl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}
vendor: 4,289 bytes, line 5
5setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return wi.setFromAxisAngle(t,e),this.quaternion.multiply(wi),this}rotateOnWorldAxis(t,e){return wi.setFromAxisAngle(t,e),this.quaternion.premultiply(wi),this}rotateX(t){return this.rotateOnAxis(sc,t)}rotateY(t){return this.rotateOnAxis(rc,t)}rotateZ(t){return this.rotateOnAxis(ac,t)}translateOnAxis(t,e){return ic.copy(t).applyQuaternion(this.quaternion),this.position.add(ic.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(sc,t)}translateY(t){return this.translateOnAxis(rc,t)}translateZ(t){return this.translateOnAxis(ac,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(mn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Zs.copy(t):Zs.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),us.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mn.lookAt(us,Zs,this.up):mn.lookAt(Zs,us,this.up),this.quaternion.setFromRotationMatrix(mn),i&&(mn.extractRotation(i.matrixWorld),wi.setFromRotationMatrix(mn),this.quaternion.premultiply(wi.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(oc),Ci.child=t,this.dispatchEvent(Ci),Ci.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Zd),Ea.child=t,this.dispatchEvent(Ea),Ea.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),mn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),mn.multiply(t.parent.matrixWorld)),t.applyMatrix4(mn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(oc),Ci.child=t,this.dispatchEvent(Ci),Ci.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(us,t,qd),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(us,Yd,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 7,415 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];r(t.shapes,u)}else r(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(r(t.materials,this.material[l]));i.material=o}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(r(t.animations,l))}}if(e){const o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),u=a(t.shapes),d=a(t.skeletons),f=a(t.animations),m=a(t.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const i=t.children[n];this.add(i.clone())}return this}}jt.DEFAULT_UP=new w(0,1,0);jt.DEFAULT_MATRIX_AUTO_UPDATE=!0;jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const nn=new w,gn=new w,Ta=new w,_n=new w,Ri=new w,Ii=new w,lc=new w,Aa=new w,wa=new w,Ca=new w,Ra=new Qt,Ia=new Qt,Pa=new Qt;class We{constructor(t=new w,e=new w,n=new w){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),nn.subVectors(t,e),i.cross(nn);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){nn.subVectors(i,e),gn.subVectors(n,e),Ta.subVectors(t,e);const a=nn.dot(nn),o=nn.dot(gn),l=nn.dot(Ta),c=gn.dot(gn),h=gn.dot(Ta),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return r.set(1-f-m,m,f)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,_n)===null?!1:_n.x>=0&&_n.y>=0&&_n.x+_n.y<=1}static getInterpolation(t,e,n,i,r,a,o,l){return this.getBarycoord(t,e,n,i,_n)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,_n.x),l.addScaledVector(a,_n.y),l.addScaledVector(o,_n.z),l)}static getInterpolatedAttribute(t,e,n,i,r,a){return Ra.setScalar(0),Ia.setScalar(0),Pa.setScalar(0),Ra.fromBufferAttribute(t,e),Ia.fromBufferAttribute(t,n),Pa.fromBufferAttribute(t,i),a.setScalar(0),a.addScaledVector(Ra,r.x),a.addScaledVector(Ia,r.y),a.addScaledVector(Pa,r.z),a}static isFrontFacing(t,e,n,i){return nn.subVectors(n,e),gn.subVectors(t,e),nn.cross(gn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return nn.subVectors(this.c,this.b),gn.subVectors(this.a,this.b),nn.cross(gn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return We.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return We.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return We.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return We.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return We.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,o;Ri.subVectors(i,n),Ii.subVectors(r,n),Aa.subVectors(t,n);const l=Ri.dot(Aa),c=Ii.dot(Aa);if(l<=0&&c<=0)return e.copy(n);wa.subVectors(t,i);
vendor: 10,276 bytes, line 5
5const h=Ri.dot(wa),u=Ii.dot(wa);if(h>=0&&u<=h)return e.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Ri,a);Ca.subVectors(t,r);const f=Ri.dot(Ca),m=Ii.dot(Ca);if(m>=0&&f<=m)return e.copy(r);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),e.copy(n).addScaledVector(Ii,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return lc.subVectors(r,i),o=(u-h)/(u-h+(f-m)),e.copy(i).addScaledVector(lc,o);const p=1/(g+_+d);return a=_*p,o=d*p,e.copy(n).addScaledVector(Ri,a).addScaledVector(Ii,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Wh={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},Fn={h:0,s:0,l:0},Js={h:0,s:0,l:0};function La(s,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?s+(t-s)*6*e:e<1/2?t:e<2/3?s+(t-s)*6*(2/3-e):s}class mt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ge){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Zt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Zt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Zt.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Zt.workingColorSpace){if(t=nl(t,1),e=fe(e,0,1),n=fe(n,0,1),e===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=La(a,r,t+1/3),this.g=La(a,r,t),this.b=La(a,r,t-1/3)}return Zt.toWorkingColorSpace(this,i),this}setStyle(t,e=Ge){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(r,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ge){const n=Wh[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=En(t.r),this.g=En(t.g),this.b=En(t.b),this}copyLinearToSRGB(t){return this.r=Zi(t.r),this.g=Zi(t.g),this.b=Zi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ge){return Zt.fromWorkingColorSpace(Ee.copy(this),t),Math.round(fe(Ee.r*255,0,255))*65536+Math.round(fe(Ee.g*255,0,255))*256+Math.round(fe(Ee.b*255,0,255))}getHexString(t=Ge){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Zt.workingColorSpace){Zt.fromWorkingColorSpace(Ee.copy(this),e);const n=Ee.r,i=Ee.g,r=Ee.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-r)/u+(i<r?6:0);break;case i:l=(r-n)/u+2;break;case r:l=(n-i)/u+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Zt.workingColorSpace){return Zt.fromWorkingColorSpace(Ee.copy(this),e),t.r=Ee.r,t.g=Ee.g,t.b=Ee.b,t}getStyle(t=Ge){Zt.fromWorkingColorSpace(Ee.copy(this),t);const e=Ee.r,n=Ee.g,i=Ee.b;return t!==Ge?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(t,e,n){return this.getHSL(Fn),this.setHSL(Fn.h+t,Fn.s+e,Fn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Fn),t.getHSL(Js);const n=As(Fn.h,Js.h,e),i=As(Fn.s,Js.s,e),r=As(Fn.l,Js.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ee=new mt;mt.NAMES=Wh;let Jd=0;class Le extends Cn{static get type(){return"Material"}get type(){return this.constructor.type}set type(t){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Jd++}),this.uuid=qe(),this.name="",this.blending=qi,this.side=Gn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=so,this.blendDst=ro,this.blendEquation=ci,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new mt(0,0,0),this.blendAlpha=0,this.depthFunc=$i,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mi,this.stencilZFail=Mi,this.stencilZPass=Mi,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.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 7,625 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qi&&(n.blending=this.blending),this.side!==Gn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==so&&(n.blendSrc=this.blendSrc),this.blendDst!==ro&&(n.blendDst=this.blendDst),this.blendEquation!==ci&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==$i&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Xl&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const a=[];
vendor: 5,182 bytes, line 5
5for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(e){const r=i(t.textures),a=i(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const i=e.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class _i extends Le{static get type(){return"MeshBasicMaterial"}constructor(t){super(),this.isMeshBasicMaterial=!0,this.color=new mt(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.envMapRotation=new Ke,this.combine=na,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Mn=$d();function $d(){const s=new ArrayBuffer(4),t=new Float32Array(s),e=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,r[l]=c|h}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:a,offsetTable:o}}function Ne(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=fe(s,-65504,65504),Mn.floatView[0]=s;const t=Mn.uint32View[0],e=t>>23&511;return Mn.baseTable[e]+((t&8388607)>>Mn.shiftTable[e])}function bs(s){const t=s>>10;return Mn.uint32View[0]=Mn.mantissaTable[Mn.offsetTable[t]+(s&1023)]+Mn.exponentTable[t],Mn.floatView[0]}const Cv={toHalfFloat:Ne,fromHalfFloat:bs},ge=new w,$s=new $;class re{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=qr,this.updateRanges=[],this.gpuType=Xe,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;
vendor: 4,689 bytes, line 5
5for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)$s.fromBufferAttribute(this,e),$s.applyMatrix3(t),this.setXY(e,$s.x,$s.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.applyMatrix3(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.applyMatrix4(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.applyNormalMatrix(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.transformDirection(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ie(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=kt(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ie(e,this.array)),e}setX(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ie(e,this.array)),e}setY(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ie(e,this.array)),e}setZ(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ie(e,this.array)),e}setW(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array),r=kt(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==qr&&(t.usage=this.usage),t}}class Rv extends re{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Iv extends re{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class Pv extends re{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Lv extends re{constructor(t,e,n){super(new Int16Array(t),e,n)}}class Xh extends re{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Dv extends re{constructor(t,e,n){super(new Int32Array(t),e,n)}}class qh extends re{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Uv extends re{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=bs(this.array[t*this.itemSize]);return this.normalized&&(e=Ie(e,this.array)),e}setX(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize]=Ne(e),this}getY(t){let e=bs(this.array[t*this.itemSize+1]);return this.normalized&&(e=Ie(e,this.array)),e}setY(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+1]=Ne(e),this}getZ(t){let e=bs(this.array[t*this.itemSize+2]);return this.normalized&&(e=Ie(e,this.array)),e}setZ(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+2]=Ne(e),this}getW(t){let e=bs(this.array[t*this.itemSize+3]);return this.normalized&&(e=Ie(e,this.array)),e}setW(t,e){return this.normalized&&(e=kt(e,this.array)),this.array[t*this.itemSize+3]=Ne(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array)),this.array[t+0]=Ne(e),this.array[t+1]=Ne(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.array[t+0]=Ne(e),this.array[t+1]=Ne(n),this.array[t+2]=Ne(i),this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array),r=kt(r,this.array)),this.array[t+0]=Ne(e),this.array[t+1]=Ne(n),this.array[t+2]=Ne(i),this.array[t+3]=Ne(r),this}}class bt extends re{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Kd=0;
vendor: 4,197 bytes, line 5
5const $e=new Ut,Da=new jt,Pi=new w,He=new Be,ds=new Be,ye=new w;class Xt extends Cn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Kd++}),this.uuid=qe(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(Hh(t)?qh:Xh)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new zt().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return $e.makeRotationFromQuaternion(t),this.applyMatrix4($e),this}rotateX(t){return $e.makeRotationX(t),this.applyMatrix4($e),this}rotateY(t){return $e.makeRotationY(t),this.applyMatrix4($e),this}rotateZ(t){return $e.makeRotationZ(t),this.applyMatrix4($e),this}translate(t,e,n){return $e.makeTranslation(t,e,n),this.applyMatrix4($e),this}scale(t,e,n){return $e.makeScale(t,e,n),this.applyMatrix4($e),this}lookAt(t){return Da.lookAt(t),Da.updateMatrix(),this.applyMatrix4(Da.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pi).negate(),this.translate(Pi.x,Pi.y,Pi.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const n=[];for(let i=0,r=t.length;i<r;i++){const a=t[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new bt(n,3))}else{for(let n=0,i=e.count;n<i;n++){const r=t[n];e.setXYZ(n,r.x,r.y,r.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Be);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new w(-1/0,-1/0,-1/0),new w(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){const r=e[n];He.setFromBufferAttribute(r),this.morphTargetsRelative?(ye.addVectors(this.boundingBox.min,He.min),this.boundingBox.expandByPoint(ye),ye.addVectors(this.boundingBox.max,He.max),this.boundingBox.expandByPoint(ye)):(this.boundingBox.expandByPoint(He.min),this.boundingBox.expandByPoint(He.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(){this.boundingSphere===null&&(this.boundingSphere=new Pe);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new w,1/0);return}if(t){const n=this.boundingSphere.center;if(He.setFromBufferAttribute(t),e)for(let r=0,a=e.length;r<a;r++){const o=e[r];ds.setFromBufferAttribute(o),this.morphTargetsRelative?(ye.addVectors(He.min,ds.min),He.expandByPoint(ye),ye.addVectors(He.max,ds.max),He.expandByPoint(ye)):(He.expandByPoint(ds.min),He.expandByPoint(ds.max)
vendor: 8,908 bytes, line 5
5)}He.getCenter(n);let i=0;for(let r=0,a=t.count;r<a;r++)ye.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(ye));if(e)for(let r=0,a=e.length;r<a;r++){const o=e[r],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ye.fromBufferAttribute(o,c),l&&(Pi.fromBufferAttribute(t,c),ye.add(Pi)),i=Math.max(i,n.distanceToSquared(ye))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.position,i=e.normal,r=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new re(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let R=0;R<n.count;R++)o[R]=new w,l[R]=new w;const c=new w,h=new w,u=new w,d=new $,f=new $,m=new $,_=new w,g=new w;function p(R,b,M){c.fromBufferAttribute(n,R),h.fromBufferAttribute(n,b),u.fromBufferAttribute(n,M),d.fromBufferAttribute(r,R),f.fromBufferAttribute(r,b),m.fromBufferAttribute(r,M),h.sub(c),u.sub(c),f.sub(d),m.sub(d);const L=1/(f.x*m.y-m.x*f.y);isFinite(L)&&(_.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(L),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(L),o[R].add(_),o[b].add(_),o[M].add(_),l[R].add(g),l[b].add(g),l[M].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:t.count}]);for(let R=0,b=y.length;R<b;++R){const M=y[R],L=M.start,k=M.count;for(let O=L,V=L+k;O<V;O+=3)p(t.getX(O+0),t.getX(O+1),t.getX(O+2))}const v=new w,x=new w,P=new w,T=new w;function C(R){P.fromBufferAttribute(i,R),T.copy(P);const b=o[R];v.copy(b),v.sub(P.multiplyScalar(P.dot(b))).normalize(),x.crossVectors(T,b);const L=x.dot(l[R])<0?-1:1;a.setXYZW(R,v.x,v.y,v.z,L)}for(let R=0,b=y.length;R<b;++R){const M=y[R],L=M.start,k=M.count;for(let O=L,V=L+k;O<V;O+=3)C(t.getX(O+0)),C(t.getX(O+1)),C(t.getX(O+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new re(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new w,r=new w,a=new w,o=new w,l=new w,c=new w,h=new w,u=new w;if(t)for(let d=0,f=t.count;d<f;d+=3){const m=t.getX(d+0),_=t.getX(d+1),g=t.getX(d+2);i.fromBufferAttribute(e,m),r.fromBufferAttribute(e,_),a.fromBufferAttribute(e,g),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=e.count;d<f;d+=3)i.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),a.fromBufferAttribute(e,d+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ye.fromBufferAttribute(t,e),ye.normalize(),t.setXYZ(e,ye.x,ye.y,ye.z)}toNonIndexed(){function t(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*h;for(let p=0;p<h;p++)d[m++]=c[f++]}return new re(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Xt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=t(l,n);e.setAttribute(o,c)}const r=this.morphAttributes;for(const o in r){const l=[],c=r[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=t(d,n);l.push(f)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(t.data))}h.length>0&&(i[l]=h,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const i=t.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(e))}const r=t.morphAttributes;for(const c in r){const h=[],u=r[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const cc=new Ut,$n=new Os,Ks=new Pe,hc=new w,Qs=new w,js=new w,tr=new w,Ua=new w,er=new w,uc=new w,nr=new w;class _e extends jt{constructor(t=new Xt,e=new _i){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(r&&o){er.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const h=o[l],u=r[l];h!==0&&(Ua.fromBufferAttribute(u,t),a?er.addScaledVector(Ua,h):er.addScaledVector(Ua.sub(e),h))}e.add(er)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ks.copy(n.boundingSphere),Ks.applyMatrix4(r),$n.copy(t.ray).recast(t.near),!(Ks.containsPoint($n.origin)===!1&&($n.intersectSphere(Ks,hc)===null||$n.origin.distanceToSquared(hc)>(t.far-t.near)**2))&&(cc.copy(r).invert(),$n.copy(t.ray).applyMatrix4(cc),!(n.boundingBox!==null&&$n.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,$n)))}_computeIntersections(t,e,n){let i;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,P=v;x<P;x+=3){const T=o.getX(x),C=o.getX(x+1),R=o.getX(x+2);i=ir(this,p,t,n,c,h,u,T,C,R),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=o.getX(g),v=o.getX(g+1),x=o.getX(g+2);i=ir(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,P=v;x<P;x+=3){const T=x,C=x+1,R=x+2;
vendor: 6,040 bytes, lines 5-9
5i=ir(this,p,t,n,c,h,u,T,C,R),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=g,v=g+1,x=g+2;i=ir(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}}}function Qd(s,t,e,n,i,r,a,o){let l;if(t.side===Oe?l=n.intersectTriangle(a,r,i,!0,o):l=n.intersectTriangle(i,r,a,t.side===Gn,o),l===null)return null;nr.copy(o),nr.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(nr);return c<e.near||c>e.far?null:{distance:c,point:nr.clone(),object:s}}function ir(s,t,e,n,i,r,a,o,l,c){s.getVertexPosition(o,Qs),s.getVertexPosition(l,js),s.getVertexPosition(c,tr);const h=Qd(s,t,e,n,Qs,js,tr,uc);if(h){const u=new w;We.getBarycoord(uc,Qs,js,tr,u),i&&(h.uv=We.getInterpolatedAttribute(i,o,l,c,u,new $)),r&&(h.uv1=We.getInterpolatedAttribute(r,o,l,c,u,new $)),a&&(h.normal=We.getInterpolatedAttribute(a,o,l,c,u,new w),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new w,materialIndex:0};We.getNormal(Qs,js,tr,d.normal),h.face=d,h.barycoord=u}return h}class is extends Xt{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,e,t,a,r,0),m("z","y","x",1,-1,n,e,-t,a,r,1),m("x","z","y",1,1,t,n,e,i,a,2),m("x","z","y",1,-1,t,n,-e,i,a,3),m("x","y","z",1,-1,t,e,n,i,r,4),m("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(l),this.setAttribute("position",new bt(c,3)),this.setAttribute("normal",new bt(h,3)),this.setAttribute("uv",new bt(u,2));function m(_,g,p,y,v,x,P,T,C,R,b){const M=x/C,L=P/R,k=x/2,O=P/2,V=T/2,Z=C+1,H=R+1;let et=0,G=0;const ot=new w;for(let pt=0;pt<H;pt++){const Mt=pt*L-O;for(let Bt=0;Bt<Z;Bt++){const te=Bt*M-k;ot[_]=te*y,ot[g]=Mt*v,ot[p]=V,c.push(ot.x,ot.y,ot.z),ot[_]=0,ot[g]=0,ot[p]=T>0?1:-1,h.push(ot.x,ot.y,ot.z),u.push(Bt/C),u.push(1-pt/R),et+=1}}for(let pt=0;pt<R;pt++)for(let Mt=0;Mt<C;Mt++){const Bt=d+Mt+Z*pt,te=d+Mt+Z*(pt+1),Y=d+(Mt+1)+Z*(pt+1),it=d+(Mt+1)+Z*pt;l.push(Bt,te,it),l.push(te,Y,it),G+=6}o.addGroup(f,G,b),f+=G,d+=et}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new is(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function ts(s){const t={};for(const e in s){t[e]={};for(const n in s[e]){const i=s[e][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone():Array.isArray(i)?t[e][n]=i.slice():t[e][n]=i}}return t}function Re(s){const t={};for(let e=0;e<s.length;e++){const n=ts(s[e]);for(const i in n)t[i]=n[i]}return t}function jd(s){const t=[];for(let e=0;e<s.length;e++)t.push(s[e].clone());return t}function Yh(s){const t=s.getRenderTarget();return t===null?s.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Zt.workingColorSpace}const tf={clone:ts,merge:Re};var ef=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,nf=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class ln extends Le{static get type(){return"ShaderMaterial"}constructor(t){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ef,this.fragmentShader=nf,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ts(t.uniforms),this.uniformsGroups=jd(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?e.uniforms[i]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[i]={type:"m4",value:a.toArray()}:e.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class rl extends jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ut,this.projectionMatrix=new Ut,this.projectionMatrixInverse=new Ut,this.coordinateSystem=bn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}
vendor: 9,076 bytes, lines 9-44
9const On=new w,dc=new $,fc=new $;class Ae extends rl{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=ji*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(di*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ji*2*Math.atan(Math.tan(di*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){On.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(On.x,On.y).multiplyScalar(-t/On.z),On.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(On.x,On.y).multiplyScalar(-t/On.z)}getViewSize(t,e){return this.getViewBounds(t,dc,fc),e.subVectors(fc,dc)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(di*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*i/l,e-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Li=-90,Di=1;class sf extends jt{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ae(Li,Di,t,e);i.layers=this.layers,this.add(i);const r=new Ae(Li,Di,t,e);r.layers=this.layers,this.add(r);const a=new Ae(Li,Di,t,e);a.layers=this.layers,this.add(a);const o=new Ae(Li,Di,t,e);o.layers=this.layers,this.add(o);const l=new Ae(Li,Di,t,e);l.layers=this.layers,this.add(l);const c=new Ae(Li,Di,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,a,o,l]=e;for(const c of e)this.remove(c);if(t===bn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Yr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,l,c,h]=this.children,u=t.getRenderTarget(),d=t.getActiveCubeFace(),f=t.getActiveMipmapLevel(),m=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,l),t.setRenderTarget(n,4,i),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,i),t.render(e,h),t.setRenderTarget(u,d,f),t.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class ra extends me{constructor(t,e,n,i,r,a,o,l,c,h){t=t!==void 0?t:[],e=e!==void 0?e:Wn,super(t,e,n,i,r,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class rf extends on{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new ra(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Me}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},i=new is(5,5,5),r=new ln({name:"CubemapFromEquirect",uniforms:ts(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Oe,blending:Vn});r.uniforms.tEquirect.value=e;const a=new _e(i,r),o=e.minFilter;return e.minFilter===Sn&&(e.minFilter=Me),new sf(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(r)}}const Na=new w,af=new w,of=new zt;class oi{constructor(t=new w(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Na.subVectors(n,e).cross(af.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Na),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||of.getNormalMatrix(t),i=this.coplanarPoint(Na).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Kn=new Pe,sr=new w;class aa{constructor(t=new oi,e=new oi,n=new oi,i=new oi,r=new oi,a=new oi){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=bn){const n=this.planes,i=t.elements,r=i[0],a=i[1],o=i[2],l=i[3],c=i[4],h=i[5],u=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],y=i[13],v=i[14],x=i[15];if(n[0].setComponents(l-r,d-c,g-f,x-p).normalize(),n[1].setComponents(l+r,d+c,g+f,x+p).normalize(),n[2].setComponents(l+a,d+h,g+m,x+y).normalize(),n[3].setComponents(l-a,d-h,g-m,x-y).normalize(),n[4].setComponents(l-o,d-u,g-_,x-v).normalize(),e===bn)n[5].setComponents(l+o,d+u,g+_,x+v).normalize();
vendor: 6,320 bytes, lines 44-103
44else if(e===Yr)n[5].setComponents(o,u,_,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Kn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Kn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Kn)}intersectsSprite(t){return Kn.center.set(0,0,0),Kn.radius=.7071067811865476,Kn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Kn)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(sr.x=i.normal.x>0?t.max.x:t.min.x,sr.y=i.normal.y>0?t.max.y:t.min.y,sr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(sr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Zh(){let s=null,t=!1,e=null,n=null;function i(r,a){e(r,a),n=s.requestAnimationFrame(i)}return{start:function(){t!==!0&&e!==null&&(n=s.requestAnimationFrame(i),t=!0)},stop:function(){s.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){s=r}}}function lf(s){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=s.createBuffer();s.bindBuffer(l,d),s.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=s.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=s.SHORT;else if(c instanceof Uint32Array)f=s.UNSIGNED_INT;else if(c instanceof Int32Array)f=s.INT;else if(c instanceof Int8Array)f=s.BYTE;else if(c instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(s.bindBuffer(c,o),u.length===0)s.bufferSubData(c,0,h);else{u.sort((f,m)=>f.start-m.start);let d=0;for(let f=1;f<u.length;f++){const m=u[d],_=u[f];_.start<=m.start+m.count+1?m.count=Math.max(m.count,_.start+_.count-m.start):(++d,u[d]=_)}u.length=d+1;for(let f=0,m=u.length;f<m;f++){const _=u[f];s.bufferSubData(c,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=t.get(o);l&&(s.deleteBuffer(l.buffer),t.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=t.get(o);(!h||h.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=t.get(o);if(c===void 0)t.set(o,e(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:r,update:a}}class Bs extends Xt{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,a=e/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=t/o,d=e/l,f=[],m=[],_=[],g=[];for(let p=0;p<h;p++){const y=p*d-a;for(let v=0;v<c;v++){const x=v*u-r;m.push(x,-y,0),_.push(0,0,1),g.push(v/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let y=0;y<o;y++){const v=y+c*p,x=y+c*(p+1),P=y+1+c*(p+1),T=y+1+c*p;f.push(v,x,T),f.push(x,P,T)}this.setIndex(f),this.setAttribute("position",new bt(m,3)),this.setAttribute("normal",new bt(_,3)),this.setAttribute("uv",new bt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Bs(t.width,t.height,t.widthSegments,t.heightSegments)}}var cf=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,hf=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,uf=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,df=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,ff=`#ifdef USE_ALPHATEST 86 #ifdef ALPHA_TO_COVERAGE 87 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 88 if ( diffuseColor.a == 0.0 ) discard; 89 #else 90 if ( diffuseColor.a < alphaTest ) discard; 91 #endif 92#endif`,pf=`#ifdef USE_ALPHATEST 93 uniform float alphaTest; 94#endif`,mf=`#ifdef USE_AOMAP 95 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 96 reflectedLight.indirectDiffuse *= ambientOcclusion; 97 #if defined( USE_CLEARCOAT ) 98 clearcoatSpecularIndirect *= ambientOcclusion; 99 #endif 100 #if defined( USE_SHEEN ) 101 sheenSpecularIndirect *= ambientOcclusion; 102 #endif 103 #if defined( USE_ENVMAP ) && defined( STANDARD )
104 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 105 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 106 #endif 107#endif`,gf=`#ifdef USE_AOMAP 108 uniform sampler2D aoMap; 109 uniform float aoMapIntensity; 110#endif`,_f=`#ifdef USE_BATCHING 111 #if ! defined( GL_ANGLE_multi_draw ) 112 #define gl_DrawID _gl_DrawID 113 uniform int _gl_DrawID; 114 #endif 115 uniform highp sampler2D batchingTexture; 116 uniform highp usampler2D batchingIdTexture; 117 mat4 getBatchingMatrix( const in float i ) { 118 int size = textureSize( batchingTexture, 0 ).x; 119 int j = int( i ) * 4; 120 int x = j % size; 121 int y = j / size; 122 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 123 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 124 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 125 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 126 return mat4( v1, v2, v3, v4 ); 127 } 128 float getIndirectIndex( const in int i ) { 129 int size = textureSize( batchingIdTexture, 0 ).x; 130 int x = i % size; 131 int y = i / size; 132 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 133 } 134#endif 135#ifdef USE_BATCHING_COLOR 136 uniform sampler2D batchingColorTexture; 137 vec3 getBatchingColor( const in float i ) { 138 int size = textureSize( batchingColorTexture, 0 ).x; 139 int j = int( i ); 140 int x = j % size; 141 int y = j / size; 142 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 143 } 144#endif`,xf=`#ifdef USE_BATCHING 145 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 146#endif`,vf=`vec3 transformed = vec3( position ); 147#ifdef USE_ALPHAHASH 148 vPosition = vec3( position ); 149#endif`,yf=`vec3 objectNormal = vec3( normal ); 150#ifdef USE_TANGENT 151 vec3 objectTangent = vec3( tangent.xyz ); 152#endif`,Mf=`float G_BlinnPhong_Implicit( ) { 153 return 0.25; 154} 155float D_BlinnPhong( const in float shininess, const in float dotNH ) { 156 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 157} 158vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 159 vec3 halfDir = normalize( lightDir + viewDir ); 160 float dotNH = saturate( dot( normal, halfDir ) ); 161 float dotVH = saturate( dot( viewDir, halfDir ) ); 162 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 163 float G = G_BlinnPhong_Implicit( ); 164 float D = D_BlinnPhong( shininess, dotNH ); 165 return F * ( G * D ); 166} // validated`,Sf=`#ifdef USE_IRIDESCENCE 167 const mat3 XYZ_TO_REC709 = mat3( 168 3.2404542, -0.9692660, 0.0556434, 169 -1.5371385, 1.8760108, -0.2040259, 170 -0.4985314, 0.0415560, 1.0572252 171 ); 172 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 173 vec3 sqrtF0 = sqrt( fresnel0 ); 174 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 175 } 176 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 177 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 178 } 179 float IorToFresnel0( float transmittedIor, float incidentIor ) { 180 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 181 } 182 vec3 evalSensitivity( float OPD, vec3 shift ) { 183 float phase = 2.0 * PI * OPD * 1.0e-9; 184 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 185 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 186 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 187 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 188 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 ) ); 189 xyz /= 1.0685e-7; 190 vec3 rgb = XYZ_TO_REC709 * xyz; 191 return rgb; 192 } 193 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 194 vec3 I; 195 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 196 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 197 float cosTheta2Sq = 1.0 - sinTheta2Sq; 198 if ( cosTheta2Sq < 0.0 ) { 199 return vec3( 1.0 ); 200 } 201 float cosTheta2 = sqrt( cosTheta2Sq ); 202 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
203 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 204 float T121 = 1.0 - R12; 205 float phi12 = 0.0; 206 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 207 float phi21 = PI - phi12; 208 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 209 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 210 vec3 phi23 = vec3( 0.0 ); 211 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 212 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 213 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 214 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 215 vec3 phi = vec3( phi21 ) + phi23; 216 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 217 vec3 r123 = sqrt( R123 ); 218 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 219 vec3 C0 = R12 + Rs; 220 I = C0; 221 vec3 Cm = Rs - T121; 222 for ( int m = 1; m <= 2; ++ m ) { 223 Cm *= r123; 224 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 225 I += Cm * Sm; 226 } 227 return max( I, vec3( 0.0 ) ); 228 } 229#endif`,bf=`#ifdef USE_BUMPMAP 230 uniform sampler2D bumpMap; 231 uniform float bumpScale; 232 vec2 dHdxy_fwd() { 233 vec2 dSTdx = dFdx( vBumpMapUv ); 234 vec2 dSTdy = dFdy( vBumpMapUv ); 235 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 236 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 237 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 238 return vec2( dBx, dBy ); 239 } 240 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 241 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 242 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 243 vec3 vN = surf_norm; 244 vec3 R1 = cross( vSigmaY, vN ); 245 vec3 R2 = cross( vN, vSigmaX ); 246 float fDet = dot( vSigmaX, R1 ) * faceDirection; 247 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 248 return normalize( abs( fDet ) * surf_norm - vGrad ); 249 } 250#endif`,Ef=`#if NUM_CLIPPING_PLANES > 0 251 vec4 plane; 252 #ifdef ALPHA_TO_COVERAGE 253 float distanceToPlane, distanceGradient; 254 float clipOpacity = 1.0; 255 #pragma unroll_loop_start 256 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 257 plane = clippingPlanes[ i ]; 258 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 259 distanceGradient = fwidth( distanceToPlane ) / 2.0; 260 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 261 if ( clipOpacity == 0.0 ) discard; 262 } 263 #pragma unroll_loop_end 264 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 265 float unionClipOpacity = 1.0; 266 #pragma unroll_loop_start 267 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 268 plane = clippingPlanes[ i ]; 269 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 270 distanceGradient = fwidth( distanceToPlane ) / 2.0; 271 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 272 } 273 #pragma unroll_loop_end 274 clipOpacity *= 1.0 - unionClipOpacity; 275 #endif 276 diffuseColor.a *= clipOpacity; 277 if ( diffuseColor.a == 0.0 ) discard; 278 #else 279 #pragma unroll_loop_start 280 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 281 plane = clippingPlanes[ i ]; 282 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 283 } 284 #pragma unroll_loop_end 285 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 286 bool clipped = true; 287 #pragma unroll_loop_start 288 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 289 plane = clippingPlanes[ i ]; 290 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 291 } 292 #pragma unroll_loop_end 293 if ( clipped ) discard; 294 #endif 295 #endif 296#endif`,Tf=`#if NUM_CLIPPING_PLANES > 0 297 varying vec3 vClipPosition; 298 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 299#endif`,Af=`#if NUM_CLIPPING_PLANES > 0 300 varying vec3 vClipPosition; 301#endif`,wf=`#if NUM_CLIPPING_PLANES > 0 302 vClipPosition = - mvPosition.xyz; 303#endif`,Cf=`#if defined( USE_COLOR_ALPHA ) 304 diffuseColor *= vColor; 305#elif defined( USE_COLOR ) 306 diffuseColor.rgb *= vColor; 307#endif`,Rf=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) 310 varying vec3 vColor; 311#endif`,If=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 varying vec3 vColor; 315#endif`,Pf=`#if defined( USE_COLOR_ALPHA ) 316 vColor = vec4( 1.0 ); 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 vColor = vec3( 1.0 ); 319#endif 320#ifdef USE_COLOR 321 vColor *= color; 322#endif 323#ifdef USE_INSTANCING_COLOR 324 vColor.xyz *= instanceColor.xyz; 325#endif 326#ifdef USE_BATCHING_COLOR 327 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 328 vColor.xyz *= batchingColor.xyz; 329#endif`,Lf=`#define PI 3.141592653589793 330#define PI2 6.283185307179586 331#define PI_HALF 1.5707963267948966 332#define RECIPROCAL_PI 0.3183098861837907 333#define RECIPROCAL_PI2 0.15915494309189535 334#define EPSILON 1e-6 335#ifndef saturate 336#define saturate( a ) clamp( a, 0.0, 1.0 ) 337#endif 338#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 339float pow2( const in float x ) { return x*x; } 340vec3 pow2( const in vec3 x ) { return x*x; } 341float pow3( const in float x ) { return x*x*x; } 342float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 343float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 344float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 345highp float rand( const in vec2 uv ) { 346 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 347 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 348 return fract( sin( sn ) * c ); 349} 350#ifdef HIGH_PRECISION 351 float precisionSafeLength( vec3 v ) { return length( v ); } 352#else 353 float precisionSafeLength( vec3 v ) { 354 float maxComponent = max3( abs( v ) ); 355 return length( v / maxComponent ) * maxComponent; 356 } 357#endif 358struct IncidentLight { 359 vec3 color; 360 vec3 direction; 361 bool visible; 362}; 363struct ReflectedLight { 364 vec3 directDiffuse; 365 vec3 directSpecular; 366 vec3 indirectDiffuse; 367 vec3 indirectSpecular; 368}; 369#ifdef USE_ALPHAHASH 370 varying vec3 vPosition; 371#endif 372vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 373 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 374} 375vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 376 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 377} 378mat3 transposeMat3( const in mat3 m ) { 379 mat3 tmp; 380 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 381 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 382 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 383 return tmp; 384} 385bool isPerspectiveMatrix( mat4 m ) { 386 return m[ 2 ][ 3 ] == - 1.0; 387} 388vec2 equirectUv( in vec3 dir ) { 389 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 390 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 391 return vec2( u, v ); 392}
393vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 394 return RECIPROCAL_PI * diffuseColor; 395} 396vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 397 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 398 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 399} 400float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} // validated`,Df=`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt ); 444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_m0 - 2.0 462 #define cubeUV_r1 0.8 463 #define cubeUV_m1 - 1.0 464 #define cubeUV_r4 0.4 465 #define cubeUV_m4 2.0 466 #define cubeUV_r5 0.305 467 #define cubeUV_m5 3.0 468 #define cubeUV_r6 0.21 469 #define cubeUV_m6 4.0 470 float roughnessToMip( float roughness ) { 471 float mip = 0.0; 472 if ( roughness >= cubeUV_r1 ) { 473 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 474 } else if ( roughness >= cubeUV_r4 ) { 475 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 476 } else if ( roughness >= cubeUV_r5 ) { 477 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 478 } else if ( roughness >= cubeUV_r6 ) { 479 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 480 } else { 481 mip = - 2.0 * log2( 1.16 * roughness ); } 482 return mip; 483 } 484 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 485 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 486 float mipF = fract( mip ); 487 float mipInt = floor( mip ); 488 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 489 if ( mipF == 0.0 ) { 490 return vec4( color0, 1.0 ); 491 } else { 492 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 493 return vec4( mix( color0, color1, mipF ), 1.0 ); 494 } 495 } 496#endif`,Uf=`vec3 transformedNormal = objectNormal; 497#ifdef USE_TANGENT 498 vec3 transformedTangent = objectTangent; 499#endif 500#ifdef USE_BATCHING 501 mat3 bm = mat3( batchingMatrix ); 502 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 503 transformedNormal = bm * transformedNormal; 504 #ifdef USE_TANGENT 505 transformedTangent = bm * transformedTangent; 506 #endif 507#endif 508#ifdef USE_INSTANCING 509 mat3 im = mat3( instanceMatrix ); 510 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 511 transformedNormal = im * transformedNormal; 512 #ifdef USE_TANGENT 513 transformedTangent = im * transformedTangent; 514 #endif 515#endif 516transformedNormal = normalMatrix * transformedNormal; 517#ifdef FLIP_SIDED 518 transformedNormal = - transformedNormal; 519#endif 520#ifdef USE_TANGENT 521 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 522 #ifdef FLIP_SIDED 523 transformedTangent = - transformedTangent; 524 #endif 525#endif`,Nf=`#ifdef USE_DISPLACEMENTMAP 526 uniform sampler2D displacementMap; 527 uniform float displacementScale; 528 uniform float displacementBias; 529#endif`,Ff=`#ifdef USE_DISPLACEMENTMAP 530 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
530placementBias ); 531#endif`,Of=`#ifdef USE_EMISSIVEMAP 532 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 533 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 534 emissiveColor = sRGBTransferEOTF( emissiveColor ); 535 #endif 536 totalEmissiveRadiance *= emissiveColor.rgb; 537#endif`,Bf=`#ifdef USE_EMISSIVEMAP 538 uniform sampler2D emissiveMap; 539#endif`,zf="gl_FragColor = linearToOutputTexel( gl_FragColor );",kf=`vec4 LinearTransferOETF( in vec4 value ) { 540 return value; 541} 542vec4 sRGBTransferEOTF( in vec4 value ) { 543 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 544} 545vec4 sRGBTransferOETF( in vec4 value ) { 546 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 ); 547}`,Vf=`#ifdef USE_ENVMAP 548 #ifdef ENV_WORLDPOS 549 vec3 cameraToFrag; 550 if ( isOrthographic ) { 551 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 552 } else { 553 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 554 } 555 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 556 #ifdef ENVMAP_MODE_REFLECTION 557 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 558 #else 559 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 560 #endif 561 #else 562 vec3 reflectVec = vReflect; 563 #endif 564 #ifdef ENVMAP_TYPE_CUBE 565 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 566 #else 567 vec4 envColor = vec4( 0.0 ); 568 #endif 569 #ifdef ENVMAP_BLENDING_MULTIPLY 570 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 571 #elif defined( ENVMAP_BLENDING_MIX ) 572 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 573 #elif defined( ENVMAP_BLENDING_ADD ) 574 outgoingLight += envColor.xyz * specularStrength * reflectivity; 575 #endif 576#endif`,Hf=`#ifdef USE_ENVMAP 577 uniform float envMapIntensity; 578 uniform float flipEnvMap; 579 uniform mat3 envMapRotation; 580 #ifdef ENVMAP_TYPE_CUBE 581 uniform samplerCube envMap; 582 #else 583 uniform sampler2D envMap; 584 #endif 585 586#endif`,Gf=`#ifdef USE_ENVMAP 587 uniform float reflectivity; 588 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 589 #define ENV_WORLDPOS 590 #endif 591 #ifdef ENV_WORLDPOS 592 varying vec3 vWorldPosition; 593 uniform float refractionRatio; 594 #else 595 varying vec3 vReflect; 596 #endif 597#endif`,Wf=`#ifdef USE_ENVMAP 598 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 599 #define ENV_WORLDPOS 600 #endif 601 #ifdef ENV_WORLDPOS 602 603 varying vec3 vWorldPosition; 604 #else 605 varying vec3 vReflect; 606 uniform float refractionRatio; 607 #endif 608#endif`,Xf=`#ifdef USE_ENVMAP 609 #ifdef ENV_WORLDPOS 610 vWorldPosition = worldPosition.xyz; 611 #else 612 vec3 cameraToVertex; 613 if ( isOrthographic ) { 614 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 615 } else {
616 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 617 } 618 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 619 #ifdef ENVMAP_MODE_REFLECTION 620 vReflect = reflect( cameraToVertex, worldNormal ); 621 #else 622 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 623 #endif 624 #endif 625#endif`,qf=`#ifdef USE_FOG 626 vFogDepth = - mvPosition.z; 627#endif`,Yf=`#ifdef USE_FOG 628 varying float vFogDepth; 629#endif`,Zf=`#ifdef USE_FOG 630 #ifdef FOG_EXP2 631 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 632 #else 633 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 634 #endif 635 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 636#endif`,Jf=`#ifdef USE_FOG 637 uniform vec3 fogColor; 638 varying float vFogDepth; 639 #ifdef FOG_EXP2 640 uniform float fogDensity; 641 #else 642 uniform float fogNear; 643 uniform float fogFar; 644 #endif 645#endif`,$f=`#ifdef USE_GRADIENTMAP 646 uniform sampler2D gradientMap; 647#endif 648vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 649 float dotNL = dot( normal, lightDirection ); 650 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 651 #ifdef USE_GRADIENTMAP 652 return vec3( texture2D( gradientMap, coord ).r ); 653 #else 654 vec2 fw = fwidth( coord ) * 0.5; 655 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 656 #endif 657}`,Kf=`#ifdef USE_LIGHTMAP 658 uniform sampler2D lightMap; 659 uniform float lightMapIntensity; 660#endif`,Qf=`LambertMaterial material; 661material.diffuseColor = diffuseColor.rgb; 662material.specularStrength = specularStrength;`,jf=`varying vec3 vViewPosition; 663struct LambertMaterial { 664 vec3 diffuseColor; 665 float specularStrength; 666}; 667void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 668 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 669 vec3 irradiance = dotNL * directLight.color; 670 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 671} 672void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 673 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 674} 675#define RE_Direct RE_Direct_Lambert 676#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tp=`uniform bool receiveShadow; 677uniform vec3 ambientLightColor; 678#if defined( USE_LIGHT_PROBES ) 679 uniform vec3 lightProbe[ 9 ]; 680#endif 681vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 682 float x = normal.x, y = normal.y, z = normal.z; 683 vec3 result = shCoefficients[ 0 ] * 0.886227; 684 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 685 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 686 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 687 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 688 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 689 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 690 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 691 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 692 return result; 693} 694vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 695 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 696 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 697 return irradiance; 698} 699vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 700 vec3 irradiance = ambientLightColor; 701 return irradiance; 702} 703float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 704 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 705 if ( cutoffDistance > 0.0 ) { 706 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 707 } 708 return distanceFalloff; 709} 710float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 711 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 712} 713#if NUM_DIR_LIGHTS > 0 714 struct DirectionalLight { 715 vec3 direction; 716 vec3 color; 717 }; 718 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 719 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 720 light.color = directionalLight.color; 721 light.direction = directionalLight.direction; 722 light.visible = true; 723 } 724#endif 725#if NUM_POINT_LIGHTS > 0 726 struct PointLight { 727 vec3 position; 728 vec3 color; 729 float distance; 730 float decay; 731 }; 732 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 733 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 734 vec3 lVector = pointLight.position - geometryPosition; 735 light.direction = normalize( lVector ); 736 float lightDistance = length( lVector ); 737 light.color = pointLight.color; 738 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 739 light.visible = ( light.color != vec3( 0.0 ) ); 740 } 741#endif
742#if NUM_SPOT_LIGHTS > 0 743 struct SpotLight { 744 vec3 position; 745 vec3 direction; 746 vec3 color; 747 float distance; 748 float decay; 749 float coneCos; 750 float penumbraCos; 751 }; 752 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 753 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 754 vec3 lVector = spotLight.position - geometryPosition; 755 light.direction = normalize( lVector ); 756 float angleCos = dot( light.direction, spotLight.direction ); 757 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 758 if ( spotAttenuation > 0.0 ) { 759 float lightDistance = length( lVector ); 760 light.color = spotLight.color * spotAttenuation; 761 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 762 light.visible = ( light.color != vec3( 0.0 ) ); 763 } else { 764 light.color = vec3( 0.0 ); 765 light.visible = false; 766 } 767 } 768#endif 769#if NUM_RECT_AREA_LIGHTS > 0 770 struct RectAreaLight { 771 vec3 color; 772 vec3 position; 773 vec3 halfWidth; 774 vec3 halfHeight; 775 }; 776 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 777 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 778#endif 779#if NUM_HEMI_LIGHTS > 0 780 struct HemisphereLight { 781 vec3 direction; 782 vec3 skyColor; 783 vec3 groundColor; 784 }; 785 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 786 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 787 float dotNL = dot( normal, hemiLight.direction ); 788 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 789 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 790 return irradiance; 791 } 792#endif`,ep=`#ifdef USE_ENVMAP 793 vec3 getIBLIrradiance( const in vec3 normal ) { 794 #ifdef ENVMAP_TYPE_CUBE_UV 795 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 796 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 797 return PI * envMapColor.rgb * envMapIntensity; 798 #else 799 return vec3( 0.0 ); 800 #endif 801 } 802 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 803 #ifdef ENVMAP_TYPE_CUBE_UV 804 vec3 reflectVec = reflect( - viewDir, normal ); 805 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 806 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 807 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 808 return envMapColor.rgb * envMapIntensity; 809 #else 810 return vec3( 0.0 ); 811 #endif 812 } 813 #ifdef USE_ANISOTROPY 814 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 815 #ifdef ENVMAP_TYPE_CUBE_UV 816 vec3 bentNormal = cross( bitangent, viewDir ); 817 bentNormal = normalize( cross( bentNormal, bitangent ) ); 818 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 819 return getIBLRadiance( viewDir, bentNormal, roughness ); 820 #else 821 return vec3( 0.0 ); 822 #endif 823 } 824 #endif 825#endif`,np=`ToonMaterial material; 826material.diffuseColor = diffuseColor.rgb;`,ip=`varying vec3 vViewPosition; 827struct ToonMaterial { 828 vec3 diffuseColor; 829}; 830void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 831 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 832 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 833} 834void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 835 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 836} 837#define RE_Direct RE_Direct_Toon 838#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,sp=`BlinnPhongMaterial material; 839material.diffuseColor = diffuseColor.rgb; 840material.specularColor = specular; 841material.specularShininess = shininess; 842material.specularStrength = specularStrength;`,rp=`varying vec3 vViewPosition; 843struct BlinnPhongMaterial { 844 vec3 diffuseColor; 845 vec3 specularColor; 846 float specularShininess; 847 float specularStrength; 848}; 849void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
850 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 851 vec3 irradiance = dotNL * directLight.color; 852 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 853 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 854} 855void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 856 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857} 858#define RE_Direct RE_Direct_BlinnPhong 859#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ap=`PhysicalMaterial material; 860material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 861vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 862float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 863material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 864material.roughness = min( material.roughness, 1.0 ); 865#ifdef IOR 866 material.ior = ior; 867 #ifdef USE_SPECULAR 868 float specularIntensityFactor = specularIntensity; 869 vec3 specularColorFactor = specularColor; 870 #ifdef USE_SPECULAR_COLORMAP 871 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 872 #endif 873 #ifdef USE_SPECULAR_INTENSITYMAP 874 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 875 #endif 876 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 877 #else 878 float specularIntensityFactor = 1.0; 879 vec3 specularColorFactor = vec3( 1.0 ); 880 material.specularF90 = 1.0; 881 #endif 882 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 883#else 884 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 885 material.specularF90 = 1.0; 886#endif 887#ifdef USE_CLEARCOAT 888 material.clearcoat = clearcoat; 889 material.clearcoatRoughness = clearcoatRoughness; 890 material.clearcoatF0 = vec3( 0.04 ); 891 material.clearcoatF90 = 1.0; 892 #ifdef USE_CLEARCOATMAP 893 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 894 #endif 895 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 896 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 897 #endif 898 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 899 material.clearcoatRoughness += geometryRoughness; 900 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 901#endif 902#ifdef USE_DISPERSION 903 material.dispersion = dispersion; 904#endif 905#ifdef USE_IRIDESCENCE 906 material.iridescence = iridescence; 907 material.iridescenceIOR = iridescenceIOR; 908 #ifdef USE_IRIDESCENCEMAP 909 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 910 #endif 911 #ifdef USE_IRIDESCENCE_THICKNESSMAP 912 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 913 #else 914 material.iridescenceThickness = iridescenceThicknessMaximum; 915 #endif 916#endif 917#ifdef USE_SHEEN 918 material.sheenColor = sheenColor; 919 #ifdef USE_SHEEN_COLORMAP 920 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 921 #endif 922 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 923 #ifdef USE_SHEEN_ROUGHNESSMAP 924 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 925 #endif 926#endif 927#ifdef USE_ANISOTROPY 928 #ifdef USE_ANISOTROPYMAP 929 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 930 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 931 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 932 #else 933 vec2 anisotropyV = anisotropyVector; 934 #endif 935 material.anisotropy = length( anisotropyV ); 936 if( material.anisotropy == 0.0 ) { 937 anisotropyV = vec2( 1.0, 0.0 ); 938 } else { 939 anisotropyV /= material.anisotropy; 940 material.anisotropy = saturate( material.anisotropy ); 941 } 942 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
943 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 944 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 945#endif`,op
vendor: 14,687 bytes, lines 945-1246
945=`struct PhysicalMaterial { 946 vec3 diffuseColor; 947 float roughness; 948 vec3 specularColor; 949 float specularF90; 950 float dispersion; 951 #ifdef USE_CLEARCOAT 952 float clearcoat; 953 float clearcoatRoughness; 954 vec3 clearcoatF0; 955 float clearcoatF90; 956 #endif 957 #ifdef USE_IRIDESCENCE 958 float iridescence; 959 float iridescenceIOR; 960 float iridescenceThickness; 961 vec3 iridescenceFresnel; 962 vec3 iridescenceF0; 963 #endif 964 #ifdef USE_SHEEN 965 vec3 sheenColor; 966 float sheenRoughness; 967 #endif 968 #ifdef IOR 969 float ior; 970 #endif 971 #ifdef USE_TRANSMISSION 972 float transmission; 973 float transmissionAlpha; 974 float thickness; 975 float attenuationDistance; 976 vec3 attenuationColor; 977 #endif 978 #ifdef USE_ANISOTROPY 979 float anisotropy; 980 float alphaT; 981 vec3 anisotropyT; 982 vec3 anisotropyB; 983 #endif 984}; 985vec3 clearcoatSpecularDirect = vec3( 0.0 ); 986vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 987vec3 sheenSpecularDirect = vec3( 0.0 ); 988vec3 sheenSpecularIndirect = vec3(0.0 ); 989vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 990 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 991 float x2 = x * x; 992 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 993 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 994} 995float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 996 float a2 = pow2( alpha ); 997 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 998 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 999 return 0.5 / max( gv + gl, EPSILON ); 1000} 1001float D_GGX( const in float alpha, const in float dotNH ) { 1002 float a2 = pow2( alpha ); 1003 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1004 return RECIPROCAL_PI * a2 / pow2( denom ); 1005} 1006#ifdef USE_ANISOTROPY 1007 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1008 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1009 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1010 float v = 0.5 / ( gv + gl ); 1011 return saturate(v); 1012 } 1013 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1014 float a2 = alphaT * alphaB; 1015 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1016 highp float v2 = dot( v, v ); 1017 float w2 = a2 / v2; 1018 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1019 } 1020#endif 1021#ifdef USE_CLEARCOAT 1022 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1023 vec3 f0 = material.clearcoatF0; 1024 float f90 = material.clearcoatF90; 1025 float roughness = material.clearcoatRoughness; 1026 float alpha = pow2( roughness ); 1027 vec3 halfDir = normalize( lightDir + viewDir ); 1028 float dotNL = saturate( dot( normal, lightDir ) ); 1029 float dotNV = saturate( dot( normal, viewDir ) ); 1030 float dotNH = saturate( dot( normal, halfDir ) ); 1031 float dotVH = saturate( dot( viewDir, halfDir ) ); 1032 vec3 F = F_Schlick( f0, f90, dotVH ); 1033 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1034 float D = D_GGX( alpha, dotNH ); 1035 return F * ( V * D ); 1036 } 1037#endif 1038vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1039 vec3 f0 = material.specularColor; 1040 float f90 = material.specularF90; 1041 float roughness = material.roughness; 1042 float alpha = pow2( roughness ); 1043 vec3 halfDir = normalize( lightDir + viewDir ); 1044 float dotNL = saturate( dot( normal, lightDir ) ); 1045 float dotNV = saturate( dot( normal, viewDir ) ); 1046 float dotNH = saturate( dot( normal, halfDir ) ); 1047 float dotVH = saturate( dot( viewDir, halfDir ) ); 1048 vec3 F = F_Schlick( f0, f90, dotVH ); 1049 #ifdef USE_IRIDESCENCE 1050 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1051 #endif 1052 #ifdef USE_ANISOTROPY 1053 float dotTL = dot( material.anisotropyT, lightDir ); 1054 float dotTV = dot( material.anisotropyT, viewDir ); 1055 float dotTH = dot( material.anisotropyT, halfDir ); 1056 float dotBL = dot( material.anisotropyB, lightDir ); 1057 float dotBV = dot( material.anisotropyB, viewDir ); 1058 float dotBH = dot( material.anisotropyB, halfDir ); 1059 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1060 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1061 #else 1062 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1063 float D = D_GGX( alpha, dotNH ); 1064 #endif 1065 return F * ( V * D ); 1066} 1067vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1068 const float LUT_SIZE = 64.0; 1069 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1070 const float LUT_BIAS = 0.5 / LUT_SIZE; 1071 float dotNV = saturate( dot( N, V ) ); 1072 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1073 uv = uv * LUT_SCALE + LUT_BIAS; 1074 return uv; 1075} 1076float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1077 float l = length( f ); 1078 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1079} 1080vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1081 float x = dot( v1, v2 ); 1082 float y = abs( x ); 1083 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1084 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1085 float v = a / b; 1086 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1087 return cross( v1, v2 ) * theta_sintheta; 1088} 1089vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1090 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1091 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1092 vec3 lightNormal = cross( v1, v2 ); 1093 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1094 vec3 T1, T2; 1095 T1 = normalize( V - N * dot( V, N ) ); 1096 T2 = - cross( N, T1 ); 1097 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1098 vec3 coords[ 4 ]; 1099 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1100 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1101 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1102 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1103 coords[ 0 ] = normalize( coords[ 0 ] ); 1104 coords[ 1 ] = normalize( coords[ 1 ] ); 1105 coords[ 2 ] = normalize( coords[ 2 ] ); 1106 coords[ 3 ] = normalize( coords[ 3 ] ); 1107 vec3 vectorFormFactor = vec3( 0.0 ); 1108 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1109 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1110 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1111 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1112 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1113 return vec3( result ); 1114} 1115#if defined( USE_SHEEN ) 1116float D_Charlie( float roughness, float dotNH ) { 1117 float alpha = pow2( roughness ); 1118 float invAlpha = 1.0 / alpha; 1119 float cos2h = dotNH * dotNH; 1120 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1121 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1122} 1123float V_Neubelt( float dotNV, float dotNL ) { 1124 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1125} 1126vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1127 vec3 halfDir = normalize( lightDir + viewDir ); 1128 float dotNL = saturate( dot( normal, lightDir ) ); 1129 float dotNV = saturate( dot( normal, viewDir ) ); 1130 float dotNH = saturate( dot( normal, halfDir ) ); 1131 float D = D_Charlie( sheenRoughness, dotNH ); 1132 float V = V_Neubelt( dotNV, dotNL ); 1133 return sheenColor * ( D * V ); 1134} 1135#endif 1136float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1137 float dotNV = saturate( dot( normal, viewDir ) ); 1138 float r2 = roughness * roughness; 1139 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1140 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1141 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1142 return saturate( DG * RECIPROCAL_PI ); 1143} 1144vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1145 float dotNV = saturate( dot( normal, viewDir ) ); 1146 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1147 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1148 vec4 r = roughness * c0 + c1; 1149 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1150 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1151 return fab; 1152} 1153vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1154 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1155 return specularColor * fab.x + specularF90 * fab.y; 1156} 1157#ifdef USE_IRIDESCENCE 1158void 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 ) { 1159#else 1160void 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 ) { 1161#endif 1162 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1163 #ifdef USE_IRIDESCENCE 1164 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1165 #else 1166 vec3 Fr = specularColor; 1167 #endif 1168 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1169 float Ess = fab.x + fab.y; 1170 float Ems = 1.0 - Ess; 1171 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1172 singleScatter += FssEss; 1173 multiScatter += Fms * Ems; 1174} 1175#if NUM_RECT_AREA_LIGHTS > 0 1176 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1177 vec3 normal = geometryNormal; 1178 vec3 viewDir = geometryViewDir; 1179 vec3 position = geometryPosition; 1180 vec3 lightPos = rectAreaLight.position; 1181 vec3 halfWidth = rectAreaLight.halfWidth; 1182 vec3 halfHeight = rectAreaLight.halfHeight; 1183 vec3 lightColor = rectAreaLight.color; 1184 float roughness = material.roughness; 1185 vec3 rectCoords[ 4 ]; 1186 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1187 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1188 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1189 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1190 vec4 t1 = texture2D( ltc_1, uv ); 1191 vec4 t2 = texture2D( ltc_2, uv ); 1192 mat3 mInv = mat3( 1193 vec3( t1.x, 0, t1.y ), 1194 vec3( 0, 1, 0 ), 1195 vec3( t1.z, 0, t1.w ) 1196 ); 1197 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1198 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1199 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1200 } 1201#endif 1202void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1203 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1204 vec3 irradiance = dotNL * directLight.color; 1205 #ifdef USE_CLEARCOAT 1206 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1207 vec3 ccIrradiance = dotNLcc * directLight.color; 1208 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1209 #endif 1210 #ifdef USE_SHEEN 1211 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1212 #endif 1213 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1214 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1215} 1216void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1217 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1218} 1219void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1220 #ifdef USE_CLEARCOAT 1221 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1222 #endif 1223 #ifdef USE_SHEEN 1224 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1225 #endif 1226 vec3 singleScattering = vec3( 0.0 ); 1227 vec3 multiScattering = vec3( 0.0 ); 1228 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1229 #ifdef USE_IRIDESCENCE 1230 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1231 #else 1232 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1233 #endif 1234 vec3 totalScattering = singleScattering + multiScattering; 1235 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1236 reflectedLight.indirectSpecular += radiance * singleScattering; 1237 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1238 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1239} 1240#define RE_Direct RE_Direct_Physical 1241#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1242#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1243#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1244float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1245 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1246}`,
1246lp=` 1247vec3 geometryPosition = - vViewPosition; 1248vec3 geometryNormal = normal; 1249vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1250vec3 geometryClearcoatNormal = vec3( 0.0 ); 1251#ifdef USE_CLEARCOAT 1252 geometryClearcoatNormal = clearcoatNormal; 1253#endif 1254#ifdef USE_IRIDESCENCE 1255 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1256 if ( material.iridescenceThickness == 0.0 ) { 1257 material.iridescence = 0.0; 1258 } else { 1259 material.iridescence = saturate( material.iridescence ); 1260 } 1261 if ( material.iridescence > 0.0 ) { 1262 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1263 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1264 } 1265#endif 1266IncidentLight directLight; 1267#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1268 PointLight pointLight; 1269 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1270 PointLightShadow pointLightShadow; 1271 #endif 1272 #pragma unroll_loop_start 1273 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1274 pointLight = pointLights[ i ]; 1275 getPointLightInfo( pointLight, geometryPosition, directLight ); 1276 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1277 pointLightShadow = pointLightShadows[ i ]; 1278 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1279 #endif 1280 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1281 } 1282 #pragma unroll_loop_end 1283#endif 1284#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1285 SpotLight spotLight; 1286 vec4 spotColor; 1287 vec3 spotLightCoord; 1288 bool inSpotLightMap; 1289 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1290 SpotLightShadow spotLightShadow; 1291 #endif 1292 #pragma unroll_loop_start 1293 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1294 spotLight = spotLights[ i ]; 1295 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1296 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1297 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1298 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1299 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1300 #else 1301 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1302 #endif 1303 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1304 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1305 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1306 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1307 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1308 #endif 1309 #undef SPOT_LIGHT_MAP_INDEX 1310 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1311 spotLightShadow = spotLightShadows[ i ]; 1312 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1313 #endif 1314 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1315 } 1316 #pragma unroll_loop_end 1317#endif 1318#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1319 DirectionalLight directionalLight; 1320 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1321 DirectionalLightShadow directionalLightShadow; 1322 #endif 1323 #pragma unroll_loop_start 1324 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1325 directionalLight = directionalLights[ i ]; 1326 getDirectionalLightInfo( directionalLight, directLight ); 1327 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1328 directionalLightShadow = directionalLightShadows[ i ]; 1329 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1330 #endif 1331 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1332 } 1333 #pragma unroll_loop_end 1334#endif 1335#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1336 RectAreaLight rectAreaLight; 1337 #pragma unroll_loop_start 1338 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1339 rectAreaLight = rectAreaLights[ i ]; 1340 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1341 } 1342 #pragma unroll_loop_end 1343#endif 1344#if defined( RE_IndirectDiffuse ) 1345 vec3 iblIrradiance = vec3( 0.0 ); 1346 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1347 #if defined( USE_LIGHT_PROBES ) 1348 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1349 #endif 1350 #if ( NUM_HEMI_LIGHTS > 0 ) 1351 #pragma unroll_loop_start 1352 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1353 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1354 } 1355 #pragma unroll_loop_end 1356 #endif 1357#endif 1358#if defined( RE_IndirectSpecular ) 1359 vec3 radiance = vec3( 0.0 ); 1360 vec3 clearcoatRadiance = vec3( 0.0 ); 1361#endif`,cp=`#if defined( RE_IndirectDiffuse ) 1362 #ifdef USE_LIGHTMAP 1363 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1364 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1365 irradiance += lightMapIrradiance; 1366 #endif 1367 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1368 iblIrradiance += getIBLIrradiance( geometryNormal ); 1369 #endif 1370#endif 1371#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1372 #ifdef USE_ANISOTROPY 1373 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1374 #else 1375 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1376 #endif 1377 #ifdef USE_CLEARCOAT 1378 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1379 #endif 1380#endif`,hp=`#if defined( RE_IndirectDiffuse ) 1381 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1382#endif 1383#if defined( RE_IndirectSpecular ) 1384 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1385#endif`,up=`#if defined( USE_LOGDEPTHBUF ) 1386 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1387#endif`,dp=`#if defined( USE_LOGDEPTHBUF ) 1388 uniform float logDepthBufFC; 1389 varying float vFragDepth; 1390 varying float vIsPerspective; 1391#endif`,fp=`#ifdef USE_LOGDEPTHBUF 1392 varying float vFragDepth; 1393 varying float vIsPerspective; 1394#endif`,pp=`#ifdef USE_LOGDEPTHBUF 1395 vFragDepth = 1.0 + gl_Position.w; 1396 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1397#endif`,mp=`#ifdef USE_MAP 1398 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1399 #ifdef DECODE_VIDEO_TEXTURE 1400 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1401 #endif 1402 diffuseColor *= sampledDiffuseColor; 1403#endif`,gp=`#ifdef USE_MAP 1404 uniform sampler2D map; 1405#endif`,_p=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1406 #if defined( USE_POINTS_UV ) 1407 vec2 uv = vUv; 1408 #else 1409 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1410 #endif 1411#endif 1412#ifdef USE_MAP 1413 diffuseColor *= texture2D( map, uv ); 1414#endif 1415#ifdef USE_ALPHAMAP 1416 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1417#endif`,xp=`#if defined( USE_POINTS_UV ) 1418 varying vec2 vUv; 1419#else 1420 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1421 uniform mat3 uvTransform; 1422 #endif 1423#endif 1424#ifdef USE_MAP 1425 uniform sampler2D map; 1426#endif 1427#ifdef USE_ALPHAMAP 1428 uniform sampler2D alphaMap; 1429#endif`,vp=`float metalnessFactor = metalness; 1430#ifdef USE_METALNESSMAP 1431 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1432 metalnessFactor *= texelMetalness.b; 1433#endif`,yp=`#ifdef USE_METALNESSMAP 1434 uniform sampler2D metalnessMap; 1435#endif`,Mp=`#ifdef USE_INSTANCING_MORPH 1436 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1437 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1438 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1439 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1440 } 1441#endif`,Sp=`#if defined( USE_MORPHCOLORS ) 1442 vColor *= morphTargetBaseInfluence; 1443 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1444 #if defined( USE_COLOR_ALPHA ) 1445 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1446 #elif defined( USE_COLOR ) 1447 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1448 #endif 1449 } 1450#endif`,bp=`#ifdef USE_MORPHNORMALS 1451 objectNormal *= morphTargetBaseInfluence; 1452 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1453 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1454 } 1455#endif`,Ep=`#ifdef USE_MORPHTARGETS 1456 #ifndef USE_INSTANCING_MORPH 1457 uniform float morphTargetBaseInfluence; 1458 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1459 #endif 1460 uniform sampler2DArray morphTargetsTexture; 1461 uniform ivec2 morphTargetsTextureSize; 1462 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1463 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1464 int y = texelIndex / morphTargetsTextureSize.x; 1465 int x = texelIndex - y * morphTargetsTextureSize.x; 1466 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1467 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1468 } 1469#endif`,Tp=`#ifdef USE_MORPHTARGETS 1470 transformed *= morphTargetBaseInfluence; 1471 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1472 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1473 } 1474#endif`,Ap=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1475#ifdef FLAT_SHADED 1476 vec3 fdx = dFdx( vViewPosition ); 1477 vec3 fdy = dFdy( vViewPosition ); 1478 vec3 normal = normalize( cross( fdx, fdy ) ); 1479#else 1480 vec3 normal = normalize( vNormal ); 1481 #ifdef DOUBLE_SIDED 1482 normal *= faceDirection; 1483 #endif 1484#endif 1485#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1486 #ifdef USE_TANGENT 1487 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1488 #else 1489 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1490 #if defined( USE_NORMALMAP ) 1491 vNormalMapUv 1492 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1493 vClearcoatNormalMapUv 1494 #else 1495 vUv 1496 #endif 1497 ); 1498 #endif 1499 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1500 tbn[0] *= faceDirection; 1501 tbn[1] *= faceDirection; 1502 #endif 1503#endif 1504#ifdef USE_CLEARCOAT_NORMALMAP 1505 #ifdef USE_TANGENT 1506 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1507 #else 1508 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1509 #endif 1510 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1511 tbn2[0] *= faceDirection; 1512 tbn2[1] *= faceDirection; 1513 #endif 1514#endif 1515vec3 nonPerturbedNormal = normal;`,wp=`#ifdef USE_NORMALMAP_OBJECTSPACE 1516 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1517 #ifdef FLIP_SIDED 1518 normal = - normal; 1519 #endif 1520 #ifdef DOUBLE_SIDED 1521 normal = normal * faceDirection; 1522 #endif 1523 normal = normalize( normalMatrix * normal ); 1524#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1525 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1526 mapN.xy *= normalScale; 1527 normal = normalize( tbn * mapN ); 1528#elif defined( USE_BUMPMAP )
1529 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1530#endif`,Cp=`#ifndef FLAT_SHADED 1531 varying vec3 vNormal; 1532 #ifdef USE_TANGENT 1533 varying vec3 vTangent; 1534 varying vec3 vBitangent; 1535 #endif 1536#endif`,Rp=`#ifndef FLAT_SHADED 1537 varying vec3 vNormal; 1538 #ifdef USE_TANGENT 1539 varying vec3 vTangent; 1540 varying vec3 vBitangent; 1541 #endif 1542#endif`,Ip=`#ifndef FLAT_SHADED 1543 vNormal = normalize( transformedNormal ); 1544 #ifdef USE_TANGENT 1545 vTangent = normalize( transformedTangent ); 1546 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1547 #endif 1548#endif`,Pp=`#ifdef USE_NORMALMAP 1549 uniform sampler2D normalMap; 1550 uniform vec2 normalScale; 1551#endif 1552#ifdef USE_NORMALMAP_OBJECTSPACE 1553 uniform mat3 normalMatrix; 1554#endif 1555#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1556 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1557 vec3 q0 = dFdx( eye_pos.xyz ); 1558 vec3 q1 = dFdy( eye_pos.xyz ); 1559 vec2 st0 = dFdx( uv.st ); 1560 vec2 st1 = dFdy( uv.st ); 1561 vec3 N = surf_norm; 1562 vec3 q1perp = cross( q1, N ); 1563 vec3 q0perp = cross( N, q0 ); 1564 vec3 T = q1perp * st0.x + q0perp * st1.x; 1565 vec3 B = q1perp * st0.y + q0perp * st1.y; 1566 float det = max( dot( T, T ), dot( B, B ) ); 1567 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1568 return mat3( T * scale, B * scale, N ); 1569 } 1570#endif`,Lp=`#ifdef USE_CLEARCOAT 1571 vec3 clearcoatNormal = nonPerturbedNormal; 1572#endif`,Dp=`#ifdef USE_CLEARCOAT_NORMALMAP 1573 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1574 clearcoatMapN.xy *= clearcoatNormalScale; 1575 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1576#endif`,Up=`#ifdef USE_CLEARCOATMAP 1577 uniform sampler2D clearcoatMap; 1578#endif 1579#ifdef USE_CLEARCOAT_NORMALMAP 1580 uniform sampler2D clearcoatNormalMap; 1581 uniform vec2 clearcoatNormalScale; 1582#endif 1583#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1584 uniform sampler2D clearcoatRoughnessMap; 1585#endif`,Np=`#ifdef USE_IRIDESCENCEMAP 1586 uniform sampler2D iridescenceMap; 1587#endif 1588#ifdef USE_IRIDESCENCE_THICKNESSMAP 1589 uniform sampler2D iridescenceThicknessMap; 1590#endif`,Fp=`#ifdef OPAQUE 1591diffuseColor.a = 1.0; 1592#endif 1593#ifdef USE_TRANSMISSION 1594diffuseColor.a *= material.transmissionAlpha; 1595#endif 1596gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Op=`vec3 packNormalToRGB( const in vec3 normal ) { 1597 return normalize( normal ) * 0.5 + 0.5; 1598} 1599vec3 unpackRGBToNormal( const in vec3 rgb ) { 1600 return 2.0 * rgb.xyz - 1.0; 1601} 1602const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1603const float Inv255 = 1. / 255.; 1604const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1605const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1606const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1607const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1608vec4 packDepthToRGBA( const in float v ) { 1609 if( v <= 0.0 ) 1610 return vec4( 0., 0., 0., 0. ); 1611 if( v >= 1.0 ) 1612 return vec4( 1., 1., 1., 1. ); 1613 float vuf; 1614 float af = modf( v * PackFactors.a, vuf ); 1615 float bf = modf( vuf * ShiftRight8, vuf ); 1616 float gf = modf( vuf * ShiftRight8, vuf ); 1617 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1618} 1619vec3 packDepthToRGB( const in float v ) { 1620 if( v <= 0.0 ) 1621 return vec3( 0., 0., 0. ); 1622 if( v >= 1.0 ) 1623 return vec3( 1., 1., 1. ); 1624 float vuf; 1625 float bf = modf( v * PackFactors.b, vuf ); 1626 float gf = modf( vuf * ShiftRight8, vuf ); 1627 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1628} 1629vec2 packDepthToRG( const in float v ) { 1630 if( v <= 0.0 ) 1631 return vec2( 0., 0. ); 1632 if( v >= 1.0 ) 1633 return vec2( 1., 1. ); 1634 float vuf; 1635 float gf = modf( v * 256., vuf ); 1636 return vec2( vuf * Inv255, gf ); 1637} 1638float unpackRGBAToDepth( const in vec4 v ) { 1639 return dot( v, UnpackFactors4 ); 1640} 1641float unpackRGBToDepth( const in vec3 v ) { 1642 return dot( v, UnpackFactors3 ); 1643} 1644float unpackRGToDepth( const in vec2 v ) { 1645 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1646} 1647vec4 pack2HalfToRGBA( const in vec2 v ) {
1648 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1649 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1650} 1651vec2 unpackRGBATo2Half( const in vec4 v ) { 1652 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1653} 1654float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1655 return ( viewZ + near ) / ( near - far ); 1656} 1657float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1658 return depth * ( near - far ) - near; 1659} 1660float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1661 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1662} 1663float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1664 return ( near * far ) / ( ( far - near ) * depth - far ); 1665}`,Bp=`#ifdef PREMULTIPLIED_ALPHA 1666 gl_FragColor.rgb *= gl_FragColor.a; 1667#endif`,zp=`vec4 mvPosition = vec4( transformed, 1.0 ); 1668#ifdef USE_BATCHING 1669 mvPosition = batchingMatrix * mvPosition; 1670#endif 1671#ifdef USE_INSTANCING 1672 mvPosition = instanceMatrix * mvPosition; 1673#endif 1674mvPosition = modelViewMatrix * mvPosition; 1675gl_Position = projectionMatrix * mvPosition;`,kp=`#ifdef DITHERING 1676 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1677#endif`,Vp=`#ifdef DITHERING 1678 vec3 dithering( vec3 color ) { 1679 float grid_position = rand( gl_FragCoord.xy ); 1680 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1681 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1682 return color + dither_shift_RGB; 1683 } 1684#endif`,Hp=`float roughnessFactor = roughness; 1685#ifdef USE_ROUGHNESSMAP 1686 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1687 roughnessFactor *= texelRoughness.g; 1688#endif`,Gp=`#ifdef USE_ROUGHNESSMAP 1689 uniform sampler2D roughnessMap; 1690#endif`,Wp=
vendor: 8,887 bytes, lines 1690-1876
1690`#if NUM_SPOT_LIGHT_COORDS > 0 1691 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1692#endif 1693#if NUM_SPOT_LIGHT_MAPS > 0 1694 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1695#endif 1696#ifdef USE_SHADOWMAP 1697 #if NUM_DIR_LIGHT_SHADOWS > 0 1698 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1699 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1700 struct DirectionalLightShadow { 1701 float shadowIntensity; 1702 float shadowBias; 1703 float shadowNormalBias; 1704 float shadowRadius; 1705 vec2 shadowMapSize; 1706 }; 1707 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1708 #endif 1709 #if NUM_SPOT_LIGHT_SHADOWS > 0 1710 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1711 struct SpotLightShadow { 1712 float shadowIntensity; 1713 float shadowBias; 1714 float shadowNormalBias; 1715 float shadowRadius; 1716 vec2 shadowMapSize; 1717 }; 1718 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1719 #endif 1720 #if NUM_POINT_LIGHT_SHADOWS > 0 1721 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1722 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1723 struct PointLightShadow { 1724 float shadowIntensity; 1725 float shadowBias; 1726 float shadowNormalBias; 1727 float shadowRadius; 1728 vec2 shadowMapSize; 1729 float shadowCameraNear; 1730 float shadowCameraFar; 1731 }; 1732 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1733 #endif 1734 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1735 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1736 } 1737 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1738 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1739 } 1740 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1741 float occlusion = 1.0; 1742 vec2 distribution = texture2DDistribution( shadow, uv ); 1743 float hard_shadow = step( compare , distribution.x ); 1744 if (hard_shadow != 1.0 ) { 1745 float distance = compare - distribution.x ; 1746 float variance = max( 0.00000, distribution.y * distribution.y ); 1747 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 ); 1748 } 1749 return occlusion; 1750 } 1751 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1752 float shadow = 1.0; 1753 shadowCoord.xyz /= shadowCoord.w; 1754 shadowCoord.z += shadowBias; 1755 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1756 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1757 if ( frustumTest ) { 1758 #if defined( SHADOWMAP_TYPE_PCF ) 1759 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1760 float dx0 = - texelSize.x * shadowRadius; 1761 float dy0 = - texelSize.y * shadowRadius; 1762 float dx1 = + texelSize.x * shadowRadius; 1763 float dy1 = + texelSize.y * shadowRadius; 1764 float dx2 = dx0 / 2.0; 1765 float dy2 = dy0 / 2.0; 1766 float dx3 = dx1 / 2.0; 1767 float dy3 = dy1 / 2.0; 1768 shadow = ( 1769 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1770 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1771 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1772 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1773 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1786 ) * ( 1.0 / 17.0 ); 1787 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1788 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1789 float dx = texelSize.x; 1790 float dy = texelSize.y; 1791 vec2 uv = shadowCoord.xy; 1792 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1793 uv -= f * texelSize; 1794 shadow = ( 1795 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1796 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1798 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1799 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1800 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1801 f.x ) + 1802 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1803 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1804 f.x ) + 1805 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1806 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1807 f.y ) + 1808 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1809 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1810 f.y ) + 1811 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1812 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1813 f.x ), 1814 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1815 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1816 f.x ), 1817 f.y ) 1818 ) * ( 1.0 / 9.0 ); 1819 #elif defined( SHADOWMAP_TYPE_VSM ) 1820 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1821 #else 1822 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1823 #endif 1824 } 1825 return mix( 1.0, shadow, shadowIntensity ); 1826 } 1827 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1828 vec3 absV = abs( v ); 1829 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1830 absV *= scaleToCube; 1831 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1832 vec2 planar = v.xy; 1833 float almostATexel = 1.5 * texelSizeY; 1834 float almostOne = 1.0 - almostATexel; 1835 if ( absV.z >= almostOne ) { 1836 if ( v.z > 0.0 ) 1837 planar.x = 4.0 - v.x; 1838 } else if ( absV.x >= almostOne ) { 1839 float signX = sign( v.x ); 1840 planar.x = v.z * signX + 2.0 * signX; 1841 } else if ( absV.y >= almostOne ) { 1842 float signY = sign( v.y ); 1843 planar.x = v.x + 2.0 * signY + 2.0; 1844 planar.y = v.z * signY - 2.0; 1845 } 1846 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1847 } 1848 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1849 float shadow = 1.0; 1850 vec3 lightToPosition = shadowCoord.xyz; 1851 1852 float lightToPositionLength = length( lightToPosition ); 1853 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1854 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1855 vec3 bd3D = normalize( lightToPosition ); 1856 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1857 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1858 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1859 shadow = ( 1860 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1861 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1862 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1863 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1864 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1869 ) * ( 1.0 / 9.0 ); 1870 #else 1871 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1872 #endif 1873 } 1874 return mix( 1.0, shadow, shadowIntensity ); 1875 } 1876#endif`,
1876Xp=`#if NUM_SPOT_LIGHT_COORDS > 0 1877 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1878 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1879#endif 1880#ifdef USE_SHADOWMAP 1881 #if NUM_DIR_LIGHT_SHADOWS > 0 1882 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1883 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1884 struct DirectionalLightShadow { 1885 float shadowIntensity; 1886 float shadowBias; 1887 float shadowNormalBias; 1888 float shadowRadius; 1889 vec2 shadowMapSize; 1890 }; 1891 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1892 #endif 1893 #if NUM_SPOT_LIGHT_SHADOWS > 0 1894 struct SpotLightShadow { 1895 float shadowIntensity; 1896 float shadowBias; 1897 float shadowNormalBias; 1898 float shadowRadius; 1899 vec2 shadowMapSize; 1900 }; 1901 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1902 #endif 1903 #if NUM_POINT_LIGHT_SHADOWS > 0 1904 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1905 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1906 struct PointLightShadow { 1907 float shadowIntensity; 1908 float shadowBias; 1909 float shadowNormalBias; 1910 float shadowRadius; 1911 vec2 shadowMapSize; 1912 float shadowCameraNear; 1913 float shadowCameraFar; 1914 }; 1915 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1916 #endif 1917#endif`,qp=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1918 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1919 vec4 shadowWorldPosition; 1920#endif 1921#if defined( USE_SHADOWMAP ) 1922 #if NUM_DIR_LIGHT_SHADOWS > 0 1923 #pragma unroll_loop_start 1924 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1925 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1926 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1927 } 1928 #pragma unroll_loop_end 1929 #endif 1930 #if NUM_POINT_LIGHT_SHADOWS > 0 1931 #pragma unroll_loop_start 1932 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1933 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1934 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1935 } 1936 #pragma unroll_loop_end 1937 #endif 1938#endif 1939#if NUM_SPOT_LIGHT_COORDS > 0 1940 #pragma unroll_loop_start 1941 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1942 shadowWorldPosition = worldPosition; 1943 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1944 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1945 #endif 1946 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1947 } 1948 #pragma unroll_loop_end 1949#endif`,Yp=`float getShadowMask() { 1950 float shadow = 1.0; 1951 #ifdef USE_SHADOWMAP 1952 #if NUM_DIR_LIGHT_SHADOWS > 0 1953 DirectionalLightShadow directionalLight; 1954 #pragma unroll_loop_start 1955 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1956 directionalLight = directionalLightShadows[ i ]; 1957 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1958 } 1959 #pragma unroll_loop_end 1960 #endif 1961 #if NUM_SPOT_LIGHT_SHADOWS > 0 1962 SpotLightShadow spotLight; 1963 #pragma unroll_loop_start 1964 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1965 spotLight = spotLightShadows[ i ]; 1966 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1967 } 1968 #pragma unroll_loop_end 1969 #endif 1970 #if NUM_POINT_LIGHT_SHADOWS > 0 1971 PointLightShadow pointLight; 1972 #pragma unroll_loop_start 1973 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1974 pointLight = pointLightShadows[ i ]; 1975 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1976 } 1977 #pragma unroll_loop_end 1978 #endif 1979 #endif 1980 return shadow; 1981}`,Zp=`#ifdef USE_SKINNING 1982 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1983 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1984 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1985 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1986#endif`,Jp=`#ifdef USE_SKINNING 1987 uniform mat4 bindMatrix; 1988 uniform mat4 bindMatrixInverse; 1989 uniform highp sampler2D boneTexture; 1990 mat4 getBoneMatrix( const in float i ) { 1991 int size = textureSize( boneTexture, 0 ).x; 1992 int j = int( i ) * 4; 1993 int x = j % size; 1994 int y = j / size; 1995 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 1996 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 1997 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 1998 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 1999 return mat4( v1, v2, v3, v4 ); 2000 } 2001#endif`,$p=`#ifdef USE_SKINNING 2002 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2003 vec4 skinned = vec4( 0.0 ); 2004 skinned += boneMatX * skinVertex * skinWeight.x; 2005 skinned += boneMatY * skinVertex * skinWeight.y; 2006 skinned += boneMatZ * skinVertex * skinWeight.z; 2007 skinned += boneMatW * skinVertex * skinWeight.w; 2008 transformed = ( bindMatrixInverse * skinned ).xyz; 2009#endif`,Kp=`#ifdef USE_SKINNING 2010 mat4 skinMatrix = mat4( 0.0 ); 2011 skinMatrix += skinWeight.x * boneMatX; 2012 skinMatrix += skinWeight.y * boneMatY; 2013 skinMatrix += skinWeight.z * boneMatZ; 2014 skinMatrix += skinWeight.w * boneMatW; 2015 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2016 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2017 #ifdef USE_TANGENT 2018 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2019 #endif 2020#endif`,Qp=`float specularStrength; 2021#ifdef USE_SPECULARMAP 2022 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2023 specularStrength = texelSpecular.r; 2024#else 2025 specularStrength = 1.0; 2026#endif`,jp=`#ifdef USE_SPECULARMAP 2027 uniform sampler2D specularMap; 2028#endif`,tm=`#if defined( TONE_MAPPING ) 2029 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2030#endif`,em=`#ifndef saturate 2031#define saturate( a ) clamp( a, 0.0, 1.0 ) 2032#endif 2033uniform float toneMappingExposure; 2034vec3 LinearToneMapping( vec3 color ) { 2035 return saturate( toneMappingExposure * color ); 2036} 2037vec3 ReinhardToneMapping( vec3 color ) { 2038 color *= toneMappingExposure; 2039 return saturate( color / ( vec3( 1.0 ) + color ) ); 2040} 2041vec3 CineonToneMapping( vec3 color ) { 2042 color *= toneMappingExposure; 2043 color = max( vec3( 0.0 ), color - 0.004 ); 2044 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2045} 2046vec3 RRTAndODTFit( vec3 v ) { 2047 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2048 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2049 return a / b; 2050} 2051vec3 ACESFilmicToneMapping( vec3 color ) { 2052 const mat3 ACESInputMat = mat3( 2053 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2054 vec3( 0.04823, 0.01566, 0.83777 ) 2055 ); 2056 const mat3 ACESOutputMat = mat3( 2057 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2058 vec3( -0.07367, -0.00605, 1.07602 ) 2059 ); 2060 color *= toneMappingExposure / 0.6; 2061 color = ACESInputMat * color; 2062 color = RRTAndODTFit( color ); 2063 color = ACESOutputMat * color; 2064 return saturate( color ); 2065} 2066const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2067 vec3( 1.6605, - 0.1246, - 0.0182 ), 2068 vec3( - 0.5876, 1.1329, - 0.1006 ), 2069 vec3( - 0.0728, - 0.0083, 1.1187 ) 2070); 2071const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2072 vec3( 0.6274, 0.0691, 0.0164 ), 2073 vec3( 0.3293, 0.9195, 0.0880 ), 2074 vec3( 0.0433, 0.0113, 0.8956 ) 2075); 2076vec3 agxDefaultContrastApprox( vec3 x ) { 2077 vec3 x2 = x * x; 2078 vec3 x4 = x2 * x2; 2079 return + 15.5 * x4 * x2 2080 - 40.14 * x4 * x 2081 + 31.96 * x4 2082 - 6.868 * x2 * x 2083 + 0.4298 * x2 2084 + 0.1191 * x 2085 - 0.00232; 2086} 2087vec3 AgXToneMapping( vec3 color ) { 2088 const mat3 AgXInsetMatrix = mat3( 2089 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2090 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2091 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2092 );
2093 const mat3 AgXOutsetMatrix = mat3( 2094 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2095 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2096 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2097 ); 2098 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2099 color *= toneMappingExposure; 2100 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2101 color = AgXInsetMatrix * color; 2102 color = max( color, 1e-10 ); color = log2( color ); 2103 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2104 color = clamp( color, 0.0, 1.0 ); 2105 color = agxDefaultContrastApprox( color ); 2106 color = AgXOutsetMatrix * color; 2107 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2108 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2109 color = clamp( color, 0.0, 1.0 ); 2110 return color; 2111} 2112vec3 NeutralToneMapping( vec3 color ) { 2113 const float StartCompression = 0.8 - 0.04; 2114 const float Desaturation = 0.15; 2115 color *= toneMappingExposure; 2116 float x = min( color.r, min( color.g, color.b ) ); 2117 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2118 color -= offset; 2119 float peak = max( color.r, max( color.g, color.b ) ); 2120 if ( peak < StartCompression ) return color; 2121 float d = 1. - StartCompression; 2122 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2123 color *= newPeak / peak; 2124 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2125 return mix( color, vec3( newPeak ), g ); 2126} 2127vec3 CustomToneMapping( vec3 color ) { return color; }`,nm=`#ifdef USE_TRANSMISSION 2128 material.transmission = transmission; 2129 material.transmissionAlpha = 1.0; 2130 material.thickness = thickness; 2131 material.attenuationDistance = attenuationDistance; 2132 material.attenuationColor = attenuationColor; 2133 #ifdef USE_TRANSMISSIONMAP 2134 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2135 #endif 2136 #ifdef USE_THICKNESSMAP 2137 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2138 #endif 2139 vec3 pos = vWorldPosition; 2140 vec3 v = normalize( cameraPosition - pos ); 2141 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2142 vec4 transmitted = getIBLVolumeRefraction( 2143 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2144 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2145 material.attenuationColor, material.attenuationDistance ); 2146 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2147 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2148#endif`,im=`#ifdef USE_TRANSMISSION 2149 uniform float transmission; 2150 uniform float thickness; 2151 uniform float attenuationDistance; 2152 uniform vec3 attenuationColor; 2153 #ifdef USE_TRANSMISSIONMAP 2154 uniform sampler2D transmissionMap; 2155 #endif 2156 #ifdef USE_THICKNESSMAP 2157 uniform sampler2D thicknessMap; 2158 #endif 2159 uniform vec2 transmissionSamplerSize; 2160 uniform sampler2D transmissionSamplerMap; 2161 uniform mat4 modelMatrix; 2162 uniform mat4 projectionMatrix; 2163 varying vec3 vWorldPosition; 2164 float w0( float a ) { 2165 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2166 } 2167 float w1( float a ) { 2168 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2169 } 2170 float w2( float a ){ 2171 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2172 } 2173 float w3( float a ) { 2174 return ( 1.0 / 6.0 ) * ( a * a * a ); 2175 } 2176 float g0( float a ) { 2177 return w0( a ) + w1( a ); 2178 } 2179 float g1( float a ) { 2180 return w2( a ) + w3( a ); 2181 } 2182 float h0( float a ) { 2183 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2184 } 2185 float h1( float a ) { 2186 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2187 } 2188 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2189 uv = uv * texelSize.zw + 0.5; 2190 vec2 iuv = floor( uv ); 2191 vec2 fuv = fract( uv ); 2192 float g0x = g0( fuv.x ); 2193 float g1x = g1( fuv.x ); 2194 float h0x = h0( fuv.x ); 2195 float h1x = h1( fuv.x ); 2196 float h0y = h0( fuv.y ); 2197 float h1y = h1( fuv.y ); 2198 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2199 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2200 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2201 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2202 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2203 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2204 } 2205 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2206 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2207 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2208 vec2 fLodSizeInv = 1.0 / fLodSize; 2209 vec2 cLodSizeInv = 1.0 / cLodSize; 2210 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2211 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2212 return mix( fSample, cSample, fract( lod ) ); 2213 } 2214 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2215 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2216 vec3 modelScale; 2217 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2218 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2219 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2220 return normalize( refractionVector ) * thickness * modelScale; 2221 } 2222 float applyIorToRoughness( const in float roughness, const in float ior ) { 2223 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2224 } 2225 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2226 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2227 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2228 } 2229 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2230 if ( isinf( attenuationDistance ) ) { 2231 return vec3( 1.0 ); 2232 } else { 2233 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2234 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2235 } 2236 } 2237 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2238 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2239 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2240 const in vec3 attenuationColor, const in float attenuationDistance ) { 2241 vec4 transmittedLight; 2242 vec3 transmittance; 2243 #ifdef USE_DISPERSION 2244 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2245 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2246 for ( int i = 0; i < 3; i ++ ) { 2247 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2248 vec3 refractedRayExit = position + transmissionRay; 2249 2250 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2251 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2252 refractionCoords += 1.0; 2253 refractionCoords /= 2.0; 2254 2255 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2256 transmittedLight[ i ] = transmissionSample[ i ]; 2257 transmittedLight.a += transmissionSample.a; 2258 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2259 } 2260 transmittedLight.a /= 3.0; 2261 2262 #else 2263 2264 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2265 vec3 refractedRayExit = position + transmissionRay; 2266 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2267 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2268 refractionCoords += 1.0; 2269 refractionCoords /= 2.0; 2270 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2271 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2272 2273 #endif 2274 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2275 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2276 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2277 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2278 } 2279#endif`,sm=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2280 varying vec2 vUv; 2281#endif 2282#ifdef USE_MAP 2283 varying vec2 vMapUv; 2284#endif 2285#ifdef USE_ALPHAMAP
2286 varying vec2 vAlphaMapUv; 2287#endif 2288#ifdef USE_LIGHTMAP 2289 varying vec2 vLightMapUv; 2290#endif 2291#ifdef USE_AOMAP 2292 varying vec2 vAoMapUv; 2293#endif 2294#ifdef USE_BUMPMAP 2295 varying vec2 vBumpMapUv; 2296#endif 2297#ifdef USE_NORMALMAP 2298 varying vec2 vNormalMapUv; 2299#endif 2300#ifdef USE_EMISSIVEMAP 2301 varying vec2 vEmissiveMapUv; 2302#endif 2303#ifdef USE_METALNESSMAP 2304 varying vec2 vMetalnessMapUv; 2305#endif 2306#ifdef USE_ROUGHNESSMAP 2307 varying vec2 vRoughnessMapUv; 2308#endif 2309#ifdef USE_ANISOTROPYMAP 2310 varying vec2 vAnisotropyMapUv; 2311#endif 2312#ifdef USE_CLEARCOATMAP 2313 varying vec2 vClearcoatMapUv; 2314#endif 2315#ifdef USE_CLEARCOAT_NORMALMAP 2316 varying vec2 vClearcoatNormalMapUv; 2317#endif 2318#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2319 varying vec2 vClearcoatRoughnessMapUv; 2320#endif 2321#ifdef USE_IRIDESCENCEMAP 2322 varying vec2 vIridescenceMapUv; 2323#endif 2324#ifdef USE_IRIDESCENCE_THICKNESSMAP 2325 varying vec2 vIridescenceThicknessMapUv; 2326#endif 2327#ifdef USE_SHEEN_COLORMAP 2328 varying vec2 vSheenColorMapUv; 2329#endif 2330#ifdef USE_SHEEN_ROUGHNESSMAP 2331 varying vec2 vSheenRoughnessMapUv; 2332#endif 2333#ifdef USE_SPECULARMAP 2334 varying vec2 vSpecularMapUv; 2335#endif 2336#ifdef USE_SPECULAR_COLORMAP 2337 varying vec2 vSpecularColorMapUv; 2338#endif 2339#ifdef USE_SPECULAR_INTENSITYMAP 2340 varying vec2 vSpecularIntensityMapUv; 2341#endif 2342#ifdef USE_TRANSMISSIONMAP 2343 uniform mat3 transmissionMapTransform; 2344 varying vec2 vTransmissionMapUv; 2345#endif 2346#ifdef USE_THICKNESSMAP 2347 uniform mat3 thicknessMapTransform; 2348 varying vec2 vThicknessMapUv; 2349#endif`,rm=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2350 varying vec2 vUv; 2351#endif 2352#ifdef USE_MAP 2353 uniform mat3 mapTransform; 2354 varying vec2 vMapUv; 2355#endif 2356#ifdef USE_ALPHAMAP 2357 uniform mat3 alphaMapTransform; 2358 varying vec2 vAlphaMapUv; 2359#endif 2360#ifdef USE_LIGHTMAP 2361 uniform mat3 lightMapTransform; 2362 varying vec2 vLightMapUv; 2363#endif 2364#ifdef USE_AOMAP 2365 uniform mat3 aoMapTransform; 2366 varying vec2 vAoMapUv; 2367#endif 2368#ifdef USE_BUMPMAP 2369 uniform mat3 bumpMapTransform; 2370 varying vec2 vBumpMapUv; 2371#endif 2372#ifdef USE_NORMALMAP 2373 uniform mat3 normalMapTransform; 2374 varying vec2 vNormalMapUv; 2375#endif 2376#ifdef USE_DISPLACEMENTMAP 2377 uniform mat3 displacementMapTransform; 2378 varying vec2 vDisplacementMapUv; 2379#endif 2380#ifdef USE_EMISSIVEMAP 2381 uniform mat3 emissiveMapTransform; 2382 varying vec2 vEmissiveMapUv; 2383#endif 2384#ifdef USE_METALNESSMAP 2385 uniform mat3 metalnessMapTransform; 2386 varying vec2 vMetalnessMapUv; 2387#endif 2388#ifdef USE_ROUGHNESSMAP 2389 uniform mat3 roughnessMapTransform; 2390 varying vec2 vRoughnessMapUv; 2391#endif 2392#ifdef USE_ANISOTROPYMAP 2393 uniform mat3 anisotropyMapTransform; 2394 varying vec2 vAnisotropyMapUv; 2395#endif 2396#ifdef USE_CLEARCOATMAP 2397 uniform mat3 clearcoatMapTransform; 2398 varying vec2 vClearcoatMapUv; 2399#endif 2400#ifdef USE_CLEARCOAT_NORMALMAP 2401 uniform mat3 clearcoatNormalMapTransform; 2402 varying vec2 vClearcoatNormalMapUv; 2403#endif 2404#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2405 uniform mat3 clearcoatRoughnessMapTransform; 2406 varying vec2 vClearcoatRoughnessMapUv; 2407#endif 2408#ifdef USE_SHEEN_COLORMAP 2409 uniform mat3 sheenColorMapTransform; 2410 varying vec2 vSheenColorMapUv; 2411#endif 2412#ifdef USE_SHEEN_ROUGHNESSMAP 2413 uniform mat3 sheenRoughnessMapTransform; 2414 varying vec2 vSheenRoughnessMapUv; 2415#endif 2416#ifdef USE_IRIDESCENCEMAP 2417 uniform mat3 iridescenceMapTransform; 2418 varying vec2 vIridescenceMapUv; 2419#endif 2420#ifdef USE_IRIDESCENCE_THICKNESSMAP 2421 uniform mat3 iridescenceThicknessMapTransform; 2422 varying vec2 vIridescenceThicknessMapUv; 2423#endif 2424#ifdef USE_SPECULARMAP 2425 uniform mat3 specularMapTransform; 2426 varying vec2 vSpecularMapUv; 2427#endif 2428#ifdef USE_SPECULAR_COLORMAP 2429 uniform mat3 specularColorMapTransform; 2430 varying vec2 vSpecularColorMapUv; 2431#endif 2432#ifdef USE_SPECULAR_INTENSITYMAP 2433 uniform mat3 specularIntensityMapTransform; 2434 varying vec2 vSpecularIntensityMapUv; 2435#endif 2436#ifdef USE_TRANSMISSIONMAP 2437 uniform mat3 transmissionMapTransform; 2438 varying vec2 vTransmissionMapUv; 2439#endif 2440#ifdef USE_THICKNESSMAP 2441 uniform mat3 thicknessMapTransform; 2442 varying vec2 vThicknessMapUv; 2443#endif`,am=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2444 vUv = vec3( uv, 1 ).xy; 2445#endif 2446#ifdef USE_MAP 2447 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2448#endif 2449#ifdef USE_ALPHAMAP 2450 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2451#endif 2452#ifdef USE_LIGHTMAP 2453 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2454#endif 2455#ifdef USE_AOMAP 2456 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2457#endif 2458#ifdef USE_BUMPMAP 2459 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2460#endif 2461#ifdef USE_NORMALMAP 2462 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2463#endif 2464#ifdef USE_DISPLACEMENTMAP 2465 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2466#endif 2467#ifdef USE_EMISSIVEMAP 2468 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2469#endif 2470#ifdef USE_METALNESSMAP 2471 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2472#endif 2473#ifdef USE_ROUGHNESSMAP 2474 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2475#endif 2476#ifdef USE_ANISOTROPYMAP 2477 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2478#endif 2479#ifdef USE_CLEARCOATMAP 2480 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2481#endif 2482#ifdef USE_CLEARCOAT_NORMALMAP 2483 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2484#endif 2485#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2486 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2487#endif
2488#ifdef USE_IRIDESCENCEMAP 2489 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_IRIDESCENCE_THICKNESSMAP 2492 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_SHEEN_COLORMAP 2495 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_SHEEN_ROUGHNESSMAP 2498 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2499#endif 2500#ifdef USE_SPECULARMAP 2501 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_SPECULAR_COLORMAP 2504 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_SPECULAR_INTENSITYMAP 2507 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_TRANSMISSIONMAP 2510 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_THICKNESSMAP 2513 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2514#endif`,om=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2515 vec4 worldPosition = vec4( transformed, 1.0 ); 2516 #ifdef USE_BATCHING 2517 worldPosition = batchingMatrix * worldPosition; 2518 #endif 2519 #ifdef USE_INSTANCING 2520 worldPosition = instanceMatrix * worldPosition; 2521 #endif 2522 worldPosition = modelMatrix * worldPosition; 2523#endif`;const lm=`varying vec2 vUv; 2524uniform mat3 uvTransform; 2525void main() { 2526 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2527 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2528}`,cm=`uniform sampler2D t2D; 2529uniform float backgroundIntensity; 2530varying vec2 vUv; 2531void main() { 2532 vec4 texColor = texture2D( t2D, vUv ); 2533 #ifdef DECODE_VIDEO_TEXTURE 2534 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2535 #endif 2536 texColor.rgb *= backgroundIntensity; 2537 gl_FragColor = texColor; 2538 #include <tonemapping_fragment> 2539 #include <colorspace_fragment> 2540}`,hm=`varying vec3 vWorldDirection; 2541#include <common> 2542void main() { 2543 vWorldDirection = transformDirection( position, modelMatrix ); 2544 #include <begin_vertex> 2545 #include <project_vertex> 2546 gl_Position.z = gl_Position.w; 2547}`,um=`#ifdef ENVMAP_TYPE_CUBE 2548 uniform samplerCube envMap; 2549#elif defined( ENVMAP_TYPE_CUBE_UV ) 2550 uniform sampler2D envMap; 2551#endif 2552uniform float flipEnvMap; 2553uniform float backgroundBlurriness; 2554uniform float backgroundIntensity; 2555uniform mat3 backgroundRotation; 2556varying vec3 vWorldDirection; 2557#include <cube_uv_reflection_fragment> 2558void main() { 2559 #ifdef ENVMAP_TYPE_CUBE 2560 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2561 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2562 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2563 #else 2564 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2565 #endif 2566 texColor.rgb *= backgroundIntensity; 2567 gl_FragColor = texColor; 2568 #include <tonemapping_fragment> 2569 #include <colorspace_fragment> 2570}`,dm=`varying vec3 vWorldDirection; 2571#include <common> 2572void main() { 2573 vWorldDirection = transformDirection( position, modelMatrix ); 2574 #include <begin_vertex> 2575 #include <project_vertex> 2576 gl_Position.z = gl_Position.w; 2577}`,fm=`uniform samplerCube tCube; 2578uniform float tFlip; 2579uniform float opacity; 2580varying vec3 vWorldDirection; 2581void main() { 2582 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2583 gl_FragColor = texColor; 2584 gl_FragColor.a *= opacity; 2585 #include <tonemapping_fragment> 2586 #include <colorspace_fragment> 2587}`,pm=`#include <common> 2588#include <batching_pars_vertex> 2589#include <uv_pars_vertex> 2590#include <displacementmap_pars_vertex> 2591#include <morphtarget_pars_vertex> 2592#include <skinning_pars_vertex> 2593#include <logdepthbuf_pars_vertex> 2594#include <clipping_planes_pars_vertex> 2595varying vec2 vHighPrecisionZW; 2596void main() { 2597 #include <uv_vertex> 2598 #include <batching_vertex> 2599 #include <skinbase_vertex> 2600 #include <morphinstance_vertex> 2601 #ifdef USE_DISPLACEMENTMAP 2602 #include <beginnormal_vertex> 2603 #include <morphnormal_vertex> 2604 #include <skinnormal_vertex> 2605 #endif 2606 #include <begin_vertex> 2607 #include <morphtarget_vertex> 2608 #include <skinning_vertex> 2609 #include <displacementmap_vertex> 2610 #include <project_vertex> 2611 #include <logdepthbuf_vertex> 2612 #include <clipping_planes_vertex> 2613 vHighPrecisionZW = gl_Position.zw; 2614}`,mm=`#if DEPTH_PACKING == 3200 2615 uniform float opacity; 2616#endif 2617#include <common> 2618#include <packing> 2619#include <uv_pars_fragment> 2620#include <map_pars_fragment> 2621#include <alphamap_pars_fragment> 2622#include <alphatest_pars_fragment> 2623#include <alphahash_pars_fragment> 2624#include <logdepthbuf_pars_fragment> 2625#include <clipping_planes_pars_fragment> 2626varying vec2 vHighPrecisionZW; 2627void main() { 2628 vec4 diffuseColor = vec4( 1.0 ); 2629 #include <clipping_planes_fragment> 2630 #if DEPTH_PACKING == 3200 2631 diffuseColor.a = opacity; 2632 #endif 2633 #include <map_fragment> 2634 #include <alphamap_fragment> 2635 #include <alphatest_fragment> 2636 #include <alphahash_fragment> 2637 #include <logdepthbuf_fragment> 2638 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2639 #if DEPTH_PACKING == 3200 2640 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2641 #elif DEPTH_PACKING == 3201 2642 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2643 #elif DEPTH_PACKING == 3202 2644 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2645 #elif DEPTH_PACKING == 3203 2646 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2647 #endif 2648}`,gm=`#define DISTANCE 2649varying vec3 vWorldPosition; 2650#include <common> 2651#include <batching_pars_vertex> 2652#include <uv_pars_vertex> 2653#include <displacementmap_pars_vertex> 2654#include <morphtarget_pars_vertex> 2655#include <skinning_pars_vertex> 2656#include <clipping_planes_pars_vertex> 2657void main() { 2658 #include <uv_vertex> 2659 #include <batching_vertex> 2660 #include <skinbase_vertex> 2661 #include <morphinstance_vertex> 2662 #ifdef USE_DISPLACEMENTMAP 2663 #include <beginnormal_vertex> 2664 #include <morphnormal_vertex> 2665 #include <skinnormal_vertex> 2666 #endif 2667 #include <begin_vertex> 2668 #include <morphtarget_vertex> 2669 #include <skinning_vertex> 2670 #include <displacementmap_vertex> 2671 #include <project_vertex> 2672 #include <worldpos_vertex> 2673 #include <clipping_planes_vertex> 2674 vWorldPosition = worldPosition.xyz; 2675}`,_m=`#define DISTANCE 2676uniform vec3 referencePosition; 2677uniform float nearDistance; 2678uniform float farDistance; 2679varying vec3 vWorldPosition; 2680#include <common> 2681#include <packing> 2682#include <uv_pars_fragment> 2683#include <map_pars_fragment> 2684#include <alphamap_pars_fragment> 2685#include <alphatest_pars_fragment> 2686#include <alphahash_pars_fragment> 2687#include <clipping_planes_pars_fragment> 2688void main () { 2689 vec4 diffuseColor = vec4( 1.0 ); 2690 #include <clipping_planes_fragment> 2691 #include <map_fragment> 2692 #include <alphamap_fragment> 2693 #include <alphatest_fragment> 2694 #include <alphahash_fragment> 2695 float dist = length( vWorldPosition - referencePosition ); 2696 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2697 dist = saturate( dist ); 2698 gl_FragColor = packDepthToRGBA( dist ); 2699}`,xm=`varying vec3 vWorldDirection; 2700#include <common> 2701void main() { 2702 vWorldDirection = transformDirection( position, modelMatrix ); 2703 #include <begin_vertex> 2704 #include <project_vertex> 2705}`,vm=`uniform sampler2D tEquirect; 2706varying vec3 vWorldDirection; 2707#include <common> 2708void main() { 2709 vec3 direction = normalize( vWorldDirection ); 2710 vec2 sampleUV = equirectUv( direction ); 2711 gl_FragColor = texture2D( tEquirect, sampleUV ); 2712 #include <tonemapping_fragment> 2713 #include <colorspace_fragment> 2714}`,ym=`uniform float scale; 2715attribute float lineDistance; 2716varying float vLineDistance; 2717#include <common> 2718#include <uv_pars_vertex> 2719#include <color_pars_vertex> 2720#include <fog_pars_vertex> 2721#include <morphtarget_pars_vertex> 2722#include <logdepthbuf_pars_vertex> 2723#include <clipping_planes_pars_vertex> 2724void main() { 2725 vLineDistance = scale * lineDistance; 2726 #include <uv_vertex> 2727 #include <color_vertex> 2728 #include <morphinstance_vertex> 2729 #include <morphcolor_vertex> 2730 #include <begin_vertex> 2731 #include <morphtarget_vertex> 2732 #include <project_vertex> 2733 #include <logdepthbuf_vertex> 2734 #include <clipping_planes_vertex> 2735 #include <fog_vertex> 2736}`,Mm=`uniform vec3 diffuse; 2737uniform float opacity; 2738uniform float dashSize; 2739uniform float totalSize; 2740varying float vLineDistance; 2741#include <common> 2742#include <color_pars_fragment> 2743#include <uv_pars_fragment> 2744#include <map_pars_fragment> 2745#include <fog_pars_fragment> 2746#include <logdepthbuf_pars_fragment> 2747#include <clipping_planes_pars_fragment> 2748void main() { 2749 vec4 diffuseColor = vec4( diffuse, opacity ); 2750 #include <clipping_planes_fragment> 2751 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2752 discard; 2753 } 2754 vec3 outgoingLight = vec3( 0.0 ); 2755 #include <logdepthbuf_fragment> 2756 #include <map_fragment> 2757 #include <color_fragment> 2758 outgoingLight = diffuseColor.rgb; 2759 #include <opaque_fragment> 2760 #include <tonemapping_fragment> 2761 #include <colorspace_fragment> 2762 #include <fog_fragment> 2763 #include <premultiplied_alpha_fragment> 2764}`,Sm=`#include <common> 2765#include <batching_pars_vertex> 2766#include <uv_pars_vertex> 2767#include <envmap_pars_vertex> 2768#include <color_pars_vertex> 2769#include <fog_pars_vertex> 2770#include <morphtarget_pars_vertex> 2771#include <skinning_pars_vertex> 2772#include <logdepthbuf_pars_vertex> 2773#include <clipping_planes_pars_vertex> 2774void main() { 2775 #include <uv_vertex> 2776 #include <color_vertex> 2777 #include <morphinstance_vertex> 2778 #include <morphcolor_vertex> 2779 #include <batching_vertex> 2780 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2781 #include <beginnormal_vertex> 2782 #include <morphnormal_vertex> 2783 #include <skinbase_vertex> 2784 #include <skinnormal_vertex> 2785 #include <defaultnormal_vertex> 2786 #endif 2787 #include <begin_vertex> 2788 #include <morphtarget_vertex> 2789 #include <skinning_vertex> 2790 #include <project_vertex> 2791 #include <logdepthbuf_vertex> 2792 #include <clipping_planes_vertex> 2793 #include <worldpos_vertex> 2794 #include <envmap_vertex> 2795 #include <fog_vertex> 2796}`,bm=`uniform vec3 diffuse; 2797uniform float opacity; 2798#ifndef FLAT_SHADED 2799 varying vec3 vNormal; 2800#endif 2801#include <common> 2802#include <dithering_pars_fragment> 2803#include <color_pars_fragment> 2804#include <uv_pars_fragment> 2805#include <map_pars_fragment> 2806#include <alphamap_pars_fragment> 2807#include <alphatest_pars_fragment> 2808#include <alphahash_pars_fragment> 2809#include <aomap_pars_fragment> 2810#include <lightmap_pars_fragment> 2811#include <envmap_common_pars_fragment> 2812#include <envmap_pars_fragment> 2813#include <fog_pars_fragment> 2814#include <specularmap_pars_fragment> 2815#include <logdepthbuf_pars_fragment> 2816#include <clipping_planes_pars_fragment> 2817void main() { 2818 vec4 diffuseColor = vec4( diffuse, opacity ); 2819 #include <clipping_planes_fragment> 2820 #include <logdepthbuf_fragment> 2821 #include <map_fragment> 2822 #include <color_fragment> 2823 #include <alphamap_fragment> 2824 #include <alphatest_fragment> 2825 #include <alphahash_fragment> 2826 #include <specularmap_fragment> 2827 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2828 #ifdef USE_LIGHTMAP 2829 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2830 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2831 #else 2832 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2833 #endif 2834 #include <aomap_fragment> 2835 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2836 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2837 #include <envmap_fragment> 2838 #include <opaque_fragment> 2839 #include <tonemapping_fragment> 2840 #include <colorspace_fragment> 2841 #include <fog_fragment> 2842 #include <premultiplied_alpha_fragment> 2843 #include <dithering_fragment> 2844}`,Em=`#define LAMBERT 2845varying vec3 vViewPosition; 2846#include <common> 2847#include <batching_pars_vertex> 2848#include <uv_pars_vertex> 2849#include <displacementmap_pars_vertex> 2850#include <envmap_pars_vertex> 2851#include <color_pars_vertex> 2852#include <fog_pars_vertex> 2853#include <normal_pars_vertex> 2854#include <morphtarget_pars_vertex> 2855#include <skinning_pars_vertex> 2856#include <shadowmap_pars_vertex> 2857#include <logdepthbuf_pars_vertex> 2858#include <clipping_planes_pars_vertex> 2859void main() { 2860 #include <uv_vertex> 2861 #include <color_vertex> 2862 #include <morphinstance_vertex> 2863 #include <morphcolor_vertex> 2864 #include <batching_vertex> 2865 #include <beginnormal_vertex> 2866 #include <morphnormal_vertex> 2867 #include <skinbase_vertex> 2868 #include <skinnormal_vertex> 2869 #include <defaultnormal_vertex> 2870 #include <normal_vertex> 2871 #include <begin_vertex> 2872 #include <morphtarget_vertex> 2873 #include <skinning_vertex> 2874 #include <displacementmap_vertex> 2875 #include <project_vertex> 2876 #include <logdepthbuf_vertex> 2877 #include <clipping_planes_vertex> 2878 vViewPosition = - mvPosition.xyz; 2879 #include <worldpos_vertex> 2880 #include <envmap_vertex> 2881 #include <shadowmap_vertex> 2882 #include <fog_vertex> 2883}`,Tm=`#define LAMBERT 2884uniform vec3 diffuse; 2885uniform vec3 emissive; 2886uniform float opacity; 2887#include <common> 2888#include <packing> 2889#include <dithering_pars_fragment> 2890#include <color_pars_fragment> 2891#include <uv_pars_fragment> 2892#include <map_pars_fragment> 2893#include <alphamap_pars_fragment> 2894#include <alphatest_pars_fragment> 2895#include <alphahash_pars_fragment> 2896#include <aomap_pars_fragment> 2897#include <lightmap_pars_fragment> 2898#include <emissivemap_pars_fragment> 2899#include <envmap_common_pars_fragment> 2900#include <envmap_pars_fragment> 2901#include <fog_pars_fragment> 2902#include <bsdfs> 2903#include <lights_pars_begin> 2904#include <normal_pars_fragment> 2905#include <lights_lambert_pars_fragment> 2906#include <shadowmap_pars_fragment> 2907#include <bumpmap_pars_fragment> 2908#include <normalmap_pars_fragment> 2909#include <specularmap_pars_fragment> 2910#include <logdepthbuf_pars_fragment> 2911#include <clipping_planes_pars_fragment> 2912void main() { 2913 vec4 diffuseColor = vec4( diffuse, opacity ); 2914 #include <clipping_planes_fragment> 2915 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2916 vec3 totalEmissiveRadiance = emissive; 2917 #include <logdepthbuf_fragment> 2918 #include <map_fragment> 2919 #include <color_fragment> 2920 #include <alphamap_fragment> 2921 #include <alphatest_fragment> 2922 #include <alphahash_fragment> 2923 #include <specularmap_fragment> 2924 #include <normal_fragment_begin> 2925 #include <normal_fragment_maps> 2926 #include <emissivemap_fragment> 2927 #include <lights_lambert_fragment> 2928 #include <lights_fragment_begin> 2929 #include <lights_fragment_maps> 2930 #include <lights_fragment_end> 2931 #include <aomap_fragment> 2932 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2933 #include <envmap_fragment> 2934 #include <opaque_fragment> 2935 #include <tonemapping_fragment> 2936 #include <colorspace_fragment> 2937 #include <fog_fragment> 2938 #include <premultiplied_alpha_fragment> 2939 #include <dithering_fragment> 2940}`,Am=`#define MATCAP 2941varying vec3 vViewPosition; 2942#include <common> 2943#include <batching_pars_vertex> 2944#include <uv_pars_vertex> 2945#include <color_pars_vertex> 2946#include <displacementmap_pars_vertex> 2947#include <fog_pars_vertex> 2948#include <normal_pars_vertex> 2949#include <morphtarget_pars_vertex> 2950#include <skinning_pars_vertex> 2951#include <logdepthbuf_pars_vertex> 2952#include <clipping_planes_pars_vertex> 2953void main() { 2954 #include <uv_vertex> 2955 #include <color_vertex> 2956 #include <morphinstance_vertex> 2957 #include <morphcolor_vertex> 2958 #include <batching_vertex> 2959 #include <beginnormal_vertex> 2960 #include <morphnormal_vertex> 2961 #include <skinbase_vertex> 2962 #include <skinnormal_vertex> 2963 #include <defaultnormal_vertex> 2964 #include <normal_vertex> 2965 #include <begin_vertex> 2966 #include <morphtarget_vertex> 2967 #include <skinning_vertex> 2968 #include <displacementmap_vertex> 2969 #include <project_vertex> 2970 #include <logdepthbuf_vertex> 2971 #include <clipping_planes_vertex> 2972 #include <fog_vertex> 2973 vViewPosition = - mvPosition.xyz; 2974}`,wm=`#define MATCAP 2975uniform vec3 diffuse; 2976uniform float opacity; 2977uniform sampler2D matcap; 2978varying vec3 vViewPosition; 2979#include <common> 2980#include <dithering_pars_fragment> 2981#include <color_pars_fragment> 2982#include <uv_pars_fragment> 2983#include <map_pars_fragment> 2984#include <alphamap_pars_fragment> 2985#include <alphatest_pars_fragment> 2986#include <alphahash_pars_fragment> 2987#include <fog_pars_fragment> 2988#include <normal_pars_fragment> 2989#include <bumpmap_pars_fragment> 2990#include <normalmap_pars_fragment> 2991#include <logdepthbuf_pars_fragment> 2992#include <clipping_planes_pars_fragment> 2993void main() { 2994 ve
2994c4 diffuseColor = vec4( diffuse, opacity ); 2995 #include <clipping_planes_fragment> 2996 #include <logdepthbuf_fragment> 2997 #include <map_fragment> 2998 #include <color_fragment> 2999 #include <alphamap_fragment> 3000 #include <alphatest_fragment> 3001 #include <alphahash_fragment> 3002 #include <normal_fragment_begin> 3003 #include <normal_fragment_maps> 3004 vec3 viewDir = normalize( vViewPosition ); 3005 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3006 vec3 y = cross( viewDir, x ); 3007 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3008 #ifdef USE_MATCAP 3009 vec4 matcapColor = texture2D( matcap, uv ); 3010 #else 3011 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3012 #endif 3013 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3014 #include <opaque_fragment> 3015 #include <tonemapping_fragment> 3016 #include <colorspace_fragment> 3017 #include <fog_fragment> 3018 #include <premultiplied_alpha_fragment> 3019 #include <dithering_fragment> 3020}`,Cm=`#define NORMAL 3021#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3022 varying vec3 vViewPosition; 3023#endif 3024#include <common> 3025#include <batching_pars_vertex> 3026#include <uv_pars_vertex> 3027#include <displacementmap_pars_vertex> 3028#include <normal_pars_vertex> 3029#include <morphtarget_pars_vertex> 3030#include <skinning_pars_vertex> 3031#include <logdepthbuf_pars_vertex> 3032#include <clipping_planes_pars_vertex> 3033void main() { 3034 #include <uv_vertex> 3035 #include <batching_vertex> 3036 #include <beginnormal_vertex> 3037 #include <morphinstance_vertex> 3038 #include <morphnormal_vertex> 3039 #include <skinbase_vertex> 3040 #include <skinnormal_vertex> 3041 #include <defaultnormal_vertex> 3042 #include <normal_vertex> 3043 #include <begin_vertex> 3044 #include <morphtarget_vertex> 3045 #include <skinning_vertex> 3046 #include <displacementmap_vertex> 3047 #include <project_vertex> 3048 #include <logdepthbuf_vertex> 3049 #include <clipping_planes_vertex> 3050#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3051 vViewPosition = - mvPosition.xyz; 3052#endif 3053}`,Rm=`#define NORMAL 3054uniform float opacity; 3055#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3056 varying vec3 vViewPosition; 3057#endif 3058#include <packing> 3059#include <uv_pars_fragment> 3060#include <normal_pars_fragment> 3061#include <bumpmap_pars_fragment> 3062#include <normalmap_pars_fragment> 3063#include <logdepthbuf_pars_fragment> 3064#include <clipping_planes_pars_fragment> 3065void main() { 3066 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3067 #include <clipping_planes_fragment> 3068 #include <logdepthbuf_fragment> 3069 #include <normal_fragment_begin> 3070 #include <normal_fragment_maps> 3071 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3072 #ifdef OPAQUE 3073 gl_FragColor.a = 1.0; 3074 #endif 3075}`,Im=`#define PHONG 3076varying vec3 vViewPosition; 3077#include <common> 3078#include <batching_pars_vertex> 3079#include <uv_pars_vertex> 3080#include <displacementmap_pars_vertex> 3081#include <envmap_pars_vertex> 3082#include <color_pars_vertex> 3083#include <fog_pars_vertex> 3084#include <normal_pars_vertex> 3085#include <morphtarget_pars_vertex> 3086#include <skinning_pars_vertex> 3087#include <shadowmap_pars_vertex> 3088#include <logdepthbuf_pars_vertex> 3089#include <clipping_planes_pars_vertex> 3090void main() { 3091 #include <uv_vertex> 3092 #include <color_vertex> 3093 #include <morphcolor_vertex> 3094 #include <batching_vertex> 3095 #include <beginnormal_vertex> 3096 #include <morphinstance_vertex> 3097 #include <morphnormal_vertex> 3098 #include <skinbase_vertex> 3099 #include <skinnormal_vertex> 3100 #include <defaultnormal_vertex> 3101 #include <normal_vertex> 3102 #include <begin_vertex> 3103 #include <morphtarget_vertex> 3104 #include <skinning_vertex> 3105 #include <displacementmap_vertex> 3106 #include <project_vertex> 3107 #include <logdepthbuf_vertex> 3108 #include <clipping_planes_vertex> 3109 vViewPosition = - mvPosition.xyz; 3110 #include <worldpos_vertex> 3111 #include <envmap_vertex> 3112 #include <shadowmap_vertex> 3113 #include <fog_vertex> 3114}`,Pm=`#define PHONG 3115uniform vec3 diffuse; 3116uniform vec3 emissive; 3117uniform vec3 specular; 3118uniform float shininess; 3119uniform float opacity; 3120#include <common> 3121#include <packing> 3122#include <dithering_pars_fragment> 3123#include <color_pars_fragment> 3124#include <uv_pars_fragment> 3125#include <map_pars_fragment> 3126#include <alphamap_pars_fragment> 3127#include <alphatest_pars_fragment> 3128#include <alphahash_pars_fragment> 3129#include <aomap_pars_fragment> 3130#include <lightmap_pars_fragment> 3131#include <emissivemap_pars_fragment> 3132#include <envmap_common_pars_fragment> 3133#include <envmap_pars_fragment> 3134#include <fog_pars_fragment> 3135#include <bsdfs> 3136#include <lights_pars_begin> 3137#include <normal_pars_fragment> 3138#include <lights_phong_pars_fragment> 3139#include <shadowmap_pars_fragment> 3140#include <bumpmap_pars_fragment> 3141#include <normalmap_pars_fragment> 3142#include <specularmap_pars_fragment> 3143#include <logdepthbuf_pars_fragment> 3144#include <clipping_planes_pars_fragment> 3145void main() { 3146 vec4 diffuseColor = vec4( diffuse, opacity ); 3147 #include <clipping_planes_fragment> 3148 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3149 vec3 totalEmissiveRadiance = emissive; 3150 #include <logdepthbuf_fragment> 3151 #include <map_fragment> 3152 #include <color_fragment> 3153 #include <alphamap_fragment> 3154 #include <alphatest_fragment> 3155 #include <alphahash_fragment> 3156 #include <specularmap_fragment> 3157 #include <normal_fragment_begin> 3158 #include <normal_fragment_maps> 3159 #include <emissivemap_fragment> 3160 #include <lights_phong_fragment> 3161 #include <lights_fragment_begin> 3162 #include <lights_fragment_maps> 3163 #include <lights_fragment_end> 3164 #include <aomap_fragment> 3165 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3166 #include <envmap_fragment> 3167 #include <opaque_fragment> 3168 #include <tonemapping_fragment> 3169 #include <colorspace_fragment> 3170 #include <fog_fragment> 3171 #include <premultiplied_alpha_fragment> 3172 #include <dithering_fragment> 3173}`,Lm=`#define STANDARD 3174varying vec3 vViewPosition; 3175#ifdef USE_TRANSMISSION 3176 varying vec3 vWorldPosition; 3177#endif 3178#include <common> 3179#include <batching_pars_vertex> 3180#include <uv_pars_vertex> 3181#include <displacementmap_pars_vertex> 3182#include <color_pars_vertex> 3183#include <fog_pars_vertex> 3184#include <normal_pars_vertex> 3185#include <morphtarget_pars_vertex> 3186#include <skinning_pars_vertex> 3187#include <shadowmap_pars_vertex> 3188#include <logdepthbuf_pars_vertex> 3189#include <clipping_planes_pars_vertex> 3190void main() { 3191 #include <uv_vertex> 3192 #include <color_vertex> 3193 #include <morphinstance_vertex> 3194 #include <morphcolor_vertex> 3195 #include <batching_vertex> 3196 #include <beginnormal_vertex> 3197 #include <morphnormal_vertex> 3198 #include <skinbase_vertex> 3199 #include <skinnormal_vertex> 3200 #include <defaultnormal_vertex> 3201 #include <normal_vertex> 3202 #include <begin_vertex> 3203 #include <morphtarget_vertex> 3204 #include <skinning_vertex> 3205 #include <displacementmap_vertex> 3206 #include <project_vertex> 3207 #include <logdepthbuf_vertex> 3208 #include <clipping_planes_vertex> 3209 vViewPosition = - mvPosition.xyz; 3210 #include <worldpos_vertex> 3211 #include <shadowmap_vertex> 3212 #include <fog_vertex> 3213#ifdef USE_TRANSMISSION 3214 vWorldPosition = worldPosition.xyz; 3215#endif 3216}`,Dm=`#define STANDARD 3217#ifdef PHYSICAL 3218 #define IOR 3219 #define USE_SPECULAR 3220#endif 3221uniform vec3 diffuse; 3222uniform vec3 emissive; 3223uniform float roughness; 3224uniform float metalness; 3225uniform float opacity; 3226#ifdef IOR 3227 uniform float ior; 3228#endif 3229#ifdef USE_SPECULAR 3230 uniform float specularIntensity; 3231 uniform vec3 specularColor; 3232 #ifdef USE_SPECULAR_COLORMAP 3233 uniform sampler2D specularColorMap; 3234 #endif 3235 #ifdef USE_SPECULAR_INTENSITYMAP 3236 uniform sampler2D specularIntensityMap; 3237 #endif 3238#endif 3239#ifdef USE_CLEARCOAT 3240 uniform float clearcoat; 3241 uniform float clearcoatRoughness; 3242#endif 3243#ifdef USE_DISPERSION 3244 uniform float dispersion; 3245#endif
3246#ifdef USE_IRIDESCENCE 3247 uniform float iridescence; 3248 uniform float iridescenceIOR; 3249 uniform float iridescenceThicknessMinimum; 3250 uniform float iridescenceThicknessMaximum; 3251#endif 3252#ifdef USE_SHEEN 3253 uniform vec3 sheenColor; 3254 uniform float sheenRoughness; 3255 #ifdef USE_SHEEN_COLORMAP 3256 uniform sampler2D sheenColorMap; 3257 #endif 3258 #ifdef USE_SHEEN_ROUGHNESSMAP 3259 uniform sampler2D sheenRoughnessMap; 3260 #endif 3261#endif 3262#ifdef USE_ANISOTROPY 3263 uniform vec2 anisotropyVector; 3264 #ifdef USE_ANISOTROPYMAP 3265 uniform sampler2D anisotropyMap; 3266 #endif 3267#endif 3268varying vec3 vViewPosition; 3269#include <common> 3270#include <packing> 3271#include <dithering_pars_fragment> 3272#include <color_pars_fragment> 3273#include <uv_pars_fragment> 3274#include <map_pars_fragment> 3275#include <alphamap_pars_fragment> 3276#include <alphatest_pars_fragment> 3277#include <alphahash_pars_fragment> 3278#include <aomap_pars_fragment> 3279#include <lightmap_pars_fragment> 3280#include <emissivemap_pars_fragment> 3281#include <iridescence_fragment> 3282#include <cube_uv_reflection_fragment> 3283#include <envmap_common_pars_fragment> 3284#include <envmap_physical_pars_fragment> 3285#include <fog_pars_fragment> 3286#include <lights_pars_begin> 3287#include <normal_pars_fragment> 3288#include <lights_physical_pars_fragment> 3289#include <transmission_pars_fragment> 3290#include <shadowmap_pars_fragment> 3291#include <bumpmap_pars_fragment> 3292#include <normalmap_pars_fragment> 3293#include <clearcoat_pars_fragment> 3294#include <iridescence_pars_fragment> 3295#include <roughnessmap_pars_fragment> 3296#include <metalnessmap_pars_fragment> 3297#include <logdepthbuf_pars_fragment> 3298#include <clipping_planes_pars_fragment> 3299void main() { 3300 vec4 diffuseColor = vec4( diffuse, opacity ); 3301 #include <clipping_planes_fragment> 3302 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3303 vec3 totalEmissiveRadiance = emissive; 3304 #include <logdepthbuf_fragment> 3305 #include <map_fragment> 3306 #include <color_fragment> 3307 #include <alphamap_fragment> 3308 #include <alphatest_fragment> 3309 #include <alphahash_fragment> 3310 #include <roughnessmap_fragment> 3311 #include <metalnessmap_fragment> 3312 #include <normal_fragment_begin> 3313 #include <normal_fragment_maps> 3314 #include <clearcoat_normal_fragment_begin> 3315 #include <clearcoat_normal_fragment_maps> 3316 #include <emissivemap_fragment> 3317 #include <lights_physical_fragment> 3318 #include <lights_fragment_begin> 3319 #include <lights_fragment_maps> 3320 #include <lights_fragment_end> 3321 #include <aomap_fragment> 3322 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3323 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3324 #include <transmission_fragment> 3325 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3326 #ifdef USE_SHEEN 3327 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3328 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3329 #endif 3330 #ifdef USE_CLEARCOAT 3331 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3332 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3333 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3334 #endif 3335 #include <opaque_fragment> 3336 #include <tonemapping_fragment> 3337 #include <colorspace_fragment> 3338 #include <fog_fragment> 3339 #include <premultiplied_alpha_fragment> 3340 #include <dithering_fragment> 3341}`,Um=`#define TOON 3342varying vec3 vViewPosition; 3343#include <common> 3344#include <batching_pars_vertex> 3345#include <uv_pars_vertex> 3346#include <displacementmap_pars_vertex> 3347#include <color_pars_vertex> 3348#include <fog_pars_vertex> 3349#include <normal_pars_vertex> 3350#include <morphtarget_pars_vertex> 3351#include <skinning_pars_vertex> 3352#include <shadowmap_pars_vertex> 3353#include <logdepthbuf_pars_vertex> 3354#include <clipping_planes_pars_vertex> 3355void main() { 3356 #include <uv_vertex> 3357 #include <color_vertex> 3358 #include <morphinstance_vertex> 3359 #include <morphcolor_vertex> 3360 #include <batching_vertex> 3361 #include <beginnormal_vertex> 3362 #include <morphnormal_vertex> 3363 #include <skinbase_vertex> 3364 #include <skinnormal_vertex> 3365 #include <defaultnormal_vertex> 3366 #include <normal_vertex> 3367 #include <begin_vertex> 3368 #include <morphtarget_vertex> 3369 #include <skinning_vertex> 3370 #include <displacementmap_vertex> 3371 #include <project_vertex> 3372 #include <logdepthbuf_vertex> 3373 #include <clipping_planes_vertex> 3374 vViewPosition = - mvPosition.xyz; 3375 #include <worldpos_vertex> 3376 #include <shadowmap_vertex> 3377 #include <fog_vertex> 3378}`,Nm=`#define TOON 3379uniform vec3 diffuse; 3380uniform vec3 emissive; 3381uniform float opacity; 3382#include <common> 3383#include <packing> 3384#include <dithering_pars_fragment> 3385#include <color_pars_fragment> 3386#include <uv_pars_fragment> 3387#include <map_pars_fragment> 3388#include <alphamap_pars_fragment> 3389#include <alphatest_pars_fragment> 3390#include <alphahash_pars_fragment> 3391#include <aomap_pars_fragment> 3392#include <lightmap_pars_fragment> 3393#include <emissivemap_pars_fragment> 3394#include <gradientmap_pars_fragment> 3395#include <fog_pars_fragment> 3396#include <bsdfs> 3397#include <lights_pars_begin> 3398#include <normal_pars_fragment> 3399#include <lights_toon_pars_fragment> 3400#include <shadowmap_pars_fragment> 3401#include <bumpmap_pars_fragment> 3402#include <normalmap_pars_fragment> 3403#include <logdepthbuf_pars_fragment> 3404#include <clipping_planes_pars_fragment> 3405void main() { 3406 vec4 diffuseColor = vec4( diffuse, opacity ); 3407 #include <clipping_planes_fragment> 3408 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3409 vec3 totalEmissiveRadiance = emissive; 3410 #include <logdepthbuf_fragment> 3411 #include <map_fragment> 3412 #include <color_fragment> 3413 #include <alphamap_fragment> 3414 #include <alphatest_fragment> 3415 #include <alphahash_fragment> 3416 #include <normal_fragment_begin> 3417 #include <normal_fragment_maps> 3418 #include <emissivemap_fragment> 3419 #include <lights_toon_fragment> 3420 #include <lights_fragment_begin> 3421 #include <lights_fragment_maps> 3422 #include <lights_fragment_end> 3423 #include <aomap_fragment> 3424 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3425 #include <opaque_fragment> 3426 #include <tonemapping_fragment> 3427 #include <colorspace_fragment> 3428 #include <fog_fragment> 3429 #include <premultiplied_alpha_fragment> 3430 #include <dithering_fragment> 3431}`,Fm=`uniform float size; 3432uniform float scale; 3433#include <common> 3434#include <color_pars_vertex> 3435#include <fog_pars_vertex> 3436#include <morphtarget_pars_vertex> 3437#include <logdepthbuf_pars_vertex> 3438#include <clipping_planes_pars_vertex> 3439#ifdef USE_POINTS_UV 3440 varying vec2 vUv; 3441 uniform mat3 uvTransform; 3442#endif 3443void main() { 3444 #ifdef USE_POINTS_UV 3445 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3446 #endif 3447 #include <color_vertex> 3448 #include <morphinstance_vertex> 3449 #include <morphcolor_vertex> 3450 #include <begin_vertex> 3451 #include <morphtarget_vertex> 3452 #include <project_vertex> 3453 gl_PointSize = size; 3454 #ifdef USE_SIZEATTENUATION 3455 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3456 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3457 #endif 3458 #include <logdepthbuf_vertex> 3459 #include <clipping_planes_vertex> 3460 #include <worldpos_vertex> 3461 #include <fog_vertex> 3462}`,Om=`uniform vec3 diffuse; 3463uniform float opacity; 3464#include <common> 3465#include <color_pars_fragment> 3466#include <map_particle_pars_fragment> 3467#include <alphatest_pars_fragment> 3468#include <alphahash_pars_fragment> 3469#include <fog_pars_fragment> 3470#include <logdepthbuf_pars_fragment> 3471#include <clipping_planes_pars_fragment> 3472void main() { 3473 vec4 diffuseColor = vec4( diffuse, opacity ); 3474 #include <clipping_planes_fragment> 3475 vec3 outgoingLight = vec3( 0.0 ); 3476 #include <logdepthbuf_fragment> 3477 #include <map_particle_fragment> 3478 #include <color_fragment> 3479 #include <alphatest_fragment> 3480 #include <alphahash_fragment> 3481 outgoingLight = diffuseColor.rgb; 3482 #include <opaque_fragment> 3483 #include <tonemapping_fragment> 3484 #include <colorspace_fragment> 3485 #include <fog_fragment> 3486 #include <premultiplied_alpha_fragment> 3487}`,Bm=`#include <common> 3488#include <batching_pars_vertex> 3489#include <fog_pars_vertex> 3490#include <morphtarget_pars_vertex> 3491#include <skinning_pars_vertex> 3492#include <logdepthbuf_pars_vertex> 3493#include <shadowmap_pars_vertex> 3494void main() { 3495 #include <batching_vertex> 3496 #include <beginnormal_vertex> 3497 #include <morphinstance_vertex> 3498 #include <morphnormal_vertex> 3499 #include <skinbase_vertex> 3500 #include <skinnormal_vertex> 3501 #include <defaultnormal_vertex> 3502 #include <begin_vertex> 3503 #include <morphtarget_vertex> 3504 #include <skinning_vertex> 3505 #include <project_vertex> 3506 #include <logdepthbuf_vertex> 3507 #include <worldpos_vertex> 3508 #include <shadowmap_vertex> 3509 #include <fog_vertex> 3510}`,zm=`uniform vec3 color; 3511uniform float opacity; 3512#include <common> 3513#include <packing> 3514#include <fog_pars_fragment> 3515#include <bsdfs> 3516#include <lights_pars_begin> 3517#include <logdepthbuf_pars_fragment> 3518#include <shadowmap_pars_fragment> 3519#include <shadowmask_pars_fragment> 3520void main() { 3521 #include <logdepthbuf_fragment> 3522 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3523 #include <tonemapping_fragment> 3524 #include <colorspace_fragment> 3525 #include <fog_fragment> 3526}`,km=`uniform float rotation; 3527uniform vec2 center; 3528#include <common> 3529#include <uv_pars_vertex> 3530#include <fog_pars_vertex> 3531#include <logdepthbuf_pars_vertex> 3532#include <clipping_planes_pars_vertex> 3533void main() { 3534 #include <uv_vertex> 3535 vec4 mvPosition = modelViewMatrix[ 3 ]; 3536 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3537 #ifndef USE_SIZEATTENUATION 3538 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3539 if ( isPerspective ) scale *= - mvPosition.z; 3540 #endif 3541 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3542 vec2 rotatedPosition; 3543 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3544 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3545 mvPosition.xy += rotatedPosition; 3546 gl_Position = projectionMatrix * mvPosition; 3547 #include <logdepthbuf_vertex> 3548 #include <clipping_planes_vertex> 3549 #include <fog_vertex> 3550}`,Vm=`uniform vec3 diffuse; 3551uniform float opacity; 3552#include <common> 3553#include <uv_pars_fragment> 3554#include <map_pars_fragment> 3555#include <alphamap_pars_fragment> 3556#include <alphatest_pars_fragment> 3557#include <alphahash_pars_fragment> 3558#include <fog_pars_fragment> 3559#include <logdepthbuf_pars_fragment> 3560#include <clipping_planes_pars_fragment> 3561void main() { 3562 vec4 diffuseColor = vec4( diffuse, opacity ); 3563 #include <clipping_planes_fragment> 3564 vec3 outgoingLight = vec3( 0.0 ); 3565 #include <logdepthbuf_fragment> 3566 #include <map_fragment> 3567 #include <alphamap_fragment> 3568 #include <alphatest_fragment> 3569 #include <alphahash_fragment> 3570 outgoingLight = diffuseColor.rgb; 3571 #include <opaque_fragment> 3572 #include <tonemapping_fragment> 3573 #include <colorspace_fragment> 3574 #include <fog_fragment> 3575}`,Wt={alphahash_fragment:cf,alphahash_pars_fragment:hf,alphamap_fragment:uf,alphamap_pars_fragment:df,alphatest_fragment:ff,alphatest_pars_fragment:pf,aomap_fragment:mf,aomap_pars_fragment:gf,batching_pars_vertex:_f,batching_vertex:xf,begin_vertex:vf,beginnormal_vertex:yf,bsdfs:Mf,iridescence_fragment:Sf,bumpmap_pars_fragment:bf,clipping_planes_fragment:Ef,clipping_planes_pars_fragment:Tf,clipping_planes_pars_vertex:Af,clipping_planes_vertex:wf,color_fragment:Cf,color_pars_fragment:Rf,color_pars_vertex:If,color_vertex:Pf,common:Lf,cube_uv_reflection_fragment:Df,defaultnormal_vertex:Uf,displacementmap_pars_vertex:Nf,displacementmap_vertex:Ff,emissivemap_fragment:Of,emissivemap_pars_fragment:Bf,colorspace_fragment:zf,colorspace_pars_fragment:kf,envmap_fragment:Vf,envmap_common_pars_fragment:Hf,envmap_pars_fragment:Gf,envmap_pars_vertex:Wf,envmap_physical_pars_fragment:ep,envmap_vertex:Xf,fog_vertex:qf,fog_pars_vertex:Yf,fog_fragment:Zf,fog_pars_fragment:Jf,gradientmap_pars_fragment:$f,lightmap_pars_fragment:Kf,lights_lambert_fragment:Qf,lights_lambert_pars_fragment:jf,lights_pars_begin:tp,lights_toon_fragment:np,lights_toon_pars_fragment:ip,lights_phong_fragment:sp,lights_phong_pars_fragment:rp,lights_physical_fragment:ap,lights_physical_pars_fragment:op,lights_fragment_begin:lp,lights_fragment_maps:cp,lights_fragment_end:hp,logdepthbuf_fragment:up,logdepthbuf_pars_fragment:dp,logdepthbuf_pars_vertex:fp,logdepthbuf_vertex:pp,map_fragment:mp,map_pars_fragment:gp,map_particle_fragment:_p,map_particle_pars_fragment:xp,metalnessmap_fragment:vp,metalnessmap_pars_fragment:yp,morphinstance_vertex:Mp,morphcolor_vertex:Sp,morphnormal_vertex:bp,morphtarget_pars_vertex:Ep,morphtarget_vertex:Tp,normal_fragment_begin:Ap,normal_fragment_maps:wp,normal_pars_fragment:Cp,normal_pars_vertex:Rp,normal_vertex:Ip,normalmap_pars_fragment:Pp,clearcoat_normal_fragment_begin:Lp,clearcoat_normal_fragment_maps:Dp,clearcoat_pars_fragment:Up,iridescence_pars_fragment:Np,opaque_fragment:Fp,packing:Op,premultiplied_alpha_fragment:Bp,project_vertex:zp,dithering_fragment:kp,dithering_pars_fragment:Vp,roughnessmap_fragment:Hp,roughnessmap_pars_fragment:Gp,shadowmap_pars_fragment:Wp,shadowmap_pars_vertex:Xp,shadowmap_vertex:qp,shadowmask_pars_fragment:Yp,skinbase_vertex:Zp,skinning_pars_vertex:Jp,skinning_vertex:$p,skinnormal_vertex:Kp,specularmap_fragment:Qp,specularmap_pars_fragment:jp,tonemapping_fragment:tm,tonemapping_pars_fragment:em,transmission_fragment:nm,transmission_pars_fragment:im,uv_pars_fragment:sm,uv_pars_vertex:rm,uv_vertex:am,worldpos_vertex:om,background_vert:lm,background_frag:cm,backgroundCube_vert:hm,backgroundCube_frag:um,cube_vert:dm,cube_frag:fm,depth_vert:pm,depth_frag:mm,distanceRGBA_vert:gm,distanceRGBA_frag:_m,equirect_vert:xm,equirect_frag:vm,linedashed_vert:ym,linedashed_frag:Mm,meshbasic_vert:Sm,meshbasic_frag:bm,meshlambert_vert:Em,meshlambert_frag:Tm,meshmatcap_vert:Am,meshmatcap_frag:wm,meshnormal_vert:Cm,meshnormal_frag:Rm,meshphong_vert:Im,meshphong_frag:Pm,meshphysical_vert:Lm,meshphysical_frag:Dm,meshtoon_vert:Um,meshtoon_frag:Nm,points_vert:Fm,points_frag:Om,shadow_vert:Bm,shadow_frag:zm,sprite_vert:km,sprite_frag:Vm},lt={common:{diffuse:{value:new mt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new zt}},envmap:{envMap:{value:null},envMapRotation:{value:new zt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new zt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new zt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new zt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new zt},normalScale:{value:new $(1,1)}}
vendor: 4,813 bytes, line 3575
3575,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new zt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new zt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new zt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new zt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new mt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 mt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0},uvTransform:{value:new zt}},sprite:{diffuse:{value:new mt(16777215)},opacity:{value:1},center:{value:new $(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}}},an={basic:{uniforms:Re([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.fog]),vertexShader:Wt.meshbasic_vert,fragmentShader:Wt.meshbasic_frag},lambert:{uniforms:Re([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,lt.lights,{emissive:{value:new mt(0)}}]),vertexShader:Wt.meshlambert_vert,fragmentShader:Wt.meshlambert_frag},phong:{uniforms:Re([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,lt.lights,{emissive:{value:new mt(0)},specular:{value:new mt(1118481)},shininess:{value:30}}]),vertexShader:Wt.meshphong_vert,fragmentShader:Wt.meshphong_frag},standard:{uniforms:Re([lt.common,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.roughnessmap,lt.metalnessmap,lt.fog,lt.lights,{emissive:{value:new mt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag},toon:{uniforms:Re([lt.common,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.gradientmap,lt.fog,lt.lights,{emissive:{value:new mt(0)}}]),vertexShader:Wt.meshtoon_vert,fragmentShader:Wt.meshtoon_frag},matcap:{uniforms:Re([lt.common,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,{matcap:{value:null}}]),vertexShader:Wt.meshmatcap_vert,fragmentShader:Wt.meshmatcap_frag},points:{uniforms:Re([lt.points,lt.fog]),vertexShader:Wt.points_vert,fragmentShader:Wt.points_frag},dashed:{uniforms:Re([lt.common,lt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wt.linedashed_vert,fragmentShader:Wt.linedashed_frag},depth:{uniforms:Re([lt.common,lt.displacementmap]),vertexShader:Wt.depth_vert,fragmentShader:Wt.depth_frag},normal:{uniforms:Re([lt.common,lt.bumpmap,lt.normalmap,lt.displacementmap,{opacity:{value:1}}]),vertexShader:Wt.meshnormal_vert,fragmentShader:Wt.meshnormal_frag},sprite:{uniforms:Re([lt.sprite,lt.fog]),vertexShader:Wt.sprite_vert,fragmentShader:Wt.sprite_frag},background:{uniforms:{uvTransform:{value:new zt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Wt.background_vert,fragmentShader:Wt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new zt}},vertexShader:Wt.backgroundCube_vert,fragmentShader:Wt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wt.cube_vert,fragmentShader:Wt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wt.equirect_vert,fragmentShader:Wt.equirect_frag}
vendor: 24,042 bytes, lines 3575-3650
3575,distanceRGBA:{uniforms:Re([lt.common,lt.displacementmap,{referencePosition:{value:new w},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wt.distanceRGBA_vert,fragmentShader:Wt.distanceRGBA_frag},shadow:{uniforms:Re([lt.lights,lt.fog,{color:{value:new mt(0)},opacity:{value:1}}]),vertexShader:Wt.shadow_vert,fragmentShader:Wt.shadow_frag}};an.physical={uniforms:Re([an.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new zt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new zt},clearcoatNormalScale:{value:new $(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new zt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new zt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new zt},sheen:{value:0},sheenColor:{value:new mt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new zt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new zt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new zt},transmissionSamplerSize:{value:new $},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new zt},attenuationDistance:{value:0},attenuationColor:{value:new mt(0)},specularColor:{value:new mt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new zt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new zt},anisotropyVector:{value:new $},anisotropyMap:{value:null},anisotropyMapTransform:{value:new zt}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag};const rr={r:0,b:0,g:0},Qn=new Ke,Hm=new Ut;function Gm(s,t,e,n,i,r,a){const o=new mt(0);let l=r===!0?0:1,c,h,u=null,d=0,f=null;function m(y){let v=y.isScene===!0?y.background:null;return v&&v.isTexture&&(v=(y.backgroundBlurriness>0?e:t).get(v)),v}function _(y){let v=!1;const x=m(y);x===null?p(o,l):x&&x.isColor&&(p(x,1),v=!0);const P=s.xr.getEnvironmentBlendMode();P==="additive"?n.buffers.color.setClear(0,0,0,1,a):P==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||v)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function g(y,v){const x=m(v);x&&(x.isCubeTexture||x.mapping===Ns)?(h===void 0&&(h=new _e(new is(1,1,1),new ln({name:"BackgroundCubeMaterial",uniforms:ts(an.backgroundCube.uniforms),vertexShader:an.backgroundCube.vertexShader,fragmentShader:an.backgroundCube.fragmentShader,side:Oe,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),Qn.copy(v.backgroundRotation),Qn.x*=-1,Qn.y*=-1,Qn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Qn.y*=-1,Qn.z*=-1),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Hm.makeRotationFromEuler(Qn)),h.material.toneMapped=Zt.getTransfer(x.colorSpace)!==se,(u!==x||d!==x.version||f!==s.toneMapping)&&(h.material.needsUpdate=!0,u=x,d=x.version,f=s.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new _e(new Bs(2,2),new ln({name:"BackgroundMaterial",uniforms:ts(an.background.uniforms),vertexShader:an.background.vertexShader,fragmentShader:an.background.fragmentShader,side:Gn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=Zt.getTransfer(x.colorSpace)!==se,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||f!==s.toneMapping)&&(c.material.needsUpdate=!0,u=x,d=x.version,f=s.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function p(y,v){y.getRGB(rr,Yh(s)),n.buffers.color.setClear(rr.r,rr.g,rr.b,v,a)}return{getClearColor:function(){return o},setClearColor:function(y,v=1){o.set(y),l=v,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,p(o,l)},render:_,addToRenderList:g}}function Wm(s,t){const e=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null);let r=i,a=!1;function o(M,L,k,O,V){let Z=!1;const H=u(O,k,L);r!==H&&(r=H,c(r.object)),Z=f(M,O,k,V),Z&&m(M,O,k,V),V!==null&&t.update(V,s.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,x(M,L,k,O),V!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t.get(V).buffer))}function l(){return s.createVertexArray()}function c(M){return s.bindVertexArray(M)}function h(M){return s.deleteVertexArray(M)}function u(M,L,k){const O=k.wireframe===!0;let V=n[M.id];V===void 0&&(V={},n[M.id]=V);let Z=V[L.id];Z===void 0&&(Z={},V[L.id]=Z);let H=Z[O];return H===void 0&&(H=d(l()),Z[O]=H),H}function d(M){const L=[],k=[],O=[];for(let V=0;V<e;V++)L[V]=0,k[V]=0,O[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:k,attributeDivisors:O,object:M,attributes:{},index:null}}function f(M,L,k,O){const V=r.attributes,Z=L.attributes;let H=0;const et=k.getAttributes();for(const G in et)if(et[G].location>=0){const pt=V[G];let Mt=Z[G];if(Mt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(Mt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(Mt=M.instanceColor)),pt===void 0||pt.attribute!==Mt||Mt&&pt.data!==Mt.data)return!0;H++}return r.attributesNum!==H||r.index!==O}function m(M,L,k,O){const V={},Z=L.attributes;let H=0;const et=k.getAttributes();for(const G in et)if(et[G].location>=0){let pt=Z[G];pt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(pt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(pt=M.instanceColor));const Mt={};Mt.attribute=pt,pt&&pt.data&&(Mt.data=pt.data),V[G]=Mt,H++}r.attributes=V,r.attributesNum=H,r.index=O}function _(){const M=r.newAttributes;for(let L=0,k=M.length;L<k;L++)M[L]=0}function g(M){p(M,0)}function p(M,L){const k=r.newAttributes,O=r.enabledAttributes,V=r.attributeDivisors;k[M]=1,O[M]===0&&(s.enableVertexAttribArray(M),O[M]=1),V[M]!==L&&(s.vertexAttribDivisor(M,L),V[M]=L)}function y(){const M=r.newAttributes,L=r.enabledAttributes;for(let k=0,O=L.length;k<O;k++)L[k]!==M[k]&&(s.disableVertexAttribArray(k),L[k]=0)}function v(M,L,k,O,V,Z,H){H===!0?s.vertexAttribIPointer(M,L,k,V,Z):s.vertexAttribPointer(M,L,k,O,V,Z)}function x(M,L,k,O){_();const V=O.attributes,Z=k.getAttributes(),H=L.defaultAttributeValues;for(const et in Z){const G=Z[et];if(G.location>=0){let ot=V[et];if(ot===void 0&&(et==="instanceMatrix"&&M.instanceMatrix&&(ot=M.instanceMatrix),et==="instanceColor"&&M.instanceColor&&(ot=M.instanceColor)),ot!==void 0){const pt=ot.normalized,Mt=ot.itemSize,Bt=t.get(ot);if(Bt===void 0)continue;const te=Bt.buffer,Y=Bt.type,it=Bt.bytesPerElement,St=Y===s.INT||Y===s.UNSIGNED_INT||ot.gpuType===Jo;if(ot.isInterleavedBufferAttribute){const rt=ot.data,It=rt.stride,Ft=ot.offset;if(rt.isInstancedInterleavedBuffer){for(let Dt=0;Dt<G.locationSize;Dt++)p(G.location+Dt,rt.meshPerAttribute);M.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=rt.meshPerAttribute*rt.count)}else for(let Dt=0;Dt<G.locationSize;Dt++)g(G.location+Dt);s.bindBuffer(s.ARRAY_BUFFER,te);for(let Dt=0;Dt<G.locationSize;Dt++)v(G.location+Dt,Mt/G.locationSize,Y,pt,It*it,(Ft+Mt/G.locationSize*Dt)*it,St)}else{if(ot.isInstancedBufferAttribute){for(let rt=0;rt<G.locationSize;rt++)p(G.location+rt,ot.meshPerAttribute);M.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=ot.meshPerAttribute*ot.count)}else for(let rt=0;rt<G.locationSize;rt++)g(G.location+rt);s.bindBuffer(s.ARRAY_BUFFER,te);for(let rt=0;rt<G.locationSize;rt++)v(G.location+rt,Mt/G.locationSize,Y,pt,Mt*it,Mt/G.locationSize*rt*it,St)}}else if(H!==void 0){const pt=H[et];if(pt!==void 0)switch(pt.length){case 2:s.vertexAttrib2fv(G.location,pt);break;case 3:s.vertexAttrib3fv(G.location,pt);break;case 4:s.vertexAttrib4fv(G.location,pt);break;default:s.vertexAttrib1fv(G.location,pt)}}}}y()}function P(){R();for(const M in n){const L=n[M];for(const k in L){const O=L[k];for(const V in O)h(O[V].object),delete O[V];delete L[k]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const L=n[M.id];for(const k in L){const O=L[k];for(const V in O)h(O[V].object),delete O[V];delete L[k]}delete n[M.id]}function C(M){for(const L in n){const k=n[L];if(k[M.id]===void 0)continue;const O=k[M.id];for(const V in O)h(O[V].object),delete O[V];delete k[M.id]}}function R(){b(),a=!0,r!==i&&(r=i,c(r.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:R,resetDefaultState:b,dispose:P,releaseStatesOfGeometry:T,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:g,disableUnusedAttributes:y}}function Xm(s,t,e){let n;function i(c){n=c}function r(c,h){s.drawArrays(n,c,h),e.update(h,n,1)}function a(c,h,u){u!==0&&(s.drawArraysInstanced(n,c,h,u),e.update(h,n,u))}function o(c,h,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let f=0;for(let m=0;m<u;m++)f+=h[m];e.update(f,n,1)}function l(c,h,u,d){if(u===0)return;const f=t.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],h[m],d[m]);else{f.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let m=0;for(let _=0;_<u;_++)m+=h[_]*d[_];e.update(m,n,1)}}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function qm(s,t,e,n){let i;function r(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){const C=t.get("EXT_texture_filter_anisotropic");i=s.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==Fe&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const R=C===Fs&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(C!==wn&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Xe&&!R)}function l(C){if(C==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,d=e.reverseDepthBuffer===!0&&t.has("EXT_clip_control"),f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),m=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_TEXTURE_SIZE),g=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),p=s.getParameter(s.MAX_VERTEX_ATTRIBS),y=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),v=s.getParameter(s.MAX_VARYING_VECTORS),x=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),P=m>0,T=s.getParameter(s.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:y,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:P,maxSamples:T}}function Ym(s){const t=this;let e=null,n=0,i=!1,r=!1;const a=new oi,o=new zt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){e=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=s.get(u);if(!i||m===null||m.length===0||r&&!g)r?h(null):c();else{const y=r?0:n,v=y*4;let x=p.clippingState||null;l.value=x,x=h(m,d,v,f);for(let P=0;P!==v;++P)x[P]=e[P];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,d,f,m){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length<p)&&(g=new Float32Array(p));for(let v=0,x=f;v!==_;++v,x+=4)a.copy(u[v]).applyMatrix4(y,o),a.normal.toArray(g,x),g[x+3]=a.constant}l.value=g,l.needsUpdate=!0}return t.numPlanes=_,t.numIntersection=0,g}}function Zm(s){let t=new WeakMap;function e(a,o){return o===kr?a.mapping=Wn:o===Vr&&(a.mapping=fi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===kr||o===Vr)if(t.has(a)){const l=t.get(a).texture;return e(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new rf(l.height);return c.fromEquirectangularTexture(s,a),t.set(a,c),a.addEventListener("dispose",i),e(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}class al extends rl{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,o=i+e,l=i-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const Wi=4,pc=[.125,.215,.35,.446,.526,.582],hi=20,Fa=new al,mc=new mt;let Oa=null,Ba=0,za=0,ka=!1;const li=(1+Math.sqrt(5))/2,Ui=1/li,gc=[new w(-li,Ui,0),new w(li,Ui,0),new w(-Ui,0,li),new w(Ui,0,li),new w(0,li,-Ui),new w(0,li,Ui),new w(-1,1,-1),new w(1,1,-1),new w(-1,1,1),new w(1,1,1)];class _c{constructor(t){this._renderer=t,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(t,e=0,n=.1,i=100){Oa=this._renderer.getRenderTarget(),Ba=this._renderer.getActiveCubeFace(),za=this._renderer.getActiveMipmapLevel(),ka=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=yc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=vc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Oa,Ba,za),this._renderer.xr.enabled=ka,t.scissorTest=!1,ar(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Wn||t.mapping===fi?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Oa=this._renderer.getRenderTarget(),Ba=this._renderer.getActiveCubeFace(),za=this._renderer.getActiveMipmapLevel(),ka=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Me,minFilter:Me,generateMipmaps:!1,type:Fs,format:Fe,colorSpace:ns,depthBuffer:!1},i=xc(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=xc(t,e,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Jm(r)),this._blurMaterial=$m(r,t,e)}return i}_compileMaterial(t){const e=new _e(this._lodPlanes[0],t);this._renderer.compile(e,Fa)}_sceneToCubeUV(t,e,n,i){const o=new Ae(90,1,e,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,d=h.toneMapping;h.getClearColor(mc),h.toneMapping=Hn,h.autoClear=!1;const f=new _i({name:"PMREM.Background",side:Oe,depthWrite:!1,depthTest:!1}),m=new _e(new is,f);let _=!1;const g=t.background;g?g.isColor&&(f.color.copy(g),t.background=null,_=!0):(f.color.copy(mc),_=!0);for(let p=0;p<6;p++){const y=p%3;y===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):y===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const v=this._cubeSize;ar(i,y*v,p>2?v:0,v,v),h.setRenderTarget(i),_&&h.render(m,o),h.render(t,o)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=d,h.autoClear=u,t.background=g}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===Wn||t.mapping===fi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=yc()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=vc());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new _e(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=t;const l=this._cubeSize;ar(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,Fa)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=gc[(i-r-1)%gc.length];this._blur(t,r-1,r,a,o)}e.autoClear=n}_blur(t,e,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new _e(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*hi-1),_=r/m,g=isFinite(r)?1+Math.floor(h*_):hi;g>hi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${hi}`);const p=[];let y=0;for(let C=0;C<hi;++C){const R=C/_,b=Math.exp(-R*R/2);p.push(b),C===0?y+=b:C<g&&(y+=2*b)}for(let C=0;C<p.length;C++)p[C]=p[C]/y;d.envMap.value=t.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:v}=this;d.dTheta.value=m,d.mipInt.value=v-n;const x=this._sizeLods[i],P=3*x*(i>v-Wi?i-v+Wi:0),T=4*(this._cubeSize-x);ar(e,P,T,3*x,2*x),l.setRenderTarget(e),l.render(u,Fa)}}function Jm(s){const t=[],e=[],n=[];let i=s;const r=s-Wi+1+pc.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>s-Wi?l=pc[a-s+Wi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,y=new Float32Array(_*m*f),v=new Float32Array(g*m*f),x=new Float32Array(p*m*f);for(let T=0;T<f;T++){const C=T%3*2/3-1,R=T>2?0:-1,b=[C,R,0,C+2/3,R,0,C+2/3,R+1,0,C,R,0,C+2/3,R+1,0,C,R+1,0];y.set(b,_*m*T),v.set(d,g*m*T);const M=[T,T,T,T,T,T];x.set(M,p*m*T)}const P=new Xt;P.setAttribute("position",new re(y,_)),P.setAttribute("uv",new re(v,g)),P.setAttribute("faceIndex",new re(x,p)),t.push(P),i>Wi&&i--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function xc(s,t,e){const n=new on(s,t,e);return n.texture.mapping=Ns,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ar(s,t,e,n,i){s.viewport.set(t,e,n,i),s.scissor.set(t,e,n,i)}function $m(s,t,e){const n=new Float32Array(hi),i=new w(0,1,0);return new ln({name:"SphericalGaussianBlur",defines:{n:hi,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:ol(),fragmentShader:` 3576 3577 precision mediump float; 3578 precision mediump int; 3579 3580 varying vec3 vOutputDirection; 3581 3582 uniform sampler2D envMap; 3583 uniform int samples; 3584 uniform float weights[ n ]; 3585 uniform bool latitudinal; 3586 uniform float dTheta; 3587 uniform float mipInt; 3588 uniform vec3 poleAxis; 3589 3590 #define ENVMAP_TYPE_CUBE_UV 3591 #include <cube_uv_reflection_fragment> 3592 3593 vec3 getSample( float theta, vec3 axis ) { 3594 3595 float cosTheta = cos( theta ); 3596 // Rodrigues' axis-angle rotation 3597 vec3 sampleDirection = vOutputDirection * cosTheta 3598 + cross( axis, vOutputDirection ) * sin( theta ) 3599 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3600 3601 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3602 3603 } 3604 3605 void main() { 3606 3607 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3608 3609 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3610 3611 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3612 3613 } 3614 3615 axis = normalize( axis ); 3616 3617 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3618 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3619 3620 for ( int i = 1; i < n; i++ ) { 3621 3622 if ( i >= samples ) { 3623 3624 break; 3625 3626 } 3627 3628 float theta = dTheta * float( i ); 3629 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3630 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3631 3632 } 3633 3634 } 3635 `,blending:Vn,depthTest:!1,depthWrite:!1})}function vc(){return new ln({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ol(),fragmentShader:` 3636 3637 precision mediump float; 3638 precision mediump int; 3639 3640 varying vec3 vOutputDirection; 3641 3642 uniform sampler2D envMap; 3643 3644 #include <common> 3645 3646 void main() { 3647 3648 vec3 outputDirection = normalize( vOutputDirection ); 3649 vec2 uv = equirectUv( outputDirection ); 3650
3651 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3652 3653 } 3654 `,blending:Vn,depthTest:!1,depthWrite:!1})}function yc(){return new ln({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ol(),fragmentShader:` 3655 3656 precision mediump float; 3657 precision mediump int; 3658 3659 uniform float flipEnvMap; 3660 3661 varying vec3 vOutputDirection; 3662 3663 uniform samplerCube envMap; 3664 3665 void main() { 3666 3667 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3668 3669 } 3670 `,blending:Vn,depthTest:!1,depthWrite:!1})}function ol(){return` 3671 3672 precision mediump float; 3673 precision mediump int; 3674 3675 attribute float faceIndex; 3676 3677 varying vec3 vOutputDirection; 3678 3679 // RH coordinate system; PMREM face-indexing convention 3680 vec3 getDirection( vec2 uv, float face ) { 3681 3682 uv = 2.0 * uv - 1.0; 3683 3684 vec3 direction = vec3( uv, 1.0 ); 3685 3686 if ( face == 0.0 ) { 3687 3688 direction = direction.zyx; // ( 1, v, u ) pos x 3689 3690 } else if ( face == 1.0 ) { 3691 3692 direction = direction.xzy; 3693 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3694 3695 } else if ( face == 2.0 ) { 3696 3697 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3698 3699 } else if ( face == 3.0 ) { 3700 3701 direction = direction.zyx; 3702 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3703 3704 } else if ( face == 4.0 ) { 3705 3706 direction = direction.xzy; 3707 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3708 3709 } else if ( face == 5.0 ) { 3710 3711 direction.z *= -1.0; // ( u, v, -1 ) neg z 3712 3713 } 3714 3715 return direction; 3716 3717 } 3718 3719 void main() { 3720 3721 vOutputDirection = getDirection( uv, faceIndex ); 3722 gl_Position = vec4( position, 1.0 ); 3723 3724 } 3725 `}function Km(s){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===kr||l===Vr,h=l===Wn||l===fi;if(c||h){let u=t.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return e===null&&(e=new _c(s)),u=c?e.fromEquirectangular(o,u):e.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return c&&f&&f.height>0||h&&f&&i(f)?(e===null&&(e=new _c(s)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",r),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function r(o){const l=o.target;l.removeEventListener("dispose",r);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function a(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:a}}function Qm(s){const t={};function e(n){if(t[n]!==void 0)return t[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return t[n]=i,i}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){const i=e(n);return i===null&&Ss("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function jm(s,t,e,n){const i={},r=new WeakMap;function a(u){const d=u.target;d.index!==null&&t.remove(d.index);for(const m in d.attributes)t.remove(d.attributes[m]);for(const m in d.morphAttributes){const _=d.morphAttributes[m];for(let g=0,p=_.length;g<p;g++)t.remove(_[g])}d.removeEventListener("dispose",a),delete i[d.id];const f=r.get(d);f&&(t.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,e.memory.geometries++),d}function l(u){const d=u.attributes;for(const m in d)t.update(d[m],s.ARRAY_BUFFER);const f=u.morphAttributes;for(const m in f){const _=f[m];for(let g=0,p=_.length;g<p;g++)t.update(_[g],s.ARRAY_BUFFER)}}function c(u){const d=[],f=u.index,m=u.attributes.position;let _=0;if(f!==null){const y=f.array;_=f.version;for(let v=0,x=y.length;v<x;v+=3){const P=y[v+0],T=y[v+1],C=y[v+2];d.push(P,T,T,C,C,P)}}else if(m!==void 0){const y=m.array;_=m.version;for(let v=0,x=y.length/3-1;v<x;v+=3){const P=v+0,T=v+1,C=v+2;d.push(P,T,T,C,C,P)}}else return;const g=new(Hh(d)?qh:Xh)(d,1);g.version=_;const p=r.get(u);p&&t.remove(p),r.set(u,g)}function h(u){const d=r.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return r.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function tg(s,t,e){let n;function i(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function l(d,f){s.drawElements(n,f,r,d*a),e.update(f,n,1)}function c(d,f,m){m!==0&&(s.drawElementsInstanced(n,f,r,d*a,m),e.update(f,n,m))}function h(d,f,m){if(m===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,r,d,0,m);let g=0;for(let p=0;p<m;p++)g+=f[p];e.update(g,n,1)}function u(d,f,m,_){if(m===0)return;const g=t.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);
vendor: 16,623 bytes, lines 3725-3755
3725else{g.multiDrawElementsInstancedWEBGL(n,f,0,r,d,0,_,0,m);let p=0;for(let y=0;y<m;y++)p+=f[y]*_[y];e.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function eg(s){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(e.calls++,a){case s.TRIANGLES:e.triangles+=o*(r/3);break;case s.LINES:e.lines+=o*(r/2);break;case s.LINE_STRIP:e.lines+=o*(r-1);break;case s.LINE_LOOP:e.lines+=o*r;break;case s.POINTS:e.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:i,update:n}}function ng(s,t,e){const n=new WeakMap,i=new Qt;function r(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let b=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],y=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),m===!0&&(v=2),_===!0&&(v=3);let x=o.attributes.position.count*v,P=1;x>t.maxTextureSize&&(P=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const T=new Float32Array(x*P*4*u),C=new il(T,x,P,u);C.type=Xe,C.needsUpdate=!0;const R=v*4;for(let M=0;M<u;M++){const L=g[M],k=p[M],O=y[M],V=x*P*4*M;for(let Z=0;Z<L.count;Z++){const H=Z*R;f===!0&&(i.fromBufferAttribute(L,Z),T[V+H+0]=i.x,T[V+H+1]=i.y,T[V+H+2]=i.z,T[V+H+3]=0),m===!0&&(i.fromBufferAttribute(k,Z),T[V+H+4]=i.x,T[V+H+5]=i.y,T[V+H+6]=i.z,T[V+H+7]=0),_===!0&&(i.fromBufferAttribute(O,Z),T[V+H+8]=i.x,T[V+H+9]=i.y,T[V+H+10]=i.z,T[V+H+11]=O.itemSize===4?i.w:1)}}d={count:u,texture:C,size:new $(x,P)},n.set(o,d),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(s,"morphTexture",a.morphTexture,e);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const m=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(s,"morphTargetBaseInfluence",m),l.getUniforms().setValue(s,"morphTargetInfluences",c)}l.getUniforms().setValue(s,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(s,"morphTargetsTextureSize",d.size)}return{update:r}}function ig(s,t,e,n){let i=new WeakMap;function r(l){const c=n.render.frame,h=l.geometry,u=t.get(l,h);if(i.get(u)!==c&&(t.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(e.update(l.instanceMatrix,s.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,s.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return u}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:r,dispose:a}}class Jh extends me{constructor(t,e,n,i,r,a,o,l,c,h=Yi){if(h!==Yi&&h!==Qi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Yi&&(n=Xn),n===void 0&&h===Qi&&(n=Ki),super(null,i,r,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=o!==void 0?o:we,this.minFilter=l!==void 0?l:we,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}const $h=new me,Mc=new Jh(1,1),Kh=new il,Qh=new Gh,jh=new ra,Sc=[],bc=[],Ec=new Float32Array(16),Tc=new Float32Array(9),Ac=new Float32Array(4);function ss(s,t,e){const n=s[0];if(n<=0||n>0)return s;const i=t*e;let r=Sc[i];if(r===void 0&&(r=new Float32Array(i),Sc[i]=r),t!==0){n.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=e,s[a].toArray(r,o)}return r}function xe(s,t){if(s.length!==t.length)return!1;for(let e=0,n=s.length;e<n;e++)if(s[e]!==t[e])return!1;return!0}function ve(s,t){for(let e=0,n=t.length;e<n;e++)s[e]=t[e]}function oa(s,t){let e=bc[t];e===void 0&&(e=new Int32Array(t),bc[t]=e);for(let n=0;n!==t;++n)e[n]=s.allocateTextureUnit();return e}function sg(s,t){const e=this.cache;e[0]!==t&&(s.uniform1f(this.addr,t),e[0]=t)}function rg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(s.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xe(e,t))return;s.uniform2fv(this.addr,t),ve(e,t)}}function ag(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(s.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(s.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(xe(e,t))return;s.uniform3fv(this.addr,t),ve(e,t)}}function og(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(s.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xe(e,t))return;s.uniform4fv(this.addr,t),ve(e,t)}}function lg(s,t){const e=this.cache,n=t.elements;if(n===void 0){if(xe(e,t))return;s.uniformMatrix2fv(this.addr,!1,t),ve(e,t)}else{if(xe(e,n))return;Ac.set(n),s.uniformMatrix2fv(this.addr,!1,Ac),ve(e,n)}}function cg(s,t){const e=this.cache,n=t.elements;if(n===void 0){if(xe(e,t))return;s.uniformMatrix3fv(this.addr,!1,t),ve(e,t)}else{if(xe(e,n))return;Tc.set(n),s.uniformMatrix3fv(this.addr,!1,Tc),ve(e,n)}}function hg(s,t){const e=this.cache,n=t.elements;if(n===void 0){if(xe(e,t))return;s.uniformMatrix4fv(this.addr,!1,t),ve(e,t)}else{if(xe(e,n))return;Ec.set(n),s.uniformMatrix4fv(this.addr,!1,Ec),ve(e,n)}}function ug(s,t){const e=this.cache;e[0]!==t&&(s.uniform1i(this.addr,t),e[0]=t)}function dg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(s.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xe(e,t))return;s.uniform2iv(this.addr,t),ve(e,t)}}function fg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(s.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(xe(e,t))return;s.uniform3iv(this.addr,t),ve(e,t)}}function pg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(s.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xe(e,t))return;s.uniform4iv(this.addr,t),ve(e,t)}}function mg(s,t){const e=this.cache;e[0]!==t&&(s.uniform1ui(this.addr,t),e[0]=t)}function gg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(s.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xe(e,t))return;s.uniform2uiv(this.addr,t),ve(e,t)}}function _g(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(s.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(xe(e,t))return;s.uniform3uiv(this.addr,t),ve(e,t)}}function xg(s,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(s.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xe(e,t))return;s.uniform4uiv(this.addr,t),ve(e,t)}}function vg(s,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(Mc.compareFunction=Vh,r=Mc):r=$h,e.setTexture2D(t||r,i)}function yg(s,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),e.setTexture3D(t||Qh,i)}function Mg(s,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),e.setTextureCube(t||jh,i)}function Sg(s,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),e.setTexture2DArray(t||Kh,i)}function bg(s){switch(s){case 5126:return sg;case 35664:return rg;case 35665:return ag;case 35666:return og;case 35674:return lg;case 35675:return cg;case 35676:return hg;case 5124:case 35670:return ug;case 35667:case 35671:return dg;case 35668:case 35672:return fg;case 35669:case 35673:return pg;case 5125:return mg;case 36294:return gg;case 36295:return _g;case 36296:return xg;case 35678:case 36198:case 36298:case 36306:case 35682:return vg;case 35679:case 36299:case 36307:return yg;case 35680:case 36300:case 36308:case 36293:return Mg;case 36289:case 36303:case 36311:case 36292:return Sg}}function Eg(s,t){s.uniform1fv(this.addr,t)}function Tg(s,t){const e=ss(t,this.size,2);s.uniform2fv(this.addr,e)}function Ag(s,t){const e=ss(t,this.size,3);s.uniform3fv(this.addr,e)}function wg(s,t){const e=ss(t,this.size,4);s.uniform4fv(this.addr,e)}function Cg(s,t){const e=ss(t,this.size,4);s.uniformMatrix2fv(this.addr,!1,e)}function Rg(s,t){const e=ss(t,this.size,9);s.uniformMatrix3fv(this.addr,!1,e)}function Ig(s,t){const e=ss(t,this.size,16);s.uniformMatrix4fv(this.addr,!1,e)}function Pg(s,t){s.uniform1iv(this.addr,t)}function Lg(s,t){s.uniform2iv(this.addr,t)}function Dg(s,t){s.uniform3iv(this.addr,t)}function Ug(s,t){s.uniform4iv(this.addr,t)}function Ng(s,t){s.uniform1uiv(this.addr,t)}function Fg(s,t){s.uniform2uiv(this.addr,t)}function Og(s,t){s.uniform3uiv(this.addr,t)}function Bg(s,t){s.uniform4uiv(this.addr,t)}function zg(s,t,e){const n=this.cache,i=t.length,r=oa(e,i);xe(n,r)||(s.uniform1iv(this.addr,r),ve(n,r));for(let a=0;a!==i;++a)e.setTexture2D(t[a]||$h,r[a])}function kg(s,t,e){const n=this.cache,i=t.length,r=oa(e,i);xe(n,r)||(s.uniform1iv(this.addr,r),ve(n,r));for(let a=0;a!==i;++a)e.setTexture3D(t[a]||Qh,r[a])}function Vg(s,t,e){const n=this.cache,i=t.length,r=oa(e,i);xe(n,r)||(s.uniform1iv(this.addr,r),ve(n,r));for(let a=0;a!==i;++a)e.setTextureCube(t[a]||jh,r[a])}function Hg(s,t,e){const n=this.cache,i=t.length,r=oa(e,i);xe(n,r)||(s.uniform1iv(this.addr,r),ve(n,r));for(let a=0;a!==i;++a)e.setTexture2DArray(t[a]||Kh,r[a])}function Gg(s){switch(s){case 5126:return Eg;case 35664:return Tg;case 35665:return Ag;case 35666:return wg;case 35674:return Cg;case 35675:return Rg;case 35676:return Ig;case 5124:case 35670:return Pg;case 35667:case 35671:return Lg;case 35668:case 35672:return Dg;case 35669:case 35673:return Ug;case 5125:return Ng;case 36294:return Fg;case 36295:return Og;case 36296:return Bg;case 35678:case 36198:case 36298:case 36306:case 35682:return zg;case 35679:case 36299:case 36307:return kg;case 35680:case 36300:case 36308:case 36293:return Vg;case 36289:case 36303:case 36311:case 36292:return Hg}}class Wg{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=bg(e.type)}}class Xg{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=Gg(e.type)}}class qg{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const o=i[r];o.setValue(t,e[o.id],n)}}}const Va=/(\w+)(\])?(\[|\.)?/g;function wc(s,t){s.seq.push(t),s.map[t.id]=t}function Yg(s,t,e){const n=s.name,i=n.length;for(Va.lastIndex=0;;){const r=Va.exec(n),a=Va.lastIndex;let o=r[1];const l=r[2]==="]",c=r[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){wc(e,c===void 0?new Wg(o,s,t):new Xg(o,s,t));break}else{let u=e.map[o];u===void 0&&(u=new qg(o),wc(e,u)),e=u}}}class zr{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=t.getActiveUniform(e,i),a=t.getUniformLocation(e,r.name);Yg(r,a,this)}}setValue(t,e,n,i){const r=this.map[e];r!==void 0&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];i!==void 0&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,a=e.length;r!==a;++r){const o=e[r],l=n[o.id];l.needsUpdate!==!1&&o.setValue(t,l.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const a=t[i];a.id in e&&n.push(a)}return n}}function Cc(s,t,e){const n=s.createShader(t);return s.shaderSource(n,e),s.compileShader(n),n}const Zg=37297;let Jg=0;function $g(s,t){const e=s.split(` 3726`),n=[],i=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let a=i;a<r;a++){const o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(` 3727`)}const Rc=new zt;function Kg(s){Zt._getMatrix(Rc,Zt.workingColorSpace,s);const t=`mat3( ${Rc.elements.map(e=>e.toFixed(4))} )`;switch(Zt.getTransfer(s)){case sa:return[t,"LinearTransferOETF"];case se:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",s),[t,"LinearTransferOETF"]}}function Ic(s,t,e){const n=s.getShaderParameter(t,s.COMPILE_STATUS),i=s.getShaderInfoLog(t).trim();if(n&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const a=parseInt(r[1]);return e.toUpperCase()+` 3728 3729`+i+` 3730 3731`+$g(s.getShaderSource(t),a)}else return i}function Qg(s,t){const e=Kg(t);return[`vec4 ${s}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(` 3732`)}function jg(s,t){let e;switch(t){case $u:e="Linear";break;case Ku:e="Reinhard";break;case Qu:e="Cineon";break;case ju:e="ACESFilmic";break;case ed:e="AgX";break;case nd:e="Neutral";break;case td:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+s+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const or=new w;function t_(){Zt.getLuminanceCoefficients(or);const s=or.x.toFixed(4),t=or.y.toFixed(4),e=or.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` 3733`)}function e_(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Es).join(` 3734`)}function n_(s){const t=[];for(const e in s){const n=s[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` 3735`)}function i_(s,t){const e={},n=s.getProgramParameter(t,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(t,i),a=r.name;let o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),e[a]={type:r.type,location:s.getAttribLocation(t,a),locationSize:o}}return e}function Es(s){return s!==""}function Pc(s,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Lc(s,t){return s.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const s_=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vo(s){return s.replace(s_,a_)}const r_=new Map;function a_(s,t){let e=Wt[t];if(e===void 0){const n=r_.get(t);if(n!==void 0)e=Wt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return Vo(e)}const o_=/#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 Dc(s){return s.replace(o_,l_)}function l_(s,t,e,n){let i="";for(let r=parseInt(t);r<parseInt(e);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function Uc(s){let t=`precision ${s.precision} float; 3736 precision ${s.precision} int; 3737 precision ${s.precision} sampler2D; 3738 precision ${s.precision} samplerCube; 3739 precision ${s.precision} sampler3D; 3740 precision ${s.precision} sampler2DArray; 3741 precision ${s.precision} sampler2DShadow; 3742 precision ${s.precision} samplerCubeShadow; 3743 precision ${s.precision} sampler2DArrayShadow; 3744 precision ${s.precision} isampler2D; 3745 precision ${s.precision} isampler3D; 3746 precision ${s.precision} isamplerCube; 3747 precision ${s.precision} isampler2DArray; 3748 precision ${s.precision} usampler2D; 3749 precision ${s.precision} usampler3D; 3750 precision ${s.precision} usamplerCube; 3751 precision ${s.precision} usampler2DArray; 3752 `;return s.precision==="highp"?t+=` 3753#define HIGH_PRECISION`:s.precision==="mediump"?t+=` 3754#define MEDIUM_PRECISION`:s.precision==="lowp"&&(t+=` 3755#define LOW_PRECISION`),t}function c_(s){let t="SHADOWMAP_TYPE_BASIC";
vendor: 7,866 bytes, lines 3755-3762
3755return s.shadowMapType===Rh?t="SHADOWMAP_TYPE_PCF":s.shadowMapType===Ru?t="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===vn&&(t="SHADOWMAP_TYPE_VSM"),t}function h_(s){let t="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case Wn:case fi:t="ENVMAP_TYPE_CUBE";break;case Ns:t="ENVMAP_TYPE_CUBE_UV";break}return t}function u_(s){let t="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case fi:t="ENVMAP_MODE_REFRACTION";break}return t}function d_(s){let t="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case na:t="ENVMAP_BLENDING_MULTIPLY";break;case Zu:t="ENVMAP_BLENDING_MIX";break;case Ju:t="ENVMAP_BLENDING_ADD";break}return t}function f_(s){const t=s.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function p_(s,t,e,n){const i=s.getContext(),r=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=c_(e),c=h_(e),h=u_(e),u=d_(e),d=f_(e),f=e_(e),m=n_(r),_=i.createProgram();let g,p,y=e.glslVersion?"#version "+e.glslVersion+` 3756`:"";e.isRawShaderMaterial?(g=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Es).join(` 3757`),g.length>0&&(g+=` 3758`),p=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Es).join(` 3759`),p.length>0&&(p+=` 3760`)):(g=[Uc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3761`].filter(Es).join(` 3762`),p=[Uc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IR
3762IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Hn?"#define TONE_MAPPING":"",e.toneMapping!==Hn?Wt.tonemapping_pars_fragment:"",e.toneMapping!==Hn?jg("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Wt.colorspace_pars_fragment,Qg("linearToOutputTexel",e.outputColorSpace),t_(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` 3763`].filter(Es).join(` 3764`)),a=Vo(a),a=Pc(a,e),a=Lc(a,e),o=Vo(o),o=Pc(o,e),o=Lc(o,e),a=Dc(a),o=Dc(o),e.isRawShaderMaterial!==!0&&(y=`#version 300 es 3765`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3766`)+` 3767`+g,p=["#define varying in",e.glslVersion===ql?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===ql?"":"#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(` 3768`)+` 3769`+p);const v=y+g+a,x=y+p+o,P=Cc(i,i.VERTEX_SHADER,v),T=Cc(i,i.FRAGMENT_SHADER,x);i.attachShader(_,P),i.attachShader(_,T),e.index0AttributeName!==void 0?i.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(L){if(s.debug.checkShaderErrors){const k=i.getProgramInfoLog(_).trim(),O=i.getShaderInfoLog(P).trim(),V=i.getShaderInfoLog(T).trim();let Z=!0,H=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(Z=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,P,T);else{const et=Ic(i,P,"vertex"),G=Ic(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` 3770 3771Material Name: `+L.name+` 3772Material Type: `+L.type+` 3773 3774Program Info Log: `+k+` 3775`+et+` 3776`+G)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(O===""||V==="")&&(H=!1);H&&(L.diagnostics={runnable:Z,programLog:k,vertexShader:{log:O,prefix:g},fragmentShader:{log:V,prefix:p}})}i.deleteShader(P),i.deleteShader(T),R=new zr(i,_),b=i_(i,_)}let R;this.getUniforms=function(){return R===void 0&&C(this),R};let b;this.getAttributes=function(){return b===void 0&&C(this),b};let M=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(_,Zg)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Jg++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=P,this.fragmentShader=T,this}let m_=0;class g_{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new __(t),e.set(t,n)),n}}class __{constructor(t){this.id=m_++,this.code=t,this.usedTimes=0}}function x_(s,t,e,n,i,r,a){const o=new sl,l=new g_,c=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={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"};function _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,M,L,k,O){const V=k.fog,Z=O.geometry,H=b.isMeshStandardMaterial?k.environment:null,et=(b.isMeshStandardMaterial?e:t).get(b.envMap||H),G=et&&et.mapping===Ns?et.image.height:null,ot=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const pt=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,Mt=pt!==void 0?pt.length:0;let Bt=0;Z.morphAttributes.position!==void 0&&(Bt=1),Z.morphAttributes.normal!==void 0&&(Bt=2),Z.morphAttributes.color!==void 0&&(Bt=3);let te,Y,it,St;if(ot){const ie=an[ot];te=ie.vertexShader,Y=ie.fragmentShader}else te=b.vertexShader,Y=b.fragmentShader,l.update(b),it=l.getVertexShaderID(b),St=l.getFragmentShaderID(b);const rt=s.getRenderTarget(),It=s.state.buffers.depth.getReversed(),Ft=O.isInstancedMesh===!0,Dt=O.isBatchedMesh===!0,Jt=!!b.map,K=!!b.matcap,nt=!!et,I=!!b.aoMap,Ct=!!b.lightMap,j=!!b.bumpMap,xt=!!b.normalMap,at=!!b.displacementMap,Pt=!!b.emissiveMap,gt=!!b.metalnessMap,A=!!b.roughnessMap,S=b.anisotropy>0,F=b.clearcoat>0,X=b.dispersion>0,Q=b.iridescence>0,q=b.sheen>0,Et=b.transmission>0,ct=S&&!!b.anisotropyMap,_t=F&&!!b.clearcoatMap,qt=F&&!!b.clearcoatNormalMap,tt=F&&!!b.clearcoatRoughnessMap,vt=Q&&!!b.iridescenceMap,Lt=Q&&!!b.iridescenceThicknessMap,Nt=q&&!!b.sheenColorMap,yt=q&&!!b.sheenRoughnessMap,Yt=!!b.specularMap,Gt=!!b.specularColorMap,ae=!!b.specularIntensityMap,D=Et&&!!b.transmissionMap,ht=Et&&!!b.thicknessMap,W=!!b.gradientMap,J=!!b.alphaMap,ft=b.alphaTest>0,ut=!!b.alphaHash,Vt=!!b.extensions;let ue=Hn;b.toneMapped&&(rt===null||rt.isXRRenderTarget===!0)&&(ue=s.toneMapping);const Se={shaderID:ot,shaderType:b.type,shaderName:b.name,vertexShader:te,fragmentShader:Y,defines:b.defines,customVertexShaderID:it,customFragmentShaderID:St,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Dt,batchingColor:Dt&&O._colorsTexture!==null,instancing:Ft,instancingColor:Ft&&O.instanceColor!==null,instancingMorph:Ft&&O.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:rt===null?s.outputColorSpace:rt.isXRRenderTarget===!0?rt.texture.colorSpace:ns,alphaToCoverage:!!b.alphaToCoverage,map:Jt,matcap:K,envMap:nt,envMapMode:nt&&et.mapping,envMapCubeUVHeight:G,aoMap:I,lightMap:Ct,bumpMap:j,normalMap:xt,displacementMap:d&&at,emissiveMap:Pt,normalMapObjectSpace:xt&&b.normalMapType===cd,normalMapTangentSpace:xt&&b.normalMapType===gi,metalnessMap:gt,roughnessMap:A,anisotropy:S,anisotropyMap:ct,clearcoat:F,clearcoatMap:_t,clearcoatNormalMap:qt,clearcoatRoughnessMap:tt,dispersion:X,iridescence:Q,iridescenceMap:vt,iridescenceThicknessMap:Lt,sheen:q,sheenColorMap:Nt,sheenRoughnessMap:yt,specularMap:Yt,specularColorMap:Gt,specularIntensityMap:ae,transmission:Et,transmissionMap:D,thicknessMap:ht,gradientMap:W,opaque:b.transparent===!1&&b.blending===qi&&b.alphaToCoverage===!1,alphaMap:J,alphaTest:ft,alphaHash:ut,combine:b.combine,mapUv:Jt&&_(b.map.channel),aoMapUv:I&&_(b.aoMap.channel),lightMapUv:Ct&&_(b.lightMap.channel),bumpMapUv:j&&_(b.bumpMap.channel),normalMapUv:xt&&_(b.normalMap.channel),displacementMapUv:at&&_(b.displacementMap.channel),emissiveMapUv:Pt&&_(b.emissiveMap.channel),metalnessMapUv:gt&&_(b.metalnessMap.channel),roughnessMapUv:A&&_(b.roughnessMap.channel),anisotropyMapUv:ct&&_(b.anisotropyMap.channel),clearcoatMapUv:_t&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:qt&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:vt&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:Lt&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Nt&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:yt&&_(b.sheenRoughnessMap.channel),specularMapUv:Yt&&_(b.specularMap.channel),specularColorMapUv:Gt&&_(b.specularColorMap.channel),specularIntensityMapUv:ae&&_(b.specularIntensityMap.channel),transmissionMapUv:D&&_(b.transmissionMap.channel),thicknessMapUv:ht&&_(b.thicknessMap.channel),alphaMapUv:J&&_(b.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(xt||S),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!Z.attributes.uv&&(Jt||J),fog:!!V,useFog:b.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:It,skinning:O.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:Mt,morphTextureStride:Bt,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:s.shadowMap.enabled&&L.length>0,shadowMapType:s.shadowMap.type,toneMapping:ue,decodeVideoTexture:Jt&&b.map.isVideoTexture===!0&&Zt.getTransfer(b.map.colorSpace)===se,decodeVideoTextureEmissive:Pt&&b.emissiveMap.isVideoTexture===!0&&Zt.getTransfer(b.emissiveMap.colorSpace)===se,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===yn,flipSided:b.side===Oe,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionCl
vendor: 13,732 bytes, lines 3776-3782
3776ipCullDistance:Vt&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Vt&&b.extensions.multiDraw===!0||Dt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Se.vertexUv1s=c.has(1),Se.vertexUv2s=c.has(2),Se.vertexUv3s=c.has(3),c.clear(),Se}function p(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)M.push(L),M.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(y(M,b),v(M,b),M.push(s.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function y(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function v(b,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),b.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.reverseDepthBuffer&&o.enable(4),M.skinning&&o.enable(5),M.morphTargets&&o.enable(6),M.morphNormals&&o.enable(7),M.morphColors&&o.enable(8),M.premultipliedAlpha&&o.enable(9),M.shadowMapEnabled&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.decodeVideoTextureEmissive&&o.enable(20),M.alphaToCoverage&&o.enable(21),b.push(o.mask)}function x(b){const M=m[b.type];let L;if(M){const k=an[M];L=tf.clone(k.uniforms)}else L=b.uniforms;return L}function P(b,M){let L;for(let k=0,O=h.length;k<O;k++){const V=h[k];if(V.cacheKey===M){L=V,++L.usedTimes;break}}return L===void 0&&(L=new p_(s,M,b,r),h.push(L)),L}function T(b){if(--b.usedTimes===0){const M=h.indexOf(b);h[M]=h[h.length-1],h.pop(),b.destroy()}}function C(b){l.remove(b)}function R(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:x,acquireProgram:P,releaseProgram:T,releaseShaderCache:C,programs:h,dispose:R}}function v_(){let s=new WeakMap;function t(a){return s.has(a)}function e(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,l){s.get(a)[o]=l}function r(){s=new WeakMap}return{has:t,get:e,remove:n,update:i,dispose:r}}function y_(s,t){return s.groupOrder!==t.groupOrder?s.groupOrder-t.groupOrder:s.renderOrder!==t.renderOrder?s.renderOrder-t.renderOrder:s.material.id!==t.material.id?s.material.id-t.material.id:s.z!==t.z?s.z-t.z:s.id-t.id}function Nc(s,t){return s.groupOrder!==t.groupOrder?s.groupOrder-t.groupOrder:s.renderOrder!==t.renderOrder?s.renderOrder-t.renderOrder:s.z!==t.z?t.z-s.z:s.id-t.id}function Fc(){const s=[];let t=0;const e=[],n=[],i=[];function r(){t=0,e.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=s[t];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},s[t]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=_,p.group=g),t++,p}function o(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):e.push(p)}function l(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):e.unshift(p)}function c(u,d){e.length>1&&e.sort(u||y_),n.length>1&&n.sort(d||Nc),i.length>1&&i.sort(d||Nc)}function h(){for(let u=t,d=s.length;u<d;u++){const f=s[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:e,transmissive:n,transparent:i,init:r,push:o,unshift:l,finish:h,sort:c}}function M_(){let s=new WeakMap;function t(n,i){const r=s.get(n);let a;return r===void 0?(a=new Fc,s.set(n,[a])):i>=r.length?(a=new Fc,r.push(a)):a=r[i],a}function e(){s=new WeakMap}return{get:t,dispose:e}}function S_(){const s={};return{get:function(t){if(s[t.id]!==void 0)return s[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new w,color:new mt};break;case"SpotLight":e={position:new w,direction:new w,color:new mt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new w,color:new mt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new w,skyColor:new mt,groundColor:new mt};break;case"RectAreaLight":e={color:new mt,position:new w,halfWidth:new w,halfHeight:new w};break}return s[t.id]=e,e}}}function b_(){const s={};return{get:function(t){if(s[t.id]!==void 0)return s[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[t.id]=e,e}}}let E_=0;function T_(s,t){return(t.castShadow?2:0)-(s.castShadow?2:0)+(t.map?1:0)-(s.map?1:0)}function A_(s){const t=new S_,e=b_(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new w);const i=new w,r=new Ut,a=new Ut;function o(c){let h=0,u=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,y=0,v=0,x=0,P=0,T=0,C=0;c.sort(T_);for(let b=0,M=c.length;b<M;b++){const L=c[b],k=L.color,O=L.intensity,V=L.distance,Z=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)h+=k.r*O,u+=k.g*O,d+=k.b*O;else if(L.isLightProbe){for(let H=0;H<9;H++)n.probe[H].addScaledVector(L.sh.coefficients[H],O);C++}else if(L.isDirectionalLight){const H=t.get(L);if(H.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const et=L.shadow,G=e.get(L);G.shadowIntensity=et.intensity,G.shadowBias=et.bias,G.shadowNormalBias=et.normalBias,G.shadowRadius=et.radius,G.shadowMapSize=et.mapSize,n.directionalShadow[f]=G,n.directionalShadowMap[f]=Z,n.directionalShadowMatrix[f]=L.shadow.matrix,y++}n.directional[f]=H,f++}else if(L.isSpotLight){const H=t.get(L);H.position.setFromMatrixPosition(L.matrixWorld),H.color.copy(k).multiplyScalar(O),H.distance=V,H.coneCos=Math.cos(L.angle),H.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),H.decay=L.decay,n.spot[_]=H;const et=L.shadow;if(L.map&&(n.spotLightMap[P]=L.map,P++,et.updateMatrices(L),L.castShadow&&T++),n.spotLightMatrix[_]=et.matrix,L.castShadow){const G=e.get(L);G.shadowIntensity=et.intensity,G.shadowBias=et.bias,G.shadowNormalBias=et.normalBias,G.shadowRadius=et.radius,G.shadowMapSize=et.mapSize,n.spotShadow[_]=G,n.spotShadowMap[_]=Z,x++}_++}else if(L.isRectAreaLight){const H=t.get(L);H.color.copy(k).multiplyScalar(O),H.halfWidth.set(L.width*.5,0,0),H.halfHeight.set(0,L.height*.5,0),n.rectArea[g]=H,g++}else if(L.isPointLight){const H=t.get(L);if(H.color.copy(L.color).multiplyScalar(L.intensity),H.distance=L.distance,H.decay=L.decay,L.castShadow){const et=L.shadow,G=e.get(L);G.shadowIntensity=et.intensity,G.shadowBias=et.bias,G.shadowNormalBias=et.normalBias,G.shadowRadius=et.radius,G.shadowMapSize=et.mapSize,G.shadowCameraNear=et.camera.near,G.shadowCameraFar=et.camera.far,n.pointShadow[m]=G,n.pointShadowMap[m]=Z,n.pointShadowMatrix[m]=L.shadow.matrix,v++}n.point[m]=H,m++}else if(L.isHemisphereLight){const H=t.get(L);H.skyColor.copy(L.color).multiplyScalar(O),H.groundColor.copy(L.groundColor).multiplyScalar(O),n.hemi[p]=H,p++}}g>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=lt.LTC_FLOAT_1,n.rectAreaLTC2=lt.LTC_FLOAT_2):(n.rectAreaLTC1=lt.LTC_HALF_1,n.rectAreaLTC2=lt.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const R=n.hash;(R.directionalLength!==f||R.pointLength!==m||R.spotLength!==_||R.rectAreaLength!==g||R.hemiLength!==p||R.numDirectionalShadows!==y||R.numPointShadows!==v||R.numSpotShadows!==x||R.numSpotMaps!==P||R.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=v,n.spotLightMatrix.length=x+P-T,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,R.directionalLength=f,R.pointLength=m,R.spotLength=_,R.rectAreaLength=g,R.hemiLength=p,R.numDirectionalShadows=y,R.numPointShadows=v,R.numSpotShadows=x,R.numSpotMaps=P,R.numLightProbes=C,n.version=E_++)}function l(c,h){let u=0,d=0,f=0,m=0,_=0;const g=h.matrixWorldInverse;for(let p=0,y=c.length;p<y;p++){const v=c[p];if(v.isDirectionalLight){const x=n.directional[u];x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),u++}else if(v.isSpotLight){const x=n.spot[f];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),f++}else if(v.isRectAreaLight){const x=n.rectArea[m];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),a.identity(),r.copy(v.matrixWorld),r.premultiply(g),a.extractRotation(r),x.halfWidth.set(v.width*.5,0,0),x.halfHeight.set(0,v.height*.5,0),x.halfWidth.applyMatrix4(a),x.halfHeight.applyMatrix4(a),m++}else if(v.isPointLight){const x=n.point[d];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),d++}else if(v.isHemisphereLight){const x=n.hemi[_];x.direction.setFromMatrixPosition(v.matrixWorld),x.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function Oc(s){const t=new A_(s),e=[],n=[];function i(h){c.camera=h,e.length=0,n.length=0}function r(h){e.push(h)}function a(h){n.push(h)}function o(){t.setup(e)}function l(h){t.setupView(e,h)}const c={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:r,pushShadow:a}}function w_(s){let t=new WeakMap;function e(i,r=0){const a=t.get(i);let o;return a===void 0?(o=new Oc(s),t.set(i,[o])):r>=a.length?(o=new Oc(s),a.push(o)):o=a[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}class tu extends Le{static get type(){return"MeshDepthMaterial"}constructor(t){super(),this.isMeshDepthMaterial=!0,this.depthPacking=od,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class eu extends Le{static get type(){return"MeshDistanceMaterial"}constructor(t){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const C_=`void main() { 3777 gl_Position = vec4( position, 1.0 ); 3778}`,R_=`uniform sampler2D shadow_pass; 3779uniform vec2 resolution; 3780uniform float radius; 3781#include <packing> 3782void main() {
3783 const float samples = float( VSM_SAMPLES ); 3784 float mean = 0.0; 3785 float squared_mean = 0.0; 3786 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3787 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3788 for ( float i = 0.0; i < samples; i ++ ) { 3789 float uvOffset = uvStart + i * uvStride; 3790 #ifdef HORIZONTAL_PASS 3791 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3792 mean += distribution.x; 3793 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3794 #else 3795 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3796 mean += depth; 3797 squared_mean += depth * depth; 3798 #endif 3799 } 3800 mean = mean / samples; 3801 squared_mean = squared_mean / samples; 3802 float std_dev = sqrt( squared_mean - mean * mean ); 3803 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3804}`;function I_(s,t,e){let n=new aa;const i=new $,r=new $,a=new Qt,o=new tu({depthPacking:ld}),l=new eu,c={},h=e.maxTextureSize,u={[Gn]:Oe,[Oe]:Gn,[yn]:yn},d=new ln({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $},radius:{value:4}},vertexShader:C_,fragmentShader:R_}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Xt;m.setAttribute("position",new re(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new _e(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Rh;let p=this.type;this.render=function(T,C,R){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const b=s.getRenderTarget(),M=s.getActiveCubeFace(),L=s.getActiveMipmapLevel(),k=s.state;k.setBlending(Vn),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const O=p!==vn&&this.type===vn,V=p===vn&&this.type!==vn;for(let Z=0,H=T.length;Z<H;Z++){const et=T[Z],G=et.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",et,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const ot=G.getFrameExtents();if(i.multiply(ot),r.copy(G.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/ot.x),i.x=r.x*ot.x,G.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/ot.y),i.y=r.y*ot.y,G.mapSize.y=r.y)),G.map===null||O===!0||V===!0){const Mt=this.type!==vn?{minFilter:we,magFilter:we}:{};G.map!==null&&G.map.dispose(),G.map=new on(i.x,i.y,Mt),G.map.texture.name=et.name+".shadowMap",G.camera.updateProjectionMatrix()}s.setRenderTarget(G.map),s.clear();const pt=G.getViewportCount();for(let Mt=0;Mt<pt;Mt++){const Bt=G.getViewport(Mt);a.set(r.x*Bt.x,r.y*Bt.y,r.x*Bt.z,r.y*Bt.w),k.viewport(a),G.updateMatrices(et,Mt),n=G.getFrustum(),x(C,R,G.camera,et,this.type)}G.isPointLightShadow!==!0&&this.type===vn&&y(G,R),G.needsUpdate=!1}p=this.type,g.needsUpdate=!1,s.setRenderTarget(b,M,L)};function y(T,C){const R=t.update(_);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new on(i.x,i.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,s.setRenderTarget(T.mapPass),s.clear(),s.renderBufferDirect(C,null,R,d,_,
vendor: 4,403 bytes, line 3804
3804null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,s.setRenderTarget(T.map),s.clear(),s.renderBufferDirect(C,null,R,f,_,null)}function v(T,C,R,b){let M=null;const L=R.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(L!==void 0)M=L;else if(M=R.isPointLight===!0?l:o,s.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){const k=M.uuid,O=C.uuid;let V=c[k];V===void 0&&(V={},c[k]=V);let Z=V[O];Z===void 0&&(Z=M.clone(),V[O]=Z,C.addEventListener("dispose",P)),M=Z}if(M.visible=C.visible,M.wireframe=C.wireframe,b===vn?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:u[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.map=C.map,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,R.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const k=s.properties.get(M);k.light=R}return M}function x(T,C,R,b,M){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===vn)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,T.matrixWorld);const O=t.update(T),V=T.material;if(Array.isArray(V)){const Z=O.groups;for(let H=0,et=Z.length;H<et;H++){const G=Z[H],ot=V[G.materialIndex];if(ot&&ot.visible){const pt=v(T,ot,b,M);T.onBeforeShadow(s,T,C,R,O,pt,G),s.renderBufferDirect(R,null,O,pt,T,G),T.onAfterShadow(s,T,C,R,O,pt,G)}}}else if(V.visible){const Z=v(T,V,b,M);T.onBeforeShadow(s,T,C,R,O,Z,null),s.renderBufferDirect(R,null,O,Z,T,null),T.onAfterShadow(s,T,C,R,O,Z,null)}}const k=T.children;for(let O=0,V=k.length;O<V;O++)x(k[O],C,R,b,M)}function P(T){T.target.removeEventListener("dispose",P);for(const R in c){const b=c[R],M=T.target.uuid;M in b&&(b[M].dispose(),delete b[M])}}}const P_={[ao]:oo,[lo]:uo,[co]:fo,[$i]:ho,[oo]:ao,[uo]:lo,[fo]:co,[ho]:$i};function L_(s,t){function e(){let D=!1;const ht=new Qt;let W=null;const J=new Qt(0,0,0,0);return{setMask:function(ft){W!==ft&&!D&&(s.colorMask(ft,ft,ft,ft),W=ft)},setLocked:function(ft){D=ft},setClear:function(ft,ut,Vt,ue,Se){Se===!0&&(ft*=ue,ut*=ue,Vt*=ue),ht.set(ft,ut,Vt,ue),J.equals(ht)===!1&&(s.clearColor(ft,ut,Vt,ue),J.copy(ht))},reset:function(){D=!1,W=null,J.set(-1,0,0,0)}}}function n(){let D=!1,ht=!1,W=null,J=null,ft=null;return{setReversed:function(ut){if(ht!==ut){const Vt=t.get("EXT_clip_control");ht?Vt.clipControlEXT(Vt.LOWER_LEFT_EXT,Vt.ZERO_TO_ONE_EXT):Vt.clipControlEXT(Vt.LOWER_LEFT_EXT,Vt.NEGATIVE_ONE_TO_ONE_EXT);const ue=ft;ft=null,this.setClear(ue)}ht=ut},getReversed:function(){return ht},setTest:function(ut){ut?rt(s.DEPTH_TEST):It(s.DEPTH_TEST)},setMask:function(ut){W!==ut&&!D&&(s.depthMask(ut),W=ut)},setFunc:function(ut){if(ht&&(ut=P_[ut]),J!==ut){switch(ut){case ao:s.depthFunc(s.NEVER);break;case oo:s.depthFunc(s.ALWAYS);break;case lo:s.depthFunc(s.LESS);break;case $i:s.depthFunc(s.LEQUAL);break;case co:s.depthFunc(s.EQUAL);break;case ho:s.depthFunc(s.GEQUAL);break;case uo:s.depthFunc(s.GREATER);break;case fo:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}J=ut}},setLocked:function(ut){D=ut},setClear:function(ut){ft!==ut&&(ht&&(ut=1-ut),s.clearDepth(ut),ft=ut)},reset:function(){D=!1,W=null,J=null,ft=null,ht=!1}}}function i(){let D=!1,ht=null,W=null,J=null,ft=null,ut=null,Vt=null,ue=null,Se=null;return{setTest:function(ie){D||(ie?rt(s.STENCIL_TEST):It(s.STENCIL_TEST))},setMask:function(ie){ht!==ie&&!D&&(s.stencilMask(ie),ht=ie)},setFunc:function(ie,Qe,un){(W!==ie||J!==Qe||ft!==un)&&(s.stencilFunc(ie,Qe,un),W=ie,J=Qe,ft=un)},setOp:function(ie,Qe,un){(ut!==ie||Vt!==Qe||ue!==un)&&(s.stencilOp(ie,Qe,un),ut=ie,Vt=Qe,ue=un)},setLocked:function(ie){D=ie},setClear:function(ie){Se!==ie&&(s.clearStencil(ie),Se=ie)},reset:function(){D=!1,ht=null,W=null,J=null,ft=null,ut=null,Vt=null,ue=null,Se=null}}}const r=new e,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,P=null,T=null,C=new mt(0,0,0),R=0,b=!1,M=null,
vendor: 6,867 bytes, line 3804
3804L=null,k=null,O=null,V=null;const Z=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,et=0;const G=s.getParameter(s.VERSION);G.indexOf("WebGL")!==-1?(et=parseFloat(/^WebGL (\d)/.exec(G)[1]),H=et>=1):G.indexOf("OpenGL ES")!==-1&&(et=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),H=et>=2);let ot=null,pt={};const Mt=s.getParameter(s.SCISSOR_BOX),Bt=s.getParameter(s.VIEWPORT),te=new Qt().fromArray(Mt),Y=new Qt().fromArray(Bt);function it(D,ht,W,J){const ft=new Uint8Array(4),ut=s.createTexture();s.bindTexture(D,ut),s.texParameteri(D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(D,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Vt=0;Vt<W;Vt++)D===s.TEXTURE_3D||D===s.TEXTURE_2D_ARRAY?s.texImage3D(ht,0,s.RGBA,1,1,J,0,s.RGBA,s.UNSIGNED_BYTE,ft):s.texImage2D(ht+Vt,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,ft);return ut}const St={};St[s.TEXTURE_2D]=it(s.TEXTURE_2D,s.TEXTURE_2D,1),St[s.TEXTURE_CUBE_MAP]=it(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),St[s.TEXTURE_2D_ARRAY]=it(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),St[s.TEXTURE_3D]=it(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),rt(s.DEPTH_TEST),a.setFunc($i),j(!1),xt(kl),rt(s.CULL_FACE),I(Vn);function rt(D){h[D]!==!0&&(s.enable(D),h[D]=!0)}function It(D){h[D]!==!1&&(s.disable(D),h[D]=!1)}function Ft(D,ht){return u[D]!==ht?(s.bindFramebuffer(D,ht),u[D]=ht,D===s.DRAW_FRAMEBUFFER&&(u[s.FRAMEBUFFER]=ht),D===s.FRAMEBUFFER&&(u[s.DRAW_FRAMEBUFFER]=ht),!0):!1}function Dt(D,ht){let W=f,J=!1;if(D){W=d.get(ht),W===void 0&&(W=[],d.set(ht,W));const ft=D.textures;if(W.length!==ft.length||W[0]!==s.COLOR_ATTACHMENT0){for(let ut=0,Vt=ft.length;ut<Vt;ut++)W[ut]=s.COLOR_ATTACHMENT0+ut;W.length=ft.length,J=!0}}else W[0]!==s.BACK&&(W[0]=s.BACK,J=!0);J&&s.drawBuffers(W)}function Jt(D){return m!==D?(s.useProgram(D),m=D,!0):!1}const K={[ci]:s.FUNC_ADD,[Pu]:s.FUNC_SUBTRACT,[Lu]:s.FUNC_REVERSE_SUBTRACT};K[Du]=s.MIN,K[Uu]=s.MAX;const nt={[Nu]:s.ZERO,[Fu]:s.ONE,[Ou]:s.SRC_COLOR,[so]:s.SRC_ALPHA,[Gu]:s.SRC_ALPHA_SATURATE,[Vu]:s.DST_COLOR,[zu]:s.DST_ALPHA,[Bu]:s.ONE_MINUS_SRC_COLOR,[ro]:s.ONE_MINUS_SRC_ALPHA,[Hu]:s.ONE_MINUS_DST_COLOR,[ku]:s.ONE_MINUS_DST_ALPHA,[Wu]:s.CONSTANT_COLOR,[Xu]:s.ONE_MINUS_CONSTANT_COLOR,[qu]:s.CONSTANT_ALPHA,[Yu]:s.ONE_MINUS_CONSTANT_ALPHA};function I(D,ht,W,J,ft,ut,Vt,ue,Se,ie){if(D===Vn){_===!0&&(It(s.BLEND),_=!1);return}if(_===!1&&(rt(s.BLEND),_=!0),D!==Iu){if(D!==g||ie!==b){if((p!==ci||x!==ci)&&(s.blendEquation(s.FUNC_ADD),p=ci,x=ci),ie)switch(D){case qi:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Vl:s.blendFunc(s.ONE,s.ONE);break;case Hl:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Gl:s.blendFuncSeparate(s.ZERO,s.SRC_COLOR,s.ZERO,s.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case qi:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Vl:s.blendFunc(s.SRC_ALPHA,s.ONE);break;case Hl:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Gl:s.blendFunc(s.ZERO,s.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}y=null,v=null,P=null,T=null,C.set(0,0,0),R=0,g=D,b=ie}return}ft=ft||ht,ut=ut||W,Vt=Vt||J,(ht!==p||ft!==x)&&(s.blendEquationSeparate(K[ht],K[ft]),p=ht,x=ft),(W!==y||J!==v||ut!==P||Vt!==T)&&(s.blendFuncSeparate(nt[W],nt[J],nt[ut],nt[Vt]),y=W,v=J,P=ut,T=Vt),(ue.equals(C)===!1||Se!==R)&&(s.blendColor(ue.r,ue.g,ue.b,Se),C.copy(ue),R=Se),g=D,b=!1}function Ct(D,ht){D.side===yn?It(s.CULL_FACE):rt(s.CULL_FACE);let W=D.side===Oe;ht&&(W=!W),j(W),D.blending===qi&&D.transparent===!1?I(Vn):I(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),r.setMask(D.colorWrite);const J=D.stencilWrite;o.setTest(J),J&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),Pt(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?rt(s.SAMPLE_ALPHA_TO_COVERAGE):It(s.SAMPLE_ALPHA_TO_COVERAGE)}function j(D){M!==D&&(D?s.frontFace(s.CW):s.frontFace(s.CCW),M=D)}function xt(D){D!==wu?(rt(s.CULL_FACE),D!==L&&(D===kl?s.cullFace(s.BACK):D===Cu?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):It(s.CULL_FACE),L=D}function at(D){D!==k&&(H&&s.lineWidth(D),k=D)}function Pt(D,ht,W){D?(rt(s.POLYGON_OFFSET_FILL),(O!==ht||V!==W)&&(s.polygonOffset(ht,W),O=ht,V=W)):It(s.POLYGON_OFFSET_FILL)}function gt(D){D?rt(s.SCISSOR_TEST):It(s.SCISSOR_TEST)}function A(D){D===void 0&&(D=s.TEXTURE0+Z-1),ot!==D&&(s.activeTexture(D),ot=D)}function S(D,ht,W){W===void 0&&(ot===null?W=s.TEXTURE0+Z-1:W=ot);let J=pt[W];J===void 0&&(J={type:void 0,texture:void 0},pt[W]=J),(J.type!==D||J.texture!==ht)&&(ot!==W&&(s.activeTexture(W),ot=W),s.bindTexture(D,ht||St[D]),J.type=D,J.texture=ht)}function F(){const D=pt[ot];D!==void 0&&D.type!==void 0&&(s.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function X(){try{s.compressedTexImage2D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Q(){try{s.compressedTexImage3D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function q(){try{s.texSubImage2D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Et(){try{s.texSubImage3D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ct(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function _t(){try{s.compressedTexSubImage3D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function qt(){try{s.texStorage2D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function tt(){try{s.texStorage3D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function vt(){try{s.texImage2D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Lt(){try{s.texImage3D.apply(s,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Nt(D){te.equals(D)===!1&&(s.scissor(D.x,D.y,D.z,D.w),te.copy(D))}function yt(D){Y.equals(D)===!1&&(s.viewport(D.x,D.y,D.z,D.w),Y.copy(D))}function Yt(D,ht){let W=c.get(ht);W===void 0&&(W=new WeakMap,c.set(ht,W));let J=W.get(D);J===void 0&&(J=s.getUniformBlockIndex(ht,D.name),W.set(D,J))}function Gt(D,ht){const J=c.get(ht).get(D);l.get(ht)!==J&&(s.uniformBlockBinding(ht,J,D.__bindingPointIndex),l.set(ht,J))}function ae(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor
vendor: 5,426 bytes, line 3804
3804(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),h={},ot=null,pt={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,P=null,T=null,C=new mt(0,0,0),R=0,b=!1,M=null,L=null,k=null,O=null,V=null,te.set(0,0,s.canvas.width,s.canvas.height),Y.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:rt,disable:It,bindFramebuffer:Ft,drawBuffers:Dt,useProgram:Jt,setBlending:I,setMaterial:Ct,setFlipSided:j,setCullFace:xt,setLineWidth:at,setPolygonOffset:Pt,setScissorTest:gt,activeTexture:A,bindTexture:S,unbindTexture:F,compressedTexImage2D:X,compressedTexImage3D:Q,texImage2D:vt,texImage3D:Lt,updateUBOMapping:Yt,uniformBlockBinding:Gt,texStorage2D:qt,texStorage3D:tt,texSubImage2D:q,texSubImage3D:Et,compressedTexSubImage2D:ct,compressedTexSubImage3D:_t,scissor:Nt,viewport:yt,reset:ae}}function D_(s,t){const e=s.image&&s.image.width?s.image.width/s.image.height:1;return e>t?(s.repeat.x=1,s.repeat.y=e/t,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=t/e,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function U_(s,t){const e=s.image&&s.image.width?s.image.width/s.image.height:1;return e>t?(s.repeat.x=t/e,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=e/t,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function N_(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function Ho(s,t,e,n){const i=F_(n);switch(e){case Uh:return s*t;case Fh:return s*t;case Oh:return s*t*2;case Qo:return s*t/i.components*i.byteLength;case ia:return s*t/i.components*i.byteLength;case Bh:return s*t*2/i.components*i.byteLength;case jo:return s*t*2/i.components*i.byteLength;case Nh:return s*t*3/i.components*i.byteLength;case Fe:return s*t*4/i.components*i.byteLength;case tl:return s*t*4/i.components*i.byteLength;case Ur:case Nr:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*8;case Fr:case Or:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case mo:case _o:return Math.max(s,16)*Math.max(t,8)/4;case po:case go:return Math.max(s,8)*Math.max(t,8)/2;case xo:case vo:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*8;case yo:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case Mo:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case So:return Math.floor((s+4)/5)*Math.floor((t+3)/4)*16;case bo:return Math.floor((s+4)/5)*Math.floor((t+4)/5)*16;case Eo:return Math.floor((s+5)/6)*Math.floor((t+4)/5)*16;case To:return Math.floor((s+5)/6)*Math.floor((t+5)/6)*16;case Ao:return Math.floor((s+7)/8)*Math.floor((t+4)/5)*16;case wo:return Math.floor((s+7)/8)*Math.floor((t+5)/6)*16;case Co:return Math.floor((s+7)/8)*Math.floor((t+7)/8)*16;case Ro:return Math.floor((s+9)/10)*Math.floor((t+4)/5)*16;case Io:return Math.floor((s+9)/10)*Math.floor((t+5)/6)*16;case Po:return Math.floor((s+9)/10)*Math.floor((t+7)/8)*16;case Lo:return Math.floor((s+9)/10)*Math.floor((t+9)/10)*16;case Do:return Math.floor((s+11)/12)*Math.floor((t+9)/10)*16;case Uo:return Math.floor((s+11)/12)*Math.floor((t+11)/12)*16;case Br:case No:case Fo:return Math.ceil(s/4)*Math.ceil(t/4)*16;case zh:case Oo:return Math.ceil(s/4)*Math.ceil(t/4)*8;case Bo:case zo:return Math.ceil(s/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function F_(s){switch(s){case wn:case Ph:return{byteLength:1,components:1};case Rs:case Lh:case Fs:return{byteLength:2,components:1};case $o:case Ko:return{byteLength:2,components:4};case Xn:case Jo:case Xe:return{byteLength:4,components:1};case Dh:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}const Nv={contain:D_,cover:U_,fill:N_,getByteLength:Ho};function O_(s,t,e,n,i,r,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new $,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(A,S){return f?new OffscreenCanvas(A,S):Is("canvas")}function _(A,S,F){let X=1;const Q=gt(A);if((Q.width>F||Q.height>F)&&(X=F/Math.max(Q.width,Q.height)),X<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const q=Math.floor(X*Q.width),Et=Math.floor(X*Q.height);u===void 0&&(u=m(q,Et));const ct=S?m(q,Et):u;return ct.width=q,ct.height=Et,ct.getContext("2d").drawImage(A,0,0,q,Et),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+q+"x"+Et+")."),ct}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),A;return A}function g(A){return A.generateMipmaps}function p(A){s.generateMipmap(A)}
vendor: 29,462 bytes, line 3804
3804function y(A){return A.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?s.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function v(A,S,F,X,Q=!1){if(A!==null){if(s[A]!==void 0)return s[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let q=S;if(S===s.RED&&(F===s.FLOAT&&(q=s.R32F),F===s.HALF_FLOAT&&(q=s.R16F),F===s.UNSIGNED_BYTE&&(q=s.R8)),S===s.RED_INTEGER&&(F===s.UNSIGNED_BYTE&&(q=s.R8UI),F===s.UNSIGNED_SHORT&&(q=s.R16UI),F===s.UNSIGNED_INT&&(q=s.R32UI),F===s.BYTE&&(q=s.R8I),F===s.SHORT&&(q=s.R16I),F===s.INT&&(q=s.R32I)),S===s.RG&&(F===s.FLOAT&&(q=s.RG32F),F===s.HALF_FLOAT&&(q=s.RG16F),F===s.UNSIGNED_BYTE&&(q=s.RG8)),S===s.RG_INTEGER&&(F===s.UNSIGNED_BYTE&&(q=s.RG8UI),F===s.UNSIGNED_SHORT&&(q=s.RG16UI),F===s.UNSIGNED_INT&&(q=s.RG32UI),F===s.BYTE&&(q=s.RG8I),F===s.SHORT&&(q=s.RG16I),F===s.INT&&(q=s.RG32I)),S===s.RGB_INTEGER&&(F===s.UNSIGNED_BYTE&&(q=s.RGB8UI),F===s.UNSIGNED_SHORT&&(q=s.RGB16UI),F===s.UNSIGNED_INT&&(q=s.RGB32UI),F===s.BYTE&&(q=s.RGB8I),F===s.SHORT&&(q=s.RGB16I),F===s.INT&&(q=s.RGB32I)),S===s.RGBA_INTEGER&&(F===s.UNSIGNED_BYTE&&(q=s.RGBA8UI),F===s.UNSIGNED_SHORT&&(q=s.RGBA16UI),F===s.UNSIGNED_INT&&(q=s.RGBA32UI),F===s.BYTE&&(q=s.RGBA8I),F===s.SHORT&&(q=s.RGBA16I),F===s.INT&&(q=s.RGBA32I)),S===s.RGB&&F===s.UNSIGNED_INT_5_9_9_9_REV&&(q=s.RGB9_E5),S===s.RGBA){const Et=Q?sa:Zt.getTransfer(X);F===s.FLOAT&&(q=s.RGBA32F),F===s.HALF_FLOAT&&(q=s.RGBA16F),F===s.UNSIGNED_BYTE&&(q=Et===se?s.SRGB8_ALPHA8:s.RGBA8),F===s.UNSIGNED_SHORT_4_4_4_4&&(q=s.RGBA4),F===s.UNSIGNED_SHORT_5_5_5_1&&(q=s.RGB5_A1)}return(q===s.R16F||q===s.R32F||q===s.RG16F||q===s.RG32F||q===s.RGBA16F||q===s.RGBA32F)&&t.get("EXT_color_buffer_float"),q}function x(A,S){let F;return A?S===null||S===Xn||S===Ki?F=s.DEPTH24_STENCIL8:S===Xe?F=s.DEPTH32F_STENCIL8:S===Rs&&(F=s.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===Xn||S===Ki?F=s.DEPTH_COMPONENT24:S===Xe?F=s.DEPTH_COMPONENT32F:S===Rs&&(F=s.DEPTH_COMPONENT16),F}function P(A,S){return g(A)===!0||A.isFramebufferTexture&&A.minFilter!==we&&A.minFilter!==Me?Math.log2(Math.max(S.width,S.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?S.mipmaps.length:1}function T(A){const S=A.target;S.removeEventListener("dispose",T),R(S),S.isVideoTexture&&h.delete(S)}function C(A){const S=A.target;S.removeEventListener("dispose",C),M(S)}function R(A){const S=n.get(A);if(S.__webglInit===void 0)return;const F=A.source,X=d.get(F);if(X){const Q=X[S.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&b(A),Object.keys(X).length===0&&d.delete(F)}n.remove(A)}function b(A){const S=n.get(A);s.deleteTexture(S.__webglTexture);const F=A.source,X=d.get(F);delete X[S.__cacheKey],a.memory.textures--}function M(A){const S=n.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),n.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(S.__webglFramebuffer[X]))for(let Q=0;Q<S.__webglFramebuffer[X].length;Q++)s.deleteFramebuffer(S.__webglFramebuffer[X][Q]);else s.deleteFramebuffer(S.__webglFramebuffer[X]);S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer[X])}else{if(Array.isArray(S.__webglFramebuffer))for(let X=0;X<S.__webglFramebuffer.length;X++)s.deleteFramebuffer(S.__webglFramebuffer[X]);else s.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&s.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let X=0;X<S.__webglColorRenderbuffer.length;X++)S.__webglColorRenderbuffer[X]&&s.deleteRenderbuffer(S.__webglColorRenderbuffer[X]);S.__webglDepthRenderbuffer&&s.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const F=A.textures;for(let X=0,Q=F.length;X<Q;X++){const q=n.get(F[X]);q.__webglTexture&&(s.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(F[X])}n.remove(A)}let L=0;function k(){L=0}function O(){const A=L;return A>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+i.maxTextures),L+=1,A}function V(A){const S=[];return S.push(A.wrapS),S.push(A.wrapT),S.push(A.wrapR||0),S.push(A.magFilter),S.push(A.minFilter),S.push(A.anisotropy),S.push(A.internalFormat),S.push(A.format),S.push(A.type),S.push(A.generateMipmaps),S.push(A.premultiplyAlpha),S.push(A.flipY),S.push(A.unpackAlignment),S.push(A.colorSpace),S.join()}function Z(A,S){const F=n.get(A);if(A.isVideoTexture&&at(A),A.isRenderTargetTexture===!1&&A.version>0&&F.__version!==A.version){const X=A.image;if(X===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Y(F,A,S);return}}e.bindTexture(s.TEXTURE_2D,F.__webglTexture,s.TEXTURE0+S)}function H(A,S){const F=n.get(A);if(A.version>0&&F.__version!==A.version){Y(F,A,S);return}e.bindTexture(s.TEXTURE_2D_ARRAY,F.__webglTexture,s.TEXTURE0+S)}function et(A,S){const F=n.get(A);if(A.version>0&&F.__version!==A.version){Y(F,A,S);return}e.bindTexture(s.TEXTURE_3D,F.__webglTexture,s.TEXTURE0+S)}function G(A,S){const F=n.get(A);if(A.version>0&&F.__version!==A.version){it(F,A,S);return}e.bindTexture(s.TEXTURE_CUBE_MAP,F.__webglTexture,s.TEXTURE0+S)}const ot={[Hr]:s.REPEAT,[sn]:s.CLAMP_TO_EDGE,[Gr]:s.MIRRORED_REPEAT},pt={[we]:s.NEAREST,[Ih]:s.NEAREST_MIPMAP_NEAREST,[Ms]:s.NEAREST_MIPMAP_LINEAR,[Me]:s.LINEAR,[Dr]:s.LINEAR_MIPMAP_NEAREST,[Sn]:s.LINEAR_MIPMAP_LINEAR},Mt={[hd]:s.NEVER,[gd]:s.ALWAYS,[ud]:s.LESS,[Vh]:s.LEQUAL,[dd]:s.EQUAL,[md]:s.GEQUAL,[fd]:s.GREATER,[pd]:s.NOTEQUAL};function Bt(A,S){if(S.type===Xe&&t.has("OES_texture_float_linear")===!1&&(S.magFilter===Me||S.magFilter===Dr||S.magFilter===Ms||S.magFilter===Sn||S.minFilter===Me||S.minFilter===Dr||S.minFilter===Ms||S.minFilter===Sn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(A,s.TEXTURE_WRAP_S,ot[S.wrapS]),s.texParameteri(A,s.TEXTURE_WRAP_T,ot[S.wrapT]),(A===s.TEXTURE_3D||A===s.TEXTURE_2D_ARRAY)&&s.texParameteri(A,s.TEXTURE_WRAP_R,ot[S.wrapR]),s.texParameteri(A,s.TEXTURE_MAG_FILTER,pt[S.magFilter]),s.texParameteri(A,s.TEXTURE_MIN_FILTER,pt[S.minFilter]),S.compareFunction&&(s.texParameteri(A,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(A,s.TEXTURE_COMPARE_FUNC,Mt[S.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===we||S.minFilter!==Ms&&S.minFilter!==Sn||S.type===Xe&&t.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const F=t.get("EXT_texture_filter_anisotropic");s.texParameterf(A,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function te(A,S){let F=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",T));const X=S.source;let Q=d.get(X);Q===void 0&&(Q={},d.set(X,Q));const q=V(S);if(q!==A.__cacheKey){Q[q]===void 0&&(Q[q]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,F=!0),Q[q].usedTimes++;const Et=Q[A.__cacheKey];Et!==void 0&&(Q[A.__cacheKey].usedTimes--,Et.usedTimes===0&&b(S)),A.__cacheKey=q,A.__webglTexture=Q[q].texture}return F}function Y(A,S,F){let X=s.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(X=s.TEXTURE_2D_ARRAY),S.isData3DTexture&&(X=s.TEXTURE_3D);const Q=te(A,S),q=S.source;e.bindTexture(X,A.__webglTexture,s.TEXTURE0+F);const Et=n.get(q);if(q.version!==Et.__version||Q===!0){e.activeTexture(s.TEXTURE0+F);const ct=Zt.getPrimaries(Zt.workingColorSpace),_t=S.colorSpace===zn?null:Zt.getPrimaries(S.colorSpace),qt=S.colorSpace===zn||ct===_t?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt);let tt=_(S.image,!1,i.maxTextureSize);tt=Pt(S,tt);const vt=r.convert(S.format,S.colorSpace),Lt=r.convert(S.type);let Nt=v(S.internalFormat,vt,Lt,S.colorSpace,S.isVideoTexture);Bt(X,S);let yt;const Yt=S.mipmaps,Gt=S.isVideoTexture!==!0,ae=Et.__version===void 0||Q===!0,D=q.dataReady,ht=P(S,tt);if(S.isDepthTexture)Nt=x(S.format===Qi,S.type),ae&&(Gt?e.texStorage2D(s.TEXTURE_2D,1,Nt,tt.width,tt.height):e.texImage2D(s.TEXTURE_2D,0,Nt,tt.width,tt.height,0,vt,Lt,null));else if(S.isDataTexture)if(Yt.length>0){Gt&&ae&&e.texStorage2D(s.TEXTURE_2D,ht,Nt,Yt[0].width,Yt[0].height);for(let W=0,J=Yt.length;W<J;W++)yt=Yt[W],Gt?D&&e.texSubImage2D(s.TEXTURE_2D,W,0,0,yt.width,yt.height,vt,Lt,yt.data):e.texImage2D(s.TEXTURE_2D,W,Nt,yt.width,yt.height,0,vt,Lt,yt.data);S.generateMipmaps=!1}else Gt?(ae&&e.texStorage2D(s.TEXTURE_2D,ht,Nt,tt.width,tt.height),D&&e.texSubImage2D(s.TEXTURE_2D,0,0,0,tt.width,tt.height,vt,Lt,tt.data)):e.texImage2D(s.TEXTURE_2D,0,Nt,tt.width,tt.height,0,vt,Lt,tt.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){Gt&&ae&&e.texStorage3D(s.TEXTURE_2D_ARRAY,ht,Nt,Yt[0].width,Yt[0].height,tt.depth);for(let W=0,J=Yt.length;W<J;W++)if(yt=Yt[W],S.format!==Fe)if(vt!==null)if(Gt){if(D)if(S.layerUpdates.size>0){const ft=Ho(yt.width,yt.height,S.format,S.type);for(const ut of S.layerUpdates){const Vt=yt.data.subarray(ut*ft/yt.data.BYTES_PER_ELEMENT,(ut+1)*ft/yt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,ut,yt.width,yt.height,1,vt,Vt)}S.clearLayerUpdates()}else e.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,0,yt.width,yt.height,tt.depth,vt,yt.data)}else e.compressedTexImage3D(s.TEXTURE_2D_ARRAY,W,Nt,yt.width,yt.height,tt.depth,0,yt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Gt?D&&e.texSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,0,yt.width,yt.height,tt.depth,vt,Lt,yt.data):e.texImage3D(s.TEXTURE_2D_ARRAY,W,Nt,yt.width,yt.height,tt.depth,0,vt,Lt,yt.data)}else{Gt&&ae&&e.texStorage2D(s.TEXTURE_2D,ht,Nt,Yt[0].width,Yt[0].height);for(let W=0,J=Yt.length;W<J;W++)yt=Yt[W],S.format!==Fe?vt!==null?Gt?D&&e.compressedTexSubImage2D(s.TEXTURE_2D,W,0,0,yt.width,yt.height,vt,yt.data):e.compressedTexImage2D(s.TEXTURE_2D,W,Nt,yt.width,yt.height,0,yt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Gt?D&&e.texSubImage2D(s.TEXTURE_2D,W,0,0,yt.width,yt.height,vt,Lt,yt.data):e.texImage2D(s.TEXTURE_2D,W,Nt,yt.width,yt.height,0,vt,Lt,yt.data)}else if(S.isDataArrayTexture)if(Gt){if(ae&&e.texStorage3D(s.TEXTURE_2D_ARRAY,ht,Nt,tt.width,tt.height,tt.depth),D)if(S.layerUpdates.size>0){const W=Ho(tt.width,tt.height,S.format,S.type);for(const J of S.layerUpdates){const ft=tt.data.subarray(J*W/tt.data.BYTES_PER_ELEMENT,(J+1)*W/tt.data.BYTES_PER_ELEMENT);e.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,J,tt.width,tt.height,1,vt,Lt,ft)}S.clearLayerUpdates()}else e.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,tt.width,tt.height,tt.depth,vt,Lt,tt.data)}else e.texImage3D(s.TEXTURE_2D_ARRAY,0,Nt,tt.width,tt.height,tt.depth,0,vt,Lt,tt.data);else if(S.isData3DTexture)Gt?(ae&&e.texStorage3D(s.TEXTURE_3D,ht,Nt,tt.width,tt.height,tt.depth),D&&e.texSubImage3D(s.TEXTURE_3D,0,0,0,0,tt.width,tt.height,tt.depth,vt,Lt,tt.data)):e.texImage3D(s.TEXTURE_3D,0,Nt,tt.width,tt.height,tt.depth,0,vt,Lt,tt.data);else if(S.isFramebufferTexture){if(ae)if(Gt)e.texStorage2D(s.TEXTURE_2D,ht,Nt,tt.width,tt.height);else{let W=tt.width,J=tt.height;for(let ft=0;ft<ht;ft++)e.texImage2D(s.TEXTURE_2D,ft,Nt,W,J,0,vt,Lt,null),W>>=1,J>>=1}}else if(Yt.length>0){if(Gt&&ae){const W=gt(Yt[0]);e.texStorage2D(s.TEXTURE_2D,ht,Nt,W.width,W.height)}for(let W=0,J=Yt.length;W<J;W++)yt=Yt[W],Gt?D&&e.texSubImage2D(s.TEXTURE_2D,W,0,0,vt,Lt,yt):e.texImage2D(s.TEXTURE_2D,W,Nt,vt,Lt,yt);S.generateMipmaps=!1}else if(Gt){if(ae){const W=gt(tt);e.texStorage2D(s.TEXTURE_2D,ht,Nt,W.width,W.height)}D&&e.texSubImage2D(s.TEXTURE_2D,0,0,0,vt,Lt,tt)}else e.texImage2D(s.TEXTURE_2D,0,Nt,vt,Lt,tt);g(S)&&p(X),Et.__version=q.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function it(A,S,F){if(S.image.length!==6)return;const X=te(A,S),Q=S.source;e.bindTexture(s.TEXTURE_CUBE_MAP,A.__webglTexture,s.TEXTURE0+F);const q=n.get(Q);if(Q.version!==q.__version||X===!0){e.activeTexture(s.TEXTURE0+F);const Et=Zt.getPrimaries(Zt.workingColorSpace),ct=S.colorSpace===zn?null:Zt.getPrimaries(S.colorSpace),_t=S.colorSpace===zn||Et===ct?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,_t);const qt=S.isCompressedTexture||S.image[0].isCompressedTexture,tt=S.image[0]&&S.image[0].isDataTexture,vt=[];for(let J=0;J<6;J++)!qt&&!tt?vt[J]=_(S.image[J],!0,i.maxCubemapSize):vt[J]=tt?S.image[J].image:S.image[J],vt[J]=Pt(S,vt[J]);const Lt=vt[0],Nt=r.convert(S.format,S.colorSpace),yt=r.convert(S.type),Yt=v(S.internalFormat,Nt,yt,S.colorSpace),Gt=S.isVideoTexture!==!0,ae=q.__version===void 0||X===!0,D=Q.dataReady;let ht=P(S,Lt);Bt(s.TEXTURE_CUBE_MAP,S);let W;if(qt){Gt&&ae&&e.texStorage2D(s.TEXTURE_CUBE_MAP,ht,Yt,Lt.width,Lt.height);for(let J=0;J<6;J++){W=vt[J].mipmaps;for(let ft=0;ft<W.length;ft++){const ut=W[ft];S.format!==Fe?Nt!==null?Gt?D&&e.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft,0,0,ut.width,ut.height,Nt,ut.data):e.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft,Yt,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Gt?D&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft,0,0,ut.width,ut.height,Nt,yt,ut.data):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft,Yt,ut.width,ut.height,0,Nt,yt,ut.data)}}}else{if(W=S.mipmaps,Gt&&ae){W.length>0&&ht++;const J=gt(vt[0]);e.texStorage2D(s.TEXTURE_CUBE_MAP,ht,Yt,J.width,J.height)}for(let J=0;J<6;J++)if(tt){Gt?D&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,vt[J].width,vt[J].height,Nt,yt,vt[J].data):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Yt,vt[J].width,vt[J].height,0,Nt,yt,vt[J].data);for(let ft=0;ft<W.length;ft++){const Vt=W[ft].image[J].image;Gt?D&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft+1,0,0,Vt.width,Vt.height,Nt,yt,Vt.data):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft+1,Yt,Vt.width,Vt.height,0,Nt,yt,Vt.data)}}else{Gt?D&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Nt,yt,vt[J]):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Yt,Nt,yt,vt[J]);for(let ft=0;ft<W.length;ft++){const ut=W[ft];Gt?D&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft+1,0,0,Nt,yt,ut.image[J]):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ft+1,Yt,Nt,yt,ut.image[J])}}}g(S)&&p(s.TEXTURE_CUBE_MAP),q.__version=Q.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function St(A,S,F,X,Q,q){const Et=r.convert(F.format,F.colorSpace),ct=r.convert(F.type),_t=v(F.internalFormat,Et,ct,F.colorSpace),qt=n.get(S),tt=n.get(F);if(tt.__renderTarget=S,!qt.__hasExternalTextures){const vt=Math.max(1,S.width>>q),Lt=Math.max(1,S.height>>q);Q===s.TEXTURE_3D||Q===s.TEXTURE_2D_ARRAY?e.texImage3D(Q,q,_t,vt,Lt,S.depth,0,Et,ct,null):e.texImage2D(Q,q,_t,vt,Lt,0,Et,ct,null)}e.bindFramebuffer(s.FRAMEBUFFER,A),xt(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,X,Q,tt.__webglTexture,0,j(S)):(Q===s.TEXTURE_2D||Q>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,X,Q,tt.__webglTexture,q),e.bindFramebuffer(s.FRAMEBUFFER,null)}function rt(A,S,F){if(s.bindRenderbuffer(s.RENDERBUFFER,A),S.depthBuffer){const X=S.depthTexture,Q=X&&X.isDepthTexture?X.type:null,q=x(S.stencilBuffer,Q),Et=S.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ct=j(S);xt(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ct,q,S.width,S.height):F?s.renderbufferStorageMultisample(s.RENDERBUFFER,ct,q,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,q,S.width,S.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,Et,s.RENDERBUFFER,A)}else{const X=S.textures;for(let Q=0;Q<X.length;Q++){const q=X[Q],Et=r.convert(q.format,q.colorSpace),ct=r.convert(q.type),_t=v(q.internalFormat,Et,ct,q.colorSpace),qt=j(S);F&&xt(S)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,qt,_t,S.width,S.height):xt(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,qt,_t,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,_t,S.width,S.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function It(A,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(s.FRAMEBUFFER,A),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const X=n.get(S.depthTexture);X.__renderTarget=S,(!X.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),Z(S.depthTexture,0);const Q=X.__webglTexture,q=j(S);if(S.depthTexture.format===Yi)xt(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,Q,0,q):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,Q,0);else if(S.depthTexture.format===Qi)xt(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,Q,0,q):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,Q,0);else throw new Error("Unknown depthTexture format")}function Ft(A){const S=n.get(A),F=A.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==A.depthTexture){const X=A.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),X){const Q=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,X.removeEventListener("dispose",Q)};X.addEventListener("dispose",Q),S.__depthDisposeCallback=Q}S.__boundDepthTexture=X}if(A.depthTexture&&!S.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");It(S.__webglFramebuffer,A)}else if(F){S.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(e.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer[X]),S.__webglDepthbuffer[X]===void 0)S.__webglDepthbuffer[X]=s.createRenderbuffer(),rt(S.__webglDepthbuffer[X],A,!1);else{const Q=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,q=S.__webglDepthbuffer[X];s.bindRenderbuffer(s.RENDERBUFFER,q),s.framebufferRenderbuffer(s.FRAMEBUFFER,Q,s.RENDERBUFFER,q)}}else if(e.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=s.createRenderbuffer(),rt(S.__webglDepthbuffer,A,!1);else{const X=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Q=S.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Q),s.framebufferRenderbuffer(s.FRAMEBUFFER,X,s.RENDERBUFFER,Q)}e.bindFramebuffer(s.FRAMEBUFFER,null)}function Dt(A,S,F){const X=n.get(A);S!==void 0&&St(X.__webglFramebuffer,A,A.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),F!==void 0&&Ft(A)}function Jt(A){const S=A.texture,F=n.get(A),X=n.get(S);A.addEventListener("dispose",C);const Q=A.textures,q=A.isWebGLCubeRenderTarget===!0,Et=Q.length>1;if(Et||(X.__webglTexture===void 0&&(X.__webglTexture=s.createTexture()),X.__version=S.version,a.memory.textures++),q){F.__webglFramebuffer=[];for(let ct=0;ct<6;ct++)if(S.mipmaps&&S.mipmaps.length>0){F.__webglFramebuffer[ct]=[];for(let _t=0;_t<S.mipmaps.length;_t++)F.__webglFramebuffer[ct][_t]=s.createFramebuffer()}else F.__webglFramebuffer[ct]=s.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){F.__webglFramebuffer=[];for(let ct=0;ct<S.mipmaps.length;ct++)F.__webglFramebuffer[ct]=s.createFramebuffer()}else F.__webglFramebuffer=s.createFramebuffer();if(Et)for(let ct=0,_t=Q.length;ct<_t;ct++){const qt=n.get(Q[ct]);qt.__webglTexture===void 0&&(qt.__webglTexture=s.createTexture(),a.memory.textures++)}if(A.samples>0&&xt(A)===!1){F.__webglMultisampledFramebuffer=s.createFramebuffer(),F.__webglColorRenderbuffer=[],e.bindFramebuffer(s.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let ct=0;ct<Q.length;ct++){const _t=Q[ct];F.__webglColorRenderbuffer[ct]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,F.__webglColorRenderbuffer[ct]);const qt=r.convert(_t.format,_t.colorSpace),tt=r.convert(_t.type),vt=v(_t.internalFormat,qt,tt,_t.colorSpace,A.isXRRenderTarget===!0),Lt=j(A);s.renderbufferStorageMultisample(s.RENDERBUFFER,Lt,vt,A.width,A.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ct,s.RENDERBUFFER,F.__webglColorRenderbuffer[ct])}s.bindRenderbuffer(s.RENDERBUFFER,null),A.depthBuffer&&(F.__webglDepthRenderbuffer=s.createRenderbuffer(),rt(F.__webglDepthRenderbuffer,A,!0)),e.bindFramebuffer(s.FRAMEBUFFER,null)}}if(q){e.bindTexture(s.TEXTURE_CUBE_MAP,X.__webglTexture),Bt(s.TEXTURE_CUBE_MAP,S);for(let ct=0;ct<6;ct++)if(S.mipmaps&&S.mipmaps.length>0)for(let _t=0;_t<S.mipmaps.length;_t++)St(F.__webglFramebuffer[ct][_t],A,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ct,_t);else St(F.__webglFramebuffer[ct],A,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0);g(S)&&p(s.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Et){for(let ct=0,_t=Q.length;ct<_t;ct++){const qt=Q[ct],tt=n.get(qt);e.bindTexture(s.TEXTURE_2D,tt.__webglTexture),Bt(s.TEXTURE_2D,qt),St(F.__webglFramebuffer,A,qt,s.COLOR_ATTACHMENT0+ct,s.TEXTURE_2D,0),g(qt)&&p(s.TEXTURE_2D)}e.unbindTexture()}else{let ct=s.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(ct=A.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),e.bindTexture(ct,X.__webglTexture),Bt(ct,S),S.mipmaps&&S.mipmaps.length>0)for(let _t=0;_t<S.mipmaps.length;_t++)St(F.__webglFramebuffer[_t],A,S,s.COLOR_ATTACHMENT0,ct,_t);else St(F.__webglFramebuffer,A,S,s.COLOR_ATTACHMENT0,ct,0);g(S)&&p(ct),e.unbindTexture()}A.depthBuffer&&Ft(A)}function K(A){const S=A.textures;for(let F=0,X=S.length;F<X;F++){const Q=S[F];if(g(Q)){const q=y(A),Et=n.get(Q).__webglTexture;e.bindTexture(q,Et),p(q),e.unbindTexture()}}}const nt=[],I=[];function Ct(A){if(A.samples>0){if(xt(A)===!1){const S=A.textures,F=A.width,X=A.height;let Q=s.COLOR_BUFFER_BIT;const q=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Et=n.get(A),ct=S.length>1;if(ct)for(let _t=0;_t<S.length;_t++)e.bindFramebuffer(s.FRAMEBUFFER,Et.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+_t,s.RENDERBUFFER,null),e.bindFramebuffer(s.FRAMEBUFFER,Et.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+_t,s.TEXTURE_2D,null,0);e.bindFramebuffer(s.READ_FRAMEBUFFER,Et.__webglMultisampledFramebuffer),e.bindFramebuffer(s.DRAW_FRAMEBUFFER,Et.__webglFramebuffer);for(let _t=0;_t<S.length;_t++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(Q|=s.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(Q|=s.STENCIL_BUFFER_BIT)),ct){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,Et.__webglColorRenderbuffer[_t]);const qt=n.get(S[_t]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,qt,0)}s.blitFramebuffer(0,0,F,X,0,0,F,X,Q,s.NEAREST),l===!0&&(nt.length=0,I.length=0,nt.push(s.COLOR_ATTACHMENT0+_t),A.depthBuffer&&A.resolveDepthBuffer===!1&&(nt.push(q),I.push(q),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,I)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,nt))}if(e.bindFramebuffer(s.READ_FRAMEBUFFER,null),e.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),ct)for(let _t=0;_t<S.length;_t++){e.bindFramebuffer(s.FRAMEBUFFER,Et.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+_t,s.RENDERBUFFER,Et.__webglColorRenderbuffer[_t]);const qt=n.get(S[_t]).__webglTexture;e.bindFramebuffer(s.FRAMEBUFFER,Et.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+_t,s.TEXTURE_2D,qt,0)}e.bindFramebuffer(s.DRAW_FRAMEBUFFER,Et.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&l){const S=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[S])}}}function j(A){return Math.min(i.maxSamples,A.samples)}function xt(A){const S=n.get(A);return A.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function at(A){const S=a.render.frame;h.get(A)!==S&&(h.set(A,S),A.update())}function Pt(A,S){const F=A.colorSpace,X=A.format,Q=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||F!==ns&&F!==zn&&(Zt.getTransfer(F)===se?(X!==Fe||Q!==wn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),S}function gt(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=k,this.setTexture2D=Z,this.setTexture2DArray=H,this.setTexture3D=et,this.setTextureCube=G,this.rebindTextures=Dt,this.setupRenderTarget=Jt,this.updateRenderTargetMipmap=K,this.updateMultisampleRenderTarget=Ct,this.setupDepthRenderbuffer=Ft,this.setupFrameBufferTexture=St,this.useMultisampledRTT=xt}function B_(s,t){function e(n,i=zn){let r;const a=Zt.getTransfer(i);if(n===wn)return s.UNSIGNED_BYTE;if(n===$o)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Ko)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Dh)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Ph)return s.BYTE;if(n===Lh)return s.SHORT;if(n===Rs)return s.UNSIGNED_SHORT;if(n===Jo)return s.INT;if(n===Xn)return s.UNSIGNED_INT;if(n===Xe)return s.FLOAT;if(n===Fs)return s.HALF_FLOAT;if(n===Uh)return s.ALPHA;if(n===Nh)return s.RGB;if(n===Fe)return s.RGBA;if(n===Fh)return s.LUMINANCE;if(n===Oh)return s.LUMINANCE_ALPHA;if(n===Yi)return s.DEPTH_COMPONENT;if(n===Qi)return s.DEPTH_STENCIL;if(n===Qo)return s.RED;if(n===ia)return s.RED_INTEGER;if(n===Bh)return s.RG;if(n===jo)return s.RG_INTEGER;if(n===tl)return s.RGBA_INTEGER;if(n===Ur||n===Nr||n===Fr||n===Or)if(a===se)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Ur)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Nr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Fr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Or)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Ur)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Nr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Fr)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Or)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===po||n===mo||n===go||n===_o)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===po)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===mo)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===go)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===_o)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===xo||n===vo||n===yo)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===xo||n===vo)return a===se?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===yo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Mo||n===So||n===bo||n===Eo||n===To||n===Ao||n===wo||n===Co||n===Ro||n===Io||n===Po||n===Lo||n===Do||n===Uo)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Mo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===So)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===bo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Eo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===To)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ao)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===wo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Co)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ro)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Io)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Po)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Lo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Do)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Uo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Br||n===No||n===Fo)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===Br)return a===se?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===No)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Fo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===zh||n===Oo||n===Bo||n===zo)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===Br)return r.COMPRESSED_RED_RGT
vendor: 11,646 bytes, lines 3804-3828
3804C1_EXT;if(n===Oo)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Bo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===zo)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ki?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:e}}class z_ extends Ae{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Ts extends jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const k_={type:"move"};class Ha{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new w,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new w),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new w,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new w),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const g=e.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=e.getPose(t.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(k_)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new Ts;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const V_=` 3805void main() { 3806 3807 gl_Position = vec4( position, 1.0 ); 3808 3809}`,H_=` 3810uniform sampler2DArray depthColor; 3811uniform float depthWidth; 3812uniform float depthHeight; 3813 3814void main() { 3815 3816 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3817 3818 if ( coord.x >= 1.0 ) { 3819 3820 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3821 3822 } else { 3823 3824 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3825 3826 } 3827 3828}`;class G_{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const i=new me,r=t.properties.get(i);r.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new ln({vertexShader:V_,fragmentShader:H_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new _e(new Bs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class W_ extends Cn{constructor(t,e){super();const n=this;let i=null,r=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=new G_,g=e.getContextAttributes();let p=null,y=null;const v=[],x=[],P=new $;let T=null;const C=new Ae;C.viewport=new Qt;const R=new Ae;R.viewport=new Qt;const b=[C,R],M=new z_;let L=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let it=v[Y];return it===void 0&&(it=new Ha,v[Y]=it),it.getTargetRaySpace()},this.getControllerGrip=function(Y){let it=v[Y];return it===void 0&&(it=new Ha,v[Y]=it),it.getGripSpace()},this.getHand=function(Y){let it=v[Y];return it===void 0&&(it=new Ha,v[Y]=it),it.getHandSpace()};function O(Y){const it=x.indexOf(Y.inputSource);if(it===-1)return;const St=v[it];St!==void 0&&(St.update(Y.inputSource,Y.frame,c||a),St.dispatchEvent({type:Y.type,data:Y.inputSource}))}function V(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",Z);for(let Y=0;Y<v.length;Y++){const it=x[Y];it!==null&&(x[Y]=null,v[Y].disconnect(it))}L=null,k=null,_.reset(),t.setRenderTarget(p),f=null,d=null,u=null,i=null,y=null,te.stop(),n.isPresenting=!1,t.setPixelRatio(T),t.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(p=t.getRenderTarget(),i.addEventListener("select",O),i.addEventListener("selectstart",O),i.addEventListener("selectend",O),i.addEventListener("squeeze",O),i.addEventListener("squeezestart",O),i.addEventListener("squeezeend",O),i.addEventListener("end",V),i.addEventListener("inputsourceschange",Z),g.xrCompatible!==!0&&await e.makeXRCompatible(),T=t.getPixelRatio(),t.getSize(P),i.renderState.layers===void 0){const it={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,e,it),i.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new on(f.framebufferWidth,f.framebufferHeight,{format:Fe,type:wn,colorSpace:t.outputColorSpace,stencilBuffer:g.stencil})}else{let it=null,St=null,rt=null;g.depth&&(rt=g.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,it=g.stencil?Qi:Yi,St=g.stencil?Ki:Xn);const It={colorFormat:e.RGBA8,depthFormat:rt,scaleFactor:r};u=new XRWebGLBinding(i,e),d=u.createProjectionLayer(It),i.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),y=new on(d.textureWidth,d.textureHeight,{format:Fe,type:wn,depthTexture:new Jh(d.textureWidth,d.textureHeight,St,void 0,void 0,void 0,void 0,void 0,void 0,it),stencilBuffer:g.stencil,colorSpace:t.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),te.setContext(i),te.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function Z(Y){for(let it=0;it<Y.removed.length;it++){const St=Y.removed[it],rt=x.indexOf(St);rt>=0&&(x[rt]=null,v[rt].disconnect(St))}for(let it=0;it<Y.added.length;it++){const St=Y.added[it];let rt=x.indexOf(St);if(rt===-1){for(let Ft=0;Ft<v.length;Ft++)if(Ft>=x.length){x.push(St),rt=Ft;break}else if(x[Ft]===null){x[Ft]=St,rt=Ft;break}if(rt===-1)break}const It=v[rt];It&&It.connect(St)}}const H=new w,et=new w;function G(Y,it,St){H.setFromMatrixPosition(it.matrixWorld),et.setFromMatrixPosition(St.matrixWorld);const rt=H.distanceTo(et),It=it.projectionMatrix.elements,Ft=St.projectionMatrix.elements,Dt=It[14]/(It[10]-1),Jt=It[14]/(It[10]+1),K=(It[9]+1)/It[5],nt=(It[9]-1)/It[5],I=(It[8]-1)/It[0],Ct=(Ft[8]+1)/Ft[0],j=Dt*I,xt=Dt*Ct,at=rt/(-I+Ct),Pt=at*-I;if(it.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Pt),Y.translateZ(at),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),It[10]===-1)Y.projectionMatrix.copy(it.projectionMatrix),Y.projectionMatrixInverse.copy(it.projectionMatrixInverse);else{const gt=Dt+at,A=Jt+at,S=j-Pt,F=xt+(rt-Pt),X=K*Jt/A*gt,Q=nt*Jt/A*gt;Y.projectionMatrix.makePerspective(S,F,X,Q,gt,A),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function ot(Y,it){it===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(it.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let it=Y.near,St=Y.far;_.texture!==null&&(_.depthNear>0&&(it=_.depthNear),_.depthFar>0&&(St=_.depthFar)),M.near=R.near=C.near=it,M.far=R.far=C.far=St,(L!==M.near||k!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,k=M.far),C.layers.mask=Y.layers.mask|2,R.layers.mask=Y.layers.mask|4,M.layers.mask=C.layers.mask|R.layers.mask;const rt=Y.parent,It=M.cameras;ot(M,rt);for(let Ft=0;Ft<It.length;Ft++)ot(It[Ft],rt);It.length===2?G(M,C,R):M.projectionMatrix.copy(C.projectionMatrix),pt(Y,M,rt)};function pt(Y,it,St){St===null?Y.matrix.copy(it.matrixWorld):(Y.matrix.copy(St.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(it.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(it.projectionMatrix),Y.projectionMatrixInverse.copy(it.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ji*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(M)};let Mt=null;function Bt(Y,it){if(h=it.getViewerPose(c||a),m=it,h!==null){const St=h.views;f!==null&&(t.setRenderTargetFramebuffer(y,f.framebuffer),t.setRenderTarget(y));let rt=!1;St.length!==M.cameras.length&&(M.cameras.length=0,rt=!0);for(let Ft=0;Ft<St.length;
vendor: 41,443 bytes, line 3828
3828Ft++){const Dt=St[Ft];let Jt=null;if(f!==null)Jt=f.getViewport(Dt);else{const nt=u.getViewSubImage(d,Dt);Jt=nt.viewport,Ft===0&&(t.setRenderTargetTextures(y,nt.colorTexture,d.ignoreDepthValues?void 0:nt.depthStencilTexture),t.setRenderTarget(y))}let K=b[Ft];K===void 0&&(K=new Ae,K.layers.enable(Ft),K.viewport=new Qt,b[Ft]=K),K.matrix.fromArray(Dt.transform.matrix),K.matrix.decompose(K.position,K.quaternion,K.scale),K.projectionMatrix.fromArray(Dt.projectionMatrix),K.projectionMatrixInverse.copy(K.projectionMatrix).invert(),K.viewport.set(Jt.x,Jt.y,Jt.width,Jt.height),Ft===0&&(M.matrix.copy(K.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),rt===!0&&M.cameras.push(K)}const It=i.enabledFeatures;if(It&&It.includes("depth-sensing")){const Ft=u.getDepthInformation(St[0]);Ft&&Ft.isValid&&Ft.texture&&_.init(t,Ft,i.renderState)}}for(let St=0;St<v.length;St++){const rt=x[St],It=v[St];rt!==null&&It!==void 0&&It.update(rt,it,c||a)}Mt&&Mt(Y,it),it.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:it}),m=null}const te=new Zh;te.setAnimationLoop(Bt),this.setAnimationLoop=function(Y){Mt=Y},this.dispose=function(){}}}const jn=new Ke,X_=new Ut;function q_(s,t){function e(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,Yh(s)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,y,v,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(g,p):p.isMeshToonMaterial?(r(g,p),u(g,p)):p.isMeshPhongMaterial?(r(g,p),h(g,p)):p.isMeshStandardMaterial?(r(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,x)):p.isMeshMatcapMaterial?(r(g,p),m(g,p)):p.isMeshDepthMaterial?r(g,p):p.isMeshDistanceMaterial?(r(g,p),_(g,p)):p.isMeshNormalMaterial?r(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,y,v):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,e(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Oe&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,e(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Oe&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,e(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,e(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const y=t.get(p),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,jn.copy(x),jn.x*=-1,jn.y*=-1,jn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(jn.y*=-1,jn.z*=-1),g.envMapRotation.value.setFromMatrix4(X_.makeRotationFromEuler(jn)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,v){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=v*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Oe&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Y_(s,t,e,n){let i={},r={},a=[];const o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(m(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const P=v.program;n.updateUBOMapping(y,P);const T=t.render.frame;r[y.id]!==T&&(d(y),r[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=s.createBuffer(),P=y.__size,T=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,x),s.bufferData(s.UNIFORM_BUFFER,P,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const v=i[y.id],x=y.uniforms,P=y.__cache;s.bindBuffer(s.UNIFORM_BUFFER,v);for(let T=0,C=x.length;T<C;T++){const R=Array.isArray(x[T])?x[T]:[x[T]];for(let b=0,M=R.length;b<M;b++){const L=R[b];if(f(L,T,b,P)===!0){const k=L.__offset,O=Array.isArray(L.value)?L.value:[L.value];let V=0;for(let Z=0;Z<O.length;Z++){const H=O[Z],et=_(H);typeof H=="number"||typeof H=="boolean"?(L.__data[0]=H,s.bufferSubData(s.UNIFORM_BUFFER,k+V,L.__data)):H.isMatrix3?(L.__data[0]=H.elements[0],L.__data[1]=H.elements[1],L.__data[2]=H.elements[2],L.__data[3]=0,L.__data[4]=H.elements[3],L.__data[5]=H.elements[4],L.__data[6]=H.elements[5],L.__data[7]=0,L.__data[8]=H.elements[6],L.__data[9]=H.elements[7],L.__data[10]=H.elements[8],L.__data[11]=0):(H.toArray(L.__data,V),V+=et.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,k,L.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(y,v,x,P){const T=y.value,C=v+"_"+x;if(P[C]===void 0)return typeof T=="number"||typeof T=="boolean"?P[C]=T:P[C]=T.clone(),!0;{const R=P[C];if(typeof T=="number"||typeof T=="boolean"){if(R!==T)return P[C]=T,!0}else if(R.equals(T)===!1)return R.copy(T),!0}return!1}function m(y){const v=y.uniforms;let x=0;const P=16;for(let C=0,R=v.length;C<R;C++){const b=Array.isArray(v[C])?v[C]:[v[C]];for(let M=0,L=b.length;M<L;M++){const k=b[M],O=Array.isArray(k.value)?k.value:[k.value];for(let V=0,Z=O.length;V<Z;V++){const H=O[V],et=_(H),G=x%P,ot=G%et.boundary,pt=G+ot;x+=ot,pt!==0&&P-pt<et.storage&&(x+=P-pt),k.__data=new Float32Array(et.storage/Float32Array.BYTES_PER_ELEMENT),k.__offset=x,x+=et.storage}}}const T=x%P;return T>0&&(x+=P-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),s.deleteBuffer(i[v.id]),delete i[v.id],delete r[v.id]}function p(){for(const y in i)s.deleteBuffer(i[y]);a=[],i={},r={}}return{bind:l,update:c,dispose:p}}class Fv{constructor(t={}){const{canvas:e=Ud(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const y=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ge,this.toneMapping=Hn,this.toneMappingExposure=1;const x=this;let P=!1,T=0,C=0,R=null,b=-1,M=null;const L=new Qt,k=new Qt;let O=null;const V=new mt(0);let Z=0,H=e.width,et=e.height,G=1,ot=null,pt=null;const Mt=new Qt(0,0,H,et),Bt=new Qt(0,0,H,et);let te=!1;const Y=new aa;let it=!1,St=!1;const rt=new Ut,It=new Ut,Ft=new w,Dt=new Qt,Jt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let K=!1;function nt(){return R===null?G:1}let I=n;function Ct(E,U){return e.getContext(E,U)}try{const E={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r170"),e.addEventListener("webglcontextlost",J,!1),e.addEventListener("webglcontextrestored",ft,!1),e.addEventListener("webglcontextcreationerror",ut,!1),I===null){const U="webgl2";if(I=Ct(U,E),I===null)throw Ct(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let j,xt,at,Pt,gt,A,S,F,X,Q,q,Et,ct,_t,qt,tt,vt,Lt,Nt,yt,Yt,Gt,ae,D;function ht(){j=new Qm(I),j.init(),Gt=new B_(I,j),xt=new qm(I,j,t,Gt),at=new L_(I,j),xt.reverseDepthBuffer&&d&&at.buffers.depth.setReversed(!0),Pt=new eg(I),gt=new v_,A=new O_(I,j,at,gt,xt,Gt,Pt),S=new Zm(x),F=new Km(x),X=new lf(I),ae=new Wm(I,X),Q=new jm(I,X,Pt,ae),q=new ig(I,Q,X,Pt),Nt=new ng(I,xt,A),tt=new Ym(gt),Et=new x_(x,S,F,j,xt,ae,tt),ct=new q_(x,gt),_t=new M_,qt=new w_(j),Lt=new Gm(x,S,F,at,q,f,l),vt=new I_(x,q,xt),D=new Y_(I,Pt,xt,at),yt=new Xm(I,j,Pt),Yt=new tg(I,j,Pt),Pt.programs=Et.programs,x.capabilities=xt,x.extensions=j,x.properties=gt,x.renderLists=_t,x.shadowMap=vt,x.state=at,x.info=Pt}ht();const W=new W_(x,I);this.xr=W,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){const E=j.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=j.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(E){E!==void 0&&(G=E,this.setSize(H,et,!1))},this.getSize=function(E){return E.set(H,et)},this.setSize=function(E,U,B=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=E,et=U,e.width=Math.floor(E*G),e.height=Math.floor(U*G),B===!0&&(e.style.width=E+"px",e.style.height=U+"px"),this.setViewport(0,0,E,U)},this.getDrawingBufferSize=function(E){return E.set(H*G,et*G).floor()},this.setDrawingBufferSize=function(E,U,B){H=E,et=U,G=B,e.width=Math.floor(E*B),e.height=Math.floor(U*B),this.setViewport(0,0,E,U)},this.getCurrentViewport=function(E){return E.copy(L)},this.getViewport=function(E){return E.copy(Mt)},this.setViewport=function(E,U,B,z){E.isVector4?Mt.set(E.x,E.y,E.z,E.w):Mt.set(E,U,B,z),at.viewport(L.copy(Mt).multiplyScalar(G).round())},this.getScissor=function(E){return E.copy(Bt)},this.setScissor=function(E,U,B,z){E.isVector4?Bt.set(E.x,E.y,E.z,E.w):Bt.set(E,U,B,z),at.scissor(k.copy(Bt).multiplyScalar(G).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(E){at.setScissorTest(te=E)},this.setOpaqueSort=function(E){ot=E},this.setTransparentSort=function(E){pt=E},this.getClearColor=function(E){return E.copy(Lt.getClearColor())},this.setClearColor=function(){Lt.setClearColor.apply(Lt,arguments)},this.getClearAlpha=function(){return Lt.getClearAlpha()},this.setClearAlpha=function(){Lt.setClearAlpha.apply(Lt,arguments)},this.clear=function(E=!0,U=!0,B=!0){let z=0;if(E){let N=!1;if(R!==null){const st=R.texture.format;N=st===tl||st===jo||st===ia}if(N){const st=R.texture.type,dt=st===wn||st===Xn||st===Rs||st===Ki||st===$o||st===Ko,Tt=Lt.getClearColor(),At=Lt.getClearAlpha(),Ot=Tt.r,Ht=Tt.g,wt=Tt.b;dt?(m[0]=Ot,m[1]=Ht,m[2]=wt,m[3]=At,I.clearBufferuiv(I.COLOR,0,m)):(_[0]=Ot,_[1]=Ht,_[2]=wt,_[3]=At,I.clearBufferiv(I.COLOR,0,_))}else z|=I.COLOR_BUFFER_BIT}U&&(z|=I.DEPTH_BUFFER_BIT),B&&(z|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(z)},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(){e.removeEventListener("webglcontextlost",J,!1),e.removeEventListener("webglcontextrestored",ft,!1),e.removeEventListener("webglcontextcreationerror",ut,!1),_t.dispose(),qt.dispose(),gt.dispose(),S.dispose(),F.dispose(),q.dispose(),ae.dispose(),D.dispose(),Et.dispose(),W.dispose(),W.removeEventListener("sessionstart",Ll),W.removeEventListener("sessionend",Dl),Yn.stop()};function J(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function ft(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const E=Pt.autoReset,U=vt.enabled,B=vt.autoUpdate,z=vt.needsUpdate,N=vt.type;ht(),Pt.autoReset=E,vt.enabled=U,vt.autoUpdate=B,vt.needsUpdate=z,vt.type=N}function ut(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Vt(E){const U=E.target;U.removeEventListener("dispose",Vt),ue(U)}function ue(E){Se(E),gt.remove(E)}function Se(E){const U=gt.get(E).programs;U!==void 0&&(U.forEach(function(B){Et.releaseProgram(B)}),E.isShaderMaterial&&Et.releaseShaderCache(E))}this.renderBufferDirect=function(E,U,B,z,N,st){U===null&&(U=Jt);const dt=N.isMesh&&N.matrixWorld.determinant()<0,Tt=Eu(E,U,B,z,N);at.setMaterial(z,dt);let At=B.index,Ot=1;if(z.wireframe===!0){if(At=Q.getWireframeAttribute(B),At===void 0)return;Ot=2}const Ht=B.drawRange,wt=B.attributes.position;let $t=Ht.start*Ot,oe=(Ht.start+Ht.count)*Ot;st!==null&&($t=Math.max($t,st.start*Ot),oe=Math.min(oe,(st.start+st.count)*Ot)),At!==null?($t=Math.max($t,0),oe=Math.min(oe,At.count)):wt!=null&&($t=Math.max($t,0),oe=Math.min(oe,wt.count));const le=oe-$t;if(le<0||le===1/0)return;ae.setup(N,z,Tt,B,At);let De,ee=yt;if(At!==null&&(De=X.get(At),ee=Yt,ee.setIndex(De)),N.isMesh)z.wireframe===!0?(at.setLineWidth(z.wireframeLinewidth*nt()),ee.setMode(I.LINES)):ee.setMode(I.TRIANGLES);else if(N.isLine){let Rt=z.linewidth;Rt===void 0&&(Rt=1),at.setLineWidth(Rt*nt()),N.isLineSegments?ee.setMode(I.LINES):N.isLineLoop?ee.setMode(I.LINE_LOOP):ee.setMode(I.LINE_STRIP)}else N.isPoints?ee.setMode(I.POINTS):N.isSprite&&ee.setMode(I.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)ee.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))ee.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Rt=N._multiDrawStarts,dn=N._multiDrawCounts,ne=N._multiDrawCount,je=At?X.get(At).bytesPerElement:1,yi=gt.get(z).currentProgram.getUniforms();for(let ke=0;ke<ne;ke++)yi.setValue(I,"_gl_DrawID",ke),ee.render(Rt[ke]/je,dn[ke])}else if(N.isInstancedMesh)ee.renderInstances($t,le,N.count);else if(B.isInstancedBufferGeometry){const Rt=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,dn=Math.min(B.instanceCount,Rt);ee.renderInstances($t,le,dn)}else ee.render($t,le)};function ie(E,U,B){E.transparent===!0&&E.side===yn&&E.forceSinglePass===!1?(E.side=Oe,E.needsUpdate=!0,Vs(E,U,B),E.side=Gn,E.needsUpdate=!0,Vs(E,U,B),E.side=yn):Vs(E,U,B)}this.compile=function(E,U,B=null){B===null&&(B=E),p=qt.get(B),p.init(U),v.push(p),B.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),E!==B&&E.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),p.setupLights();const z=new Set;return E.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const st=N.material;if(st)if(Array.isArray(st))for(let dt=0;dt<st.length;dt++){const Tt=st[dt];ie(Tt,B,N),z.add(Tt)}else ie(st,B,N),z.add(st)}),v.pop(),p=null,z},this.compileAsync=function(E,U,B=null){const z=this.compile(E,U,B);return new Promise(N=>{function st(){if(z.forEach(function(dt){gt.get(dt).currentProgram.isReady()&&z.delete(dt)}),z.size===0){N(E);return}setTimeout(st,10)}j.get("KHR_parallel_shader_compile")!==null?st():setTimeout(st,10)})};let Qe=null;function un(E){Qe&&Qe(E)}function Ll(){Yn.stop()}function Dl(){Yn.start()}const Yn=new Zh;Yn.setAnimationLoop(un),typeof self<"u"&&Yn.setContext(self),this.setAnimationLoop=function(E){Qe=E,W.setAnimationLoop(E),E===null?Yn.stop():Yn.start()},W.addEventListener("sessionstart",Ll),W.addEventListener("sessionend",Dl),this.render=function(E,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(U),U=W.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,U,R),p=qt.get(E,v.length),p.init(U),v.push(p),It.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Y.setFromProjectionMatrix(It),St=this.localClippingEnabled,it=tt.init(this.clippingPlanes,St),g=_t.get(E,y.length),g.init(),y.push(g),W.enabled===!0&&W.isPresenting===!0){const st=x.xr.getDepthSensingMesh();st!==null&&pa(st,U,-1/0,x.sortObjects)}pa(E,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(ot,pt),K=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,K&&Lt.addToRenderList(g,E),this.info.render.frame++,it===!0&&tt.beginShadows();const B=p.state.shadowsArray;vt.render(B,E,U),it===!0&&tt.endShadows(),this.info.autoReset===!0&&this.info.reset();const z=g.opaque,N=g.transmissive;if(p.setupLights(),U.isArrayCamera){const st=U.cameras;if(N.length>0)for(let dt=0,Tt=st.length;dt<Tt;dt++){const At=st[dt];Nl(z,N,E,At)}K&&Lt.render(E);for(let dt=0,Tt=st.length;dt<Tt;dt++){const At=st[dt];Ul(g,E,At,At.viewport)}}else N.length>0&&Nl(z,N,E,U),K&&Lt.render(E),Ul(g,E,U);R!==null&&(A.updateMultisampleRenderTarget(R),A.updateRenderTargetMipmap(R)),E.isScene===!0&&E.onAfterRender(x,E,U),ae.resetDefaultState(),b=-1,M=null,v.pop(),v.length>0?(p=v[v.length-1],it===!0&&tt.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function pa(E,U,B,z){if(E.visible===!1)return;if(E.layers.test(U.layers)){if(E.isGroup)B=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(U);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Y.intersectsSprite(E)){z&&Dt.setFromMatrixPosition(E.matrixWorld).applyMatrix4(It);const dt=q.update(E),Tt=E.material;Tt.visible&&g.push(E,dt,Tt,B,Dt.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||Y.intersectsObject(E))){const dt=q.update(E),Tt=E.material;if(z&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Dt.copy(E.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),Dt.copy(dt.boundingSphere.center)),Dt.applyMatrix4(E.matrixWorld).applyMatrix4(It)),Array.isArray(Tt)){const At=dt.groups;for(let Ot=0,Ht=At.length;Ot<Ht;Ot++){const wt=At[Ot],$t=Tt[wt.materialIndex];$t&&$t.visible&&g.push(E,dt,$t,B,Dt.z,wt)}}else Tt.visible&&g.push(E,dt,Tt,B,Dt.z,null)}}const st=E.children;for(let dt=0,Tt=st.length;dt<Tt;dt++)pa(st[dt],U,B,z)}function Ul(E,U,B,z){const N=E.opaque,st=E.transmissive,dt=E.transparent;p.setupLightsView(B),it===!0&&tt.setGlobalState(x.clippingPlanes,B),z&&at.viewport(L.copy(z)),N.length>0&&ks(N,U,B),st.length>0&&ks(st,U,B),dt.length>0&&ks(dt,U,B),at.buffers.depth.setTest(!0),at.buffers.depth.setMask(!0),at.buffers.color.setMask(!0),at.setPolygonOffset(!1)}function Nl(E,U,B,z){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[z.id]===void 0&&(p.state.transmissionRenderTarget[z.id]=new on(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?Fs:wn,minFilter:Sn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Zt.workingColorSpace}));const st=p.state.transmissionRenderTarget[z.id],dt=z.viewport||L;st.setSize(dt.z,dt.w);const Tt=x.getRenderTarget();x.setRenderTarget(st),x.getClearColor(V),Z=x.getClearAlpha(),Z<1&&x.setClearColor(16777215,.5),x.clear(),K&&Lt.render(B);const At=x.toneMapping;x.toneMapping=Hn;const Ot=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),p.setupLightsView(z),it===!0&&tt.setGlobalState(x.clippingPlanes,z),ks(E,B,z),A.updateMultisampleRenderTarget(st),A.updateRenderTargetMipmap(st),j.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let wt=0,$t=U.length;wt<$t;wt++){const oe=U[wt],le=oe.object,De=oe.geometry,ee=oe.material,Rt=oe.group;if(ee.side===yn&&le.layers.test(z.layers)){const dn=ee.side;ee.side=Oe,ee.needsUpdate=!0,Fl(le,B,z,De,ee,Rt),ee.side=dn,ee.needsUpdate=!0,Ht=!0}}Ht===!0&&(A.updateMultisampleRenderTarget(st),A.updateRenderTargetMipmap(st))}x.setRenderTarget(Tt),x.setClearColor(V,Z),Ot!==void 0&&(z.viewport=Ot),x.toneMapping=At}function ks(E,U,B){const z=U.isScene===!0?U.overrideMaterial:null;for(let N=0,st=E.length;N<st;N++){const dt=E[N],Tt=dt.object,At=dt.geometry,Ot=z===null?dt.material:z,Ht=dt.group;Tt.layers.test(B.layers)&&Fl(Tt,U,B,At,Ot,Ht)}}function Fl(E,U,B,z,N,st){E.onBeforeRender(x,U,B,z,N,st),E.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),N.onBeforeRender(x,U,B,z,E,st),N.transparent===!0&&N.side===yn&&N.forceSinglePass===!1?(N.side=Oe,N.needsUpdate=!0,x.renderBufferDirect(B,U,z,N,E,st),N.side=Gn,N.needsUpdate=!0,x.renderBufferDirect(B,U,z,N,E,st),N.side=yn):x.renderBufferDirect(B,U,z,N,E,st),E.onAfterRender(x,U,B,z,N,st)}function Vs(E,U,B){U.isScene!==!0&&(U=Jt);const z=gt.get(E),N=p.state.lights,st=p.state.shadowsArray,dt=N.state.version,Tt=Et.getParameters(E,N.state,st,U,B),At=Et.getProgramCacheKey(Tt);let Ot=z.programs;z.environment=E.isMeshStandardMaterial?U.environment:null,z.fog=U.fog,z.envMap=(E.isMeshStandardMaterial?F:S).get(E.envMap||z.environment),z.envMapRotation=z.environment!==null&&E.envMap===null?U.environmentRotation:E.envMapRotation,Ot===void 0&&(E.addEventListener("dispose",Vt),Ot=new Map,z.programs=Ot);let Ht=Ot.get(At);if(Ht!==void 0){if(z.currentProgram===Ht&&z.lightsStateVersion===dt)return Bl(E,Tt),Ht}else Tt.uniforms=Et.getUniforms(E),E.onBeforeCompile(Tt,x),Ht=Et.acquireProgram(Tt,At),Ot.set(At,Ht),z.uniforms=Tt.uniforms;const wt=z.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(wt.clippingPlanes=tt.uniform),Bl(E,Tt),z.needsLights=Au(E),z.lightsStateVersion=dt,z.needsLights&&(wt.ambientLightColor.value=N.state.ambient,wt.lightProbe.value=N.state.probe,wt.directionalLights.value=N.state.directional,wt.directionalLightShadows.value=N.state.directionalShadow,wt.spotLights.value=N.state.spot,wt.spotLightShadows.value=N.state.spotShadow,wt.rectAreaLights.value=N.state.rectArea,wt.ltc_1.value=N.state.rectAreaLTC1,wt.ltc_2.value=N.state.rectAreaLTC2,wt.pointLights.value=N.state.point,wt.pointLightShadows.value=N.state.pointShadow,wt.hemisphereLights.value=N.state.hemi,wt.directionalShadowMap.value=N.state.directionalShadowMap,wt.directionalShadowMatrix.value=N.state.directionalShadowMatrix,wt.spotShadowMap.value=N.state.spotShadowMap,wt.spotLightMatrix.value=N.state.spotLightMatrix,wt.spotLightMap.value=N.state.spotLightMap,wt.pointShadowMap.value=N.state.pointShadowMap,wt.pointShadowMatrix.value=N.state.pointShadowMatrix),z.currentProgram=Ht,z.uniformsList=null,Ht}function Ol(E){if(E.uniformsList===null){const U=E.currentProgram.getUniforms();E.uniformsList=zr.seqWithValue(U.seq,E.uniforms)}return E.uniformsList}function Bl(E,U){const B=gt.get(E);B.outputColorSpace=U.outputColorSpace,B.batching=U.batching,B.batchingColor=U.batchingColor,B.instancing=U.instancing,B.instancingColor=U.instancingColor,B.instancingMorph=U.instancingMorph,B.skinning=U.skinning,B.morphTargets=U.morphTargets,B.morphNormals=U.morphNormals,B.morphColors=U.morphColors,B.morphTargetsCount=U.morphTargetsCount,B.numClippingPlanes=U.numClippingPlanes,B.numIntersection=U.numClipIntersection,B.vertexAlphas=U.vertexAlphas,B.vertexTangents=U.vertexTangents,B.toneMapping=U.toneMapping}function Eu(E,U,B,z,N){U.isScene!==!0&&(U=Jt),A.resetTextureUnits();const st=U.fog,dt=z.isMeshStandardMaterial?U.environment:null,Tt=R===null?x.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:ns,At=(z.isMeshStandardMaterial?F:S).get(z.envMap||dt),Ot=z.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,Ht=!!B.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),wt=!!B.morphAttributes.position,$t=!!B.morphAttributes.normal,oe=!!B.morphAttributes.color;let le=Hn;z.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(le=x.toneMapping);const De=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,ee=De!==void 0?De.length:0,Rt=gt.get(z),dn=p.state.lights;if(it===!0&&(St===!0||E!==M)){const Je=E===M&&z.id===b;tt.setState(z,E,Je)}let ne=!1;z.version===Rt.__version?(Rt.needsLights&&Rt.lightsStateVersion!==dn.state.version||Rt.outputColorSpace!==Tt||N.isBatchedMesh&&Rt.batching===!1||!N.isBatchedMesh&&Rt.batching===!0||N.isBatchedMesh&&Rt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Rt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Rt.instancing===!1||!N.isInstancedMesh&&Rt.instancing===!0||N.isSkinnedMesh&&Rt.skinning===!1||!N.isSkinnedMesh&&Rt.skinning===!0||N.isInstancedMesh&&Rt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Rt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Rt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Rt.instancingMorph===!1&&N.morphTexture!==null||Rt.envMap!==At||z.fog===!0&&Rt.fog!==st||Rt.numClippingPlanes!==void 0&&(Rt.numClippingPlanes!==tt.numPlanes||Rt.numIntersection!==tt.numIntersection)||Rt.vertexAlphas!==Ot||Rt.vertexTangents!==Ht||Rt.morphTargets!==wt||Rt.morphNormals!==$t||Rt.morphColors!==oe||Rt.toneMapping!==le||Rt.morphTargetsCount!==ee)&&(ne=!0):(ne=!0,Rt.__version=z.version);let je=Rt.currentProgram;ne===!0&&(je=Vs(z,U,N));let yi=!1,ke=!1,os=!1;const ce=je.getUniforms(),rn=Rt.uniforms;if(at.useProgram(je.program)&&(yi=!0,ke=!0,os=!0),z.id!==b&&(b=z.id,ke=!0),yi||M!==E){at.buffers.depth.getReversed()?(rt.copy(E.projectionMatrix),Fd(rt),Od(rt),ce.setValue(I,"projectionMatrix",rt)):ce.setValue(I,"projectionMatrix",E.projectionMatrix),ce.setValue(I,"viewMatrix",E.matrixWorldInverse);const In=ce.map.cameraPosition;In!==void 0&&In.setValue(I,Ft.setFromMatrixPosition(E.matrixWorld)),xt.logarithmicDepthBuffer&&ce.setValue(I,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&ce.setValue(I,"isOrthographic",E.isOrthographicCamera===!0),M!==E&&(M=E,ke=!0,os=!0)}if(N.isSkinnedMesh){ce.setOptional(I,N,"bindMatrix"),ce.setOptional(I,N,"bindMatrixInverse");const Je=N.skeleton;Je&&(Je.boneTexture===null&&Je.computeBoneTexture(),ce.setValue(I,"boneTexture",Je.boneTexture,A))}N.isBatchedMesh&&(ce.setOptional(I,N,"batchingTexture"),ce.setValue(I,"batchingTexture",N._matricesTexture,A),ce.setOptional(I,N,"batchingIdTexture"),ce.setValue(I,"batchingIdTexture",N._indirectTexture,A),ce.setOptional(I,N,"batchingColorTexture"),N._colorsTexture!==null&&ce.setValue(I,"batchingColorTexture",N._colorsTexture,A));const ls=B.morphAttributes;if((ls.position!==void 0||ls.normal!==void 0||ls.color!==void 0)&&Nt.update(N,B,je),(ke||Rt.receiveShadow!==N.receiveShadow)&&(Rt.receiveShadow=N.receiveShadow,ce.setValue(I,"receiveShadow",N.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(rn.envMap.value=At,rn.flipEnvMap.value=At.isCubeTexture&&At.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&U.environment!==null&&(rn.envMapIntensity.value=U.environmentIntensity),ke&&(ce.setValue(I,"toneMappingExposure",x.toneMappingExposure),Rt.needsLights&&Tu(rn,os),st&&z.fog===!0&&ct.refreshFogUniforms(rn,st),ct.refreshMaterialUniforms(rn,z,G,et,p.state.transmissionRenderTarget[E.id]),zr.upload(I,Ol(Rt),rn,A)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(zr.upload(I,Ol(Rt),rn,A),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&ce.setValue(I,"center",N.center),ce.setValue(I,"modelViewMatrix",N.modelViewMatrix),ce.setValue(I,"normalMatrix",N.normalMatrix),ce.setValue(I,"modelMatrix",N.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Je=z.uniformsGroups;for(let In=0,Pn=Je.length;In<Pn;In++){const zl=Je[In];D.update(zl,je),D.bind(zl,je)}}return je}function Tu(E,U){E.ambientLightColor.needsUpdate=U,E.lightProbe.needsUpdate=U,E.directionalLights.needsUpdate=U,E.directionalLightShadows.needsUpdate=U,E.pointLights.needsUpdate=U,E.pointLightShadows.needsUpdate=U,E.spotLights.needsUpdate=U,E.spotLightShadows.needsUpdate=U,E.rectAreaLights.needsUpdate=U,E.hemisphereLights.needsUpdate=U}function Au(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(E,U,B){gt.get(E.texture).__webglTexture=U,gt.get(E.depthTexture).__webglTexture=B;const z=gt.get(E);z.__hasExternalTextures=!0,z.__autoAllocateDepthBuffer=B===void 0,z.__autoAllocateDepthBuffer||j.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,U){const B=gt.get(E);B.__webglFramebuffer=U,B.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(E,U=0,B=0){R=E,T=U,C=B;let z=!0,N=null,st=!1,dt=!1;if(E){const At=gt.get(E);if(At.__useDefaultFramebuffer!==void 0)at.bindFramebuffer(I.FRAMEBUFFER,null),z=!1;else if(At.__webglFramebuffer===void 0)A.setupRenderTarget(E);else if(At.__hasExternalTextures)A.rebindTextures(E,gt.get(E.texture).__webglTexture,gt.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const wt=E.depthTexture;if(At.__boundDepthTexture!==wt){if(wt!==null&>.has(wt)&&(E.width!==wt.image.width||E.height!==wt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");A.setupDepthRenderbuffer(E)}}const Ot=E.texture;(Ot.isData3DTexture||Ot.isDataArrayTexture||Ot.isCompressedArrayTexture)&&(dt=!0);const Ht=gt.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Ht[U])?N=Ht[U][B]:N=Ht[U],st=!0):E.samples>0&&A.useMultisampledRTT(E)===!1?N=gt.get(E).__webglMultisampledFramebuffer:Array.isArray(Ht)?N=Ht[B]:N=Ht,L.copy(E.viewport),k.copy(E.scissor),O=E.scissorTest}else L.copy(Mt).multiplyScalar(G).floor(),k.copy(Bt).multiplyScalar(G).floor(),O=te;if(at.bindFramebuffer(I.FRAMEBUFFER,N)&&z&&at.drawBuffers(E,N),at.viewport(L),at.scissor(k),at.setScissorTest(O),st){const At=gt.get(E.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+U,At.__webglTexture,B)}else if(dt){const At=gt.get(E.texture),Ot=U||0;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,At.__webglTexture,B||0,Ot)}b=-1},this.readRenderTargetPixels=function(E,U,B,z,N,st,dt){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Tt=gt.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&dt!==void 0&&(Tt=Tt[dt]),Tt){at.bindFramebuffer(I.FRAMEBUFFER,Tt);try{const At=E.texture,Ot=At.format,Ht=At.type;if(!xt.textureFormatReadable(Ot)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!xt.textureTypeReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=E.width-z&&B>=0&&B<=E.height-N&&I.readPixels(U,B,z,N,Gt.convert(Ot),Gt.convert(Ht),st)}finally{const At=R!==null?gt.get(R).__webglFramebuffer:null;at.bindFramebuffer(I.FRAMEBUFFER,At)}}},this.readRenderTargetPixelsAsync=async function(E,U,B,z,N,st,dt){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Tt=gt.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&dt!==void 0&&(Tt=Tt[dt]),Tt){const At=E.texture,Ot=At.format,Ht=At.type;if(!xt.textureFormatReadable(Ot))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!xt.textureTypeReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(U>=0&&U<=E.width-z&&B>=0&&B<=E.height-N){at.bindFramebuffer(I.FRAMEBUFFER,Tt);const wt=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,wt),I.bufferData(I.PIXEL_PACK_BUFFER,st.byteLength,I.STREAM_READ),I.readPixels(U,B,z,N,Gt.convert(Ot),Gt.convert(Ht),0);const $t=R!==null?gt.get(R).__webglFramebuffer:null;at.bindFramebuffer(I.FRAMEBUFFER,$t);const oe=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Nd(I,oe,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,wt),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,st),I.deleteBuffer(wt),I.deleteSync(oe),st}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(E,U=null,B=0){E.isTexture!==!0&&(Ss("WebGLRenderer: copyFramebufferToTexture function signature has changed."),U=arguments[0]||null,E=arguments[1]);const z=Math.pow(2,-B),N=Math.floor(E.image.width*z),st=Math.floor(E.image.height*z),dt=U!==null?U.x:0,Tt=U!==null?U.y:0;A.setTexture2D(E,0),I.copyTexSubImage2D(I.TEXTURE_2D,B,0,0,dt,Tt,N,st),at.unbindTexture()},this.copyTextureToTexture=function(E,U,B=null,z=null,N=0){E.isTexture!==!0&&(Ss("WebGLRenderer: copyTextureToTexture function signature has changed."),z=arguments[0]||null,E=arguments[1],U=arguments[2],N=arguments[3]||0,B=null);let st,dt,Tt,At,Ot,Ht,wt,$t,oe;const le=E.isCompressedTexture?E.mipmaps[N]:E.image;B!==null?(st=B.max.x-B.min.x,dt=B.max.y-B.min.y,Tt=B.isBox3?B.max.z-B.min.z:1,At=B.min.x,Ot=B.min.y,Ht=B.isBox3?B.min.z:0):(st=le.width,dt=le.height,Tt=le.depth||1,At=0,Ot=0,Ht=0),z!==null?(wt=z.x,$t=z.y,oe=z.z):(wt=0,$t=0,oe=0);const De=Gt.convert(U.format),ee=Gt.convert(U.type);let Rt;U.isData3DTexture?(A.setTexture3D(U,0),Rt=I.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(A.setTexture2DArray(U,0),Rt=I.TEXTURE_2D_ARRAY):(A.setTexture2D(U,0),Rt=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,U.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,U.unpackAlignment);const dn=I.getParameter(I.UNPACK_ROW_LENGTH),ne=I.getParameter(I.UNPACK_IMAGE_HEIGHT),je=I.getParameter(I.UNPACK_SKIP_PIXELS),yi=I.getParameter(I.UNPACK_SKIP_ROWS),ke=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,le.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,le.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,At),I.pixelStorei(I.UNPACK_SKIP_ROWS,Ot),I.pixelStorei(I.UNPACK_SKIP_IMAGES,Ht);const os=E.isDataArrayTexture||E.isData3DTexture,ce=U.isDataArrayTexture||U.isData3DTexture;if(E.isRenderTargetTexture||E.isDepthTexture){const rn=gt.get(E),ls=gt.get(U),Je=gt.get(rn.__renderTarget),In=gt.get(ls.__renderTarget);at.bindFramebuffer(I.READ_FRAMEBUFFER,Je.__webglFramebuffer),at.bindFramebuffer(I.DRAW_FRAMEBUFFER,In.__webglFramebuffer);for(let Pn=0;Pn<Tt;Pn++)os&&I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,gt.get(E).__webglTexture,N,Ht+Pn),E.isDepthTexture?(ce&&I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,gt.get(U).__webglTexture,N,oe+Pn),I.blitFramebuffer(At,Ot,st,dt,wt,$t,st,dt,I.DEPTH_BUFFER_BIT,I.NEAREST)):ce?I.copyTexSubImage3D(Rt,N,wt,$t,oe+Pn,At,Ot,st,dt):I.copyTexSubImage2D(Rt,N,wt,$t,oe+Pn,At,Ot,st,dt);at.bindFramebuffer(I.READ_FRAMEBUFFER,null),at.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else ce?E.isDataTexture||E.isData3DTexture?I.texSubImage3D(Rt,N,wt,$t,oe,st,dt,Tt,De,ee,le.data):U.isCompressedArrayTexture?I.compressedTexSubImage3D(Rt,N,wt,$t,oe,st,dt,Tt,De,le.data):I.texSubImage3D(Rt,N,wt,$t,oe,st,dt,Tt,De,ee,le):E.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,N,wt,$t,st,dt,De,ee,le.data):E.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,N,wt,$t,le.width,le.height,De,le.data):I.texSubImage2D(I.TEXTURE_2D,N,wt,$t,st,dt,De,ee,le);I.pixelStorei(I.UNPACK_ROW_LENGTH,dn),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,ne),I.pixelStorei(I.UNPACK_SKIP_PIXELS,je),I.pixelStorei(I.UNPACK_SKIP_ROWS,yi),I.pixelStorei(I.UNPACK_SKIP_IMAGES,ke),N===0&&U.generateMipmaps&&I.generateMipmap(Rt),at.unbindTexture()},this.copyTextureToTexture3D=function(E,U,B=null,z=null,N=0){return E.isTexture!==!0&&(Ss("WebGLRenderer: copyTextureToTexture3D function signature has changed."),B=arguments[0]||null,z=arguments[1]||null,E=arguments[2],U=arguments[3],N=arguments[4]||0),Ss('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,U,B,z,N)},this.initRenderTarget=function(E){gt.get(E).__webglFramebuffer===void 0&&A.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?A.setTextureCube(E,
vendor: 20,724 bytes, line 3828
38280):E.isData3DTexture?A.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?A.setTexture2DArray(E,0):A.setTexture2D(E,0),at.unbindTexture()},this.resetState=function(){T=0,C=0,R=null,at.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return bn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=Zt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Zt._getUnpackColorSpace()}}class ll{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new mt(t),this.density=e}clone(){return new ll(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class cl{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new mt(t),this.near=e,this.far=n}clone(){return new cl(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Z_ extends jt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ke,this.environmentIntensity=1,this.environmentRotation=new Ke,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class hl{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=qr,this.updateRanges=[],this.version=0,this.uuid=qe()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=qe()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=qe()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}}const Ce=new w;class es{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ce.fromBufferAttribute(this,e),Ce.applyMatrix4(t),this.setXYZ(e,Ce.x,Ce.y,Ce.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ce.fromBufferAttribute(this,e),Ce.applyNormalMatrix(t),this.setXYZ(e,Ce.x,Ce.y,Ce.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ce.fromBufferAttribute(this,e),Ce.transformDirection(t),this.setXYZ(e,Ce.x,Ce.y,Ce.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Ie(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=kt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=kt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=kt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=kt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=kt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ie(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ie(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ie(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ie(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=kt(e,this.array),n=kt(n,this.array),i=kt(i,this.array),r=kt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[i+r])}return new re(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new es(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class nu extends Le{static get type(){return"SpriteMaterial"}constructor(t){super(),this.isSpriteMaterial=!0,this.color=new mt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Ni;const fs=new w,Fi=new w,Oi=new w,Bi=new $,ps=new $,iu=new Ut,lr=new w,ms=new w,cr=new w,Bc=new $,Ga=new $,zc=new $;class J_ extends jt{constructor(t=new nu){if(super(),this.isSprite=!0,this.type="Sprite",Ni===void 0){Ni=new Xt;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new hl(e,5);Ni.setIndex([0,1,2,0,2,3]),Ni.setAttribute("position",new es(n,3,0,!1)),Ni.setAttribute("uv",new es(n,2,3,!1))}this.geometry=Ni,this.material=t,this.center=new $(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fi.setFromMatrixScale(this.matrixWorld),iu.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Oi.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fi.multiplyScalar(-Oi.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;hr(lr.set(-.5,-.5,0),Oi,a,Fi,i,r),hr(ms.set(.5,-.5,0),Oi,a,Fi,i,r),hr(cr.set(.5,.5,0),Oi,a,Fi,i,r),Bc.set(0,0),Ga.set(1,0),zc.set(1,1);let o=t.ray.intersectTriangle(lr,ms,cr,!1,fs);if(o===null&&(hr(ms.set(-.5,.5,0),Oi,a,Fi,i,r),Ga.set(0,1),o=t.ray.intersectTriangle(lr,cr,ms,!1,fs),o===null))return;const l=t.ray.origin.distanceTo(fs);l<t.near||l>t.far||e.push({distance:l,point:fs.clone(),uv:We.getInterpolation(fs,lr,ms,cr,Bc,Ga,zc,new $),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function hr(s,t,e,n,i,r){Bi.subVectors(s,e).addScalar(.5).multiply(n),i!==void 0?(ps.x=r*Bi.x-i*Bi.y,ps.y=i*Bi.x+r*Bi.y):ps.copy(Bi),s.copy(t),s.x+=ps.x,s.y+=ps.y,s.applyMatrix4(iu)}const ur=new w,kc=new w;class $_ extends jt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n<i;n++){const r=e[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let r;for(r=0;r<i.length&&!(e<i[r].distance);r++);return i.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const i=e.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let r=e[n].distance;if(e[n].object.visible&&(r-=r*e[n].hysteresis),t<r)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){ur.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(ur);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){ur.setFromMatrixPosition(t.matrixWorld),kc.setFromMatrixPosition(this.matrixWorld);const n=ur.distanceTo(kc)/t.zoom;e[0].object.visible=!0;let i,r;for(i=1,r=e.length;i<r;i++){let a=e[i].distance;if(e[i].object.visible&&(a-=a*e[i].hysteresis),n>=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const a=n[i];e.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return e}}const Vc=new w,Hc=new Qt,Gc=new Qt,K_=new w,Wc=new Ut,dr=new w,Wa=new Pe,Xc=new Ut,Xa=new Os;class Q_ extends _e{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Wl,this.bindMatrix=new Ut,this.bindMatrixInverse=new Ut,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;this.boundingBox===null&&(this.boundingBox=new Be),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,dr),this.boundingBox.expandByPoint(dr)}computeBoundingSphere(){const t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Pe),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,dr),this.boundingSphere.expandByPoint(dr)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Wa.copy(this.boundingSphere),Wa.applyMatrix4(i),t.ray.intersectsSphere(Wa)!==!1&&(Xc.copy(i).invert(),Xa.copy(t.ray).applyMatrix4(Xc),!(this.boundingBox!==null&&Xa.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,Xa)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Qt,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Wl?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===id?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;Hc.fromBufferAttribute(i.attributes.skinIndex,t),Gc.fromBufferAttribute(i.attributes.skinWeight,t),Vc.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){const a=Gc.getComponent(r);if(a!==0){const o=Hc.getComponent(r);Wc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(K_.copy(Vc).applyMatrix4(Wc),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}class su extends jt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Tn extends me{constructor(t=null,e=1,n=1,i,r,a,o,l,c=we,h=we,u,d){super(null,a,o,l,c,h,i,r,u,d),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const qc=new Ut,j_=new Ut;class ul{constructor(t=[],e=[]){this.uuid=qe(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ut)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const n=new Ut;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=t.length;r<a;r++){const o=t[r]?t[r].matrixWorld:j_;qc.multiplyMatrices(o,e[r]),qc.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new ul(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Tn(e,t,t,Fe,Xe);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const r=t.bones[n];let a=e[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new su),this.bones.push(a),this.boneInverses.push(new Ut().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const a=e[i];t.bones.push(a.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}}class Ps extends re{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const zi=new Ut,Yc=new Ut,fr=[],Zc=new Be,t0=new Ut,gs=new _e,_s=new Pe;class e0 extends _e{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ps(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,t0)}computeBoundingBox(){const t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Be),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,zi),Zc.copy(t.boundingBox).applyMatrix4(zi),this.boundingBox.union(Zc)}computeBoundingSphere(){const t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new Pe),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,zi),_s.copy(t.boundingSphere).applyMatrix4(zi),this.boundingSphere.union(_s)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=t*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(gs.geometry=this.geometry,gs.material=this.material,gs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_s.copy(this.boundingSphere),_s.applyMatrix4(n),t.ray.intersectsSphere(_s)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,zi),Yc.multiplyMatrices(n,zi),gs.matrixWorld=Yc,gs.raycast(t,fr);for(let a=0,o=fr.length;a<o;a++){const l=fr[a];l.instanceId=r,l.object=this,e.push(l)}fr.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new Ps(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Tn(new Float32Array(i*this.count),i,this.count,Qo,Xe));const r=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*t;r[l]=o,r.set(n,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function qa(s,t){return s-t}function n0(s,t){return s.z-t.z}function i0(s,t){return t.z-s.z}class s0{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const r=this.pool,a=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];a.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}
3828const Ue=new Ut,r0=new mt(1,1,1),Ya=new aa,pr=new Be,ti=new Pe,xs=new w,Jc=new w,a0=new w,Za=new s0,Te=new _e,mr=[];function o0(s,t,e=0){const n=t.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==t.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let a=0;a<n;a++)t.setComponent(r+e,a,s.getComponent(r,a))}else t.array.set(s.array,e*n);t.needsUpdate=!0}function ei(s,t){if(s.constructor!==t.constructor){const e=Math.min(s.length,t.length);for(let n=0;n<e;n++)t[n]=s[n]}else{const e=Math.min(s.length,t.length);t.set(new s.constructor(s.buffer,0,e))}}class l0 extends _e{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(t,e,n=e*2,i){super(new Xt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new Tn(e,t,t,Fe,Xe);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new Tn(e,t,t,ia,Xn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new Tn(e,t,t,Fe,Xe);
3828n.colorSpace=Zt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in t.attributes){const a=t.getAttribute(r),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),u=new re(h,l,c);e.setAttribute(r,u)}if(t.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new re(r,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Be);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const r=e[n].geometryIndex;this.getMatrixAt(n,Ue),this.getBoundingBoxAt(r,pr).applyMatrix4(Ue),t.union(pr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pe);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const r=e[n].geometryIndex;this.getMatrixAt(n,Ue),this.getBoundingSphereAt(r,ti).applyMatrix4(Ue),t.union(ti)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:t};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(qa),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const r=this._matricesTexture;Ue.identity().toArray(r.image.data,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(r0.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=e===-1?t.getAttribute("position").count:e;const a=t.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(qa),l=this._availableGeometryIds.shift(),r[l]=i):(l=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(l,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),a=e.getIndex(),o=this._geometryInfo[t];if(i&&a.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const h in n.attributes){const u=e.getAttribute(h),d=n.getAttribute(h);o0(u,d,l);const f=u.itemSize;for(let m=u.count,_=c;m<_;m++){const g=l+m;for(let p=0;p<f;p++)d.setComponent(g,p,0)}d.needsUpdate=!0,d.addUpdateRange(l*f,c*f)}if(i){const h=o.indexStart,u=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let d=0;d<a.count;d++)r.setX(h+d,l+a.getX(d));for(let d=a.count,f=u;d<f;d++)r.setX(h+d,l);r.needsUpdate=!0,r.addUpdateRange(h,o.reservedIndexCount)}
3828return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,e.boundingBox!==null&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,e.boundingSphere!==null&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;const n=this._instanceInfo;for(let i=0,r=n.length;i<r;i++)n[i].geometryIndex===t&&this.deleteInstance(i);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){const e=this._instanceInfo;return t>=e.length||e[t].active===!1?this:(e[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this)}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),r=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=i[a],c=n[l];if(c.active!==!1){if(r.index!==null){if(c.indexStart!==e){const{indexStart:h,vertexStart:u,reservedIndexCount:d}=c,f=r.index,m=f.array,_=t-u;for(let g=h;g<h+d;g++)m[g]=m[g]+_;f.array.copyWithin(e,h,h+d),f.addUpdateRange(e,d),c.indexStart=e}e+=c.reservedIndexCount}if(c.vertexStart!==t){const{vertexStart:h,reservedVertexCount:u}=c,d=r.attributes;for(const f in d){const m=d[f],{array:_,itemSize:g}=m;_.copyWithin(t*g,h*g,(h+u)*g),m.addUpdateRange(t*g,u*g)}c.vertexStart=t}t+=c.reservedVertexCount,c.start=r.index?c.indexStart:c.vertexStart,this._nextIndexStart=r.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingBox===null){const r=new Be,a=n.index,o=n.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let h=l;a&&(h=a.getX(h)),r.expandByPoint(xs.fromBufferAttribute(o,h))}i.boundingBox=r}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingSphere===null){const r=new Pe;this.getBoundingBoxAt(t,pr),pr.getCenter(r.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=i.start,h=i.start+i.count;c<h;c++){let u=c;a&&(u=a.getX(u)),xs.fromBufferAttribute(o,u),l=Math.max(l,r.center.distanceToSquared(xs))}r.radius=Math.sqrt(l),i.boundingSphere=r}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){const n=this._instanceInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return t>=n.length||n[t].active===!1?this:(e.toArray(r,t*16),i.needsUpdate=!0,this)}getMatrixAt(t,e){const n=this._instanceInfo,i=this._matricesTexture.image.data;return t>=n.length||n[t].active===!1?null:e.fromArray(i,t*16)}setColorAt(t,e){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._instanceInfo;return t>=r.length||r[t].active===!1?this:(e.toArray(i,t*4),n.needsUpdate=!0,this)}getColorAt(t,e){const n=this._colorsTexture.image.data,i=this._instanceInfo;return t>=i.length||i[t].active===!1?null:e.fromArray(n,t*4)}setVisibleAt(t,e){const n=this._instanceInfo;return t>=n.length||n[t].active===!1||n[t].visible===e?this:(n[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){const e=this._instanceInfo;return t>=e.length||e[t].active===!1?!1:e[t].visible}setGeometryIdAt(t,e){const n=this._instanceInfo,i=this._geometryInfo;return t>=n.length||n[t].active===!1||e>=i.length||i[e].active===!1?null:(n[t].geometryIndex=e,this)}getGeometryIdAt(t){const e=this._instanceInfo;return t>=e.length||e[t].active===!1?-1:e[t].geometryIndex}getGeometryRangeAt(t,e={}){if(t<0||t>=this._geometryCount)return null;const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(qa);e[e.length-1]===n.length;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),r=new Int32Array(t);ei(this._multiDrawCounts,i),ei(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=t;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),ei(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ei(o.image.data,this._matricesTexture.image.data),l&&(l.dis
3828pose(),this._initColorsTexture(),ei(l.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Xt,this._initializeGeometry(r));const a=this.geometry;r.index&&ei(r.index.array,a.index.array);for(const o in r.attributes)ei(r.attributes[o].array,a.attributes[o].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;Te.material=this.material,Te.geometry.index=a.index,Te.geometry.attributes=a.attributes,Te.geometry.boundingBox===null&&(Te.geometry.boundingBox=new Be),Te.geometry.boundingSphere===null&&(Te.geometry.boundingSphere=new Pe);for(let o=0,l=n.length;o<l;o++){if(!n[o].visible||!n[o].active)continue;const c=n[o].geometryIndex,h=i[c];Te.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Te.matrixWorld).premultiply(r),this.getBoundingBoxAt(c,Te.geometry.boundingBox),this.getBoundingSphereAt(c,Te.geometry.boundingSphere),Te.raycast(t,mr);for(let u=0,d=mr.length;u<d;u++){const f=mr[u];f.object=this,f.batchId=o,e.push(f)}mr.length=0}Te.material=null,Te.geometry.index=null,Te.geometry.attributes={},Te.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,f=this._indirectTexture,m=f.image.data;d&&(Ue.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Ya.setFromProjectionMatrix(Ue,t.coordinateSystem));let _=0;if(this.sortObjects){Ue.copy(this.matrixWorld).invert(),xs.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ue),Jc.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ue);for(let y=0,v=l.length;y<v;y++)if(l[y].visible&&l[y].active){const x=l[y].geometryIndex;this.getMatrixAt(y,Ue),this.getBoundingSphereAt(x,ti).applyMatrix4(Ue);let P=!1;if(d&&(P=!Ya.intersectsSphere(ti)),!P){const T=u[x],C=a0.subVectors(ti.center,xs).dot(Jc);Za.push(T.start,T.count,C,y)}}const g=Za.list,p=this.customSort;p===null?g.sort(r.transparent?i0:n0):p.call(this,g,n);for(let y=0,v=g.length;y<v;y++){const x=g[y];c[_]=x.start*o,h[_]=x.count,m[_]=x.index,_++}Za.reset()}else for(let g=0,p=l.length;g<p;g++)if(l[g].visible&&l[g].active){const y=l[g].geometryIndex;let v=!1;if(d&&(this.getMatrixAt(g,Ue),this.getBoundingSphereAt(y,ti).applyMatrix4(Ue),v=!Ya.intersectsSphere(ti)),!v){const x=u[y];c[_]=x.start*o,h[_]=x.count,m[_]=g,_++}}f.needsUpdate=!0,this._multiDrawCount=_,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,r,a){this.onBeforeRender(t,null,i,r,a)}}class ze extends Le{static get type(){return"LineBasicMaterial"}constructor(t){super(),this.isLineBasicMaterial=!0,this.color=new mt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}
vendor: 4,485 bytes, line 3828
3828const Zr=new w,Jr=new w,$c=new Ut,vs=new Os,gr=new Pe,Ja=new w,Kc=new w;class pi extends jt{constructor(t=new Xt,e=new ze){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[0];for(let i=1,r=e.count;i<r;i++)Zr.fromBufferAttribute(e,i-1),Jr.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=Zr.distanceTo(Jr);t.setAttribute("lineDistance",new bt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(i),gr.radius+=r,t.ray.intersectsSphere(gr)===!1)return;$c.copy(i).invert(),vs.copy(t.ray).applyMatrix4($c);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const f=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=h.getX(_),y=h.getX(_+1),v=_r(this,t,vs,l,p,y);v&&e.push(v)}if(this.isLineLoop){const _=h.getX(m-1),g=h.getX(f),p=_r(this,t,vs,l,_,g);p&&e.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=_r(this,t,vs,l,_,_+1);p&&e.push(p)}if(this.isLineLoop){const _=_r(this,t,vs,l,m-1,f);_&&e.push(_)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function _r(s,t,e,n,i,r){const a=s.geometry.attributes.position;if(Zr.fromBufferAttribute(a,i),Jr.fromBufferAttribute(a,r),e.distanceSqToSegment(Zr,Jr,Ja,Kc)>n)return;Ja.applyMatrix4(s.matrixWorld);const l=t.ray.origin.distanceTo(Ja);if(!(l<t.near||l>t.far))return{distance:l,point:Kc.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:s}}const Qc=new w,jc=new w;class Rn extends pi{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[];for(let i=0,r=e.count;i<r;i+=2)Qc.fromBufferAttribute(e,i),jc.fromBufferAttribute(e,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Qc.distanceTo(jc);t.setAttribute("lineDistance",new bt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class c0 extends pi{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class ru extends Le{static get type(){return"PointsMaterial"}constructor(t){super(),this.isPointsMaterial=!0,this.color=new mt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const th=new Ut,Go=new Os,xr=new Pe,vr=new w;class h0 extends jt{constructor(t=new Xt,e=new ru){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),xr.copy(n.boundingSphere),xr.applyMatrix4(i),xr.radius+=r,t.ray.intersectsSphere(xr)===!1)return;th.copy(i).invert(),Go.copy(t.ray).applyMatrix4(th);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);vr.fromBufferAttribute(u,g),eh(vr,g,l,i,t,e,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,_=f;m<_;m++)vr.fromBufferAttribute(u,m),eh(vr,m,l,i,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>
vendor: 4,447 bytes, line 3828
38280){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function eh(s,t,e,n,i,r,a){const o=Go.distanceSqToPoint(s);if(o<e){const l=new w;Go.closestPointToPoint(s,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class Ov extends me{constructor(t,e,n,i,r,a,o,l,c){super(t,e,n,i,r,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Me,this.magFilter=r!==void 0?r:Me,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Bv extends me{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=we,this.minFilter=we,this.generateMipmaps=!1,this.needsUpdate=!0}}class dl extends me{constructor(t,e,n,i,r,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,r,u,d),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class zv extends dl{constructor(t,e,n,i,r,a){super(t,e,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=sn,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class kv extends dl{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Wn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Vv extends me{constructor(t,e,n,i,r,a,o,l,c){super(t,e,n,i,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class cn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let a;e?a=e:a=t*n[r-1];let o=0,l=r-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(r-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(r-1)}getTangent(t,e){let i=t-1e-4,r=t+1e-4;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),o=this.getPoint(r),l=e||(a.isVector2?new $:new w);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new w,i=[],r=[],a=[],o=new w,l=new Ut;for(let f=0;f<=t;f++){const m=f/t;i[f]=this.getTangentAt(m,new w)}r[0]=new w,a[0]=new w;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let f=1;f<=t;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(fe(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],r[f])}if(e===!0){let f=Math.acos(fe(r[0].dot(r[t]),-1,1));f/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(f=-f);for(let m=1;m<=t;m++)r[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],r[m])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.t
vendor: 10,422 bytes, line 3828
3828ype,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class fl extends cn{constructor(t=0,e=0,n=1,i=1,r=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new $){const n=e,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(a?r=0:r=i),this.aClockwise===!0&&!a&&(r===i?r=-i:r=r-i);const o=this.aStartAngle+t*r;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class u0 extends fl{constructor(t,e,n,i,r,a){super(t,e,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}}function pl(){let s=0,t=0,e=0,n=0;function i(r,a,o,l){s=r,t=o,e=-3*r+3*a-2*o-l,n=2*r-2*a+o+l}return{initCatmullRom:function(r,a,o,l,c){i(a,o,c*(o-r),c*(l-a))},initNonuniformCatmullRom:function(r,a,o,l,c,h,u){let d=(a-r)/c-(o-r)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(r){const a=r*r,o=a*r;return s+t*r+e*a+n*o}}}const yr=new w,$a=new pl,Ka=new pl,Qa=new pl;class d0 extends cn{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new w){const n=e,i=this.points,r=i.length,a=(r-(this.closed?0:1))*t;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%r]:(yr.subVectors(i[0],i[1]).add(i[0]),c=yr);const u=i[o%r],d=i[(o+1)%r];if(this.closed||o+2<r?h=i[(o+2)%r]:(yr.subVectors(i[r-1],i[r-2]).add(i[r-1]),h=yr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),f),_=Math.pow(u.distanceToSquared(d),f),g=Math.pow(d.distanceToSquared(h),f);_<1e-4&&(_=1),m<1e-4&&(m=_),g<1e-4&&(g=_),$a.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,_,g),Ka.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,_,g),Qa.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,_,g)}else this.curveType==="catmullrom"&&($a.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),Ka.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),Qa.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set($a.calc(l),Ka.calc(l),Qa.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new w().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function nh(s,t,e,n,i){const r=(n-t)*.5,a=(i-e)*.5,o=s*s,l=s*o;return(2*e-2*n+r+a)*l+(-3*e+3*n-2*r-a)*o+r*s+e}function f0(s,t){const e=1-s;return e*e*t}function p0(s,t){return 2*(1-s)*s*t}function m0(s,t){return s*s*t}function ws(s,t,e,n){return f0(s,t)+p0(s,e)+m0(s,n)}function g0(s,t){const e=1-s;return e*e*e*t}function _0(s,t){const e=1-s;return 3*e*e*s*t}function x0(s,t){return 3*(1-s)*s*s*t}function v0(s,t){return s*s*s*t}function Cs(s,t,e,n,i){return g0(s,t)+_0(s,e)+x0(s,n)+v0(s,i)}class au extends cn{constructor(t=new $,e=new $,n=new $,i=new $){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new $){const n=e,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Cs(t,i.x,r.x,a.x,o.x),Cs(t,i.y,r.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class y0 extends cn{constructor(t=new w,e=new w,n=new w,i=new w){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new w){const n=e,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Cs(t,i.x,r.x,a.x,o.x),Cs(t,i.y,r.y,a.y,o.y),Cs(t,i.z,r.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class ou extends cn{constructor(t=new $,e=new $){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new $){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new $){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class M0 extends cn{constructor(t=new w,e=new w){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new w){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new w){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class lu extends cn{constructor(t=new $,e=new $,n=new $){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new $){const n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(ws(t,i.x,r.x,a.x),ws(t,i.y,r.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class cu extends cn{constructor(t=new w,e=new w,n=new w){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new w){const n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(ws(t,i.x,r.x,a.x),ws(t,i.y,r.y,a.y),ws(t,i.z,r.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class hu extends cn{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new $){const n=e,i=this.points,r=(i.length-1)*t,a=Math.floor(r),o=r-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(nh(o,l.x,c.x,h.x,u.x),nh(o,l.y,c.y,h.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new $().fromArray(i))}return this}}var $r=Object.freeze({__proto__:null,ArcCurve:u0,CatmullRomCurve3:d0,CubicBezierCurve:au,CubicBezierCurve3:y0,EllipseCurve:fl,LineCurve:ou,LineCurve3:M0,QuadraticBezierCurve:lu,QuadraticBezierCurve3:cu,SplineCurve:hu});class S0 extends cn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new $r[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const a=i[r]-n,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],o=a.isEllipseCurve?t*2:a.isLineCurve||a.isLineCurve3?1:a.isS
vendor: 6,581 bytes, line 3828
3828plineCurve?t*a.points.length:t,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(e.push(h),n=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(new $r[i.type]().fromJSON(i))}return this}}class Kr extends S0{constructor(t){super(),this.type="Path",this.currentPoint=new $,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ou(this.currentPoint.clone(),new $(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new lu(this.currentPoint.clone(),new $(t,e),new $(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,a){const o=new au(this.currentPoint.clone(),new $(t,e),new $(n,i),new $(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new hu(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+o,e+l,n,i,r,a),this}absarc(t,e,n,i,r,a){return this.absellipse(t,e,n,n,i,r,a),this}ellipse(t,e,n,i,r,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+c,e+h,n,i,r,a,o,l),this}absellipse(t,e,n,i,r,a,o,l){const c=new fl(t,e,n,i,r,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class la extends Xt{constructor(t=[new $(0,-.5),new $(.5,0),new $(0,.5)],e=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=fe(i,0,Math.PI*2);const r=[],a=[],o=[],l=[],c=[],h=1/e,u=new w,d=new $,f=new w,m=new w,_=new w;let g=0,p=0;for(let y=0;y<=t.length-1;y++)switch(y){case 0:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case t.length-1:l.push(_.x,_.y,_.z);break;default:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(m)}for(let y=0;y<=e;y++){const v=n+y*h*i,x=Math.sin(v),P=Math.cos(v);for(let T=0;T<=t.length-1;T++){u.x=t[T].x*x,u.y=t[T].y,u.z=t[T].x*P,a.push(u.x,u.y,u.z),d.x=y/e,d.y=T/(t.length-1),o.push(d.x,d.y);const C=l[3*T+0]*x,R=l[3*T+1],b=l[3*T+0]*P;c.push(C,R,b)}}for(let y=0;y<e;y++)for(let v=0;v<t.length-1;v++){const x=v+y*t.length,P=x,T=x+t.length,C=x+t.length+1,R=x+1;r.push(P,T,R),r.push(C,R,T)}this.setIndex(r),this.setAttribute("position",new bt(a,3)),this.setAttribute("uv",new bt(o,2)),this.setAttribute("normal",new bt(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new la(t.points,t.segments,t.phiStart,t.phiLength)}}class ml extends la{constructor(t=1,e=1,n=4,i=8){const r=new Kr;r.absarc(0,-e/2,t,Math.PI*1.5,0),r.absarc(0,e/2,t,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new ml(t.radius,t.length,t.capSegments,t.radialSegments)}}class gl extends Xt{constructor(t=1,e=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],a=[],o=[],l=[],c=new w,h=new $;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=e;u++,d+=3){const f=n+u/e*i;c.x=t*Math.cos(f),c.y=t*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[d]/t+1)/2,h.y=(a[d+1]/t+1)/2,l.push(h.x,h.y)}for(let u=1;u<=e;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new bt(a,3)),this.setAttribute("normal",new bt(o,3)),this.setAttribute("uv",new bt(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new gl(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class zs extends Xt{constructor(t=1,e=1,n=1,i=32,r=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),r=Math.floor(r);const h=[],u=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;y(),a===!1&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new bt(u,3)),this.setAttribute("normal",new bt(d,3)),this.setAttribute("uv",new bt(f,2));function y(){const x=new w,P=new w;let T=0;const C=(e-t)/n;for(let R=0;R<=r;R++){const b=[],M=R/r,L=M*(e-t)+t;for(let k=0;k<=i;k++){const O=k/i,V=O*l+o,Z=Math.sin(V),H=Math.cos(V);P.x=L*Z,P.y=-M*n+g,P.z=L*H,u.push(P.x,P.y,P.z),x.set(Z,C,H).normalize(),d.push(x.x,x.y,x.z),f.push(O,1-M),b.push(m++)}_.push(b)}for(let R=0;R<i;R++)for(let b=0;b<r;b++){const M=_[b][R],L=_[b+1][R],k=_[b+1][R+1],O=_[b][R+1];(t>0||b!==0)&&(h.push(M,L,O),T+=3),(e>0||b!==r-1)&&(h.push(L,k,O),T+=3)}c.addGroup(p,T,0),p+=T}function v(x){const P=m,T=new $,C=new w;let R=0;const b=x===!0?t:e,M=x===!0?1:-1;for(let k=1;k<=i;k++)u.push(0,g*M,0),d.push(0,M,0),f.push(.5,.5),m++;const L=m;for(let k=0;k<=i;k++){const V=k/i*l+o,Z=Math.cos(V),H=Math.sin(V);C.x=b*H,C.y=g*M,C.z=b*Z,u.push(C.x,C.y,C.z),d.push(0,M,0),T.x=Z*.5+.5,T.y=H*.5*M+.5,f.push(T.x,T.y),m++}for(let k=0;k<i;k++){const O=P+k,V=L+k;x===!0?h.push(V,V+1,O):h.push(V+1,V,O),R+=3}c.addGroup(p,R,x===!0?1:2),p+=R}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new zs(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class _l extends zs{constructor(t=1,e=1,n=32,i=1,r=!1,a=0,o=Math.PI*2){super(0,t,e,n,i,r,a,o),this.type="C
3828oneGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}static fromJSON(t){return new _l(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class xi extends Xt{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],a=[];o(i),c(n),h(),this.setAttribute("position",new bt(r,3)),this.setAttribute("normal",new bt(r.slice(),3)),this.setAttribute("uv",new bt(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(y){const v=new w,x=new w,P=new w;for(let T=0;T<e.length;T+=3)f(e[T+0],v),f(e[T+1],x),f(e[T+2],P),l(v,x,P,y)}function l(y,v,x,P){const T=P+1,C=[];for(let R=0;R<=T;R++){C[R]=[];const b=y.clone().lerp(x,R/T),M=v.clone().lerp(x,R/T),L=T-R;for(let k=0;k<=L;k++)k===0&&R===T?C[R][k]=b:C[R][k]=b.clone().lerp(M,k/L)}for(let R=0;R<T;R++)for(let b=0;b<2*(T-R)-1;b++){const M=Math.floor(b/2);b%2===0?(d(C[R][M+1]),d(C[R+1][M]),d(C[R][M])):(d(C[R][M+1]),d(C[R+1][M+1]),d(C[R+1][M]))}}function c(y){const v=new w;for(let x=0;x<r.length;x+=3)v.x=r[x+0],v.y=r[x+1],v.z=r[x+2],v.normalize().multiplyScalar(y),r[x+0]=v.x,r[x+1]=v.y,r[x+2]=v.z}function h(){const y=new w;for(let v=0;v<r.length;v+=3){y.x=r[v+0],y.y=r[v+1],y.z=r[v+2];const x=g(y)/2/Math.PI+.5,P=p(y)/Math.PI+.5;a.push(x,1-P)}m(),u()}function u(){for(let y=0;y<a.length;y+=6){const v=a[y+0],x=a[y+2],P=a[y+4],T=Math.max(v,x,P),C=Math.min(v,x,P);T>.9&&C<.1&&(v<.2&&(a[y+0]+=1),x<.2&&(a[y+2]+=1),P<.2&&(a[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function f(y,v){const x=y*3;v.x=t[x+0],v.y=t[x+1],v.z=t[x+2]}function m(){const y=new w,v=new w,x=new w,P=new w,T=new $,C=new $,R=new $;for(let b=0,M=0;b<r.length;
vendor: 90,741 bytes, line 3828
3828b+=9,M+=6){y.set(r[b+0],r[b+1],r[b+2]),v.set(r[b+3],r[b+4],r[b+5]),x.set(r[b+6],r[b+7],r[b+8]),T.set(a[M+0],a[M+1]),C.set(a[M+2],a[M+3]),R.set(a[M+4],a[M+5]),P.copy(y).add(v).add(x).divideScalar(3);const L=g(P);_(T,M+0,y,L),_(C,M+2,v,L),_(R,M+4,x,L)}}function _(y,v,x,P){P<0&&y.x===1&&(a[v]=y.x-1),x.x===0&&x.z===0&&(a[v]=P/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function p(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xi(t.vertices,t.indices,t.radius,t.details)}}class xl extends xi{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,a,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new xl(t.radius,t.detail)}}const Mr=new w,Sr=new w,ja=new w,br=new We;class b0 extends Xt{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){const i=Math.pow(10,4),r=Math.cos(di*e),a=t.getIndex(),o=t.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],u=new Array(3),d={},f=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:_,b:g,c:p}=br;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),br.getNormal(ja),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let y=0;y<3;y++){const v=(y+1)%3,x=u[y],P=u[v],T=br[h[y]],C=br[h[v]],R=`${x}_${P}`,b=`${P}_${x}`;b in d&&d[b]?(ja.dot(d[b].normal)<=r&&(f.push(T.x,T.y,T.z),f.push(C.x,C.y,C.z)),d[b]=null):R in d||(d[R]={index0:c[y],index1:c[v],normal:ja.clone()})}}for(const m in d)if(d[m]){const{index0:_,index1:g}=d[m];Mr.fromBufferAttribute(o,_),Sr.fromBufferAttribute(o,g),f.push(Mr.x,Mr.y,Mr.z),f.push(Sr.x,Sr.y,Sr.z)}this.setAttribute("position",new bt(f,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Ji extends Kr{constructor(t){super(t),this.uuid=qe(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(new Kr().fromJSON(i))}return this}}const E0={triangulate:function(s,t,e=2){const n=t&&t.length,i=n?t[0]*e:s.length;let r=uu(s,0,i,e,!0);const a=[];if(!r||r.next===r.prev)return a;let o,l,c,h,u,d,f;if(n&&(r=R0(s,t,r,e)),s.length>80*e){o=c=s[0],l=h=s[1];for(let m=e;m<i;m+=e)u=s[m],d=s[m+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-o,h-l),f=f!==0?32767/f:0}return Ls(r,a,e,o,l,f,0),a}};function uu(s,t,e,n,i){let r,a;if(i===k0(s,t,e,n)>0)for(r=t;r<e;r+=n)a=ih(r,s[r],s[r+1],a);else for(r=e-n;r>=t;r-=n)a=ih(r,s[r],s[r+1],a);return a&&ca(a,a.next)&&(Us(a),a=a.next),a}function mi(s,t){if(!s)return s;t||(t=s);let e=s,n;do if(n=!1,!e.steiner&&(ca(e,e.next)||he(e.prev,e,e.next)===0)){if(Us(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Ls(s,t,e,n,i,r,a){if(!s)return;!a&&r&&U0(s,n,i,r);let o=s,l,c;for(;s.prev!==s.next;){if(l=s.prev,c=s.next,r?A0(s,n,i,r):T0(s)){t.push(l.i/e|0),t.push(s.i/e|0),t.push(c.i/e|0),Us(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=w0(mi(s),t,e),Ls(s,t,e,n,i,r,2)):a===2&&C0(s,t,e,n,i,r):Ls(mi(s),t,e,n,i,r,1);break}}}function T0(s){const t=s.prev,e=s,n=s.next;if(he(t,e,n)>=0)return!1;const i=t.x,r=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=i<r?i<a?i:a:r<a?r:a,u=o<l?o<c?o:c:l<c?l:c,d=i>r?i>a?i:a:r>a?r:a,f=o>l?o>c?o:c:l>c?l:c;let m=n.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Xi(i,o,r,l,a,c,m.x,m.y)&&he(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function A0(s,t,e,n){const i=s.prev,r=s,a=s.next;if(he(i,r,a)>=0)return!1;const o=i.x,l=r.x,c=a.x,h=i.y,u=r.y,d=a.y,f=o<l?o<c?o:c:l<c?l:c,m=h<u?h<d?h:d:u<d?u:d,_=o>l?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,p=Wo(f,m,t,e,n),y=Wo(_,g,t,e,n);let v=s.prevZ,x=s.nextZ;for(;v&&v.z>=p&&x&&x.z<=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Xi(o,h,l,u,c,d,v.x,v.y)&&he(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Xi(o,h,l,u,c,d,x.x,x.y)&&he(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=p;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Xi(o,h,l,u,c,d,v.x,v.y)&&he(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Xi(o,h,l,u,c,d,x.x,x.y)&&he(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function w0(s,t,e){let n=s;do{const i=n.prev,r=n.next.next;!ca(i,r)&&du(i,n,n.next,r)&&Ds(i,r)&&Ds(r,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(r.i/e|0),Us(n),Us(n.next),n=s=r),n=n.next}while(n!==s);return mi(n)}function C0(s,t,e,n,i,r){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&O0(a,o)){let l=fu(a,o);a=mi(a,a.next),l=mi(l,l.next),Ls(a,t,e,n,i,r,0),Ls(l,t,e,n,i,r,0);return}o=o.next}a=a.next}while(a!==s)}function R0(s,t,e,n){const i=[];let r,a,o,l,c;for(r=0,a=t.length;r<a;r++)o=t[r]*n,l=r<a-1?t[r+1]*n:s.length,c=uu(s,o,l,n,!1),c===c.next&&(c.steiner=!0),i.push(F0(c));for(i.sort(I0),r=0;r<i.length;r++)e=P0(i[r],e);return e}function I0(s,t){return s.x-t.x}function P0(s,t){const e=L0(s,t);if(!e)return t;const n=fu(e,s);return mi(n,n.next),mi(e,e.next)}function L0(s,t){let e=t,n=-1/0,i;const r=s.x,a=s.y;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){const d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=r&&d>n&&(n=d,i=e.x<e.next.x?e:e.next,d===r))return i}e=e.next}while(e!==t);if(!i)return null;const o=i,l=i.x,c=i.y;let h=1/0,u;e=i;do r>=e.x&&e.x>=l&&r!==e.x&&Xi(a<c?r:n,a,l,c,a<c?n:r,a,e.x,e.y)&&(u=Math.abs(a-e.y)/(r-e.x),Ds(e,s)&&(u<h||u===h&&(e.x>i.x||e.x===i.x&&D0(i,e)))&&(i=e,h=u)),e=e.next;while(e!==o);return i}function D0(s,t){return he(s.prev,s,t.prev)<0&&he(t.next,s,s.next)<0}function U0(s,t,e,n){let i=s;do i.z===0&&(i.z=Wo(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,N0(i)}function N0(s){let t,e,n,i,r,a,o,l,c=1;do{for(e=s,s=null,r=null,a=0;e;){for(a++,n=e,o=0,t=0;t<c&&(o++,n=n.nextZ,!!n);t++);for(l=c;o>0||l>0&&n;)o!==0&&(l===0||!n||e.z<=n.z)?(i=e,e=e.nextZ,o--):(i=n,n=n.nextZ,l--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;e=n}r.nextZ=null,c*=2}while(a>1);return s}function Wo(s,t,e,n,i){return s=(s-e)*i|0,t=(t-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function F0(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function Xi(s,t,e,n,i,r,a,o){return(i-a)*(t-o)>=(s-a)*(r-o)&&(s-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(r-o)>=(i-a)*(n-o)}function O0(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!B0(s,t)&&(Ds(s,t)&&Ds(t,s)&&z0(s,t)&&(he(s.prev,s,t.prev)||he(s,t.prev,t))||ca(s,t)&&he(s.prev,s,s.next)>0&&he(t.prev,t,t.next)>0)}function he(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function ca(s,t){return s.x===t.x&&s.y===t.y}function du(s,t,e,n){const i=Tr(he(s,t,e)),r=Tr(he(s,t,n)),a=Tr(he(e,n,s)),o=Tr(he(e,n,t));return!!(i!==r&&a!==o||i===0&&Er(s,e,t)||r===0&&Er(s,n,t)||a===0&&Er(e,s,n)||o===0&&Er(e,t,n))}function Er(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Tr(s){return s>0?1:s<0?-1:0}function B0(s,t){let e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&du(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Ds(s,t){return he(s.prev,s,s.next)<0?he(s,t,s.next)>=0&&he(s,s.prev,t)>=0:he(s,t,s.prev)<0||he(s,s.next,t)<0}function z0(s,t){let e=s,n=!1;const i=(s.x+t.x)/2,r=(s.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&i<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==s);return n}function fu(s,t){const e=new Xo(s.i,s.x,s.y),n=new Xo(t.i,t.x,t.y),i=s.next,r=t.prev;return s.next=t,t.prev=s,e.next=i,i.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function ih(s,t,e,n){const i=new Xo(s,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Us(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Xo(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function k0(s,t,e,n){let i=0;for(let r=t,a=e-n;r<e;r+=n)i+=(s[a]-s[r])*(s[r+1]+s[a+1]),a=r;return i}class An{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return n*.5}static isClockWise(t){return An.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];sh(t),rh(n,t);let a=t.length;e.forEach(sh);for(let l=0;l<e.length;l++)i.push(a),a+=e[l].length,rh(n,e[l]);const o=E0.triangulate(n,i);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}}function sh(s){const t=s.length;t>2&&s[t-1].equals(s[0])&&s.pop()}function rh(s,t){for(let e=0;e<t.length;e++)s.push(t[e].x),s.push(t[e].y)}class vl extends Xt{constructor(t=new Ji([new $(.5,.5),new $(-.5,.5),new $(-.5,-.5),new $(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let o=0,l=t.length;o<l;o++){const c=t[o];a(c)}this.setAttribute("position",new bt(i,3)),this.setAttribute("uv",new bt(r,2)),this.computeVertexNormals();function a(o){const l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1;let d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,f=e.bevelThickness!==void 0?e.bevelThickness:.2,m=e.bevelSize!==void 0?e.bevelSize:f-.1,_=e.bevelOffset!==void 0?e.bevelOffset:0,g=e.bevelSegments!==void 0?e.bevelSegments:3;const p=e.extrudePath,y=e.UVGenerator!==void 0?e.UVGenerator:V0;let v,x=!1,P,T,C,R;p&&(v=p.getSpacedPoints(h),x=!0,d=!1,P=p.computeFrenetFrames(h,!1),T=new w,C=new w,R=new w),d||(g=0,f=0,m=0,_=0);const b=o.extractPoints(c);let M=b.shape;const L=b.holes;if(!An.isClockWise(M)){M=M.reverse();for(let K=0,nt=L.length;K<nt;K++){const I=L[K];An.isClockWise(I)&&(L[K]=I.reverse())}}const O=An.triangulateShape(M,L),V=M;for(let K=0,nt=L.length;K<nt;K++){const I=L[K];M=M.concat(I)}function Z(K,nt,I){return nt||console.error("THREE.ExtrudeGeometry: vec does not exist"),K.clone().addScaledVector(nt,I)}const H=M.length,et=O.length;function G(K,nt,I){let Ct,j,xt;const at=K.x-nt.x,Pt=K.y-nt.y,gt=I.x-K.x,A=I.y-K.y,S=at*at+Pt*Pt,F=at*A-Pt*gt;if(Math.abs(F)>Number.EPSILON){const X=Math.sqrt(S),Q=Math.sqrt(gt*gt+A*A),q=nt.x-Pt/X,Et=nt.y+at/X,ct=I.x-A/Q,_t=I.y+gt/Q,qt=((ct-q)*A-(_t-Et)*gt)/(at*A-Pt*gt);Ct=q+at*qt-K.x,j=Et+Pt*qt-K.y;const tt=Ct*Ct+j*j;if(tt<=2)return new $(Ct,j);xt=Math.sqrt(tt/2)}else{let X=!1;at>Number.EPSILON?gt>Number.EPSILON&&(X=!0):at<-Number.EPSILON?gt<-Number.EPSILON&&(X=!0):Math.sign(Pt)===Math.sign(A)&&(X=!0),X?(Ct=-Pt,j=at,xt=Math.sqrt(S)):(Ct=at,j=Pt,xt=Math.sqrt(S/2))}return new $(Ct/xt,j/xt)}const ot=[];for(let K=0,nt=V.length,I=nt-1,Ct=K+1;K<nt;K++,I++,Ct++)I===nt&&(I=0),Ct===nt&&(Ct=0),ot[K]=G(V[K],V[I],V[Ct]);const pt=[];let Mt,Bt=ot.concat();for(let K=0,nt=L.length;K<nt;K++){const I=L[K];Mt=[];for(let Ct=0,j=I.length,xt=j-1,at=Ct+1;Ct<j;Ct++,xt++,at++)xt===j&&(xt=0),at===j&&(at=0),Mt[Ct]=G(I[Ct],I[xt],I[at]);pt.push(Mt),Bt=Bt.concat(Mt)}for(let K=0;K<g;K++){const nt=K/g,I=f*Math.cos(nt*Math.PI/2),Ct=m*Math.sin(nt*Math.PI/2)+_;for(let j=0,xt=V.length;j<xt;j++){const at=Z(V[j],ot[j],Ct);rt(at.x,at.y,-I)}for(let j=0,xt=L.length;j<xt;j++){const at=L[j];Mt=pt[j];for(let Pt=0,gt=at.length;Pt<gt;Pt++){const A=Z(at[Pt],Mt[Pt],Ct);rt(A.x,A.y,-I)}}}const te=m+_;for(let K=0;K<H;K++){const nt=d?Z(M[K],Bt[K],te):M[K];x?(C.copy(P.normals[0]).multiplyScalar(nt.x),T.copy(P.binormals[0]).multiplyScalar(nt.y),R.copy(v[0]).add(C).add(T),rt(R.x,R.y,R.z)):rt(nt.x,nt.y,0)}for(let K=1;K<=h;K++)for(let nt=0;nt<H;nt++){const I=d?Z(M[nt],Bt[nt],te):M[nt];x?(C.copy(P.normals[K]).multiplyScalar(I.x),T.copy(P.binormals[K]).multiplyScalar(I.y),R.copy(v[K]).add(C).add(T),rt(R.x,R.y,R.z)):rt(I.x,I.y,u/h*K)}for(let K=g-1;K>=0;K--){const nt=K/g,I=f*Math.cos(nt*Math.PI/2),Ct=m*Math.sin(nt*Math.PI/2)+_;for(let j=0,xt=V.length;j<xt;j++){const at=Z(V[j],ot[j],Ct);rt(at.x,at.y,u+I)}for(let j=0,xt=L.length;j<xt;j++){const at=L[j];Mt=pt[j];for(let Pt=0,gt=at.length;Pt<gt;Pt++){const A=Z(at[Pt],Mt[Pt],Ct);x?rt(A.x,A.y+v[h-1].y,v[h-1].x+I):rt(A.x,A.y,u+I)}}}Y(),it();function Y(){const K=i.length/3;if(d){let nt=0,I=H*nt;for(let Ct=0;Ct<et;Ct++){const j=O[Ct];It(j[2]+I,j[1]+I,j[0]+I)}nt=h+g*2,I=H*nt;for(let Ct=0;Ct<et;Ct++){const j=O[Ct];It(j[0]+I,j[1]+I,j[2]+I)}}else{for(let nt=0;nt<et;nt++){const I=O[nt];It(I[2],I[1],I[0])}for(let nt=0;nt<et;nt++){const I=O[nt];It(I[0]+H*h,I[1]+H*h,I[2]+H*h)}}n.addGroup(K,i.length/3-K,0)}function it(){const K=i.length/3;let nt=0;St(V,nt),nt+=V.length;for(let I=0,Ct=L.length;I<Ct;I++){const j=L[I];St(j,nt),nt+=j.length}n.addGroup(K,i.length/3-K,1)}function St(K,nt){let I=K.length;for(;--I>=0;){const Ct=I;let j=I-1;j<0&&(j=K.length-1);for(let xt=0,at=h+g*2;xt<at;xt++){const Pt=H*xt,gt=H*(xt+1),A=nt+Ct+Pt,S=nt+j+Pt,F=nt+j+gt,X=nt+Ct+gt;Ft(A,S,F,X)}}}function rt(K,nt,I){l.push(K),l.push(nt),l.push(I)}function It(K,nt,I){Dt(K),Dt(nt),Dt(I);const Ct=i.length/3,j=y.generateTopUV(n,i,Ct-3,Ct-2,Ct-1);Jt(j[0]),Jt(j[1]),Jt(j[2])}function Ft(K,nt,I,Ct){Dt(K),Dt(nt),Dt(Ct),Dt(nt),Dt(I),Dt(Ct);const j=i.length/3,xt=y.generateSideWallUV(n,i,j-6,j-3,j-2,j-1);Jt(xt[0]),Jt(xt[1]),Jt(xt[3]),Jt(xt[1]),Jt(xt[2]),Jt(xt[3])}function Dt(K){i.push(l[K*3+0]),i.push(l[K*3+1]),i.push(l[K*3+2])}function Jt(K){r.push(K.x),r.push(K.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return H0(e,n,t)}static fromJSON(t,e){const n=[];for(let r=0,a=t.shapes.length;r<a;r++){const o=e[t.shapes[r]];n.push(o)}const i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new $r[i.type]().fromJSON(i)),new vl(n,t.options)}}const V0={generateTopUV:function(s,t,e,n,i){const r=t[e*3],a=t[e*3+1],o=t[n*3],l=t[n*3+1],c=t[i*3],h=t[i*3+1];return[new $(r,a),new $(o,l),new $(c,h)]},generateSideWallUV:function(s,t,e,n,i,r){const a=t[e*3],o=t[e*3+1],l=t[e*3+2],c=t[n*3],h=t[n*3+1],u=t[n*3+2],d=t[i*3],f=t[i*3+1],m=t[i*3+2],_=t[r*3],g=t[r*3+1],p=t[r*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new $(a,1-l),new $(c,1-u),new $(d,1-m),new $(_,1-p)]:[new $(o,1-l),new $(h,1-u),new $(f,1-m),new $(g,1-p)]}};function H0(s,t,e){if(e.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];e.shapes.push(r.uuid)}else e.shapes.push(s.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}class yl extends xi{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new yl(t.radius,t.detail)}}class ha extends xi{constructor(t=1,e=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new ha(t.radius,t.detail)}}class Ml extends Xt{constructor(t=.5,e=1,n=32,i=1,r=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],l=[],c=[],h=[];let u=t;const d=(e-t)/i,f=new w,m=new $;for(let _=0;_<=i;_++){for(let g=0;g<=n;g++){const p=r+g/n*a;f.x=u*Math.cos(p),f.y=u*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),m.x=(f.x/e+1)/2,m.y=(f.y/e+1)/2,h.push(m.x,m.y)}u+=d}for(let _=0;_<i;_++){const g=_*(n+1);for(let p=0;p<n;p++){const y=p+g,v=y,x=y+n+1,P=y+n+2,T=y+1;o.push(v,x,T),o.push(x,P,T)}}this.setIndex(o),this.setAttribute("position",new bt(l,3)),this.setAttribute("normal",new bt(c,3)),this.setAttribute("uv",new bt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ml(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Sl extends Xt{constructor(t=new Ji([new $(0,.5),new $(-.5,-.5),new $(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],a=[];let o=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new bt(i,3)),this.setAttribute("normal",new bt(r,3)),this.setAttribute("uv",new bt(a,2));function c(h){const u=i.length/3,d=h.extractPoints(e);let f=d.shape;const m=d.holes;An.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,p=m.length;g<p;g++){const y=m[g];An.isClockWise(y)===!0&&(m[g]=y.reverse())}const _=An.triangulateShape(f,m);for(let g=0,p=m.length;g<p;g++){const y=m[g];f=f.concat(y)}for(let g=0,p=f.length;g<p;g++){const y=f[g];i.push(y.x,y.y,0),r.push(0,0,1),a.push(y.x,y.y)}for(let g=0,p=_.length;g<p;g++){const y=_[g],v=y[0]+u,x=y[1]+u,P=y[2]+u;n.push(v,x,P),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return G0(e,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const a=e[t.shapes[i]];n.push(a)}return new Sl(n,t.curveSegments)}}function G0(s,t){if(t.shapes=[],Array.isArray(s))for(let e=0,n=s.length;e<n;e++){const i=s[e];t.shapes.push(i.uuid)}else t.shapes.push(s.uuid);return t}class ua extends Xt{constructor(t=1,e=32,n=16,i=0,r=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],u=new w,d=new w,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const y=[],v=p/n;let x=0;p===0&&a===0?x=.5/e:p===n&&l===Math.PI&&(x=-.5/e);for(let P=0;P<=e;P++){const T=P/e;u.x=-t*Math.cos(i+T*r)*Math.sin(a+v*o),u.y=t*Math.cos(a+v*o),u.z=t*Math.sin(i+T*r)*Math.sin(a+v*o),m.push(u.x,u.y,u.z),d.copy(u).normalize(),_.push(d.x,d.y,d.z),g.push(T+x,1-v),y.push(c++)}h.push(y)}for(let p=0;p<n;p++)for(let y=0;y<e;y++){const v=h[p][y+1],x=h[p][y],P=h[p+1][y],T=h[p+1][y+1];(p!==0||a>0)&&f.push(v,x,T),(p!==n-1||l<Math.PI)&&f.push(x,P,T)}this.setIndex(f),this.setAttribute("position",new bt(m,3)),this.setAttribute("normal",new bt(_,3)),this.setAttribute("uv",new bt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ua(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class bl extends xi{constructor(t=1,e=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bl(t.radius,t.detail)}}class El extends Xt{constructor(t=1,e=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],h=new w,u=new w,d=new w;for(let f=0;f<=n;f++)for(let m=0;m<=i;m++){const _=m/i*r,g=f/n*Math.PI*2;u.x=(t+e*Math.cos(g))*Math.cos(_),u.y=(t+e*Math.cos(g))*Math.sin(_),u.z=e*Math.sin(g),o.push(u.x,u.y,u.z),h.x=t*Math.cos(_),h.y=t*Math.sin(_),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let m=1;m<=i;m++){const _=(i+1)*f+m-1,g=(i+1)*(f-1)+m-1,p=(i+1)*(f-1)+m,y=(i+1)*f+m;a.push(_,g,y),a.push(g,p,y)}this.setIndex(a),this.setAttribute("position",new bt(o,3)),this.setAttribute("normal",new bt(l,3)),this.setAttribute("uv",new bt(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new El(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Tl extends Xt{constructor(t=1,e=.4,n=64,i=8,r=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],h=[],u=new w,d=new w,f=new w,m=new w,_=new w,g=new w,p=new w;for(let v=0;v<=n;++v){const x=v/n*r*Math.PI*2;y(x,r,a,t,f),y(x+.01,r,a,t,m),g.subVectors(m,f),p.addVectors(m,f),_.crossVectors(g,p),p.crossVectors(_,g),_.normalize(),p.normalize();for(let P=0;P<=i;++P){const T=P/i*Math.PI*2,C=-e*Math.cos(T),R=e*Math.sin(T);u.x=f.x+(C*p.x+R*_.x),u.y=f.y+(C*p.y+R*_.y),u.z=f.z+(C*p.z+R*_.z),l.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),h.push(v/n),h.push(P/i)}}for(let v=1;v<=n;v++)for(let x=1;x<=i;x++){const P=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),C=(i+1)*v+x,R=(i+1)*(v-1)+x;o.push(P,T,R),o.push(T,C,R)}this.setIndex(o),this.setAttribute("position",new bt(l,3)),this.setAttribute("normal",new bt(c,3)),this.setAttribute("uv",new bt(h,2));function y(v,x,P,T,C){const R=Math.cos(v),b=Math.sin(v),M=P/x*v,L=Math.cos(M);C.x=T*(2+L)*.5*R,C.y=T*(2+L)*b*.5,C.z=T*Math.sin(M)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Tl(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Al extends Xt{constructor(t=new cu(new w(-1,-1,0),new w(-1,1,0),new w(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new w,l=new w,c=new $;let h=new w;const u=[],d=[],f=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new bt(u,3)),this.setAttribute("normal",new bt(d,3)),this.setAttribute("uv",new bt(f,2));function _(){for(let v=0;v<e;v++)g(v);g(r===!1?e:0),y(),p()}function g(v){h=t.getPointAt(v/e,h);const x=a.normals[v],P=a.binormals[v];for(let T=0;T<=i;T++){const C=T/i*Math.PI*2,R=Math.sin(C),b=-Math.cos(C);l.x=b*x.x+R*P.x,l.y=b*x.y+R*P.y,l.z=b*x.z+R*P.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,u.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=e;v++)for(let x=1;x<=i;x++){const P=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),C=(i+1)*v+x,R=(i+1)*(v-1)+x;m.push(P,T,R),m.push(T,C,R)}}function y(){for(let v=0;v<=e;v++)for(let x=0;x<=i;x++)c.x=v/e,c.y=x/i,f.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Al(new $r[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class W0 extends Xt{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){const e=[],n=new Set,i=new w,r=new w;if(t.index!==null){const a=t.attributes.position,o=t.index;let l=t.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,f=u.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),y=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),r.fromBufferAttribute(a,y),ah(i,r,n)===!0&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const a=t.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,u=3*o+(c+1)%3;i.fromBufferAttribute(a,h),r.fromBufferAttribute(a,u),ah(i,r,n)===!0&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new bt(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function ah(s,t,e){const n=`${s.x},${s.y},${s.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${s.x},${s.y},${s.z}`;return e.has(n)===!0||e.has(i)===!0?!1:(e.add(n),e.add(i),!0)}var oh=Object.freeze({__proto__:null,BoxGeometry:is,CapsuleGeometry:ml,CircleGeometry:gl,ConeGeometry:_l,CylinderGeometry:zs,DodecahedronGeometry:xl,EdgesGeometry:b0,ExtrudeGeometry:vl,IcosahedronGeometry:yl,LatheGeometry:la,OctahedronGeometry:ha,PlaneGeometry:Bs,PolyhedronGeometry:xi,RingGeometry:Ml,ShapeGeometry:Sl,SphereGeometry:ua,TetrahedronGeometry:bl,TorusGeometry:El,TorusKnotGeometry:Tl,TubeGeometry:Al,WireframeGeometry:W0});class X0 extends Le{static get type(){return"ShadowMaterial"}constructor(t){super(),this.isShadowMaterial=!0,this.color=new mt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class q0 extends ln{static get type(){return"RawShaderMaterial"}constructor(t){super(t),this.isRawShaderMaterial=!0}}class pu extends Le{static get type(){return"MeshStandardMaterial"}constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new mt(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 mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ke,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Y0 extends pu{static get type(){return"MeshPhysicalMaterial"}constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new $(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return fe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new mt(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 mt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new mt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Z0 extends Le{static get type(){return"MeshPhongMaterial"}constructor(t){super(),this.isMeshPhongMaterial=!0,this.color=new mt(16777215),this.specular=new mt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ke,this.combine=na,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class J0 extends Le{static get type(){return"MeshToonMaterial"}constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new mt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class $0 extends Le{static get type(){return"MeshNormalMaterial"}constructor(t){super(),this.isMeshNormalMaterial=!0,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class K0 extends Le{static get type(){return"MeshLambertMaterial"}constructor(t){super(),this.isMeshLambertMaterial=!0,this.color=new mt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ke,this.combine=na,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Q0 extends Le{static get type(){return"MeshMatcapMaterial"}constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new mt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gi,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class j0 extends ze{static get type(){return"LineDashedMaterial"}constructor(t){super(),this.isLineDashedMaterial=!0,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function ui(s,t,e){return!s||!e&&s.constructor===t?s:typeof t.BYTES_PER_ELEMENT=="number"?new t(s):Array.prototype.slice.call(s)}function mu(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function gu(s){function t(i,r){return s[i]-s[r]}const e=s.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function qo(s,t,e){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const o=e[r]*t;for(let l=0;l!==t;++l)i[a++]=s[o+l]}return i}function wl(s,t,e,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(t.push(r.time),e.push.apply(e,a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(t.push(r.time),a.toArray(e,e.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(t.push(r.time),e.push(a)),r=s[i++];while(r!==void 0)}function tx(s,t,e,n,i=30){const r=s.clone();r.name=t;const a=[];for(let l=0;l<r.tracks.length;++l){const c=r.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const m=c.times[f]*i;if(!(m<e||m>=n)){u.push(c.times[f]);for(let _=0;_<h;++_)d.push(c.values[f*h+_])}}u.length!==0&&(c.times=ui(u,c.times.constructor),c.values=ui(d,c.values.constructor),a.push(c))}r.tracks=a;let o=1/0;for(let l=0;l<r.tracks.length;++l)o>r.tracks[l].times[0]&&(o=r.tracks[l].times[0]);for(let l=0;l<r.tracks.length;++l)r.tracks[l].shift(-1*o);return r.resetDuration(),r}function ex(s,t=0,e=s,n=30){n<=0&&(n=30);const i=e.tracks.length,r=t/n;for(let a=0;a<i;++a){const o=e.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=s.tracks.find(function(p){return p.name===o.name&&p.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const m=o.times.length-1;let _;if(r<=o.times[0]){const p=h,y=u-h;_=o.values.slice(p,y)}else if(r>=o.times[m]){const p=m*u+h,y=p+u-h;_=o.values.slice(p,y)}else{const p=o.createInterpolant(),y=h,v=u-h;p.evaluate(r),_=p.resultBuffer.slice(y,v)}l==="quaternion"&&new Ye().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p<g;++p){const y=p*f+d;if(l==="quaternion")Ye.multiplyQuaternionsFlat(c.values,y,_,0,c.values,y);else{const v=f-d*2;for(let x=0;x<v;++x)c.values[y+x]-=_[x]}}}return s.blendMode=kh,s}const Hv={convertArray:ui,isTypedArray:mu,getKeyframeOrder:gu,sortedArray:qo,flattenJSON:wl,subclip:tx,makeClipAdditive:ex};class da{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let a;n:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=e[++n],t<i)break e}a=e.length;break n}if(!(t>=r)){const o=e[1];t<o&&(n=2,r=o);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,r=e[--n-1],t>=r)break e}a=n,n=0;break n}break t}for(;n<a;){const o=n+a>>>1;t<e[o]?a=o:n=o+1}if(i=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let a=0;a!==i;++a)e[a]=n[r+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class nx extends da{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ki,endingEnd:ki}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,a=t+1,o=i[r],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Vi:r=t,o=2*e-n;break;case Xr:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Vi:a=t,l=2*n-e;break;case Xr:a=1,l=n+i[1]-i[0];break;default:a=t-1,l=e}const c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-e)/(i-e),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,y=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,v=(-1-f)*g+(1.5+f)*_+.5*m,x=f*g-f*_;for(let P=0;P!==o;++P)r[P]=p*a[h+P]+y*a[c+P]+v*a[l+P]+x*a[u+P];return r}}class _u extends da{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(i-e),u=1-h;for(let d=0;d!==o;++d)r[d]=a[c+d]*u+a[l+d]*h;return r}}class ix extends da{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class hn{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ui(e,this.TimeBufferType),this.values=ui(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:ui(t.times,Array),values:ui(t.values,Array)};const i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new ix(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new _u(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new nx(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Wr:e=this.InterpolantFactoryMethodDiscrete;break;case ko:e=this.InterpolantFactoryMethodLinear;break;case ma:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Wr;case this.InterpolantFactoryMethodLinear:return ko;case this.InterpolantFactoryMethodSmooth:return ma}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<t;)++r;for(;a!==-1&&n[a]>e;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==r;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(i!==void 0&&mu(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===ma,r=t.length-1;let a=1;for(let o=1;o<r;++o){let l=!1;const c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const _=e[u+m];if(_!==e[d+m]||_!==e[f+m]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)e[d+f]=e[u+f]}++a}}if(r>0){t[a]=t[r];for(let o=r*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}hn.prototype.TimeBufferType=Float32Array;hn.prototype.ValueBufferType=Float32Array;hn.prototype.DefaultInterpolation=ko;class rs extends hn{constructor(t,e,n){super(t,e,n)}}rs.prototype.ValueTypeName="bool";rs.prototype.ValueBufferType=Array;rs.prototype.DefaultInterpolation=Wr;rs.prototype.InterpolantFactoryMethodLinear=void 0;rs.prototype.InterpolantFactoryMethodSmooth=void 0;class xu extends hn{}xu.prototype.ValueTypeName="color";class Qr extends hn{}Qr.prototype.ValueTypeName="number";class sx extends da{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(i-e);let c=t*o;for(let h=c+o;c!==h;c+=4)Ye.slerpFlat(r,0,a,c-o,a,c,l);return r}}class fa extends hn{InterpolantFactoryMethodLinear(t){return new sx(this.times,this.values,this.getValueSize(),t)}}fa.prototype.ValueTypeName="quaternion";fa.prototype.InterpolantFactoryMethodSmooth=void 0;class as extends hn{constructor(t,e,n){super(t,e,n)}}as.prototype.ValueTypeName="string";as.prototype.ValueBufferType=Array;as.prototype.DefaultInterpolation=Wr;as.prototype.InterpolantFactoryMethodLinear=void 0;as.prototype.InterpolantFactoryMethodSmooth=void 0;class jr extends hn{}jr.prototype.ValueTypeName="vector";class ta{constructor(t="",e=-1,n=[],i=el){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=qe(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(ax(n[a]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,a=n.length;r!==a;++r)e.push(hn.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,a=[];for(let o=0;o<r;o++){let l=[],c=[];l.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);const h=gu(l);l=qo(l,1,h),c=qo(c,1,h),!i&&l[0]===0&&(l.push(r),c.push(c[0])),a.push(new Qr(".morphTargetInfluences["+e[o].name+"]",l,c).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const i=t;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,l=t.length;o<l;o++){const c=t[o],h=c.name.match(r);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];wl(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],r=t.name||"default",a=t.fps||30,o=t.blendMode;let l=t.length||-1;const c=t.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let y=0;y!==d[m].morphTargets.length;++y){const v=d[m];g.push(v.time),p.push(v.morphTarget===_?1:0)}i.push(new Qr(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+e[u].name+"]";n(jr,f+".position",d,"pos",i),n(fa,f+".quaternion",d,"rot",i),n(jr,f+".scale",d,"scl",i)}}return i.length===0?null:new this(r,l,i,o)}resetDuration(){const t=this.tracks;let e=0;for(let n=0,i=t.length;n!==i;++n){const r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function rx(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Qr;case"vector":case"vector2":case"vector3":case"vector4":return jr;case"color":return xu;case"quaternion":return fa;case"bool":case"boolean":return rs;case"string":return as}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function ax(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=rx(s.type);if(s.times===void 0){const e=[],n=[];wl(s.keys,e,n,"value"),s.times=e,s.values=n}return t.parse!==void 0?t.parse(s):new t(s.name,s.times,s.values,s.interpolation)}const kn={enabled:!1,files:{},add:function(s,t){this.enabled!==!1&&(this.files[s]=t)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class vu{constructor(t,e,n){const i=this;let r=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null}}}const ox=new vu;class Ze{constructor(t){this.manager=t!==void 0?t:ox,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(i,r){n.load(t,i,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ze.DEFAULT_MATERIAL_NAME="__DEFAULT";const xn={};class lx extends Error{constructor(t,e){super(t),this.response=e}}class qn extends Ze{constructor(t){super(t)}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=kn.get(t);if(r!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(xn[t]!==void 0){xn[t].push({onLoad:e,onProgress:n,onError:i});return}xn[t]=[],xn[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=xn[t],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){y();function y(){u.read().then(({done:v,value:x})=>{if(v)p.close();else{_+=x.byteLength;const P=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let T=0,C=h.length;T<C;T++){const R=h[T];R.onProgress&&R.onProgress(P)}p.enqueue(x),y()}},v=>{p.error(v)})}}});return new Response(g)}else throw new lx(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{kn.add(t,c);const h=xn[t];delete xn[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=xn[t];if(h===void 0)throw this.manager.itemError(t),c;delete xn[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Gv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=new qn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),r.manager.itemError(t)}},n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=ta.parse(t[n]);e.push(i)}return e}}class Wv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=[],o=new dl,l=new qn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(r.withCredentials);let c=0;function h(u){l.load(t[u],function(d){const f=r.parse(d,!0);a[u]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=Me),o.image=a,o.format=f.format,o.needsUpdate=!0,e&&e(o))},n,i)}if(Array.isArray(t))for(let u=0,d=t.length;u<d;++u)h(u);else l.load(t,function(u){const d=r.parse(u,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let m=0;m<f;m++){a[m]={mipmaps:[]};for(let _=0;_<d.mipmapCount;_++)a[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+_]),a[m].format=d.format,a[m].width=d.width,a[m].height=d.height}o.image=a}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=Me),o.format=d.format,o.needsUpdate=!0,e&&e(o)},n,i);return o}}class ea extends Ze{constructor(t){super(t)}load(t,e,n,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=kn.get(t);if(a!==void 0)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;const o=Is("img");function l(){h(),kn.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(u){h(),i&&i(u),r.manager.itemError(t),r.manager.itemEnd(t)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class Xv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=new ra;r.colorSpace=Ge;const a=new ea(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(t[c],function(h){r.images[c]=h,o++,o===6&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}for(let c=0;c<t.length;++c)l(c);return r}}class qv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=new Tn,o=new qn(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,function(l){let c;try{c=r.parse(l)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:sn,a.wrapT=c.wrapT!==void 0?c.wrapT:sn,a.magFilter=c.magFilter!==void 0?c.magFilter:Me,a.minFilter=c.minFilter!==void 0?c.minFilter:Me,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Sn),c.mipmapCount===1&&(a.minFilter=Me),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,e&&e(a,c)},n,i),a}}class Yv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=new me,a=new ea(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(o){r.image=o,r.needsUpdate=!0,e!==void 0&&e(r)},n,i),r}}class vi extends jt{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new mt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}class cx extends vi{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(jt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new mt(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const to=new Ut,lh=new w,ch=new w;class Cl{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $(512,512),this.map=null,this.mapPass=null,this.matrix=new Ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new aa,this._frameExtents=new $(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;lh.setFromMatrixPosition(t.matrixWorld),e.position.copy(lh),ch.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(ch),e.updateMatrixWorld(),to.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(to),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(to)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class hx extends Cl{constructor(){super(new Ae(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=ji*2*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;(n!==e.fov||i!==e.aspect||r!==e.far)&&(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class ux extends vi{constructor(t,e,n=0,i=Math.PI/3,r=0,a=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(jt.DEFAULT_UP),this.updateMatrix(),this.target=new jt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new hx}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const hh=new Ut,ys=new w,eo=new w;class dx extends Cl{constructor(){super(new Ae(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new $(4,2),this._viewportCount=6,this._viewports=[new Qt(2,1,1,1),new Qt(0,1,1,1),new Qt(3,1,1,1),new Qt(1,1,1,1),new Qt(3,0,1,1),new Qt(1,0,1,1)],this._cubeDirections=[new w(1,0,0),new w(-1,0,0),new w(0,0,1),new w(0,0,-1),new w(0,1,0),new w(0,-1,0)],this._cubeUps=[new w(0,1,0),new w(0,1,0),new w(0,1,0),new w(0,1,0),new w(0,0,1),new w(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),ys.setFromMatrixPosition(t.matrixWorld),n.position.copy(ys),eo.copy(n.position),eo.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(eo),n.updateMatrixWorld(),i.makeTranslation(-ys.x,-ys.y,-ys.z),hh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hh)}}class fx extends vi{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new dx}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class px extends Cl{constructor(){super(new al(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class mx extends vi{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(jt.DEFAULT_UP),this.updateMatrix(),this.target=new jt,this.shadow=new px}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class gx extends vi{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class _x extends vi{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class xx{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new w)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],1.092548*(n*i)),e.addScaledVector(a[5],1.092548*(i*r)),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],1.092548*(n*r)),e.addScaledVector(a[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],2*.511664*i),e.addScaledVector(a[2],2*.511664*r),e.addScaledVector(a[3],2*.511664*n),e.addScaledVector(a[4],2*.429043*n*i),e.addScaledVector(a[5],2*.429043*i*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],2*.429043*n*r),e.addScaledVector(a[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+i*3);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+i*3);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class vx extends vi{constructor(t=new xx,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class Rl extends Ze{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,a=new qn(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),r.manager.itemError(t)}},n,i)}parse(t){const e=this.textures;function n(r){return e[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),e[r]}const i=this.createMaterialFromType(t.type);if(t.uuid!==void 0&&(i.uuid=t.uuid),t.name!==void 0&&(i.name=t.name),t.color!==void 0&&i.color!==void 0&&i.color.setHex(t.color),t.roughness!==void 0&&(i.roughness=t.roughness),t.metalness!==void 0&&(i.metalness=t.metalness),t.sheen!==void 0&&(i.sheen=t.sheen),t.sheenColor!==void 0&&(i.sheenColor=new mt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(i.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(t.emissive),t.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(t.specular),t.specularIntensity!==void 0&&(i.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(i.shininess=t.shininess),t.clearcoat!==void 0&&(i.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(i.dispersion=t.dispersion),t.iridescence!==void 0&&(i.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(i.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(i.transmission=t.transmission),t.thickness!==void 0&&(i.thickness=t.thickness),t.attenuationDistance!==void 0&&(i.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(i.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(i.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(i.fog=t.fog),t.flatShading!==void 0&&(i.flatShading=t.flatShading),t.blending!==void 0&&(i.blending=t.blending),t.combine!==void 0&&(i.combine=t.combine),t.side!==void 0&&(i.side=t.side),t.shadowSide!==void 0&&(i.shadowSide=t.shadowSide),t.opacity!==void 0&&(i.opacity=t.opacity),t.transparent!==void 0&&(i.transparent=t.transparent),t.alphaTest!==void 0&&(i.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(i.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(i.depthFunc=t.depthFunc),t.depthTest!==void 0&&(i.depthTest=t.depthTest),t.depthWrite!==void 0&&(i.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(i.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(i.blendSrc=t.blendSrc),t.blendDst!==void 0&&(i.blendDst=t.blendDst),t.blendEquation!==void 0&&(i.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(i.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(i.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(i.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(i.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(i.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(i.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(i.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(i.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(i.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(i.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(i.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(i.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(i.rotation=t.rotation),t.linewidth!==void 0&&(i.linewidth=t.linewidth),t.dashSize!==void 0&&(i.dashSize=t.dashSize),t.gapSize!==void 0&&(i.gapSize=t.gapSize),t.scale!==void 0&&(i.scale=t.scale),t.polygonOffset!==void 0&&(i.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(i.dithering=t.dithering),t.alphaToCoverage!==void 0&&(i.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(i.forceSinglePass=t.forceSinglePass),t.visible!==void 0&&(i.visible=t.visible),t.toneMapped!==void 0&&(i.toneMapped=t.toneMapped),t.userData!==void 0&&(i.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const r in t.uniforms){const a=t.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=new mt().setHex(a.value);break;case"v2":i.uniforms[r].value=new $().fromArray(a.value);break;case"v3":i.uniforms[r].value=new w().fromArray(a.value);break;case"v4":i.uniforms[r].value=new Qt().fromArray(a.value);break;case"m3":i.uniforms[r].value=new zt().fromArray(a.value);break;case"m4":i.uniforms[r].value=new Ut().fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(i.glslVersion=t.glslVersion),t.extensions!==void 0)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(t.lights!==void 0&&(i.lights=t.lights),t.clipping!==void 0&&(i.clipping=t.clipping),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let r=t.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new $().fromArray(r)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(i.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapRotation!==void 0&&i.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new $().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(i.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(i.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(i.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(i.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return Rl.createMaterialFromType(t)}static createMaterialFromType(t){const e={ShadowMaterial:X0,SpriteMaterial:nu,RawShaderMaterial:q0,ShaderMaterial:ln,PointsMaterial:ru,MeshPhysicalMaterial:Y0,MeshStandardMaterial:pu,MeshPhongMaterial:Z0,MeshToonMaterial:J0,MeshNormalMaterial:$0,MeshLambertMaterial:K0,MeshDepthMaterial:tu,MeshDistanceMaterial:eu,MeshBasicMaterial:_i,MeshMatcapMaterial:Q0,LineDashedMaterial:j0,LineBasicMaterial:ze,Material:Le};return new e[t]}}class uh{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch{return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class yx extends Xt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class Mx extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=new qn(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),r.manager.itemError(t)}},n,i)}parse(t){const e={},n={};function i(f,m){if(e[m]!==void 0)return e[m];const g=f.interleavedBuffers[m],p=r(f,g.buffer),y=Hi(g.type,p),v=new hl(y,g.stride);return v.uuid=g.uuid,e[m]=v,v}function r(f,m){if(n[m]!==void 0)return n[m];const g=f.arrayBuffers[m],p=new Uint32Array(g).buffer;return n[m]=p,p}const a=t.isInstancedBufferGeometry?new yx:new Xt,o=t.data.index;if(o!==void 0){const f=Hi(o.type,o.array);a.setIndex(new re(f,1))}const l=t.data.attributes;for(const f in l){const m=l[f];let _;if(m.isInterleavedBufferAttribute){const g=i(t.data,m.data);_=new es(g,m.itemSize,m.offset,m.normalized)}else{const g=Hi(m.type,m.array),p=m.isInstancedBufferAttribute?Ps:re;_=new p(g,m.itemSize,m.normalized)}m.name!==void 0&&(_.name=m.name),m.usage!==void 0&&_.setUsage(m.usage),a.setAttribute(f,_)}const c=t.data.morphAttributes;if(c)for(const f in c){const m=c[f],_=[];for(let g=0,p=m.length;g<p;g++){const y=m[g];let v;if(y.isInterleavedBufferAttribute){const x=i(t.data,y.data);v=new es(x,y.itemSize,y.offset,y.normalized)}else{const x=Hi(y.type,y.array);v=new re(x,y.itemSize,y.normalized)}y.name!==void 0&&(v.name=y.name),_.push(v)}a.morphAttributes[f]=_}t.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const u=t.data.groups||t.data.drawcalls||t.data.offsets;if(u!==void 0)for(let f=0,m=u.length;f!==m;++f){const _=u[f];a.addGroup(_.start,_.count,_.materialIndex)}const d=t.data.boundingSphere;if(d!==void 0){const f=new w;d.center!==void 0&&f.fromArray(d.center),a.boundingSphere=new Pe(f,d.radius)}return t.name&&(a.name=t.name),t.userData&&(a.userData=t.userData),a}}class Zv extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=this.path===""?uh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const o=new qn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(l){let c=null;try{c=JSON.parse(l)}catch(u){i!==void 0&&i(u),console.error("THREE:ObjectLoader: Can't parse "+t+".",u.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+t)),console.error("THREE.ObjectLoader: Can't load "+t);return}r.parse(c,e)},n,i)}async loadAsync(t,e){const n=this,i=this.path===""?uh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const r=new qn(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const a=await r.loadAsync(t,e),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),a=this.parseImages(t.images,function(){e!==void 0&&e(c)}),o=this.parseTextures(t.textures,a),l=this.parseMaterials(t.materials,o),c=this.parseObject(t.object,r,l,o,n),h=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),e!==void 0){let u=!1;for(const d in a)if(a[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&e(c)}return c}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,i,o,a,e),c=this.parseSkeletons(t.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(t){const e={};if(t!==void 0)for(let n=0,i=t.length;n<i;n++){const r=new Ji().fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),t!==void 0)for(let r=0,a=t.length;r<a;r++){const o=new ul().fromJSON(t[r],i);n[o.uuid]=o}return n}parseGeometries(t,e){const n={};if(t!==void 0){const i=new Mx;for(let r=0,a=t.length;r<a;r++){let o;const l=t[r];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in oh?o=oh[l.type].fromJSON(l,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(t,e){const n={},i={};if(t!==void 0){const r=new Rl;r.setTextures(e);for(let a=0,o=t.length;a<o;a++){const l=t[a];n[l.uuid]===void 0&&(n[l.uuid]=r.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(t){const e={};if(t!==void 0)for(let n=0;n<t.length;n++){const i=t[n],r=ta.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function a(l){return n.manager.itemStart(l),r.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:Hi(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){const l=new vu(e);r=new ea(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,h=t.length;c<h;c++){const u=t[c],d=u.url;if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m],p=o(g);p!==null&&(p instanceof HTMLImageElement?f.push(p):f.push(new Tn(p.data,p.width,p.height)))}i[u.uuid]=new Gi(f)}else{const f=o(u.url);i[u.uuid]=new Gi(f)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:e.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:Hi(a.type,a.data),width:a.width,height:a.height}:null}if(t!==void 0&&t.length>0){i=new ea(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=t.length;a<o;a++){const l=t[a],c=l.url;if(Array.isArray(c)){const h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u],m=await r(f);m!==null&&(m instanceof HTMLImageElement?h.push(m):h.push(new Tn(m.data,m.width,m.height)))}n[l.uuid]=new Gi(h)}else{const h=await r(l.url);n[l.uuid]=new Gi(h)}}}return n}parseTextures(t,e){function n(r,a){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),a[r])}const i={};if(t!==void 0)for(let r=0,a=t.length;r<a;r++){const o=t[r];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),e[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=e[o.image],c=l.data;let h;Array.isArray(c)?(h=new ra,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new Tn:h=new me,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,Sx)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],dh),h.wrapT=n(o.wrap[1],dh)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,fh)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,fh)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),i[o.uuid]=h}return i}parseObject(t,e,n,i,r){let a;function o(d){return e[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),e[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m];n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let h,u;switch(t.type){case"Scene":a=new Z_,t.background!==void 0&&(Number.isInteger(t.background)?a.background=new mt(t.background):a.background=c(t.background)),t.environment!==void 0&&(a.environment=c(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new cl(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new ll(t.fog.color,t.fog.density)),t.fog.name!==""&&(a.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(a.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(a.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&a.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":a=new Ae(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new al(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(a.zoom=t.zoom),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"AmbientLight":a=new gx(t.color,t.intensity);break;case"DirectionalLight":a=new mx(t.color,t.intensity),a.target=t.target||"";break;case"PointLight":a=new fx(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":a=new _x(t.color,t.intensity,t.width,t.height);break;case"SpotLight":a=new ux(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),a.target=t.target||"";break;case"HemisphereLight":a=new cx(t.color,t.groundColor,t.intensity);break;case"LightProbe":a=new vx().fromJSON(t);break;case"SkinnedMesh":h=o(t.geometry),u=l(t.material),a=new Q_(h,u),t.bindMode!==void 0&&(a.bindMode=t.bindMode),t.bindMatrix!==void 0&&a.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(a.skeleton=t.skeleton);break;case"Mesh":h=o(t.geometry),u=l(t.material),a=new _e(h,u);break;case"InstancedMesh":h=o(t.geometry),u=l(t.material);const d=t.count,f=t.instanceMatrix,m=t.instanceColor;a=new e0(h,u,d),a.instanceMatrix=new Ps(new Float32Array(f.array),16),m!==void 0&&(a.instanceColor=new Ps(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":h=o(t.geometry),u=l(t.material),a=new l0(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,u),a.geometry=h,a.perObjectFrustumCulled=t.perObjectFrustumCulled,a.sortObjects=t.sortObjects,a._drawRanges=t.drawRanges,a._reservedRanges=t.reservedRanges,a._visibility=t.visibility,a._active=t.active,a._bounds=t.bounds.map(_=>{const g=new Be;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const p=new Pe;return p.radius=_.sphereRadius,p.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:p}}),a._maxInstanceCount=t.maxInstanceCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._geometryCount=t.geometryCount,a._matricesTexture=c(t.matricesTexture.uuid),t.colorsTexture!==void 0&&(a._colorsTexture=c(t.colorsTexture.uuid));break;case"LOD":a=new $_;break;case"Line":a=new pi(o(t.geometry),l(t.material));break;case"LineLoop":a=new c0(o(t.geometry),l(t.material));break;case"LineSegments":a=new Rn(o(t.geometry),l(t.material));break;case"PointCloud":case"Points":a=new h0(o(t.geometry),l(t.material));break;case"Sprite":a=new J_(l(t.material));break;case"Group":a=new Ts;break;case"Bone":a=new su;break;default:a=new jt}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(a.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){const d=t.children;for(let f=0;f<d.length;f++)a.add(this.parseObject(d[f],e,n,i,r))}if(t.animations!==void 0){const d=t.animations;for(let f=0;f<d.length;f++){const m=d[f];a.animations.push(r[m])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(a.autoUpdate=t.autoUpdate);const d=t.levels;for(let f=0;f<d.length;f++){const m=d[f],_=a.getObjectByProperty("uuid",m.object);
3828_!==void 0&&a.addLevel(_,m.distance,m.hysteresis)}}return a}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=e[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);i!==void 0?e.target=i:e.target=new jt}})}}const Sx={UVMapping:Zo,CubeReflectionMapping:Wn,CubeRefractionMapping:fi,EquirectangularReflectionMapping:kr,EquirectangularRefractionMapping:Vr,CubeUVReflectionMapping:Ns},dh={RepeatWrapping:Hr,ClampToEdgeWrapping:sn,MirroredRepeatWrapping:Gr},fh={NearestFilter:we,NearestMipmapNearestFilter:Ih,NearestMipmapLinearFilter:Ms,LinearFilter:Me,LinearMipmapNearestFilter:Dr,LinearMipmapLinearFilter:Sn};class Jv extends Ze{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=kn.get(t);if(a!==void 0){if(r.manager.itemStart(t),a.then){a.then(c=>{e&&e(c),r.manager.itemEnd(t)}
vendor: 37,135 bytes, line 3828
3828).catch(c=>{i&&i(c)});return}return setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){return kn.add(t,c),e&&e(c),r.manager.itemEnd(t),c}).catch(function(c){i&&i(c),kn.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)});kn.add(t,l),r.manager.itemStart(t)}}let Ar;class yu{static getContext(){return Ar===void 0&&(Ar=new(window.AudioContext||window.webkitAudioContext)),Ar}static setContext(t){Ar=t}}class $v extends Ze{constructor(t){super(t)}load(t,e,n,i){const r=this,a=new qn(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{const c=l.slice(0);yu.getContext().decodeAudioData(c,function(u){e(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),r.manager.itemError(t)}}}const ph=new Ut,mh=new Ut,ni=new Ut;class Kv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ae,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ae,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,ni.copy(t.projectionMatrix);const i=e.eyeSep/2,r=i*e.near/e.focus,a=e.near*Math.tan(di*e.fov*.5)/e.zoom;let o,l;mh.elements[12]=-i,ph.elements[12]=i,o=-a*e.aspect+r,l=a*e.aspect+r,ni.elements[0]=2*e.near/(l-o),ni.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ni),o=-a*e.aspect-r,l=a*e.aspect-r,ni.elements[0]=2*e.near/(l-o),ni.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ni)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(mh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(ph)}}class bx{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=gh();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function gh(){return performance.now()}const ii=new w,_h=new Ye,Ex=new w,si=new w;class Qv extends jt{constructor(){super(),this.type="AudioListener",this.context=yu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new bx}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ii,_h,Ex),si.set(0,0,-1).applyQuaternion(_h),e.positionX){const i=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(ii.x,i),e.positionY.linearRampToValueAtTime(ii.y,i),e.positionZ.linearRampToValueAtTime(ii.z,i),e.forwardX.linearRampToValueAtTime(si.x,i),e.forwardY.linearRampToValueAtTime(si.y,i),e.forwardZ.linearRampToValueAtTime(si.z,i),e.upX.linearRampToValueAtTime(n.x,i),e.upY.linearRampToValueAtTime(n.y,i),e.upZ.linearRampToValueAtTime(n.z,i)}else e.setPosition(ii.x,ii.y,ii.z),e.setOrientation(si.x,si.y,si.z,n.x,n.y,n.z)}}class Tx extends jt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(t=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const ri=new w,xh=new Ye,Ax=new w,ai=new w;class jv extends Tx{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ri,xh,Ax),ai.set(0,0,1).applyQuaternion(xh);const e=this.panner;if(e.positionX){const n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(ri.x,n),e.positionY.linearRampToValueAtTime(ri.y,n),e.positionZ.linearRampToValueAtTime(ri.z,n),e.orientationX.linearRampToValueAtTime(ai.x,n),e.orientationY.linearRampToValueAtTime(ai.y,n),e.orientationZ.linearRampToValueAtTime(ai.z,n)}else e.setPosition(ri.x,ri.y,ri.z),e.setOrientation(ai.x,ai.y,ai.z)}}class ty{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class wx{constructor(t,e,n){this.binding=t,this.valueSize=n;let i,r,a;switch(e){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=e}else{a+=e;const o=e/a;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const l=e*this._origIndex;this._mixBufferRegion(n,i,l,1-r,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,a=i;r!==a;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){Ye.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const a=this._workIndex*r;Ye.multiplyQuaternionsFlat(t,a,t,e,t,n),Ye.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,r){const a=1-i;for(let o=0;o!==r;++o){const l=e+o;t[l]=t[l]*a+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let a=0;a!==r;++a){const o=e+a;t[o]=t[o]+t[n+a]*i}}}const Il="\\[\\]\\.:\\/",Cx=new RegExp("["+Il+"]","g"),Pl="[^"+Il+"]",Rx="[^"+Il.replace("\\.","")+"]",Ix=/((?:WC+[\/:])*)/.source.replace("WC",Pl),Px=/(WCOD+)?/.source.replace("WCOD",Rx),Lx=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Pl),Dx=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Pl),Ux=new RegExp("^"+Ix+Px+Lx+Dx+"$"),Nx=["material","materials","bones","map"];class Fx{constructor(t,e,n){const i=n||Kt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class Kt{constructor(t,e,n){this.path=e,this.parsedPath=n||Kt.parseTrackName(e),this.node=Kt.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Kt.Composite(t,e,n):new Kt(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Cx,"")}static parseTrackName(t){const e=Ux.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);Nx.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===e||o.uuid===e)return o;const l=n(o.children);if(l)return l}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Kt.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}const a=t[i];if(a===void 0){const c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Kt.Composite=Fx;Kt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Kt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Kt.prototype.GetterByBindingType=[Kt.prototype._getValue_direct,Kt.prototype._getValue_array,Kt.prototype._getValue_arrayElement,Kt.prototype._getValue_toArray];Kt.prototype.SetterByBindingTypeAndVersioning=[[Kt.prototype._setValue_direct,Kt.prototype._setValue_direct_setNeedsUpdate,Kt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Kt.prototype._setValue_array,Kt.prototype._setValue_array_setNeedsUpdate,Kt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Kt.prototype._setValue_arrayElement,Kt.prototype._setValue_arrayElement_setNeedsUpdate,Kt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Kt.prototype._setValue_fromArray,Kt.prototype._setValue_fromArray_setNeedsUpdate,Kt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class ey{constructor(){this.isAnimationObjectGroup=!0,this.uuid=qe(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length;let o,l=t.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let m=e[f];if(m===void 0){m=l++,e[f]=m,t.push(d);for(let _=0,g=a;_!==g;++_)r[_].push(new Kt(d,n[_],i[_]))}else if(m<c){o=t[m];const _=--c,g=t[_];e[g.uuid]=m,t[m]=g,e[f]=_,t[_]=d;for(let p=0,y=a;p!==y;++p){const v=r[p],x=v[_];let P=v[m];v[m]=x,P===void 0&&(P=new Kt(d,n[p],i[p])),v[_]=P}}else t[m]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=e[c];if(h!==void 0&&h>=r){const u=r++,d=t[u];e[d.uuid]=h,t[h]=d,e[c]=u,t[u]=l;for(let f=0,m=i;f!==m;++f){const _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,a=t.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=e[h];if(u!==void 0)if(delete e[h],u<r){const d=--r,f=t[d],m=--a,_=t[m];e[f.uuid]=u,t[u]=f,e[_.uuid]=d,t[d]=_,t.pop();for(let g=0,p=i;g!==p;++g){const y=n[g],v=y[d],x=y[m];y[u]=v,y[d]=x,y.pop()}}else{const d=--a,f=t[d];d>0&&(e[f.uuid]=u),t[u]=f,t.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(i!==void 0)return r[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=r.length,n[t]=i,a.push(t),o.push(e),r.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new Kt(m,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){const i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=t[o];e[c]=n,a[n]=l,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Ox{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,a=r.length,o=new Array(a),l={endingStart:ki,endingEnd:ki};for(let c=0;c!==a;++c){const h=r[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=rd,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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const i=this._clip.duration,r=t._clip.duration,a=r/i,o=i/r;t.warp(1,a,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=r,l[1]=r+n,c[0]=t/a,c[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled){this._updateWeight(t);return}const r=this._startTime;if(r!==null){const l=(t-r)*n;l<0||n===0?e=0:(this._startTime=null,e=n*l)}e*=this._updateTimeScale(t);const a=this._updateTime(e),o=this._updateWeight(t);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case kh:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case el:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const a=n===ad;if(t===0)return r===-1?i:a&&(r&1)===1?e-i:i;if(n===sd){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(r===-1&&(t>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){const o=Math.floor(i/e);i-=e*o,r+=Math.abs(o);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){const c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(r&1)===1)return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Vi,i.endingEnd=Vi):(t?i.endingStart=this.zeroSlopeAtStart?Vi:ki:i.endingStart=Xr,e?i.endingEnd=this.zeroSlopeAtEnd?Vi:ki:i.endingEnd=Xr)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,l[0]=e,o[1]=r+t,l[1]=n,this}}const Bx=new Float32Array(1);class ny extends Cn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,a=t._propertyBindings,o=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==r;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const _=e&&e._propertyBindings[u].binding.parsedPath;m=new wx(Kt.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const n=(t._localRoot||this._root).uuid,i=t._clip.uuid,r=this._actionsByClip[i];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,i,n)}const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let a=r[e];if(a===void 0)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{const o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,a=this._actionsByClip,o=a[r],l=o.knownActions,c=l[l.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),t._byClipCacheIndex=null;const u=o.actionByRoot,d=(t._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[e];a===void 0&&(a={},i[e]=a),a[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],l=e[e.length-1],c=t._cacheIndex;l._cacheIndex=c,e[c]=l,e.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return n===void 0&&(n=new _u(new Float32Array(2),new Float32Array(2),1,Bx),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let a=typeof t=="string"?ta.findByName(i,t):t;const o=a!==null?a.uuid:t,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=el),l!==void 0){const u=l.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new Ox(this,a,e,n);return this._bindAction(h,c),this._addInactiveAction(h,o,r),h}existingAction(t,e){const n=e||this._root,i=n.uuid,r=typeof t=="string"?ta.findByName(n,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,r,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const a=r.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,e[h]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[e];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,r=i[e];if(r!==void 0)for(const a in r){const o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(t,e){const n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Mu{constructor(t){this.value=t}clone(){return new Mu(this.value.clone===void 0?this.value:this.value.clone())}}let zx=0;class iy extends Cn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:zx++}),this.name="",this.usage=qr,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let n=0,i=e.length;n<i;n++){const r=Array.isArray(e[n])?e[n]:[e[n]];for(let a=0;a<r.length;a++)this.uniforms.push(r[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class sy extends hl{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class ry{constructor(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const vh=new Ut;class ay{constructor(t,e,n=0,i=1/0){this.ray=new Os(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new sl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster:
3828Unsupported camera type: "+e.type)}setFromXRController(t){return vh.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(vh),this}intersectObject(t,e=!0,n=[]){return Yo(t,this,n,e),n.sort(yh),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)Yo(t[i],this,n,e);return n.sort(yh),n}}function yh(s,t){return s.distance-t.distance}function Yo(s,t,e,n){let i=!0;if(s.layers.test(t.layers)&&s.raycast(t,e)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let a=0,o=r.length;a<o;a++)Yo(r[a],t,e,!0)}}class oy{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(fe(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class ly{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}}class Su{constructor(t,e,n,i){Su.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=i,this}}const Mh=new $;class cy{constructor(t=new $(1/0,1/0),e=new $(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Mh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mh).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Sh=new w,wr=new w;class hy{constructor(t=new w,e=new w){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Sh.subVectors(t,this.start),wr.subVectors(this.end,this.start);const n=wr.dot(wr);let r=wr.dot(Sh)/n;return e&&(r=fe(r,0,1)),r}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 19,287 bytes, line 3828
3828applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const bh=new w;class uy extends jt{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new Xt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new bt(i,3));const r=new ze({fog:!1,toneMapped:!1});this.cone=new Rn(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),bh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(bh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Bn=new w,Cr=new Ut,no=new Ut;class dy extends Rn{constructor(t){const e=bu(t),n=new Xt,i=[],r=[],a=new mt(0,0,1),o=new mt(0,1,0);for(let c=0;c<e.length;c++){const h=e[c];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new bt(i,3)),n.setAttribute("color",new bt(r,3));const l=new ze({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");no.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<e.length;r++){const o=e[r];o.parent&&o.parent.isBone&&(Cr.multiplyMatrices(no,o.matrixWorld),Bn.setFromMatrixPosition(Cr),i.setXYZ(a,Bn.x,Bn.y,Bn.z),Cr.multiplyMatrices(no,o.parent.matrixWorld),Bn.setFromMatrixPosition(Cr),i.setXYZ(a+1,Bn.x,Bn.y,Bn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function bu(s){const t=[];s.isBone===!0&&t.push(s);for(let e=0;e<s.children.length;e++)t.push.apply(t,bu(s.children[e]));return t}class fy extends _e{constructor(t,e,n){const i=new ua(e,4,2),r=new _i({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const kx=new w,Eh=new mt,Th=new mt;class py extends jt{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ha(e);i.rotateY(Math.PI*.5),this.material=new _i({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),a=new Float32Array(r.count*3);i.setAttribute("color",new re(a,3)),this.add(new _e(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Eh.copy(this.light.color),Th.copy(this.light.groundColor);for(let n=0,i=e.count;n<i;n++){const r=n<i/2?Eh:Th;e.setXYZ(n,r.r,r.g,r.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(kx.setFromMatrixPosition(this.light.matrixWorld).negate())}}class my extends Rn{constructor(t=10,e=10,n=4473924,i=8947848){n=new mt(n),i=new mt(i);const r=e/2,a=t/e,o=t/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=e;d++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const _=d===r?n:i;_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3}const h=new Xt;h.setAttribute("position",new bt(l,3)),h.setAttribute("color",new bt(c,3));const u=new ze({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class gy extends Rn{constructor(t=10,e=16,n=8,i=64,r=4473924,a=8947848){r=new mt(r),a=new mt(a);const o=[],l=[];if(e>1)for(let u=0;u<e;u++){const d=u/e*(Math.PI*2),f=Math.sin(d)*t,m=Math.cos(d)*t;o.push(0,0,0),o.push(f,0,m);const _=u&1?r:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const d=u&1?r:a,f=t-t/n*u;for(let m=0;m<i;m++){let _=m/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f;o.push(g,0,p),l.push(d.r,d.g,d.b),_=(m+1)/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f,o.push(g,0,p),l.push(d.r,d.g,d.b)}}const c=new Xt;c.setAttribute("position",new bt(o,3)),c.setAttribute("color",new bt(l,3));const h=new ze({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Ah=new w,Rr=new w,wh=new w;class _y extends jt{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let i=new Xt;i.setAttribute("position",new bt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ze({fog:!1,toneMapped:!1});this.lightPlane=new pi(i,r),this.add(this.lightPlane),i=new Xt,i.setAttribute("position",new bt([0,0,0,0,0,1],3)),this.targetLine=new pi(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Ah.setFromMatrixPosition(this.light.matrixWorld),Rr.setFromMatrixPosition(this.light.target.matrixWorld),wh.subVectors(Rr,Ah),this.lightPlane.lookAt(Rr),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Rr),this.targetLine.scale.z=wh.length()}}const Ir=new w,de=new rl;class xy extends Rn{constructor(t){const e=new Xt,n=new ze({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(m,_){l(m),l(_)}function l(m){i.push(0,0,0),r.push(0,0,0),a[m]===void 0&&(a[m]=[]),a[m].push(i.length/3-1)}e.setAttribute("position",new bt(i,3)),e.setAttribute("color",new bt(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new mt(16755200),h=new mt(16711680),u=new mt(43775),d=new mt(16777215),f=new mt(3355443);this.setColors(c,h,u,d,f)}setColors(t,e,n,i,r){const o=this.geometry.getAttribute("color");o.setXYZ(0,t.r,t.g,t.b),o.setXYZ(1,t.r,t.g,t.b),o.setXYZ(2,t.r,t.g,t.b),o.setXYZ(3,t.r,t.g,t.b),o.setXYZ(4,t.r,t.g,t.b),o.setXYZ(5,t.r,t.g,t.b),o.setXYZ(6,t.r,t.g,t.b),o.setXYZ(7,t.r,t.g,t.b),o.setXYZ(8,t.r,t.g,t.b),o.setXYZ(9,t.r,t.g,t.b),o.setXYZ(10,t.r,t.g,t.b),o.setXYZ(11,t.r,t.g,t.b),o.setXYZ(12,t.r,t.g,t.b),o.setXYZ(13,t.r,t.g,t.b),o.setXYZ(14,t.r,t.g,t.b),o.setXYZ(15,t.r,t.g,t.b),o.setXYZ(16,t.r,t.g,t.b),o.setXYZ(17,t.r,t.g,t.b),o.setXYZ(18,t.r,t.g,t.b),o.setXYZ(19,t.r,t.g,t.b),o.setXYZ(20,t.r,t.g,t.b),o.setXYZ(21,t.r,t.g,t.b),o.setXYZ(22,t.r,t.g,t.b),o.setXYZ(23,t.r,t.g,t.b),o.setXYZ(24,e.r,e.g,e.b),o.setXYZ(25,e.r,e.g,e.b),o.setXYZ(26,e.r,e.g,e.b),o.setXYZ(27,e.r,e.g,e.b),o.setXYZ(28,e.r,e.g,e.b),o.setXYZ(29,e.r,e.g,e.b),o.setXYZ(30,e.r,e.g,e.b),o.setXYZ(31,e.r,e.g,e.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,r.r,r.g,r.b),o.setXYZ(41,r.r,r.g,r.b),o.setXYZ(42,r.r,r.g,r.b),o.setXYZ(43,r.r,r.g,r.b),o.setXYZ(44,r.r,r.g,r.b),o.setXYZ(45,r.r,r.g,r.b),o.setXYZ(46,r.r,r.g,r.b),o.setXYZ(47,r.r,r.g,r.b),o.setXYZ(48,r.r,r.g,r.b),o.setXYZ(49,r.r,r.g,r.b),o.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap,n=1,i=1;de.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),pe("c",e,t,de,0,0,-1),pe("t",e,t,de,0,0,1),pe("n1",e,t,de,-n,-i,-1),pe("n2",e,t,de,n,-i,-1),pe("n3",e,t,de,-n,i,-1),pe("n4",e,t,de,n,i,-1),pe("f1",e,t,de,-n,-i,1),pe("f2",e,t,de,n,-i,1),pe("f3",e,t,de,-n,i,1),pe("f4",e,t,de,n,i,1),pe("u1",e,t,de,n*.7,i*1.1,-1),pe("u2",e,t,de,-n*.7,i*1.1,-1),pe("u3",e,t,de,0,i*2,-1),pe("cf1",e,t,de,-n,0,1),pe("cf2",e,t,de,n,0,1),pe("cf3",e,t,de,0,-i,1),pe("cf4",e,t,de,0,i,1),pe("cn1",e,t,de,-n,0,-1),pe("cn2",e,t,de,n,0,-1),pe("cn3",e,t,de,0,-i,-1),pe("cn4",e,t,de,0,i,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function pe(s,t,e,n,i,r,a){Ir.set(i,r,a).unproject(n);const o=t[s];if(o!==void 0){const l=e.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Ir.x,Ir.y,Ir.z)}}const Pr=new Be;class vy extends Rn{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Xt;r.setIndex(new re(n,1)),r.setAttribute("position",new re(i,3)),super(r,new ze({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(t!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Pr.setFromObject(this.object),Pr.isEmpty())return;const e=Pr.min,n=Pr.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class yy extends Rn{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new Xt;r.setIndex(new re(n,1)),r.setAttribute("position",new bt(i,3)),super(r,new ze({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class My extends pi{constructor(t,e=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Xt;a.setAttribute("position",new bt(r,3)),a.computeBoundingSphere(),super(a,new ze({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Xt;l.setAttribute("position",new bt(o,3)),l.computeBoundingSphere(),this.add(new _e(l,new _i({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Ch=new w;let Lr,io;class Sy extends jt{constructor(t=new w(0,0,1),e=new w(0,0,0),n=1,i=16776960,r=n*.2,a=r*.2){super(),this.type="ArrowHelper",Lr===void 0&&(Lr=new Xt,Lr.setAttribute("position",new bt([0,0,0,0,1,0],3)),io=new zs(0,.5,1,5,1),io.translate(0,-.5,0)),this.position.copy(e),this.line=new pi(Lr,new ze({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new _e(io,new _i({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,a)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Ch.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Ch,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class by extends Rn{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Xt;i.setAttribute("position",new bt(e,3)),i.setAttribute("color",new bt(n,3));const r=new ze({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(t,e,n){const i=new mt,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ey{constructor(){this.type="ShapePath",this.color=new mt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Kr,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,a){return this.currentPath.bezierCurveTo(t,e,n,i,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(p){const y=[];for(let v=0,x=p.length;v<x;v++){const P=p[v],T=new Ji;T.curves=P.curves,y.push(T)}return y}function n(p,y){const v=y.length;let x=!1;for(let P=v-1,T=0;T<v;P=T++){let C=y[P],R=y[T],b=R.x-C.x,M=R.y-C.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(C=y[T],b=-b,R=y[P],M=-M),p.y<C.y||p.y>R.y)continue;if(p.y===C.y){if(p.x===C.x)return!0}else{const L=M*(p.x-C.x)-b*(p.y-C.y);if(L===0)return!0;if(L<0)continue;x=!x}}else{if(p.y!==C.y)continue;if(R.x<=p.x&&p.x<=C.x||C.x<=p.x&&p.x<=R.x)return!0}}return x}const i=An.isClockWise,r=this.subPaths;if(r.length===0)return[];let a,o,l;const c=[];if(r.length===1)return o=r[0],l=new Ji,l.curves=o.curves,c.push(l),c;let h=!i(r[0].getPoints());h=t?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,y=r.length;p<y;p++)o=r[p],_=o.getPoints(),a=i(_),a=t?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new Ji,p:_},d[m].s.curves=o.curves,h&&m++,f[m]=[]):f[m].push({h:o,p:_[0]});if(!d[0])return e(r);if(d.length>1){let p=!1,y=0;for(let v=0,x=d.length;v<x;v++)u[v]=[];for(let v=0,x=d.length;v<x;v++){const P=f[v];for(let T=0;T<P.length;T++){const C=P[T];let R=!0;for(let b=0;b<d.length;b++)n(C.p,d[b].p)&&(v!==b&&y++,R?(R=!1,u[b].push(C)):p=!0);R&&u[v].push(C)}}y>0&&p===!1&&(f=u)}let g;for(let p=0,y=d.length;p<y;p++){l=d[p].s,c.push(l),g=f[p];for(let v=0,x=g.length;v<x;v++)l.holes.push(g[v].h)}return c}}class Ty extends Cn{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class Ay extends on{constructor(t=1,e=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(t,e,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"170"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="170");export{ju as ACESFilmicToneMapping,ci as AddEquation,Ju as AddOperation,kh as AdditiveAnimationBlendMode,Vl as AdditiveBlending,ed as AgXToneMapping,Uh as AlphaFormat,gd as AlwaysCompare,oo as AlwaysDepth,Xl as AlwaysStencilFunc,gx as AmbientLight,Ox as AnimationAction,ta as AnimationClip,Gv as AnimationLoader,ny as AnimationMixer,ey as AnimationObjectGroup,Hv as AnimationUtils,u0 as ArcCurve,z_ as ArrayCamera,Sy as ArrowHelper,Wl as AttachedBindMode,Tx as Audio,ty as AudioAnalyser,yu as AudioContext,Qv as AudioListener,$v as AudioLoader,by as AxesHelper,Oe as BackSide,od as BasicDepthPacking,Xx as BasicShadowMap,l0 as BatchedMesh,su as Bone,rs as BooleanKeyframeTrack,cy as Box2,Be as Box3,yy as Box3Helper,is as BoxGeometry,vy as BoxHelper,re as BufferAttribute,Xt as BufferGeometry,Mx as BufferGeometryLoader,Ph as ByteType,kn as Cache,rl as Camera,xy as CameraHelper,Vv as CanvasTexture,ml as CapsuleGeometry,d0 as CatmullRomCurve3,Qu as CineonToneMapping,gl as CircleGeometry,sn as ClampToEdgeWrapping,bx as Clock,mt as Color,xu as ColorKeyframeTrack,Zt as ColorManagement,zv as CompressedArrayTexture,kv as CompressedCubeTexture,dl as CompressedTexture,Wv as CompressedTextureLoader,_l as ConeGeometry,qu as ConstantAlphaFactor,Wu as ConstantColorFactor,Ty as Controls,sf as CubeCamera,Wn as CubeReflectionMapping,fi as CubeRefractionMapping,ra as CubeTexture,Xv as CubeTextureLoader,Ns as CubeUVReflectionMapping,au as CubicBezierCurve,y0 as CubicBezierCurve3,nx as CubicInterpolant,kl as CullFaceBack,Cu as CullFaceFront,Wx as CullFaceFrontBack,wu as CullFaceNone,cn as Curve,S0 as CurvePath,Iu as CustomBlending,td as CustomToneMapping,zs as CylinderGeometry,ly as Cylindrical,Gh as Data3DTexture,il as DataArrayTexture,Tn as DataTexture,qv as DataTextureLoader,Cv as DataUtils,rv as DecrementStencilOp,ov as DecrementWrapStencilOp,ox as DefaultLoadingManager,Yi as DepthFormat,Qi as DepthStencilFormat,Jh as DepthTexture,id as DetachedBindMode,mx as DirectionalLight,_y as DirectionalLightHelper,ix as DiscreteInterpolant,xl as DodecahedronGeometry,yn as DoubleSide,zu as DstAlphaFactor,Vu as DstColorFactor,Sv as DynamicCopyUsage,gv as DynamicDrawUsage,vv as DynamicReadUsage,b0 as EdgesGeometry,fl as EllipseCurve,dd as EqualCompare,co as EqualDepth,uv as EqualStencilFunc,kr as EquirectangularReflectionMapping,Vr as EquirectangularRefractionMapping,Ke as Euler,Cn as EventDispatcher,vl as ExtrudeGeometry,qn as FileLoader,Uv as Float16BufferAttribute,bt as Float32BufferAttribute,Xe as FloatType,cl as Fog,ll as FogExp2,Bv as FramebufferTexture,Gn as FrontSide,aa as Frustum,ry as GLBufferAttribute,
3828Ev as GLSL1,ql as GLSL3,fd as GreaterCompare,uo as GreaterDepth,md as GreaterEqualCompare,ho as GreaterEqualDepth,mv as GreaterEqualStencilFunc,fv as GreaterStencilFunc,my as GridHelper,Ts as Group,Fs as HalfFloatType,cx as HemisphereLight,py as HemisphereLightHelper,yl as IcosahedronGeometry,Jv as ImageBitmapLoader,ea as ImageLoader,Bd as ImageUtils,sv as IncrementStencilOp,av as IncrementWrapStencilOp,Ps as InstancedBufferAttribute,yx as InstancedBufferGeometry,sy as InstancedInterleavedBuffer,e0 as InstancedMesh,Lv as Int16BufferAttribute,Dv as Int32BufferAttribute,Rv as Int8BufferAttribute,Jo as IntType,hl as InterleavedBuffer,es as InterleavedBufferAttribute,da as Interpolant,Wr as InterpolateDiscrete,ko as InterpolateLinear,ma as InterpolateSmooth,lv as InvertStencilOp,Mi as KeepStencilOp,hn as KeyframeTrack,$_ as LOD,la as LatheGeometry,sl as Layers,ud as LessCompare,lo as LessDepth,Vh as LessEqualCompare,$i as LessEqualDepth,dv as LessEqualStencilFunc,hv as LessStencilFunc,vi as Light,vx as LightProbe,pi as Line,hy as Line3,ze as LineBasicMaterial,ou as LineCurve,M0 as LineCurve3,j0 as LineDashedMaterial,c0 as LineLoop,Rn as LineSegments,Me as LinearFilter,_u as LinearInterpolant,Jx as LinearMipMapLinearFilter,Zx as LinearMipMapNearestFilter,Sn as LinearMipmapLinearFilter,Dr as LinearMipmapNearestFilter,ns as LinearSRGBColorSpace,$u as LinearToneMapping,sa as LinearTransfer,Ze as Loader,uh as LoaderUtils,vu as LoadingManager,sd as LoopOnce,ad as LoopPingPong,rd as LoopRepeat,Oh as LuminanceAlphaFormat,Fh as LuminanceFormat,Hx as MOUSE,Le as Material,Rl as MaterialLoader,Tv as MathUtils,Su as Matrix2,zt as Matrix3,Ut as Matrix4,Uu as MaxEquation,_e as Mesh,_i as MeshBasicMaterial,tu as MeshDepthMaterial,eu as MeshDistanceMaterial,K0 as MeshLambertMaterial,Q0 as MeshMatcapMaterial,$0 as MeshNormalMaterial,Z0 as MeshPhongMaterial,Y0 as MeshPhysicalMaterial,pu as MeshStandardMaterial,J0 as MeshToonMaterial,Du as MinEquation,Gr as MirroredRepeatWrapping,Zu as MixOperation,Gl as MultiplyBlending,na as MultiplyOperation,we as NearestFilter,Yx as NearestMipMapLinearFilter,qx as NearestMipMapNearestFilter,Ms as NearestMipmapLinearFilter,Ih as NearestMipmapNearestFilter,nd as NeutralToneMapping,hd as NeverCompare,ao as NeverDepth,cv as NeverStencilFunc,Vn as NoBlending,zn as NoColorSpace,Hn as NoToneMapping,el as NormalAnimationBlendMode,qi as NormalBlending,pd as NotEqualCompare,fo as NotEqualDepth,pv as NotEqualStencilFunc,Qr as NumberKeyframeTrack,jt as Object3D,Zv as ObjectLoader,cd as ObjectSpaceNormalMap,ha as OctahedronGeometry,Fu as OneFactor,Yu as OneMinusConstantAlphaFactor,Xu as OneMinusConstantColorFactor,ku as OneMinusDstAlphaFactor,Hu as OneMinusDstColorFactor,ro as OneMinusSrcAlphaFactor,Bu as OneMinusSrcColorFactor,al as OrthographicCamera,Rh as PCFShadowMap,Ru as PCFSoftShadowMap,_c as PMREMGenerator,Kr as Path,Ae as PerspectiveCamera,oi as Plane,Bs as PlaneGeometry,My as PlaneHelper,fx as PointLight,fy as PointLightHelper,h0 as Points,ru as PointsMaterial,gy as PolarGridHelper,xi as PolyhedronGeometry,jv as PositionalAudio,Kt as PropertyBinding,wx as PropertyMixer,lu as QuadraticBezierCurve,cu as QuadraticBezierCurve3,Ye as Quaternion,fa as QuaternionKeyframeTrack,sx as QuaternionLinearInterpolant,Bo as RED_GREEN_RGTC2_Format,zh as RED_RGTC1_Format,Vx as REVISION,ld as RGBADepthPacking,Fe as RGBAFormat,tl as RGBAIntegerFormat,Lo as RGBA_ASTC_10x10_Format,Ro as RGBA_ASTC_10x5_Format,Io as RGBA_ASTC_10x6_Format,Po as RGBA_ASTC_10x8_Format,Do as RGBA_ASTC_12x10_Format,Uo as RGBA_ASTC_12x12_Format,Mo as RGBA_ASTC_4x4_Format,So as RGBA_ASTC_5x4_Format,bo as RGBA_ASTC_5x5_Format,Eo as RGBA_ASTC_6x5_Format,To as RGBA_ASTC_6x6_Format,Ao as RGBA_ASTC_8x5_Format,wo as RGBA_ASTC_8x6_Format,Co as RGBA_ASTC_8x8_Format,Br as RGBA_BPTC_Format,yo as RGBA_ETC2_EAC_Format,_o as RGBA_PVRTC_2BPPV1_Format,go as RGBA_PVRTC_4BPPV1_Format,Nr as RGBA_S3TC_DXT1_Format,Fr as RGBA_S3TC_DXT3_Format,Or as RGBA_S3TC_DXT5_Format,tv as RGBDepthPacking,Nh as RGBFormat,$x as RGBIntegerFormat,No as RGB_BPTC_SIGNED_Format,Fo as RGB_BPTC_UNSIGNED_Format,xo as RGB_ETC1_Format,vo as RGB_ETC2_Format,mo as RGB_PVRTC_2BPPV1_Format,po as RGB_PVRTC_4BPPV1_Format,Ur as RGB_S3TC_DXT1_Format,ev as RGDepthPacking,Bh as RGFormat,jo as RGIntegerFormat,q0 as RawShaderMaterial,Os as Ray,ay as Raycaster,_x as RectAreaLight,Qo as RedFormat,ia as RedIntegerFormat,Ku as ReinhardToneMapping,Vd as RenderTarget,Hr as RepeatWrapping,iv as ReplaceStencilOp,Lu as ReverseSubtractEquation,Ml as RingGeometry,zo as SIGNED_RED_GREEN_RGTC2_Format,Oo as SIGNED_RED_RGT
3828C1_Format,Ge as SRGBColorSpace,se as SRGBTransfer,Z_ as Scene,Wt as ShaderChunk,an as ShaderLib,ln as ShaderMaterial,X0 as ShadowMaterial,Ji as Shape,Sl as ShapeGeometry,Ey as ShapePath,An as ShapeUtils,Lh as ShortType,ul as Skeleton,dy as SkeletonHelper,Q_ as SkinnedMesh,Gi as Source,Pe as Sphere,ua as SphereGeometry,oy as Spherical,xx as SphericalHarmonics3,hu as SplineCurve,ux as SpotLight,uy as SpotLightHelper,J_ as Sprite,nu as SpriteMaterial,so as SrcAlphaFactor,Gu as SrcAlphaSaturateFactor,Ou as SrcColorFactor,Mv as StaticCopyUsage,qr as StaticDrawUsage,xv as StaticReadUsage,Kv as StereoCamera,bv as StreamCopyUsage,_v as StreamDrawUsage,yv as StreamReadUsage,as as StringKeyframeTrack,Pu as SubtractEquation,Hl as SubtractiveBlending,Gx as TOUCH,gi as TangentSpaceNormalMap,bl as TetrahedronGeometry,me as Texture,Yv as TextureLoader,Nv as TextureUtils,El as TorusGeometry,Tl as TorusKnotGeometry,We as Triangle,jx as TriangleFanDrawMode,Qx as TriangleStripDrawMode,Kx as TrianglesDrawMode,Al as TubeGeometry,Zo as UVMapping,Xh as Uint16BufferAttribute,qh as Uint32BufferAttribute,Iv as Uint8BufferAttribute,Pv as Uint8ClampedBufferAttribute,Mu as Uniform,iy as UniformsGroup,lt as UniformsLib,tf as UniformsUtils,wn as UnsignedByteType,Ki as UnsignedInt248Type,Dh as UnsignedInt5999Type,Xn as UnsignedIntType,$o as UnsignedShort4444Type,Ko as UnsignedShort5551Type,Rs as UnsignedShortType,vn as VSMShadowMap,$ as Vector2,w as Vector3,Qt as Vector4,jr as VectorKeyframeTrack,Ov as VideoTexture,wv as WebGL3DRenderTarget,Av as WebGLArrayRenderTarget,bn as WebGLCoordinateSystem,rf as WebGLCubeRenderTarget,Ay as WebGLMultipleRenderTargets,on as WebGLRenderTarget,Fv as WebGLRenderer,B_ as WebGLUtils,Yr as WebGPUCoordinateSystem,W0 as WireframeGeometry,Xr as WrapAroundEnding,ki as ZeroCurvatureEnding,Nu as ZeroFactor,Vi as ZeroSlopeEnding,nv as ZeroStencilOp,Ud as createCanvasElement};
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.