vendor: 6,204 bytes, line 1
1var li={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},hi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ru=0,Wc=1,ou=2;var Xc=1,au=2,In=3,mn=0,zt=1,qt=2,qn=0,Mi=1,qc=2,Yc=3,Zc=4,cu=5,si=100,lu=101,hu=102,uu=103,du=104,fu=200,pu=201,mu=202,gu=203,yo=204,vo=205,_u=206,xu=207,yu=208,vu=209,Mu=210,Su=211,bu=212,Eu=213,Tu=214,Xo=0,qo=1,Yo=2,Si=3,Zo=4,Ko=5,$o=6,Jo=7,Kc=0,Au=1,wu=2,Yn=0,Ru=1,Cu=2,Iu=3,Pu=4,Lu=5,Du=6,Nu=7,Cc="attached",Uu="detached",$c=300,Ni=301,Ui=302,jo=303,Qo=304,Lr=306,ri=1e3,Sn=1001,rs=1002,Rt=1003,ea=1004;var Oi=1005;var Ot=1006,Ms=1007;var xn=1008;var yn=1009,Jc=1010,jc=1011,Ss=1012,ta=1013,ui=1014,cn=1015,bs=1016,na=1017,ia=1018,Es=1020,Qc=35902,el=35899,tl=1021,nl=1022,en=1023,os=1026,Ts=1027,sa=1028,ra=1029,il=1030,oa=1031;var aa=1033,Dr=33776,Nr=33777,Ur=33778,Or=33779,ca=35840,la=35841,ha=35842,ua=35843,da=36196,fa=37492,pa=37496,ma=37808,ga=37809,_a=37810,xa=37811,ya=37812,va=37813,Ma=37814,Sa=37815,ba=37816,Ea=37817,Ta=37818,Aa=37819,wa=37820,Ra=37821,Ca=36492,Ia=36494,Pa=36495,La=36283,Da=36284,Na=36285,Ua=36286;var bi=2300,Ei=2301,xo=2302,Ic=2400,Pc=2401,Lc=2402,Ou=2500;var sl=0,Fr=1,As=2,Fu=3200,Bu=3201;var rl=0,zu=1,Zn="",mt="srgb",Ct="srgb-linear",Ks="linear",it="srgb";var yi=7680;var Dc=519,ku=512,Hu=513,Vu=514,ol=515,Gu=516,Wu=517,Xu=518,qu=519,Mo=35044;var al="300 es",pn=2e3,$s=2001;var En=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let s=n[e];if(s!==void 0){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let s=n.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}},It=["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"],yh=1234567,Xs=Math.PI/180,Ti=180/Math.PI;function on(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(It[i&255]+It[i>>8&255]+It[i>>16&255]+It[i>>24&255]+"-"+It[e&255]+It[e>>8&255]+"-"+It[e>>16&15|64]+It[e>>24&255]+"-"+It[t&63|128]+It[t>>8&255]+"-"+It[t>>16&255]+It[t>>24&255]+It[n&255]+It[n>>8&255]+It[n>>16&255]+It[n>>24&255]).toLowerCase()}function Xe(i,e,t){return Math.max(e,Math.min(t,i))}function cl(i,e){return(i%e+e)%e}function tf(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function nf(i,e,t){return i!==e?(t-i)/(e-i):0}function qs(i,e,t){return(1-t)*i+t*e}function sf(i,e,t,n){return qs(i,e,1-Math.exp(-t*n))}function rf(i,e=1){return e-Math.abs(cl(i,e*2)-e)}function of(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function af(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function cf(i,e){return i+Math.floor(Math.random()*(e-i+1))}function lf(i,e){return i+Math.random()*(e-i)}function hf(i){return i*(.5-Math.random())}function uf(i){i!==void 0&&(yh=i);let e=yh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function df(i){return i*Xs}function ff(i){return i*Ti}function pf(i){return(i&i-1)===0&&i!==0}function mf(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function gf(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function _f(i,e,t,n,s){let r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),l=r((e+n)/2),h=o((e+n)/2),u=r((e-n)/2),d=o((e-n)/2),f=r((n-e)/2),g=o((n-e)/2);switch(s){case"XYX":i.set(a*h,c*u,c*d,a*l);break;case"YZY":i.set(c*d,a*h,c*u,a*l);break;case"ZXZ":i.set(c*u,c*d,a*h,a*l);break;case"XZX":i.set(a*h,c*g,c*f,a*l);break;case"YXY":i.set(c*f,a*h,c*g,a*l);break;case"ZYZ":i.set(c*g,c*f,a*h,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function fn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function nt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var vn={DEG2RAD:Xs,RAD2DEG:Ti,generateUUID:on,clamp:Xe,euclideanModulo:cl,mapLinear:tf,inverseLerp:nf,lerp:qs,damp:sf,pingpong:rf,smoothstep:of,smootherstep:af,randInt:cf,randFloat:lf,randFloatSpread:hf,seededRandom:uf,degToRad:df,radToDeg:ff,isPowerOfTwo:pf,ceilPowerOfTwo:mf,floorPowerOfTwo:gf,setQuaternionFromProperEuler:_f,normalize:nt,denormalize:fn}
vendor: 19,294 bytes, line 1
1,ie=class i{constructor(e=0,t=0){i.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Xe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*s+e.x,this.y=r*s+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ft=class{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,o,a){let c=n[s+0],l=n[s+1],h=n[s+2],u=n[s+3],d=r[o+0],f=r[o+1],g=r[o+2],_=r[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=d,e[t+1]=f,e[t+2]=g,e[t+3]=_;return}if(u!==_||c!==d||l!==f||h!==g){let m=1-a,p=c*d+l*f+h*g+u*_,E=p>=0?1:-1,S=1-p*p;if(S>Number.EPSILON){let R=Math.sqrt(S),w=Math.atan2(R,p*E);m=Math.sin(m*w)/R,a=Math.sin(a*w)/R}let x=a*E;if(c=c*m+d*x,l=l*m+f*x,h=h*m+g*x,u=u*m+_*x,m===1-a){let R=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=R,l*=R,h*=R,u*=R}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,s,r,o){let a=n[s],c=n[s+1],l=n[s+2],h=n[s+3],u=r[o],d=r[o+1],f=r[o+2],g=r[o+3];return e[t]=a*g+h*u+c*f-l*d,e[t+1]=c*g+h*d+l*u-a*f,e[t+2]=l*g+h*f+a*d-c*u,e[t+3]=h*g-a*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),h=a(s/2),u=a(r/2),d=c(n/2),f=c(s/2),g=c(r/2);switch(o){case"XYZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"YXZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"ZXY":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"ZYX":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"YZX":this._x=d*h*u+l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u-d*f*g;break;case"XZY":this._x=d*h*u-l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u+d*f*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],s=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+a+u;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(o-s)*f}else if(n>a&&n>u){let f=2*Math.sqrt(1+n-a-u);this._w=(h-c)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+l)/f}else if(a>u){let f=2*Math.sqrt(1+a-n-u);this._w=(r-l)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(c+h)/f}else{let f=2*Math.sqrt(1+u-n-a);this._w=(o-s)/f,this._x=(r+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Xe(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let s=Math.min(1,t/n);return this.slerp(e,s),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,s=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+o*a+s*l-r*c,this._y=s*h+o*c+r*a-n*l,this._z=r*h+o*l+n*c-s*a,this._w=o*h-n*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,s=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=s,this._z=r,this;let c=1-a*a;if(c<=Number.EPSILON){let f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*s+t*this._y,this._z=f*r+t*this._z,this.normalize(),this}let l=Math.sqrt(c),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=s*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},L=class i{constructor(e=0,t=0,n=0){i.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(vh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*s-a*n),h=2*(a*t-r*s),u=2*(r*n-o*t);return this.x=t+c*l+o*u-a*h,this.y=n+c*h+a*l-r*u,this.z=s+c*u+r*h-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this.z=Xe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this.z=Xe(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}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}round(){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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,s=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=s*c-r*a,this.y=r*o-n*c,this.z=n*a-s*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Qa.copy(this).projectOnVector(e),this.sub(Qa)}reflect(e){return this.sub(Qa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Xe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Qa=new L,vh=new Ft,Ge=class i{constructor(e,t,n,s,r,o,a,c,l){i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,o,a,c,l)}set(e,t,n,s,r,o,a,c,l){let h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,s=t.elements,r=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],g=n[8],_=s[0],m=s[3],p=s[6],E=s[1],S=s[4],x=s[7],R=s[2],w=s[5],P=s[8];return r[0]=o*_+a*E+c*R,r[3]=o*m+a*S+c*w,r[6]=o*p+a*x+c*P,r[1]=l*_+h*E+u*R,r[4]=l*m+h*S+u*w,r[7]=l*p+h*x+u*P,r[2]=d*_+f*E+g*R,r[5]=d*m+f*S+g*w,r[8]=d*p+f*x+g*P,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*o*h-t*a*l-n*r*h+n*a*c+s*r*l-s*o*c}invert(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=h*o-a*l,d=a*c-h*r,f=l*r-o*c,g=t*u+n*d+s*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/g;return e[0]=u*_,e[1]=(s*l-h*n)*_,e[2]=(a*n-s*o)*_,e[3]=d*_,e[4]=(h*t-s*c)*_,e[5]=(s*r-a*t)*_,e[6]=f*_,e[7]=(n*c-l*t)*_,e[8]=(o*t-n*r)*_,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,o,a){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(ec.makeScale(e,t)),this}rotate(e){return this.premultiply(ec.makeRotation(-e)),this}translate(e,t){return this.premultiply(ec.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},ec=new Ge;function ll(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function as(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Yu(){let i=as("canvas");return i.style.display="block",i}var Mh={};function cs(i){i in Mh||(Mh[i]=!0,console.warn(i))}function Zu(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Sh=new Ge().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),bh=new Ge().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 9,990 bytes, line 1
17,1.0569715);function xf(){let i={enabled:!0,workingColorSpace:Ct,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===it&&(s.r=kn(s.r),s.g=kn(s.g),s.b=kn(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===it&&(s.r=ss(s.r),s.g=ss(s.g),s.b=ss(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Zn?Ks:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return cs("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return cs("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ct]:{primaries:e,whitePoint:n,transfer:Ks,toXYZ:Sh,fromXYZ:bh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:mt},outputColorSpaceConfig:{drawingBufferColorSpace:mt}},[mt]:{primaries:e,whitePoint:n,transfer:it,toXYZ:Sh,fromXYZ:bh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:mt}}}),i}var je=xf();function kn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ss(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Wi,So=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Wi===void 0&&(Wi=as("canvas")),Wi.width=e.width,Wi.height=e.height;let s=Wi.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=Wi}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=as("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=kn(r[o]/255)*255;return n.putImageData(s,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(kn(t[n]/255)*255):t[n]=kn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},yf=0,ls=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:yf++}),this.uuid=on(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(tc(s[o].image)):r.push(tc(s[o]))}else r=tc(s);n.url=r}return t||(e.images[this.uuid]=n),n}};function tc(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?So.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var vf=0,nc=new L,At=class i extends En{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Sn,s=Sn,r=Ot,o=xn,a=en,c=yn,l=i.DEFAULT_ANISOTROPY,h=Zn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:vf++}),this.uuid=on(),this.name="",this.source=new ls(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new ie(0,0),this.repeat=new ie(1,1),this.center=new ie(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ge,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(nc).x}get height(){return this.source.getSize(nc).y}get depth(){return this.source.getSize(nc).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==$c)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ri:e.x=e.x-Math.floor(e.x);break;case Sn:e.x=e.x<0?0:1;break;case rs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ri:e.y=e.y-Math.floor(e.y);break;case Sn:e.y=e.y<0?0:1;break;case rs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};At.DEFAULT_IMAGE=null;At.DEFAULT_MAPPING=$c;At.DEFAULT_ANISOTROPY=1;var et=class i{constructor(e=0,t=0,n=0,s=1){i.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,s){return this.x=e,this.y=t,this.z=n,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}
vendor: 4,109 bytes, line 1
1sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],g=c[9],_=c[2],m=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let S=(l+1)/2,x=(f+1)/2,R=(p+1)/2,w=(h+d)/4,P=(u+_)/4,T=(g+m)/4;return S>x&&S>R?S<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(S),s=w/n,r=P/n):x>R?x<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(x),n=w/s,r=T/s):R<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(R),n=P/r,s=T/r),this.set(n,s,r,t),this}let E=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(u-_)/E,this.z=(d-h)/E,this.w=Math.acos((l+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this.z=Xe(this.z,e.z,t.z),this.w=Xe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this.z=Xe(this.z,e,t),this.w=Xe(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}}
vendor: 14,269 bytes, line 1
1,bo=class extends En{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ot,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new et(0,0,e,t),this.scissorTest=!1,this.viewport=new et(0,0,e,t);let s={width:e,height:t,depth:n.depth},r=new At(s);this.textures=[];let o=n.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:Ot,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=n,this.textures[s].isArrayTexture=this.textures[s].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let s=Object.assign({},e.textures[t].image);this.textures[t].source=new ls(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Tn=class extends bo{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Js=class extends At{constructor(e=null,t=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=Sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var Eo=class extends At{constructor(e=null,t=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=Sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var jt=class{constructor(e=new L(1/0,1/0,1/0),t=new L(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(hn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(hn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=hn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,hn):hn.fromBufferAttribute(r,o),hn.applyMatrix4(e.matrixWorld),this.expandByPoint(hn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Wr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Wr.copy(n.boundingBox)),Wr.applyMatrix4(e.matrixWorld),this.union(Wr)}let s=e.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,hn),hn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Os),Xr.subVectors(this.max,Os),Xi.subVectors(e.a,Os),qi.subVectors(e.b,Os),Yi.subVectors(e.c,Os),Jn.subVectors(qi,Xi),jn.subVectors(Yi,qi),mi.subVectors(Xi,Yi);let t=[0,-Jn.z,Jn.y,0,-jn.z,jn.y,0,-mi.z,mi.y,Jn.z,0,-Jn.x,jn.z,0,-jn.x,mi.z,0,-mi.x,-Jn.y,Jn.x,0,-jn.y,jn.x,0,-mi.y,mi.x,0];return!ic(t,Xi,qi,Yi,Xr)||(t=[1,0,0,0,1,0,0,0,1],!ic(t,Xi,qi,Yi,Xr))?!1:(qr.crossVectors(Jn,jn),t=[qr.x,qr.y,qr.z],ic(t,Xi,qi,Yi,Xr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Nn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Nn=[new L,new L,new L,new L,new L,new L,new L,new L],hn=new L,Wr=new jt,Xi=new L,qi=new L,Yi=new L,Jn=new L,jn=new L,mi=new L,Os=new L,Xr=new L,qr=new L,gi=new L;function ic(i,e,t,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){gi.fromArray(i,r);let a=s.x*Math.abs(gi.x)+s.y*Math.abs(gi.y)+s.z*Math.abs(gi.z),c=e.dot(gi),l=t.dot(gi),h=n.dot(gi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}var Mf=new jt,Fs=new L,sc=new L,Vt=class{constructor(e=new L,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Mf.setFromPoints(e).getCenter(n);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Fs.subVectors(e,this.center);let t=Fs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(Fs,s/n),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(sc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fs.copy(e.center).add(sc)),this.expandByPoint(Fs.copy(e.center).sub(sc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Un=new L,rc=new L,Yr=new L,Qn=new L,oc=new L,Zr=new L,ac=new L,Hn=class{constructor(e=new L,t=new L(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Un)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Un.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Un.copy(this.origin).addScaledVector(this.direction,t),Un.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){rc.copy(e).add(t).multiplyScalar(.5),Yr.copy(t).sub(e).normalize(),Qn.copy(this.origin).sub(rc);let r=e.distanceTo(t)*.5,o=-this.direction.dot(Yr),a=Qn.dot(this.direction),c=-Qn.dot(Yr),l=Qn.lengthSq(),h=Math.abs(1-o*o),u,d,f,g;if(h>0)if(u=o*c-a,d=o*a-c,g=r*h,u>=0)if(d>=-g)if(d<=g){let _=1/h;u*=_,d*=_,f=u*(u+o*d+2*a)+d*(o*u+d+2*c)+l}else d=r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-o*r+a)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(o*r+a)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=o>0?-r:r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(rc).addScaledVector(Yr,d),f}intersectSphere(e,t){Un.subVectors(e.center,this.origin);let n=Un.dot(this.direction),s=Un.dot(Un)-n*n,r=e.radius*e.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,o,a,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,s=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,s=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,o=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,o=(e.min.y-d.y)*h),n>o||r>s||((r>n||isNaN(n))&&(n=r),(o<s||isNaN(s))&&(s=o),u>=0?(a=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||a>s)||((a>n||n!==n)&&(n=a),(c<s||s!==s)&&(s=c),s<0)?null:this.at(n>=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,Un)!==null}intersectTriangle(e,t,n,s,r){oc.subVectors(t,e),Zr.subVectors(n,e),ac.crossVectors(oc,Zr);let o=this.direction.dot(ac),a;
vendor: 4,583 bytes, line 1
1if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Qn.subVectors(this.origin,e);let c=a*this.direction.dot(Zr.crossVectors(Qn,Zr));if(c<0)return null;let l=a*this.direction.dot(oc.cross(Qn));if(l<0||c+l>o)return null;let h=-a*Qn.dot(ac);return h<0?null:this.at(h/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ve=class i{constructor(e,t,n,s,r,o,a,c,l,h,u,d,f,g,_,m){i.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,o,a,c,l,h,u,d,f,g,_,m)}set(e,t,n,s,r,o,a,c,l,h,u,d,f,g,_,m){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=g,p[11]=_,p[15]=m,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 i().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,s=1/Zi.setFromMatrixColumn(e,0).length(),r=1/Zi.setFromMatrixColumn(e,1).length(),o=1/Zi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,s=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(s),l=Math.sin(s),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=o*h,f=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+g*l,t[5]=d-_*l,t[9]=-a*c,t[2]=_-d*l,t[6]=g+f*l,t[10]=o*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,g=l*h,_=l*u;t[0]=d+_*a,t[4]=g*a-f,t[8]=o*l,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=f*a-g,t[6]=_+d*a,t[10]=o*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,g=l*h,_=l*u;t[0]=d-_*a,t[4]=-o*u,t[8]=g+f*a,t[1]=f+g*a,t[5]=o*h,t[9]=_-d*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){let d=o*h,f=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=g*l-f,t[8]=d*l+_,t[1]=c*u,t[5]=_*l+d,t[9]=f*l-g,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){let d=o*c,f=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=_-d*u,t[8]=g*u+f,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-l*h,t[6]=f*u+g,t[10]=d-_*u}else if(e.order==="XZY"){let d=o*c,f=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+_,t[5]=o*h,t[9]=f*u-g,t[2]=g*u-f,t[6]=a*h,t[10]=_*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Sf,e,bf)}lookAt(e,t,n){let s=this.elements;return $t.subVectors(e,t),$t.lengthSq()===0&&($t.z=1),$t.normalize(),ei.crossVectors(n,$t),ei.lengthSq()===0&&(Math.abs(n.z)===1?$t.x+=1e-4:$t.z+=1e-4,$t.normalize(),ei.crossVectors(n,$t)),ei.normalize(),Kr.crossVectors($t,ei),s[0]=ei.x,s[4]=Kr.x,s[8]=$t.x,s[1]=ei.y,s[5]=Kr.y,s[9]=$t.y,s[2]=ei.z,s[6]=Kr.z,s[10]=$t.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,s=t.elements,r=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],g=n[2],_=n[6],m=n[10],p=n[14],E=n[3],S=n[7],x=n[11],R=n[15],w=s[0],P=s[4],T=s[8],y=s[12],v=s[1],C=s[5],D=s[9],U=s[13],B=s[2],G=s[6],V=s[10],J=s[14],H=s[3],ce=s[7],fe=s[11],ye=s[15];return r[0]=o*w+a*v+c*B+l*H,r[4]=o*P+a*C+c*G+l*ce,r[8]=o*T+a*D+c*V+l*fe,r[12]=o*y+a*U+c*J+l*ye,r[1]=h*w+u*v+d*B+f*H,r[5]=h*P+u*C+d*G+f*ce,r[9]=h*T+u*D+d*V+f*fe,r[13]=h*y+u*U+d*J+f*ye,r[2]=g*w+_*v+m*B+p*H,r[6]=g*P+_*C+m*G+p*ce,r[10]=g*T+_*D+m*V+p*fe,r[14]=g*y+_*U+m*J+p*ye,r[3]=E*w+S*v+x*B+R*H,r[7]=E*P+S*C+x*G+R*ce,r[11]=E*T+S*D+x*V+R*fe,r[15]=E*y+S*U+x*J+R*ye,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],g=e[3],_=e[7],m=e[11],p=e[15];
vendor: 4,061 bytes, line 1
1return g*(+r*c*u-s*l*u-r*a*d+n*l*d+s*a*f-n*c*f)+_*(+t*c*f-t*l*d+r*o*d-s*o*f+s*l*h-r*c*h)+m*(+t*l*u-t*a*f-r*o*u+n*o*f+r*a*h-n*l*h)+p*(-s*a*h-t*c*u+t*a*d+s*o*u-n*o*d+n*c*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=u*m*l-_*d*l+_*c*f-a*m*f-u*c*p+a*d*p,S=g*d*l-h*m*l-g*c*f+o*m*f+h*c*p-o*d*p,x=h*_*l-g*u*l+g*a*f-o*_*f-h*a*p+o*u*p,R=g*u*c-h*_*c-g*a*d+o*_*d+h*a*m-o*u*m,w=t*E+n*S+s*x+r*R;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let P=1/w;return e[0]=E*P,e[1]=(_*d*r-u*m*r-_*s*f+n*m*f+u*s*p-n*d*p)*P,e[2]=(a*m*r-_*c*r+_*s*l-n*m*l-a*s*p+n*c*p)*P,e[3]=(u*c*r-a*d*r-u*s*l+n*d*l+a*s*f-n*c*f)*P,e[4]=S*P,e[5]=(h*m*r-g*d*r+g*s*f-t*m*f-h*s*p+t*d*p)*P,e[6]=(g*c*r-o*m*r-g*s*l+t*m*l+o*s*p-t*c*p)*P,e[7]=(o*d*r-h*c*r+h*s*l-t*d*l-o*s*f+t*c*f)*P,e[8]=x*P,e[9]=(g*u*r-h*_*r-g*n*f+t*_*f+h*n*p-t*u*p)*P,e[10]=(o*_*r-g*a*r+g*n*l-t*_*l-o*n*p+t*a*p)*P,e[11]=(h*a*r-o*u*r-h*n*l+t*u*l+o*n*f-t*a*f)*P,e[12]=R*P,e[13]=(h*_*s-g*u*s+g*n*d-t*_*d-h*n*m+t*u*m)*P,e[14]=(g*a*s-o*_*s-g*n*c+t*_*c+o*n*m-t*a*m)*P,e[15]=(o*u*s-h*a*s+h*n*c-t*u*c-o*n*d+t*a*d)*P,this}scale(e){let t=this.elements,n=e.x,s=e.y,r=e.z;return t[0]*=n,t[4]*=s,t[8]*=r,t[1]*=n,t[5]*=s,t[9]*=r,t[2]*=n,t[6]*=s,t[10]*=r,t[3]*=n,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,s))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),s=Math.sin(t),r=1-n,o=e.x,a=e.y,c=e.z,l=r*o,h=r*a;return this.set(l*o+n,l*a-s*c,l*c+s*a,0,l*a+s*c,h*a+n,h*c-s*o,0,l*c-s*a,h*c+s*o,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,s,r,o){return this.set(1,n,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,n){let s=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,h=o+o,u=a+a,d=r*l,f=r*h,g=r*u,_=o*h,m=o*u,p=a*u,E=c*l,S=c*h,x=c*u,R=n.x,w=n.y,P=n.z;return s[0]=(1-(_+p))*R,s[1]=(f+x)*R,s[2]=(g-S)*R,s[3]=0,s[4]=(f-x)*w,s[5]=(1-(d+p))*w,s[6]=(m+E)*w,s[7]=0,s[8]=(g+S)*P,s[9]=(m-E)*P,s[10]=(1-(d+_))*P,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,n){let s=this.elements,r=Zi.set(s[0],s[1],s[2]).length(),o=Zi.set(s[4],s[5],s[6]).length(),a=Zi.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],un.copy(this);let l=1/r,h=1/o,u=1/a;return un.elements[0]*=l,un.elements[1]*=l,un.elements[2]*=l,un.elements[4]*=h,un.elements[5]*=h,un.elements[6]*=h,un.elements[8]*=u,un.elements[9]*=u,un.elements[10]*=u,t.setFromRotationMatrix(un),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,s,r,o,a=pn,c=!1){let l=this.elements,h=2*r/(t-e),u=2*r/(n-s),d=(t+e)/(t-e),f=(n+s)/(n-s),g,_;if(c)g=r/(o-r),_=o*r/(o-r);else if(a===pn)g=-(o+r)/(o-r),_=-2*o*r/(o-r);else if(a===$s)g=-o/(o-r),_=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,s,r,o,a=pn,c=!1){let l=this.elements,h=2/(t-e),u=2/(n-s),d=-(t+e)/(t-e),f=-(n+s)/(n-s),g,_;if(c)g=1/(o-r),_=o/(o-r);else if(a===pn)g=-2/(o-r),_=-(o+r)/(o-r);else if(a===$s)g=-1/(o-r),_=-r/(o-r);
vendor: 9,204 bytes, line 1
1else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let s=0;s<16;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Zi=new L,un=new Ve,Sf=new L(0,0,0),bf=new L(1,1,1),ei=new L,Kr=new L,$t=new L,Eh=new Ve,Th=new Ft,gn=class i{constructor(e=0,t=0,n=0,s=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,s=this._order){return this._x=e,this._y=t,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],h=s[9],u=s[2],d=s[6],f=s[10];switch(t){case"XYZ":this._y=Math.asin(Xe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Xe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Xe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Xe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Xe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-Xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Eh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Eh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Th.setFromEuler(this),this.setFromQuaternion(Th,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};gn.DEFAULT_ORDER="XYZ";var js=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},Ef=0,Ah=new L,Ki=new Ft,On=new Ve,$r=new L,Bs=new L,Tf=new L,Af=new Ft,wh=new L(1,0,0),Rh=new L(0,1,0),Ch=new L(0,0,1),Ih={type:"added"},wf={type:"removed"},$i={type:"childadded",child:null},cc={type:"childremoved",child:null},dt=class i extends En{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ef++}),this.uuid=on(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new L,t=new gn,n=new Ft,s=new L(1,1,1);function r(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Ve},normalMatrix:{value:new Ge}}),this.matrix=new Ve,this.matrixWorld=new Ve,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new js,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ki.setFromAxisAngle(e,t),this.quaternion.multiply(Ki),this}rotateOnWorldAxis(e,t){return Ki.setFromAxisAngle(e,t),this.quaternion.premultiply(Ki),this}rotateX(e){return this.rotateOnAxis(wh,e)}rotateY(e){return this.rotateOnAxis(Rh,e)}rotateZ(e){return this.rotateOnAxis(Ch,e)}translateOnAxis(e,t){return Ah.copy(e).applyQuaternion(this.quaternion),this.position.add(Ah.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wh,e)}translateY(e){return this.translateOnAxis(Rh,e)}translateZ(e){return this.translateOnAxis(Ch,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(On.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?$r.copy(e):$r.set(e,t,n);let s=this.parent;this.updateWorldMatrix(!0,!1),Bs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?On.lookAt(Bs,$r,this.up):On.lookAt($r,Bs,this.up),this.quaternion.setFromRotationMatrix(On),s&&(On.extractRotation(s.matrixWorld),Ki.setFromRotationMatrix(On),this.quaternion.premultiply(Ki.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ih),$i.child=e,this.dispatchEvent($i),$i.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(wf),cc.child=e,this.dispatchEvent(cc),cc.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),On.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),On.multiply(e.parent.matrixWorld)),e.applyMatrix4(On),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ih),$i.child=e,this.dispatchEvent($i),$i.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,s=this.children.length;n<s;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,e,Tf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,Af,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,838 bytes, line 1
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));s.material=a}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];s.animations.push(r(e.animations,c))}}if(t){let a=o(e.geometries),c=o(e.materials),l=o(e.textures),h=o(e.images),u=o(e.shapes),d=o(e.skeletons),f=o(e.animations),g=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=s,n;function o(a){let c=[];for(let l in a){let h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let s=e.children[n];this.add(s.clone())}return this}};dt.DEFAULT_UP=new L(0,1,0);dt.DEFAULT_MATRIX_AUTO_UPDATE=!0;dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var dn=new L,Fn=new L,lc=new L,Bn=new L,Ji=new L,ji=new L,Ph=new L,hc=new L,uc=new L,dc=new L,fc=new et,pc=new et,mc=new et,ii=class i{constructor(e=new L,t=new L,n=new L){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),dn.subVectors(e,t),s.cross(dn);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){dn.subVectors(s,t),Fn.subVectors(n,t),lc.subVectors(e,t);let o=dn.dot(dn),a=dn.dot(Fn),c=dn.dot(lc),l=Fn.dot(Fn),h=Fn.dot(lc),u=o*l-a*a;if(u===0)return r.set(0,0,0),null;
vendor: 5,349 bytes, line 1
1let d=1/u,f=(l*c-a*h)*d,g=(o*h-a*c)*d;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,Bn)===null?!1:Bn.x>=0&&Bn.y>=0&&Bn.x+Bn.y<=1}static getInterpolation(e,t,n,s,r,o,a,c){return this.getBarycoord(e,t,n,s,Bn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Bn.x),c.addScaledVector(o,Bn.y),c.addScaledVector(a,Bn.z),c)}static getInterpolatedAttribute(e,t,n,s,r,o){return fc.setScalar(0),pc.setScalar(0),mc.setScalar(0),fc.fromBufferAttribute(e,t),pc.fromBufferAttribute(e,n),mc.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(fc,r.x),o.addScaledVector(pc,r.y),o.addScaledVector(mc,r.z),o}static isFrontFacing(e,t,n,s){return dn.subVectors(n,t),Fn.subVectors(e,t),dn.cross(Fn).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return dn.subVectors(this.c,this.b),Fn.subVectors(this.a,this.b),dn.cross(Fn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return i.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,s=this.b,r=this.c,o,a;Ji.subVectors(s,n),ji.subVectors(r,n),hc.subVectors(e,n);let c=Ji.dot(hc),l=ji.dot(hc);if(c<=0&&l<=0)return t.copy(n);uc.subVectors(e,s);let h=Ji.dot(uc),u=ji.dot(uc);if(h>=0&&u<=h)return t.copy(s);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(n).addScaledVector(Ji,o);dc.subVectors(e,r);let f=Ji.dot(dc),g=ji.dot(dc);if(g>=0&&f<=g)return t.copy(r);let _=f*l-c*g;if(_<=0&&l>=0&&g<=0)return a=l/(l-g),t.copy(n).addScaledVector(ji,a);let m=h*g-f*u;if(m<=0&&u-h>=0&&f-g>=0)return Ph.subVectors(r,s),a=(u-h)/(u-h+(f-g)),t.copy(s).addScaledVector(Ph,a);let p=1/(m+_+d);return o=_*p,a=d*p,t.copy(n).addScaledVector(Ji,o).addScaledVector(ji,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ku={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},ti={h:0,s:0,l:0}
vendor: 15,891 bytes, line 1
1,Jr={h:0,s:0,l:0};function gc(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Le=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,je.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=je.workingColorSpace){return this.r=e,this.g=t,this.b=n,je.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=je.workingColorSpace){if(e=cl(e,1),t=Xe(t,0,1),n=Xe(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=gc(o,r,e+1/3),this.g=gc(o,r,e),this.b=gc(o,r,e-1/3)}return je.colorSpaceToWorking(this,s),this}setStyle(e,t=mt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=mt){let n=Ku[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=ss(e.r),this.g=ss(e.g),this.b=ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return je.workingToColorSpace(Pt.copy(this),e),Math.round(Xe(Pt.r*255,0,255))*65536+Math.round(Xe(Pt.g*255,0,255))*256+Math.round(Xe(Pt.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=je.workingColorSpace){je.workingToColorSpace(Pt.copy(this),t);let n=Pt.r,s=Pt.g,r=Pt.b,o=Math.max(n,s,r),a=Math.min(n,s,r),c,l,h=(a+o)/2;if(a===o)c=0,l=0;else{let u=o-a;switch(l=h<=.5?u/(o+a):u/(2-o-a),o){case n:c=(s-r)/u+(s<r?6:0);break;case s:c=(r-n)/u+2;break;case r:c=(n-s)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=je.workingColorSpace){return je.workingToColorSpace(Pt.copy(this),t),e.r=Pt.r,e.g=Pt.g,e.b=Pt.b,e}getStyle(e=mt){je.workingToColorSpace(Pt.copy(this),e);let t=Pt.r,n=Pt.g,s=Pt.b;return e!==mt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(ti),this.setHSL(ti.h+e,ti.s+t,ti.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ti),e.getHSL(Jr);let n=qs(ti.h,Jr.h,t),s=qs(ti.s,Jr.s,t),r=qs(ti.l,Jr.l,t);return this.setHSL(n,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Pt=new Le;Le.NAMES=Ku;var Rf=0,Gt=class extends En{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Rf++}),this.uuid=on(),this.name="",this.type="Material",this.blending=Mi,this.side=mn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=yo,this.blendDst=vo,this.blendEquation=si,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Le(0,0,0),this.blendAlpha=0,this.depthFunc=Si,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Dc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yi,this.stencilZFail=yi,this.stencilZPass=yi,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).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(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).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(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).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!==Mi&&(n.blending=this.blending),this.side!==mn&&(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!==yo&&(n.blendSrc=this.blendSrc),this.blendDst!==vo&&(n.blendDst=this.blendDst),this.blendEquation!==si&&(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!==Si&&(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!==Dc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yi&&(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 s(r){let o=[];for(let a in r){let c=r[a];delete c.metadata,o.push(c)}return o}if(t){let r=s(e.textures),o=s(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let s=t.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,912 bytes, line 1
1adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Bt=class extends Gt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(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 gn,this.combine=Kc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var yt=new L,jr=new ie,Cf=0,ut=class{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Cf++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Mo,this.updateRanges=[],this.gpuType=cn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[n+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)jr.fromBufferAttribute(this,t),jr.applyMatrix3(e),this.setXY(t,jr.x,jr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyMatrix3(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyMatrix4(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyNormalMatrix(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.transformDirection(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=fn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=fn(t,this.array)),t}setX(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=fn(t,this.array)),t}setY(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=fn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=fn(t,this.array)),t}setW(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),s=nt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e*=this.itemSize,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),s=nt(s,this.array),r=nt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this.array[e+3]=r,this}
vendor: 20,344 bytes, lines 1-5
1onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Mo&&(e.usage=this.usage),e}};var Qs=class extends ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var er=class extends ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var _t=class extends ut{constructor(e,t,n){super(new Float32Array(e),t,n)}},If=0,sn=new Ve,_c=new dt,Qi=new L,Jt=new jt,zs=new jt,Tt=new L,Mt=class i extends En{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:If++}),this.uuid=on(),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(e){return Array.isArray(e)?this.index=new(ll(e)?er:Qs)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Ge().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return sn.makeRotationFromQuaternion(e),this.applyMatrix4(sn),this}rotateX(e){return sn.makeRotationX(e),this.applyMatrix4(sn),this}rotateY(e){return sn.makeRotationY(e),this.applyMatrix4(sn),this}rotateZ(e){return sn.makeRotationZ(e),this.applyMatrix4(sn),this}translate(e,t,n){return sn.makeTranslation(e,t,n),this.applyMatrix4(sn),this}scale(e,t,n){return sn.makeScale(e,t,n),this.applyMatrix4(sn),this}lookAt(e){return _c.lookAt(e),_c.updateMatrix(),this.applyMatrix4(_c.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qi).negate(),this.translate(Qi.x,Qi.y,Qi.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let s=0,r=e.length;s<r;s++){let o=e[s];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new _t(n,3))}else{let n=Math.min(e.length,t.count);for(let s=0;s<n;s++){let r=e[s];t.setXYZ(s,r.x,r.y,r.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){let r=t[n];Jt.setFromBufferAttribute(r),this.morphTargetsRelative?(Tt.addVectors(this.boundingBox.min,Jt.min),this.boundingBox.expandByPoint(Tt),Tt.addVectors(this.boundingBox.max,Jt.max),this.boundingBox.expandByPoint(Tt)):(this.boundingBox.expandByPoint(Jt.min),this.boundingBox.expandByPoint(Jt.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 Vt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new L,1/0);return}if(e){let n=this.boundingSphere.center;if(Jt.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){let a=t[r];zs.setFromBufferAttribute(a),this.morphTargetsRelative?(Tt.addVectors(Jt.min,zs.min),Jt.expandByPoint(Tt),Tt.addVectors(Jt.max,zs.max),Jt.expandByPoint(Tt)):(Jt.expandByPoint(zs.min),Jt.expandByPoint(zs.max))}Jt.getCenter(n);let s=0;for(let r=0,o=e.count;r<o;r++)Tt.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(Tt));if(t)for(let r=0,o=t.length;r<o;r++){let a=t[r],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Tt.fromBufferAttribute(a,l),c&&(Qi.fromBufferAttribute(e,l),Tt.add(Qi)),s=Math.max(s,n.distanceToSquared(Tt))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,s=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ut(new Float32Array(4*n.count),4));let o=this.getAttribute("tangent"),a=[],c=[];for(let T=0;T<n.count;T++)a[T]=new L,c[T]=new L;let l=new L,h=new L,u=new L,d=new ie,f=new ie,g=new ie,_=new L,m=new L;function p(T,y,v){l.fromBufferAttribute(n,T),h.fromBufferAttribute(n,y),u.fromBufferAttribute(n,v),d.fromBufferAttribute(r,T),f.fromBufferAttribute(r,y),g.fromBufferAttribute(r,v),h.sub(l),u.sub(l),f.sub(d),g.sub(d);let C=1/(f.x*g.y-g.x*f.y);isFinite(C)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(C),m.copy(u).multiplyScalar(f.x).addScaledVector(h,-g.x).multiplyScalar(C),a[T].add(_),a[y].add(_),a[v].add(_),c[T].add(m),c[y].add(m),c[v].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let T=0,y=E.length;T<y;++T){let v=E[T],C=v.start,D=v.count;for(let U=C,B=C+D;U<B;U+=3)p(e.getX(U+0),e.getX(U+1),e.getX(U+2))}let S=new L,x=new L,R=new L,w=new L;function P(T){R.fromBufferAttribute(s,T),w.copy(R);let y=a[T];S.copy(y),S.sub(R.multiplyScalar(R.dot(y))).normalize(),x.crossVectors(w,y);let C=x.dot(c[T])<0?-1:1;o.setXYZW(T,S.x,S.y,S.z,C)}for(let T=0,y=E.length;T<y;++T){let v=E[T],C=v.start,D=v.count;for(let U=C,B=C+D;U<B;U+=3)P(e.getX(U+0)),P(e.getX(U+1)),P(e.getX(U+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ut(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);let s=new L,r=new L,o=new L,a=new L,c=new L,l=new L,h=new L,u=new L;if(e)for(let d=0,f=e.count;d<f;d+=3){let g=e.getX(d+0),_=e.getX(d+1),m=e.getX(d+2);s.fromBufferAttribute(t,g),r.fromBufferAttribute(t,_),o.fromBufferAttribute(t,m),h.subVectors(o,r),u.subVectors(s,r),h.cross(u),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),a.add(h),c.add(h),l.add(h),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)s.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),h.subVectors(o,r),u.subVectors(s,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(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Tt.fromBufferAttribute(e,t),Tt.normalize(),e.setXYZ(t,Tt.x,Tt.y,Tt.z)}toNonIndexed(){function e(a,c){let l=a.array,h=a.itemSize,u=a.normalized,d=new l.constructor(c.length*h),f=0,g=0;for(let _=0,m=c.length;_<m;_++){a.isInterleavedBufferAttribute?f=c[_]*a.data.stride+a.offset:f=c[_]*h;for(let p=0;p<h;p++)d[g++]=l[f++]}return new ut(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,s=this.attributes;for(let a in s){let c=s[a],l=e(c,n);t.setAttribute(a,l)}let r=this.morphAttributes;for(let a in r){let c=[],l=r[a];for(let h=0,u=l.length;h<u;h++){let d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,c=o.length;a<c;a++){let l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let s={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){let f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(s[c]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let s=e.attributes;for(let l in s){let h=s[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let l=0,h=o.length;l<h;l++){let u=o[l];this.addGroup(u.start,u.count,u.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},Lh=new Ve,_i=new Hn,Qr=new Vt,Dh=new L,eo=new L,to=new L,no=new L,xc=new L,io=new L,Nh=new L,so=new L,ht=class extends dt{constructor(e=new Mt,t=new Bt){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(s,e);let a=this.morphTargetInfluences;if(r&&a){io.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=a[c],u=r[c];h!==0&&(xc.fromBufferAttribute(u,e),o?io.addScaledVector(xc,h):io.addScaledVector(xc.sub(t),h))}t.add(io)}return t}raycast(e,t){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Qr.copy(n.boundingSphere),Qr.applyMatrix4(r),_i.copy(e.ray).recast(e.near),!(Qr.containsPoint(_i.origin)===!1&&(_i.intersectSphere(Qr,Dh)===null||_i.origin.distanceToSquared(Dh)>(e.far-e.near)**2))&&(Lh.copy(r).invert(),_i.copy(e.ray).applyMatrix4(Lh),!(n.boundingBox!==null&&_i.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,_i)))}_computeIntersections(e,t,n){let s,r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=d.length;g<_;g++){let m=d[g],p=o[m.materialIndex],E=Math.max(m.start,f.start),S=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let x=E,R=S;x<R;x+=3){let w=a.getX(x),P=a.getX(x+1),T=a.getX(x+2);s=ro(this,p,e,n,l,h,u,w,P,T),s&&(s.faceIndex=Math.floor(x/3),s.face.materialIndex=m.materialIndex,t.push(s))}}else{let g=Math.max(0,f.start),_=Math.min(a.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){let E=a.getX(m),S=a.getX(m+1),x=a.getX(m+2);s=ro(this,o,e,n,l,h,u,E,S,x),s&&(s.faceIndex=Math.floor(m/3),t.push(s))}}else if(c!==void 0)if(Array.isArray(o))for(let g=0,_=d.length;g<_;g++){let m=d[g],p=o[m.materialIndex],E=Math.max(m.start,f.start),S=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let x=E,R=S;x<R;x+=3){let w=x,P=x+1,T=x+2;s=ro(this,p,e,n,l,h,u,w,P,T),s&&(s.faceIndex=Math.floor(x/3),s.face.materialIndex=m.materialIndex,t.push(s))}}else{let g=Math.max(0,f.start),_=Math.min(c.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){let E=m,S=m+1,x=m+2;s=ro(this,o,e,n,l,h,u,E,S,x),s&&(s.faceIndex=Math.floor(m/3),t.push(s))}}}};function Pf(i,e,t,n,s,r,o,a){let c;if(e.side===zt?c=n.intersectTriangle(o,r,s,!0,a):c=n.intersectTriangle(s,r,o,e.side===mn,a),c===null)return null;so.copy(a),so.applyMatrix4(i.matrixWorld);let l=t.ray.origin.distanceTo(so);return l<t.near||l>t.far?null:{distance:l,point:so.clone(),object:i}}function ro(i,e,t,n,s,r,o,a,c,l){i.getVertexPosition(a,eo),i.getVertexPosition(c,to),i.getVertexPosition(l,no);let h=Pf(i,e,t,n,eo,to,no,Nh);if(h){let u=new L;ii.getBarycoord(Nh,eo,to,no,u),s&&(h.uv=ii.getInterpolatedAttribute(s,a,c,l,u,new ie)),r&&(h.uv1=ii.getInterpolatedAttribute(r,a,c,l,u,new ie)),o&&(h.normal=ii.getInterpolatedAttribute(o,a,c,l,u,new L),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let d={a,b:c,c:l,normal:new L,materialIndex:0};ii.getNormal(eo,to,no,d.normal),h.face=d,h.barycoord=u}return h}var an=class i extends Mt{constructor(e=1,t=1,n=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let c=[],l=[],h=[],u=[],d=0,f=0;g("z","y","x",-1,-1,n,t,e,o,r,0),g("z","y","x",1,-1,n,t,-e,o,r,1),g("x","z","y",1,1,e,n,t,s,o,2),g("x","z","y",1,-1,e,n,-t,s,o,3),g("x","y","z",1,-1,e,t,n,s,r,4),g("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new _t(l,3)),this.setAttribute("normal",new _t(h,3)),this.setAttribute("uv",new _t(u,2));function g(_,m,p,E,S,x,R,w,P,T,y){let v=x/P,C=R/T,D=x/2,U=R/2,B=w/2,G=P+1,V=T+1,J=0,H=0,ce=new L;for(let fe=0;fe<V;fe++){let ye=fe*C-U;for(let Ue=0;Ue<G;Ue++){let Be=Ue*v-D;ce[_]=Be*E,ce[m]=ye*S,ce[p]=B,l.push(ce.x,ce.y,ce.z),ce[_]=0,ce[m]=0,ce[p]=w>0?1:-1,h.push(ce.x,ce.y,ce.z),u.push(Ue/P),u.push(1-fe/T),J+=1}}for(let fe=0;fe<T;fe++)for(let ye=0;ye<P;ye++){let Ue=d+ye+G*fe,Be=d+ye+G*(fe+1),Ze=d+(ye+1)+G*(fe+1),qe=d+(ye+1)+G*fe;c.push(Ue,Be,qe),c.push(Be,Ze,qe),H+=6}a.addGroup(f,H,y),f+=H,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Fi(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let s=i[t][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=s.clone():Array.isArray(s)?e[t][n]=s.slice():e[t][n]=s}}return e}function Dt(i){let e={};for(let t=0;t<i.length;t++){let n=Fi(i[t]);for(let s in n)e[s]=n[s]}return e}function Lf(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function hl(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:je.workingColorSpace}var $u={clone:Fi,merge:Dt},Df=`void main() { 2 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3}`,Nf=`void main() { 4 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 5}`,_n=class extends Gt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Df,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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Fi(e.uniforms),this.uniformsGroups=Lf(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let s in this.uniforms){let o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},tr=class extends dt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ve,this.projectionMatrix=new Ve,this.projectionMatrixInverse=new Ve,this.coordinateSystem=pn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},ni=new L,Uh=new ie,Oh=new ie,vt=class extends tr{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ti*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Xs*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 11,712 bytes, lines 5-40
5getEffectiveFOV(){return Ti*2*Math.atan(Math.tan(Xs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ni.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ni.x,ni.y).multiplyScalar(-e/ni.z),ni.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ni.x,ni.y).multiplyScalar(-e/ni.z)}getViewSize(e,t){return this.getViewBounds(e,Uh,Oh),t.subVectors(Oh,Uh)}setViewOffset(e,t,n,s,r,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Xs*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,r=-.5*s,o=this.view;if(this.view!==null&&this.view.enabled){let c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,t-=o.offsetY*n/l,s*=o.width/c,n*=o.height/l}let a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},es=-90,ts=1,To=class extends dt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new vt(es,ts,e,t);s.layers=this.layers,this.add(s);let r=new vt(es,ts,e,t);r.layers=this.layers,this.add(r);let o=new vt(es,ts,e,t);o.layers=this.layers,this.add(o);let a=new vt(es,ts,e,t);a.layers=this.layers,this.add(a);let c=new vt(es,ts,e,t);c.layers=this.layers,this.add(c);let l=new vt(es,ts,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,s,r,o,a,c]=t;for(let l of t)this.remove(l);if(e===pn)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===$s)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,o,a,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;let _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,s),e.render(t,r),e.setRenderTarget(n,1,s),e.render(t,o),e.setRenderTarget(n,2,s),e.render(t,a),e.setRenderTarget(n,3,s),e.render(t,c),e.setRenderTarget(n,4,s),e.render(t,l),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,s),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},nr=class extends At{constructor(e=[],t=Ni,n,s,r,o,a,c,l,h){super(e,t,n,s,r,o,a,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Ao=class extends Tn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new nr(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 6 7 varying vec3 vWorldDirection; 8 9 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 10 11 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 12 13 } 14 15 void main() { 16 17 vWorldDirection = transformDirection( position, modelMatrix ); 18 19 #include <begin_vertex> 20 #include <project_vertex> 21 22 } 23 `,fragmentShader:` 24 25 uniform sampler2D tEquirect; 26 27 varying vec3 vWorldDirection; 28 29 #include <common> 30 31 void main() { 32 33 vec3 direction = normalize( vWorldDirection ); 34 35 vec2 sampleUV = equirectUv( direction ); 36 37 gl_FragColor = texture2D( tEquirect, sampleUV ); 38 39 } 40 `},s=new an(5,5,5),r=new _n({name:"CubemapFromEquirect",uniforms:Fi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:zt,blending:qn});r.uniforms.tEquirect.value=t;let o=new ht(s,r),a=t.minFilter;return t.minFilter===xn&&(t.minFilter=Ot),new To(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){let r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,s);e.setRenderTarget(r)}},Lt=class extends dt{constructor(){super(),this.isGroup=!0,this.type="Group"}},Uf={type:"move"},hs=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Lt,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 Lt,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Lt,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let s=null,r=null,o=null,a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(let _ of e.hand.values()){let m=t.getJointPose(_,n),p=this._getHandJoint(l,_);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}let h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,g=.005;l.inputState.pinching&&d>f+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Uf)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Lt;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}};var ir=class extends dt{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 gn,this.environmentIntensity=1,this.environmentRotation=new gn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},us=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Mo,this.updateRanges=[],this.version=0,this.uuid=on()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let s=0,r=this.stride;s<r;s++)this.array[e+s]=t.array[n+s];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=on()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=on()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.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}}}
vendor: 12,550 bytes, line 40
40,Ut=new L,ds=class i{constructor(e,t,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix4(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyNormalMatrix(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.transformDirection(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=fn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=fn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),s=nt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),s=nt(s,this.array),r=nt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return new ut(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};var Fh=new L,Bh=new et,zh=new et,Of=new L,kh=new Ve,oo=new L,yc=new Vt,Hh=new Ve,vc=new Hn,sr=class extends ht{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Cc,this.bindMatrix=new Ve,this.bindMatrixInverse=new Ve,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new jt),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,oo),this.boundingBox.expandByPoint(oo)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Vt),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,oo),this.boundingSphere.expandByPoint(oo)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),yc.copy(this.boundingSphere),yc.applyMatrix4(s),e.ray.intersectsSphere(yc)!==!1&&(Hh.copy(s).invert(),vc.copy(e.ray).applyMatrix4(Hh),!(this.boundingBox!==null&&vc.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,vc)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new et,t=this.geometry.attributes.skinWeight;for(let n=0,s=t.count;n<s;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Cc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Uu?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,s=this.geometry;Bh.fromBufferAttribute(s.attributes.skinIndex,e),zh.fromBufferAttribute(s.attributes.skinWeight,e),Fh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){let o=zh.getComponent(r);if(o!==0){let a=Bh.getComponent(r);kh.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(Of.copy(Fh).applyMatrix4(kh),o)}}return t.applyMatrix4(this.bindMatrixInverse)}},fs=class extends dt{constructor(){super(),this.isBone=!0,this.type="Bone"}},rr=class extends At{constructor(e=null,t=1,n=1,s,r,o,a,c,l=Rt,h=Rt,u,d){super(null,o,a,c,l,h,s,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Vh=new Ve,Ff=new Ve,or=class i{constructor(e=[],t=[]){this.uuid=on(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new Ve)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Ve;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];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(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,o=e.length;r<o;r++){let a=e[r]?e[r].matrixWorld:Ff;Vh.multiplyMatrices(a,t[r]),Vh.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new i(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new rr(t,e,e,en,cn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,s=e.bones.length;n<s;n++){let r=e.bones[n],o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new fs),this.bones.push(o),this.boneInverses.push(new Ve().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let s=0,r=t.length;s<r;s++){let o=t[s];e.bones.push(o.uuid);let a=n[s];e.boneInverses.push(a.toArray())}return e}},oi=class extends ut{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},ns=new Ve,Gh=new Ve,ao=[],Wh=new jt,Bf=new Ve,ks=new ht,Hs=new Vt,ar=class extends ht{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new oi(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,Bf)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new jt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ns),Wh.copy(e.boundingBox).applyMatrix4(ns),this.boundingBox.union(Wh)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Vt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ns),Hs.copy(e.boundingSphere).applyMatrix4(ns),this.boundingSphere.union(Hs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,o=e*r+1;for(let a=0;a<n.length;a++)n[a]=s[o+a]}raycast(e,t){let n=this.matrixWorld,s=this.count;if(ks.geometry=this.geometry,ks.material=this.material,ks.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hs.copy(this.boundingSphere),Hs.applyMatrix4(n),e.ray.intersectsSphere(Hs)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ns),Gh.multiplyMatrices(n,ns),ks.matrixWorld=Gh,ks.raycast(e,ao);for(let o=0,a=ao.length;o<a;o++){let c=ao[o];c.instanceId=r,c.object=this,t.push(c)}ao.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new oi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){let n=t.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new rr(new Float32Array(s*this.count),s,this.count,sa,cn));let r=this.morphTexture.source.data.data,o=0;for(let l=0;l<n.length;l++)o+=n[l];let a=this.geometry.morphTargetsRelative?1:1-o,c=s*e;r[c]=a,r.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Mc=new L,zf=new L,kf=new Ge,rn=class{constructor(e=new L(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 17,949 bytes, line 40
40setFromCoplanarPoints(e,t,n){let s=Mc.subVectors(n,t).cross(zf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let n=e.delta(Mc),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||kf.getNormalMatrix(e),s=this.coplanarPoint(Mc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},xi=new Vt,Hf=new ie(.5,.5),co=new L,ps=class{constructor(e=new rn,t=new rn,n=new rn,s=new rn,r=new rn,o=new rn){this.planes=[e,t,n,s,r,o]}set(e,t,n,s,r,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=pn,n=!1){let s=this.planes,r=e.elements,o=r[0],a=r[1],c=r[2],l=r[3],h=r[4],u=r[5],d=r[6],f=r[7],g=r[8],_=r[9],m=r[10],p=r[11],E=r[12],S=r[13],x=r[14],R=r[15];if(s[0].setComponents(l-o,f-h,p-g,R-E).normalize(),s[1].setComponents(l+o,f+h,p+g,R+E).normalize(),s[2].setComponents(l+a,f+u,p+_,R+S).normalize(),s[3].setComponents(l-a,f-u,p-_,R-S).normalize(),n)s[4].setComponents(c,d,m,x).normalize(),s[5].setComponents(l-c,f-d,p-m,R-x).normalize();else if(s[4].setComponents(l-c,f-d,p-m,R-x).normalize(),t===pn)s[5].setComponents(l+c,f+d,p+m,R+x).normalize();else if(t===$s)s[5].setComponents(c,d,m,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),xi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),xi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(xi)}intersectsSprite(e){xi.center.set(0,0,0);let t=Hf.distanceTo(e.center);return xi.radius=.7071067811865476+t,xi.applyMatrix4(e.matrixWorld),this.intersectsSphere(xi)}intersectsSphere(e){let t=this.planes,n=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let s=t[n];if(co.x=s.normal.x>0?e.max.x:e.min.x,co.y=s.normal.y>0?e.max.y:e.min.y,co.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(co)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var Ai=class extends Gt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},wo=new L,Ro=new L,Xh=new Ve,Vs=new Hn,lo=new Vt,Sc=new L,qh=new L,wi=class extends dt{constructor(e=new Mt,t=new Ai){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let s=1,r=t.count;s<r;s++)wo.fromBufferAttribute(t,s-1),Ro.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=wo.distanceTo(Ro);e.setAttribute("lineDistance",new _t(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),lo.copy(n.boundingSphere),lo.applyMatrix4(s),lo.radius+=r,e.ray.intersectsSphere(lo)===!1)return;Xh.copy(s).invert(),Vs.copy(e.ray).applyMatrix4(Xh);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){let f=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let _=f,m=g-1;_<m;_+=l){let p=h.getX(_),E=h.getX(_+1),S=ho(this,e,Vs,c,p,E,_);S&&t.push(S)}if(this.isLineLoop){let _=h.getX(g-1),m=h.getX(f),p=ho(this,e,Vs,c,_,m,g-1);p&&t.push(p)}}else{let f=Math.max(0,o.start),g=Math.min(d.count,o.start+o.count);for(let _=f,m=g-1;_<m;_+=l){let p=ho(this,e,Vs,c,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){let _=ho(this,e,Vs,c,g-1,f,g-1);_&&t.push(_)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};function ho(i,e,t,n,s,r,o){let a=i.geometry.attributes.position;if(wo.fromBufferAttribute(a,s),Ro.fromBufferAttribute(a,r),t.distanceSqToSegment(wo,Ro,Sc,qh)>n)return;Sc.applyMatrix4(i.matrixWorld);let l=e.ray.origin.distanceTo(Sc);if(!(l<e.near||l>e.far))return{distance:l,point:qh.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var Yh=new L,Zh=new L,ms=class extends wi{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let s=0,r=t.count;s<r;s+=2)Yh.fromBufferAttribute(t,s),Zh.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+Yh.distanceTo(Zh);e.setAttribute("lineDistance",new _t(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},cr=class extends wi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},gs=class extends Gt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Kh=new Ve,Nc=new Hn,uo=new Vt,fo=new L,lr=class extends dt{constructor(e=new Mt,t=new gs){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),uo.copy(n.boundingSphere),uo.applyMatrix4(s),uo.radius+=r,e.ray.intersectsSphere(uo)===!1)return;Kh.copy(s).invert(),Nc.copy(e.ray).applyMatrix4(Kh);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,u=n.attributes.position;if(l!==null){let d=Math.max(0,o.start),f=Math.min(l.count,o.start+o.count);for(let g=d,_=f;g<_;g++){let m=l.getX(g);fo.fromBufferAttribute(u,m),$h(fo,m,c,s,e,t,this)}}else{let d=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let g=d,_=f;g<_;g++)fo.fromBufferAttribute(u,g),$h(fo,g,c,s,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};function $h(i,e,t,n,s,r,o){let a=Nc.distanceSqToPoint(i);if(a<t){let c=new L;Nc.closestPointToPoint(i,c),c.applyMatrix4(n);let l=s.ray.origin.distanceTo(c);if(l<s.near||l>s.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var hr=class extends At{constructor(e,t,n=ui,s,r,o,a=Rt,c=Rt,l,h=os,u=1){if(h!==os&&h!==Ts)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:u};super(d,s,r,o,a,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ls(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},ur=class extends At{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}};var dr=class i extends Mt{constructor(e=1,t=1,n=1,s=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};let l=this;s=Math.floor(s),r=Math.floor(r);let h=[],u=[],d=[],f=[],g=0,_=[],m=n/2,p=0;E(),o===!1&&(e>0&&S(!0),t>0&&S(!1)),this.setIndex(h),this.setAttribute("position",new _t(u,3)),this.setAttribute("normal",new _t(d,3)),this.setAttribute("uv",new _t(f,2));function E(){let x=new L,R=new L,w=0,P=(t-e)/n;for(let T=0;T<=r;T++){let y=[],v=T/r,C=v*(t-e)+e;for(let D=0;D<=s;D++){let U=D/s,B=U*c+a,G=Math.sin(B),V=Math.cos(B);R.x=C*G,R.y=-v*n+m,R.z=C*V,u.push(R.x,R.y,R.z),x.set(G,P,V).normalize(),d.push(x.x,x.y,x.z),f.push(U,1-v),y.push(g++)}_.push(y)}for(let T=0;T<s;T++)for(let y=0;y<r;y++){let v=_[y][T],C=_[y+1][T],D=_[y+1][T+1],U=_[y][T+1];(e>0||y!==0)&&(h.push(v,C,U),w+=3),(t>0||y!==r-1)&&(h.push(C,D,U),w+=3)}l.addGroup(p,w,0),p+=w}function S(x){let R=g,w=new ie,P=new L,T=0,y=x===!0?e:t,v=x===!0?1:-1;for(let D=1;D<=s;D++)u.push(0,m*v,0),d.push(0,v,0),f.push(.5,.5),g++;let C=g;for(let D=0;D<=s;D++){let B=D/s*c+a,G=Math.cos(B),V=Math.sin(B);P.x=y*V,P.y=m*v,P.z=y*G,u.push(P.x,P.y,P.z),d.push(0,v,0),w.x=G*.5+.5,w.y=V*.5*v+.5,f.push(w.x,w.y),g++}for(let D=0;D<s;D++){let U=R+D,B=C+D;x===!0?h.push(B,B+1,U):h.push(B+1,B,U),T+=3}l.addGroup(p,T,x===!0?1:2),p+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var Co=class i extends Mt{constructor(e=[],t=[],n=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:s};let r=[],o=[];a(s),l(n),h(),this.setAttribute("position",new _t(r,3)),this.setAttribute("normal",new _t(r.slice(),3)),this.setAttribute("uv",new _t(o,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(E){let S=new L,x=new L,R=new L;for(let w=0;w<t.length;w+=3)f(t[w+0],S),f(t[w+1],x),f(t[w+2],R),c(S,x,R,E)}function c(E,S,x,R){let w=R+1,P=[];for(let T=0;T<=w;T++){P[T]=[];let y=E.clone().lerp(x,T/w),v=S.clone().lerp(x,T/w),C=w-T;for(let D=0;D<=C;D++)D===0&&T===w?P[T][D]=y:P[T][D]=y.clone().lerp(v,D/C)}for(let T=0;T<w;T++)for(let y=0;y<2*(w-T)-1;y++){let v=Math.floor(y/2);y%2===0?(d(P[T][v+1]),d(P[T+1][v]),d(P[T][v])):(d(P[T][v+1]),d(P[T+1][v+1]),d(P[T+1][v]))}}function l(E){let S=new L;for(let x=0;x<r.length;x+=3)S.x=r[x+0],S.y=r[x+1],S.z=r[x+2],S.normalize().multiplyScalar(E),r[x+0]=S.x,r[x+1]=S.y,r[x+2]=S.z}function h(){let E=new L;for(let S=0;S<r.length;S+=3){E.x=r[S+0],E.y=r[S+1],E.z=r[S+2];let x=m(E)/2/Math.PI+.5,R=p(E)/Math.PI+.5;o.push(x,1-R)}g(),u()}function u(){for(let E=0;E<o.length;E+=6){let S=o[E+0],x=o[E+2],R=o[E+4],w=Math.max(S,x,R),P=Math.min(S,x,R);w>.9&&P<.1&&(S<.2&&(o[E+0]+=1),x<.2&&(o[E+2]+=1),R<.2&&(o[E+4]+=1))}}function d(E){r.push(E.x,E.y,E.z)}function f(E,S){let x=E*3;S.x=e[x+0],S.y=e[x+1],S.z=e[x+2]}function g(){let E=new L,S=new L,x=new L,R=new L,w=new ie,P=new ie,T=new ie;for(let y=0,v=0;y<r.length;y+=9,v+=6){E.set(r[y+0],r[y+1],r[y+2]),S.set(r[y+3],r[y+4],r[y+5]),x.set(r[y+6],r[y+7],r[y+8]),w.set(o[v+0],o[v+1]),P.set(o[v+2],o[v+3]),T.set(o[v+4],o[v+5]),R.copy(E).add(S).add(x).divideScalar(3);let C=m(R);_(w,v+0,E,C),_(P,v+2,S,C),_(T,v+4,x,C)}}function _(E,S,x,R){R<0&&E.x===1&&(o[S]=E.x-1),x.x===0&&x.z===0&&(o[S]=R/2/Math.PI+.5)}function m(E){return Math.atan2(E.z,-E.x)}function p(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.vertices,e.indices,e.radius,e.details)}};var Qt=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(s),t.push(r),s=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),s=0,r=n.length,o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(s=Math.floor(a+(c-a)/2),l=n[s]-o,l<0)a=s+1;else if(l>0)c=s-1;else{c=s;break}if(s=c,n[s]===o)return s/(r-1);let h=n[s],d=n[s+1]-h,f=(o-h)/d;return(s+f)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);let o=this.getPoint(s),a=this.getPoint(r),c=t||(o.isVector2?new ie:new L);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new L,s=[],r=[],o=[],a=new L,c=new Ve;for(let f=0;f<=e;f++){let g=f/e;s[f]=this.getTangentAt(g,new L)}r[0]=new L,o[0]=new L;let l=Number.MAX_VALUE,h=Math.abs(s[0].x),u=Math.abs(s[0].y),d=Math.abs(s[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(s[f-1],s[f]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(Xe(s[f-1].dot(s[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(a,g))}o[f].crossVectors(s[f],r[f])}if(t===!0){let f=Math.acos(Xe(r[0].dot(r[e]),-1,1));f/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(f=-f);for(let g=1;g<=e;g++)r[g].applyMatrix4(c.makeRotationAxis(s[g],f*g)),o[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},_s=class extends Qt{constructor(e=0,t=0,n=1,s=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new ie){let n=t,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(o?r=0:r=s),this.aClockwise===!0&&!o&&(r===s?r=-s:r=r-s);let a=this.aStartAngle+e*r,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=c-this.aX,f=l-this.aY;c=d*h-f*u+this.aX,l=d*u+f*h+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Io=class extends _s{constructor(e,t,n,s,r,o){super(e,t,n,n,s,r,o),this.isArcCurve=!0,this.type="ArcCurve"}};function ul(){let i=0,e=0,t=0,n=0;function s(r,o,a,c){i=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){s(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,h,u){let d=(o-r)/l-(a-r)/(l+h)+(a-o)/h,f=(a-o)/h-(c-o)/(h+u)+(c-a)/u;d*=h,f*=h,s(o,a,d,f)},calc:function(r){let o=r*r,a=o*r;return i+e*r+t*o+n*a}}}
vendor: 1,148 bytes, line 40
40var po=new L,bc=new ul,Ec=new ul,Tc=new ul,Po=class extends Qt{constructor(e=[],t=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=s}getPoint(e,t=new L){let n=t,s=this.points,r=s.length,o=(r-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,h;this.closed||a>0?l=s[(a-1)%r]:(po.subVectors(s[0],s[1]).add(s[0]),l=po);let u=s[a%r],d=s[(a+1)%r];if(this.closed||a+2<r?h=s[(a+2)%r]:(po.subVectors(s[r-1],s[r-2]).add(s[r-1]),h=po),this.curveType==="centripetal"||this.curveType==="chordal"){let f=this.curveType==="chordal"?.5:.25,g=Math.pow(l.distanceToSquared(u),f),_=Math.pow(u.distanceToSquared(d),f),m=Math.pow(d.distanceToSquared(h),f);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),bc.initNonuniformCatmullRom(l.x,u.x,d.x,h.x,g,_,m),Ec.initNonuniformCatmullRom(l.y,u.y,d.y,h.y,g,_,m),Tc.initNonuniformCatmullRom(l.z,u.z,d.z,h.z,g,_,m)}else this.curveType==="catmullrom"&&(bc.initCatmullRom(l.x,u.x,d.x,h.x,this.tension),Ec.initCatmullRom(l.y,u.y,d.y,h.y,this.tension),Tc.init
vendor: 7,255 bytes, line 40
40CatmullRom(l.z,u.z,d.z,h.z,this.tension));return n.set(bc.calc(c),Ec.calc(c),Tc.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let s=e.points[t];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let s=this.points[t];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let s=e.points[t];this.points.push(new L().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Jh(i,e,t,n,s){let r=(n-e)*.5,o=(s-t)*.5,a=i*i,c=i*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*i+t}function Vf(i,e){let t=1-i;return t*t*e}function Gf(i,e){return 2*(1-i)*i*e}function Wf(i,e){return i*i*e}function Ys(i,e,t,n){return Vf(i,e)+Gf(i,t)+Wf(i,n)}function Xf(i,e){let t=1-i;return t*t*t*e}function qf(i,e){let t=1-i;return 3*t*t*i*e}function Yf(i,e){return 3*(1-i)*i*i*e}function Zf(i,e){return i*i*i*e}function Zs(i,e,t,n,s){return Xf(i,e)+qf(i,t)+Yf(i,n)+Zf(i,s)}var fr=class extends Qt{constructor(e=new ie,t=new ie,n=new ie,s=new ie){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=s}getPoint(e,t=new ie){let n=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Zs(e,s.x,r.x,o.x,a.x),Zs(e,s.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Lo=class extends Qt{constructor(e=new L,t=new L,n=new L,s=new L){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=s}getPoint(e,t=new L){let n=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Zs(e,s.x,r.x,o.x,a.x),Zs(e,s.y,r.y,o.y,a.y),Zs(e,s.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},pr=class extends Qt{constructor(e=new ie,t=new ie){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Do=class extends Qt{constructor(e=new L,t=new L){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new L){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new L){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},mr=class extends Qt{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,s=this.v0,r=this.v1,o=this.v2;return n.set(Ys(e,s.x,r.x,o.x),Ys(e,s.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},No=class extends Qt{constructor(e=new L,t=new L,n=new L){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new L){let n=t,s=this.v0,r=this.v1,o=this.v2;return n.set(Ys(e,s.x,r.x,o.x),Ys(e,s.y,r.y,o.y),Ys(e,s.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},gr=class extends Qt{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ie){let n=t,s=this.points,r=(s.length-1)*e,o=Math.floor(r),a=r-o,c=s[o===0?o:o-1],l=s[o],h=s[o>s.length-2?s.length-1:o+1],u=s[o>s.length-3?s.length-1:o+2];return n.set(Jh(a,c.x,l.x,h.x,u.x),Jh(a,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let s=e.points[t];this.points.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let s=e.points[t];this.points.push(new ie().fromArray(s))}return this}},Uc=Object.freeze({__proto__:null,ArcCurve:Io,CatmullRomCurve3:Po,CubicBezierCurve:fr,CubicBezierCurve3:Lo,EllipseCurve:_s,LineCurve:pr,LineCurve3:Do,QuadraticBezierCurve:mr,QuadraticBezierCurve3:No,SplineCurve:gr}),Uo=class extends Qt{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Uc[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=n){let o=s[r]-n,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,s=this.curves.length;n<s;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let s=0,r=this.curves;s<r.length;s++){let o=r[s],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 5,316 bytes, line 40
40plineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let h=c[l];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let s=e.curves[t];this.curves.push(s.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let s=this.curves[t];e.curves.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let s=e.curves[t];this.curves.push(new Uc[s.type]().fromJSON(s))}return this}},Ri=class extends Uo{constructor(e){super(),this.type="Path",this.currentPoint=new ie,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new pr(this.currentPoint.clone(),new ie(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,s){let r=new mr(this.currentPoint.clone(),new ie(e,t),new ie(n,s));return this.curves.push(r),this.currentPoint.set(n,s),this}bezierCurveTo(e,t,n,s,r,o){let a=new fr(this.currentPoint.clone(),new ie(e,t),new ie(n,s),new ie(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new gr(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,s,r,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,s,r,o),this}absarc(e,t,n,s,r,o){return this.absellipse(e,t,n,n,s,r,o),this}ellipse(e,t,n,s,r,o,a,c){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,n,s,r,o,a,c),this}absellipse(e,t,n,s,r,o,a,c){let l=new _s(e,t,n,s,r,o,a,c);if(this.curves.length>0){let u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},xs=class extends Ri{constructor(e){super(e),this.uuid=on(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,s=this.holes.length;n<s;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let s=e.holes[t];this.holes.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let s=this.holes[t];e.holes.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let s=e.holes[t];this.holes.push(new Ri().fromJSON(s))}return this}};function Kf(i,e,t=2){let n=e&&e.length,s=n?e[0]*t:i.length,r=Ju(i,0,s,t,!0),o=[];if(!r||r.next===r.prev)return o;let a,c,l;if(n&&(r=ep(i,e,r,t)),i.length>80*t){a=1/0,c=1/0;let h=-1/0,u=-1/0;for(let d=t;d<s;d+=t){let f=i[d],g=i[d+1];f<a&&(a=f),g<c&&(c=g),f>h&&(h=f),g>u&&(u=g)}l=Math.max(h-a,u-c),l=l!==0?32767/l:0}return _r(r,o,t,a,c,l,0),o}function Ju(i,e,t,n,s){let r;if(s===up(i,e,t,n)>0)for(let o=e;o<t;o+=n)r=jh(o/n|0,i[o],i[o+1],r);else for(let o=t-n;o>=e;o-=n)r=jh(o/n|0,i[o],i[o+1],r);return r&&ys(r,r.next)&&(yr(r),r=r.next),r}function Ci(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(ys(t,t.next)||gt(t.prev,t,t.next)===0)){if(yr(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function _r(i,e,t,n,s,r,o){if(!i)return;!o&&r&&rp(i,n,s,r);let a=i;for(;i.prev!==i.next;){let c=i.prev,l=i.next;if(r?Jf(i,n,s,r):$f(i)){e.push(c.i,i.i,l.i),yr(i),i=l.next,a=l.next;continue}if(i=l,i===a){o?o===1?(i=jf(Ci(i),e),_r(i,e,t,n,s,r,2)):o===2&&Qf(i,e,t,n,s,r):_r(Ci(i),e,t,n,s,r,1);break}}}function $f(i){let e=i.prev,t=i,n=i.next;if(gt(e,t,n)>=0)return!1;let s=e.x,r=t.x,o=n.x,a=e.y,c=t.y,l=n.y,h=Math.min(s,r,o),u=Math.min(a,c,l),d=Math.max(s,r,o),f=Math.max(a,c,l),g=n.next;for(;g!==e;){if(g.x>=h&&g.x<=d&&g.y>=u&&g.y<=f&&Ws(s,a,r,c,o,l,g.x,g.y)&>(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Jf(i,e,t,n){let s=i.prev,r=i,o=i.next;if(gt(s,r,o)>=0)return!1;let a=s.x,c=r.x,l=o.x,h=s.y,u=r.y,d=o.y,f=Math.min(a,c,l),g=Math.min(h,u,d),_=Math.max(a,c,l),m=Math.max(h,u,d),p=Oc(f,g,e,t,n),E=Oc(_,m,e,t,n),S=i.prevZ,x=i.nextZ;for(;S&&S.z>=p&&x&&x.z<=E;){if(S.x>=f&&S.x<=_&&S.y>=g&&S.y<=m&&S!==s&&S!==o&&Ws(a,h,c,u,l,d,S.x,S.y)&>(S.prev,S,S.next)>=0||(S=S.prevZ,x.x>=f&&x.x<=_&&x.y>=g&&x.y<=m&&x!==s&&x!==o&&Ws(a,h,c,u,l,d,x.x,x.y)&>(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;S&&S.z>=p;){if(S.x>=f&&S.x<=_&&S.y>=g&&S.y<=m&&S!==s&&S!==o&&Ws(a,h,c,u,l,d,S.x,S.y)&>(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;x&&x.z<=E;){if(x.x>=f&&x.x<=_&&x.y>=g&&x.y<=m&&x!==s&&x!==o&&Ws(a,h,c,u,l,d,x.x,x.y)&>(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function jf(i,e){let t=i;do{let n=t.prev,s=t.next.next;!ys(n,s)&&Qu(n,t,t.next,s)&&xr(n,s)&&xr(s,n)&&(e.push(n.i,t.i,s.i),yr(t),yr(t.next),t=i=s),t=t.next}
vendor: 37,646 bytes, line 40
40while(t!==i);return Ci(t)}function Qf(i,e,t,n,s,r){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&cp(o,a)){let c=ed(o,a);o=Ci(o,o.next),c=Ci(c,c.next),_r(o,e,t,n,s,r,0),_r(c,e,t,n,s,r,0);return}a=a.next}o=o.next}while(o!==i)}function ep(i,e,t,n){let s=[];for(let r=0,o=e.length;r<o;r++){let a=e[r]*n,c=r<o-1?e[r+1]*n:i.length,l=Ju(i,a,c,n,!1);l===l.next&&(l.steiner=!0),s.push(ap(l))}s.sort(tp);for(let r=0;r<s.length;r++)t=np(s[r],t);return t}function tp(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function np(i,e){let t=ip(i,e);if(!t)return e;let n=ed(t,i);return Ci(n,n.next),Ci(t,t.next)}function ip(i,e){let t=e,n=i.x,s=i.y,r=-1/0,o;if(ys(i,t))return t;do{if(ys(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){let u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>r&&(r=u,o=t.x<t.next.x?t:t.next,u===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,c=o.x,l=o.y,h=1/0;t=o;do{if(n>=t.x&&t.x>=c&&n!==t.x&&ju(s<l?n:r,s,c,l,s<l?r:n,s,t.x,t.y)){let u=Math.abs(s-t.y)/(n-t.x);xr(t,i)&&(u<h||u===h&&(t.x>o.x||t.x===o.x&&sp(o,t)))&&(o=t,h=u)}t=t.next}while(t!==a);return o}function sp(i,e){return gt(i.prev,i,e.prev)<0&>(e.next,i,i.next)<0}function rp(i,e,t,n){let s=i;do s.z===0&&(s.z=Oc(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,op(s)}function op(i){let e,t=1;do{let n=i,s;i=null;let r=null;for(e=0;n;){e++;let o=n,a=0;for(let l=0;l<t&&(a++,o=o.nextZ,!!o);l++);let c=t;for(;a>0||c>0&&o;)a!==0&&(c===0||!o||n.z<=o.z)?(s=n,n=n.nextZ,a--):(s=o,o=o.nextZ,c--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=o}r.nextZ=null,t*=2}while(e>1);return i}function Oc(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function ap(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function ju(i,e,t,n,s,r,o,a){return(s-o)*(e-a)>=(i-o)*(r-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(n-a)}function Ws(i,e,t,n,s,r,o,a){return!(i===o&&e===a)&&ju(i,e,t,n,s,r,o,a)}function cp(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!lp(i,e)&&(xr(i,e)&&xr(e,i)&&hp(i,e)&&(gt(i.prev,i,e.prev)||gt(i,e.prev,e))||ys(i,e)&>(i.prev,i,i.next)>0&>(e.prev,e,e.next)>0)}function gt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ys(i,e){return i.x===e.x&&i.y===e.y}function Qu(i,e,t,n){let s=go(gt(i,e,t)),r=go(gt(i,e,n)),o=go(gt(t,n,i)),a=go(gt(t,n,e));return!!(s!==r&&o!==a||s===0&&mo(i,t,e)||r===0&&mo(i,n,e)||o===0&&mo(t,i,n)||a===0&&mo(t,e,n))}function mo(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function go(i){return i>0?1:i<0?-1:0}function lp(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Qu(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function xr(i,e){return gt(i.prev,i,i.next)<0?gt(i,e,i.next)>=0&>(i,i.prev,e)>=0:gt(i,e,i.prev)<0||gt(i,i.next,e)<0}function hp(i,e){let t=i,n=!1,s=(i.x+e.x)/2,r=(i.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function ed(i,e){let t=Fc(i.i,i.x,i.y),n=Fc(e.i,e.x,e.y),s=i.next,r=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function jh(i,e,t,n){let s=Fc(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function yr(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Fc(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function up(i,e,t,n){let s=0;for(let r=e,o=t-n;r<t;r+=n)s+=(i[o]-i[r])*(i[r+1]+i[o+1]),o=r;return s}var Bc=class{static triangulate(e,t,n=2){return Kf(e,t,n)}},vi=class i{static area(e){let t=e.length,n=0;for(let s=t-1,r=0;r<t;s=r++)n+=e[s].x*e[r].y-e[r].x*e[s].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],s=[],r=[];Qh(e),eu(n,e);let o=e.length;t.forEach(Qh);for(let c=0;c<t.length;c++)s.push(o),o+=t[c].length,eu(n,t[c]);let a=Bc.triangulate(n,s);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}};function Qh(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function eu(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var vr=class i extends Mt{constructor(e=new xs([new ie(.5,.5),new ie(-.5,.5),new ie(-.5,-.5),new ie(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,s=[],r=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new _t(s,3)),this.setAttribute("uv",new _t(r,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:f-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3,p=t.extrudePath,E=t.UVGenerator!==void 0?t.UVGenerator:dp,S,x=!1,R,w,P,T;p&&(S=p.getSpacedPoints(h),x=!0,d=!1,R=p.computeFrenetFrames(h,!1),w=new L,P=new L,T=new L),d||(m=0,f=0,g=0,_=0);let y=a.extractPoints(l),v=y.shape,C=y.holes;if(!vi.isClockWise(v)){v=v.reverse();for(let j=0,$=C.length;j<$;j++){let k=C[j];vi.isClockWise(k)&&(C[j]=k.reverse())}}function U(j){let k=10000000000000001e-36,Z=j[0];for(let ne=1;ne<=j.length;ne++){let se=ne%j.length,ue=j[se],ke=ue.x-Z.x,ze=ue.y-Z.y,A=ke*ke+ze*ze,M=Math.max(Math.abs(ue.x),Math.abs(ue.y),Math.abs(Z.x),Math.abs(Z.y)),z=k*M*M;if(A<=z){j.splice(se,1),ne--;continue}Z=ue}}U(v),C.forEach(U);let B=C.length,G=v;for(let j=0;j<B;j++){let $=C[j];v=v.concat($)}function V(j,$,k){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),j.clone().addScaledVector($,k)}let J=v.length;function H(j,$,k){let Z,ne,se,ue=j.x-$.x,ke=j.y-$.y,ze=k.x-j.x,A=k.y-j.y,M=ue*ue+ke*ke,z=ue*A-ke*ze;if(Math.abs(z)>Number.EPSILON){let q=Math.sqrt(M),te=Math.sqrt(ze*ze+A*A),Y=$.x-ke/q,we=$.y+ue/q,he=k.x-A/te,Ee=k.y+ze/te,Te=((he-Y)*A-(Ee-we)*ze)/(ue*A-ke*ze);Z=Y+ue*Te-j.x,ne=we+ke*Te-j.y;let re=Z*Z+ne*ne;if(re<=2)return new ie(Z,ne);se=Math.sqrt(re/2)}else{let q=!1;ue>Number.EPSILON?ze>Number.EPSILON&&(q=!0):ue<-Number.EPSILON?ze<-Number.EPSILON&&(q=!0):Math.sign(ke)===Math.sign(A)&&(q=!0),q?(Z=-ke,ne=ue,se=Math.sqrt(M)):(Z=ue,ne=ke,se=Math.sqrt(M/2))}return new ie(Z/se,ne/se)}let ce=[];for(let j=0,$=G.length,k=$-1,Z=j+1;j<$;j++,k++,Z++)k===$&&(k=0),Z===$&&(Z=0),ce[j]=H(G[j],G[k],G[Z]);let fe=[],ye,Ue=ce.concat();for(let j=0,$=B;j<$;j++){let k=C[j];ye=[];for(let Z=0,ne=k.length,se=ne-1,ue=Z+1;Z<ne;Z++,se++,ue++)se===ne&&(se=0),ue===ne&&(ue=0),ye[Z]=H(k[Z],k[se],k[ue]);fe.push(ye),Ue=Ue.concat(ye)}let Be;if(m===0)Be=vi.triangulateShape(G,C);else{let j=[],$=[];for(let k=0;k<m;k++){let Z=k/m,ne=f*Math.cos(Z*Math.PI/2),se=g*Math.sin(Z*Math.PI/2)+_;for(let ue=0,ke=G.length;ue<ke;ue++){let ze=V(G[ue],ce[ue],se);Re(ze.x,ze.y,-ne),Z===0&&j.push(ze)}for(let ue=0,ke=B;ue<ke;ue++){let ze=C[ue];ye=fe[ue];let A=[];for(let M=0,z=ze.length;M<z;M++){let q=V(ze[M],ye[M],se);Re(q.x,q.y,-ne),Z===0&&A.push(q)}Z===0&&$.push(A)}}Be=vi.triangulateShape(j,$)}let Ze=Be.length,qe=g+_;for(let j=0;j<J;j++){let $=d?V(v[j],Ue[j],qe):v[j];x?(P.copy(R.normals[0]).multiplyScalar($.x),w.copy(R.binormals[0]).multiplyScalar($.y),T.copy(S[0]).add(P).add(w),Re(T.x,T.y,T.z)):Re($.x,$.y,0)}for(let j=1;j<=h;j++)for(let $=0;$<J;$++){let k=d?V(v[$],Ue[$],qe):v[$];x?(P.copy(R.normals[j]).multiplyScalar(k.x),w.copy(R.binormals[j]).multiplyScalar(k.y),T.copy(S[j]).add(P).add(w),Re(T.x,T.y,T.z)):Re(k.x,k.y,u/h*j)}for(let j=m-1;j>=0;j--){let $=j/m,k=f*Math.cos($*Math.PI/2),Z=g*Math.sin($*Math.PI/2)+_;for(let ne=0,se=G.length;ne<se;ne++){let ue=V(G[ne],ce[ne],Z);Re(ue.x,ue.y,u+k)}for(let ne=0,se=C.length;ne<se;ne++){let ue=C[ne];ye=fe[ne];for(let ke=0,ze=ue.length;ke<ze;ke++){let A=V(ue[ke],ye[ke],Z);x?Re(A.x,A.y+S[h-1].y,S[h-1].x+k):Re(A.x,A.y,u+k)}}}K(),ee();function K(){let j=s.length/3;if(d){let $=0,k=J*$;for(let Z=0;Z<Ze;Z++){let ne=Be[Z];Me(ne[2]+k,ne[1]+k,ne[0]+k)}$=h+m*2,k=J*$;for(let Z=0;Z<Ze;Z++){let ne=Be[Z];Me(ne[0]+k,ne[1]+k,ne[2]+k)}}else{for(let $=0;$<Ze;$++){let k=Be[$];Me(k[2],k[1],k[0])}for(let $=0;$<Ze;$++){let k=Be[$];Me(k[0]+J*h,k[1]+J*h,k[2]+J*h)}}n.addGroup(j,s.length/3-j,0)}function ee(){let j=s.length/3,$=0;xe(G,$),$+=G.length;for(let k=0,Z=C.length;k<Z;k++){let ne=C[k];xe(ne,$),$+=ne.length}n.addGroup(j,s.length/3-j,1)}function xe(j,$){let k=j.length;for(;--k>=0;){let Z=k,ne=k-1;ne<0&&(ne=j.length-1);for(let se=0,ue=h+m*2;se<ue;se++){let ke=J*se,ze=J*(se+1),A=$+Z+ke,M=$+ne+ke,z=$+ne+ze,q=$+Z+ze;Ke(A,M,z,q)}}}function Re(j,$,k){c.push(j),c.push($),c.push(k)}function Me(j,$,k){Ie(j),Ie($),Ie(k);let Z=s.length/3,ne=E.generateTopUV(n,s,Z-3,Z-2,Z-1);I(ne[0]),I(ne[1]),I(ne[2])}function Ke(j,$,k,Z){Ie(j),Ie($),Ie(Z),Ie($),Ie(k),Ie(Z);let ne=s.length/3,se=E.generateSideWallUV(n,s,ne-6,ne-3,ne-2,ne-1);I(se[0]),I(se[1]),I(se[3]),I(se[1]),I(se[2]),I(se[3])}function Ie(j){s.push(c[j*3+0]),s.push(c[j*3+1]),s.push(c[j*3+2])}function I(j){r.push(j.x),r.push(j.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return fp(t,n,e)}static fromJSON(e,t){let n=[];for(let r=0,o=e.shapes.length;r<o;r++){let a=t[e.shapes[r]];n.push(a)}let s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new Uc[s.type]().fromJSON(s)),new i(n,e.options)}},dp={generateTopUV:function(i,e,t,n,s){let r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[s*3],h=e[s*3+1];return[new ie(r,o),new ie(a,c),new ie(l,h)]},generateSideWallUV:function(i,e,t,n,s,r){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],h=e[n*3+1],u=e[n*3+2],d=e[s*3],f=e[s*3+1],g=e[s*3+2],_=e[r*3],m=e[r*3+1],p=e[r*3+2];return Math.abs(a-h)<Math.abs(o-l)?[new ie(o,1-c),new ie(l,1-u),new ie(d,1-g),new ie(_,1-p)]:[new ie(a,1-c),new ie(h,1-u),new ie(f,1-g),new ie(m,1-p)]}};function fp(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,s=i.length;n<s;n++){let r=i[n];t.shapes.push(r.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Mr=class i extends Co{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,s=[-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(s,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new i(e.radius,e.detail)}};var Ii=class i extends Mt{constructor(e=1,t=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:s};let r=e/2,o=t/2,a=Math.floor(n),c=Math.floor(s),l=a+1,h=c+1,u=e/a,d=t/c,f=[],g=[],_=[],m=[];for(let p=0;p<h;p++){let E=p*d-o;for(let S=0;S<l;S++){let x=S*u-r;g.push(x,-E,0),_.push(0,0,1),m.push(S/a),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let E=0;E<a;E++){let S=E+l*p,x=E+l*(p+1),R=E+1+l*(p+1),w=E+1+l*p;f.push(S,x,w),f.push(x,R,w)}this.setIndex(f),this.setAttribute("position",new _t(g,3)),this.setAttribute("normal",new _t(_,3)),this.setAttribute("uv",new _t(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var wt=class extends Gt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Le(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 Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rl,this.normalScale=new ie(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 gn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Wt=class extends wt{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ie(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Xe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Le(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 Le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Le(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(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};var Oo=class extends Gt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Fu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Fo=class extends Gt{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function _o(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function pp(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function mp(i){function e(s,r){return i[s]-i[r]}let t=i.length,n=new Array(t);for(let s=0;s!==t;++s)n[s]=s;return n.sort(e),n}function tu(i,e,t){let n=i.length,s=new i.constructor(n);for(let r=0,o=0;o!==n;++r){let a=t[r]*e;for(let c=0;c!==e;++c)s[o++]=i[a+c]}return s}function td(i,e,t,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push(...o)),r=i[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=i[s++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=i[s++];while(r!==void 0)}var Vn=class{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,s=t[n],r=t[n-1];n:{e:{let o;t:{i:if(!(e<s)){for(let a=n+2;;){if(s===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=s,s=t[++n],e<s)break e}o=t.length;break t}if(!(e>=r)){let a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(s=r,r=t[--n-1],e>=r)break e}o=n,n=0;break t}break n}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(s=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s;for(let o=0;o!==s;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Bo=class extends Vn{constructor(e,t,n,s){super(e,t,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ic,endingEnd:Ic}}intervalChanged_(e,t,n){let s=this.parameterPositions,r=e-2,o=e+1,a=s[r],c=s[o];if(a===void 0)switch(this.getSettings_().endingStart){case Pc:r=e,a=2*t-n;break;case Lc:r=s.length-2,a=t+s[r]-s[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Pc:o=e,c=2*n-t;break;case Lc:o=1,c=n+s[1]-s[0];break;default:o=e-1,c=t}let l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=o*h}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,g=(n-t)/(s-t),_=g*g,m=_*g,p=-d*m+2*d*_-d*g,E=(1+d)*m+(-1.5-2*d)*_+(-.5+d)*g+1,S=(-1-f)*m+(1.5+f)*_+.5*g,x=f*m-f*_;for(let R=0;R!==a;++R)r[R]=p*o[h+R]+E*o[l+R]+S*o[c+R]+x*o[u+R];return r}},zo=class extends Vn{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=(n-t)/(s-t),u=1-h;for(let d=0;d!==a;++d)r[d]=o[l+d]*u+o[c+d]*h;return r}},ko=class extends Vn{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}},Xt=class{constructor(e,t,n,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=_o(t,this.TimeBufferType),this.values=_o(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:_o(e.times,Array),values:_o(e.values,Array)};let s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ko(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new zo(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Bo(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case bi:t=this.InterpolantFactoryMethodDiscrete;break;case Ei:t=this.InterpolantFactoryMethodLinear;break;case xo:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return bi;case this.InterpolantFactoryMethodLinear:return Ei;case this.InterpolantFactoryMethodSmooth:return xo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]*=e}return this}trim(e,t){let n=this.times,s=n.length,r=0,o=s-1;for(;r!==s&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){let c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(s!==void 0&&pp(s))for(let a=0,c=s.length;a!==c;++a){let l=s[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===xo,r=e.length-1,o=1;for(let a=1;a<r;++a){let c=!1,l=e[a],h=e[a+1];if(l!==h&&(a!==1||l!==e[0]))if(s)c=!0;else{let u=a*n,d=u-n,f=u+n;for(let g=0;g!==n;++g){let _=t[u+g];if(_!==t[d+g]||_!==t[f+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];let u=a*n,d=o*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}};Xt.prototype.ValueTypeName="";Xt.prototype.TimeBufferType=Float32Array;Xt.prototype.ValueBufferType=Float32Array;Xt.prototype.DefaultInterpolation=Ei;var Gn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Gn.prototype.ValueTypeName="bool";Gn.prototype.ValueBufferType=Array;Gn.prototype.DefaultInterpolation=bi;Gn.prototype.InterpolantFactoryMethodLinear=void 0;Gn.prototype.InterpolantFactoryMethodSmooth=void 0;var Sr=class extends Xt{constructor(e,t,n,s){super(e,t,n,s)}};Sr.prototype.ValueTypeName="color";var An=class extends Xt{constructor(e,t,n,s){super(e,t,n,s)}};An.prototype.ValueTypeName="number";var Ho=class extends Vn{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(s-t),l=e*a;for(let h=l+a;l!==h;l+=4)Ft.slerpFlat(r,0,o,l-a,o,l,c);return r}},wn=class extends Xt{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new Ho(this.times,this.values,this.getValueSize(),e)}};wn.prototype.ValueTypeName="quaternion";wn.prototype.InterpolantFactoryMethodSmooth=void 0;var Wn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Wn.prototype.ValueTypeName="string";Wn.prototype.ValueBufferType=Array;Wn.prototype.DefaultInterpolation=bi;Wn.prototype.InterpolantFactoryMethodLinear=void 0;Wn.prototype.InterpolantFactoryMethodSmooth=void 0;var Rn=class extends Xt{constructor(e,t,n,s){super(e,t,n,s)}};Rn.prototype.ValueTypeName="vector";var br=class{constructor(e="",t=-1,n=[],s=Ou){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=on(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,s=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(_p(n[o]).scale(s));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,o=n.length;r!==o;++r)t.push(Xt.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(e,t,n,s){let r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);let h=mp(c);c=tu(c,1,h),l=tu(l,1,h),!s&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new An(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let s=e;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===t)return n[s];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let s={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){let l=e[a],h=l.name.match(r);if(h&&h.length>1){let u=h[1],d=s[u];d||(s[u]=d=[]),d.push(l)}}let o=[];for(let a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,n));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,g,_){if(f.length!==0){let m=[],p=[];td(f,m,p,g),m.length!==0&&_.push(new u(d,m,p))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u<l.length;u++){let d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){let f={},g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let _=0;_<d[g].morphTargets.length;_++)f[d[g].morphTargets[_]]=-1;for(let _ in f){let m=[],p=[];for(let E=0;E!==d[g].morphTargets.length;++E){let S=d[g];m.push(S.time),p.push(S.morphTarget===_?1:0)}s.push(new An(".morphTargetInfluence["+_+"]",m,p))}c=f.length*o}else{let f=".bones["+t[u].name+"]";n(Rn,f+".position",d,"pos",s),n(wn,f+".quaternion",d,"rot",s),n(Rn,f+".scale",d,"scl",s)}}return s.length===0?null:new this(r,c,s,a)}resetDuration(){let e=this.tracks,t=0;for(let n=0,s=e.length;n!==s;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function gp(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return An;case"vector":case"vector2":case"vector3":case"vector4":return Rn;case"color":return Sr;case"quaternion":return wn;case"bool":case"boolean":return Gn;case"string":return Wn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function _p(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=gp(i.type);if(i.times===void 0){let t=[],n=[];td(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var bn={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Vo=class{constructor(e,t,n){let s=this,r=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){let u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){let f=l[u],g=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}},nd=new Vo,Cn=class{constructor(e){this.manager=e!==void 0?e:nd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(s,r){n.load(e,s,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Cn.DEFAULT_MATERIAL_NAME="__DEFAULT";var zn={},zc=class extends Error{constructor(e,t){super(e),this.response=t}},vs=class extends Cn{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=bn.get(`file:${e}`);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(zn[e]!==void 0){zn[e].push({onLoad:t,onProgress:n,onError:s});return}zn[e]=[],zn[e].push({onLoad:t,onProgress:n,onError:s});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=zn[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,g=f!==0,_=0,m=new ReadableStream({start(p){E();function E(){u.read().then(({done:S,value:x})=>{if(S)p.close();else{_+=x.byteLength;let R=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:f});for(let w=0,P=h.length;w<P;w++){let T=h[w];T.onProgress&&T.onProgress(R)}p.enqueue(x),E()}},S=>{p.error(S)})}}});return new Response(m)}else throw new zc(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return l.json();default:if(a==="")return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(a),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(g=>f.decode(g))}}}).then(l=>{bn.add(`file:${e}`,l);let h=zn[e];delete zn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{let h=zn[e];if(h===void 0)throw this.manager.itemError(e),l;delete zn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var is=new WeakMap,Go=class extends Cn{constructor(e){super(e)}load(e,t,n,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,o=bn.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0);else{let u=is.get(o);u===void 0&&(u=[],is.set(o,u)),u.push({onLoad:t,onError:s})}return o}let a=as("img");function c(){h(),t&&t(this);let u=is.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];f.onLoad&&f.onLoad(this)}is.delete(this),r.manager.itemEnd(e)}function l(u){h(),s&&s(u),bn.remove(`image:${e}`);let d=is.get(this)||[];for(let f=0;f<d.length;f++){let g=d[f];g.onError&&g.onError(u)}is.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),bn.add(`image:${e}`,a),r.manager.itemStart(e),a.src=e,a}};var Pi=class extends Cn{constructor(e){super(e)}load(e,t,n,s){let r=new At,o=new Go(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,s),r}},Li=class extends dt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},Er=class extends Li{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(dt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Le(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},Ac=new Ve,nu=new L,iu=new L,Tr=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ie(512,512),this.mapType=yn,this.map=null,this.mapPass=null,this.matrix=new Ve,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ps,this._frameExtents=new ie(1,1),this._viewportCount=1,this._viewports=[new et(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;nu.setFromMatrixPosition(e.matrixWorld),t.position.copy(nu),iu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(iu),t.updateMatrixWorld(),Ac.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ac,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ac)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 4,102 bytes, line 40
40ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},kc=class extends Tr{constructor(){super(new vt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ti*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},Ar=class extends Li{constructor(e,t,n=0,s=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(dt.DEFAULT_UP),this.updateMatrix(),this.target=new dt,this.distance=n,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new kc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},su=new Ve,Gs=new L,wc=new L,Hc=class extends Tr{constructor(){super(new vt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ie(4,2),this._viewportCount=6,this._viewports=[new et(2,1,1,1),new et(0,1,1,1),new et(3,1,1,1),new et(1,1,1,1),new et(3,0,1,1),new et(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,s=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Gs.setFromMatrixPosition(e.matrixWorld),n.position.copy(Gs),wc.copy(n.position),wc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wc),n.updateMatrixWorld(),s.makeTranslation(-Gs.x,-Gs.y,-Gs.z),su.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(su,n.coordinateSystem,n.reversedDepth)}},wr=class extends Li{constructor(e,t,n=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new Hc}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},Di=class extends tr{constructor(e=-1,t=1,n=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,s,r,o){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-e,o=n+e,a=s+t,c=s-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}
vendor: 6,475 bytes, line 40
40this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Vc=class extends Tr{constructor(){super(new Di(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ai=class extends Li{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(dt.DEFAULT_UP),this.updateMatrix(),this.target=new dt,this.shadow=new Vc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};var Xn=class{static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var Rc=new WeakMap,Rr=class extends Cn{constructor(e){super(e),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"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,o=bn.get(`image-bitmap:${e}`);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(l=>{if(Rc.has(o)===!0)s&&s(Rc.get(o)),r.manager.itemError(e),r.manager.itemEnd(e);else return t&&t(l),r.manager.itemEnd(e),l});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return bn.add(`image-bitmap:${e}`,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){s&&s(l),Rc.set(c,l),bn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});bn.add(`image-bitmap:${e}`,c),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var Wo=class extends vt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},Cr=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};var dl="\\[\\]\\.:\\/",xp=new RegExp("["+dl+"]","g"),fl="[^"+dl+"]",yp="[^"+dl.replace("\\.","")+"]",vp=/((?:WC+[\/:])*)/.source.replace("WC",fl),Mp=/(WCOD+)?/.source.replace("WCOD",yp),Sp=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",fl),bp=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",fl),Ep=new RegExp("^"+vp+Mp+Sp+bp+"$"),Tp=["material","materials","bones","map"],Gc=class{constructor(e,t,n){let s=n||at.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},at=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(xp,"")}static parseTrackName(e){let t=Ep.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);Tp.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let o=0;o<r.length;o++){let a=r[o];if(a.name===t||a.uuid===t)return a;let c=n(a.children);if(c)return c}return null},s=n(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)e[t++]=n[s]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 4,335 bytes, line 40
40_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,s=t.propertyName,r=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[s];if(o===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+s+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=s;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};at.Composite=Gc;at.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};at.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};at.prototype.GetterByBindingType=[at.prototype._getValue_direct,at.prototype._getValue_array,at.prototype._getValue_arrayElement,at.prototype._getValue_toArray];at.prototype.SetterByBindingTypeAndVersioning=[[at.prototype._setValue_direct,at.prototype._setValue_direct_setNeedsUpdate,at.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[at.prototype._setValue_array,at.prototype._setValue_array_setNeedsUpdate,at.prototype._setValue_array_setMatr
vendor: 4,267 bytes, line 40
40ixWorldNeedsUpdate],[at.prototype._setValue_arrayElement,at.prototype._setValue_arrayElement_setNeedsUpdate,at.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[at.prototype._setValue_fromArray,at.prototype._setValue_fromArray_setNeedsUpdate,at.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Nx=new Float32Array(1);var ci=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Xe(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Xe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var Ir=class extends ms{constructor(e=10,t=10,n=4473924,s=8947848){n=new Le(n),s=new Le(s);let r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,f=0,g=-a;d<=t;d++,g+=o){c.push(-a,0,g,a,0,g),c.push(g,0,-a,g,0,a);let _=d===r?n:s;_.toArray(l,f),f+=3,_.toArray(l,f),f+=3,_.toArray(l,f),f+=3,_.toArray(l,f),f+=3}let h=new Mt;h.setAttribute("position",new _t(c,3)),h.setAttribute("color",new _t(l,3));let u=new Ai({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};var Pr=class extends En{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function pl(i,e,t,n){let s=Ap(n);switch(t){case tl:return i*e;case sa:return i*e/s.components*s.byteLength;case ra:return i*e/s.components*s.byteLength;case il:return i*e*2/s.components*s.byteLength;case oa:return i*e*2/s.components*s.byteLength;case nl:return i*e*3/s.components*s.byteLength;case en:return i*e*4/s.components*s.byteLength;case aa:return i*e*4/s.components*s.byteLength;case Dr:case Nr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ur:case Or:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case la:case ua:return Math.max(i,16)*Math.max(e,8)/4;case ca:case ha:return Math.max(i,8)*Math.max(e,8)/2;case da:case fa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case pa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ma:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ga:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case _a:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case xa:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case ya:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case va:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Ma:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Sa:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case ba:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Ea:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Ta:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Aa:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case wa:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Ra:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ca:case Ia:case Pa:return Math.ceil(i/4)*Math.ceil(e/4)*16;case La:case Da:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Na:case Ua:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Ap(i){switch(i){case yn:case Jc:return{byteLength:1,components:1};case Ss:case jc:case bs:return{byteLength:2,components:1};case na:case ia:return{byteLength:2,components:4};case ui:case ta:case cn:return{byteLength:4,components:1};case Qc:case el:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"180"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="
40180");function Ad(){let i=null,e=!1,t=null,n=null;function s(r,o){t(r,o),n=i.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(s),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){i=r}}}function Rp(i){let e=new WeakMap;function t(a,c){let l=a.array,h=a.usage,u=l.byteLength,d=i.createBuffer();i.bindBuffer(c,d),i.bufferData(c,l,h),a.onUploadCallback();let f;if(l instanceof Float32Array)f=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=i.HALF_FLOAT;else if(l instanceof Uint16Array)a.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=i.SHORT;else if(l instanceof Uint32Array)f=i.UNSIGNED_INT;else if(l instanceof Int32Array)f=i.INT;else if(l instanceof Int8Array)f=i.BYTE;else if(l instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:u}}function n(a,c,l){let h=c.array,u=c.updateRanges;if(i.bindBuffer(l,a),u.length===0)i.bufferSubData(l,0,h);else{u.sort((f,g)=>f.start-g.start);let d=0;for(let f=1;f<u.length;f++){let g=u[d],_=u[f];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++d,u[d]=_)}u.length=d+1;for(let f=0,g=u.length;f<g;f++){let _=u[f];i.bufferSubData(l,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);let c=e.get(a);c&&(i.deleteBuffer(c.buffer),e.delete(a))}function o(a,c){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let h=e.get(a);(!h||h.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=e.get(a);if(l===void 0)e.set(a,t(a,c));else if(l.version<a.version){if(l.size!==a.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(l.buffer,a,c),l.version=a.version}}return{get:s,remove:r,update:o}}var Cp=`#ifdef USE_ALPHAHASH 41 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 42#endif`,Ip=`#ifdef USE_ALPHAHASH 43 const float ALPHA_HASH_SCALE = 0.05; 44 float hash2D( vec2 value ) { 45 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 46 } 47 float hash3D( vec3 value ) { 48 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 49 } 50 float getAlphaHashThreshold( vec3 position ) { 51 float maxDeriv = max( 52 length( dFdx( position.xyz ) ), 53 length( dFdy( position.xyz ) ) 54 ); 55 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 56 vec2 pixScales = vec2( 57 exp2( floor( log2( pixScale ) ) ), 58 exp2( ceil( log2( pixScale ) ) ) 59 ); 60 vec2 alpha = vec2( 61 hash3D( floor( pixScales.x * position.xyz ) ), 62 hash3D( floor( pixScales.y * position.xyz ) ) 63 ); 64 float lerpFactor = fract( log2( pixScale ) ); 65 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 66 float a = min( lerpFactor, 1.0 - lerpFactor ); 67 vec3 cases = vec3( 68 x * x / ( 2.0 * a * ( 1.0 - a ) ), 69 ( x - 0.5 * a ) / ( 1.0 - a ), 70 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 71 ); 72 float threshold = ( x < ( 1.0 - a ) ) 73 ? ( ( x < a ) ? cases.x : cases.y ) 74 : cases.z; 75 return clamp( threshold , 1.0e-6, 1.0 ); 76 } 77#endif`,Pp=`#ifdef USE_ALPHAMAP 78 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 79#endif`,Lp=`#ifdef USE_ALPHAMAP 80 uniform sampler2D alphaMap; 81#endif`,Dp=`#ifdef USE_ALPHATEST 82 #ifdef ALPHA_TO_COVERAGE 83 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 84 if ( diffuseColor.a == 0.0 ) discard; 85 #else 86 if ( diffuseColor.a < alphaTest ) discard; 87 #endif 88#endif`,Np=`#ifdef USE_ALPHATEST 89 uniform float alphaTest; 90#endif`,Up=`#ifdef USE_AOMAP 91 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 92 reflectedLight.indirectDiffuse *= ambientOcclusion; 93 #if defined( USE_CLEARCOAT ) 94 clearcoatSpecularIndirect *= ambientOcclusion; 95 #endif 96 #if defined( USE_SHEEN ) 97 sheenSpecularIndirect *= ambientOcclusion; 98 #endif 99 #if defined( USE_ENVMAP ) && defined( STANDARD )
100 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 101 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 102 #endif 103#endif`,Op=`#ifdef USE_AOMAP 104 uniform sampler2D aoMap; 105 uniform float aoMapIntensity; 106#endif`,Fp=`#ifdef USE_BATCHING 107 #if ! defined( GL_ANGLE_multi_draw ) 108 #define gl_DrawID _gl_DrawID 109 uniform int _gl_DrawID; 110 #endif 111 uniform highp sampler2D batchingTexture; 112 uniform highp usampler2D batchingIdTexture; 113 mat4 getBatchingMatrix( const in float i ) { 114 int size = textureSize( batchingTexture, 0 ).x; 115 int j = int( i ) * 4; 116 int x = j % size; 117 int y = j / size; 118 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 119 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 120 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 121 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 122 return mat4( v1, v2, v3, v4 ); 123 } 124 float getIndirectIndex( const in int i ) { 125 int size = textureSize( batchingIdTexture, 0 ).x; 126 int x = i % size; 127 int y = i / size; 128 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 129 } 130#endif 131#ifdef USE_BATCHING_COLOR 132 uniform sampler2D batchingColorTexture; 133 vec3 getBatchingColor( const in float i ) { 134 int size = textureSize( batchingColorTexture, 0 ).x; 135 int j = int( i ); 136 int x = j % size; 137 int y = j / size; 138 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 139 } 140#endif`,Bp=`#ifdef USE_BATCHING 141 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 142#endif`,zp=`vec3 transformed = vec3( position ); 143#ifdef USE_ALPHAHASH 144 vPosition = vec3( position ); 145#endif`,kp=`vec3 objectNormal = vec3( normal ); 146#ifdef USE_TANGENT 147 vec3 objectTangent = vec3( tangent.xyz ); 148#endif`,Hp=`float G_BlinnPhong_Implicit( ) { 149 return 0.25; 150} 151float D_BlinnPhong( const in float shininess, const in float dotNH ) { 152 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 153} 154vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 155 vec3 halfDir = normalize( lightDir + viewDir ); 156 float dotNH = saturate( dot( normal, halfDir ) ); 157 float dotVH = saturate( dot( viewDir, halfDir ) ); 158 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 159 float G = G_BlinnPhong_Implicit( ); 160 float D = D_BlinnPhong( shininess, dotNH ); 161 return F * ( G * D ); 162} // validated`,Vp=`#ifdef USE_IRIDESCENCE 163 const mat3 XYZ_TO_REC709 = mat3( 164 3.2404542, -0.9692660, 0.0556434, 165 -1.5371385, 1.8760108, -0.2040259, 166 -0.4985314, 0.0415560, 1.0572252 167 ); 168 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 169 vec3 sqrtF0 = sqrt( fresnel0 ); 170 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 171 } 172 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 173 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 174 } 175 float IorToFresnel0( float transmittedIor, float incidentIor ) { 176 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 177 } 178 vec3 evalSensitivity( float OPD, vec3 shift ) { 179 float phase = 2.0 * PI * OPD * 1.0e-9; 180 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 181 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 182 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 183 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 184 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 ) ); 185 xyz /= 1.0685e-7; 186 vec3 rgb = XYZ_TO_REC709 * xyz; 187 return rgb; 188 } 189 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 190 vec3 I; 191 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 192 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 193 float cosTheta2Sq = 1.0 - sinTheta2Sq; 194 if ( cosTheta2Sq < 0.0 ) { 195 return vec3( 1.0 ); 196 } 197 float cosTheta2 = sqrt( cosTheta2Sq ); 198 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
199 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 200 float T121 = 1.0 - R12; 201 float phi12 = 0.0; 202 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 203 float phi21 = PI - phi12; 204 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 205 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 206 vec3 phi23 = vec3( 0.0 ); 207 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 208 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 209 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 210 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 211 vec3 phi = vec3( phi21 ) + phi23; 212 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 213 vec3 r123 = sqrt( R123 ); 214 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 215 vec3 C0 = R12 + Rs; 216 I = C0; 217 vec3 Cm = Rs - T121; 218 for ( int m = 1; m <= 2; ++ m ) { 219 Cm *= r123; 220 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 221 I += Cm * Sm; 222 } 223 return max( I, vec3( 0.0 ) ); 224 } 225#endif`,Gp=`#ifdef USE_BUMPMAP 226 uniform sampler2D bumpMap; 227 uniform float bumpScale; 228 vec2 dHdxy_fwd() { 229 vec2 dSTdx = dFdx( vBumpMapUv ); 230 vec2 dSTdy = dFdy( vBumpMapUv ); 231 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 232 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 233 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 234 return vec2( dBx, dBy ); 235 } 236 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 237 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 238 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 239 vec3 vN = surf_norm; 240 vec3 R1 = cross( vSigmaY, vN ); 241 vec3 R2 = cross( vN, vSigmaX ); 242 float fDet = dot( vSigmaX, R1 ) * faceDirection; 243 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 244 return normalize( abs( fDet ) * surf_norm - vGrad ); 245 } 246#endif`,Wp=`#if NUM_CLIPPING_PLANES > 0 247 vec4 plane; 248 #ifdef ALPHA_TO_COVERAGE 249 float distanceToPlane, distanceGradient; 250 float clipOpacity = 1.0; 251 #pragma unroll_loop_start 252 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 253 plane = clippingPlanes[ i ]; 254 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 255 distanceGradient = fwidth( distanceToPlane ) / 2.0; 256 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 257 if ( clipOpacity == 0.0 ) discard; 258 } 259 #pragma unroll_loop_end 260 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 261 float unionClipOpacity = 1.0; 262 #pragma unroll_loop_start 263 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 264 plane = clippingPlanes[ i ]; 265 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 266 distanceGradient = fwidth( distanceToPlane ) / 2.0; 267 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 268 } 269 #pragma unroll_loop_end 270 clipOpacity *= 1.0 - unionClipOpacity; 271 #endif 272 diffuseColor.a *= clipOpacity; 273 if ( diffuseColor.a == 0.0 ) discard; 274 #else 275 #pragma unroll_loop_start 276 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 277 plane = clippingPlanes[ i ]; 278 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 279 } 280 #pragma unroll_loop_end 281 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 282 bool clipped = true; 283 #pragma unroll_loop_start 284 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 287 } 288 #pragma unroll_loop_end 289 if ( clipped ) discard; 290 #endif 291 #endif 292#endif`,Xp=`#if NUM_CLIPPING_PLANES > 0 293 varying vec3 vClipPosition; 294 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 295#endif`,qp=`#if NUM_CLIPPING_PLANES > 0 296 varying vec3 vClipPosition; 297#endif`,Yp=`#if NUM_CLIPPING_PLANES > 0 298 vClipPosition = - mvPosition.xyz; 299#endif`,Zp=`#if defined( USE_COLOR_ALPHA ) 300 diffuseColor *= vColor; 301#elif defined( USE_COLOR ) 302 diffuseColor.rgb *= vColor; 303#endif`,Kp=`#if defined( USE_COLOR_ALPHA ) 304 varying vec4 vColor; 305#elif defined( USE_COLOR ) 306 varying vec3 vColor; 307#endif`,$p=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 310 varying vec3 vColor; 311#endif`,Jp=`#if defined( USE_COLOR_ALPHA ) 312 vColor = vec4( 1.0 ); 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 vColor = vec3( 1.0 ); 315#endif 316#ifdef USE_COLOR 317 vColor *= color; 318#endif 319#ifdef USE_INSTANCING_COLOR 320 vColor.xyz *= instanceColor.xyz; 321#endif 322#ifdef USE_BATCHING_COLOR 323 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 324 vColor.xyz *= batchingColor.xyz; 325#endif`,jp=`#define PI 3.141592653589793 326#define PI2 6.283185307179586 327#define PI_HALF 1.5707963267948966 328#define RECIPROCAL_PI 0.3183098861837907 329#define RECIPROCAL_PI2 0.15915494309189535 330#define EPSILON 1e-6 331#ifndef saturate 332#define saturate( a ) clamp( a, 0.0, 1.0 ) 333#endif 334#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 335float pow2( const in float x ) { return x*x; } 336vec3 pow2( const in vec3 x ) { return x*x; } 337float pow3( const in float x ) { return x*x*x; } 338float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 339float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 340float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 341highp float rand( const in vec2 uv ) { 342 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 343 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 344 return fract( sin( sn ) * c ); 345} 346#ifdef HIGH_PRECISION 347 float precisionSafeLength( vec3 v ) { return length( v ); } 348#else 349 float precisionSafeLength( vec3 v ) { 350 float maxComponent = max3( abs( v ) ); 351 return length( v / maxComponent ) * maxComponent; 352 } 353#endif 354struct IncidentLight { 355 vec3 color; 356 vec3 direction; 357 bool visible; 358}; 359struct ReflectedLight { 360 vec3 directDiffuse; 361 vec3 directSpecular; 362 vec3 indirectDiffuse; 363 vec3 indirectSpecular; 364}; 365#ifdef USE_ALPHAHASH 366 varying vec3 vPosition; 367#endif 368vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 369 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 370} 371vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 372 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 373} 374mat3 transposeMat3( const in mat3 m ) { 375 mat3 tmp; 376 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 377 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 378 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 379 return tmp; 380} 381bool isPerspectiveMatrix( mat4 m ) { 382 return m[ 2 ][ 3 ] == - 1.0; 383} 384vec2 equirectUv( in vec3 dir ) { 385 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 386 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 387 return vec2( u, v ); 388}
389vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 390 return RECIPROCAL_PI * diffuseColor; 391} 392vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 393 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 394 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 395} 396float F_Schlick( const in float 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} // validated`,Qp=`#ifdef ENVMAP_TYPE_CUBE_UV 400 #define cubeUV_minMipLevel 4.0 401 #define cubeUV_minTileSize 16.0 402 float getFace( vec3 direction ) { 403 vec3 absDirection = abs( direction ); 404 float face = - 1.0; 405 if ( absDirection.x > absDirection.z ) { 406 if ( absDirection.x > absDirection.y ) 407 face = direction.x > 0.0 ? 0.0 : 3.0; 408 else 409 face = direction.y > 0.0 ? 1.0 : 4.0; 410 } else { 411 if ( absDirection.z > absDirection.y ) 412 face = direction.z > 0.0 ? 2.0 : 5.0; 413 else 414 face = direction.y > 0.0 ? 1.0 : 4.0; 415 } 416 return face; 417 } 418 vec2 getUV( vec3 direction, float face ) { 419 vec2 uv; 420 if ( face == 0.0 ) { 421 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 422 } else if ( face == 1.0 ) { 423 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 424 } else if ( face == 2.0 ) { 425 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 426 } else if ( face == 3.0 ) { 427 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 428 } else if ( face == 4.0 ) { 429 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 430 } else { 431 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 432 } 433 return 0.5 * ( uv + 1.0 ); 434 } 435 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 436 float face = getFace( direction ); 437 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 438 mipInt = max( mipInt, cubeUV_minMipLevel ); 439 float faceSize = exp2( mipInt ); 440 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 441 if ( face > 2.0 ) { 442 uv.y += faceSize; 443 face -= 3.0; 444 } 445 uv.x += face * faceSize; 446 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 447 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 448 uv.x *= CUBEUV_TEXEL_WIDTH; 449 uv.y *= CUBEUV_TEXEL_HEIGHT; 450 #ifdef texture2DGradEXT 451 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 452 #else 453 return texture2D( envMap, uv ).rgb; 454 #endif 455 } 456 #define cubeUV_r0 1.0 457 #define cubeUV_m0 - 2.0 458 #define cubeUV_r1 0.8 459 #define cubeUV_m1 - 1.0 460 #define cubeUV_r4 0.4 461 #define cubeUV_m4 2.0 462 #define cubeUV_r5 0.305 463 #define cubeUV_m5 3.0 464 #define cubeUV_r6 0.21 465 #define cubeUV_m6 4.0 466 float roughnessToMip( float roughness ) { 467 float mip = 0.0; 468 if ( roughness >= cubeUV_r1 ) { 469 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 470 } else if ( roughness >= cubeUV_r4 ) { 471 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 472 } else if ( roughness >= cubeUV_r5 ) { 473 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 474 } else if ( roughness >= cubeUV_r6 ) { 475 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 476 } else { 477 mip = - 2.0 * log2( 1.16 * roughness ); } 478 return mip; 479 } 480 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 481 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 482 float mipF = fract( mip ); 483 float mipInt = floor( mip ); 484 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 485 if ( mipF == 0.0 ) { 486 return vec4( color0, 1.0 ); 487 } else { 488 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 489 return vec4( mix( color0, color1, mipF ), 1.0 ); 490 } 491 } 492#endif`,em=`vec3 transformedNormal = objectNormal; 493#ifdef USE_TANGENT 494 vec3 transformedTangent = objectTangent; 495#endif 496#ifdef USE_BATCHING 497 mat3 bm = mat3( batchingMatrix ); 498 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 499 transformedNormal = bm * transformedNormal; 500 #ifdef USE_TANGENT 501 transformedTangent = bm * transformedTangent; 502 #endif 503#endif 504#ifdef USE_INSTANCING 505 mat3 im = mat3( instanceMatrix ); 506 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 507 transformedNormal = im * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = im * transformedTangent; 510 #endif 511#endif 512transformedNormal = normalMatrix * transformedNormal; 513#ifdef FLIP_SIDED 514 transformedNormal = - transformedNormal; 515#endif 516#ifdef USE_TANGENT 517 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 518 #ifdef FLIP_SIDED 519 transformedTangent = - transformedTangent; 520 #endif 521#endif`,tm=`#ifdef USE_DISPLACEMENTMAP 522 uniform sampler2D displacementMap; 523 uniform float displacementScale; 524 uniform float displacementBias; 525#endif`,nm=`#ifdef USE_DISPLACEMENTMAP 526 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
526placementBias ); 527#endif`,im=`#ifdef USE_EMISSIVEMAP 528 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 529 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 530 emissiveColor = sRGBTransferEOTF( emissiveColor ); 531 #endif 532 totalEmissiveRadiance *= emissiveColor.rgb; 533#endif`,sm=`#ifdef USE_EMISSIVEMAP 534 uniform sampler2D emissiveMap; 535#endif`,rm="gl_FragColor = linearToOutputTexel( gl_FragColor );",om=`vec4 LinearTransferOETF( in vec4 value ) { 536 return value; 537} 538vec4 sRGBTransferEOTF( in vec4 value ) { 539 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 ); 540} 541vec4 sRGBTransferOETF( in vec4 value ) { 542 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 ); 543}`,am=`#ifdef USE_ENVMAP 544 #ifdef ENV_WORLDPOS 545 vec3 cameraToFrag; 546 if ( isOrthographic ) { 547 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 548 } else { 549 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 550 } 551 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 552 #ifdef ENVMAP_MODE_REFLECTION 553 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 554 #else 555 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 556 #endif 557 #else 558 vec3 reflectVec = vReflect; 559 #endif 560 #ifdef ENVMAP_TYPE_CUBE 561 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 562 #else 563 vec4 envColor = vec4( 0.0 ); 564 #endif 565 #ifdef ENVMAP_BLENDING_MULTIPLY 566 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 567 #elif defined( ENVMAP_BLENDING_MIX ) 568 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 569 #elif defined( ENVMAP_BLENDING_ADD ) 570 outgoingLight += envColor.xyz * specularStrength * reflectivity; 571 #endif 572#endif`,cm=`#ifdef USE_ENVMAP 573 uniform float envMapIntensity; 574 uniform float flipEnvMap; 575 uniform mat3 envMapRotation; 576 #ifdef ENVMAP_TYPE_CUBE 577 uniform samplerCube envMap; 578 #else 579 uniform sampler2D envMap; 580 #endif 581 582#endif`,lm=`#ifdef USE_ENVMAP 583 uniform float reflectivity; 584 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 585 #define ENV_WORLDPOS 586 #endif 587 #ifdef ENV_WORLDPOS 588 varying vec3 vWorldPosition; 589 uniform float refractionRatio; 590 #else 591 varying vec3 vReflect; 592 #endif 593#endif`,hm=`#ifdef USE_ENVMAP 594 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 595 #define ENV_WORLDPOS 596 #endif 597 #ifdef ENV_WORLDPOS 598 599 varying vec3 vWorldPosition; 600 #else 601 varying vec3 vReflect; 602 uniform float refractionRatio; 603 #endif 604#endif`,um=`#ifdef USE_ENVMAP 605 #ifdef ENV_WORLDPOS 606 vWorldPosition = worldPosition.xyz; 607 #else 608 vec3 cameraToVertex; 609 if ( isOrthographic ) { 610 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 611 } else {
612 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 613 } 614 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 615 #ifdef ENVMAP_MODE_REFLECTION 616 vReflect = reflect( cameraToVertex, worldNormal ); 617 #else 618 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 619 #endif 620 #endif 621#endif`,dm=`#ifdef USE_FOG 622 vFogDepth = - mvPosition.z; 623#endif`,fm=`#ifdef USE_FOG 624 varying float vFogDepth; 625#endif`,pm=`#ifdef USE_FOG 626 #ifdef FOG_EXP2 627 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 628 #else 629 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 630 #endif 631 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 632#endif`,mm=`#ifdef USE_FOG 633 uniform vec3 fogColor; 634 varying float vFogDepth; 635 #ifdef FOG_EXP2 636 uniform float fogDensity; 637 #else 638 uniform float fogNear; 639 uniform float fogFar; 640 #endif 641#endif`,gm=`#ifdef USE_GRADIENTMAP 642 uniform sampler2D gradientMap; 643#endif 644vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 645 float dotNL = dot( normal, lightDirection ); 646 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 647 #ifdef USE_GRADIENTMAP 648 return vec3( texture2D( gradientMap, coord ).r ); 649 #else 650 vec2 fw = fwidth( coord ) * 0.5; 651 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 652 #endif 653}`,_m=`#ifdef USE_LIGHTMAP 654 uniform sampler2D lightMap; 655 uniform float lightMapIntensity; 656#endif`,xm=`LambertMaterial material; 657material.diffuseColor = diffuseColor.rgb; 658material.specularStrength = specularStrength;`,ym=`varying vec3 vViewPosition; 659struct LambertMaterial { 660 vec3 diffuseColor; 661 float specularStrength; 662}; 663void 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 ) { 664 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 665 vec3 irradiance = dotNL * directLight.color; 666 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 667} 668void 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 ) { 669 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 670} 671#define RE_Direct RE_Direct_Lambert 672#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,vm=`uniform bool receiveShadow; 673uniform vec3 ambientLightColor; 674#if defined( USE_LIGHT_PROBES ) 675 uniform vec3 lightProbe[ 9 ]; 676#endif 677vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 678 float x = normal.x, y = normal.y, z = normal.z; 679 vec3 result = shCoefficients[ 0 ] * 0.886227; 680 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 681 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 682 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 683 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 684 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 685 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 686 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 687 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 688 return result; 689} 690vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 691 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 692 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 693 return irradiance; 694} 695vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 696 vec3 irradiance = ambientLightColor; 697 return irradiance; 698} 699float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 700 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 701 if ( cutoffDistance > 0.0 ) { 702 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 703 } 704 return distanceFalloff; 705} 706float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 707 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 708} 709#if NUM_DIR_LIGHTS > 0 710 struct DirectionalLight { 711 vec3 direction; 712 vec3 color; 713 }; 714 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 715 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 716 light.color = directionalLight.color; 717 light.direction = directionalLight.direction; 718 light.visible = true; 719 } 720#endif 721#if NUM_POINT_LIGHTS > 0 722 struct PointLight { 723 vec3 position; 724 vec3 color; 725 float distance; 726 float decay; 727 }; 728 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 729 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 730 vec3 lVector = pointLight.position - geometryPosition; 731 light.direction = normalize( lVector ); 732 float lightDistance = length( lVector ); 733 light.color = pointLight.color; 734 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 735 light.visible = ( light.color != vec3( 0.0 ) ); 736 } 737#endif
738#if NUM_SPOT_LIGHTS > 0 739 struct SpotLight { 740 vec3 position; 741 vec3 direction; 742 vec3 color; 743 float distance; 744 float decay; 745 float coneCos; 746 float penumbraCos; 747 }; 748 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 749 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 750 vec3 lVector = spotLight.position - geometryPosition; 751 light.direction = normalize( lVector ); 752 float angleCos = dot( light.direction, spotLight.direction ); 753 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 754 if ( spotAttenuation > 0.0 ) { 755 float lightDistance = length( lVector ); 756 light.color = spotLight.color * spotAttenuation; 757 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 758 light.visible = ( light.color != vec3( 0.0 ) ); 759 } else { 760 light.color = vec3( 0.0 ); 761 light.visible = false; 762 } 763 } 764#endif 765#if NUM_RECT_AREA_LIGHTS > 0 766 struct RectAreaLight { 767 vec3 color; 768 vec3 position; 769 vec3 halfWidth; 770 vec3 halfHeight; 771 }; 772 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 773 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 774#endif 775#if NUM_HEMI_LIGHTS > 0 776 struct HemisphereLight { 777 vec3 direction; 778 vec3 skyColor; 779 vec3 groundColor; 780 }; 781 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 782 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 783 float dotNL = dot( normal, hemiLight.direction ); 784 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 785 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 786 return irradiance; 787 } 788#endif`,Mm=`#ifdef USE_ENVMAP 789 vec3 getIBLIrradiance( const in vec3 normal ) { 790 #ifdef ENVMAP_TYPE_CUBE_UV 791 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 792 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 793 return PI * envMapColor.rgb * envMapIntensity; 794 #else 795 return vec3( 0.0 ); 796 #endif 797 } 798 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 799 #ifdef ENVMAP_TYPE_CUBE_UV 800 vec3 reflectVec = reflect( - viewDir, normal ); 801 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 802 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 803 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 804 return envMapColor.rgb * envMapIntensity; 805 #else 806 return vec3( 0.0 ); 807 #endif 808 } 809 #ifdef USE_ANISOTROPY 810 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 811 #ifdef ENVMAP_TYPE_CUBE_UV 812 vec3 bentNormal = cross( bitangent, viewDir ); 813 bentNormal = normalize( cross( bentNormal, bitangent ) ); 814 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 815 return getIBLRadiance( viewDir, bentNormal, roughness ); 816 #else 817 return vec3( 0.0 ); 818 #endif 819 } 820 #endif 821#endif`,Sm=`ToonMaterial material; 822material.diffuseColor = diffuseColor.rgb;`,bm=`varying vec3 vViewPosition; 823struct ToonMaterial { 824 vec3 diffuseColor; 825}; 826void 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 ) { 827 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 828 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 829} 830void 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 ) { 831 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 832} 833#define RE_Direct RE_Direct_Toon 834#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Em=`BlinnPhongMaterial material; 835material.diffuseColor = diffuseColor.rgb; 836material.specularColor = specular; 837material.specularShininess = shininess; 838material.specularStrength = specularStrength;`,Tm=`varying vec3 vViewPosition; 839struct BlinnPhongMaterial { 840 vec3 diffuseColor; 841 vec3 specularColor; 842 float specularShininess; 843 float specularStrength; 844}; 845void 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 ) {
846 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 847 vec3 irradiance = dotNL * directLight.color; 848 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 849 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 850} 851void 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 ) { 852 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 853} 854#define RE_Direct RE_Direct_BlinnPhong 855#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Am=`PhysicalMaterial material; 856material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 857vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 858float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 859material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 860material.roughness = min( material.roughness, 1.0 ); 861#ifdef IOR 862 material.ior = ior; 863 #ifdef USE_SPECULAR 864 float specularIntensityFactor = specularIntensity; 865 vec3 specularColorFactor = specularColor; 866 #ifdef USE_SPECULAR_COLORMAP 867 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 868 #endif 869 #ifdef USE_SPECULAR_INTENSITYMAP 870 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 871 #endif 872 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 873 #else 874 float specularIntensityFactor = 1.0; 875 vec3 specularColorFactor = vec3( 1.0 ); 876 material.specularF90 = 1.0; 877 #endif 878 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 879#else 880 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 881 material.specularF90 = 1.0; 882#endif 883#ifdef USE_CLEARCOAT 884 material.clearcoat = clearcoat; 885 material.clearcoatRoughness = clearcoatRoughness; 886 material.clearcoatF0 = vec3( 0.04 ); 887 material.clearcoatF90 = 1.0; 888 #ifdef USE_CLEARCOATMAP 889 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 890 #endif 891 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 892 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 893 #endif 894 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 895 material.clearcoatRoughness += geometryRoughness; 896 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 897#endif 898#ifdef USE_DISPERSION 899 material.dispersion = dispersion; 900#endif 901#ifdef USE_IRIDESCENCE 902 material.iridescence = iridescence; 903 material.iridescenceIOR = iridescenceIOR; 904 #ifdef USE_IRIDESCENCEMAP 905 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 906 #endif 907 #ifdef USE_IRIDESCENCE_THICKNESSMAP 908 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 909 #else 910 material.iridescenceThickness = iridescenceThicknessMaximum; 911 #endif 912#endif 913#ifdef USE_SHEEN 914 material.sheenColor = sheenColor; 915 #ifdef USE_SHEEN_COLORMAP 916 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 917 #endif 918 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 919 #ifdef USE_SHEEN_ROUGHNESSMAP 920 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 921 #endif 922#endif 923#ifdef USE_ANISOTROPY 924 #ifdef USE_ANISOTROPYMAP 925 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 926 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 927 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 928 #else 929 vec2 anisotropyV = anisotropyVector; 930 #endif 931 material.anisotropy = length( anisotropyV ); 932 if( material.anisotropy == 0.0 ) { 933 anisotropyV = vec2( 1.0, 0.0 ); 934 } else { 935 anisotropyV /= material.anisotropy; 936 material.anisotropy = saturate( material.anisotropy ); 937 } 938 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
939 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 940 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 941#endif`,wm
vendor: 14,687 bytes, lines 941-1242
941=`struct PhysicalMaterial { 942 vec3 diffuseColor; 943 float roughness; 944 vec3 specularColor; 945 float specularF90; 946 float dispersion; 947 #ifdef USE_CLEARCOAT 948 float clearcoat; 949 float clearcoatRoughness; 950 vec3 clearcoatF0; 951 float clearcoatF90; 952 #endif 953 #ifdef USE_IRIDESCENCE 954 float iridescence; 955 float iridescenceIOR; 956 float iridescenceThickness; 957 vec3 iridescenceFresnel; 958 vec3 iridescenceF0; 959 #endif 960 #ifdef USE_SHEEN 961 vec3 sheenColor; 962 float sheenRoughness; 963 #endif 964 #ifdef IOR 965 float ior; 966 #endif 967 #ifdef USE_TRANSMISSION 968 float transmission; 969 float transmissionAlpha; 970 float thickness; 971 float attenuationDistance; 972 vec3 attenuationColor; 973 #endif 974 #ifdef USE_ANISOTROPY 975 float anisotropy; 976 float alphaT; 977 vec3 anisotropyT; 978 vec3 anisotropyB; 979 #endif 980}; 981vec3 clearcoatSpecularDirect = vec3( 0.0 ); 982vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 983vec3 sheenSpecularDirect = vec3( 0.0 ); 984vec3 sheenSpecularIndirect = vec3(0.0 ); 985vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 986 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 987 float x2 = x * x; 988 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 989 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 990} 991float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 992 float a2 = pow2( alpha ); 993 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 994 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 995 return 0.5 / max( gv + gl, EPSILON ); 996} 997float D_GGX( const in float alpha, const in float dotNH ) { 998 float a2 = pow2( alpha ); 999 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1000 return RECIPROCAL_PI * a2 / pow2( denom ); 1001} 1002#ifdef USE_ANISOTROPY 1003 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 ) { 1004 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1005 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1006 float v = 0.5 / ( gv + gl ); 1007 return saturate(v); 1008 } 1009 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1010 float a2 = alphaT * alphaB; 1011 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1012 highp float v2 = dot( v, v ); 1013 float w2 = a2 / v2; 1014 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1015 } 1016#endif 1017#ifdef USE_CLEARCOAT 1018 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1019 vec3 f0 = material.clearcoatF0; 1020 float f90 = material.clearcoatF90; 1021 float roughness = material.clearcoatRoughness; 1022 float alpha = pow2( roughness ); 1023 vec3 halfDir = normalize( lightDir + viewDir ); 1024 float dotNL = saturate( dot( normal, lightDir ) ); 1025 float dotNV = saturate( dot( normal, viewDir ) ); 1026 float dotNH = saturate( dot( normal, halfDir ) ); 1027 float dotVH = saturate( dot( viewDir, halfDir ) ); 1028 vec3 F = F_Schlick( f0, f90, dotVH ); 1029 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1030 float D = D_GGX( alpha, dotNH ); 1031 return F * ( V * D ); 1032 } 1033#endif 1034vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1035 vec3 f0 = material.specularColor; 1036 float f90 = material.specularF90; 1037 float roughness = material.roughness; 1038 float alpha = pow2( roughness ); 1039 vec3 halfDir = normalize( lightDir + viewDir ); 1040 float dotNL = saturate( dot( normal, lightDir ) ); 1041 float dotNV = saturate( dot( normal, viewDir ) ); 1042 float dotNH = saturate( dot( normal, halfDir ) ); 1043 float dotVH = saturate( dot( viewDir, halfDir ) ); 1044 vec3 F = F_Schlick( f0, f90, dotVH ); 1045 #ifdef USE_IRIDESCENCE 1046 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1047 #endif 1048 #ifdef USE_ANISOTROPY 1049 float dotTL = dot( material.anisotropyT, lightDir ); 1050 float dotTV = dot( material.anisotropyT, viewDir ); 1051 float dotTH = dot( material.anisotropyT, halfDir ); 1052 float dotBL = dot( material.anisotropyB, lightDir ); 1053 float dotBV = dot( material.anisotropyB, viewDir ); 1054 float dotBH = dot( material.anisotropyB, halfDir ); 1055 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1056 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1057 #else 1058 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1059 float D = D_GGX( alpha, dotNH ); 1060 #endif 1061 return F * ( V * D ); 1062} 1063vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1064 const float LUT_SIZE = 64.0; 1065 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1066 const float LUT_BIAS = 0.5 / LUT_SIZE; 1067 float dotNV = saturate( dot( N, V ) ); 1068 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1069 uv = uv * LUT_SCALE + LUT_BIAS; 1070 return uv; 1071} 1072float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1073 float l = length( f ); 1074 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1075} 1076vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1077 float x = dot( v1, v2 ); 1078 float y = abs( x ); 1079 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1080 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1081 float v = a / b; 1082 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1083 return cross( v1, v2 ) * theta_sintheta; 1084} 1085vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1086 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1087 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1088 vec3 lightNormal = cross( v1, v2 ); 1089 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1090 vec3 T1, T2; 1091 T1 = normalize( V - N * dot( V, N ) ); 1092 T2 = - cross( N, T1 ); 1093 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1094 vec3 coords[ 4 ]; 1095 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1096 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1097 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1098 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1099 coords[ 0 ] = normalize( coords[ 0 ] ); 1100 coords[ 1 ] = normalize( coords[ 1 ] ); 1101 coords[ 2 ] = normalize( coords[ 2 ] ); 1102 coords[ 3 ] = normalize( coords[ 3 ] ); 1103 vec3 vectorFormFactor = vec3( 0.0 ); 1104 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1105 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1106 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1107 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1108 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1109 return vec3( result ); 1110} 1111#if defined( USE_SHEEN ) 1112float D_Charlie( float roughness, float dotNH ) { 1113 float alpha = pow2( roughness ); 1114 float invAlpha = 1.0 / alpha; 1115 float cos2h = dotNH * dotNH; 1116 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1117 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1118} 1119float V_Neubelt( float dotNV, float dotNL ) { 1120 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1121} 1122vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1123 vec3 halfDir = normalize( lightDir + viewDir ); 1124 float dotNL = saturate( dot( normal, lightDir ) ); 1125 float dotNV = saturate( dot( normal, viewDir ) ); 1126 float dotNH = saturate( dot( normal, halfDir ) ); 1127 float D = D_Charlie( sheenRoughness, dotNH ); 1128 float V = V_Neubelt( dotNV, dotNL ); 1129 return sheenColor * ( D * V ); 1130} 1131#endif 1132float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 float r2 = roughness * roughness; 1135 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1136 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1137 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1138 return saturate( DG * RECIPROCAL_PI ); 1139} 1140vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1143 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1144 vec4 r = roughness * c0 + c1; 1145 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1146 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1147 return fab; 1148} 1149vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1150 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1151 return specularColor * fab.x + specularF90 * fab.y; 1152} 1153#ifdef USE_IRIDESCENCE 1154void 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 ) { 1155#else 1156void 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 ) { 1157#endif 1158 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1159 #ifdef USE_IRIDESCENCE 1160 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1161 #else 1162 vec3 Fr = specularColor; 1163 #endif 1164 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1165 float Ess = fab.x + fab.y; 1166 float Ems = 1.0 - Ess; 1167 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1168 singleScatter += FssEss; 1169 multiScatter += Fms * Ems; 1170} 1171#if NUM_RECT_AREA_LIGHTS > 0 1172 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 ) { 1173 vec3 normal = geometryNormal; 1174 vec3 viewDir = geometryViewDir; 1175 vec3 position = geometryPosition; 1176 vec3 lightPos = rectAreaLight.position; 1177 vec3 halfWidth = rectAreaLight.halfWidth; 1178 vec3 halfHeight = rectAreaLight.halfHeight; 1179 vec3 lightColor = rectAreaLight.color; 1180 float roughness = material.roughness; 1181 vec3 rectCoords[ 4 ]; 1182 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1183 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1184 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1185 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1186 vec4 t1 = texture2D( ltc_1, uv ); 1187 vec4 t2 = texture2D( ltc_2, uv ); 1188 mat3 mInv = mat3( 1189 vec3( t1.x, 0, t1.y ), 1190 vec3( 0, 1, 0 ), 1191 vec3( t1.z, 0, t1.w ) 1192 ); 1193 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1194 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1195 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1196 } 1197#endif 1198void 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 ) { 1199 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1200 vec3 irradiance = dotNL * directLight.color; 1201 #ifdef USE_CLEARCOAT 1202 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1203 vec3 ccIrradiance = dotNLcc * directLight.color; 1204 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1205 #endif 1206 #ifdef USE_SHEEN 1207 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1208 #endif 1209 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1210 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1211} 1212void 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 ) { 1213 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1214} 1215void 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) { 1216 #ifdef USE_CLEARCOAT 1217 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1218 #endif 1219 #ifdef USE_SHEEN 1220 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1221 #endif 1222 vec3 singleScattering = vec3( 0.0 ); 1223 vec3 multiScattering = vec3( 0.0 ); 1224 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1225 #ifdef USE_IRIDESCENCE 1226 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1227 #else 1228 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1229 #endif 1230 vec3 totalScattering = singleScattering + multiScattering; 1231 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1232 reflectedLight.indirectSpecular += radiance * singleScattering; 1233 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1234 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1235} 1236#define RE_Direct RE_Direct_Physical 1237#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1238#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1239#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1240float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1241 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1242}`,
1242Rm=` 1243vec3 geometryPosition = - vViewPosition; 1244vec3 geometryNormal = normal; 1245vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1246vec3 geometryClearcoatNormal = vec3( 0.0 ); 1247#ifdef USE_CLEARCOAT 1248 geometryClearcoatNormal = clearcoatNormal; 1249#endif 1250#ifdef USE_IRIDESCENCE 1251 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1252 if ( material.iridescenceThickness == 0.0 ) { 1253 material.iridescence = 0.0; 1254 } else { 1255 material.iridescence = saturate( material.iridescence ); 1256 } 1257 if ( material.iridescence > 0.0 ) { 1258 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1259 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1260 } 1261#endif 1262IncidentLight directLight; 1263#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1264 PointLight pointLight; 1265 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1266 PointLightShadow pointLightShadow; 1267 #endif 1268 #pragma unroll_loop_start 1269 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1270 pointLight = pointLights[ i ]; 1271 getPointLightInfo( pointLight, geometryPosition, directLight ); 1272 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1273 pointLightShadow = pointLightShadows[ i ]; 1274 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1275 #endif 1276 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1277 } 1278 #pragma unroll_loop_end 1279#endif 1280#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1281 SpotLight spotLight; 1282 vec4 spotColor; 1283 vec3 spotLightCoord; 1284 bool inSpotLightMap; 1285 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1286 SpotLightShadow spotLightShadow; 1287 #endif 1288 #pragma unroll_loop_start 1289 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1290 spotLight = spotLights[ i ]; 1291 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1292 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1293 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1294 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1295 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1296 #else 1297 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1298 #endif 1299 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1300 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1301 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1302 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1303 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1304 #endif 1305 #undef SPOT_LIGHT_MAP_INDEX 1306 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1307 spotLightShadow = spotLightShadows[ i ]; 1308 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1309 #endif 1310 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1311 } 1312 #pragma unroll_loop_end 1313#endif 1314#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1315 DirectionalLight directionalLight; 1316 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1317 DirectionalLightShadow directionalLightShadow; 1318 #endif 1319 #pragma unroll_loop_start 1320 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1321 directionalLight = directionalLights[ i ]; 1322 getDirectionalLightInfo( directionalLight, directLight ); 1323 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1324 directionalLightShadow = directionalLightShadows[ i ]; 1325 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1326 #endif 1327 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1328 } 1329 #pragma unroll_loop_end 1330#endif 1331#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1332 RectAreaLight rectAreaLight; 1333 #pragma unroll_loop_start 1334 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1335 rectAreaLight = rectAreaLights[ i ]; 1336 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1337 } 1338 #pragma unroll_loop_end 1339#endif 1340#if defined( RE_IndirectDiffuse ) 1341 vec3 iblIrradiance = vec3( 0.0 ); 1342 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1343 #if defined( USE_LIGHT_PROBES ) 1344 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1345 #endif 1346 #if ( NUM_HEMI_LIGHTS > 0 ) 1347 #pragma unroll_loop_start 1348 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1349 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1350 } 1351 #pragma unroll_loop_end 1352 #endif 1353#endif 1354#if defined( RE_IndirectSpecular ) 1355 vec3 radiance = vec3( 0.0 ); 1356 vec3 clearcoatRadiance = vec3( 0.0 ); 1357#endif`,Cm=`#if defined( RE_IndirectDiffuse ) 1358 #ifdef USE_LIGHTMAP 1359 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1360 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1361 irradiance += lightMapIrradiance; 1362 #endif 1363 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1364 iblIrradiance += getIBLIrradiance( geometryNormal ); 1365 #endif 1366#endif 1367#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1368 #ifdef USE_ANISOTROPY 1369 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1370 #else 1371 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1372 #endif 1373 #ifdef USE_CLEARCOAT 1374 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1375 #endif 1376#endif`,Im=`#if defined( RE_IndirectDiffuse ) 1377 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1378#endif 1379#if defined( RE_IndirectSpecular ) 1380 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1381#endif`,Pm=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1382 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1383#endif`,Lm=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1384 uniform float logDepthBufFC; 1385 varying float vFragDepth; 1386 varying float vIsPerspective; 1387#endif`,Dm=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1388 varying float vFragDepth; 1389 varying float vIsPerspective; 1390#endif`,Nm=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1391 vFragDepth = 1.0 + gl_Position.w; 1392 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1393#endif`,Um=`#ifdef USE_MAP 1394 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1395 #ifdef DECODE_VIDEO_TEXTURE 1396 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1397 #endif 1398 diffuseColor *= sampledDiffuseColor; 1399#endif`,Om=`#ifdef USE_MAP 1400 uniform sampler2D map; 1401#endif`,Fm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1402 #if defined( USE_POINTS_UV ) 1403 vec2 uv = vUv; 1404 #else 1405 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1406 #endif 1407#endif 1408#ifdef USE_MAP 1409 diffuseColor *= texture2D( map, uv ); 1410#endif 1411#ifdef USE_ALPHAMAP 1412 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1413#endif`,Bm=`#if defined( USE_POINTS_UV ) 1414 varying vec2 vUv; 1415#else 1416 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1417 uniform mat3 uvTransform; 1418 #endif 1419#endif 1420#ifdef USE_MAP 1421 uniform sampler2D map; 1422#endif 1423#ifdef USE_ALPHAMAP 1424 uniform sampler2D alphaMap; 1425#endif`,zm=`float metalnessFactor = metalness; 1426#ifdef USE_METALNESSMAP 1427 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1428 metalnessFactor *= texelMetalness.b; 1429#endif`,km=`#ifdef USE_METALNESSMAP 1430 uniform sampler2D metalnessMap; 1431#endif`,Hm=`#ifdef USE_INSTANCING_MORPH 1432 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1433 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1434 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1435 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1436 } 1437#endif`,Vm=`#if defined( USE_MORPHCOLORS ) 1438 vColor *= morphTargetBaseInfluence; 1439 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1440 #if defined( USE_COLOR_ALPHA ) 1441 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1442 #elif defined( USE_COLOR ) 1443 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1444 #endif 1445 } 1446#endif`,Gm=`#ifdef USE_MORPHNORMALS 1447 objectNormal *= morphTargetBaseInfluence; 1448 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1449 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1450 } 1451#endif`,Wm=`#ifdef USE_MORPHTARGETS 1452 #ifndef USE_INSTANCING_MORPH 1453 uniform float morphTargetBaseInfluence; 1454 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1455 #endif 1456 uniform sampler2DArray morphTargetsTexture; 1457 uniform ivec2 morphTargetsTextureSize; 1458 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1459 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1460 int y = texelIndex / morphTargetsTextureSize.x; 1461 int x = texelIndex - y * morphTargetsTextureSize.x; 1462 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1463 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1464 } 1465#endif`,Xm=`#ifdef USE_MORPHTARGETS 1466 transformed *= morphTargetBaseInfluence; 1467 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1468 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1469 } 1470#endif`,qm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1471#ifdef FLAT_SHADED 1472 vec3 fdx = dFdx( vViewPosition ); 1473 vec3 fdy = dFdy( vViewPosition ); 1474 vec3 normal = normalize( cross( fdx, fdy ) ); 1475#else 1476 vec3 normal = normalize( vNormal ); 1477 #ifdef DOUBLE_SIDED 1478 normal *= faceDirection; 1479 #endif 1480#endif 1481#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1482 #ifdef USE_TANGENT 1483 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1484 #else 1485 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1486 #if defined( USE_NORMALMAP ) 1487 vNormalMapUv 1488 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1489 vClearcoatNormalMapUv 1490 #else 1491 vUv 1492 #endif 1493 ); 1494 #endif 1495 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1496 tbn[0] *= faceDirection; 1497 tbn[1] *= faceDirection; 1498 #endif 1499#endif 1500#ifdef USE_CLEARCOAT_NORMALMAP 1501 #ifdef USE_TANGENT 1502 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1503 #else 1504 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1505 #endif 1506 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1507 tbn2[0] *= faceDirection; 1508 tbn2[1] *= faceDirection; 1509 #endif 1510#endif 1511vec3 nonPerturbedNormal = normal;`,Ym=`#ifdef USE_NORMALMAP_OBJECTSPACE 1512 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1513 #ifdef FLIP_SIDED 1514 normal = - normal; 1515 #endif 1516 #ifdef DOUBLE_SIDED 1517 normal = normal * faceDirection; 1518 #endif 1519 normal = normalize( normalMatrix * normal ); 1520#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1521 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1522 mapN.xy *= normalScale; 1523 normal = normalize( tbn * mapN ); 1524#elif defined( USE_BUMPMAP )
1525 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1526#endif`,Zm=`#ifndef FLAT_SHADED 1527 varying vec3 vNormal; 1528 #ifdef USE_TANGENT 1529 varying vec3 vTangent; 1530 varying vec3 vBitangent; 1531 #endif 1532#endif`,Km=`#ifndef FLAT_SHADED 1533 varying vec3 vNormal; 1534 #ifdef USE_TANGENT 1535 varying vec3 vTangent; 1536 varying vec3 vBitangent; 1537 #endif 1538#endif`,$m=`#ifndef FLAT_SHADED 1539 vNormal = normalize( transformedNormal ); 1540 #ifdef USE_TANGENT 1541 vTangent = normalize( transformedTangent ); 1542 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1543 #endif 1544#endif`,Jm=`#ifdef USE_NORMALMAP 1545 uniform sampler2D normalMap; 1546 uniform vec2 normalScale; 1547#endif 1548#ifdef USE_NORMALMAP_OBJECTSPACE 1549 uniform mat3 normalMatrix; 1550#endif 1551#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1552 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1553 vec3 q0 = dFdx( eye_pos.xyz ); 1554 vec3 q1 = dFdy( eye_pos.xyz ); 1555 vec2 st0 = dFdx( uv.st ); 1556 vec2 st1 = dFdy( uv.st ); 1557 vec3 N = surf_norm; 1558 vec3 q1perp = cross( q1, N ); 1559 vec3 q0perp = cross( N, q0 ); 1560 vec3 T = q1perp * st0.x + q0perp * st1.x; 1561 vec3 B = q1perp * st0.y + q0perp * st1.y; 1562 float det = max( dot( T, T ), dot( B, B ) ); 1563 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1564 return mat3( T * scale, B * scale, N ); 1565 } 1566#endif`,jm=`#ifdef USE_CLEARCOAT 1567 vec3 clearcoatNormal = nonPerturbedNormal; 1568#endif`,Qm=`#ifdef USE_CLEARCOAT_NORMALMAP 1569 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1570 clearcoatMapN.xy *= clearcoatNormalScale; 1571 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1572#endif`,eg=`#ifdef USE_CLEARCOATMAP 1573 uniform sampler2D clearcoatMap; 1574#endif 1575#ifdef USE_CLEARCOAT_NORMALMAP 1576 uniform sampler2D clearcoatNormalMap; 1577 uniform vec2 clearcoatNormalScale; 1578#endif 1579#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1580 uniform sampler2D clearcoatRoughnessMap; 1581#endif`,tg=`#ifdef USE_IRIDESCENCEMAP 1582 uniform sampler2D iridescenceMap; 1583#endif 1584#ifdef USE_IRIDESCENCE_THICKNESSMAP 1585 uniform sampler2D iridescenceThicknessMap; 1586#endif`,ng=`#ifdef OPAQUE 1587diffuseColor.a = 1.0; 1588#endif 1589#ifdef USE_TRANSMISSION 1590diffuseColor.a *= material.transmissionAlpha; 1591#endif 1592gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ig=`vec3 packNormalToRGB( const in vec3 normal ) { 1593 return normalize( normal ) * 0.5 + 0.5; 1594} 1595vec3 unpackRGBToNormal( const in vec3 rgb ) { 1596 return 2.0 * rgb.xyz - 1.0; 1597} 1598const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1599const float Inv255 = 1. / 255.; 1600const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1601const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1602const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1603const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1604vec4 packDepthToRGBA( const in float v ) { 1605 if( v <= 0.0 ) 1606 return vec4( 0., 0., 0., 0. ); 1607 if( v >= 1.0 ) 1608 return vec4( 1., 1., 1., 1. ); 1609 float vuf; 1610 float af = modf( v * PackFactors.a, vuf ); 1611 float bf = modf( vuf * ShiftRight8, vuf ); 1612 float gf = modf( vuf * ShiftRight8, vuf ); 1613 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1614} 1615vec3 packDepthToRGB( const in float v ) { 1616 if( v <= 0.0 ) 1617 return vec3( 0., 0., 0. ); 1618 if( v >= 1.0 ) 1619 return vec3( 1., 1., 1. ); 1620 float vuf; 1621 float bf = modf( v * PackFactors.b, vuf ); 1622 float gf = modf( vuf * ShiftRight8, vuf ); 1623 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1624} 1625vec2 packDepthToRG( const in float v ) { 1626 if( v <= 0.0 ) 1627 return vec2( 0., 0. ); 1628 if( v >= 1.0 ) 1629 return vec2( 1., 1. ); 1630 float vuf; 1631 float gf = modf( v * 256., vuf ); 1632 return vec2( vuf * Inv255, gf ); 1633} 1634float unpackRGBAToDepth( const in vec4 v ) { 1635 return dot( v, UnpackFactors4 ); 1636} 1637float unpackRGBToDepth( const in vec3 v ) { 1638 return dot( v, UnpackFactors3 ); 1639} 1640float unpackRGToDepth( const in vec2 v ) { 1641 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1642} 1643vec4 pack2HalfToRGBA( const in vec2 v ) {
1644 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1645 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1646} 1647vec2 unpackRGBATo2Half( const in vec4 v ) { 1648 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1649} 1650float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1651 return ( viewZ + near ) / ( near - far ); 1652} 1653float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1654 return depth * ( near - far ) - near; 1655} 1656float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1657 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1658} 1659float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1660 return ( near * far ) / ( ( far - near ) * depth - far ); 1661}`,sg=`#ifdef PREMULTIPLIED_ALPHA 1662 gl_FragColor.rgb *= gl_FragColor.a; 1663#endif`,rg=`vec4 mvPosition = vec4( transformed, 1.0 ); 1664#ifdef USE_BATCHING 1665 mvPosition = batchingMatrix * mvPosition; 1666#endif 1667#ifdef USE_INSTANCING 1668 mvPosition = instanceMatrix * mvPosition; 1669#endif 1670mvPosition = modelViewMatrix * mvPosition; 1671gl_Position = projectionMatrix * mvPosition;`,og=`#ifdef DITHERING 1672 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1673#endif`,ag=`#ifdef DITHERING 1674 vec3 dithering( vec3 color ) { 1675 float grid_position = rand( gl_FragCoord.xy ); 1676 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1677 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1678 return color + dither_shift_RGB; 1679 } 1680#endif`,cg=`float roughnessFactor = roughness; 1681#ifdef USE_ROUGHNESSMAP 1682 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1683 roughnessFactor *= texelRoughness.g; 1684#endif`,lg=`#ifdef USE_ROUGHNESSMAP 1685 uniform sampler2D roughnessMap; 1686#endif`,hg=`#if NUM_SPOT_LIGHT_COORDS > 0 1687 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1688#endif 1689#if NUM_SPOT_LIGHT_MAPS > 0 1690 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1691#endif 1692#ifdef USE_SHADOWMAP 1693 #if NUM_DIR_LIGHT_SHADOWS > 0 1694 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1695 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1696 struct DirectionalLightShadow { 1697 float shadowIntensity; 1698 float shadowBias; 1699 float shadowNormalBias; 1700 float shadowRadius; 1701 vec2 shadowMapSize; 1702 }; 1703 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1704 #endif 1705 #if NUM_SPOT_LIGHT_SHADOWS > 0 1706 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1707 struct SpotLightShadow { 1708 float shadowIntensity; 1709 float shadowBias; 1710 float shadowNormalBias; 1711 float shadowRadius; 1712 vec2 shadowMapSize; 1713 }; 1714 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1715 #endif 1716 #if NUM_POINT_LIGHT_SHADOWS > 0 1717 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1718 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1719 struct PointLightShadow { 1720 float shadowIntensity; 1721 float shadowBias; 1722 float shadowNormalBias; 1723 float shadowRadius; 1724 vec2 shadowMapSize; 1725 float shadowCameraNear; 1726 float shadowCameraFar; 1727 }; 1728 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1729 #endif 1730 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1731 float depth = unpackRGBAToDepth( texture2D( depths, uv ) ); 1732 #ifdef USE_REVERSED_DEPTH_BUFFER 1733 return step( depth, compare ); 1734 #else 1735 return step( compare, depth ); 1736 #endif 1737 } 1738 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1739 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1740 } 1741 float VSMShadow( sampler2D shadow, vec2 uv, float compare ) { 1742 float occlusion = 1.0; 1743 vec2 distribution = texture2DDistribution( shadow, uv ); 1744 #ifdef USE_REVERSED_DEPTH_BUFFER 1745 float hard_shadow = step( distribution.x, compare ); 1746 #else 1747 float hard_shadow = step( compare, distribution.x ); 1748 #endif 1749 if ( hard_shadow != 1.0 ) { 1750 float distance = compare - distribution.x
vendor: 6,963 bytes, lines 1750-1881
1750; 1751 float variance = max( 0.00000, distribution.y * distribution.y ); 1752 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 ); 1753 } 1754 return occlusion; 1755 } 1756 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1757 float shadow = 1.0; 1758 shadowCoord.xyz /= shadowCoord.w; 1759 shadowCoord.z += shadowBias; 1760 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1761 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1762 if ( frustumTest ) { 1763 #if defined( SHADOWMAP_TYPE_PCF ) 1764 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1765 float dx0 = - texelSize.x * shadowRadius; 1766 float dy0 = - texelSize.y * shadowRadius; 1767 float dx1 = + texelSize.x * shadowRadius; 1768 float dy1 = + texelSize.y * shadowRadius; 1769 float dx2 = dx0 / 2.0; 1770 float dy2 = dy0 / 2.0; 1771 float dx3 = dx1 / 2.0; 1772 float dy3 = dy1 / 2.0; 1773 shadow = ( 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1791 ) * ( 1.0 / 17.0 ); 1792 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1793 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1794 float dx = texelSize.x; 1795 float dy = texelSize.y; 1796 vec2 uv = shadowCoord.xy; 1797 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1798 uv -= f * texelSize; 1799 shadow = ( 1800 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1801 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1802 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1803 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1804 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1805 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1806 f.x ) + 1807 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1808 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1809 f.x ) + 1810 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1811 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1812 f.y ) + 1813 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1814 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1815 f.y ) + 1816 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1817 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1818 f.x ), 1819 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1820 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1821 f.x ), 1822 f.y ) 1823 ) * ( 1.0 / 9.0 ); 1824 #elif defined( SHADOWMAP_TYPE_VSM ) 1825 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1826 #else 1827 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1828 #endif 1829 } 1830 return mix( 1.0, shadow, shadowIntensity ); 1831 } 1832 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1833 vec3 absV = abs( v ); 1834 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1835 absV *= scaleToCube; 1836 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1837 vec2 planar = v.xy; 1838 float almostATexel = 1.5 * texelSizeY; 1839 float almostOne = 1.0 - almostATexel; 1840 if ( absV.z >= almostOne ) { 1841 if ( v.z > 0.0 ) 1842 planar.x = 4.0 - v.x; 1843 } else if ( absV.x >= almostOne ) { 1844 float signX = sign( v.x ); 1845 planar.x = v.z * signX + 2.0 * signX; 1846 } else if ( absV.y >= almostOne ) { 1847 float signY = sign( v.y ); 1848 planar.x = v.x + 2.0 * signY + 2.0; 1849 planar.y = v.z * signY - 2.0; 1850 } 1851 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1852 } 1853 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1854 float shadow = 1.0; 1855 vec3 lightToPosition = shadowCoord.xyz; 1856 1857 float lightToPositionLength = length( lightToPosition ); 1858 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1859 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1860 vec3 bd3D = normalize( lightToPosition ); 1861 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1862 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1863 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1864 shadow = ( 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1869 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1870 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1871 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1874 ) * ( 1.0 / 9.0 ); 1875 #else 1876 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1877 #endif 1878 } 1879 return mix( 1.0, shadow, shadowIntensity ); 1880 } 1881#endif`,
1881ug=`#if NUM_SPOT_LIGHT_COORDS > 0 1882 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1883 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1884#endif 1885#ifdef USE_SHADOWMAP 1886 #if NUM_DIR_LIGHT_SHADOWS > 0 1887 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1888 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1889 struct DirectionalLightShadow { 1890 float shadowIntensity; 1891 float shadowBias; 1892 float shadowNormalBias; 1893 float shadowRadius; 1894 vec2 shadowMapSize; 1895 }; 1896 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1897 #endif 1898 #if NUM_SPOT_LIGHT_SHADOWS > 0 1899 struct SpotLightShadow { 1900 float shadowIntensity; 1901 float shadowBias; 1902 float shadowNormalBias; 1903 float shadowRadius; 1904 vec2 shadowMapSize; 1905 }; 1906 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1907 #endif 1908 #if NUM_POINT_LIGHT_SHADOWS > 0 1909 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1910 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1911 struct PointLightShadow { 1912 float shadowIntensity; 1913 float shadowBias; 1914 float shadowNormalBias; 1915 float shadowRadius; 1916 vec2 shadowMapSize; 1917 float shadowCameraNear; 1918 float shadowCameraFar; 1919 }; 1920 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1921 #endif 1922#endif`,dg=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1923 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1924 vec4 shadowWorldPosition; 1925#endif 1926#if defined( USE_SHADOWMAP ) 1927 #if NUM_DIR_LIGHT_SHADOWS > 0 1928 #pragma unroll_loop_start 1929 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1930 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1931 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1932 } 1933 #pragma unroll_loop_end 1934 #endif 1935 #if NUM_POINT_LIGHT_SHADOWS > 0 1936 #pragma unroll_loop_start 1937 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1938 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1939 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1940 } 1941 #pragma unroll_loop_end 1942 #endif 1943#endif 1944#if NUM_SPOT_LIGHT_COORDS > 0 1945 #pragma unroll_loop_start 1946 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1947 shadowWorldPosition = worldPosition; 1948 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1949 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1950 #endif 1951 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1952 } 1953 #pragma unroll_loop_end 1954#endif`,fg=`float getShadowMask() { 1955 float shadow = 1.0; 1956 #ifdef USE_SHADOWMAP 1957 #if NUM_DIR_LIGHT_SHADOWS > 0 1958 DirectionalLightShadow directionalLight; 1959 #pragma unroll_loop_start 1960 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1961 directionalLight = directionalLightShadows[ i ]; 1962 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1963 } 1964 #pragma unroll_loop_end 1965 #endif 1966 #if NUM_SPOT_LIGHT_SHADOWS > 0 1967 SpotLightShadow spotLight; 1968 #pragma unroll_loop_start 1969 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1970 spotLight = spotLightShadows[ i ]; 1971 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1972 } 1973 #pragma unroll_loop_end 1974 #endif 1975 #if NUM_POINT_LIGHT_SHADOWS > 0 1976 PointLightShadow pointLight; 1977 #pragma unroll_loop_start 1978 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1979 pointLight = pointLightShadows[ i ]; 1980 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1981 } 1982 #pragma unroll_loop_end 1983 #endif 1984 #endif 1985 return shadow; 1986}`,pg=`#ifdef USE_SKINNING 1987 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1988 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1989 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1990 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1991#endif`,mg=`#ifdef USE_SKINNING 1992 uniform mat4 bindMatrix; 1993 uniform mat4 bindMatrixInverse; 1994 uniform highp sampler2D boneTexture; 1995 mat4 getBoneMatrix( const in float i ) { 1996 int size = textureSize( boneTexture, 0 ).x; 1997 int j = int( i ) * 4; 1998 int x = j % size; 1999 int y = j / size; 2000 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2001 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2002 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2003 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2004 return mat4( v1, v2, v3, v4 ); 2005 } 2006#endif`,gg=`#ifdef USE_SKINNING 2007 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2008 vec4 skinned = vec4( 0.0 ); 2009 skinned += boneMatX * skinVertex * skinWeight.x; 2010 skinned += boneMatY * skinVertex * skinWeight.y; 2011 skinned += boneMatZ * skinVertex * skinWeight.z; 2012 skinned += boneMatW * skinVertex * skinWeight.w; 2013 transformed = ( bindMatrixInverse * skinned ).xyz; 2014#endif`,_g=`#ifdef USE_SKINNING 2015 mat4 skinMatrix = mat4( 0.0 ); 2016 skinMatrix += skinWeight.x * boneMatX; 2017 skinMatrix += skinWeight.y * boneMatY; 2018 skinMatrix += skinWeight.z * boneMatZ; 2019 skinMatrix += skinWeight.w * boneMatW; 2020 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2021 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2022 #ifdef USE_TANGENT 2023 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2024 #endif 2025#endif`,xg=`float specularStrength; 2026#ifdef USE_SPECULARMAP 2027 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2028 specularStrength = texelSpecular.r; 2029#else 2030 specularStrength = 1.0; 2031#endif`,yg=`#ifdef USE_SPECULARMAP 2032 uniform sampler2D specularMap; 2033#endif`,vg=`#if defined( TONE_MAPPING ) 2034 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2035#endif`,Mg=`#ifndef saturate 2036#define saturate( a ) clamp( a, 0.0, 1.0 ) 2037#endif 2038uniform float toneMappingExposure; 2039vec3 LinearToneMapping( vec3 color ) { 2040 return saturate( toneMappingExposure * color ); 2041} 2042vec3 ReinhardToneMapping( vec3 color ) { 2043 color *= toneMappingExposure; 2044 return saturate( color / ( vec3( 1.0 ) + color ) ); 2045} 2046vec3 CineonToneMapping( vec3 color ) { 2047 color *= toneMappingExposure; 2048 color = max( vec3( 0.0 ), color - 0.004 ); 2049 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2050} 2051vec3 RRTAndODTFit( vec3 v ) { 2052 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2053 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2054 return a / b; 2055} 2056vec3 ACESFilmicToneMapping( vec3 color ) { 2057 const mat3 ACESInputMat = mat3( 2058 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2059 vec3( 0.04823, 0.01566, 0.83777 ) 2060 ); 2061 const mat3 ACESOutputMat = mat3( 2062 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2063 vec3( -0.07367, -0.00605, 1.07602 ) 2064 ); 2065 color *= toneMappingExposure / 0.6; 2066 color = ACESInputMat * color; 2067 color = RRTAndODTFit( color ); 2068 color = ACESOutputMat * color; 2069 return saturate( color ); 2070} 2071const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2072 vec3( 1.6605, - 0.1246, - 0.0182 ), 2073 vec3( - 0.5876, 1.1329, - 0.1006 ), 2074 vec3( - 0.0728, - 0.0083, 1.1187 ) 2075); 2076const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2077 vec3( 0.6274, 0.0691, 0.0164 ), 2078 vec3( 0.3293, 0.9195, 0.0880 ), 2079 vec3( 0.0433, 0.0113, 0.8956 ) 2080); 2081vec3 agxDefaultContrastApprox( vec3 x ) { 2082 vec3 x2 = x * x; 2083 vec3 x4 = x2 * x2; 2084 return + 15.5 * x4 * x2 2085 - 40.14 * x4 * x 2086 + 31.96 * x4 2087 - 6.868 * x2 * x 2088 + 0.4298 * x2 2089 + 0.1191 * x 2090 - 0.00232; 2091} 2092vec3 AgXToneMapping( vec3 color ) { 2093 const mat3 AgXInsetMatrix = mat3( 2094 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2095 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2096 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2097 );
2098 const mat3 AgXOutsetMatrix = mat3( 2099 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2100 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2101 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2102 ); 2103 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2104 color *= toneMappingExposure; 2105 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2106 color = AgXInsetMatrix * color; 2107 color = max( color, 1e-10 ); color = log2( color ); 2108 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2109 color = clamp( color, 0.0, 1.0 ); 2110 color = agxDefaultContrastApprox( color ); 2111 color = AgXOutsetMatrix * color; 2112 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2113 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2114 color = clamp( color, 0.0, 1.0 ); 2115 return color; 2116} 2117vec3 NeutralToneMapping( vec3 color ) { 2118 const float StartCompression = 0.8 - 0.04; 2119 const float Desaturation = 0.15; 2120 color *= toneMappingExposure; 2121 float x = min( color.r, min( color.g, color.b ) ); 2122 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2123 color -= offset; 2124 float peak = max( color.r, max( color.g, color.b ) ); 2125 if ( peak < StartCompression ) return color; 2126 float d = 1. - StartCompression; 2127 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2128 color *= newPeak / peak; 2129 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2130 return mix( color, vec3( newPeak ), g ); 2131} 2132vec3 CustomToneMapping( vec3 color ) { return color; }`,Sg=`#ifdef USE_TRANSMISSION 2133 material.transmission = transmission; 2134 material.transmissionAlpha = 1.0; 2135 material.thickness = thickness; 2136 material.attenuationDistance = attenuationDistance; 2137 material.attenuationColor = attenuationColor; 2138 #ifdef USE_TRANSMISSIONMAP 2139 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2140 #endif 2141 #ifdef USE_THICKNESSMAP 2142 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2143 #endif 2144 vec3 pos = vWorldPosition; 2145 vec3 v = normalize( cameraPosition - pos ); 2146 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2147 vec4 transmitted = getIBLVolumeRefraction( 2148 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2149 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2150 material.attenuationColor, material.attenuationDistance ); 2151 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2152 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2153#endif`,bg=`#ifdef USE_TRANSMISSION 2154 uniform float transmission; 2155 uniform float thickness; 2156 uniform float attenuationDistance; 2157 uniform vec3 attenuationColor; 2158 #ifdef USE_TRANSMISSIONMAP 2159 uniform sampler2D transmissionMap; 2160 #endif 2161 #ifdef USE_THICKNESSMAP 2162 uniform sampler2D thicknessMap; 2163 #endif 2164 uniform vec2 transmissionSamplerSize; 2165 uniform sampler2D transmissionSamplerMap; 2166 uniform mat4 modelMatrix; 2167 uniform mat4 projectionMatrix; 2168 varying vec3 vWorldPosition; 2169 float w0( float a ) { 2170 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2171 } 2172 float w1( float a ) { 2173 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2174 } 2175 float w2( float a ){ 2176 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2177 } 2178 float w3( float a ) { 2179 return ( 1.0 / 6.0 ) * ( a * a * a ); 2180 } 2181 float g0( float a ) { 2182 return w0( a ) + w1( a ); 2183 } 2184 float g1( float a ) { 2185 return w2( a ) + w3( a ); 2186 } 2187 float h0( float a ) { 2188 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2189 } 2190 float h1( float a ) { 2191 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2192 } 2193 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2194 uv = uv * texelSize.zw + 0.5; 2195 vec2 iuv = floor( uv ); 2196 vec2 fuv = fract( uv ); 2197 float g0x = g0( fuv.x ); 2198 float g1x = g1( fuv.x ); 2199 float h0x = h0( fuv.x ); 2200 float h1x = h1( fuv.x ); 2201 float h0y = h0( fuv.y ); 2202 float h1y = h1( fuv.y ); 2203 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2204 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2205 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2206 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2207 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2208 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2209 } 2210 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2211 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2212 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2213 vec2 fLodSizeInv = 1.0 / fLodSize; 2214 vec2 cLodSizeInv = 1.0 / cLodSize; 2215 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2216 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2217 return mix( fSample, cSample, fract( lod ) ); 2218 } 2219 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2220 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2221 vec3 modelScale; 2222 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2223 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2224 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2225 return normalize( refractionVector ) * thickness * modelScale; 2226 } 2227 float applyIorToRoughness( const in float roughness, const in float ior ) { 2228 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2229 } 2230 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2231 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2232 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2233 } 2234 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2235 if ( isinf( attenuationDistance ) ) { 2236 return vec3( 1.0 ); 2237 } else { 2238 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2239 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2240 } 2241 } 2242 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2243 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2244 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2245 const in vec3 attenuationColor, const in float attenuationDistance ) { 2246 vec4 transmittedLight; 2247 vec3 transmittance; 2248 #ifdef USE_DISPERSION 2249 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2250 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2251 for ( int i = 0; i < 3; i ++ ) { 2252 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2253 vec3 refractedRayExit = position + transmissionRay; 2254 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2255 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2256 refractionCoords += 1.0; 2257 refractionCoords /= 2.0; 2258 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2259 transmittedLight[ i ] = transmissionSample[ i ]; 2260 transmittedLight.a += transmissionSample.a; 2261 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2262 } 2263 transmittedLight.a /= 3.0; 2264 #else 2265 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2266 vec3 refractedRayExit = position + transmissionRay; 2267 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2268 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2269 refractionCoords += 1.0; 2270 refractionCoords /= 2.0; 2271 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2272 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 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`,Eg=`#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`,Tg=`#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`,Ag=`#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`,wg=`#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`,Rg=`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}`,Cg=`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}`,Ig=`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}`,Pg=`#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}`,Lg=`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}`,Dg=`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}`,Ng=`#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}`,Ug=`#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 #ifdef USE_REVERSED_DEPTH_BUFFER 2639 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2640 #else 2641 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2642 #endif 2643 #if DEPTH_PACKING == 3200 2644 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2645 #elif DEPTH_PACKING == 3201 2646 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2647 #elif DEPTH_PACKING == 3202 2648 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2649 #elif DEPTH_PACKING == 3203 2650 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2651 #endif 2652}`,Og=`#define DISTANCE 2653varying vec3 vWorldPosition; 2654#include <common> 2655#include <batching_pars_vertex> 2656#include <uv_pars_vertex> 2657#include <displacementmap_pars_vertex> 2658#include <morphtarget_pars_vertex> 2659#include <skinning_pars_vertex> 2660#include <clipping_planes_pars_vertex> 2661void main() { 2662 #include <uv_vertex> 2663 #include <batching_vertex> 2664 #include <skinbase_vertex> 2665 #include <morphinstance_vertex> 2666 #ifdef USE_DISPLACEMENTMAP 2667 #include <beginnormal_vertex> 2668 #include <morphnormal_vertex> 2669 #include <skinnormal_vertex> 2670 #endif 2671 #include <begin_vertex> 2672 #include <morphtarget_vertex> 2673 #include <skinning_vertex> 2674 #include <displacementmap_vertex> 2675 #include <project_vertex> 2676 #include <worldpos_vertex> 2677 #include <clipping_planes_vertex> 2678 vWorldPosition = worldPosition.xyz; 2679}`,Fg=`#define DISTANCE 2680uniform vec3 referencePosition; 2681uniform float nearDistance; 2682uniform float farDistance; 2683varying vec3 vWorldPosition; 2684#include <common> 2685#include <packing> 2686#include <uv_pars_fragment> 2687#include <map_pars_fragment> 2688#include <alphamap_pars_fragment> 2689#include <alphatest_pars_fragment> 2690#include <alphahash_pars_fragment> 2691#include <clipping_planes_pars_fragment> 2692void main () { 2693 vec4 diffuseColor = vec4( 1.0 ); 2694 #include <clipping_planes_fragment> 2695 #include <map_fragment> 2696 #include <alphamap_fragment> 2697 #include <alphatest_fragment> 2698 #include <alphahash_fragment> 2699 float dist = length( vWorldPosition - referencePosition ); 2700 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2701 dist = saturate( dist ); 2702 gl_FragColor = packDepthToRGBA( dist ); 2703}`,Bg=`varying vec3 vWorldDirection; 2704#include <common> 2705void main() { 2706 vWorldDirection = transformDirection( position, modelMatrix ); 2707 #include <begin_vertex> 2708 #include <project_vertex> 2709}`,zg=`uniform sampler2D tEquirect; 2710varying vec3 vWorldDirection; 2711#include <common> 2712void main() { 2713 vec3 direction = normalize( vWorldDirection ); 2714 vec2 sampleUV = equirectUv( direction ); 2715 gl_FragColor = texture2D( tEquirect, sampleUV ); 2716 #include <tonemapping_fragment> 2717 #include <colorspace_fragment> 2718}`,kg=`uniform float scale; 2719attribute float lineDistance; 2720varying float vLineDistance; 2721#include <common> 2722#include <uv_pars_vertex> 2723#include <color_pars_vertex> 2724#include <fog_pars_vertex> 2725#include <morphtarget_pars_vertex> 2726#include <logdepthbuf_pars_vertex> 2727#include <clipping_planes_pars_vertex> 2728void main() { 2729 vLineDistance = scale * lineDistance; 2730 #include <uv_vertex> 2731 #include <color_vertex> 2732 #include <morphinstance_vertex> 2733 #include <morphcolor_vertex> 2734 #include <begin_vertex> 2735 #include <morphtarget_vertex> 2736 #include <project_vertex> 2737 #include <logdepthbuf_vertex> 2738 #include <clipping_planes_vertex> 2739 #include <fog_vertex> 2740}`,Hg=`uniform vec3 diffuse; 2741uniform float opacity; 2742uniform float dashSize; 2743uniform float totalSize; 2744varying float vLineDistance; 2745#include <common> 2746#include <color_pars_fragment> 2747#include <uv_pars_fragment> 2748#include <map_pars_fragment> 2749#include <fog_pars_fragment> 2750#include <logdepthbuf_pars_fragment> 2751#include <clipping_planes_pars_fragment> 2752void main() { 2753 vec4 diffuseColor = vec4( diffuse, opacity ); 2754 #include <clipping_planes_fragment> 2755 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2756 discard; 2757 } 2758 vec3 outgoingLight = vec3( 0.0 ); 2759 #include <logdepthbuf_fragment> 2760 #include <map_fragment> 2761 #include <color_fragment> 2762 outgoingLight = diffuseColor.rgb; 2763 #include <opaque_fragment> 2764 #include <tonemapping_fragment> 2765 #include <colorspace_fragment> 2766 #include <fog_fragment> 2767 #include <premultiplied_alpha_fragment> 2768}`,Vg=`#include <common> 2769#include <batching_pars_vertex> 2770#include <uv_pars_vertex> 2771#include <envmap_pars_vertex> 2772#include <color_pars_vertex> 2773#include <fog_pars_vertex> 2774#include <morphtarget_pars_vertex> 2775#include <skinning_pars_vertex> 2776#include <logdepthbuf_pars_vertex> 2777#include <clipping_planes_pars_vertex> 2778void main() { 2779 #include <uv_vertex> 2780 #include <color_vertex> 2781 #include <morphinstance_vertex> 2782 #include <morphcolor_vertex> 2783 #include <batching_vertex> 2784 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2785 #include <beginnormal_vertex> 2786 #include <morphnormal_vertex> 2787 #include <skinbase_vertex> 2788 #include <skinnormal_vertex> 2789 #include <defaultnormal_vertex> 2790 #endif 2791 #include <begin_vertex> 2792 #include <morphtarget_vertex> 2793 #include <skinning_vertex> 2794 #include <project_vertex> 2795 #include <logdepthbuf_vertex> 2796 #include <clipping_planes_vertex> 2797 #include <worldpos_vertex> 2798 #include <envmap_vertex> 2799 #include <fog_vertex> 2800}`,Gg=`uniform vec3 diffuse; 2801uniform float opacity; 2802#ifndef FLAT_SHADED 2803 varying vec3 vNormal; 2804#endif 2805#include <common> 2806#include <dithering_pars_fragment> 2807#include <color_pars_fragment> 2808#include <uv_pars_fragment> 2809#include <map_pars_fragment> 2810#include <alphamap_pars_fragment> 2811#include <alphatest_pars_fragment> 2812#include <alphahash_pars_fragment> 2813#include <aomap_pars_fragment> 2814#include <lightmap_pars_fragment> 2815#include <envmap_common_pars_fragment> 2816#include <envmap_pars_fragment> 2817#include <fog_pars_fragment> 2818#include <specularmap_pars_fragment> 2819#include <logdepthbuf_pars_fragment> 2820#include <clipping_planes_pars_fragment> 2821void main() { 2822 vec4 diffuseColor = vec4( diffuse, opacity ); 2823 #include <clipping_planes_fragment> 2824 #include <logdepthbuf_fragment> 2825 #include <map_fragment> 2826 #include <color_fragment> 2827 #include <alphamap_fragment> 2828 #include <alphatest_fragment> 2829 #include <alphahash_fragment> 2830 #include <specularmap_fragment> 2831 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2832 #ifdef USE_LIGHTMAP 2833 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2834 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2835 #else 2836 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2837 #endif 2838 #include <aomap_fragment> 2839 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2840 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2841 #include <envmap_fragment> 2842 #include <opaque_fragment> 2843 #include <tonemapping_fragment> 2844 #include <colorspace_fragment> 2845 #include <fog_fragment> 2846 #include <premultiplied_alpha_fragment> 2847 #include <dithering_fragment> 2848}`,Wg=`#define LAMBERT 2849varying vec3 vViewPosition; 2850#include <common> 2851#include <batching_pars_vertex> 2852#include <uv_pars_vertex> 2853#include <displacementmap_pars_vertex> 2854#include <envmap_pars_vertex> 2855#include <color_pars_vertex> 2856#include <fog_pars_vertex> 2857#include <normal_pars_vertex> 2858#include <morphtarget_pars_vertex> 2859#include <skinning_pars_vertex> 2860#include <shadowmap_pars_vertex> 2861#include <logdepthbuf_pars_vertex> 2862#include <clipping_planes_pars_vertex> 2863void main() { 2864 #include <uv_vertex> 2865 #include <color_vertex> 2866 #include <morphinstance_vertex> 2867 #include <morphcolor_vertex> 2868 #include <batching_vertex> 2869 #include <beginnormal_vertex> 2870 #include <morphnormal_vertex> 2871 #include <skinbase_vertex> 2872 #include <skinnormal_vertex> 2873 #include <defaultnormal_vertex> 2874 #include <normal_vertex> 2875 #include <begin_vertex> 2876 #include <morphtarget_vertex> 2877 #include <skinning_vertex> 2878 #include <displacementmap_vertex> 2879 #include <project_vertex> 2880 #include <logdepthbuf_vertex> 2881 #include <clipping_planes_vertex> 2882 vViewPosition = - mvPosition.xyz; 2883 #include <worldpos_vertex> 2884 #include <envmap_vertex> 2885 #include <shadowmap_vertex> 2886 #include <fog_vertex> 2887}`,Xg=`#define LAMBERT 2888uniform vec3 diffuse; 2889uniform vec3 emissive; 2890uniform float opacity; 2891#include <common> 2892#include <packing> 2893#include <dithering_pars_fragment> 2894#include <color_pars_fragment> 2895#include <uv_pars_fragment> 2896#include <map_pars_fragment> 2897#include <alphamap_pars_fragment> 2898#include <alphatest_pars_fragment> 2899#include <alphahash_pars_fragment> 2900#include <aomap_pars_fragment> 2901#include <lightmap_pars_fragment> 2902#include <emissivemap_pars_fragment> 2903#include <envmap_common_pars_fragment> 2904#include <envmap_pars_fragment> 2905#include <fog_pars_fragment> 2906#include <bsdfs> 2907#include <lights_pars_begin> 2908#include <normal_pars_fragment> 2909#include <lights_lambert_pars_fragment> 2910#include <shadowmap_pars_fragment> 2911#include <bumpmap_pars_fragment> 2912#include <normalmap_pars_fragment> 2913#include <specularmap_pars_fragment> 2914#include <logdepthbuf_pars_fragment> 2915#include <clipping_planes_pars_fragment> 2916void main() { 2917 vec4 diffuseColor = vec4( diffuse, opacity ); 2918 #include <clipping_planes_fragment> 2919 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2920 vec3 totalEmissiveRadiance = emissive; 2921 #include <logdepthbuf_fragment> 2922 #include <map_fragment> 2923 #include <color_fragment> 2924 #include <alphamap_fragment> 2925 #include <alphatest_fragment> 2926 #include <alphahash_fragment> 2927 #include <specularmap_fragment> 2928 #include <normal_fragment_begin> 2929 #include <normal_fragment_maps> 2930 #include <emissivemap_fragment> 2931 #include <lights_lambert_fragment> 2932 #include <lights_fragment_begin> 2933 #include <lights_fragment_maps> 2934 #include <lights_fragment_end> 2935 #include <aomap_fragment> 2936 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2937 #include <envmap_fragment> 2938 #include <opaque_fragment> 2939 #include <tonemapping_fragment> 2940 #include <colorspace_fragment> 2941 #include <fog_fragment> 2942 #include <premultiplied_alpha_fragment> 2943 #include <dithering_fragment> 2944}`,qg=`#define MATCAP 2945varying vec3 vViewPosition; 2946#include <common> 2947#include <batching_pars_vertex> 2948#include <uv_pars_vertex> 2949#include <color_pars_vertex> 2950#include <displacementmap_pars_vertex> 2951#include <fog_pars_vertex> 2952#include <normal_pars_vertex> 2953#include <morphtarget_pars_vertex> 2954#include <skinning_pars_vertex> 2955#include <logdepthbuf_pars_vertex> 2956#include <clipping_planes_pars_vertex> 2957void main() { 2958 #include <uv_vertex> 2959 #include <color_vertex> 2960 #include <morphinstance_vertex> 2961 #include <morphcolor_vertex> 2962 #include <batching_vertex> 2963 #include <beginnormal_vertex> 2964 #include <morphnormal_vertex> 2965 #include <skinbase_vertex> 2966 #include <skinnormal_vertex> 2967 #include <defaultnormal_vertex> 2968 #include <normal_vertex> 2969 #include <begin_vertex> 2970 #include <morphtarget_vertex> 2971 #include <skinning_vertex> 2972 #include <displacementmap_vertex> 2973 #include <project_vertex> 2974 #include <logdepthbuf_vertex> 2975 #include <clipping_planes_vertex> 2976 #include <fog_vertex> 2977 vViewPosition = - mvPosition.xyz; 2978}`,Yg=`#define MATCAP 2979uniform vec3 diffuse; 2980uniform float opacity; 2981uniform sampler2D matcap; 2982varying vec3 vViewPosition; 2983#include <common> 2984#include <dithering_pars_fragment> 2985#include <color_pars_fragment> 2986#include <uv_pars_fragment> 2987#include <map_pars_fragment> 2988#include <alphamap_pars_fragment> 2989#include <alphatest_pars_fragment> 2990#include <alphahash_pars_fragment> 2991#include <fog_pars_fragment> 2992#include <normal_pars_fragment> 2993#include <bumpmap_pars_fragment> 2994#include <norm
2994almap_pars_fragment> 2995#include <logdepthbuf_pars_fragment> 2996#include <clipping_planes_pars_fragment> 2997void main() { 2998 vec4 diffuseColor = vec4( diffuse, opacity ); 2999 #include <clipping_planes_fragment> 3000 #include <logdepthbuf_fragment> 3001 #include <map_fragment> 3002 #include <color_fragment> 3003 #include <alphamap_fragment> 3004 #include <alphatest_fragment> 3005 #include <alphahash_fragment> 3006 #include <normal_fragment_begin> 3007 #include <normal_fragment_maps> 3008 vec3 viewDir = normalize( vViewPosition ); 3009 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3010 vec3 y = cross( viewDir, x ); 3011 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3012 #ifdef USE_MATCAP 3013 vec4 matcapColor = texture2D( matcap, uv ); 3014 #else 3015 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3016 #endif 3017 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3018 #include <opaque_fragment> 3019 #include <tonemapping_fragment> 3020 #include <colorspace_fragment> 3021 #include <fog_fragment> 3022 #include <premultiplied_alpha_fragment> 3023 #include <dithering_fragment> 3024}`,Zg=`#define NORMAL 3025#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3026 varying vec3 vViewPosition; 3027#endif 3028#include <common> 3029#include <batching_pars_vertex> 3030#include <uv_pars_vertex> 3031#include <displacementmap_pars_vertex> 3032#include <normal_pars_vertex> 3033#include <morphtarget_pars_vertex> 3034#include <skinning_pars_vertex> 3035#include <logdepthbuf_pars_vertex> 3036#include <clipping_planes_pars_vertex> 3037void main() { 3038 #include <uv_vertex> 3039 #include <batching_vertex> 3040 #include <beginnormal_vertex> 3041 #include <morphinstance_vertex> 3042 #include <morphnormal_vertex> 3043 #include <skinbase_vertex> 3044 #include <skinnormal_vertex> 3045 #include <defaultnormal_vertex> 3046 #include <normal_vertex> 3047 #include <begin_vertex> 3048 #include <morphtarget_vertex> 3049 #include <skinning_vertex> 3050 #include <displacementmap_vertex> 3051 #include <project_vertex> 3052 #include <logdepthbuf_vertex> 3053 #include <clipping_planes_vertex> 3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3055 vViewPosition = - mvPosition.xyz; 3056#endif 3057}`,Kg=`#define NORMAL 3058uniform float opacity; 3059#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3060 varying vec3 vViewPosition; 3061#endif 3062#include <packing> 3063#include <uv_pars_fragment> 3064#include <normal_pars_fragment> 3065#include <bumpmap_pars_fragment> 3066#include <normalmap_pars_fragment> 3067#include <logdepthbuf_pars_fragment> 3068#include <clipping_planes_pars_fragment> 3069void main() { 3070 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3071 #include <clipping_planes_fragment> 3072 #include <logdepthbuf_fragment> 3073 #include <normal_fragment_begin> 3074 #include <normal_fragment_maps> 3075 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3076 #ifdef OPAQUE 3077 gl_FragColor.a = 1.0; 3078 #endif 3079}`,$g=`#define PHONG 3080varying vec3 vViewPosition; 3081#include <common> 3082#include <batching_pars_vertex> 3083#include <uv_pars_vertex> 3084#include <displacementmap_pars_vertex> 3085#include <envmap_pars_vertex> 3086#include <color_pars_vertex> 3087#include <fog_pars_vertex> 3088#include <normal_pars_vertex> 3089#include <morphtarget_pars_vertex> 3090#include <skinning_pars_vertex> 3091#include <shadowmap_pars_vertex> 3092#include <logdepthbuf_pars_vertex> 3093#include <clipping_planes_pars_vertex> 3094void main() { 3095 #include <uv_vertex> 3096 #include <color_vertex> 3097 #include <morphcolor_vertex> 3098 #include <batching_vertex> 3099 #include <beginnormal_vertex> 3100 #include <morphinstance_vertex> 3101 #include <morphnormal_vertex> 3102 #include <skinbase_vertex> 3103 #include <skinnormal_vertex> 3104 #include <defaultnormal_vertex> 3105 #include <normal_vertex> 3106 #include <begin_vertex> 3107 #include <morphtarget_vertex> 3108 #include <skinning_vertex> 3109 #include <displacementmap_vertex> 3110 #include <project_vertex> 3111 #include <logdepthbuf_vertex> 3112 #include <clipping_planes_vertex> 3113 vViewPosition = - mvPosition.xyz; 3114 #include <worldpos_vertex> 3115 #include <envmap_vertex> 3116 #include <shadowmap_vertex> 3117 #include <fog_vertex> 3118}`,Jg=`#define PHONG 3119uniform vec3 diffuse; 3120uniform vec3 emissive; 3121uniform vec3 specular; 3122uniform float shininess; 3123uniform float opacity; 3124#include <common> 3125#include <packing> 3126#include <dithering_pars_fragment> 3127#include <color_pars_fragment> 3128#include <uv_pars_fragment> 3129#include <map_pars_fragment> 3130#include <alphamap_pars_fragment> 3131#include <alphatest_pars_fragment> 3132#include <alphahash_pars_fragment> 3133#include <aomap_pars_fragment> 3134#include <lightmap_pars_fragment> 3135#include <emissivemap_pars_fragment> 3136#include <envmap_common_pars_fragment> 3137#include <envmap_pars_fragment> 3138#include <fog_pars_fragment> 3139#include <bsdfs> 3140#include <lights_pars_begin> 3141#include <normal_pars_fragment> 3142#include <lights_phong_pars_fragment> 3143#include <shadowmap_pars_fragment> 3144#include <bumpmap_pars_fragment> 3145#include <normalmap_pars_fragment> 3146#include <specularmap_pars_fragment> 3147#include <logdepthbuf_pars_fragment> 3148#include <clipping_planes_pars_fragment> 3149void main() { 3150 vec4 diffuseColor = vec4( diffuse, opacity ); 3151 #include <clipping_planes_fragment> 3152 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3153 vec3 totalEmissiveRadiance = emissive; 3154 #include <logdepthbuf_fragment> 3155 #include <map_fragment> 3156 #include <color_fragment> 3157 #include <alphamap_fragment> 3158 #include <alphatest_fragment> 3159 #include <alphahash_fragment> 3160 #include <specularmap_fragment> 3161 #include <normal_fragment_begin> 3162 #include <normal_fragment_maps> 3163 #include <emissivemap_fragment> 3164 #include <lights_phong_fragment> 3165 #include <lights_fragment_begin> 3166 #include <lights_fragment_maps> 3167 #include <lights_fragment_end> 3168 #include <aomap_fragment> 3169 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3170 #include <envmap_fragment> 3171 #include <opaque_fragment> 3172 #include <tonemapping_fragment> 3173 #include <colorspace_fragment> 3174 #include <fog_fragment> 3175 #include <premultiplied_alpha_fragment> 3176 #include <dithering_fragment> 3177}`,jg=`#define STANDARD 3178varying vec3 vViewPosition; 3179#ifdef USE_TRANSMISSION 3180 varying vec3 vWorldPosition; 3181#endif 3182#include <common> 3183#include <batching_pars_vertex> 3184#include <uv_pars_vertex> 3185#include <displacementmap_pars_vertex> 3186#include <color_pars_vertex> 3187#include <fog_pars_vertex> 3188#include <normal_pars_vertex> 3189#include <morphtarget_pars_vertex> 3190#include <skinning_pars_vertex> 3191#include <shadowmap_pars_vertex> 3192#include <logdepthbuf_pars_vertex> 3193#include <clipping_planes_pars_vertex> 3194void main() { 3195 #include <uv_vertex> 3196 #include <color_vertex> 3197 #include <morphinstance_vertex> 3198 #include <morphcolor_vertex> 3199 #include <batching_vertex> 3200 #include <beginnormal_vertex> 3201 #include <morphnormal_vertex> 3202 #include <skinbase_vertex> 3203 #include <skinnormal_vertex> 3204 #include <defaultnormal_vertex> 3205 #include <normal_vertex> 3206 #include <begin_vertex> 3207 #include <morphtarget_vertex> 3208 #include <skinning_vertex> 3209 #include <displacementmap_vertex> 3210 #include <project_vertex> 3211 #include <logdepthbuf_vertex> 3212 #include <clipping_planes_vertex> 3213 vViewPosition = - mvPosition.xyz; 3214 #include <worldpos_vertex> 3215 #include <shadowmap_vertex> 3216 #include <fog_vertex> 3217#ifdef USE_TRANSMISSION 3218 vWorldPosition = worldPosition.xyz; 3219#endif 3220}`,Qg=`#define STANDARD 3221#ifdef PHYSICAL 3222 #define IOR 3223 #define USE_SPECULAR 3224#endif 3225uniform vec3 diffuse; 3226uniform vec3 emissive; 3227uniform float roughness; 3228uniform float metalness; 3229uniform float opacity; 3230#ifdef IOR 3231 uniform float ior; 3232#endif 3233#ifdef USE_SPECULAR 3234 uniform float specularIntensity; 3235 uniform vec3 specularColor; 3236 #ifdef USE_SPECULAR_COLORMAP 3237 uniform sampler2D specularColorMap; 3238 #endif 3239 #ifdef USE_SPECULAR_INTENSITYMAP 3240 uniform sampler2D specularIntensityMap; 3241 #endif 3242#endif 3243#ifdef USE_CLEARCOAT 3244 uniform float clearcoat; 3245 uniform float clearcoatRoughness; 3246#endif 3247#ifdef USE_DISPERSION 3248 uniform float dispersion; 3249#endif
3250#ifdef USE_IRIDESCENCE 3251 uniform float iridescence; 3252 uniform float iridescenceIOR; 3253 uniform float iridescenceThicknessMinimum; 3254 uniform float iridescenceThicknessMaximum; 3255#endif 3256#ifdef USE_SHEEN 3257 uniform vec3 sheenColor; 3258 uniform float sheenRoughness; 3259 #ifdef USE_SHEEN_COLORMAP 3260 uniform sampler2D sheenColorMap; 3261 #endif 3262 #ifdef USE_SHEEN_ROUGHNESSMAP 3263 uniform sampler2D sheenRoughnessMap; 3264 #endif 3265#endif 3266#ifdef USE_ANISOTROPY 3267 uniform vec2 anisotropyVector; 3268 #ifdef USE_ANISOTROPYMAP 3269 uniform sampler2D anisotropyMap; 3270 #endif 3271#endif 3272varying vec3 vViewPosition; 3273#include <common> 3274#include <packing> 3275#include <dithering_pars_fragment> 3276#include <color_pars_fragment> 3277#include <uv_pars_fragment> 3278#include <map_pars_fragment> 3279#include <alphamap_pars_fragment> 3280#include <alphatest_pars_fragment> 3281#include <alphahash_pars_fragment> 3282#include <aomap_pars_fragment> 3283#include <lightmap_pars_fragment> 3284#include <emissivemap_pars_fragment> 3285#include <iridescence_fragment> 3286#include <cube_uv_reflection_fragment> 3287#include <envmap_common_pars_fragment> 3288#include <envmap_physical_pars_fragment> 3289#include <fog_pars_fragment> 3290#include <lights_pars_begin> 3291#include <normal_pars_fragment> 3292#include <lights_physical_pars_fragment> 3293#include <transmission_pars_fragment> 3294#include <shadowmap_pars_fragment> 3295#include <bumpmap_pars_fragment> 3296#include <normalmap_pars_fragment> 3297#include <clearcoat_pars_fragment> 3298#include <iridescence_pars_fragment> 3299#include <roughnessmap_pars_fragment> 3300#include <metalnessmap_pars_fragment> 3301#include <logdepthbuf_pars_fragment> 3302#include <clipping_planes_pars_fragment> 3303void main() { 3304 vec4 diffuseColor = vec4( diffuse, opacity ); 3305 #include <clipping_planes_fragment> 3306 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3307 vec3 totalEmissiveRadiance = emissive; 3308 #include <logdepthbuf_fragment> 3309 #include <map_fragment> 3310 #include <color_fragment> 3311 #include <alphamap_fragment> 3312 #include <alphatest_fragment> 3313 #include <alphahash_fragment> 3314 #include <roughnessmap_fragment> 3315 #include <metalnessmap_fragment> 3316 #include <normal_fragment_begin> 3317 #include <normal_fragment_maps> 3318 #include <clearcoat_normal_fragment_begin> 3319 #include <clearcoat_normal_fragment_maps> 3320 #include <emissivemap_fragment> 3321 #include <lights_physical_fragment> 3322 #include <lights_fragment_begin> 3323 #include <lights_fragment_maps> 3324 #include <lights_fragment_end> 3325 #include <aomap_fragment> 3326 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3327 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3328 #include <transmission_fragment> 3329 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3330 #ifdef USE_SHEEN 3331 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3332 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3333 #endif 3334 #ifdef USE_CLEARCOAT 3335 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3336 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3337 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3338 #endif 3339 #include <opaque_fragment> 3340 #include <tonemapping_fragment> 3341 #include <colorspace_fragment> 3342 #include <fog_fragment> 3343 #include <premultiplied_alpha_fragment> 3344 #include <dithering_fragment> 3345}`,e_=`#define TOON 3346varying vec3 vViewPosition; 3347#include <common> 3348#include <batching_pars_vertex> 3349#include <uv_pars_vertex> 3350#include <displacementmap_pars_vertex> 3351#include <color_pars_vertex> 3352#include <fog_pars_vertex> 3353#include <normal_pars_vertex> 3354#include <morphtarget_pars_vertex> 3355#include <skinning_pars_vertex> 3356#include <shadowmap_pars_vertex> 3357#include <logdepthbuf_pars_vertex> 3358#include <clipping_planes_pars_vertex> 3359void main() { 3360 #include <uv_vertex> 3361 #include <color_vertex> 3362 #include <morphinstance_vertex> 3363 #include <morphcolor_vertex> 3364 #include <batching_vertex> 3365 #include <beginnormal_vertex> 3366 #include <morphnormal_vertex> 3367 #include <skinbase_vertex> 3368 #include <skinnormal_vertex> 3369 #include <defaultnormal_vertex> 3370 #include <normal_vertex> 3371 #include <begin_vertex> 3372 #include <morphtarget_vertex> 3373 #include <skinning_vertex> 3374 #include <displacementmap_vertex> 3375 #include <project_vertex> 3376 #include <logdepthbuf_vertex> 3377 #include <clipping_planes_vertex> 3378 vViewPosition = - mvPosition.xyz; 3379 #include <worldpos_vertex> 3380 #include <shadowmap_vertex> 3381 #include <fog_vertex> 3382}`,t_=`#define TOON 3383uniform vec3 diffuse; 3384uniform vec3 emissive; 3385uniform float opacity; 3386#include <common> 3387#include <packing> 3388#include <dithering_pars_fragment> 3389#include <color_pars_fragment> 3390#include <uv_pars_fragment> 3391#include <map_pars_fragment> 3392#include <alphamap_pars_fragment> 3393#include <alphatest_pars_fragment> 3394#include <alphahash_pars_fragment> 3395#include <aomap_pars_fragment> 3396#include <lightmap_pars_fragment> 3397#include <emissivemap_pars_fragment> 3398#include <gradientmap_pars_fragment> 3399#include <fog_pars_fragment> 3400#include <bsdfs> 3401#include <lights_pars_begin> 3402#include <normal_pars_fragment> 3403#include <lights_toon_pars_fragment> 3404#include <shadowmap_pars_fragment> 3405#include <bumpmap_pars_fragment> 3406#include <normalmap_pars_fragment> 3407#include <logdepthbuf_pars_fragment> 3408#include <clipping_planes_pars_fragment> 3409void main() { 3410 vec4 diffuseColor = vec4( diffuse, opacity ); 3411 #include <clipping_planes_fragment> 3412 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3413 vec3 totalEmissiveRadiance = emissive; 3414 #include <logdepthbuf_fragment> 3415 #include <map_fragment> 3416 #include <color_fragment> 3417 #include <alphamap_fragment> 3418 #include <alphatest_fragment> 3419 #include <alphahash_fragment> 3420 #include <normal_fragment_begin> 3421 #include <normal_fragment_maps> 3422 #include <emissivemap_fragment> 3423 #include <lights_toon_fragment> 3424 #include <lights_fragment_begin> 3425 #include <lights_fragment_maps> 3426 #include <lights_fragment_end> 3427 #include <aomap_fragment> 3428 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3429 #include <opaque_fragment> 3430 #include <tonemapping_fragment> 3431 #include <colorspace_fragment> 3432 #include <fog_fragment> 3433 #include <premultiplied_alpha_fragment> 3434 #include <dithering_fragment> 3435}`,n_=`uniform float size; 3436uniform float scale; 3437#include <common> 3438#include <color_pars_vertex> 3439#include <fog_pars_vertex> 3440#include <morphtarget_pars_vertex> 3441#include <logdepthbuf_pars_vertex> 3442#include <clipping_planes_pars_vertex> 3443#ifdef USE_POINTS_UV 3444 varying vec2 vUv; 3445 uniform mat3 uvTransform; 3446#endif 3447void main() { 3448 #ifdef USE_POINTS_UV 3449 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3450 #endif 3451 #include <color_vertex> 3452 #include <morphinstance_vertex> 3453 #include <morphcolor_vertex> 3454 #include <begin_vertex> 3455 #include <morphtarget_vertex> 3456 #include <project_vertex> 3457 gl_PointSize = size; 3458 #ifdef USE_SIZEATTENUATION 3459 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3460 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3461 #endif 3462 #include <logdepthbuf_vertex> 3463 #include <clipping_planes_vertex> 3464 #include <worldpos_vertex> 3465 #include <fog_vertex> 3466}`,i_=`uniform vec3 diffuse; 3467uniform float opacity; 3468#include <common> 3469#include <color_pars_fragment> 3470#include <map_particle_pars_fragment> 3471#include <alphatest_pars_fragment> 3472#include <alphahash_pars_fragment> 3473#include <fog_pars_fragment> 3474#include <logdepthbuf_pars_fragment> 3475#include <clipping_planes_pars_fragment> 3476void main() { 3477 vec4 diffuseColor = vec4( diffuse, opacity ); 3478 #include <clipping_planes_fragment> 3479 vec3 outgoingLight = vec3( 0.0 ); 3480 #include <logdepthbuf_fragment> 3481 #include <map_particle_fragment> 3482 #include <color_fragment> 3483 #include <alphatest_fragment> 3484 #include <alphahash_fragment> 3485 outgoingLight = diffuseColor.rgb; 3486 #include <opaque_fragment> 3487 #include <tonemapping_fragment> 3488 #include <colorspace_fragment> 3489 #include <fog_fragment> 3490 #include <premultiplied_alpha_fragment> 3491}`,s_=`#include <common> 3492#include <batching_pars_vertex> 3493#include <fog_pars_vertex> 3494#include <morphtarget_pars_vertex> 3495#include <skinning_pars_vertex> 3496#include <logdepthbuf_pars_vertex> 3497#include <shadowmap_pars_vertex> 3498void main() { 3499 #include <batching_vertex> 3500 #include <beginnormal_vertex> 3501 #include <morphinstance_vertex> 3502 #include <morphnormal_vertex> 3503 #include <skinbase_vertex> 3504 #include <skinnormal_vertex> 3505 #include <defaultnormal_vertex> 3506 #include <begin_vertex> 3507 #include <morphtarget_vertex> 3508 #include <skinning_vertex> 3509 #include <project_vertex> 3510 #include <logdepthbuf_vertex> 3511 #include <worldpos_vertex> 3512 #include <shadowmap_vertex> 3513 #include <fog_vertex> 3514}`,r_=`uniform vec3 color; 3515uniform float opacity; 3516#include <common> 3517#include <packing> 3518#include <fog_pars_fragment> 3519#include <bsdfs> 3520#include <lights_pars_begin> 3521#include <logdepthbuf_pars_fragment> 3522#include <shadowmap_pars_fragment> 3523#include <shadowmask_pars_fragment> 3524void main() { 3525 #include <logdepthbuf_fragment> 3526 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3527 #include <tonemapping_fragment> 3528 #include <colorspace_fragment> 3529 #include <fog_fragment> 3530}`,o_=`uniform float rotation; 3531uniform vec2 center; 3532#include <common> 3533#include <uv_pars_vertex> 3534#include <fog_pars_vertex> 3535#include <logdepthbuf_pars_vertex> 3536#include <clipping_planes_pars_vertex> 3537void main() { 3538 #include <uv_vertex> 3539 vec4 mvPosition = modelViewMatrix[ 3 ]; 3540 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3541 #ifndef USE_SIZEATTENUATION 3542 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3543 if ( isPerspective ) scale *= - mvPosition.z; 3544 #endif 3545 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3546 vec2 rotatedPosition; 3547 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3548 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3549 mvPosition.xy += rotatedPosition; 3550 gl_Position = projectionMatrix * mvPosition; 3551 #include <logdepthbuf_vertex> 3552 #include <clipping_planes_vertex> 3553 #include <fog_vertex> 3554}`,a_=`uniform vec3 diffuse; 3555uniform float opacity; 3556#include <common> 3557#include <uv_pars_fragment> 3558#include <map_pars_fragment> 3559#include <alphamap_pars_fragment> 3560#include <alphatest_pars_fragment> 3561#include <alphahash_pars_fragment> 3562#include <fog_pars_fragment> 3563#include <logdepthbuf_pars_fragment> 3564#include <clipping_planes_pars_fragment> 3565void main() { 3566 vec4 diffuseColor = vec4( diffuse, opacity ); 3567 #include <clipping_planes_fragment> 3568 vec3 outgoingLight = vec3( 0.0 ); 3569 #include <logdepthbuf_fragment> 3570 #include <map_fragment> 3571 #include <alphamap_fragment> 3572 #include <alphatest_fragment> 3573 #include <alphahash_fragment> 3574 outgoingLight = diffuseColor.rgb; 3575 #include <opaque_fragment> 3576 #include <tonemapping_fragment> 3577 #include <colorspace_fragment> 3578 #include <fog_fragment> 3579}`,Ye={alphahash_fragment:Cp,alphahash_pars_fragment:Ip,alphamap_fragment:Pp,alphamap_pars_fragment:Lp,alphatest_fragment:Dp,alphatest_pars_fragment:Np,aomap_fragment:Up,aomap_pars_fragment:Op,batching_pars_vertex:Fp,batching_vertex:Bp,begin_vertex:zp,beginnormal_vertex:kp,bsdfs:Hp,iridescence_fragment:Vp,bumpmap_pars_fragment:Gp,clipping_planes_fragment:Wp,clipping_planes_pars_fragment:Xp,clipping_planes_pars_vertex:qp,clipping_planes_vertex:Yp,color_fragment:Zp,color_pars_fragment:Kp,color_pars_vertex:$p,color_vertex:Jp,common:jp,cube_uv_reflection_fragment:Qp,defaultnormal_vertex:em,displacementmap_pars_vertex:tm,displacementmap_vertex:nm,emissivemap_fragment:im,emissivemap_pars_fragment:sm,colorspace_fragment:rm,colorspace_pars_fragment:om,envmap_fragment:am,envmap_common_pars_fragment:cm,envmap_pars_fragment:lm,envmap_pars_vertex:hm,envmap_physical_pars_fragment:Mm,envmap_vertex:um,fog_vertex:dm,fog_pars_vertex:fm,fog_fragment:pm,fog_pars_fragment:mm,gradientmap_pars_fragment:gm,lightmap_pars_fragment:_m,lights_lambert_fragment:xm,lights_lambert_pars_fragment:ym,lights_pars_begin:vm,lights_toon_fragment:Sm,lights_toon_pars_fragment:bm,lights_phong_fragment:Em,lights_phong_pars_fragment:Tm,lights_physical_fragment:Am,lights_physical_pars_fragment:wm,lights_fragment_begin:Rm,lights_fragment_maps:Cm,lights_fragment_end:Im,logdepthbuf_fragment:Pm,logdepthbuf_pars_fragment:Lm,logdepthbuf_pars_vertex:Dm,logdepthbuf_vertex:Nm,map_fragment:Um,map_pars_fragment:Om,map_particle_fragment:Fm,map_particle_pars_fragment:Bm,metalnessmap_fragment:zm,metalnessmap_pars_fragment:km,morphinstance_vertex:Hm,morphcolor_vertex:Vm,morphnormal_vertex:Gm,morphtarget_pars_vertex:Wm,morphtarget_vertex:Xm,normal_fragment_begin:qm,normal_fragment_maps:Ym,normal_pars_fragment:Zm,normal_pars_vertex:Km,normal_vertex:$m,normalmap_pars_fragment:Jm,clearcoat_normal_fragment_begin:jm,clearcoat_normal_fragment_maps:Qm,clearcoat_pars_fragment:eg,iridescence_pars_fragment:tg,opaque_fragment:ng,packing:ig,premultiplied_alpha_fragment:sg,project_vertex:rg,dithering_fragment:og,dithering_pars_fragment:ag,roughnessmap_fragment:cg,roughnessmap_pars_fragment:lg,shadowmap_pars_fragment:hg,shadowmap_pars_vertex:ug,shadowmap_vertex:dg,shadowmask_pars_fragment:fg,skinbase_vertex:pg,skinning_pars_vertex:mg,skinning_vertex:gg,skinnormal_vertex:_g,specularmap_fragment:xg,specularmap_pars_fragment:yg,tonemapping_fragment:vg,tonemapping_pars_fragment:Mg,transmission_fragment:Sg,transmission_pars_fragment:bg,uv_pars_fragment:Eg,uv_pars_vertex:Tg,uv_vertex:Ag,worldpos_vertex:wg,background_vert:
vendor: 10,079 bytes, line 3579
3579Rg,background_frag:Cg,backgroundCube_vert:Ig,backgroundCube_frag:Pg,cube_vert:Lg,cube_frag:Dg,depth_vert:Ng,depth_frag:Ug,distanceRGBA_vert:Og,distanceRGBA_frag:Fg,equirect_vert:Bg,equirect_frag:zg,linedashed_vert:kg,linedashed_frag:Hg,meshbasic_vert:Vg,meshbasic_frag:Gg,meshlambert_vert:Wg,meshlambert_frag:Xg,meshmatcap_vert:qg,meshmatcap_frag:Yg,meshnormal_vert:Zg,meshnormal_frag:Kg,meshphong_vert:$g,meshphong_frag:Jg,meshphysical_vert:jg,meshphysical_frag:Qg,meshtoon_vert:e_,meshtoon_frag:t_,points_vert:n_,points_frag:i_,shadow_vert:s_,shadow_frag:r_,sprite_vert:o_,sprite_frag:a_},pe={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ge}},envmap:{envMap:{value:null},envMapRotation:{value:new Ge},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ge}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ge}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ge},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ge},normalScale:{value:new ie(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ge},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ge}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ge}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ge}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Le(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 Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0},uvTransform:{value:new Ge}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new ie(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}}},Pn={basic:{uniforms:Dt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:Dt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:Dt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:Dt([pe.common,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.roughnessmap,pe.metalnessmap,pe.fog,pe.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:Dt([pe.common,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.gradientmap,pe.fog,pe.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:Dt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:Dt([pe.points,pe.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:Dt([pe.common,pe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:Dt([pe.common,pe.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:Dt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:Dt([pe.sprite,pe.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new Ge},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ge}},vertexShader:Ye.backgroundCube_vert,fragmentShader:Ye.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:Dt([pe.common,pe.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:Dt([pe.lights,pe.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};Pn.physical={uniforms:Dt([Pn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ge},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ge},clearcoatNormalScale:{value:new ie(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ge},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ge},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ge},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ge},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ge},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ge},transmissionSamplerSize:{value:new ie},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ge},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ge},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ge},anisotropyVector:{value:new ie},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ge}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};var Oa={r:0,b:0,g:0},Bi=new gn,c_=new Ve;function l_(i,e,t,n,s,r,o){let a=new Le(0),c=r===!0?0:1,l,h,u=null,d=0,f=null;function g(S){let x=S.isScene===!0?S.background:null;return x&&x.isTexture&&(x=(S.backgroundBlurriness>0?t:e).get(x)),x}function _(S){let x=!1,R=g(S);R===null?p(a,c):R&&R.isColor&&(p(R,1),x=!0);let w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,o):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(S,x){let R=g(x);R&&(R.isCubeTexture||R.mapping===Lr)?(h===void 0&&(h=new ht(new an(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:Fi(Pn.backgroundCube.uniforms),vertexShader:Pn.backgroundCube.vertexShader,fragmentShader:Pn.backgroundCube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,P,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),Bi.copy(x.backgroundRotation),Bi.x*=-1,Bi.y*=-1,Bi.z*=-1,R.isCubeTexture&&R.isRenderTargetTexture===!1&&(Bi.y*=-1,Bi.z*=-1),h.material.uniforms.envMap.value=R,h.material.uniforms.flipEnvMap.value=R.isCubeTexture&&R.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(c_.makeRotationFromEuler(Bi)),h.material.toneMapped=je.getTransfer(R.colorSpace)!==it,(u!==R||d!==R.version||f!==i.toneMapping)&&(h.material.needsUpdate=!0,u=R,d=R.version,f=i.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null)):R&&R.isTexture&&(l===void 0&&(l=new ht(new Ii(2,2),new _n({name:"Backgroun
3579dMaterial",uniforms:Fi(Pn.background.uniforms),vertexShader:Pn.background.vertexShader,fragmentShader:Pn.background.fragmentShader,side:mn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=R,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.toneMapped=je.getTransfer(R.colorSpace)!==it,R.matrixAutoUpdate===!0&&R.updateMatrix(),l.material.uniforms.uvTransform.value.copy(R.matrix),(u!==R||d!==R.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=R,d=R.version,f=i.toneMapping),l.layers.enableAll(),S.unshift(l,l.geometry,l.material,0,0,null))}function p(S,x){S.getRGB(Oa,hl(i)),n.buffers.color.setClear(Oa.r,Oa.g,Oa.b,x,o)}function E(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(S,x=1){a.set(S),c=x,p(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(S){c=S,p(a,c)},render:_,addToRenderList:m,dispose:E}}function h_(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=d(null),r=s,o=!1;function a(v,C,D,U,B){let G=!1,V=u(U,D,C);r!==V&&(r=V,l(r.object)),G=f(v,U,D,B),G&&g(v,U,D,B),B!==null&&e.update(B,i.ELEMENT_ARRAY_BUFFER),(G||o)&&(o=!1,x(v,C,D,U),B!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function c(){return i.createVertexArray()}function l(v){return i.bindVertexArray(v)}function h(v){return i.deleteVertexArray(v)}function u(v,C,D){let U=D.wireframe===!0,B=n[v.id];B===void 0&&(B={},n[v.id]=B);let G=B[C.id];G===void 0&&(G={},B[C.id]=G);let V=G[U];return V===void 0&&(V=d(c()),G[U]=V),V}function d(v){let C=[],D=[],U=[];for(let B=0;B<t;B++)C[B]=0,D[B]=0,U[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:D,attributeDivisors:U,object:v,attributes:{},index:null}}function f(v,C,D,U){let B=r.attributes,G=C.attributes,V=0,J=D.getAttributes();for(let H in J)if(J[H].location>=0){let fe=B[H],ye=G[H];if(ye===void 0&&(H==="instanceMatrix"&&v.instanceMatrix&&(ye=v.instanceMatrix),H==="instanceColor"&&v.instanceColor&&(ye=v.instanceColor)),fe===void 0||fe.attribute!==ye||ye&&fe.data!==ye.data)return!0;V++}return r.attributesNum!==V||r.index!==U}function g(v,C,D,U){let B={},G=C.attributes,V=0,J=D.getAttributes();for(let H in J)if(J[H].location>=0){let fe=G[H];fe===void 0&&(H==="instanceMatrix"&&v.instanceMatrix&&(fe=v.instanceMatrix),H==="instanceColor"&&v.instanceColor&&(fe=v.instanceColor));let ye={};ye.attribute=fe,fe&&fe.data&&(ye.data=fe.data),B[H]=ye,V++}r.attributes=B,r.attributesNum=V,r.index=U}function _(){let v=r.newAttributes;for(let C=0,D=v.length;C<D;C++)v[C]=0}function m(v){p(v,0)}function p(v,C){let D=r.newAttributes,U=r.enabledAttributes,B=r.attributeDivisors;D[v]=1,U[v]===0&&(i.enableVertexAttribArray(v),U[v]=1),B[v]!==C&&(i.vertexAttribDivisor(v,C),B[v]=C)}function E(){let v=r.newAttributes,C=r.enabledAttributes;for(let D=0,U=C.length;D<U;D++)C[D]!==v[D]&&(i.disableVertexAttribArray(D),C[D]=0)}function S(v,C,D,U,B,G,V){V===!0?i.vertexAttribIPointer(v,C,D,B,G):i.vertexAttribPointer(v,C,D,U,B,G)}function x(v,C,D,U){_();let B=U.attributes,G=D.getAttributes(),V=C.defaultAttributeValues;for(let J in G){let H=G[J];if(H.location>=0){let ce=B[J];if(ce===void 0&&(J==="instanceMatrix"&&v.instanceMatrix&&(ce=v.instanceMatrix),J==="instanceColor"&&v.instanceColor&&(ce=v.instanceColor)),ce!==void 0){let fe=ce.normalized,ye=ce.itemSize,Ue=e.get(ce);if(Ue===void 0)continue;let Be=Ue.buffer,Ze=Ue.type,qe=Ue.bytesPerElement,K=Ze===i.INT||Ze===i.UNSIGNED_INT||ce.gpuType===ta;if(ce.isInterleavedBufferAttribute){let ee=ce.data,xe=ee.stride,Re=ce.offset;if(ee.isInstancedInterleavedBuffer){for(let Me=0;Me<H.locationSize;Me++)p(H.location+Me,ee.meshPerAttribute);v.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Me=0;Me<H.locationSize;Me++)m(H.location+Me);i.bindBuffer(i.ARRAY_BUFFER,Be);for(let Me=0;Me<H.locationSize;Me++)S(H.location+Me,ye/H.locationSize,Ze,fe,xe*qe,(Re+ye/H.locationSize*Me)*qe,K)}else{if(ce.isInstancedBufferAttribute){for(let ee=0;ee<H.locationSize;ee++)p(H.location+ee,ce.meshPerAttribute);v.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=ce.meshPerAttribute*ce.count)}else for(let ee=0;ee<H.locationSize;ee++)m(H.location+ee);i.bindBuffer(i.ARRAY_BUFFER,Be);for(let ee=0;ee<H.locationSize;
vendor: 13,990 bytes, lines 3579-3654
3579ee++)S(H.location+ee,ye/H.locationSize,Ze,fe,ye*qe,ye/H.locationSize*ee*qe,K)}}else if(V!==void 0){let fe=V[J];if(fe!==void 0)switch(fe.length){case 2:i.vertexAttrib2fv(H.location,fe);break;case 3:i.vertexAttrib3fv(H.location,fe);break;case 4:i.vertexAttrib4fv(H.location,fe);break;default:i.vertexAttrib1fv(H.location,fe)}}}}E()}function R(){T();for(let v in n){let C=n[v];for(let D in C){let U=C[D];for(let B in U)h(U[B].object),delete U[B];delete C[D]}delete n[v]}}function w(v){if(n[v.id]===void 0)return;let C=n[v.id];for(let D in C){let U=C[D];for(let B in U)h(U[B].object),delete U[B];delete C[D]}delete n[v.id]}function P(v){for(let C in n){let D=n[C];if(D[v.id]===void 0)continue;let U=D[v.id];for(let B in U)h(U[B].object),delete U[B];delete D[v.id]}}function T(){y(),o=!0,r!==s&&(r=s,l(r.object))}function y(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:T,resetDefaultState:y,dispose:R,releaseStatesOfGeometry:w,releaseStatesOfProgram:P,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function u_(i,e,t){let n;function s(l){n=l}function r(l,h){i.drawArrays(n,l,h),t.update(h,n,1)}function o(l,h,u){u!==0&&(i.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function a(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let f=0;for(let g=0;g<u;g++)f+=h[g];t.update(f,n,1)}function c(l,h,u,d){if(u===0)return;let f=e.get("WEBGL_multi_draw");if(f===null)for(let g=0;g<l.length;g++)o(l[g],h[g],d[g]);else{f.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let g=0;for(let _=0;_<u;_++)g+=h[_]*d[_];t.update(g,n,1)}}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=c}function d_(i,e,t,n){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){let P=e.get("EXT_texture_filter_anisotropic");s=i.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(P){return!(P!==en&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(P){let T=P===bs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==yn&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&P!==cn&&!T)}function c(P){if(P==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp",h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),S=i.getParameter(i.MAX_VARYING_VECTORS),x=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),R=g>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:E,maxVaryings:S,maxFragmentUniforms:x,vertexTextures:R,maxSamples:w}}function f_(i){let e=this,t=null,n=0,s=!1,r=!1,o=new rn,a=new Ge,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||n!==0||s;return s=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){let g=u.clippingPlanes,_=u.clipIntersection,m=u.clipShadows,p=i.get(u);if(!s||g===null||g.length===0||r&&!m)r?h(null):l();else{let E=r?0:n,S=E*4,x=p.clippingState||null;c.value=x,x=h(g,d,S,f);for(let R=0;R!==S;++R)x[R]=t[R];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,g){let _=u!==null?u.length:0,m=null;if(_!==0){if(m=c.value,g!==!0||m===null){let p=f+_*4,E=d.matrixWorldInverse;a.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let S=0,x=f;S!==_;++S,x+=4)o.copy(u[S]).applyMatrix4(E,a),o.normal.toArray(m,x),m[x+3]=o.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function p_(i){let e=new WeakMap;function t(o,a){return a===jo?o.mapping=Ni:a===Qo&&(o.mapping=Ui),o}function n(o){if(o&&o.isTexture){let a=o.mapping;if(a===jo||a===Qo)if(e.has(o)){let c=e.get(o).texture;return t(c,o.mapping)}else{let c=o.image;if(c&&c.height>0){let l=new Ao(c.height);return l.fromEquirectangularTexture(i,o),e.set(o,l),o.addEventListener("dispose",s),t(l.texture,o.mapping)}else return null}}return o}function s(o){let a=o.target;a.removeEventListener("dispose",s);let c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}var Rs=4,id=[.125,.215,.35,.446,.526,.582],Hi=20,ml=new Di,sd=new Le,gl=null,_l=0,xl=0,yl=!1,ki=(1+Math.sqrt(5))/2,ws=1/ki,rd=[new L(-ki,ws,0),new L(ki,ws,0),new L(-ws,0,ki),new L(ws,0,ki),new L(0,ki,-ws),new L(0,ki,ws),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)],m_=new L,za=class{constructor(e){this._renderer=e,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(e,t=0,n=.1,s=100,r={}){let{size:o=256,position:a=m_}=r;gl=this._renderer.getRenderTarget(),_l=this._renderer.getActiveCubeFace(),xl=this._renderer.getActiveMipmapLevel(),yl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,s,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=cd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ad(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(gl,_l,xl),this._renderer.xr.enabled=yl,e.scissorTest=!1,Fa(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ni||e.mapping===Ui?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),gl=this._renderer.getRenderTarget(),_l=this._renderer.getActiveCubeFace(),xl=this._renderer.getActiveMipmapLevel(),yl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ot,minFilter:Ot,generateMipmaps:!1,type:bs,format:en,colorSpace:Ct,depthBuffer:!1},s=od(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=od(e,t,n);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=g_(r)),this._blurMaterial=__(r,e,t)}return s}_compileMaterial(e){let t=new ht(this._lodPlanes[0],e);this._renderer.compile(t,ml)}_sceneToCubeUV(e,t,n,s,r){let c=new vt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(sd),u.toneMapping=Yn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(s),u.clearDepth(),u.setRenderTarget(null));let _=new Bt({name:"PMREM.Background",side:zt,depthWrite:!1,depthTest:!1}),m=new ht(new an,_),p=!1,E=e.background;E?E.isColor&&(_.color.copy(E),e.background=null,p=!0):(_.color.copy(sd),p=!0);for(let S=0;S<6;S++){let x=S%3;x===0?(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[S],r.y,r.z)):x===1?(c.up.set(0,0,l[S]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[S],r.z)):(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[S]));let R=this._cubeSize;Fa(s,x*R,S>2?R:0,R,R),u.setRenderTarget(s),p&&u.render(m,c),u.render(e,c)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=E}_textureToCubeUV(e,t){let n=this._renderer,s=e.mapping===Ni||e.mapping===Ui;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=cd()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ad());let r=s?this._cubemapMaterial:this._equirectMaterial,o=new ht(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;let c=this._cubeSize;Fa(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,ml)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let s=this._lodPlanes.length;for(let r=1;r<s;r++){let o=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=rd[(s-r-1)%rd.length];this._blur(e,r-1,r,o,a)}t.autoClear=n}_blur(e,t,n,s,r){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,s,"latitudinal",r),this._halfBlur(o,e,n,n,s,"longitudinal",r)}_halfBlur(e,t,n,s,r,o,a){let c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let h=3,u=new ht(this._lodPlanes[s],l),d=l.uniforms,f=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Hi-1),_=r/g,m=isFinite(r)?1+Math.floor(h*_):Hi;m>Hi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Hi}`);let p=[],E=0;for(let P=0;P<Hi;++P){let T=P/_,y=Math.exp(-T*T/2);p.push(y),P===0?E+=y:P<m&&(E+=2*y)}for(let P=0;P<p.length;P++)p[P]=p[P]/E;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=p,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:S}=this;d.dTheta.value=g,d.mipInt.value=S-n;let x=this._sizeLods[s],R=3*x*(s>S-Rs?s-S+Rs:0),w=4*(this._cubeSize-x);Fa(t,R,w,3*x,2*x),c.setRenderTarget(t),c.render(u,ml)}};function g_(i){let e=[],t=[],n=[],s=i,r=i-Rs+1+id.length;for(let o=0;o<r;o++){let a=Math.pow(2,s);t.push(a);let c=1/a;o>i-Rs?c=id[o-i+Rs-1]:o===0&&(c=0),n.push(c);let l=1/(a-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,g=6,_=3,m=2,p=1,E=new Float32Array(_*g*f),S=new Float32Array(m*g*f),x=new Float32Array(p*g*f);for(let w=0;w<f;w++){let P=w%3*2/3-1,T=w>2?0:-1,y=[P,T,0,P+2/3,T,0,P+2/3,T+1,0,P,T,0,P+2/3,T+1,0,P,T+1,0];E.set(y,_*g*w),S.set(d,m*g*w);let v=[w,w,w,w,w,w];x.set(v,p*g*w)}let R=new Mt;R.setAttribute("position",new ut(E,_)),R.setAttribute("uv",new ut(S,m)),R.setAttribute("faceIndex",new ut(x,p)),e.push(R),s>Rs&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function od(i,e,t){let n=new Tn(i,e,t);return n.texture.mapping=Lr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fa(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function __(i,e,t){let n=new Float32Array(Hi),s=new L(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:Hi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Cl(),fragmentShader:` 3580 3581 precision mediump float; 3582 precision mediump int; 3583 3584 varying vec3 vOutputDirection; 3585 3586 uniform sampler2D envMap; 3587 uniform int samples; 3588 uniform float weights[ n ]; 3589 uniform bool latitudinal; 3590 uniform float dTheta; 3591 uniform float mipInt; 3592 uniform vec3 poleAxis; 3593 3594 #define ENVMAP_TYPE_CUBE_UV 3595 #include <cube_uv_reflection_fragment> 3596 3597 vec3 getSample( float theta, vec3 axis ) { 3598 3599 float cosTheta = cos( theta ); 3600 // Rodrigues' axis-angle rotation 3601 vec3 sampleDirection = vOutputDirection * cosTheta 3602 + cross( axis, vOutputDirection ) * sin( theta ) 3603 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3604 3605 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3606 3607 } 3608 3609 void main() { 3610 3611 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3612 3613 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3614 3615 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3616 3617 } 3618 3619 axis = normalize( axis ); 3620 3621 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3622 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3623 3624 for ( int i = 1; i < n; i++ ) { 3625 3626 if ( i >= samples ) { 3627 3628 break; 3629 3630 } 3631 3632 float theta = dTheta * float( i ); 3633 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3634 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3635 3636 } 3637 3638 } 3639 `,blending:qn,depthTest:!1,depthWrite:!1})}function ad(){return new _n({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Cl(),fragmentShader:` 3640 3641 precision mediump float; 3642 precision mediump int; 3643 3644 varying vec3 vOutputDirection; 3645 3646 uniform sampler2D envMap; 3647 3648 #include <common> 3649 3650 void main() { 3651 3652 vec3 outputDirection = normalize( vOutputDirection ); 3653 vec2 uv = equirectUv( outputDirection ); 3654
3655 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3656 3657 } 3658 `,blending:qn,depthTest:!1,depthWrite:!1})}function cd(){return new _n({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Cl(),fragmentShader:` 3659 3660 precision mediump float; 3661 precision mediump int; 3662 3663 uniform float flipEnvMap; 3664 3665 varying vec3 vOutputDirection; 3666 3667 uniform samplerCube envMap; 3668 3669 void main() { 3670 3671 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3672 3673 } 3674 `,blending:qn,depthTest:!1,depthWrite:!1})}function Cl(){return` 3675 3676 precision mediump float; 3677 precision mediump int; 3678 3679 attribute float faceIndex; 3680 3681 varying vec3 vOutputDirection; 3682 3683 // RH coordinate system; PMREM face-indexing convention 3684 vec3 getDirection( vec2 uv, float face ) { 3685 3686 uv = 2.0 * uv - 1.0; 3687 3688 vec3 direction = vec3( uv, 1.0 ); 3689 3690 if ( face == 0.0 ) { 3691 3692 direction = direction.zyx; // ( 1, v, u ) pos x 3693 3694 } else if ( face == 1.0 ) { 3695 3696 direction = direction.xzy; 3697 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3698 3699 } else if ( face == 2.0 ) { 3700 3701 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3702 3703 } else if ( face == 3.0 ) { 3704 3705 direction = direction.zyx; 3706 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3707 3708 } else if ( face == 4.0 ) { 3709 3710 direction = direction.xzy; 3711 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3712 3713 } else if ( face == 5.0 ) { 3714 3715 direction.z *= -1.0; // ( u, v, -1 ) neg z 3716 3717 } 3718 3719 return direction; 3720 3721 } 3722 3723 void main() { 3724 3725 vOutputDirection = getDirection( uv, faceIndex ); 3726 gl_Position = vec4( position, 1.0 ); 3727 3728 } 3729 `}function x_(i){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){let c=a.mapping,l=c===jo||c===Qo,h=c===Ni||c===Ui;if(l||h){let u=e.get(a),d=u!==void 0?u.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new za(i)),u=l?t.fromEquirectangular(a,u):t.fromCubemap(a,u),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),u.texture;if(u!==void 0)return u.texture;{let f=a.image;return l&&f&&f.height>0||h&&f&&s(f)?(t===null&&(t=new za(i)),u=l?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",r),u.texture):null}}}return a}function s(a){let c=0,l=6;for(let h=0;h<l;h++)a[h]!==void 0&&c++;return c===l}function r(a){let c=a.target;c.removeEventListener("dispose",r);let l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function y_(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let s;switch(n){case"WEBGL_depth_texture":s=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=i.getExtension(n)}return e[n]=s,s}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let s=t(n);return s===null&&cs("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function v_(i,e,t,n){let s={},r=new WeakMap;function o(u){let d=u.target;d.index!==null&&e.remove(d.index);for(let g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",o),delete s[d.id];let f=r.get(d);f&&(e.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(u,d){return s[d.id]===!0||(d.addEventListener("dispose",o),s[d.id]=!0,t.memory.geometries++),d}function c(u){let d=u.attributes;for(let f in d)e.update(d[f],i.ARRAY_BUFFER)}function l(u){let d=[],f=u.index,g=u.attributes.position,_=0;if(f!==null){let E=f.array;_=f.version;for(let S=0,x=E.length;S<x;S+=3){let R=E[S+0],w=E[S+1],P=E[S+2];d.push(R,w,w,P,P,R)}}else if(g!==void 0){let E=g.array;_=g.version;for(let S=0,x=E.length/3-1;S<x;S+=3){let R=S+0,w=S+1,P=S+2;d.push(R,w,w,P,P,R)}}else return;let m=new(ll(d)?er:Qs)(d,1);m.version=_;let p=r.get(u);p&&e.remove(p),r.set(u,m)}function h(u){let d=r.get(u);if(d){let f=u.index;f!==null&&d.version<f.version&&l(u)}else l(u);return r.get(u)}return{get:a,update:c,getWireframeAttribute:h}}function M_(i,e,t){let n;function s(d){n=d}let r,o;function a(d){r=d.type,o=d.bytesPerElement}function c(d,f){i.drawElements(n,f,r,d*o),t.update(f,n,1)}function l(d,f,g){g!==0&&(i.drawElementsInstanced(n,f,r,d*o,g),t.update(f,n,g))}function h(d,f,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,r,d,0,g);let m=0;for(let p=0;p<g;p++)m+=f[p];t.update(m,n,1)}function u(d,f,g,_){if(g===0)return;let m=e.get("WEBGL_multi_draw");if(m===null)for(let p=0;p<d.length;
vendor: 16,977 bytes, lines 3729-3760
3729p++)l(d[p]/o,f[p],_[p]);else{m.multiDrawElementsInstancedWEBGL(n,f,0,r,d,0,_,0,g);let p=0;for(let E=0;E<g;E++)p+=f[E]*_[E];t.update(p,n,1)}}this.setMode=s,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function S_(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(r/3);break;case i.LINES:t.lines+=a*(r/2);break;case i.LINE_STRIP:t.lines+=a*(r-1);break;case i.LINE_LOOP:t.lines+=a*r;break;case i.POINTS:t.points+=a*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function b_(i,e,t){let n=new WeakMap,s=new et;function r(o,a,c){let l=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,u=h!==void 0?h.length:0,d=n.get(a);if(d===void 0||d.count!==u){let y=function(){P.dispose(),n.delete(a),a.removeEventListener("dispose",y)};d!==void 0&&d.texture.dispose();let f=a.morphAttributes.position!==void 0,g=a.morphAttributes.normal!==void 0,_=a.morphAttributes.color!==void 0,m=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],E=a.morphAttributes.color||[],S=0;f===!0&&(S=1),g===!0&&(S=2),_===!0&&(S=3);let x=a.attributes.position.count*S,R=1;x>e.maxTextureSize&&(R=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);let w=new Float32Array(x*R*4*u),P=new Js(w,x,R,u);P.type=cn,P.needsUpdate=!0;let T=S*4;for(let v=0;v<u;v++){let C=m[v],D=p[v],U=E[v],B=x*R*4*v;for(let G=0;G<C.count;G++){let V=G*T;f===!0&&(s.fromBufferAttribute(C,G),w[B+V+0]=s.x,w[B+V+1]=s.y,w[B+V+2]=s.z,w[B+V+3]=0),g===!0&&(s.fromBufferAttribute(D,G),w[B+V+4]=s.x,w[B+V+5]=s.y,w[B+V+6]=s.z,w[B+V+7]=0),_===!0&&(s.fromBufferAttribute(U,G),w[B+V+8]=s.x,w[B+V+9]=s.y,w[B+V+10]=s.z,w[B+V+11]=U.itemSize===4?s.w:1)}}d={count:u,texture:P,size:new ie(x,R)},n.set(a,d),a.addEventListener("dispose",y)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let f=0;for(let _=0;_<l.length;_++)f+=l[_];let g=a.morphTargetsRelative?1:1-f;c.getUniforms().setValue(i,"morphTargetBaseInfluence",g),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:r}}function E_(i,e,t,n){let s=new WeakMap;function r(c){let l=n.render.frame,h=c.geometry,u=e.get(c,h);if(s.get(u)!==l&&(e.update(u),s.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),s.get(c)!==l&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,l))),c.isSkinnedMesh){let d=c.skeleton;s.get(d)!==l&&(d.update(),s.set(d,l))}return u}function o(){s=new WeakMap}function a(c){let l=c.target;l.removeEventListener("dispose",a),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:o}}var wd=new At,ld=new hr(1,1),Rd=new Js,Cd=new Eo,Id=new nr,hd=[],ud=[],dd=new Float32Array(16),fd=new Float32Array(9),pd=new Float32Array(4);function Is(i,e,t){let n=i[0];if(n<=0||n>0)return i;let s=e*t,r=hd[s];if(r===void 0&&(r=new Float32Array(s),hd[s]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(r,a)}return r}function St(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function bt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ha(i,e){let t=ud[e];t===void 0&&(t=new Int32Array(e),ud[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function T_(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function A_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;i.uniform2fv(this.addr,e),bt(t,e)}}function w_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(St(t,e))return;i.uniform3fv(this.addr,e),bt(t,e)}}function R_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;i.uniform4fv(this.addr,e),bt(t,e)}}function C_(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(St(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),bt(t,e)}else{if(St(t,n))return;pd.set(n),i.uniformMatrix2fv(this.addr,!1,pd),bt(t,n)}}function I_(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(St(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),bt(t,e)}else{if(St(t,n))return;fd.set(n),i.uniformMatrix3fv(this.addr,!1,fd),bt(t,n)}}function P_(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(St(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),bt(t,e)}else{if(St(t,n))return;dd.set(n),i.uniformMatrix4fv(this.addr,!1,dd),bt(t,n)}}function L_(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function D_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;i.uniform2iv(this.addr,e),bt(t,e)}}function N_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(St(t,e))return;i.uniform3iv(this.addr,e),bt(t,e)}}function U_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;i.uniform4iv(this.addr,e),bt(t,e)}}function O_(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function F_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;i.uniform2uiv(this.addr,e),bt(t,e)}}function B_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(St(t,e))return;i.uniform3uiv(this.addr,e),bt(t,e)}}function z_(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;i.uniform4uiv(this.addr,e),bt(t,e)}}function k_(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(ld.compareFunction=ol,r=ld):r=wd,t.setTexture2D(e||r,s)}function H_(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||Cd,s)}function V_(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||Id,s)}function G_(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||Rd,s)}function W_(i){switch(i){case 5126:return T_;case 35664:return A_;case 35665:return w_;case 35666:return R_;case 35674:return C_;case 35675:return I_;case 35676:return P_;case 5124:case 35670:return L_;case 35667:case 35671:return D_;case 35668:case 35672:return N_;case 35669:case 35673:return U_;case 5125:return O_;case 36294:return F_;case 36295:return B_;case 36296:return z_;case 35678:case 36198:case 36298:case 36306:case 35682:return k_;case 35679:case 36299:case 36307:return H_;case 35680:case 36300:case 36308:case 36293:return V_;case 36289:case 36303:case 36311:case 36292:return G_}}function X_(i,e){i.uniform1fv(this.addr,e)}function q_(i,e){let t=Is(e,this.size,2);i.uniform2fv(this.addr,t)}function Y_(i,e){let t=Is(e,this.size,3);i.uniform3fv(this.addr,t)}function Z_(i,e){let t=Is(e,this.size,4);i.uniform4fv(this.addr,t)}function K_(i,e){let t=Is(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function $_(i,e){let t=Is(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function J_(i,e){let t=Is(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function j_(i,e){i.uniform1iv(this.addr,e)}function Q_(i,e){i.uniform2iv(this.addr,e)}function e0(i,e){i.uniform3iv(this.addr,e)}function t0(i,e){i.uniform4iv(this.addr,e)}function n0(i,e){i.uniform1uiv(this.addr,e)}function i0(i,e){i.uniform2uiv(this.addr,e)}function s0(i,e){i.uniform3uiv(this.addr,e)}function r0(i,e){i.uniform4uiv(this.addr,e)}function o0(i,e,t){let n=this.cache,s=e.length,r=Ha(t,s);St(n,r)||(i.uniform1iv(this.addr,r),bt(n,r));for(let o=0;o!==s;++o)t.setTexture2D(e[o]||wd,r[o])}function a0(i,e,t){let n=this.cache,s=e.length,r=Ha(t,s);St(n,r)||(i.uniform1iv(this.addr,r),bt(n,r));for(let o=0;o!==s;++o)t.setTexture3D(e[o]||Cd,r[o])}function c0(i,e,t){let n=this.cache,s=e.length,r=Ha(t,s);St(n,r)||(i.uniform1iv(this.addr,r),bt(n,r));for(let o=0;o!==s;++o)t.setTextureCube(e[o]||Id,r[o])}function l0(i,e,t){let n=this.cache,s=e.length,r=Ha(t,s);St(n,r)||(i.uniform1iv(this.addr,r),bt(n,r));for(let o=0;o!==s;++o)t.setTexture2DArray(e[o]||Rd,r[o])}function h0(i){switch(i){case 5126:return X_;case 35664:return q_;case 35665:return Y_;case 35666:return Z_;case 35674:return K_;case 35675:return $_;case 35676:return J_;case 5124:case 35670:return j_;case 35667:case 35671:return Q_;case 35668:case 35672:return e0;case 35669:case 35673:return t0;case 5125:return n0;case 36294:return i0;case 36295:return s0;case 36296:return r0;case 35678:case 36198:case 36298:case 36306:case 35682:return o0;case 35679:case 36299:case 36307:return a0;case 35680:case 36300:case 36308:case 36293:return c0;case 36289:case 36303:case 36311:case 36292:return l0}}var Ml=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=W_(t.type)}},Sl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=h0(t.type)}},bl=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let s=this.seq;for(let r=0,o=s.length;r!==o;++r){let a=s[r];a.setValue(e,t[a.id],n)}}},vl=/(\w+)(\])?(\[|\.)?/g;function md(i,e){i.seq.push(e),i.map[e.id]=e}function u0(i,e,t){let n=i.name,s=n.length;for(vl.lastIndex=0;;){let r=vl.exec(n),o=vl.lastIndex,a=r[1],c=r[2]==="]",l=r[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===s){md(t,l===void 0?new Ml(a,i,e):new Sl(a,i,e));break}else{let u=t.map[a];u===void 0&&(u=new bl(a),md(t,u)),t=u}}}var Cs=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let r=e.getActiveUniform(t,s),o=e.getUniformLocation(t,r.name);u0(r,o,this)}}setValue(e,t,n,s){let r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){let s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,o=t.length;r!==o;++r){let a=t[r],c=n[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,s)}}static seqWithValue(e,t){let n=[];for(let s=0,r=e.length;s!==r;++s){let o=e[s];o.id in t&&n.push(o)}return n}};function gd(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var d0=37297,f0=0;function p0(i,e){let t=i.split(` 3730`),n=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=s;o<r;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` 3731`)}var _d=new Ge;function m0(i){je._getMatrix(_d,je.workingColorSpace,i);let e=`mat3( ${_d.elements.map(t=>t.toFixed(4))} )`;switch(je.getTransfer(i)){case Ks:return[e,"LinearTransferOETF"];case it:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function xd(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),r=(i.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` 3732 3733`+r+` 3734 3735`+p0(i.getShaderSource(e),a)}else return r}function g0(i,e){let t=m0(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3736`)}function _0(i,e){let t;switch(e){case Ru:t="Linear";break;case Cu:t="Reinhard";break;case Iu:t="Cineon";break;case Pu:t="ACESFilmic";break;case Du:t="AgX";break;case Nu:t="Neutral";break;case Lu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Ba=new L;function x0(){je.getLuminanceCoefficients(Ba);let i=Ba.x.toFixed(4),e=Ba.y.toFixed(4),t=Ba.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3737`)}function y0(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Br).join(` 3738`)}function v0(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3739`)}function M0(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(e,s),o=r.name,a=1;r.type===i.FLOAT_MAT2&&(a=2),r.type===i.FLOAT_MAT3&&(a=3),r.type===i.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Br(i){return i!==""}function yd(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function vd(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var S0=/^[ \t]*#include +<([\w\d./]+)>/gm;function El(i){return i.replace(S0,E0)}var b0=new Map;function E0(i,e){let t=Ye[e];if(t===void 0){let n=b0.get(e);if(n!==void 0)t=Ye[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return El(t)}var T0=/#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 Md(i){return i.replace(T0,A0)}function A0(i,e,t,n){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Sd(i){let e=`precision ${i.precision} float; 3740 precision ${i.precision} int; 3741 precision ${i.precision} sampler2D; 3742 precision ${i.precision} samplerCube; 3743 precision ${i.precision} sampler3D; 3744 precision ${i.precision} sampler2DArray; 3745 precision ${i.precision} sampler2DShadow; 3746 precision ${i.precision} samplerCubeShadow; 3747 precision ${i.precision} sampler2DArrayShadow; 3748 precision ${i.precision} isampler2D; 3749 precision ${i.precision} isampler3D; 3750 precision ${i.precision} isamplerCube; 3751 precision ${i.precision} isampler2DArray; 3752 precision ${i.precision} usampler2D; 3753 precision ${i.precision} usampler3D; 3754 precision ${i.precision} usamplerCube; 3755 precision ${i.precision} usampler2DArray; 3756 `;return i.precision==="highp"?e+=` 3757#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3758#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3759#define LOW_PRECISION`),e}function w0(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Xc?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===au?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===In&&(e="SHADOWMAP_TYPE_VSM"),e}function R0(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Ni:case Ui:e="ENVMAP_TYPE_CUBE";break;case Lr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function C0(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===Ui&&(e="ENVMAP_MODE_REFRACTION"),e}function I0(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Kc:e="ENVMAP_BLENDING_MULTIPLY";break;case Au:e="ENVMAP_BLENDING_MIX";break;case wu:e="ENVMAP_BLENDING_ADD";break}return e}function P0(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function L0(i,e,t,n){let s=i.getContext(),r=t.defines,o=t.vertexShader,a=t.fragmentShader,c=w0(t),l=R0(t),h=C0(t),u=I0(t),d=P0(t),f=y0(t),g=v0(r),_=s.createProgram(),m,p,E=t.glslVersion?"#version "+t.glslVersion+` 3760`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(
vendor: 5,506 bytes, lines 3760-3764
3760Br).join(` 3761`),m.length>0&&(m+=` 3762`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Br).join(` 3763`),p.length>0&&(p+=` 3764`)):(m=[Sd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
3765`].filter(Br).join(` 3766`),p=[Sd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.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":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Yn?"#define TONE_MAPPING":"",t.toneMapping!==Yn?Ye.tonemapping_pars_fragment:"",t.toneMapping!==Yn?_0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ye.colorspace_pars_fragment,g0("linearToOutputTexel",t.outputColorSpace),x0(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3767`].filter(Br).join(` 3768`)),o=El(o),o=yd(o,t),o=vd(o,t),a=El(a),a=yd(a,t),a=vd(a,t),o=Md(o),a=Md(a),t.isRawShaderMaterial!==!0&&(E=`#version 300 es 3769`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3770`)+` 3771`+m,p=["#define varying in",t.glslVersion===al?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===al?"":"#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(` 3772`)+` 3773`+p);let S=E+m+o,x=E+p+a,R=gd(s,s.VERTEX_SHADER,S),w=gd(s,s.FRAGMENT_SHADER,x);s.attachShader(_,R),s.attachShader(_,w),t.index0AttributeName!==void 0?s.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);
vendor: 21,162 bytes, lines 3773-3786
3773function P(C){if(i.debug.checkShaderErrors){let D=s.getProgramInfoLog(_)||"",U=s.getShaderInfoLog(R)||"",B=s.getShaderInfoLog(w)||"",G=D.trim(),V=U.trim(),J=B.trim(),H=!0,ce=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(H=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,R,w);else{let fe=xd(s,R,"vertex"),ye=xd(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` 3774 3775Material Name: `+C.name+` 3776Material Type: `+C.type+` 3777 3778Program Info Log: `+G+` 3779`+fe+` 3780`+ye)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(V===""||J==="")&&(ce=!1);ce&&(C.diagnostics={runnable:H,programLog:G,vertexShader:{log:V,prefix:m},fragmentShader:{log:J,prefix:p}})}s.deleteShader(R),s.deleteShader(w),T=new Cs(s,_),y=M0(s,_)}let T;this.getUniforms=function(){return T===void 0&&P(this),T};let y;this.getAttributes=function(){return y===void 0&&P(this),y};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=s.getProgramParameter(_,d0)),v},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=f0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=R,this.fragmentShader=w,this}var D0=0,Tl=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Al(e),t.set(e,n)),n}},Al=class{constructor(e){this.id=D0++,this.code=e,this.usedTimes=0}};function N0(i,e,t,n,s,r,o){let a=new js,c=new Tl,l=new Set,h=[],u=s.logarithmicDepthBuffer,d=s.vertexTextures,f=s.precision,g={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 _(y){return l.add(y),y===0?"uv":`uv${y}`}function m(y,v,C,D,U){let B=D.fog,G=U.geometry,V=y.isMeshStandardMaterial?D.environment:null,J=(y.isMeshStandardMaterial?t:e).get(y.envMap||V),H=J&&J.mapping===Lr?J.image.height:null,ce=g[y.type];y.precision!==null&&(f=s.getMaxPrecision(y.precision),f!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",f,"instead."));let fe=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,ye=fe!==void 0?fe.length:0,Ue=0;G.morphAttributes.position!==void 0&&(Ue=1),G.morphAttributes.normal!==void 0&&(Ue=2),G.morphAttributes.color!==void 0&&(Ue=3);let Be,Ze,qe,K;if(ce){let tt=Pn[ce];Be=tt.vertexShader,Ze=tt.fragmentShader}else Be=y.vertexShader,Ze=y.fragmentShader,c.update(y),qe=c.getVertexShaderID(y),K=c.getFragmentShaderID(y);let ee=i.getRenderTarget(),xe=i.state.buffers.depth.getReversed(),Re=U.isInstancedMesh===!0,Me=U.isBatchedMesh===!0,Ke=!!y.map,Ie=!!y.matcap,I=!!J,j=!!y.aoMap,$=!!y.lightMap,k=!!y.bumpMap,Z=!!y.normalMap,ne=!!y.displacementMap,se=!!y.emissiveMap,ue=!!y.metalnessMap,ke=!!y.roughnessMap,ze=y.anisotropy>0,A=y.clearcoat>0,M=y.dispersion>0,z=y.iridescence>0,q=y.sheen>0,te=y.transmission>0,Y=ze&&!!y.anisotropyMap,we=A&&!!y.clearcoatMap,he=A&&!!y.clearcoatNormalMap,Ee=A&&!!y.clearcoatRoughnessMap,Te=z&&!!y.iridescenceMap,re=z&&!!y.iridescenceThicknessMap,_e=q&&!!y.sheenColorMap,Oe=q&&!!y.sheenRoughnessMap,Ce=!!y.specularMap,me=!!y.specularColorMap,We=!!y.specularIntensityMap,N=te&&!!y.transmissionMap,le=te&&!!y.thicknessMap,de=!!y.gradientMap,Se=!!y.alphaMap,oe=y.alphaTest>0,Q=!!y.alphaHash,Ae=!!y.extensions,He=Yn;y.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(He=i.toneMapping);let ct={shaderID:ce,shaderType:y.type,shaderName:y.name,vertexShader:Be,fragmentShader:Ze,defines:y.defines,customVertexShaderID:qe,customFragmentShaderID:K,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:f,batching:Me,batchingColor:Me&&U._colorsTexture!==null,instancing:Re,instancingColor:Re&&U.instanceColor!==null,instancingMorph:Re&&U.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ee===null?i.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:Ct,alphaToCoverage:!!y.alphaToCoverage,map:Ke,matcap:Ie,envMap:I,envMapMode:I&&J.mapping,envMapCubeUVHeight:H,aoMap:j,lightMap:$,bumpMap:k,normalMap:Z,displacementMap:d&&ne,emissiveMap:se,normalMapObjectSpace:Z&&y.normalMapType===zu,normalMapTangentSpace:Z&&y.normalMapType===rl,metalnessMap:ue,roughnessMap:ke,anisotropy:ze,anisotropyMap:Y,clearcoat:A,clearcoatMap:we,clearcoatNormalMap:he,clearcoatRoughnessMap:Ee,dispersion:M,iridescence:z,iridescenceMap:Te,iridescenceThicknessMap:re,sheen:q,sheenColorMap:_e,sheenRoughnessMap:Oe,specularMap:Ce,specularColorMap:me,specularIntensityMap:We,transmission:te,transmissionMap:N,thicknessMap:le,gradientMap:de,opaque:y.transparent===!1&&y.blending===Mi&&y.alphaToCoverage===!1,alphaMap:Se,alphaTest:oe,alphaHash:Q,combine:y.combine,mapUv:Ke&&_(y.map.channel),aoMapUv:j&&_(y.aoMap.channel),lightMapUv:$&&_(y.lightMap.channel),bumpMapUv:k&&_(y.bumpMap.channel),normalMapUv:Z&&_(y.normalMap.channel),displacementMapUv:ne&&_(y.displacementMap.channel),emissiveMapUv:se&&_(y.emissiveMap.channel),metalnessMapUv:ue&&_(y.metalnessMap.channel),roughnessMapUv:ke&&_(y.roughnessMap.channel),anisotropyMapUv:Y&&_(y.anisotropyMap.channel),clearcoatMapUv:we&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:he&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Te&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:re&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:_e&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&_(y.sheenRoughnessMap.channel),specularMapUv:Ce&&_(y.specularMap.channel),specularColorMapUv:me&&_(y.specularColorMap.channel),specularIntensityMapUv:We&&_(y.specularIntensityMap.channel),transmissionMapUv:N&&_(y.transmissionMap.channel),thicknessMapUv:le&&_(y.thicknessMap.channel),alphaMapUv:Se&&_(y.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(Z||ze),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!G.attributes.uv&&(Ke||Se),fog:!!B,useFog:y.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:y.flatShading===!0&&y.wireframe===!1,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:xe,skinning:U.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:ye,morphTextureStride:Ue,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:He,decodeVideoTexture:Ke&&y.map.isVideoTexture===!0&&je.getTransfer(y.map.colorSpace)===it,decodeVideoTextureEmissive:se&&y.emissiveMap.isVideoTexture===!0&&je.getTransfer(y.emissiveMap.colorSpace)===it,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===qt,flipSided:y.side===zt,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:Ae&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ae&&y.extensions.multiDraw===!0||Me)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return ct.vertexUv1s=l.has(1),ct.vertexUv2s=l.has(2),ct.vertexUv3s=l.has(3),l.clear(),ct}function p(y){let v=[];if(y.shaderID?v.push(y.shaderID):(v.push(y.customVertexShaderID),v.push(y.customFragmentShaderID)),y.defines!==void 0)for(let C in y.defines)v.push(C),v.push(y.defines[C]);return y.isRawShaderMaterial===!1&&(E(v,y),S(v,y),v.push(i.outputColorSpace)),v.push(y.customProgramCacheKey),v.join()}function E(y,v){y.push(v.precision),y.push(v.outputColorSpace),y.push(v.envMapMode),y.push(v.envMapCubeUVHeight),y.push(v.mapUv),y.push(v.alphaMapUv),y.push(v.lightMapUv),y.push(v.aoMapUv),y.push(v.bumpMapUv),y.push(v.normalMapUv),y.push(v.displacementMapUv),y.push(v.emissiveMapUv),y.push(v.metalnessMapUv),y.push(v.roughnessMapUv),y.push(v.anisotropyMapUv),y.push(v.clearcoatMapUv),y.push(v.clearcoatNormalMapUv),y.push(v.clearcoatRoughnessMapUv),y.push(v.iridescenceMapUv),y.push(v.iridescenceThicknessMapUv),y.push(v.sheenColorMapUv),y.push(v.sheenRoughnessMapUv),y.push(v.specularMapUv),y.push(v.specularColorMapUv),y.push(v.specularIntensityMapUv),y.push(v.transmissionMapUv),y.push(v.thicknessMapUv),y.push(v.combine),y.push(v.fogExp2),y.push(v.sizeAttenuation),y.push(v.morphTargetsCount),y.push(v.morphAttributeCount),y.push(v.numDirLights),y.push(v.numPointLights),y.push(v.numSpotLights),y.push(v.numSpotLightMaps),y.push(v.numHemiLights),y.push(v.numRectAreaLights),y.push(v.numDirLightShadows),y.push(v.numPointLightShadows),y.push(v.numSpotLightShadows),y.push(v.numSpotLightShadowsWithMaps),y.push(v.numLightProbes),y.push(v.shadowMapType),y.push(v.toneMapping),y.push(v.numClippingPlanes),y.push(v.numClipIntersection),y.push(v.depthPacking)}function S(y,v){a.disableAll(),v.supportsVertexTextures&&a.enable(0),v.instancing&&a.enable(1),v.instancingColor&&a.enable(2),v.instancingMorph&&a.enable(3),v.matcap&&a.enable(4),v.envMap&&a.enable(5),v.normalMapObjectSpace&&a.enable(6),v.normalMapTangentSpace&&a.enable(7),v.clearcoat&&a.enable(8),v.iridescence&&a.enable(9),v.alphaTest&&a.enable(10),v.vertexColors&&a.enable(11),v.vertexAlphas&&a.enable(12),v.vertexUv1s&&a.enable(13),v.vertexUv2s&&a.enable(14),v.vertexUv3s&&a.enable(15),v.vertexTangents&&a.enable(16),v.anisotropy&&a.enable(17),v.alphaHash&&a.enable(18),v.batching&&a.enable(19),v.dispersion&&a.enable(20),v.batchingColor&&a.enable(21),v.gradientMap&&a.enable(22),y.push(a.mask),a.disableAll(),v.fog&&a.enable(0),v.useFog&&a.enable(1),v.flatShading&&a.enable(2),v.logarithmicDepthBuffer&&a.enable(3),v.reversedDepthBuffer&&a.enable(4),v.skinning&&a.enable(5),v.morphTargets&&a.enable(6),v.morphNormals&&a.enable(7),v.morphColors&&a.enable(8),v.premultipliedAlpha&&a.enable(9),v.shadowMapEnabled&&a.enable(10),v.doubleSided&&a.enable(11),v.flipSided&&a.enable(12),v.useDepthPacking&&a.enable(13),v.dithering&&a.enable(14),v.transmission&&a.enable(15),v.sheen&&a.enable(16),v.opaque&&a.enable(17),v.pointsUvs&&a.enable(18),v.decodeVideoTexture&&a.enable(19),v.decodeVideoTextureEmissive&&a.enable(20),v.alphaToCoverage&&a.enable(21),y.push(a.mask)}function x(y){let v=g[y.type],C;if(v){let D=Pn[v];C=$u.clone(D.uniforms)}else C=y.uniforms;return C}function R(y,v){let C;for(let D=0,U=h.length;D<U;D++){let B=h[D];if(B.cacheKey===v){C=B,++C.usedTimes;break}}return C===void 0&&(C=new L0(i,v,y,r),h.push(C)),C}function w(y){if(--y.usedTimes===0){let v=h.indexOf(y);h[v]=h[h.length-1],h.pop(),y.destroy()}}function P(y){c.remove(y)}function T(){c.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:x,acquireProgram:R,releaseProgram:w,releaseShaderCache:P,programs:h,dispose:T}}function U0(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function s(o,a,c){i.get(o)[a]=c}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function O0(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function bd(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Ed(){let i=[],e=0,t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function o(u,d,f,g,_,m){let p=i[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:g,renderOrder:u.renderOrder,z:_,group:m},i[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=g,p.renderOrder=u.renderOrder,p.z=_,p.group=m),e++,p}function a(u,d,f,g,_,m){let p=o(u,d,f,g,_,m);f.transmission>0?n.push(p):f.transparent===!0?s.push(p):t.push(p)}function c(u,d,f,g,_,m){let p=o(u,d,f,g,_,m);f.transmission>0?n.unshift(p):f.transparent===!0?s.unshift(p):t.unshift(p)}function l(u,d){t.length>1&&t.sort(u||O0),n.length>1&&n.sort(d||bd),s.length>1&&s.sort(d||bd)}function h(){for(let u=e,d=i.length;u<d;u++){let f=i[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:s,init:r,push:a,unshift:c,finish:h,sort:l}}function F0(){let i=new WeakMap;function e(n,s){let r=i.get(n),o;return r===void 0?(o=new Ed,i.set(n,[o])):s>=r.length?(o=new Ed,r.push(o)):o=r[s],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function B0(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new L,color:new Le};break;case"SpotLight":t={position:new L,direction:new L,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Le,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":t={color:new Le,position:new L,halfWidth:new L,halfHeight:new L};break}return i[e.id]=t,t}}}function z0(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ie};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ie};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ie,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var k0=0;function H0(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function V0(i){let e=new B0,t=z0(),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 l=0;l<9;l++)n.probe.push(new L);let s=new L,r=new Ve,o=new Ve;function a(l){let h=0,u=0,d=0;for(let y=0;y<9;y++)n.probe[y].set(0,0,0);let f=0,g=0,_=0,m=0,p=0,E=0,S=0,x=0,R=0,w=0,P=0;l.sort(H0);for(let y=0,v=l.length;y<v;y++){let C=l[y],D=C.color,U=C.intensity,B=C.distance,G=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=D.r*U,u+=D.g*U,d+=D.b*U;else if(C.isLightProbe){for(let V=0;V<9;V++)n.probe[V].addScaledVector(C.sh.coefficients[V],U);P++}else if(C.isDirectionalLight){let V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let J=C.shadow,H=t.get(C);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,n.directionalShadow[f]=H,n.directionalShadowMap[f]=G,n.directionalShadowMatrix[f]=C.shadow.matrix,E++}n.directional[f]=V,f++}else if(C.isSpotLight){let V=e.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(D).multiplyScalar(U),V.distance=B,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,n.spot[_]=V;let J=C.shadow;if(C.map&&(n.spotLightMap[R]=C.map,R++,J.updateMatrices(C),C.castShadow&&w++),n.spotLightMatrix[_]=J.matrix,C.castShadow){let H=t.get(C);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,n.spotShadow[_]=H,n.spotShadowMap[_]=G,x++}_++}else if(C.isRectAreaLight){let V=e.get(C);V.color.copy(D).multiplyScalar(U),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),n.rectArea[m]=V,m++}else if(C.isPointLight){let V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let J=C.shadow,H=t.get(C);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,H.shadowCameraNear=J.camera.near,H.shadowCameraFar=J.camera.far,n.pointShadow[g]=H,n.pointShadowMap[g]=G,n.pointShadowMatrix[g]=C.shadow.matrix,S++}n.point[g]=V,g++}else if(C.isHemisphereLight){let V=e.get(C);V.skyColor.copy(C.color).multiplyScalar(U),V.groundColor.copy(C.groundColor).multiplyScalar(U),n.hemi[p]=V,p++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pe.LTC_FLOAT_1,n.rectAreaLTC2=pe.LTC_FLOAT_2):(n.rectAreaLTC1=pe.LTC_HALF_1,n.rectAreaLTC2=pe.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;let T=n.hash;(T.directionalLength!==f||T.pointLength!==g||T.spotLength!==_||T.rectAreaLength!==m||T.hemiLength!==p||T.numDirectionalShadows!==E||T.numPointShadows!==S||T.numSpotShadows!==x||T.numSpotMaps!==R||T.numLightProbes!==P)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=x+R-w,n.spotLightMap.length=R,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=P,T.directionalLength=f,T.pointLength=g,T.spotLength=_,T.rectAreaLength=m,T.hemiLength=p,T.numDirectionalShadows=E,T.numPointShadows=S,T.numSpotShadows=x,T.numSpotMaps=R,T.numLightProbes=P,n.version=k0++)}function c(l,h){let u=0,d=0,f=0,g=0,_=0,m=h.matrixWorldInverse;for(let p=0,E=l.length;p<E;p++){let S=l[p];if(S.isDirectionalLight){let x=n.directional[u];x.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),x.direction.sub(s),x.direction.transformDirection(m),u++}else if(S.isSpotLight){let x=n.spot[f];x.position.setFromMatrixPosition(S.matrixWorld),x.position.applyMatrix4(m),x.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),x.direction.sub(s),x.direction.transformDirection(m),f++}else if(S.isRectAreaLight){let x=n.rectArea[g];x.position.setFromMatrixPosition(S.matrixWorld),x.position.applyMatrix4(m),o.identity(),r.copy(S.matrixWorld),r.premultiply(m),o.extractRotation(r),x.halfWidth.set(S.width*.5,0,0),x.halfHeight.set(0,S.height*.5,0),x.halfWidth.applyMatrix4(o),x.halfHeight.applyMatrix4(o),g++}else if(S.isPointLight){let x=n.point[d];x.position.setFromMatrixPosition(S.matrixWorld),x.position.applyMatrix4(m),d++}else if(S.isHemisphereLight){let x=n.hemi[_];x.direction.setFromMatrixPosition(S.matrixWorld),x.direction.transformDirection(m),_++}}}return{setup:a,setupView:c,state:n}}function Td(i){let e=new V0(i),t=[],n=[];function s(h){l.camera=h,t.length=0,n.length=0}function r(h){t.push(h)}function o(h){n.push(h)}function a(){e.setup(t)}function c(h){e.setupView(t,h)}let l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:l,setupLights:a,setupLightsView:c,pushLight:r,pushShadow:o}}function G0(i){let e=new WeakMap;function t(s,r=0){let o=e.get(s),a;return o===void 0?(a=new Td(i),e.set(s,[a])):r>=o.length?(a=new Td(i),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var W0=`void main() { 3781 gl_Position = vec4( position, 1.0 ); 3782}`,X0=`uniform sampler2D shadow_pass; 3783uniform vec2 resolution; 3784uniform float radius; 3785#include <packing> 3786void main() {
3787 const float samples = float( VSM_SAMPLES ); 3788 float mean = 0.0; 3789 float squared_mean = 0.0; 3790 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3791 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3792 for ( float i = 0.0; i < samples; i ++ ) { 3793 float uvOffset = uvStart + i * uvStride; 3794 #ifdef HORIZONTAL_PASS 3795 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3796 mean += distribution.x; 3797 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3798 #else 3799 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3800 mean += depth; 3801 squared_mean += depth * depth; 3802 #endif 3803 } 3804 mean = mean / samples; 3805 squared_mean = squared_mean / samples; 3806 float std_dev = sqrt( squared_mean - mean * mean ); 3807 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3808}`;function q0(i,e,t){let n=new ps,s=new ie,r=new ie,o=new et,a=new Oo({depthPacking:Bu}),c=new Fo,l={},h=t.maxTextureSize,u={[mn]:zt,[zt]:mn,[qt]:qt},d=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ie},radius:{value:4}},vertexShader:W0,fragmentShader:X0}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let g=new Mt;g.setAttribute("position",new ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new ht(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Xc;let p=this.type;this.render=function(w,P,T){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;let y=i.getRenderTarget(),v=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),D=i.state;D.setBlending(qn),D.buffers.depth.getReversed()===!0?D.buffers.color.setClear(0,0,0,0):D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);let U=p!==In&&this.type===In,B=p===In&&this.type!==In;for(let G=0,V=w.length;G<V;G++){let J=w[G],H=J.shadow;if(H===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;s.copy(H.mapSize);let ce=H.getFrameExtents();if(s.multiply(ce),r.copy(H.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/ce.x),s.x=r.x*ce.x,H.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/ce.y),s.y=r.y*ce.y,H.mapSize.y=r.y)),H.map===null||U===!0||B===!0){let ye=this.type!==In?{minFilter:Rt,magFilter:Rt}:{};H.map!==null&&H.map.dispose(),H.map=new Tn(s.x,s.y,ye),H.map.texture.name=J.name+".shadowMap",H.camera.updateProjectionMatrix()}i.setRenderTarget(H.map),i.clear();let fe=H.getViewportCount();for(let ye=0;ye<fe;ye++){let Ue=H.getViewport(ye);o.set(r.x*Ue.x,r.y*Ue.y,r.x*Ue.z,r.y*Ue.w),D.viewport(o),H.updateMatrices(J,ye),n=H.getFrustum(),x(P,T,H.camera,J,this.type)}H.isPointLightShadow!==!0&&this.type===In&&E(H,T),H.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(y,v,C)};function E(w,P){let T=e.update(_);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,f.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new Tn(s.x,s.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(P,null,T,d,_,null),f.uniforms.shadow_pass.value=w.mapPass.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(P,null,T,f,_,null)}function S(w,P,T,y){let v=null,C=T.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(C!==void 0)v=C;else if(v=T.isPointLight===!0?c:a,i.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){let D=v.uuid,U=P.uuid,B=l[D];B===void 0&&(B={},l[D]=B);let G=B[U];G===void 0&&(G=v.clone(),B[U]=G,P.addEventListener("dispose",R)),v=G}if(v.visible=P.visible,v.wireframe=P.wireframe,y===In?v.side=P.shadowSide!==null?P.shadowSide:P.side:v.side=P.shadowSide!==null?P.shadowSide:u[P.side],v.alphaMap=P.alphaMap,v.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,v.map=P.map,v.clipShadows=P.clipShadows,v.clippingPlanes=P.clippingPlanes,v.clipIntersection=P.clipIntersection,v.displacementMap=P.displacementMap,v.displacementScale=P.displacementScale,v.displacementBias=P.displacementBias,v.wireframeLinewidth=P.wireframeLinewidth,v.linewidth=P.linewidth,T.isPointLight===!0&&v.isMeshDistanceMaterial===!0){let D=i.properties.get(v);D.light=T}return v}function x(w,P,T,y,v){if(w.visible===!1)return;if(w.layers.test(P.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&v===In)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld);let U=e.update(w),B=w.material;if(Array.isArray(B)){let G=U.groups;for(let V=0,J=G.length;V<J;V++){let H=G[V],ce=B[H.materialIndex];
vendor: 6,098 bytes, line 3808
3808if(ce&&ce.visible){let fe=S(w,ce,y,v);w.onBeforeShadow(i,w,P,T,U,fe,H),i.renderBufferDirect(T,null,U,fe,w,H),w.onAfterShadow(i,w,P,T,U,fe,H)}}}else if(B.visible){let G=S(w,B,y,v);w.onBeforeShadow(i,w,P,T,U,G,null),i.renderBufferDirect(T,null,U,G,w,null),w.onAfterShadow(i,w,P,T,U,G,null)}}let D=w.children;for(let U=0,B=D.length;U<B;U++)x(D[U],P,T,y,v)}function R(w){w.target.removeEventListener("dispose",R);for(let T in l){let y=l[T],v=w.target.uuid;v in y&&(y[v].dispose(),delete y[v])}}}var Y0={[Xo]:qo,[Yo]:$o,[Zo]:Jo,[Si]:Ko,[qo]:Xo,[$o]:Yo,[Jo]:Zo,[Ko]:Si};function Z0(i,e){function t(){let N=!1,le=new et,de=null,Se=new et(0,0,0,0);return{setMask:function(oe){de!==oe&&!N&&(i.colorMask(oe,oe,oe,oe),de=oe)},setLocked:function(oe){N=oe},setClear:function(oe,Q,Ae,He,ct){ct===!0&&(oe*=He,Q*=He,Ae*=He),le.set(oe,Q,Ae,He),Se.equals(le)===!1&&(i.clearColor(oe,Q,Ae,He),Se.copy(le))},reset:function(){N=!1,de=null,Se.set(-1,0,0,0)}}}function n(){let N=!1,le=!1,de=null,Se=null,oe=null;return{setReversed:function(Q){if(le!==Q){let Ae=e.get("EXT_clip_control");Q?Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.ZERO_TO_ONE_EXT):Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.NEGATIVE_ONE_TO_ONE_EXT),le=Q;let He=oe;oe=null,this.setClear(He)}},getReversed:function(){return le},setTest:function(Q){Q?ee(i.DEPTH_TEST):xe(i.DEPTH_TEST)},setMask:function(Q){de!==Q&&!N&&(i.depthMask(Q),de=Q)},setFunc:function(Q){if(le&&(Q=Y0[Q]),Se!==Q){switch(Q){case Xo:i.depthFunc(i.NEVER);break;case qo:i.depthFunc(i.ALWAYS);break;case Yo:i.depthFunc(i.LESS);break;case Si:i.depthFunc(i.LEQUAL);break;case Zo:i.depthFunc(i.EQUAL);break;case Ko:i.depthFunc(i.GEQUAL);break;case $o:i.depthFunc(i.GREATER);break;case Jo:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Se=Q}},setLocked:function(Q){N=Q},setClear:function(Q){oe!==Q&&(le&&(Q=1-Q),i.clearDepth(Q),oe=Q)},reset:function(){N=!1,de=null,Se=null,oe=null,le=!1}}}function s(){let N=!1,le=null,de=null,Se=null,oe=null,Q=null,Ae=null,He=null,ct=null;return{setTest:function(tt){N||(tt?ee(i.STENCIL_TEST):xe(i.STENCIL_TEST))},setMask:function(tt){le!==tt&&!N&&(i.stencilMask(tt),le=tt)},setFunc:function(tt,Dn,Mn){(de!==tt||Se!==Dn||oe!==Mn)&&(i.stencilFunc(tt,Dn,Mn),de=tt,Se=Dn,oe=Mn)},setOp:function(tt,Dn,Mn){(Q!==tt||Ae!==Dn||He!==Mn)&&(i.stencilOp(tt,Dn,Mn),Q=tt,Ae=Dn,He=Mn)},setLocked:function(tt){N=tt},setClear:function(tt){ct!==tt&&(i.clearStencil(tt),ct=tt)},reset:function(){N=!1,le=null,de=null,Se=null,oe=null,Q=null,Ae=null,He=null,ct=null}}}let r=new t,o=new n,a=new s,c=new WeakMap,l=new WeakMap,h={},u={},d=new WeakMap,f=[],g=null,_=!1,m=null,p=null,E=null,S=null,x=null,R=null,w=null,P=new Le(0,0,0),T=0,y=!1,v=null,C=null,D=null,U=null,B=null,G=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),V=!1,J=0,H=i.getParameter(i.VERSION);H.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(H)[1]),V=J>=1):H.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),V=J>=2);let ce=null,fe={},ye=i.getParameter(i.SCISSOR_BOX),Ue=i.getParameter(i.VIEWPORT),Be=new et().fromArray(ye),Ze=new et().fromArray(Ue);function qe(N,le,de,Se){let oe=new Uint8Array(4),Q=i.createTexture();i.bindTexture(N,Q),i.texParameteri(N,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(N,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ae=0;Ae<de;Ae++)N===i.TEXTURE_3D||N===i.TEXTURE_2D_ARRAY?i.texImage3D(le,0,i.RGBA,1,1,Se,0,i.RGBA,i.UNSIGNED_BYTE,oe):i.texImage2D(le+Ae,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,oe);return Q}let K={};K[i.TEXTURE_2D]=qe(i.TEXTURE_2D,i.TEXTURE_2D,1),K[i.TEXTURE_CUBE_MAP]=qe(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),K[i.TEXTURE_2D_ARRAY]=qe(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),K[i.TEXTURE_3D]=qe(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ee(i.DEPTH_TEST),o.setFunc(Si),k(!1),Z(Wc),ee(i.CULL_FACE),j(qn);function ee(N){h[N]!==!0&&(i.enable(N),h[N]=!0)}function xe(N){h[N]!==!1&&(i.disable(N),h[N]=!1)}function Re(N,le){return u[N]!==le?(i.bindFramebuffer(N,le),u[N]=le,N===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=le),N===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=le),!0):!1}function Me(N,le){let de=f,Se=!1;if(N){de=d.get(le),de===void 0&&(de=[],d.set(le,de));let oe=N.textures;if(de.length!==oe.length||de[0]!==i.COLOR_ATTACHMENT0){for(let Q=0,Ae=oe.length;Q<Ae;Q++)de[Q]=i.COLOR_ATTACHMENT0+Q;de.length=oe.length,Se=!0}}else de[0]!==i.BACK&&(de[0]=i.BACK,Se=!0);Se&&i.drawBuffers(de)}function Ke(N){return g!==N?(i.useProgram(N),g=N,!0):!1}let Ie={[si]:i.FUNC_ADD,[lu]:i.FUNC_SUBTRACT,[hu]:i.FUNC_REVERSE_SUBTRACT};Ie[uu]=i.MIN,Ie[du]=i.MAX;let I={[fu]:i.ZERO,[pu]:i.ONE,[mu]:i.SRC_COLOR,[yo]:i.SRC_ALPHA,[Mu]:i.SRC_ALPHA_SATURATE,[yu]:i.DST_COLOR,[_u]:i.DST_ALPHA,[gu]:i.ONE_MINUS_SRC_COLOR,[vo]:i.ONE_MINUS_SRC_ALPHA,[vu]:i.ONE_MINUS_DST_COLOR,[xu]:i.ONE_MINUS_DST_ALPHA,[Su]:i.CONSTANT_COLOR,[bu]:i.ONE_MINUS_CONSTANT_COLOR,[Eu]:i.CONSTANT_ALPHA,[Tu]:i.ONE_MINUS_CONSTANT_ALPHA};function j(N,le,de,Se,oe,Q,Ae,He,ct,tt){if(N===qn){_===!0&&(xe(i.BLEND),_=!1);return}if(_===!1&&(ee(i.BLEND),_=!0),N!==cu){if(N!==m||tt!==y){if((p!==si||x!==si)&&(i.blendEquation(i.FUNC_ADD),p=si,x=si),tt)switch(N){case Mi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qc:i.blendFunc(i.ONE,i.ONE);break;case Yc:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Zc:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",N);break}else switch(N){case Mi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qc:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Yc:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Zc:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",N);break}E=null,S=null,R=null,w=null,P.set(0,0,0),T=0,m=N,y=tt}return}oe=oe||le,Q=Q||de,Ae=Ae||Se,(le!==p||oe!==x)&&(i.blendEquationSeparate(Ie[le],Ie[oe]),p=le,x=oe),
vendor: 9,203 bytes, line 3808
3808(de!==E||Se!==S||Q!==R||Ae!==w)&&(i.blendFuncSeparate(I[de],I[Se],I[Q],I[Ae]),E=de,S=Se,R=Q,w=Ae),(He.equals(P)===!1||ct!==T)&&(i.blendColor(He.r,He.g,He.b,ct),P.copy(He),T=ct),m=N,y=!1}function $(N,le){N.side===qt?xe(i.CULL_FACE):ee(i.CULL_FACE);let de=N.side===zt;le&&(de=!de),k(de),N.blending===Mi&&N.transparent===!1?j(qn):j(N.blending,N.blendEquation,N.blendSrc,N.blendDst,N.blendEquationAlpha,N.blendSrcAlpha,N.blendDstAlpha,N.blendColor,N.blendAlpha,N.premultipliedAlpha),o.setFunc(N.depthFunc),o.setTest(N.depthTest),o.setMask(N.depthWrite),r.setMask(N.colorWrite);let Se=N.stencilWrite;a.setTest(Se),Se&&(a.setMask(N.stencilWriteMask),a.setFunc(N.stencilFunc,N.stencilRef,N.stencilFuncMask),a.setOp(N.stencilFail,N.stencilZFail,N.stencilZPass)),se(N.polygonOffset,N.polygonOffsetFactor,N.polygonOffsetUnits),N.alphaToCoverage===!0?ee(i.SAMPLE_ALPHA_TO_COVERAGE):xe(i.SAMPLE_ALPHA_TO_COVERAGE)}function k(N){v!==N&&(N?i.frontFace(i.CW):i.frontFace(i.CCW),v=N)}function Z(N){N!==ru?(ee(i.CULL_FACE),N!==C&&(N===Wc?i.cullFace(i.BACK):N===ou?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):xe(i.CULL_FACE),C=N}function ne(N){N!==D&&(V&&i.lineWidth(N),D=N)}function se(N,le,de){N?(ee(i.POLYGON_OFFSET_FILL),(U!==le||B!==de)&&(i.polygonOffset(le,de),U=le,B=de)):xe(i.POLYGON_OFFSET_FILL)}function ue(N){N?ee(i.SCISSOR_TEST):xe(i.SCISSOR_TEST)}function ke(N){N===void 0&&(N=i.TEXTURE0+G-1),ce!==N&&(i.activeTexture(N),ce=N)}function ze(N,le,de){de===void 0&&(ce===null?de=i.TEXTURE0+G-1:de=ce);let Se=fe[de];Se===void 0&&(Se={type:void 0,texture:void 0},fe[de]=Se),(Se.type!==N||Se.texture!==le)&&(ce!==de&&(i.activeTexture(de),ce=de),i.bindTexture(N,le||K[N]),Se.type=N,Se.texture=le)}function A(){let N=fe[ce];N!==void 0&&N.type!==void 0&&(i.bindTexture(N.type,null),N.type=void 0,N.texture=void 0)}function M(){try{i.compressedTexImage2D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function z(){try{i.compressedTexImage3D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function q(){try{i.texSubImage2D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function te(){try{i.texSubImage3D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function Y(){try{i.compressedTexSubImage2D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function we(){try{i.compressedTexSubImage3D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function he(){try{i.texStorage2D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function Ee(){try{i.texStorage3D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function Te(){try{i.texImage2D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function re(){try{i.texImage3D(...arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function _e(N){Be.equals(N)===!1&&(i.scissor(N.x,N.y,N.z,N.w),Be.copy(N))}function Oe(N){Ze.equals(N)===!1&&(i.viewport(N.x,N.y,N.z,N.w),Ze.copy(N))}function Ce(N,le){let de=l.get(le);de===void 0&&(de=new WeakMap,l.set(le,de));let Se=de.get(N);Se===void 0&&(Se=i.getUniformBlockIndex(le,N.name),de.set(N,Se))}function me(N,le){let Se=l.get(le).get(N);c.get(le)!==Se&&(i.uniformBlockBinding(le,Se,N.__bindingPointIndex),c.set(le,Se))}function We(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},ce=null,fe={},u={},d=new WeakMap,f=[],g=null,_=!1,m=null,p=null,E=null,S=null,x=null,R=null,w=null,P=new Le(0,0,0),T=0,y=!1,v=null,C=null,D=null,U=null,B=null,Be.set(0,0,i.canvas.width,i.canvas.height),Ze.set(0,0,i.canvas.width,i.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:ee,disable:xe,bindFramebuffer:Re,drawBuffers:Me,useProgram:Ke,setBlending:j,setMaterial:$,setFlipSided:k,setCullFace:Z,setLineWidth:ne,setPolygonOffset:se,setScissorTest:ue,activeTexture:ke,bindTexture:ze,unbindTexture:A,compressedTexImage2D:M,compressedTexImage3D:z,texImage2D:Te,texImage3D:re,updateUBOMapping:Ce,uniformBlockBinding:me,texStorage2D:he,texStorage3D:Ee,texSubImage2D:q,texSubImage3D:te,compressedTexSubImage2D:Y,compressedTexSubImage3D:we,scissor:_e,viewport:Oe,reset:We}}function K0(i,e,t,n,s,r,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new ie,h=new WeakMap,u,d=new WeakMap,f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(A,M){return f?new OffscreenCanvas(A,M):as("canvas")}function _(A,M,z){let q=1,te=ze(A);if((te.width>z||te.height>z)&&(q=z/Math.max(te.width,te.height)),q<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){let Y=Math.floor(q*te.width),we=Math.floor(q*te.height);u===void 0&&(u=g(Y,we));let he=M?g(Y,we):u;return he.width=Y,he.height=we,he.getContext("2d").drawImage(A,0,0,Y,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+Y+"x"+we+")."),he}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),A;return A}function m(A){return A.generateMipmaps}function p(A){i.generateMipmap(A)}function E(A){return A.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?i.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function S(A,M,z,q,te=!1){if(A!==null){if(i[A]!==void 0)return i[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let Y=M;if(M===i.RED&&(z===i.FLOAT&&(Y=i.R32F),z===i.HALF_FLOAT&&(Y=i.R16F),z===i.UNSIGNED_BYTE&&(Y=i.R8)),M===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&(Y=i.R8UI),z===i.UNSIGNED_SHORT&&(Y=i.R16UI),z===i.UNSIGNED_INT&&(Y=i.R32UI),z===i.BYTE&&(Y=i.R8I),z===i.SHORT&&(Y=i.R16I),z===i.INT&&(Y=i.R32I)),M===i.RG&&(z===i.FLOAT&&(Y=i.RG32F),z===i.HALF_FLOAT&&(Y=i.RG16F),z===i.UNSIGNED_BYTE&&(Y=i.RG8)),M===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&(Y=i.RG8UI),z===i.UNSIGNED_SHORT&&(Y=i.RG16UI),z===i.UNSIGNED_INT&&(Y=i.RG32UI),z===i.BYTE&&(Y=i.RG8I),z===i.SHORT&&(Y=i.RG16I),z===i.INT&&(Y=i.RG32I)),M===i.RGB_INTEGER&&(z===i.UNSIGNED_BYTE&&(Y=i.RGB8UI),z===i.UNSIGNED_SHORT&&(Y=i.RGB16UI),z===i.UNSIGNED_INT&&(Y=i.RGB32UI),z===i.BYTE&&(Y=i.RGB8I),z===i.SHORT&&(Y=i.RGB16I),z===i.INT&&(Y=i.RGB32I)),M===i.RGBA_INTEGER&&(z===i.UNSIGNED_BYTE&&(Y=i.RGBA8UI),z===i.UNSIGNED_SHORT&&(Y=i.RGBA16UI),z===i.UNSIGNED_INT&&(Y=i.RGBA32UI),z===i.BYTE&&(Y=i.RGBA8I),z===i.SHORT&&(Y=i.RGBA16I),z===i.INT&&(Y=i.RGBA32I)),M===i.RGB&&(z===i.UNSIGNED_INT_5_9_9_9_REV&&(Y=i.RGB9_E5),z===i.UNSIGNED_INT_10F_11F_11F_REV&&(Y=i.R11F_G11F_B10F)),M===i.RGBA){let we=te?Ks:je.getTransfer(q);z===i.FLOAT&&(Y=i.RGBA32F),z===i.HALF_FLOAT&&(Y=i.RGBA16F),z===i.UNSIGNED_BYTE&&(Y=we===it?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&(Y=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&(Y=i.RGB5_A1)}return(Y===i.R16F||Y===i.R32F||Y===i.RG16F||Y===i.RG32F||Y===i.RGBA16F||Y===i.RGBA32F)&&e.get("EXT_color_buffer_float"),Y}function x(A,M){let z;return A?M===null||M===ui||M===Es?z=i.DEPTH24_STENCIL8:M===cn?z=i.DEPTH32F_STENCIL8:M===Ss&&(z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===ui||M===Es?z=i.DEPTH_COMPONENT24:M===cn?z=i.DEPTH_COMPONENT32F:M===Ss&&(z=i.DEPTH_COMPONENT16),z}function R(A,M){return m(A)===!0||A.isFramebufferTexture&&A.minFilter!==Rt&&A.minFilter!==Ot?Math.log2(Math.max(M.width,M.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?M.mipmaps.length:1}function w(A){let M=A.target;M.removeEventListener("dispose",w),T(M),M.isVideoTexture&&h.delete(M)}function P(A){let M=A.target;M.removeEventListener("dispose",P),v(M)}function T(A){let M=n.get(A);if(M.__webglInit===void 0)return;let z=A.source,q=d.get(z);if(q){let te=q[M.__cacheKey];te.usedTimes--,te.usedTimes===0&&y(A),Object.keys(q).length===0&&d.delete(z)}n.remove(A)}function y(A){let M=n.get(A);i.deleteTexture(M.__webglTexture);let z=A.source,q=d.get(z);delete q[M.__cacheKey],o.memory.textures--}function v(A){let M=n.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),n.remove(A.depthTexture)),A.isWebGLCubeRen
vendor: 5,990 bytes, line 3808
3808derTarget)for(let q=0;q<6;q++){if(Array.isArray(M.__webglFramebuffer[q]))for(let te=0;te<M.__webglFramebuffer[q].length;te++)i.deleteFramebuffer(M.__webglFramebuffer[q][te]);else i.deleteFramebuffer(M.__webglFramebuffer[q]);M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer[q])}else{if(Array.isArray(M.__webglFramebuffer))for(let q=0;q<M.__webglFramebuffer.length;q++)i.deleteFramebuffer(M.__webglFramebuffer[q]);else i.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&i.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let q=0;q<M.__webglColorRenderbuffer.length;q++)M.__webglColorRenderbuffer[q]&&i.deleteRenderbuffer(M.__webglColorRenderbuffer[q]);M.__webglDepthRenderbuffer&&i.deleteRenderbuffer(M.__webglDepthRenderbuffer)}let z=A.textures;for(let q=0,te=z.length;q<te;q++){let Y=n.get(z[q]);Y.__webglTexture&&(i.deleteTexture(Y.__webglTexture),o.memory.textures--),n.remove(z[q])}n.remove(A)}let C=0;function D(){C=0}function U(){let A=C;return A>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+s.maxTextures),C+=1,A}function B(A){let M=[];return M.push(A.wrapS),M.push(A.wrapT),M.push(A.wrapR||0),M.push(A.magFilter),M.push(A.minFilter),M.push(A.anisotropy),M.push(A.internalFormat),M.push(A.format),M.push(A.type),M.push(A.generateMipmaps),M.push(A.premultiplyAlpha),M.push(A.flipY),M.push(A.unpackAlignment),M.push(A.colorSpace),M.join()}function G(A,M){let z=n.get(A);if(A.isVideoTexture&&ue(A),A.isRenderTargetTexture===!1&&A.isExternalTexture!==!0&&A.version>0&&z.__version!==A.version){let q=A.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{K(z,A,M);return}}else A.isExternalTexture&&(z.__webglTexture=A.sourceTexture?A.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+M)}function V(A,M){let z=n.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&z.__version!==A.version){K(z,A,M);return}t.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+M)}function J(A,M){let z=n.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&z.__version!==A.version){K(z,A,M);return}t.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+M)}function H(A,M){let z=n.get(A);if(A.version>0&&z.__version!==A.version){ee(z,A,M);return}t.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+M)}let ce={[ri]:i.REPEAT,[Sn]:i.CLAMP_TO_EDGE,[rs]:i.MIRRORED_REPEAT},fe={[Rt]:i.NEAREST,[ea]:i.NEAREST_MIPMAP_NEAREST,[Oi]:i.NEAREST_MIPMAP_LINEAR,[Ot]:i.LINEAR,[Ms]:i.LINEAR_MIPMAP_NEAREST,[xn]:i.LINEAR_MIPMAP_LINEAR},ye={[ku]:i.NEVER,[qu]:i.ALWAYS,[Hu]:i.LESS,[ol]:i.LEQUAL,[Vu]:i.EQUAL,[Xu]:i.GEQUAL,[Gu]:i.GREATER,[Wu]:i.NOTEQUAL};function Ue(A,M){if(M.type===cn&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===Ot||M.magFilter===Ms||M.magFilter===Oi||M.magFilter===xn||M.minFilter===Ot||M.minFilter===Ms||M.minFilter===Oi||M.minFilter===xn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(A,i.TEXTURE_WRAP_S,ce[M.wrapS]),i.texParameteri(A,i.TEXTURE_WRAP_T,ce[M.wrapT]),(A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY)&&i.texParameteri(A,i.TEXTURE_WRAP_R,ce[M.wrapR]),i.texParameteri(A,i.TEXTURE_MAG_FILTER,fe[M.magFilter]),i.texParameteri(A,i.TEXTURE_MIN_FILTER,fe[M.minFilter]),M.compareFunction&&(i.texParameteri(A,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(A,i.TEXTURE_COMPARE_FUNC,ye[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Rt||M.minFilter!==Oi&&M.minFilter!==xn||M.type===cn&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){let z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(A,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function Be(A,M){let z=!1;A.__webglInit===void 0&&(A.__webglInit=!0,M.addEventListener("dispose",w));let q=M.source,te=d.get(q);te===void 0&&(te={},d.set(q,te));let Y=B(M);if(Y!==A.__cacheKey){te[Y]===void 0&&(te[Y]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,z=!0),te[Y].usedTimes++;let we=te[A.__cacheKey];we!==void 0&&(te[A.__cacheKey].usedTimes--,we.usedTimes===0&&y(M)),A.__cacheKey=Y,A.__webglTexture=te[Y].texture}return z}function Ze(A,M,z){return Math.floor(Math.floor(A/z)/M)}function qe(A,M,z,q){let Y=A.updateRanges;if(Y.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,M.width,M.height,z,q,M.data);else{Y.sort((re,_e)=>re.start-_e.start);let we=0;for(let re=1;re<Y.length;re++){let _e=Y[we],Oe=Y[re],Ce=_e.start+_e.count,me=Ze(Oe.start,M.width,4),We=Ze(_e.start,M.width,4);Oe.start<=Ce+1&&me===We&&Ze(Oe.start+Oe.count-1,M.width,4)===me?_e.count=Math.max(_e.count,Oe.start+Oe.count-_e.start):(++we,Y[we]=Oe)}Y.length=we+1;let he=i.getParameter(i.UNPACK_ROW_LENGTH),Ee=i.getParameter(i.UNPACK_SKIP_PIXELS),Te=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,M.width);for(let re=0,_e=Y.length;re<_e;re++){let Oe=Y[re],Ce=Math.floor(Oe.start/4),me=Math.ceil(Oe.count/4),We=Ce%M.width,N=Math.floor(Ce/M.width),le=me,de=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,We),i.pixelStorei(i.UNPACK_SKIP_ROWS,N),t.texSubImage2D(i.TEXTURE_2D,0,We,N,le,de,z,q,M.data)}A.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,he),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Ee),i.pixelStorei(i.UNPACK_SKIP_ROWS,Te)}}function K(A,M,z){let q=i.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(q=i.TEXTURE_2D_ARRAY),M.isData3DTexture&&(q=i.TEXTURE_3D);let te=Be(A,M),Y=M.source;t.bindTexture(q,A.__webglTexture,i.TEXTURE0+z);let we=n.get(Y);if(Y.version!==we.__version||te===!0){t.activeTexture(i.TEXTURE0+z);
vendor: 13,131 bytes, line 3808
3808let he=je.getPrimaries(je.workingColorSpace),Ee=M.colorSpace===Zn?null:je.getPrimaries(M.colorSpace),Te=M.colorSpace===Zn||he===Ee?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Te);let re=_(M.image,!1,s.maxTextureSize);re=ke(M,re);let _e=r.convert(M.format,M.colorSpace),Oe=r.convert(M.type),Ce=S(M.internalFormat,_e,Oe,M.colorSpace,M.isVideoTexture);Ue(q,M);let me,We=M.mipmaps,N=M.isVideoTexture!==!0,le=we.__version===void 0||te===!0,de=Y.dataReady,Se=R(M,re);if(M.isDepthTexture)Ce=x(M.format===Ts,M.type),le&&(N?t.texStorage2D(i.TEXTURE_2D,1,Ce,re.width,re.height):t.texImage2D(i.TEXTURE_2D,0,Ce,re.width,re.height,0,_e,Oe,null));else if(M.isDataTexture)if(We.length>0){N&&le&&t.texStorage2D(i.TEXTURE_2D,Se,Ce,We[0].width,We[0].height);for(let oe=0,Q=We.length;oe<Q;oe++)me=We[oe],N?de&&t.texSubImage2D(i.TEXTURE_2D,oe,0,0,me.width,me.height,_e,Oe,me.data):t.texImage2D(i.TEXTURE_2D,oe,Ce,me.width,me.height,0,_e,Oe,me.data);M.generateMipmaps=!1}else N?(le&&t.texStorage2D(i.TEXTURE_2D,Se,Ce,re.width,re.height),de&&qe(M,re,_e,Oe)):t.texImage2D(i.TEXTURE_2D,0,Ce,re.width,re.height,0,_e,Oe,re.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){N&&le&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Se,Ce,We[0].width,We[0].height,re.depth);for(let oe=0,Q=We.length;oe<Q;oe++)if(me=We[oe],M.format!==en)if(_e!==null)if(N){if(de)if(M.layerUpdates.size>0){let Ae=pl(me.width,me.height,M.format,M.type);for(let He of M.layerUpdates){let ct=me.data.subarray(He*Ae/me.data.BYTES_PER_ELEMENT,(He+1)*Ae/me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,oe,0,0,He,me.width,me.height,1,_e,ct)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,oe,0,0,0,me.width,me.height,re.depth,_e,me.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,oe,Ce,me.width,me.height,re.depth,0,me.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else N?de&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,oe,0,0,0,me.width,me.height,re.depth,_e,Oe,me.data):t.texImage3D(i.TEXTURE_2D_ARRAY,oe,Ce,me.width,me.height,re.depth,0,_e,Oe,me.data)}else{N&&le&&t.texStorage2D(i.TEXTURE_2D,Se,Ce,We[0].width,We[0].height);for(let oe=0,Q=We.length;oe<Q;oe++)me=We[oe],M.format!==en?_e!==null?N?de&&t.compressedTexSubImage2D(i.TEXTURE_2D,oe,0,0,me.width,me.height,_e,me.data):t.compressedTexImage2D(i.TEXTURE_2D,oe,Ce,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):N?de&&t.texSubImage2D(i.TEXTURE_2D,oe,0,0,me.width,me.height,_e,Oe,me.data):t.texImage2D(i.TEXTURE_2D,oe,Ce,me.width,me.height,0,_e,Oe,me.data)}else if(M.isDataArrayTexture)if(N){if(le&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Se,Ce,re.width,re.height,re.depth),de)if(M.layerUpdates.size>0){let oe=pl(re.width,re.height,M.format,M.type);for(let Q of M.layerUpdates){let Ae=re.data.subarray(Q*oe/re.data.BYTES_PER_ELEMENT,(Q+1)*oe/re.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Q,re.width,re.height,1,_e,Oe,Ae)}M.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,re.width,re.height,re.depth,_e,Oe,re.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ce,re.width,re.height,re.depth,0,_e,Oe,re.data);else if(M.isData3DTexture)N?(le&&t.texStorage3D(i.TEXTURE_3D,Se,Ce,re.width,re.height,re.depth),de&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,re.width,re.height,re.depth,_e,Oe,re.data)):t.texImage3D(i.TEXTURE_3D,0,Ce,re.width,re.height,re.depth,0,_e,Oe,re.data);else if(M.isFramebufferTexture){if(le)if(N)t.texStorage2D(i.TEXTURE_2D,Se,Ce,re.width,re.height);else{let oe=re.width,Q=re.height;for(let Ae=0;Ae<Se;Ae++)t.texImage2D(i.TEXTURE_2D,Ae,Ce,oe,Q,0,_e,Oe,null),oe>>=1,Q>>=1}}else if(We.length>0){if(N&&le){let oe=ze(We[0]);t.texStorage2D(i.TEXTURE_2D,Se,Ce,oe.width,oe.height)}for(let oe=0,Q=We.length;oe<Q;oe++)me=We[oe],N?de&&t.texSubImage2D(i.TEXTURE_2D,oe,0,0,_e,Oe,me):t.texImage2D(i.TEXTURE_2D,oe,Ce,_e,Oe,me);M.generateMipmaps=!1}else if(N){if(le){let oe=ze(re);t.texStorage2D(i.TEXTURE_2D,Se,Ce,oe.width,oe.height)}de&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,_e,Oe,re)}else t.texImage2D(i.TEXTURE_2D,0,Ce,_e,Oe,re);m(M)&&p(q),we.__version=Y.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function ee(A,M,z){if(M.image.length!==6)return;let q=Be(A,M),te=M.source;t.bindTexture(i.TEXTURE_CUBE_MAP,A.__webglTexture,i.TEXTURE0+z);let Y=n.get(te);if(te.version!==Y.__version||q===!0){t.activeTexture(i.TEXTURE0+z);let we=je.getPrimaries(je.workingColorSpace),he=M.colorSpace===Zn?null:je.getPrimaries(M.colorSpace),Ee=M.colorSpace===Zn||we===he?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee);let Te=M.isCompressedTexture||M.image[0].isCompressedTexture,re=M.image[0]&&M.image[0].isDataTexture,_e=[];for(let Q=0;Q<6;Q++)!Te&&!re?_e[Q]=_(M.image[Q],!0,s.maxCubemapSize):_e[Q]=re?M.image[Q].image:M.image[Q],_e[Q]=ke(M,_e[Q]);let Oe=_e[0],Ce=r.convert(M.format,M.colorSpace),me=r.convert(M.type),We=S(M.internalFormat,Ce,me,M.colorSpace),N=M.isVideoTexture!==!0,le=Y.__version===void 0||q===!0,de=te.dataReady,Se=R(M,Oe);Ue(i.TEXTURE_CUBE_MAP,M);let oe;if(Te){N&&le&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Se,We,Oe.width,Oe.height);for(let Q=0;Q<6;Q++){oe=_e[Q].mipmaps;for(let Ae=0;Ae<oe.length;Ae++){let He=oe[Ae];M.format!==en?Ce!==null?N?de&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae,0,0,He.width,He.height,Ce,He.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae,We,He.width,He.height,0,He.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):N?de&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae,0,0,He.width,He.height,Ce,me,He.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae,We,He.width,He.height,0,Ce,me,He.data)}}}else{if(oe=M.mipmaps,N&&le){oe.length>0&&Se++;let Q=ze(_e[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Se,We,Q.width,Q.height)}for(let Q=0;Q<6;Q++)if(re){N?de&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,_e[Q].width,_e[Q].height,Ce,me,_e[Q].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,We,_e[Q].width,_e[Q].height,0,Ce,me,_e[Q].data);for(let Ae=0;Ae<oe.length;Ae++){let ct=oe[Ae].image[Q].image;N?de&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae+1,0,0,ct.width,ct.height,Ce,me,ct.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae+1,We,ct.width,ct.height,0,Ce,me,ct.data)}}else{N?de&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,Ce,me,_e[Q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,We,Ce,me,_e[Q]);for(let Ae=0;Ae<oe.length;Ae++){let He=oe[Ae];N?de&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae+1,0,0,Ce,me,He.image[Q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ae+1,We,Ce,me,He.image[Q])}}}m(M)&&p(i.TEXTURE_CUBE_MAP),Y.__version=te.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function xe(A,M,z,q,te,Y){let we=r.convert(z.format,z.colorSpace),he=r.convert(z.type),Ee=S(z.internalFormat,we,he,z.colorSpace),Te=n.get(M),re=n.get(z);if(re.__renderTarget=M,!Te.__hasExternalTextures){let _e=Math.max(1,M.width>>Y),Oe=Math.max(1,M.height>>Y);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,Y,Ee,_e,Oe,M.depth,0,we,he,null):t.texImage2D(te,Y,Ee,_e,Oe,0,we,he,null)}t.bindFramebuffer(i.FRAMEBUFFER,A),se(M)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,q,te,re.__webglTexture,0,ne(M)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,q,te,re.__webglTexture,Y),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Re(A,M,z){if(i.bindRenderbuffer(i.RENDERBUFFER,A),M.depthBuffer){let q=M.depthTexture,te=q&&q.isDepthTexture?q.type:null,Y=x(M.stencilBuffer,te),we=M.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=ne(M);se(M)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,he,Y,M.width,M.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,he,Y,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,Y,M.width,M.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,we,i.RENDERBUFFER,A)}else{let q=M.textures;for(let te=0;te<q.length;te++){let Y=q[te],we=r.convert(Y.format,Y.colorSpace),he=r.convert(Y.type),Ee=S(Y.internalFormat,we,he,Y.colorSpace),Te=ne(M);z&&se(M)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Te,Ee,M.width,M.height):se(M)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Te,Ee,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,Ee,M.width,M.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Me(A,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,A),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let q=n.get(M.depthTexture);q.__renderTarget=M,(!q.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),G(M.depthTexture,0);let te=q.__webglTexture,Y=ne(M);if(M.depthTexture.format===os)se(M)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,te,0,Y):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,te,0);else if(M.depthTexture.format===Ts)se(M)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,te,0,Y):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,te,0);else throw new Error("Unknown depthTexture format")}function Ke(A){let M=n.get(A),z=A.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==A.depthTexture){let q=A.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),q){let te=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,q.removeEventListener("dispose",te)};q.addEventListener("dispose",te),M.__depthDisposeCallback=te}M.__boundDepthTexture=q}if(A.depthTexture&&!M.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");let q=A.texture.mipmaps;q&&q.length>0?Me(M.__webglFramebuffer[0],A):Me(M.__webglFramebuffer,A)}else if(z){M.__webglDepthbuffer=[];for(let q=0;q<6;q++)if(t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[q]),M.__webglDepthbuffer[q]===void 0)M.__webglDepthbuffer[q]=i.createRenderbuffer(),Re(M.__webglDepthbuffer[q],A,!1);else{let te=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Y=M.__webglDepthbuffer[q];i.bindRenderbuffer(i.RENDERBUFFER,Y),i.framebufferRenderbuffer(i.FRAMEBUFFER,te,i.RENDERBUFFER,Y)}}else{let q=A.texture.mipmaps;if(q&&q.length>0?t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=i.createRenderbuffer(),Re(M.__webglDepthbuffer,A,!1);else{let te=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Y=M.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Y),i.framebufferRenderbuffer(i.FRAMEBUFFER,te,i.RENDERBUFFER,Y)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ie(A,M,z){let q=n.get(A);M!==void 0&&xe(q.__webglFramebuffer,A,A.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),z!==void 0&&Ke(A)}function I(A){let M=A.texture,z=n.get(A),q=n.get(M);A.addEventListener("dispose",P);let te=A.textures,Y=A.isWebGLCubeRenderTarget===!0,we=te.length>1;if(we||(q.__webglTexture===void 0&&(q.__webglTexture=i.createTexture()),q.__version=M.version,o.memory.textures++),Y){z.__webglFramebuffer=[];for(let he=0;he<6;he++)if(M.mipmaps&&M.mipmaps.length>0){z.__webglFramebuffer[he]=[];for(let Ee=0;Ee<M.mipmaps.length;Ee++)z.__webglFramebuffer[he][Ee]=i.createFramebuffer()}else z.__webglFramebuffer[he]=i.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){z.__webglFramebuffer=[];for(let he=0;he<M.mipmaps.length;he++)z.__webglFramebuffer[he]=i.createFramebuffer()}else z.__webglFramebuffer=i.createFramebuffer();if(we)for(let he=0,Ee=te.length;he<Ee;he++){let Te=n.get(te[he]);Te.__webglTexture===void 0&&(Te.__webglTexture=i.createTexture(),o.memory.textures++)}if(A.samples>0&&se(A)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let he=0;he<te.length;he++){let Ee=te[he];z.__webglColorRenderbuffer[he]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,z.__webglColorRenderbuffer[he]);let Te=r.convert(Ee.format,Ee.colorSpace),re=r.convert(Ee.type),_e=S(Ee.internalFormat,Te,re,Ee.colorSpace,A.isXRRenderTarget===!0),Oe=ne(A);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,_e,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,z.__webglColorRen
vendor: 1,323 bytes, line 3808
3808derbuffer[he])}i.bindRenderbuffer(i.RENDERBUFFER,null),A.depthBuffer&&(z.__webglDepthRenderbuffer=i.createRenderbuffer(),Re(z.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Y){t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),Ue(i.TEXTURE_CUBE_MAP,M);for(let he=0;he<6;he++)if(M.mipmaps&&M.mipmaps.length>0)for(let Ee=0;Ee<M.mipmaps.length;Ee++)xe(z.__webglFramebuffer[he][Ee],A,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,Ee);else xe(z.__webglFramebuffer[he],A,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,0);m(M)&&p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(we){for(let he=0,Ee=te.length;he<Ee;he++){let Te=te[he],re=n.get(Te),_e=i.TEXTURE_2D;(A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(_e=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(_e,re.__webglTexture),Ue(_e,Te),xe(z.__webglFramebuffer,A,Te,i.COLOR_ATTACHMENT0+he,_e,0),m(Te)&&p(_e)}t.unbindTexture()}else{let he=i.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(he=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(he,q.__webglTexture),Ue(he,M),M.mipmaps&&M.mipmaps.length>0)for(let Ee=0;Ee<M.mipmaps.length;Ee++)xe(z.__webglFramebuffer[Ee],A,M,i.COLOR_ATTACHMENT0,he,Ee);else xe(z.__webglFramebuffer,A,M,i.COLOR_ATTACHMENT0,he,0);
vendor: 6,946 bytes, line 3808
3808m(M)&&p(he),t.unbindTexture()}A.depthBuffer&&Ke(A)}function j(A){let M=A.textures;for(let z=0,q=M.length;z<q;z++){let te=M[z];if(m(te)){let Y=E(A),we=n.get(te).__webglTexture;t.bindTexture(Y,we),p(Y),t.unbindTexture()}}}let $=[],k=[];function Z(A){if(A.samples>0){if(se(A)===!1){let M=A.textures,z=A.width,q=A.height,te=i.COLOR_BUFFER_BIT,Y=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,we=n.get(A),he=M.length>1;if(he)for(let Te=0;Te<M.length;Te++)t.bindFramebuffer(i.FRAMEBUFFER,we.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Te,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,we.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Te,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,we.__webglMultisampledFramebuffer);let Ee=A.texture.mipmaps;Ee&&Ee.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,we.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,we.__webglFramebuffer);for(let Te=0;Te<M.length;Te++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(te|=i.STENCIL_BUFFER_BIT)),he){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,we.__webglColorRenderbuffer[Te]);let re=n.get(M[Te]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,re,0)}i.blitFramebuffer(0,0,z,q,0,0,z,q,te,i.NEAREST),c===!0&&($.length=0,k.length=0,$.push(i.COLOR_ATTACHMENT0+Te),A.depthBuffer&&A.resolveDepthBuffer===!1&&($.push(Y),k.push(Y),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,k)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,$))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),he)for(let Te=0;Te<M.length;Te++){t.bindFramebuffer(i.FRAMEBUFFER,we.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Te,i.RENDERBUFFER,we.__webglColorRenderbuffer[Te]);let re=n.get(M[Te]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,we.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Te,i.TEXTURE_2D,re,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,we.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&c){let M=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[M])}}}function ne(A){return Math.min(s.maxSamples,A.samples)}function se(A){let M=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function ue(A){let M=o.render.frame;h.get(A)!==M&&(h.set(A,M),A.update())}function ke(A,M){let z=A.colorSpace,q=A.format,te=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||z!==Ct&&z!==Zn&&(je.getTransfer(z)===it?(q!==en||te!==yn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),M}function ze(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(l.width=A.naturalWidth||A.width,l.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(l.width=A.displayWidth,l.height=A.displayHeight):(l.width=A.width,l.height=A.height),l}this.allocateTextureUnit=U,this.resetTextureUnits=D,this.setTexture2D=G,this.setTexture2DArray=V,this.setTexture3D=J,this.setTextureCube=H,this.rebindTextures=Ie,this.setupRenderTarget=I,this.updateRenderTargetMipmap=j,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Ke,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=se}function $0(i,e){function t(n,s=Zn){let r,o=je.getTransfer(s);if(n===yn)return i.UNSIGNED_BYTE;if(n===na)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ia)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Qc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===el)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Jc)return i.BYTE;if(n===jc)return i.SHORT;if(n===Ss)return i.UNSIGNED_SHORT;if(n===ta)return i.INT;if(n===ui)return i.UNSIGNED_INT;if(n===cn)return i.FLOAT;if(n===bs)return i.HALF_FLOAT;if(n===tl)return i.ALPHA;if(n===nl)return i.RGB;if(n===en)return i.RGBA;if(n===os)return i.DEPTH_COMPONENT;if(n===Ts)return i.DEPTH_STENCIL;if(n===sa)return i.RED;if(n===ra)return i.RED_INTEGER;if(n===il)return i.RG;if(n===oa)return i.RG_INTEGER;if(n===aa)return i.RGBA_INTEGER;if(n===Dr||n===Nr||n===Ur||n===Or)if(o===it)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Dr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Nr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ur)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=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Dr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Nr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ur)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Or)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ca||n===la||n===ha||n===ua)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===ca)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===la)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ha)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ua)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===da||n===fa||n===pa)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===da||n===fa)return o===it?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===pa)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ma||n===ga||n===_a||n===xa||n===ya||n===va||n===Ma||n===Sa||n===ba||n===Ea||n===Ta||n===Aa||n===wa||n===Ra)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ma)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ga)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===_a)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===xa)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ya)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===va)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ma)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Sa)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ba)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ea)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ta)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Aa)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===wa)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;
vendor: 15,122 bytes, lines 3808-3832
3808if(n===Ra)return o===it?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ca||n===Ia||n===Pa)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Ca)return o===it?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ia)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Pa)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===La||n===Da||n===Na||n===Ua)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===La)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Da)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Na)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ua)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Es?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var J0=` 3809void main() { 3810 3811 gl_Position = vec4( position, 1.0 ); 3812 3813}`,j0=` 3814uniform sampler2DArray depthColor; 3815uniform float depthWidth; 3816uniform float depthHeight; 3817 3818void main() { 3819 3820 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3821 3822 if ( coord.x >= 1.0 ) { 3823 3824 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3825 3826 } else { 3827 3828 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3829 3830 } 3831 3832}`,wl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new ur(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new _n({vertexShader:J0,fragmentShader:j0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ht(new Ii(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Rl=class extends En{constructor(e,t){super();let n=this,s=null,r=1,o=null,a="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,g=null,_=typeof XRWebGLBinding<"u",m=new wl,p={},E=t.getContextAttributes(),S=null,x=null,R=[],w=[],P=new ie,T=null,y=new vt;y.viewport=new et;let v=new vt;v.viewport=new et;let C=[y,v],D=new Wo,U=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let ee=R[K];return ee===void 0&&(ee=new hs,R[K]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(K){let ee=R[K];return ee===void 0&&(ee=new hs,R[K]=ee),ee.getGripSpace()},this.getHand=function(K){let ee=R[K];return ee===void 0&&(ee=new hs,R[K]=ee),ee.getHandSpace()};function G(K){let ee=w.indexOf(K.inputSource);if(ee===-1)return;let xe=R[ee];xe!==void 0&&(xe.update(K.inputSource,K.frame,l||o),xe.dispatchEvent({type:K.type,data:K.inputSource}))}function V(){s.removeEventListener("select",G),s.removeEventListener("selectstart",G),s.removeEventListener("selectend",G),s.removeEventListener("squeeze",G),s.removeEventListener("squeezestart",G),s.removeEventListener("squeezeend",G),s.removeEventListener("end",V),s.removeEventListener("inputsourceschange",J);for(let K=0;K<R.length;K++){let ee=w[K];ee!==null&&(w[K]=null,R[K].disconnect(ee))}U=null,B=null,m.reset();for(let K in p)delete p[K];e.setRenderTarget(S),f=null,d=null,u=null,s=null,x=null,qe.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){r=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){a=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(K){l=K},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(s,t)),u},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(K){if(s=K,s!==null){if(S=e.getRenderTarget(),s.addEventListener("select",G),s.addEventListener("selectstart",G),s.addEventListener("selectend",G),s.addEventListener("squeeze",G),s.addEventListener("squeezestart",G),s.addEventListener("squeezeend",G),s.addEventListener("end",V),s.addEventListener("inputsourceschange",J),E.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(P),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let xe=null,Re=null,Me=null;E.depth&&(Me=E.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,xe=E.stencil?Ts:os,Re=E.stencil?Es:ui);let Ke={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:r};u=this.getBinding(),d=u.createProjectionLayer(Ke),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),x=new Tn(d.textureWidth,d.textureHeight,{format:en,type:yn,depthTexture:new hr(d.textureWidth,d.textureHeight,Re,void 0,void 0,void 0,void 0,void 0,void 0,xe),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let xe={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,t,xe),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),x=new Tn(f.framebufferWidth,f.framebufferHeight,{format:en,type:yn,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await s.requestReferenceSpace(a),qe.setContext(s),qe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function J(K){for(let ee=0;ee<K.removed.length;ee++){let xe=K.removed[ee],Re=w.indexOf(xe);Re>=0&&(w[Re]=null,R[Re].disconnect(xe))}for(let ee=0;ee<K.added.length;ee++){let xe=K.added[ee],Re=w.indexOf(xe);if(Re===-1){for(let Ke=0;Ke<R.length;Ke++)if(Ke>=w.length){w.push(xe),Re=Ke;break}else if(w[Ke]===null){w[Ke]=xe,Re=Ke;break}if(Re===-1)break}let Me=R[Re];Me&&Me.connect(xe)}}let H=new L,ce=new L;function fe(K,ee,xe){H.setFromMatrixPosition(ee.matrixWorld),ce.setFromMatrixPosition(xe.matrixWorld);let Re=H.distanceTo(ce),Me=ee.projectionMatrix.elements,Ke=xe.projectionMatrix.elements,Ie=Me[14]/(Me[10]-1),I=Me[14]/(Me[10]+1),j=(Me[9]+1)/Me[5],$=(Me[9]-1)/Me[5],k=(Me[8]-1)/Me[0],Z=(Ke[8]+1)/Ke[0],ne=Ie*k,se=Ie*Z,ue=Re/(-k+Z),ke=ue*-k;if(ee.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(ke),K.translateZ(ue),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert(),Me[10]===-1)K.projectionMatrix.copy(ee.projectionMatrix),K.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{let ze=Ie+ue,A=I+ue,M=ne-ke,z=se+(Re-ke),q=j*I/A*ze,te=$*I/A*ze;K.projectionMatrix.makePerspective(M,z,q,te,ze,A),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}}function ye(K,ee){ee===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ee.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(s===null)return;let ee=K.near,xe=K.far;m.texture!==null&&(m.depthNear>0&&(ee=m.depthNear),m.depthFar>0&&(xe=m.depthFar)),D.near=v.near=y.near=ee,D.far=v.far=y.far=xe,(U!==D.near||B!==D.far)&&(s.updateRenderState({depthNear:D.near,depthFar:D.far}),U=D.near,B=D.far),D.layers.mask=K.layers.mask|6,y.layers.mask=D.layers.mask&3,v.layers.mask=D.layers.mask&5;let Re=K.parent,Me=D.cameras;ye(D,Re);for(let Ke=0;Ke<Me.length;Ke++)ye(Me[Ke],Re);Me.length===2?fe(D,y,v):D.projectionMatrix.copy(y.projectionMatrix),Ue(K,D,Re)};function Ue(K,ee,xe){xe===null?K.matrix.copy(ee.matrixWorld):(K.matrix.copy(xe.matrixWorld),K.matrix.invert(),K.matrix.multiply(ee.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(ee.projectionMatrix),K.projectionMatrixInverse.copy(ee.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=Ti*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(K){c=K,d!==null&&(d.fixedFoveation=K),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=K)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(D)},this.getCameraTexture=function(K){return p[K]};let Be=null;function Ze(K,ee){if(h=ee.getViewerPose(l||o),g=ee,h!==null){let xe=h.views;f!==null&&(e.setRenderTargetFramebuffer(x,f.framebuffer),e.setRenderTarget(x));let Re=!1;xe.length!==D.cameras.length&&(D.cameras.length=0,Re=!0);for(let I=0;I<xe.length;I++){let j=xe[I],$=null;if(f!==null)$=f.getViewport(j);else{let Z=u.getViewSubImage(d,j);$=Z.viewport,I===0&&(e.setRenderTargetTextures(x,Z.colorTexture,Z.depthStencilTexture),e.setRenderTarget(x))}let k=C[I];k===void 0&&(k=new vt,k.layers.enable(I),k.viewport=new et,C[I]=k),k.matrix.fromArray(j.transform.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale),k.projectionMatrix.fromArray(j.projectionMatrix),k.projectionMatrixInverse.copy(k.projectionMatrix).invert(),k.viewport.set($.x,$.y,$.width,$.height),I===0&&(D.matrix.copy(k.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),Re===!0&&D.cameras.push(k)}let Me=s.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&_){u=n.getBinding();let I=u.getDepthInformation(xe[0]);I&&I.isValid&&I.texture&&m.init(I,s.renderState)}if(Me&&Me.includes("camera-access")&&_){e.state.unbindTexture(),u=n.getBinding();for(let I=0;I<xe.length;I++){let j=xe[I].camera;if(j){let $=p[j];$||($=new ur,p[j]=$);let k=u.getCameraImage(j);$.sourceTexture=k}}}}for(let xe=0;xe<R.length;xe++){let Re=w[xe],Me=R[xe];Re!==null&&Me!==void 0&&Me.update(Re,ee,l||o)}Be&&Be(K,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),g=null}let qe=new Ad;qe.setAnimationLoop(Ze),this.setAnimationLoop=function(K){Be=K},this.dispose=function(){}}},zi=new gn,Q0=new Ve;function ex(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,hl(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,E,S,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(m,p):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),h(m,p)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,x)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),_(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,E,S):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===zt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===zt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);let E=e.get(p),S=E.envMap,x=E.envMapRotation;S&&(m.envMap.value=S,zi.copy(x),zi.x*=-1,zi.y*=-1,zi.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(zi.y*=-1,zi.z*=-1),m.envMapRotation.value.setFromMatrix4(Q0.makeRotationFromEuler(zi)),m.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,E,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===zt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.
vendor: 24,112 bytes, line 3832
3832iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){let E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function tx(i,e,t,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(E,S){let x=S.program;n.uniformBlockBinding(E,x)}function l(E,S){let x=s[E.id];x===void 0&&(g(E),x=h(E),s[E.id]=x,E.addEventListener("dispose",m));let R=S.program;n.updateUBOMapping(E,R);let w=e.render.frame;r[E.id]!==w&&(d(E),r[E.id]=w)}function h(E){let S=u();E.__bindingPointIndex=S;let x=i.createBuffer(),R=E.__size,w=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,x),i.bufferData(i.UNIFORM_BUFFER,R,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,S,x),x}function u(){for(let E=0;E<a;E++)if(o.indexOf(E)===-1)return o.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(E){let S=s[E.id],x=E.uniforms,R=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,S);for(let w=0,P=x.length;w<P;w++){let T=Array.isArray(x[w])?x[w]:[x[w]];for(let y=0,v=T.length;y<v;y++){let C=T[y];if(f(C,w,y,R)===!0){let D=C.__offset,U=Array.isArray(C.value)?C.value:[C.value],B=0;for(let G=0;G<U.length;G++){let V=U[G],J=_(V);typeof V=="number"||typeof V=="boolean"?(C.__data[0]=V,i.bufferSubData(i.UNIFORM_BUFFER,D+B,C.__data)):V.isMatrix3?(C.__data[0]=V.elements[0],C.__data[1]=V.elements[1],C.__data[2]=V.elements[2],C.__data[3]=0,C.__data[4]=V.elements[3],C.__data[5]=V.elements[4],C.__data[6]=V.elements[5],C.__data[7]=0,C.__data[8]=V.elements[6],C.__data[9]=V.elements[7],C.__data[10]=V.elements[8],C.__data[11]=0):(V.toArray(C.__data,B),B+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,D,C.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(E,S,x,R){let w=E.value,P=S+"_"+x;if(R[P]===void 0)return typeof w=="number"||typeof w=="boolean"?R[P]=w:R[P]=w.clone(),!0;{let T=R[P];if(typeof w=="number"||typeof w=="boolean"){if(T!==w)return R[P]=w,!0}else if(T.equals(w)===!1)return T.copy(w),!0}return!1}function g(E){let S=E.uniforms,x=0,R=16;for(let P=0,T=S.length;P<T;P++){let y=Array.isArray(S[P])?S[P]:[S[P]];for(let v=0,C=y.length;v<C;v++){let D=y[v],U=Array.isArray(D.value)?D.value:[D.value];for(let B=0,G=U.length;B<G;B++){let V=U[B],J=_(V),H=x%R,ce=H%J.boundary,fe=H+ce;x+=ce,fe!==0&&R-fe<J.storage&&(x+=R-fe),D.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),D.__offset=x,x+=J.storage}}}let w=x%R;return w>0&&(x+=R-w),E.__size=x,E.__cache={},this}function _(E){let S={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(S.boundary=4,S.storage=4):E.isVector2?(S.boundary=8,S.storage=8):E.isVector3||E.isColor?(S.boundary=16,S.storage=12):E.isVector4?(S.boundary=16,S.storage=16):E.isMatrix3?(S.boundary=48,S.storage=48):E.isMatrix4?(S.boundary=64,S.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),S}function m(E){let S=E.target;S.removeEventListener("dispose",m);let x=o.indexOf(S.__bindingPointIndex);o.splice(x,1),i.deleteBuffer(s[S.id]),delete s[S.id],delete r[S.id]}function p(){for(let E in s)i.deleteBuffer(s[E]);o=[],s={},r={}}return{bind:c,update:l,dispose:p}}var ka=class{constructor(e={}){let{canvas:t=Yu(),context:n=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=e;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=o;let g=new Uint32Array(4),_=new Int32Array(4),m=null,p=null,E=[],S=[];this.domElement=t,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.toneMapping=Yn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let x=this,R=!1;this._outputColorSpace=mt;let w=0,P=0,T=null,y=-1,v=null,C=new et,D=new et,U=null,B=new Le(0),G=0,V=t.width,J=t.height,H=1,ce=null,fe=null,ye=new et(0,0,V,J),Ue=new et(0,0,V,J),Be=!1,Ze=new ps,qe=!1,K=!1,ee=new Ve,xe=new L,Re=new et,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ke=!1;function Ie(){return T===null?H:1}let I=n;function j(b,O){return t.getContext(b,O)}try{let b={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"180"}`),t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",Se,!1),t.addEventListener("webglcontextcreationerror",oe,!1),I===null){let O="webgl2";if(I=j(O,b),I===null)throw j(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(b){throw console.error("THREE.WebGLRenderer: "+b.message),b}let $,k,Z,ne,se,ue,ke,ze,A,M,z,q,te,Y,we,he,Ee,Te,re,_e,Oe,Ce,me,We;function N(){$=new y_(I),$.init(),Ce=new $0(I,$),k=new d_(I,$,e,Ce),Z=new Z0(I,$),k.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),ne=new S_(I),se=new U0,ue=new K0(I,$,Z,se,k,Ce,ne),ke=new p_(x),ze=new x_(x),A=new Rp(I),me=new h_(I,A),M=new v_(I,A,ne,me),z=new E_(I,M,A,ne),re=new b_(I,k,ue),he=new f_(se),q=new N0(x,ke,ze,$,k,me,he),te=new ex(x,se),Y=new F0,we=new G0($),Te=new l_(x,ke,ze,Z,z,f,c),Ee=new q0(x,z,k),We=new tx(I,ne,k,Z),_e=new u_(I,$,ne),Oe=new M_(I,$,ne),ne.programs=q.programs,x.capabilities=k,x.extensions=$,x.properties=se,x.renderLists=Y,x.shadowMap=Ee,x.state=Z,x.info=ne}N();let le=new Rl(x,I);this.xr=le,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let b=$.get("WEBGL_lose_context");b&&b.loseContext()},this.forceContextRestore=function(){let b=$.get("WEBGL_lose_context");b&&b.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(b){b!==void 0&&(H=b,this.setSize(V,J,!1))},this.getSize=function(b){return b.set(V,J)},this.setSize=function(b,O,W=!0){if(le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=b,J=O,t.width=Math.floor(b*H),t.height=Math.floor(O*H),W===!0&&(t.style.width=b+"px",t.style.height=O+"px"),this.setViewport(0,0,b,O)},this.getDrawingBufferSize=function(b){return b.set(V*H,J*H).floor()},this.setDrawingBufferSize=function(b,O,W){V=b,J=O,H=W,t.width=Math.floor(b*W),t.height=Math.floor(O*W),this.setViewport(0,0,b,O)},this.getCurrentViewport=function(b){return b.copy(C)},this.getViewport=function(b){return b.copy(ye)},this.setViewport=function(b,O,W,X){b.isVector4?ye.set(b.x,b.y,b.z,b.w):ye.set(b,O,W,X),Z.viewport(C.copy(ye).multiplyScalar(H).round())},this.getScissor=function(b){return b.copy(Ue)},this.setScissor=function(b,O,W,X){b.isVector4?Ue.set(b.x,b.y,b.z,b.w):Ue.set(b,O,W,X),Z.scissor(D.copy(Ue).multiplyScalar(H).round())},this.getScissorTest=function(){return Be},this.setScissorTest=function(b){Z.setScissorTest(Be=b)},this.setOpaqueSort=function(b){ce=b},this.setTransparentSort=function(b){fe=b},this.getClearColor=function(b){return b.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor(...arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha(...arguments)},this.clear=function(b=!0,O=!0,W=!0){let X=0;if(b){let F=!1;if(T!==null){let ae=T.texture.format;F=ae===aa||ae===oa||ae===ra}if(F){let ae=T.texture.type,ge=ae===yn||ae===ui||ae===Ss||ae===Es||ae===na||ae===ia,be=Te.getClearColor(),ve=Te.getClearAlpha(),Ne=be.r,Fe=be.g,Pe=be.b;ge?(g[0]=Ne,g[1]=Fe,g[2]=Pe,g[3]=ve,I.clearBufferuiv(I.COLOR,0,g)):(_[0]=Ne,_[1]=Fe,_[2]=Pe,_[3]=ve,I.clearBufferiv(I.COLOR,0,_))}else X|=I.COLOR_BUFFER_BIT}O&&(X|=I.DEPTH_BUFFER_BIT),W&&(X|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(X)},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(){t.removeEventListener("webglcontextlost",de,!1),t.removeEventListener("webglcontextrestored",Se,!1),t.removeEventListener("webglcontextcreationerror",oe,!1),Te.dispose(),Y.dispose(),we.dispose(),se.dispose(),ke.dispose(),ze.dispose(),z.dispose(),me.dispose(),We.dispose(),q.dispose(),le.dispose(),le.removeEventListener("sessionstart",Mn),le.removeEventListener("sessionend",fh),fi.stop()};function de(b){b.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function Se(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;let b=ne.autoReset,O=Ee.enabled,W=Ee.autoUpdate,X=Ee.needsUpdate,F=Ee.type;N(),ne.autoReset=b,Ee.enabled=O,Ee.autoUpdate=W,Ee.needsUpdate=X,Ee.type=F}function oe(b){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",b.statusMessage)}function Q(b){let O=b.target;O.removeEventListener("dispose",Q),Ae(O)}function Ae(b){He(b),se.remove(b)}function He(b){let O=se.get(b).programs;O!==void 0&&(O.forEach(function(W){q.releaseProgram(W)}),b.isShaderMaterial&&q.releaseShaderCache(b))}this.renderBufferDirect=function(b,O,W,X,F,ae){O===null&&(O=Me);let ge=F.isMesh&&F.matrixWorld.determinant()<0,be=Kd(b,O,W,X,F);Z.setMaterial(X,ge);let ve=W.index,Ne=1;if(X.wireframe===!0){if(ve=M.getWireframeAttribute(W),ve===void 0)return;Ne=2}let Fe=W.drawRange,Pe=W.attributes.position,Je=Fe.start*Ne,st=(Fe.start+Fe.count)*Ne;ae!==null&&(Je=Math.max(Je,ae.start*Ne),st=Math.min(st,(ae.start+ae.count)*Ne)),ve!==null?(Je=Math.max(Je,0),st=Math.min(st,ve.count)):Pe!=null&&(Je=Math.max(Je,0),st=Math.min(st,Pe.count));let xt=st-Je;if(xt<0||xt===1/0)return;me.setup(F,X,be,W,ve);let lt,ot=_e;if(ve!==null&&(lt=A.get(ve),ot=Oe,ot.setIndex(lt)),F.isMesh)X.wireframe===!0?(Z.setLineWidth(X.wireframeLinewidth*Ie()),ot.setMode(I.LINES)):ot.setMode(I.TRIANGLES);else if(F.isLine){let De=X.linewidth;De===void 0&&(De=1),Z.setLineWidth(De*Ie()),F.isLineSegments?ot.setMode(I.LINES):F.isLineLoop?ot.setMode(I.LINE_LOOP):ot.setMode(I.LINE_STRIP)}else F.isPoints?ot.setMode(I.POINTS):F.isSprite&&ot.setMode(I.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)cs("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ot.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if($.get("WEBGL_multi_draw"))ot.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{let De=F._multiDrawStarts,ft=F._multiDrawCounts,Qe=F._multiDrawCount,Zt=ve?A.get(ve).bytesPerElement:1,Gi=se.get(X).currentProgram.getUniforms();for(let Kt=0;Kt<Qe;Kt++)Gi.setValue(I,"_gl_DrawID",Kt),ot.render(De[Kt]/Zt,ft[Kt])}else if(F.isInstancedMesh)ot.renderInstances(Je,xt,F.count);else if(W.isInstancedBufferGeometry){let De=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,ft=Math.min(W.instanceCount,De);ot.renderInstances(Je,xt,ft)}else ot.render(Je,xt)};function ct(b,O,W){b.transparent===!0&&b.side===qt&&b.forceSinglePass===!1?(b.side=zt,b.needsUpdate=!0,Gr(b,O,W),b.side=mn,b.needsUpdate=!0,Gr(b,O,W),b.side=qt):Gr(b,O,W)}this.compile=function(b,O,W=null){W===null&&(W=b),p=we.get(W),p.init(O),S.push(p),W.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(p.pushLight(F),F.castShadow&&p.pushShadow(F))}),b!==W&&b.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(p.pushLight(F),F.castShadow&&p.pushShadow(F))}),p.setupLights();let X=new Set;return b.traverse(function(F){if(!(F.isMesh||F.isPoints||F.isLine||F.isSprite))return;let ae=F.material;if(ae)if(Array.isArray(ae))for(let ge=0;ge<ae.length;ge++){let be=ae[ge];ct(be,W,F),X.add(be)}else ct(ae,W,F),X.add(ae)}),p=S.pop(),X},this.compileAsync=function(b,O,W=null){let X=this.compile(b,O,W);return new Promise(F=>{function ae(){if(X.forEach(function(ge){se.get(ge).currentProgram.isReady()&&X.delete(ge)}),X.size===0){F(b);return}setTimeout(ae,10)}$.get("KHR_parallel_shader_compile")!==null?ae():setTimeout(ae,10)})};let tt=null;function Dn(b){tt&&tt(b)}function Mn(){fi.stop()}function fh(){fi.start()}let fi=new Ad;fi.setAnimationLoop(Dn),typeof self<"u"&&fi.setContext(self),this.setAnimationLoop=function(b){tt=b,le.setAnimationLoop(b),b===null?fi.stop():fi.start()},le.addEventListener("sessionstart",Mn),le.addEventListener("sessionend",fh),this.render=function(b,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;if(b.matrixWorldAutoUpdate===!0&&b.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(O),O=le.getCamera()),b.isScene===!0&&b.onBeforeRender(x,b,O,T),p=we.get(b,S.length),p.init(O),S.push(p),ee.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Ze.setFromProjectionMatrix(ee,pn,O.reversedDepth),K=this.localClippingEnabled,qe=he.init(this.clippingPlanes,K),m=Y.get(b,E.length),m.init(),E.push(m),le.enabled===!0&&le.isPresenting===!0){let ae=x.xr.getDepthSensingMesh();ae!==null&&Ja(ae,O,-1/0,x.sortObjects)}Ja(b,O,0,x.sortObjects),m.finish(),x.sortObjects===!0&&m.sort(ce,fe),Ke=le.enabled===!1||le.isPresenting===!1||le.hasDepthSensing()===!1,Ke&&Te.addToRenderList(m,b),this.info.render.frame++,qe===!0&&he.beginShadows();let W=p.state.shadowsArray;Ee.render(W,b,O),qe===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset();let X=m.opaque,F=m.transmissive;if(p.setupLights(),O.isArrayCamera){let ae=O.cameras;if(F.length>0)for(let ge=0,be=ae.length;ge<be;ge++){let ve=ae[ge];mh(X,F,b,ve)}Ke&&Te.render(b);for(let ge=0,be=ae.length;ge<be;ge++){let ve=ae[ge];ph(m,b,ve,ve.viewport)}}else F.length>0&&mh(X,F,b,O),Ke&&Te.render(b),ph(m,b,O);T!==null&&P===0&&(ue.updateMultisampleRenderTarget(T),ue.updateRenderTargetMipmap(T)),b.isScene===!0&&b.onAfterRender(x,b,O),me.resetDefaultState(),y=-1,v=null,S.pop(),S.length>0?(p=S[S.length-1],qe===!0&&he.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,E.pop(),E.length>0?m=E[E.length-1]:m=null};function Ja(b,O,W,X){if(b.visible===!1)return;if(b.layers.test(O.layers)){if(b.isGroup)W=b.renderOrder;else if(b.isLOD)b.autoUpdate===!0&&b.update(O);else if(b.isLight)p.pushLight(b),b.castShadow&&p.pushShadow(b);else if(b.isSprite){if(!b.frustumCulled||Ze.intersectsSprite(b)){X&&Re.setFromMatrixPosition(b.matrixWorld).applyMatrix4(ee);let ge=z.update(b),be=b.material;be.visible&&m.push(b,ge,be,W,Re.z,null)}}else if((b.isMesh||b.isLine||b.isPoints)&&(!b.frustumCulled||Ze.intersectsObject(b))){let ge=z.update(b),be=b.material;if(X&&(b.boundingSphere!==void 0?(b.boundingSphere===null&&b.computeBoundingSphere(),Re.copy(b.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),Re.copy(ge.boundingSphere.center)),Re.applyMatrix4(b.matrixWorld).applyMatrix4(ee)),Array.isArray(be)){let ve=ge.groups;for(let Ne=0,Fe=ve.length;Ne<Fe;Ne++){let Pe=ve[Ne],Je=be[Pe.materialIndex];Je&&Je.visible&&m.push(b,ge,Je,W,Re.z,Pe)}}else be.visible&&m.push(b,ge,be,W,Re.z,null)}}let ae=b.children;for(let ge=0,be=ae.length;ge<be;ge++)Ja(ae[ge],O,W,X)}function ph(b,O,W,X){let F=b.opaque,ae=b.transmissive,ge=b.transparent;p.setupLightsView(W),qe===!0&&he.setGlobalState(x.clippingPlanes,W),X&&Z.viewport(C.copy(X)),F.length>0&&Vr(F,O,W),ae.length>0&&Vr(ae,O,W),ge.length>0&&Vr(ge,O,W),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function mh(b,O,W,X){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[X.id]===void 0&&(p.state.transmissionRenderTarget[X.id]=new Tn(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")||$.has("EXT_color_buffer_float")?bs:yn,minFilter:xn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:je.workingColorSpace}));let ae=p.state.transmissionRenderTarget[X.id],ge=X.viewport||C;ae.setSize(ge.z*x.transmissionResolutionScale,ge.w*x.transmissionResolutionScale);let be=x.getRenderTarget(),ve=x.getActiveCubeFace(),Ne=x.getActiveMipmapLevel();x.setRenderTarget(ae),x.getClearColor(B),G=x.getClearAlpha(),G<1&&x.setClearColor(16777215,.5),x.clear(),Ke&&Te.render(W);let Fe=x.toneMapping;x.toneMapping=Yn;let Pe=X.viewport;if(X.viewport!==void 0&&(X.viewport=void 0),p.setupLightsView(X),qe===!0&&he.setGlobalState(x.clippingPlanes,X),Vr(b,W,X),ue.updateMultisampleRenderTarget(ae),ue.updateRenderTargetMipmap(ae),$.has("WEBGL_multisampled_render_to_texture")===!1){let Je=!1;for(let st=0,xt=O.length;st<xt;st++){let lt=O[st],ot=lt.object,De=lt.geometry,ft=lt.material,Qe=lt.group;if(ft.side===qt&&ot.layers.test(X.layers)){let Zt=ft.side;ft.side=zt,ft.needsUpdate=!0,gh(ot,W,X,De,ft,Qe),ft.side=Zt,ft.needsUpdate=!0,Je=!0}}Je===!0&&(ue.updateMultisampleRenderTarget(ae),ue.updateRenderTargetMipmap(ae))}x.setRenderTarget(be,ve,Ne),x.setClearColor(B,G),Pe!==void 0&&(X.viewport=Pe),x.toneMapping=Fe}function Vr(b,O,W){let X=O.isScene===!0?O.overrideMaterial:null;for(let F=0,ae=b.length;F<ae;F++){let ge=b[F],be=ge.object,ve=ge.geometry,Ne=ge.group,Fe=ge.material;Fe.allowOverride===!0&&X!==null&&(Fe=X),be.layers.test(W.layers)&&gh(be,O,W,ve,Fe,Ne)}}function gh(b,O,W,X,F,ae){b.onBeforeRender(x,O,W,X,F,ae),b.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,b.matrixWorld),b.normalMatrix.getNormalMatrix(b.modelViewMatrix),F.onBeforeRender(x,O,W,X,b,ae),F.transparent===!0&&F.side===qt&&F.forceSinglePass===!1?(F.side=zt,F.needsUpdate=!0,x.renderBufferDirect(W,O,X,F,b,ae),F.side=mn,F.needsUpdate=!0,x.renderBufferDirect(W,O,X,F,b,ae),F.side=qt):x.renderBufferDirect(W,O,X,F,b,ae),b.onAfterRender(x,O,W,X,F,ae)}function Gr(b,O,W){O.isScene!==!0&&(O=Me);let X=se.get(b),F=p.state.lights,ae=p.state.shadowsArray,ge=F.state.version,be=q.getParameters(b,F.state,ae,O,W),ve=q.getProgramCacheKey(be),Ne=X.programs;X.environment=b.isMeshStandardMaterial?O.environment:null,X.fog=O.fog,X.envMap=(b.isMeshStandardMaterial?ze:ke).get(b.envMap||X.environment),X.envMapRotation=X.environment!==null&&b.envMap===null?O.environmentRotation:b.envMapRotation,Ne===void 0&&(b.addEventListener("dispose",Q),Ne=new Map,X.programs=Ne);let Fe=Ne.get(ve);if(Fe!==void 0){if(X.currentProgram===Fe&&X.lightsStateVersion===ge)return xh(b,be),Fe}else be.uniforms=q.getUniforms(b),b.onBeforeCompile(be,x),Fe=q.acquireProgram(be,ve),Ne.set(ve,Fe),X.uniforms=be.uniforms;let Pe=X.uniforms;return(!b.isShaderMaterial&&!b.isRawShaderMaterial||b.clipping===!0)&&(Pe.clippingPlanes=he.uniform),xh(b,be),X.needsLights=Jd(b),X.lightsStateVersion=ge,X.needsLights&&(Pe.ambientLightColor.value=F.state.ambient,Pe.lightProbe.value=F.state.probe,Pe.directionalLights.value=F.state.directional,Pe.directionalLightShadows.value=F.state.directionalShadow,Pe.spotLights.value=F.state.spot,Pe.spotLightShadows.value=F.state.spotShadow,Pe.rectAreaLights.value=F.state.rectArea,Pe.ltc_1.value=F.state.rectAreaLTC1,Pe.ltc_2.value=F.state.rectAreaLTC2,Pe.pointLights.value=F.state.point,Pe.pointLightShadows.value=F.state.pointShadow,Pe.hemisphereLights.value=F.state.hemi,Pe.directionalShadowMap.value=F.state.directionalShadowMap,Pe.directionalShadowMatrix.value=F.state.directionalShadowMatrix,Pe.spotShadowMap.value=F.state.spotShadowMap,Pe.spotLightMatrix.value=F.state.spotLightMatrix,Pe.spotLightMap.value=F.state.spotLightMap,Pe.pointShadowMap.value=F.state.pointShadowMap,Pe.pointShadowMatrix.value=F.state.pointShadowMatrix),X.currentProgram=Fe,X.uniformsList=null,Fe}function _h(b){if(b.uniformsList===null){let O=b.currentProgram.getUniforms();b.uniformsList=Cs.seqWithValue(O.seq,b.uniforms)}return b.uniformsList}function xh(b,O){let W=se.get(b);W.outputColorSpace=O.outputColorSpace,W.batching=O.batching,W.batchingColor=O.batchingColor,W.instancing=O.instancing,W.instancingColor=O.instancingColor,W.instancingMorph=O.instancingMorph,W.skinning=O.skinning,W.morphTargets=O.morphTargets,W.morphNormals=O.morphNormals,W.morphColors=O.morphColors,W.morphTargetsCount=O.morphTargetsCount,W.numClippingPlanes=O.numClippingPlanes,W.numIntersection=O.numClipIntersection,W.vertexAlphas=O.vertexAlphas,W.vertexTangents=O.vertexTangents,W.toneMapping=O.toneMapping}function Kd(b,O,W,X,F){O.isScene!==!0&&(O=Me),ue.resetTextureUnits();let ae=O.fog,ge=X.isMeshStandardMaterial?O.environment:null,be=T===null?x.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:Ct,ve=(X.isMeshStandardMaterial?ze:ke).get(X.envMap||ge),Ne=X.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Fe=!!W.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),Pe=!!W.morphAttributes.position,Je=!!W.morphAttributes.normal,st=!!W.morphAttributes.color,xt=Yn;X.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(xt=x.toneMapping);let lt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,ot=lt!==void 0?lt.length:0,De=se.get(X),ft=p.state.lights;if(qe===!0&&(K===!0||b!==v)){let Nt=b===v&&X.id===y;he.setState(X,b,Nt)}let Qe=!1;X.version===De.__version?(De.needsLights&&De.lightsStateVersion!==ft.state.version||De.outputColorSpace!==be||F.isBatchedMesh&&De.batching===!1||!F.isBatchedMesh&&De.batching===!0||F.isBatchedMesh&&De.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&De.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&De.instancing===!1||!F.isInstancedMesh&&De.instancing===!0||F.isSkinnedMesh&&De.skinning===!1||!F.isSkinnedMesh&&De.skinning===!0||F.isInstancedMesh&&De.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&De.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&De.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&De.instancingMorph===!1&&F.morphTexture!==null||De.envMap!==ve||X.fog===!0&&De.fog!==ae||De.numClippingPlanes!==void 0&&(De.numClippingPlanes!==he.numPlanes||De.numIntersection!==he.numIntersection)||De.vertexAlphas!==Ne||De.vertexTangents!==Fe||De.morphTargets!==Pe||De.morphNormals!==Je||De.morphColors!==st||De.toneMapping!==xt||De.morphTargetsCount!==ot)&&(Qe=!0):(Qe=!0,De.__version=X.version);let Zt=De.currentProgram;
vendor: 11,304 bytes, line 3832
3832Qe===!0&&(Zt=Gr(X,O,F));let Gi=!1,Kt=!1,Us=!1,pt=Zt.getUniforms(),tn=De.uniforms;if(Z.useProgram(Zt.program)&&(Gi=!0,Kt=!0,Us=!0),X.id!==y&&(y=X.id,Kt=!0),Gi||v!==b){Z.buffers.depth.getReversed()&&b.reversedDepth!==!0&&(b._reversedDepth=!0,b.updateProjectionMatrix()),pt.setValue(I,"projectionMatrix",b.projectionMatrix),pt.setValue(I,"viewMatrix",b.matrixWorldInverse);let Ht=pt.map.cameraPosition;Ht!==void 0&&Ht.setValue(I,xe.setFromMatrixPosition(b.matrixWorld)),k.logarithmicDepthBuffer&&pt.setValue(I,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(I,"isOrthographic",b.isOrthographicCamera===!0),v!==b&&(v=b,Kt=!0,Us=!0)}if(F.isSkinnedMesh){pt.setOptional(I,F,"bindMatrix"),pt.setOptional(I,F,"bindMatrixInverse");let Nt=F.skeleton;Nt&&(Nt.boneTexture===null&&Nt.computeBoneTexture(),pt.setValue(I,"boneTexture",Nt.boneTexture,ue))}F.isBatchedMesh&&(pt.setOptional(I,F,"batchingTexture"),pt.setValue(I,"batchingTexture",F._matricesTexture,ue),pt.setOptional(I,F,"batchingIdTexture"),pt.setValue(I,"batchingIdTexture",F._indirectTexture,ue),pt.setOptional(I,F,"batchingColorTexture"),F._colorsTexture!==null&&pt.setValue(I,"batchingColorTexture",F._colorsTexture,ue));let nn=W.morphAttributes;if((nn.position!==void 0||nn.normal!==void 0||nn.color!==void 0)&&re.update(F,W,Zt),(Kt||De.receiveShadow!==F.receiveShadow)&&(De.receiveShadow=F.receiveShadow,pt.setValue(I,"receiveShadow",F.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(tn.envMap.value=ve,tn.flipEnvMap.value=ve.isCubeTexture&&ve.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&O.environment!==null&&(tn.envMapIntensity.value=O.environmentIntensity),Kt&&(pt.setValue(I,"toneMappingExposure",x.toneMappingExposure),De.needsLights&&$d(tn,Us),ae&&X.fog===!0&&te.refreshFogUniforms(tn,ae),te.refreshMaterialUniforms(tn,X,H,J,p.state.transmissionRenderTarget[b.id]),Cs.upload(I,_h(De),tn,ue)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Cs.upload(I,_h(De),tn,ue),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&pt.setValue(I,"center",F.center),pt.setValue(I,"modelViewMatrix",F.modelViewMatrix),pt.setValue(I,"normalMatrix",F.normalMatrix),pt.setValue(I,"modelMatrix",F.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){let Nt=X.uniformsGroups;for(let Ht=0,ja=Nt.length;Ht<ja;Ht++){let pi=Nt[Ht];We.update(pi,Zt),We.bind(pi,Zt)}}return Zt}function $d(b,O){b.ambientLightColor.needsUpdate=O,b.lightProbe.needsUpdate=O,b.directionalLights.needsUpdate=O,b.directionalLightShadows.needsUpdate=O,b.pointLights.needsUpdate=O,b.pointLightShadows.needsUpdate=O,b.spotLights.needsUpdate=O,b.spotLightShadows.needsUpdate=O,b.rectAreaLights.needsUpdate=O,b.hemisphereLights.needsUpdate=O}function Jd(b){return b.isMeshLambertMaterial||b.isMeshToonMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isShadowMaterial||b.isShaderMaterial&&b.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(b,O,W){let X=se.get(b);X.__autoAllocateDepthBuffer=b.resolveDepthBuffer===!1,X.__autoAllocateDepthBuffer===!1&&(X.__useRenderToTexture=!1),se.get(b.texture).__webglTexture=O,se.get(b.depthTexture).__webglTexture=X.__autoAllocateDepthBuffer?void 0:W,X.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(b,O){let W=se.get(b);W.__webglFramebuffer=O,W.__useDefaultFramebuffer=O===void 0};let jd=I.createFramebuffer();this.setRenderTarget=function(b,O=0,W=0){T=b,w=O,P=W;let X=!0,F=null,ae=!1,ge=!1;if(b){let ve=se.get(b);if(ve.__useDefaultFramebuffer!==void 0)Z.bindFramebuffer(I.FRAMEBUFFER,null),X=!1;else if(ve.__webglFramebuffer===void 0)ue.setupRenderTarget(b);else if(ve.__hasExternalTextures)ue.rebindTextures(b,se.get(b.texture).__webglTexture,se.get(b.depthTexture).__webglTexture);else if(b.depthBuffer){let Pe=b.depthTexture;if(ve.__boundDepthTexture!==Pe){if(Pe!==null&&se.has(Pe)&&(b.width!==Pe.image.width||b.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ue.setupDepthRenderbuffer(b)}}let Ne=b.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(ge=!0);let Fe=se.get(b).__webglFramebuffer;b.isWebGLCubeRenderTarget?(Array.isArray(Fe[O])?F=Fe[O][W]:F=Fe[O],ae=!0):b.samples>0&&ue.useMultisampledRTT(b)===!1?F=se.get(b).__webglMultisampledFramebuffer:Array.isArray(Fe)?F=Fe[W]:F=Fe,C.copy(b.viewport),D.copy(b.scissor),U=b.scissorTest}else C.copy(ye).multiplyScalar(H).floor(),D.copy(Ue).multiplyScalar(H).floor(),U=Be;if(W!==0&&(F=jd),Z.bindFramebuffer(I.FRAMEBUFFER,F)&&X&&Z.drawBuffers(b,F),Z.viewport(C),Z.scissor(D),Z.setScissorTest(U),ae){let ve=se.get(b.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+O,ve.__webglTexture,W)}else if(ge){let ve=O;for(let Ne=0;Ne<b.textures.length;Ne++){let Fe=se.get(b.textures[Ne]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+Ne,Fe.__webglTexture,W,ve)}}else if(b!==null&&W!==0){let ve=se.get(b.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,ve.__webglTexture,W)}y=-1},this.readRenderTargetPixels=function(b,O,W,X,F,ae,ge,be=0){if(!(b&&b.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=se.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve){Z.bindFramebuffer(I.FRAMEBUFFER,ve);try{let Ne=b.textures[be],Fe=Ne.format,Pe=Ne.type;if(!k.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!k.textureTypeReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=b.width-X&&W>=0&&W<=b.height-F&&(b.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+be),I.readPixels(O,W,X,F,Ce.convert(Fe),Ce.convert(Pe),ae))}finally{let Ne=T!==null?se.get(T).__webglFramebuffer:null;Z.bindFramebuffer(I.FRAMEBUFFER,Ne)}}},this.readRenderTargetPixelsAsync=async function(b,O,W,X,F,ae,ge,be=0){if(!(b&&b.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=se.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve)if(O>=0&&O<=b.width-X&&W>=0&&W<=b.height-F){Z.bindFramebuffer(I.FRAMEBUFFER,ve);let Ne=b.textures[be],Fe=Ne.format,Pe=Ne.type;if(!k.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!k.textureTypeReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Je=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Je),I.bufferData(I.PIXEL_PACK_BUFFER,ae.byteLength,I.STREAM_READ),b.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+be),I.readPixels(O,W,X,F,Ce.convert(Fe),Ce.convert(Pe),0);let st=T!==null?se.get(T).__webglFramebuffer:null;Z.bindFramebuffer(I.FRAMEBUFFER,st);let xt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Zu(I,xt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Je),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ae),I.deleteBuffer(Je),I.deleteSync(xt),ae}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(b,O=null,W=0){let X=Math.pow(2,-W),F=Math.floor(b.image.width*X),ae=Math.floor(b.image.height*X),ge=O!==null?O.x:0,be=O!==null?O.y:0;ue.setTexture2D(b,0),I.copyTexSubImage2D(I.TEXTURE_2D,W,0,0,ge,be,F,ae),Z.unbindTexture()};let Qd=I.createFramebuffer(),ef=I.createFramebuffer();this.copyTextureToTexture=function(b,O,W=null,X=null,F=0,ae=null){ae===null&&(F!==0?(cs("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ae=F,F=0):ae=0);let ge,be,ve,Ne,Fe,Pe,Je,st,xt,lt=b.isCompressedTexture?b.mipmaps[ae]:b.image;if(W!==null)ge=W.max.x-W.min.x,be=W.max.y-W.min.y,ve=W.isBox3?W.max.z-W.min.z:1,Ne=W.min.x,Fe=W.min.y,Pe=W.isBox3?W.min.z:0;else{let nn=Math.pow(2,-F);ge=Math.floor(lt.width*nn),be=Math.floor(lt.height*nn),b.isDataArrayTexture?ve=lt.depth:b.isData3DTexture?ve=Math.floor(lt.depth*nn):ve=1,Ne=0,Fe=0,Pe=0}X!==null?(Je=X.x,st=X.y,xt=X.z):(Je=0,st=0,xt=0);let ot=Ce.convert(O.format),De=Ce.convert(O.type),ft;O.isData3DTexture?(ue.setTexture3D(O,0),ft=I.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(ue.setTexture2DArray(O,0),ft=I.TEXTURE_2D_ARRAY):(ue.setTexture2D(O,0),ft=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,O.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,O.unpackAlignment);let Qe=I.getParameter(I.UNPACK_ROW_LENGTH),Zt=I.getParameter(I.UNPACK_IMAGE_HEIGHT),Gi=I.getParameter(I.UNPACK_SKIP_PIXELS),Kt=I.getParameter(I.UNPACK_SKIP_ROWS),Us=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,lt.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,lt.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,Ne),I.pixelStorei(I.UNPACK_SKIP_ROWS,Fe),I.pixelStorei(I.UNPACK_SKIP_IMAGES,Pe);let pt=b.isDataArrayTexture||b.isData3DTexture,tn=O.isDataArrayTexture||O.isData3DTexture;if(b.isDepthTexture){let nn=se.get(b),Nt=se.get(O),Ht=se.get(nn.__renderTarget),ja=se.get(Nt.__renderTarget);Z.bindFramebuffer(I.READ_FRAMEBUFFER,Ht.__webglFramebuffer),Z.bindFramebuffer(I.DRAW_FRAMEBUFFER,ja.__webglFramebuffer);for(let pi=0;pi<ve;pi++)pt&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,se.get(b).__webglTexture,F,Pe+pi),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,se.get(O).__webglTexture,ae,xt+pi)),I.blitFramebuffer(Ne,Fe,ge,be,Je,st,ge,be,I.DEPTH_BUFFER_BIT,I.NEAREST);Z.bindFramebuffer(I.READ_FRAMEBUFFER,null),Z.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(F!==0||b.isRenderTargetTexture||se.has(b)){let nn=se.get(b),Nt=se.get(O);Z.bindFramebuffer(I.READ_FRAMEBUFFER,Qd),Z.bindFramebuffer(I.DRAW_FRAMEBUFFER,ef);for(let Ht=0;Ht<ve;Ht++)pt?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,nn.__webglTexture,F,Pe+Ht):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,nn.__webglTexture,F),tn?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,Nt.__webglTexture,ae,xt+Ht):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,Nt.__webglTexture,ae),F!==0?I.blitFramebuffer(Ne,Fe,ge,be,Je,st,ge,be,I.COLOR_BUFFER_BIT,I.NEAREST):tn?I.copyTexSubImage3D(ft,ae,Je,st,xt+Ht,Ne,Fe,ge,be):I.copyTexSubImage2D(ft,ae,Je,st,Ne,Fe,ge,be);Z.bindFramebuffer(I.READ_FRAMEBUFFER,null),Z.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else tn?b.isDataTexture||b.isData3DTexture?I.texSubImage3D(ft,ae,Je,st,xt,ge,be,ve,ot,De,lt.data):O.isCompressedArrayTexture?I.compressedTexSubImage3D(ft,ae,Je,st,xt,ge,be,ve,ot,lt.data):I.texSubImage3D(ft,ae,Je,st,xt,ge,be,ve,ot,De,lt):b.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,ae,Je,
3832st,ge,be,ot,De,lt.data):b.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,ae,Je,st,lt.width,lt.height,ot,lt.data):I.texSubImage2D(I.TEXTURE_2D,ae,Je,st,ge,be,ot,De,lt);I.pixelStorei(I.UNPACK_ROW_LENGTH,Qe),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,Zt),I.pixelStorei(I.UNPACK_SKIP_PIXELS,Gi),I.pixelStorei(I.UNPACK_SKIP_ROWS,Kt),I.pixelStorei(I.UNPACK_SKIP_IMAGES,Us),ae===0&&O.generateMipmaps&&I.generateMipmap(ft),Z.unbindTexture()},this.initRenderTarget=function(b){se.get(b).__webglFramebuffer===void 0&&ue.setupRenderTarget(b)},this.initTexture=function(b){b.isCubeTexture?ue.setTextureCube(b,0):b.isData3DTexture?ue.setTexture3D(b,0):b.isDataArrayTexture||b.isCompressedArrayTexture?ue.setTexture2DArray(b,0):ue.setTexture2D(b,0),Z.unbindTexture()},this.resetState=function(){w=0,P=0,T=null,Z.reset(),me.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return pn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=je._getDrawingBufferColorSpace(e),t.unpackColorSpace=je._getUnpackColorSpace()}};async function Pd(i,e,t=1){let n=await fetch(`${e}rob-visual.json?v=20260916`);if(!n.ok)throw new Error("ROB capture metadata could not load");let s=await n.json(),[r,o]=await Promise.all([fetch(`${e}${s.geometryBuffer}?v=20260916`),new Pi().loadAsync(`${e}rob-captured-colors.png?v=20260916`)]);if(!r.ok)throw o.dispose(),new Error("ROB capture geometry could not load");let a=await r.arrayBuffer();o.colorSpace=mt;let c=new Bt({map:o,side:qt}),l=c.clone();l.userData.captured=!0;let h=[];function u(d,f){if(!f||f.name!==d.name)throw new Error(`Missing ROB animation node ${d.name}`);let g=s.geometries[d.geometry]?.buffer;if(g){let{byteOffset:_,vertexCount:m}=g;if(!Number.isInteger(_)||!Number.isInteger(m)||_<0||m<=0||m>2e6||_%4||_+m*32>a.byteLength)throw new Error("Invalid captured ROB buffer");let p=new Float32Array(a,_,m*8),E=new Float32Array(m*3),S=new Float32Array(m*3),x=new Float32Array(m*2);for(let w=0;w<m;w++){for(let P=0;P<3;P++)E[w*3+P]=p[w*8+P]*t,S[w*3+P]=p[w*8+P+3];x[w*2]=p[w*8+6],x[w*2+1]=p[w*8+7]}let R=new Mt;R.setAttribute("position",new ut(E,3)),R.setAttribute("normal",new ut(S,3)),R.setAttribute("uv",new ut(x,2)),R.computeBoundingBox(),R.computeBoundingSphere(),h.push({target:f,geometry:R,material:d.material==="captured-body"?l:c})}else f.isMesh&&d.geometry===void 0&&h.push({target:f});d.children.forEach((_,m)=>u(_,f.children[m]))}try{u(s.root,i.root)}catch(d){throw h.forEach(({geometry:f})=>f?.dispose()),c.dispose(),l.dispose(),o.dispose(),d}for(let{target:d,geometry:f,material:g}of h){if(!f){d.visible=!1;continue}if(d.isMesh)d.geometry.dispose(),d.geometry=f,d.material=g,d.visible=!0;else{let _=new ht(f,g);_.name=`${d.name} Captured Surface`,d.add(_)}}return i.captureMaterial=l,i.root.userData.captureVersion=s.version,s.capture}var Ld={type:"change"},Ll={type:"start"},Nd={type:"end"},Va=new Hn,Dd=new rn,nx=Math.cos(70*vn.DEG2RAD),Et=new L,Yt=2*Math.PI,rt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Pl=1e-6,Ga=class extends Pr{constructor(e,t=null){super(e,t),this.state=rt.NONE,this.target=new L,this.cursor=new L,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:li.ROTATE,MIDDLE:li.DOLLY,RIGHT:li.PAN},this.touches={ONE:hi.ROTATE,TWO:hi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new L,this._lastQuaternion=new Ft,this._lastTargetPosition=new L,this._quat=new Ft().setFromUnitVectors(e.up,new L(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new ci,this._sphericalDelta=new ci,this._scale=1,this._panOffset=new L,this._rotateStart=new ie,this._rotateEnd=new ie,this._rotateDelta=new ie,this._panStart=new ie,this._panEnd=new ie,this._panDelta=new ie,this._dollyStart=new ie,this._dollyEnd=new ie,this._dollyDelta=new ie,this._dollyDirection=new L,this._mouse=new ie,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=sx.bind(this),this._onPointerDown=ix.bind(this),this._onPointerUp=rx.bind(this),this._onContextMenu=dx.bind(this),this._onMouseWheel=cx.bind(this),this._onKeyDown=lx.bind(this),this._onTouchStart=hx.bind(this),this._onTouchMove=ux.bind(this),this._onMouseDown=ox.bind(this),this._onMouseMove=ax.bind(this),this._interceptControlDown=fx.bind(this),this._interceptControlUp=px.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ld),this.update(),this.state=rt.NONE}update(e=null){let t=this.object.position;Et.copy(t).sub(this.target),Et.applyQuaternion(this._quat),this._spherical.setFromVector3(Et),this.autoRotate&&this.state===rt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(n)&&isFinite(s)&&(n<-Math.PI?n+=Yt:n>Math.PI&&(n-=Yt),s<-Math.PI?s+=Yt:s>Math.PI&&(s-=Yt),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radiu
3832s=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=o!=this._spherical.radius}if(Et.setFromSpherical(this._spherical),Et.applyQuaternion(this._quatInverse),t.copy(this.target).add(Et),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=Et.length();o=this._clampDistance(a*this._scale);let c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){let a=new L(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;let l=new L(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(a),this.object.updateMatrixWorld(),o=Et.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Va.origin.copy(this.object.position),Va.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Va.direction))<nx?this.object.lookAt(this.target):(Dd.setFromNormalAndCoplanarPoint(this.object.up,this.target),Va.intersectPlane(Dd,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Pl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Pl||this._lastTargetPosition.distanceToSquared(this.target)>Pl?(this.dispatchEvent(Ld),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Yt/60*this.autoRotateSpeed*e:Yt/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Et.setFromMatrixColumn(t,0),Et.multiplyScalar(-e),this._panOffset.add(Et)}
vendor: 16,347 bytes, line 3832
3832_panUp(e,t){this.screenSpacePanning===!0?Et.setFromMatrixColumn(t,1):(Et.setFromMatrixColumn(t,0),Et.crossVectors(this.object.up,Et)),Et.multiplyScalar(e),this._panOffset.add(Et)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let s=this.object.position;Et.copy(s).sub(this.target);let r=Et.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),s=e-n.left,r=t-n.top,o=n.width,a=n.height;this._mouse.x=s/o*2-1,this._mouse.y=-(r/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Yt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Yt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Yt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Yt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Yt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Yt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._rotateStart.set(n,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panStart.set(n,s)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),s=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Yt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Yt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panEnd.set(n,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new ie,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function ix(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function sx(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function rx(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Nd),this.state=rt.NONE;break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function ox(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case li.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=rt.DOLLY;break;case li.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=rt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=rt.ROTATE}break;case li.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=rt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=rt.PAN}break;default:this.state=rt.NONE}this.state!==rt.NONE&&this.dispatchEvent(Ll)}function ax(i){switch(this.state){case rt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case rt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case rt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function cx(i){this.enabled===!1||this.enableZoom===!1||this.state!==rt.NONE||(i.preventDefault(),this.dispatchEvent(Ll),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Nd))}function lx(i){this.enabled!==!1&&this._handleKeyDown(i)}function hx(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case hi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=rt.TOUCH_ROTATE;break;case hi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=rt.TOUCH_PAN;break;default:this.state=rt.NONE}break;case 2:switch(this.touches.TWO){case hi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=rt.TOUCH_DOLLY_PAN;break;case hi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=rt.TOUCH_DOLLY_ROTATE;break;default:this.state=rt.NONE}break;default:this.state=rt.NONE}this.state!==rt.NONE&&this.dispatchEvent(Ll)}function ux(i){switch(this._trackPointer(i),this.state){case rt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case rt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case rt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case rt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=rt.NONE}}function dx(i){this.enabled!==!1&&i.preventDefault()}function fx(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function px(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Dl(i,e){if(e===sl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===As||e===Fr){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,s=[];if(e===As)for(let o=1;o<=n;o++)s.push(t.getX(0)),s.push(t.getX(o)),s.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(s.push(t.getX(o)),s.push(t.getX(o+1)),s.push(t.getX(o+2))):(s.push(t.getX(o+2)),s.push(t.getX(o+1)),s.push(t.getX(o)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let r=i.clone();return r.setIndex(s),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}var Wa=class extends Cn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new kl(t)}),this.register(function(t){return new Hl(t)}),this.register(function(t){return new $l(t)}),this.register(function(t){return new Jl(t)}),this.register(function(t){return new jl(t)}),this.register(function(t){return new Gl(t)}),this.register(function(t){return new Wl(t)}),this.register(function(t){return new Xl(t)}),this.register(function(t){return new ql(t)}),this.register(function(t){return new zl(t)}),this.register(function(t){return new Yl(t)}),this.register(function(t){return new Vl(t)}),this.register(function(t){return new Kl(t)}),this.register(function(t){return new Zl(t)}),this.register(function(t){return new Fl(t)}),this.register(function(t){return new Ql(t)}),this.register(function(t){return new eh(t)})}load(e,t,n,s){let r=this,o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){let l=Xn.extractUrlBase(e);o=Xn.resolveURL(l,this.path)}else o=Xn.extractUrlBase(e);this.manager.itemStart(e);let a=function(l){s?s(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new vs(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,o,function(h){t(h),r.manager.itemEnd(e)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){let r,o={},a={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===zd){try{o[$e.KHR_BINARY_GLTF]=new th(e)}catch(u){s&&s(u);return}r=JSON.parse(o[$e.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new ch(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){let u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){let u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case $e.KHR_MATERIALS_UNLIT:o[u]=new Bl;break;case $e.KHR_DRACO_MESH_COMPRESSION:o[u]=new nh(r,this.dracoLoader);break;case $e.KHR_TEXTURE_TRANSFORM:o[u]=new ih;break;case $e.KHR_MESH_QUANTIZATION:o[u]=new sh;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(n,s)}parseAsync(e,t){let n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}};function mx(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}var $e={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"}
vendor: 7,090 bytes, line 3832
3832,Fl=class{constructor(e){this.parser=e,this.name=$e.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,s=t.cache.get(n);if(s)return s;let r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],l,h=new Le(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Ct);let u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new ai(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new wr(h),l.distance=u;break;case"spot":l=new Ar(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),Ln(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(l),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(t.cache,a,c)})}},Bl=class{constructor(){this.name=$e.KHR_MATERIALS_UNLIT}getMaterialType(){return Bt}extendParams(e,t,n){let s=[];e.color=new Le(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let o=r.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Ct),e.opacity=o[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,mt))}return Promise.all(s)}},zl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=s.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}},kl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){let a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ie(a,a)}return Promise.all(r)}},Hl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_DISPERSION}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=s.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}},Vl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(r)}},Gl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_SHEEN}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[];t.sheenColor=new Le(0,0,0),t.sheenRoughness=0,t.sheen=1;let o=s.extensions[this.name];if(o.sheenColorFactor!==void 0){let a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],Ct)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,mt)),o.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(r)}},Wl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(r)}},Xl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_VOLUME}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;let a=o.attenuationColor||[1,1,1];return t.attenuationColor=new Le().setRGB(a[0],a[1],a[2],Ct),Promise.all(r)}},ql=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_IOR}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=s.extensions[this.name];
vendor: 4,577 bytes, line 3832
3832return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}},Yl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_SPECULAR}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));let a=o.specularColorFactor||[1,1,1];return t.specularColor=new Le().setRGB(a[0],a[1],a[2],Ct),o.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,mt)),Promise.all(r)}},Zl=class{constructor(e){this.parser=e,this.name=$e.EXT_MATERIALS_BUMP}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(r)}},Kl=class{constructor(e){this.parser=e,this.name=$e.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Wt}extendMaterialParams(e,t){let n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let r=[],o=s.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(r)}},$l=class{constructor(e){this.parser=e,this.name=$e.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;let r=s.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,o)}},Jl=class{constructor(e){this.parser=e,this.name=$e.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let o=r.extensions[t],a=s.images[o.source],c=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}},jl=class{constructor(e){this.parser=e,this.name=$e.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let o=r.extensions[t],a=s.images[o.source],c=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}},Ql=class{constructor(e){this.name=$e.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){let c=s.byteOffset||0,l=s.byteLength||0,h=s.count,u=s.byteStride,d=new Uint8Array(a,c,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,d,s.mode,s.filter).then(function(f){return f.buffer}):o.ready.then(function(){let f=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(f),h,u,d,s.mode,s.filter),f})})}else return null}},eh=class{constructor(e){this.name=$e.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let s=t.meshes[n.mesh];for(let l of s.primitives)if(l.mode!==ln.TRIANGLES&&l.mode!==ln.TRIANGLE_STRIP&&l.mode!==ln.TRIANGLE_FAN&&l.mode!==void 0)return null;let o=n.extensions[this.name].attributes,a=[],c={};for(let l in o)a.push(this.parser.getDependency("accessor",o[l]).then(h=>(c[l]=h,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{let h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];
vendor: 20,435 bytes, line 3832
3832for(let g of u){let _=new Ve,m=new L,p=new Ft,E=new L(1,1,1),S=new ar(g.geometry,g.material,d);for(let x=0;x<d;x++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,x),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,x),c.SCALE&&E.fromBufferAttribute(c.SCALE,x),S.setMatrixAt(x,_.compose(m,p,E));for(let x in c)if(x==="_COLOR_0"){let R=c[x];S.instanceColor=new oi(R.array,R.itemSize,R.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,c[x]);dt.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),f.push(S)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}},zd="glTF",zr=12,Ud={JSON:1313821514,BIN:5130562},th=class{constructor(e){this.name=$e.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,zr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==zd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let s=this.header.length-zr,r=new DataView(e,zr),o=0;for(;o<s;){let a=r.getUint32(o,!0);o+=4;let c=r.getUint32(o,!0);if(o+=4,c===Ud.JSON){let l=new Uint8Array(e,zr+o,a);this.content=n.decode(l)}else if(c===Ud.BIN){let l=zr+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},nh=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=$e.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(let h in o){let u=oh[h]||h.toLowerCase();a[u]=o[h]}for(let h in e.attributes){let u=oh[h]||h.toLowerCase();if(o[h]!==void 0){let d=n.accessors[e.attributes[h]],f=Ps[d.componentType];l[u]=f.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,d){s.decodeDracoFile(h,function(f){for(let g in f.attributes){let _=f.attributes[g],m=c[g];m!==void 0&&(_.normalized=m)}u(f)},a,l,Ct,d)})})}},ih=class{constructor(){this.name=$e.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}},sh=class{constructor(){this.name=$e.KHR_MESH_QUANTIZATION}},Xa=class extends Vn{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let o=0;o!==s;o++)t[o]=n[r+o];return t}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,h=s-t,u=(n-t)/h,d=u*u,f=d*u,g=e*l,_=g-l,m=-2*f+3*d,p=f-d,E=1-m,S=p-d+u;for(let x=0;x!==a;x++){let R=o[_+x+a],w=o[_+x+c]*h,P=o[g+x+a],T=o[g+x]*h;r[x]=E*R+S*w+m*P+p*T}return r}},gx=new Ft,rh=class extends Xa{interpolate_(e,t,n,s){let r=super.interpolate_(e,t,n,s);return gx.fromArray(r).normalize().toArray(r),r}},ln={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ps={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Od={9728:Rt,9729:Ot,9984:ea,9985:Ms,9986:Oi,9987:xn},Fd={33071:Sn,33648:rs,10497:ri},Nl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oh={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},di={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},_x={CUBICSPLINE:void 0,LINEAR:Ei,STEP:bi},Ul={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xx(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new wt({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:mn})),i.DefaultMaterial}function Vi(i,e,t){for(let n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Ln(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function yx(i,e,t){let n=!1,s=!1,r=!1;for(let l=0,h=e.length;l<h;l++){let u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(i);let o=[],a=[],c=[];for(let l=0,h=e.length;l<h;l++){let u=e[l];if(n){let d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;o.push(d)}if(s){let d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;a.push(d)}if(r){let d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;c.push(d)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let h=l[0],u=l[1],d=l[2];return n&&(i.morphAttributes.position=h),s&&(i.morphAttributes.normal=u),r&&(i.morphAttributes.color=d),i.morphTargetsRelative=!0,i})}function vx(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Mx(i){let e,t=i.extensions&&i.extensions[$e.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ol(t.attributes):e=i.indices+":"+Ol(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=":"+Ol(i.targets[n]);return e}function Ol(i){let e="",t=Object.keys(i).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+i[t[n]]+";";return e}function ah(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Sx(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var bx=new Ve,ch=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new mx,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,r=!1,o=-1;if(typeof navigator<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let c=a.match(/Version\/(\d+)/);s=n&&c?parseInt(c[1],10):-1,r=a.indexOf("Firefox")>-1,o=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||r&&o<98?this.textureLoader=new Pi(this.options.manager):this.textureLoader=new Rr(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new vs(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){let a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:n,userData:{}};return Vi(r,a,s),Ln(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(let c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){let o=t[s].joints;for(let a=0,c=o.length;a<c;a++)e[o[a]].isBone=!0}for(let s=0,r=e.length;s<r;s++){let o=e[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let s=n.clone(),r=(o,a)=>{let c=this.associations.get(o);c!=null&&this.associations.set(a,c);for(let[l,h]of o.children.entries())r(h,a.children[l])};return r(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let s=e(t[n]);if(s)return s}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let s=0;s<t.length;s++){let r=e(t[s]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(r,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[$e.KHR_BINARY_GLTF].body);let s=this.options;return new Promise(function(r,o){n.load(Xn.resolveURL(t.uri,s.path),r,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){let t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){let o=Nl[s.type],a=Ps[s.componentType],c=s.normalized===!0,l=new a(s.count*o);return Promise.resolve(new ut(l,o,c))}let r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(o){let a=o[0],c=Nl[s.type],l=Ps[s.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=s.byteOffset||0,f=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0,_,m;if(f&&f!==u){let p=Math.floor(d/f),E="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+p+":"+s.count,S=t.cache.get(E);S||(_=new l(a,p*f,s.count*f/h),S=new us(_,f/h),t.cache.add(E,S)),m=new ds(S,c,d%f/h,g)}else a===null?_=new l(s.count*c):_=new l(a,d,s.count*c),m=new ut(_,c,g);if(s.sparse!==void 0){let p=Nl.SCALAR,E=Ps[s.sparse.indices.componentType],S=s.sparse.indices.byteOffset||0,x=s.sparse.values.byteOffset||0,R=new E(o[1],S,s.sparse.count*p),w=new l(o[2],x,s.sparse.count*c);a!==null&&(m=new ut(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let P=0,T=R.length;P<T;P++){let y=R[P];if(m.setX(y,w[P*c]),c>=2&&m.setY(y,w[P*c+1]),c>=3&&m.setZ(y,w[P*c+2]),c>=4&&m.setW(y,w[P*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,o=t.images[r],a=this.textureLoader;if(o.uri){let c=n.manager.getHandler(o.uri);c!==null&&(a=c)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let s=this,r=this.json,o=r.textures[e],a=r.images[t],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];let l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);let d=(r.samplers||{})[o.sampler]||{};return h.magFilter=Od[d.magFilter]||Ot,h.minFilter=Od[d.minFilter]||xn,h.wrapS=Fd[d.wrapS]||ri,h.wrapT=Fd[d.wrapT]||ri,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Rt&&h.minFilter!==Ot,s.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){let n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());let o=s.images[e],a=self.URL||self.webkitURL,c=o.uri||"",l=!1;if(o.bufferView!==void 0)c=n.getDependency("bufferView",o.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:o.mimeType});return c=a.createObjectURL(d),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let g=d;t.isImageBitmapLoader===!0&&(g=function(_){let m=new At(_);m.needsUpdate=!0,d(m)}),t.load(Xn.resolveURL(u,r.path),g,void 0,f)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),Ln(u,o),u.userData.mimeType=o.mimeType||Sx(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,s){let r=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),r.extensions[$e.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[$e.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let c=r.associations.get(o);o=r.extensions[$e.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,c)}}return s!==void 0&&(o.colorSpace=s),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,n=e.material,s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,c=this.cache.get(a);c||(c=new gs,Gt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,c=this.cache.get(a);c||(c=new Ai,Gt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||r||o){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),r&&(c.vertexColors=!0),o&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return wt}loadMaterial(e){let t=this,n=this.json,s=this.extensions,r=n.materials[e],o,a={},c=r.extensions||{},l=[];if(c[$e.KHR_MATERIALS_UNLIT]){let u=s[$e.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),l.push(u.extendParams(a,r,t))}else{let u=r.pbrMetallicRoughness||{};if(a.color=new Le(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){let d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],Ct),a.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,mt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=qt);let h=r.alphaMode||Ul.OPAQUE;if(h===Ul.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Ul.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==Bt&&(l.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new ie(1,1),r.normalTexture.scale!==void 0)){let u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&o!==Bt&&(l.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==Bt){let u=r.emissiveFactor;a.emissive=new Le().setRGB(u[0],u[1],u[2],Ct)}return r.emissiveTexture!==void 0&&o!==Bt&&l.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,mt)),Promise.all(l).then(function(){let u=new o(a);return r.name&&(u.name=r.name),Ln(u,r),t.associations.set(u,{materials:e}),r.extensions&&Vi(s,u,r),u})}createUniqueName(e){let t=at.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[$e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Bd(c,a,t)})}let o=[];for(let a=0,c=e.length;a<c;a++){let l=e[a],h=Mx(l),u=s[h];if(u)o.push(u.promise);else{let d;l.extensions&&l.extensions[$e.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=Bd(new Mt,l,t),s[h]={primitive:l,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){let t=this,n=this.json,s=this.extensions,r=n.meshes[e],o=r.primitives,a=[];for(let c=0,l=o.length;c<l;c++){let h=o[c].material===void 0?xx(this.cache):this.getDependency("material",o[c].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(c){let l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,g=h.length;f<g;f++){let _=h[f],m=o[f],p,E=l[f];if(m.mode===ln.TRIANGLES||m.mode===ln.TRIANGLE_STRIP||m.mode===ln.TRIANGLE_FAN||m.mode===void 0)p=r.isSkinnedMesh===!0?new sr(_,E):new ht(_,E),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===ln.TRIANGLE_STRIP?p.geometry=Dl(p.geometry,Fr):m.mode===ln.TRIANGLE_FAN&&(p.geometry=Dl(p.geometry,As));else if(m.mode===ln.LINES)p=new ms(_,E);else if(m.mode===ln.LINE_STRIP)p=new wi(_,E);else if(m.mode===ln.LINE_LOOP)p=new cr(_,E);else if(m.mode===ln.POINTS)p=new lr(_,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&vx(p,r),p.name=t.createUniqueName(r.name||"mesh_"+e),Ln(p,r),m.extensions&&Vi(s,p,m),t.assignFinalMaterial(p),u.push(p)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&Vi(s,u[0],r),u[0];let d=new Lt;r.extensions&&Vi(s,d,r),t.associations.set(d,{meshes:e});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}loadCamera(e){let t,n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new vt(vn.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new Di(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Ln(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;
vendor: 4,374 bytes, line 3832
3832s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){let r=s.pop(),o=s,a=[],c=[];for(let l=0,h=o.length;l<h;l++){let u=o[l];if(u){a.push(u);let d=new Ve;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new or(a,c)})}loadAnimation(e){let t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,o=[],a=[],c=[],l=[],h=[];for(let u=0,d=s.channels.length;u<d;u++){let f=s.channels[u],g=s.samplers[f.sampler],_=f.target,m=_.node,p=s.parameters!==void 0?s.parameters[g.input]:g.input,E=s.parameters!==void 0?s.parameters[g.output]:g.output;_.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",E)),l.push(g),h.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){let d=u[0],f=u[1],g=u[2],_=u[3],m=u[4],p=[];for(let S=0,x=d.length;S<x;S++){let R=d[S],w=f[S],P=g[S],T=_[S],y=m[S];if(R===void 0)continue;R.updateMatrix&&R.updateMatrix();let v=n._createAnimationTracks(R,w,P,T,y);if(v)for(let C=0;C<v.length;C++)p.push(v[C])}let E=new br(r,void 0,p);return Ln(E,s),E})}createNodeMesh(e){let t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){let o=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let c=0,l=s.weights.length;c<l;c++)a.morphTargetInfluences[c]=s.weights[c]}),o})}loadNode(e){let t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),o=[],a=s.children||[];for(let l=0,h=a.length;l<h;l++)o.push(n.getDependency("node",a[l]));let c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),c]).then(function(l){let h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,bx)});for(let f=0,g=u.length;f<g;f++)h.add(u[f]);return h})}_loadNodeShallow(e){let t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],o=r.name?s.createUniqueName(r.name):"",a=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(l){return s._getNodeRef(s.cameraCache,r.camera,l)})),s._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let h;if(r.isBone===!0?h=new fs:l.length>1?h=new Lt:l.length===1?h=l[0]:h=new dt,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=o),Ln(h,r),r.extensions&&Vi(n,h,r),r.matrix!==void 0){let u=new Ve;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!s.associations.has(h))s.associations.set(h,{});else if(r.mesh!==void 0&&s.meshCache.refs[r.mesh]>1){let u=s.associations.get(h);s.associations.set(h,{...u})}return s.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],s=this,r=new Lt;n.name&&(r.name=s.createUniqueName(n.name)),Ln(r,n),n.extensions&&Vi(t,r,n);let o=n.nodes||[],a=[];for(let c=0,l=o.length;c<l;c++)a.push(s.getDependency("node",o[c]));return Promise.all(a).then(function(c){for(let h=0,u=c.length;h<u;h++)r.add(c[h]);let l=h=>{let u=new Map;for(let[d,f]of s.associations)(d instanceof Gt||d instanceof At)&&u.set(d,f);return h.traverse(d=>{let f=s.associations.get(d);f!=null&&u.set(d,f)}),u};return s.associations=l(r),r})}_createAnimationTracks(e,t,n,s,r){let o=[],a=e.name?e.name:e.uuid,c=[];di[r.path]===di.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(a);let l;switch(di[r.path]){case di.weights:l=An;break;case di.rotation:l=wn;break;case di.translation:case di.scale:l=Rn;break;default:n.itemSize===1?l=An:l=Rn;break}let h=s.interpolation!==void 0?_x[s.interpolation]:Ei,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){let g=new l(c[d]+"."+di[r.path],t.array,u,h);
3832s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=ah(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){let s=this instanceof wn?rh:Xa;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function Ex(i,e,t){let n=e.attributes,s=new jt;if(n.POSITION!==void 0){let a=t.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(s.set(new L(c[0],c[1],c[2]),new L(l[0],l[1],l[2])),a.normalized){let h=ah(Ps[a.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=e.targets;if(r!==void 0){let a=new L,c=new L;for(let l=0,h=r.length;l<h;l++){let u=r[l];if(u.POSITION!==void 0){let d=t.json.accessors[u.POSITION],f=d.min,g=d.max;if(f!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),d.normalized){let _=ah(Ps[d.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}i.boundingBox=s;let o=new Vt;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,i.boundingSphere=o}function Bd(i,e,t){let n=e.attributes,s=[];function r(o,a){return t.getDependency("accessor",o).then(function(c){i.setAttribute(a,c)})}for(let o in n){let a=oh[o]||o.toLowerCase();a in i.attributes||s.push(r(n[o],a))}if(e.indices!==void 0&&!i.index){let o=t.getDependency("accessor",e.indices).then(function(a){i.setIndex(a)});s.push(o)}return je.workingColorSpace!==Ct&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${je.workingColorSpace}" not supported.`),Ln(i,e),Ex(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?yx(i,e.targets,t):i})}var Tx=Object.freeze({wheelSpacing:.42545,rearAxleZ:.212725,axleHeight:.11,flipperLength:.33655,flipperRollerRadius:.029,trackCenterX:.205});function kd({scale:i=1,finish:e=4542813,faceColor:t=6094699}={}){let n=new Lt;n.name="ROB";let s={body:new wt({color:e,metalness:.65,roughness:.42}),aluminum:new wt({color:11056058,metalness:.75,roughness:.32}),rubber:new wt({color:1382944,roughness:.9}),polymer:new wt({color:3159611,roughness:.64}),blue:new wt({color:3566234,metalness:.6,roughness:.4}),lens:new wt({color:465442,metalness:.6,roughness:.12}),face:new wt({color:t,emissive:t,emissiveIntensity:.35})};Object.entries(s).forEach(([T,y])=>{y.name=T});let r=(T,y,v=[0,0,0])=>{let C=new Lt;return C.name=T,C.position.fromArray(v),y.add(C),C},o=(T,y,v,C,D=[0,0,0],U=[0,0,0])=>{let B=new ht(y,s[v]);return B.name=T,B.position.fromArray(D),B.rotation.set(...U),B.castShadow=!0,B.receiveShadow=!0,C.add(B),B},a=(T,y,v,C,D)=>o(T,new an(...y),C,D,v),c=(T,y,v,C,D,U,B="y")=>o(T,new dr(y,y,v,16),D,U,C,B==="x"?[0,0,Math.PI/2]:B==="z"?[Math.PI/2,0,0]:[0,0,0]),l=(T,y,v,C,D,U)=>{let B=new L(...y),G=new L(...v),V=G.clone().sub(B),J=c(T,C,V.length(),B.add(G).multiplyScalar(.5).toArray(),D,U);return J.quaternion.setFromUnitVectors(new L(0,1,0),V.normalize()),J},{rearAxleZ:h,axleHeight:u,flipperLength:d,flipperRollerRadius:f,trackCenterX:g}=Tx,_=r("Drive Base Assembly",n,[0,0,h]);a("Tri-Wheel Chassis",[.32,.13,.42],[0,.205,-h],"body",_);let m=a("Sloped Front Hood",[.325,.035,.23],[0,.28,-.3],"body",_);m.rotation.x=-.27;for(let T of[-1,1]){let y=T<0?"Left":"Right",v=r(`${y} Tri-Wheel Tread`,_,[T*g,0,-h]),C=[[-.28,.038],[.275,.038],[.301,.12],[.133,.353],[.035,.383],[-.284,.155]];C.forEach(([D,U],B)=>{let[G,V]=C[(B+1)%C.length],J=G-D,H=V-U,ce=Math.hypot(J,H),fe=-Math.atan2(H,J),ye=a(`${y} Track Belt Segment ${B+1}`,[.085,.02,ce+.008],[0,(U+V)/2,(D+G)/2],"rubber",v);ye.rotation.x=fe;let Ue=Math.ceil(ce/.043);for(let Be=0;Be<Ue;Be+=1){let Ze=(Be+.5)/Ue,qe=a(`${y} Tread Shoe ${B}-${Be}`,[.096,.03,.029],[0,U+H*Ze,D+J*Ze],"polymer",v);qe.rotation.x=fe}}
3832),[[-.212725,u,.078],[.065,.302,.073],[h,u,.078]].forEach(([D,U,B],G)=>{let V=r(`${y} Tri-Wheel ${G+1}`,v,[0,U,D]);c(`${y} Wheel Tire ${G}`,B,.081,[0,0,0],"rubber",V,"x"),c(`${y} Wheel Rim ${G}`,B*.84,.087,[0,0,0],"aluminum",V,"x"),c(`${y} Wheel Hub ${G}`,.02,.098,[0,0,0],"polymer",V,"x");for(let J=0;J<5;J+=1){let H=J*Math.PI*2/5;c(`${y} Rim Recess ${G}-${J}`,.017,.002,[T*.0445,Math.sin(H)*.041,Math.cos(H)*.041],"rubber",V,"x")}})}let p=r("Base Lift Flipper Assembly",_,[0,u,0]);for(let T of[-1,1]){let y=T<0?"Left":"Right",v=r(`${y} Base Lift Flipper Arm`,p,[T*.269,0,0]),C=new xs;C.moveTo(-d,-.029),C.lineTo(.018,-.042),C.quadraticCurveTo(.049,0,.018,.042),C.lineTo(-d,.029),C.quadraticCurveTo(-d-.03,0,-d,-.029);for(let U=1;U<=4;U+=1){let B=new Ri;B.absarc(-U*.067,0,.021,0,Math.PI*2,!0),C.holes.push(B)}let D=new vr(C,{depth:.014,bevelEnabled:!1,curveSegments:8});D.translate(0,0,-.007),D.rotateY(-Math.PI/2),o(`${y} Perforated UHMW Flipper`,D,"polymer",v),c(`${y} Flipper Axle Cap`,.033,.027,[0,0,0],"aluminum",v,"x"),c(`${y} Flipper End Roller`,f,.038,[0,0,-d],"rubber",v,"x"),c(`${y} Flipper Roller Hub`,.012,.041,[0,0,-d],"aluminum",v,"x")}let E=r("Torso Assembly",n),S=r("Right Shoulder Gatling",E,[.2,.95,.13]),x=r("Gatling Tilt Servo",S);r("Captured Shoulder Laser",x),r("Shoulder Laser Muzzle",x,[0,.105,-.055]),c("Waist Bearing",.104,.044,[0,.51,.035],"aluminum",E);for(let T of[-.09,.09])l("Open Waist Frame",[T,.31,.02],[T,.53,.07],.015,"aluminum",E),l("Torso Linear Actuator",[T*.6,.3,-.08],[T*.6,.52,.055],.014,"aluminum",E);a("Belly Compute",[.26,.1,.205],[0,.58,.012],"body",E),a("Cerebro Torso",[.32,.29,.205],[0,.765,.012],"body",E),a("Chest Bezel",[.302,.268,.014],[0,.77,-.099],"polymer",E);for(let T of[-1,1]){let y=T<0?"Left":"Right",v=T*.078;c(`${y} ROB Speaker Ring`,.065,.018,[v,.79,-.116],"rubber",E,"z"),c(`${y} ROB Speaker Cone`,.048,.012,[v,.79,-.129],"aluminum",E,"z"),c(`${y} Speaker Dust Cap`,.019,.016,[v,.79,-.139],"polymer",E,"z");for(let C of[.65,.883])c(`${y} Chest Fastener ${C}`,.007,.004,[T*.14,C,-.111],"aluminum",E,"z")}a("Chest Status Panel",[.1,.022,.014],[0,.692,-.113],"rubber",E),a("Depth Camera",[.105,.032,.045],[0,.576,-.116],"aluminum",E);for(let T of[-.037,0,.037])c("Belly Camera Lens",.008,.005,[T,.576,-.141],"lens",E,"z");let R=r("Neck Pan",E,[0,.913,.02]);c("Neck Base",.047,.052,[0,.012,0],"rubber",R);for(let T of[-.025,.025])l("Open Neck Rail",[T,.025,0],[T,.242,.025],.01,"aluminum",R);l("Neck Cable",[0,.018,.023],[0,.242,.048],.009,"rubber",R);for(let T of[.053,.237])c("Neck Pitch Pivot",.025,.079,[0,T,.02],"aluminum",R,"x");let w=r("Camera Head Pivot",R,[0,.3,.008]);o("Camera Head",new Mr(.08,1),"body",w).scale.set(1,1.12,.94);for(let T of[-1,1]){let y=r(`${T<0?"Left":"Right"} Camera Eye`,w,[T*.039,-.004,-.058]);y.rotation.y=T*-.26,c("Eye Lens Bezel",.026,.014,[0,0,0],"aluminum",y,"z"),c("Optical Lens",.018,.018,[0,0,-.009],"lens",y,"z"),c(T<0?"Face Smiley Left Eye":"Face Smiley Right Eye",.005,.002,[0,.002,-.019],"face",y,"z"),l("Head Antenna",[T*.042,.06,.01],[T*.065,.16,.012],.0025,"aluminum",w)}a("Head Depth Camera",[.105,.027,.036],[0,-.07,-.034],"polymer",w);for(let T of[-.033,.033])c("Head Depth Lens",.009,.004,[T,-.07,-.054],"lens",w,"z");for(let T=0;T<5;T+=1)a(["Face Smiley Left Corner","Face Smiley Left Smile","Face Smiley Center Smile","Face Smiley Right Smile","Face Smiley Right Corner"][T],[.007,.003,.002],[(T-2)*.01,-.046,-.065],"face",w);for(let T of[-1,1]){let y=T<0?"Left":"Right",v=r(`${y} Arm Assembly`,E,[T*.208,.962,.018]);v.userData.side=T;let C=[[0,0,0],[T*.037,-.078,0],[T*.066,-.177,-.003],[T*.08,-.243,-.004],[T*.074,-.315,-.006],[T*.089,-.408,-.012],[T*.084,-.479,-.013]];C.forEach((D,U)=>{if(c(`${y} AMBER Joint ${U+1}`,U<3?.043:.03,U%2?.067:.06,D,"aluminum",v,U%2?"y":"z"),U%2===0&&c(`${y} AMBER Blue Cap ${U}`,U<3?.036:.023,.007,[D[0],D[1],D[2]-.035],"blue",v,"z"),U<C.length-1){let B=C[U+1];for(let G of[-.025,.025]){let V=l(`${y} Link ${U}-${G}`,[D[0],D[1],D[2]+G],[B[0],B[1],B[2]+G],.009,"aluminum",v);if(U===1||U===4){let J=Math.hypot(...B.map((H,ce)=>H-D[ce]));V.geometry.dispose(),V.geometry=new an(.038,J,.012),G<0&&(V.name=`${y} ${U===1?"Upper Arm":"Forearm"}`,V.material=s.body)}}}}),a(`${y} Gripper Palm`,[.046,.04,.037],[T*.084,-.527,-.013],"polymer",v);for(let D of[-1,1]){let U=a(`${y} Gripper Finger ${D}`,[.012,.063,.015],[T*.084+D*.021,-.574,-.018],"aluminum",v);U.rotation.z=D*-.14}}return i!==1&&n.traverse(T=>{T.position.multiplyScalar(i),T.isMesh&&T.geometry.scale(i,i,i)}),{root:n,materials:s,driveBase:_,baseFlipper:p,torso:E,neckPan:R,cameraHead:w,arms:["Left","Right"].map(T=>n.getObjectByName(`${T} Arm Assembly`)),speakerCones:["Left","Right"].map(T=>n.getObjectByName(`${T} ROB Speaker Cone`)),treadWheels:[-1,1].flatMap(T=>[1,2,3].map(y=>({side:T<0?"left":"right",wheel:n.getObjectByName(`${T<0?"Left":"Right"} Tri-Wheel ${y}`)})))}}var Kn=-Math.PI*.3,qa=0,Ya=Math.PI*1.15,Ls=.42545,Ax=4.8,yM=Math.abs(qa-Kn)/Ax,wx=(i,e=!1)=>i==="forward"?Kn:e?Ya:qa,Rx=i=>Math.max(0,Math.min(1,(i-qa)/(Kn-qa)));var Ds=i=>{let e=.11+.33655*Math.sin(i),t=.33655*Math.cos(i);return e>=.029||t<=0||i>=0?0:Math.max(0,Math.min(.85,Math.asin(.029/Math.hypot(e,t))-Math.atan2(e,t)))};var lh=({angle:i,target:e="rear",onLedge:t=!1,climbProgress:n,stepHeight:s=0,supportHeight:r=t?s:0,scale:o=1})=>{let a=Number.isFinite(n),c=Rx(i),l=Math.abs(i-wx(e,a))>.005,h=t&&!a&&!l&&Math.abs(i)<.005,u=Ds(i),d=r;if(a){let f=Ls*o,g=Math.asin(Math.min(1,s/f)),_=Math.max(0,Math.min(1,(n-.75)/.25)),m=g*(1-_*_*(3-2*_));if(i<=0)u=Math.max(m,Ds(i));else{let p=g,E=S=>
3832s-f*Math.sin(S)+o*(.11*Math.cos(S)+.33655*Math.sin(i+S)-.029);if(i>Math.PI/2&&E(p)<0){let S=0,x=p;for(let R=0;R<24;R++){let w=(S+x)/2;E(w)>=0?S=w:x=w}p=S}u=Math.min(m,p)}d=Math.max(0,s-Ls*o*Math.sin(u))}return{active:l,phase:c,angle:i,lift:d,pitch:u,stabilized:h,climbing:a}};var vM=Math.PI/5;var Ka=Object.freeze({x:0,y:.375,z:.065}),Hd=Object.freeze({x:0,y:.78,z:.012}),Cx=Object.freeze({x:0,y:.3,z:-.08}),Ix=Object.freeze({x:0,y:.3+Math.sqrt(.20955**2-.135**2),z:.055});var hh=(i,e)=>({x:i.x,y:i.y*Math.cos(e)-i.z*Math.sin(e),z:i.y*Math.sin(e)+i.z*Math.cos(e)}),Px=(i,e)=>({x:i.x*Math.cos(e)+i.z*Math.sin(e),y:i.y,z:-i.x*Math.sin(e)+i.z*Math.cos(e)}),kr=(i,e)=>({x:i.x-e.x,y:i.y-e.y,z:i.z-e.z}),Za=(i,e)=>({x:i.x+e.x,y:i.y+e.y,z:i.z+e.z}),Lx=(i,e)=>({x:i.x*e,y:i.y*e,z:i.z*e});var Vd=i=>{let t=.212725-.42545*Math.cos(i),n=Za(hh(kr(Ka,{x:0,y:0,z:.212725}),i),{x:0,y:0,z:.212725}),s=kr(Hd,Ka),r=n.z+s.z,o=Math.max(t+.07,Math.min(.212725-.07,r)),a=Math.abs(o-r)<1e-9?0:Math.asin(Math.max(-1,Math.min(1,(o-n.z)/Math.hypot(s.y,s.z))))-Math.atan2(s.z,s.y);return Math.max(-1.45,Math.min(1.15,a-i))};var Gd=({basePitch:i,leanAngle:e,rearHeight:t=0,rootHeight:n=0,scale:s=1,yaw:r=0})=>{let o={x:0,y:0,z:.212725},a=i+e,c=p=>Za(hh(kr(p,o),i),o),l=c(Ka),h=p=>hh(Px(p,r),a),u=kr(l,h(Ka)),d=Lx(u,s);d.y+=t-n;let f=c(Cx),g=Za(u,h(Ix)),_=kr(g,f),m=Za(u,h(Hd));return{position:d,pitch:a,fixedPin:f,movingPin:g,massCenter:m,lactLength:Math.hypot(_.x,_.y,_.z)}};var kt=Object.freeze({width:1.6,depth:1.34,height:.24,edgeZ:-.3}),$n=11.5,Wd=.212725,$a=.65,Dx=Ls*Math.cos(Ds(Kn)),Ns=kt.edgeZ+Dx-Wd+.02,uh=kt.edgeZ-Wd,dh=i=>{let e=Math.max(0,Math.min(1,i));return e*e*(3-2*e)},Hr=(i,e,t)=>i+(e-i)*dh(t);function Xd(i=0){let{pitch:e,lift:t}=lh({angle:i});if(i>Math.PI&&.11+.33655*Math.sin(i)<.029){let n=o=>-Ls*Math.sin(o)+.11*Math.cos(o)+.33655*Math.sin(i+o)-.029,s=-.6,r=0;for(let o=0;o<30;o++){let a=(s+r)/2;n(a)>=0?s=a:r=a}e=s,t=-Ls*Math.sin(e)}return{angle:i,pitch:e,lift:t,z:$a,wheelTravel:0,stage:"Manual flippers",detail
3832:"The grounded tread end stays planted while the torso counter-leans above the upper wheel."}}function qd(i=0){let e=Math.max(0,Math.min($n,i)),t=0,n=$a,s=0,r=0,o,a;if(e<1.5)o="1 \xB7 Approach the ledge",a="ROB approaches on level treads.",n=Hr($a,Ns+.24,e/1.5);else if(e<3)o="2 \xB7 Lift the front",a="Flippers push down. The rear stays grounded and the torso leans forward to balance.",n=Ns+.24,t=Hr(0,Kn,(e-1.5)/1.5),s=Ds(t);else if(e<4.6)o="3 \xB7 Mount the front treads",a="ROB moves forward with its front treads raised above the lip.",n=Hr(Ns+.24,Ns,(e-3)/1.6),t=Kn,s=Ds(t);else if(e<8.4){o="4 \xB7 Reverse and lift the rear",a="The flippers counter-rotate to provide rear support as ROB mounts the platform.";let c=dh((e-4.6)/3.8);t=Kn+(Ya-Kn)*c;let l=dh((c-.24)/.76);n=Ns+(uh-Ns)*l,{pitch:s,lift:r}=lh({angle:t,target:"rear",climbProgress:l,stepHeight:kt.height})}else e<9.7?(o="5 \xB7 Level and stow",a="Both tread ends are supported. The torso returns upright and the flippers tuck away.",n=uh,r=kt.height,t=Hr(Ya,0,(e-8.4)/1.3)):(o=e<$n?"6 \xB7 Drive onto the platform":"Climb complete \xB7 ROB is level",a="ROB continues forward with level treads and an upright torso.",n=Hr(uh,-1.08,(e-9.7)/1.8),r=kt.height);return{angle:t,pitch:s,lift:r,z:n,wheelTravel:$a-n,stage:o,detail:a}}function Yd(i,e){i.root.position.set(0,0,e.z),i.driveBase.rotation.x=e.pitch,i.driveBase.position.y=e.lift,i.baseFlipper.rotation.x=e.angle;let t=Vd(e.pitch),n=Gd({basePitch:e.pitch,leanAngle:t,rearHeight:e.lift});return i.torso.rotation.x=n.pitch,i.torso.position.set(n.position.x,n.position.y,n.position.z),i.treadWheels.forEach(({wheel:s})=>{s.rotation.x=-e.wheelTravel/.078}),{leanAngle:t,torso:n}}function Zd(i,e,t){i.root.getObjectByName("Right Shoulder Gatling").rotation.y=e,i.root.getObjectByName("Gatling Tilt Servo").rotation.x=t}document.querySelectorAll("[data-rob-showcase]").forEach(i=>{let e=i.querySelector("[data-model-viewport]"),t=i.querySelector("[data-model-poster]"),n=i.querySelector("[data-model-status]"),s=i.querySelector("[data-model-pose]"),r=i.querySelector("[data-model-rotate]"),o=i.querySelector("[data-model-flipper]"),a=i.querySelector("[data-model-rig-controls]"),c=i.querySelector("[data-model-laser-pan]"),l=i.querySelector("[data-model-laser-tilt]"),h=i.querySelector("[data-model-laser-scan]"),u=i.querySelector("[data-model-climb]"),d=i.querySelector("[data-model-progress]"),f=i.querySelector("[data-model-stage]"),g=i.querySelector("[data-model-balance]"),_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,m,p,E,S,x=0,R=!1,w=!0,P,T=!1,y=!1,v=0,C=!_,D=0,U=new ir;U.background=new Le(659996);let B=new vt(38,1,.01,30),G=new Wa;U.add(new Er(15004415,5399156,3));let V=new ai(16777215,4);V.position.set(2,3,-3),U.add(V);let J=new ai(8765439,3);J.position.set(-2,2,2),U.add(J);let H=new Lt;H.visible=!1,U.add(H);let ce=new ht(new Ii(4,4.8),new wt({color:1188657,roughness:.95}));ce.rotation.x=-Math.PI/2,ce.position.set(0,-.003,-.45),H.add(ce);let fe=new Ir(4,20,3233134,2112333);fe.position.set(0,.001,-.45),H.add(fe);let ye=new ht(new an(kt.width,kt.height,kt.depth),new wt({color:2836058,metalness:.25,roughness:.7}));ye.position.set(0,kt.height/2,kt.edgeZ-kt.depth/2),H.add(ye);let Ue=new ht(new an(kt.width,.018,.028),new Bt({color:16758858}));Ue.position.set(0,kt.height+.009,kt.edgeZ-.014),H.add(Ue);let Be=Ie=>{let I=new Set,j=new Set,$=new Set;Ie?.traverse(k=>{k.geometry&&I.add(k.geometry),(Array.isArray(k.material)?k.material:k.material?[k.material]:[]).forEach(Z=>{j.add(Z),Object.values(Z).forEach(ne=>{ne?.isTexture&&$.add(ne)})})}),I.forEach(k=>k.dispose()),j.forEach(k=>k.dispose()),$.forEach(k=>k.dispose())},Ze=()=>{r.setAttribute("aria-pressed",String(p.autoRotate)),r.textContent=p.autoRotate?"Pause view rotation":"Rotate view"};function qe(){S?(B.position.set(2.45,1.35,-2.4),p.target.set(0,.66,-.22)):(B.position.set(1.25,1.04,2.6),p.target.set(0,.7,0)),p.update()}let K=(Ie,I)=>{Ie.textContent!==I&&(Ie.textContent=I)};function ee(){if(!S)return;let Ie=y?qd(v):Xd(Number(o.value)*Math.PI/180),{leanAngle:I}=Yd(S,Ie);y&&(o.value=String(Ie.angle*180/Math.PI)),K(i.querySelector("[data-model-angle]"),`${Math.round(Ie.angle*180/Math.PI)}\xB0`),K(g,`Chassis ${Math.round(Ie.pitch*180/Math.PI)}\xB0 \xB7 Body counter-lean ${Math.round(I*180/Math.PI)}\xB0`),K(f,y?Ie.stage:"Explore ROB\u2019s moving joints"),d.value=String(y?v:0),d.setAttribute("aria-valuetext",`${Math.round(v/$n*100)}% \xB7 ${Ie.stage}`),K(i.querySelector("[data-model-progress-text]"),`${Math.round(v/$n*100)}%`),u.textContent=T?"Pause climb":v>=$n?"Replay climb":y?"Resume climb":"Watch ROB climb",u.setAttribute("aria-pressed",String(T)),y&&K(n,Ie.detail)}function xe(Ie=0){S&&(C&&(c.value=String(vn.damp(Number(c.value),Math.sin(D*.7)*.9*180/Math.PI,6,Ie)),l.value=String(vn.damp(Number(l.value),Math.sin(D*.43)*.13*180/Math.PI,6,Ie))),Zd(S,Number(c.value)*
3832Math.PI/180,Number(l.value)*Math.PI/180),K(i.querySelector("[data-model-pan-angle]"),`${Math.round(Number(c.value))}\xB0`),K(i.querySelector("[data-model-tilt-angle]"),`${Math.round(Number(l.value))}\xB0`),h.setAttribute("aria-pressed",String(C)),h.textContent=C?"Pause laser scan":"Scan shoulder laser")}function Re(){T=y=!1,v=0,o.value=c.value=l.value="0",D=0,ee(),xe(),n.textContent="Move the shoulder laser or flippers, or watch ROB climb. Drag to orbit; scroll or pinch to zoom."}function Me(Ie){E&&(U.remove(E),Be(E)),E=Ie,U.add(E),qe(),t.hidden=!0}async function Ke(){let Ie=++x;if(T=!1,e.setAttribute("aria-busy","true"),a.hidden=s.value!=="rig",H.visible=s.value==="rig",f.hidden=s.value!=="rig",s.value==="rig"){S=kd();let I=S;Me(S.root),Re(),p.autoRotate=!1,Ze(),n.textContent="Loading ROB\u2019s captured surfaces\u2026";try{if(await Pd(I,i.dataset.modelBase),Ie!==x||R){Be(I.root);return}n.textContent="Move the shoulder laser or flippers, or watch ROB climb. Drag to orbit; scroll or pinch to zoom."}catch{if(Ie!==x||R)return;n.textContent="The captured surfaces could not load. The motion controls still work on the simplified robot."}finally{Ie===x&&e.setAttribute("aria-busy","false")}return}S=void 0,n.textContent="Loading ROB\u2019s scan\u2026";try{let I=await G.loadAsync(`${i.dataset.modelBase}${s.value}.glb`);if(Ie!==x||R){Be(I.scene);return}Me(I.scene),n.textContent="Drag to orbit \xB7 scroll or pinch to zoom. Arrow keys rotate; + and \u2212 zoom."}catch{if(Ie!==x||R)return;n.textContent="The scan could not load. Try another pose or choose the interactive robot."}finally{Ie===x&&e.setAttribute("aria-busy","false")}}try{let j=function(){if(R||!w||document.hidden){P=void 0;return}P=requestAnimationFrame(j);let k=Math.min(I.getDelta(),.05);S&&(T&&(v=Math.min($n,v+k),v>=$n&&(T=!1),ee()),C&&(D+=k,xe(k))),p.update(k),m.render(U,B)};m=new ka({antialias:!0,alpha:!1}),m.setPixelRatio(Math.min(window.devicePixelRatio,2)),m.outputColorSpace=mt,m.domElement.setAttribute("aria-label","Interactive ROB with shoulder laser, balanced flippers, and a ledge-climbing demonstration"),m.domElement.tabIndex=0,e.append(m.domElement),p=new Ga(B,m.domElement),p.enableDamping=!0,p.enablePan=!1,p.minDistance=1,p.maxDistance=5,p.maxPolarAngle=Math.PI*.88,p.autoRotate=!_,p.autoRotateSpeed=.6,Ze(),p.addEventListener("start",()=>{p.autoRotate=!1,Ze()});let Ie=new ResizeObserver(()=>{let k=e.clientWidth,Z=e.clientHeight;!k||!Z||(m.setSize(k,Z,!1),B.aspect=k/Z,B.updateProjectionMatrix())});Ie.observe(e);let I=new Cr,$=new IntersectionObserver(([k])=>{w=k.isIntersecting,w&&!P&&j()});$.observe(i),document.addEventListener("visibilitychange",()=>{!document.hidden&&!P&&j()}),s.addEventListener("change",Ke),i.querySelector("[data-model-reset]").addEventListener("click",qe),i.querySelector("[data-model-reset-pose]").addEventListener("click",Re),r.addEventListener("click",()=>{p.autoRotate=!p.autoRotate,Ze()}),h.addEventListener("click",()=>{C=!C,C&&(D=Math.asin(vn.clamp(Number(c.value)*Math.PI/180/.9,-1,1))/.7),xe()}),[c,l].forEach(k=>k.addEventListener("input",()=>{C=!1,xe()})),o.addEventListener("input",()=>{S&&(T=y=!1,v=0,ee(),n.textContent="The grounded tread end stays planted while ROB\u2019s torso counter-leans above the upper wheel.")}),u.addEventListener("click",()=>{S&&((!y||v>=$n)&&(v=0),y=!0,T=!T,p.autoRotate=!1,Ze(),ee())}),d.addEventListener("input",()=>{S&&(T=!1,y=!0,v=Number(d.value),ee())}),m.domElement.addEventListener("keydown",k=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","+","=","-","Home"].includes(k.key))return;if(k.preventDefault(),p.autoRotate=!1,Ze(),k.key==="Home"){qe();return}let Z=B.position.clone().sub(p.target),ne=new ci().setFromVector3(Z);k.key==="ArrowLeft"&&(ne.theta-=.15),k.key==="ArrowRight"&&(ne.theta+=.15),k.key==="ArrowUp"&&(ne.phi-=.1),k.key==="ArrowDown"&&(ne.phi+=.1),["+","="].includes(k.key)&&(ne.radius*=.9),k.key==="-"&&(ne.radius*=1.1),ne.phi=vn.clamp(ne.phi,.1,Math.PI*.88),ne.radius=vn.clamp(ne.radius,1,5),B.position.copy(p.target).add(new L().setFromSpherical(ne)),p.update()}),m.domElement.addEventListener("webglcontextlost",k=>{k.preventDefault(),R=!0,cancelAnimationFrame(P),t.hidden=!1,n.textContent="The 3D view was interrupted. Reload this page to explore ROB again."}),window.addEventListener("pageshow",k=>{k.persisted&&!P&&j()}),window.addEventListener("pagehide",k=>{if(k.persisted){cancelAnimationFrame(P),P=void 0;return}R=!0,x+=1,cancelAnimationFrame(P),Ie.disconnect(),$.disconnect(),p.dispose(),Be(E),Be(H),m.dispose()}),qe(),Ke(),j()}
3832catch{m?.dispose(),i.querySelector("[data-model-controls]").hidden=!0,n.textContent="ROB\u2019s scan is shown above. Interactive 3D is unavailable in this browser."}}); 3833/*! Bundled license information: 3834 3835three/build/three.core.js: 3836three/build/three.module.js: 3837 (** 3838 * @license 3839 * Copyright 2010-2025 Three.js Authors 3840 * SPDX-License-Identifier: MIT 3841 *) 3842*/
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.