PageSourceSearch

https://www.audemarspiguet.com/etc.clientlibs/ap-com/ui/clientlibs…1_dist_asset-e0ae02.99d23b178000645f7335.js

js audemarspiguet.com collected 2026-10-02 03:05:15 UTC 980,124 bytes, 2 lines download raw bytes

1/*! License information can be found in resources/licenses/vendors-node_modules_audemarspiguet_needle-3d-players_players_15245OR_OO_A206VE_01_dist_asset-e0ae02.99d23b178000645f7335.js.LICENSE.txt */
2"use strict";(self.webpackChunkap_com=self.webpackChunkap_com||[]).push([["vendors-node_modules_audemarspiguet_needle-3d-players_players_15245OR_OO_A206VE_01_dist_asset-e0ae02"],{16498:function(e,t,n){n.d(t,{A:function(){return wl},B:function(){return pr},C:function(){return Nc},D:function(){return Os},E:function(){return Lt},I:function(){return Xo},M:function(){return wr},P:function(){return Vr},S:function(){return Hn},T:function(){return mn},U:function(){return Wd},V:function(){return Mn},W:function(){return vn},X:function(){return _n},_:function(){return To},a:function(){return Sn},a$:function(){return fh},a1:function(){return Rh},a3:function(){return Lh},a4:function(){return Uh},a5:function(){return sh},a6:function(){return Xi},aA:function(){return Cl},aB:function(){return Si},aC:function(){return dd},aD:function(){return vc},aE:function(){return ic},aF:function(){return Bd},aG:function(){return Tl},aH:function(){return fc},aI:function(){return hc},aJ:function(){return gc},aK:function(){return bc},aL:function(){return Po},aN:function(){return Al},aO:function(){return Eh},aP:function(){return Sl},aS:function(){return xn},aY:function(){return Nh},aZ:function(){return bh},a_:function(){return Sh},ae:function(){return us},af:function(){return ju},ag:function(){return qi},ah:function(){return Zp},ai:function(){return Nw},ak:function(){return ww},al:function(){return fR},au:function(){return sd},av:function(){return Xh},aw:function(){return Jh},ax:function(){return Qh},ay:function(){return nh},az:function(){return Vl},b:function(){return jt},b$:function(){return Lo},b0:function(){return Ac},b1:function(){return Ec},bA:function(){return nr},bB:function(){return Ou},bD:function(){return $n},bE:function(){return jr},bH:function(){return Jd},bI:function(){return Ho},bJ:function(){return hn},bK:function(){return ad},bL:function(){return Xd},bM:function(){return $u},bN:function(){return np},bO:function(){return li},bQ:function(){return Fi},bS:function(){return Qu},bT:function(){return bp},bU:function(){return hp},bV:function(){return Np},bW:function(){return Zo},bX:function(){return cl},bY:function(){return uu},bZ:function(){return Wo},b_:function(){return cu},bi:function(){return zu},bj:function(){return Ep},bk:function(){return Yd},bl:function(){return oi},bm:function(){return tu},bn:function(){return Er},bo:function(){return sr},bp:function(){return Hu},bq:function(){return qu},br:function(){return Ap},bs:function(){return Jr},bt:function(){return Vh},bv:function(){return Rc},bw:function(){return ih},bx:function(){return ah},bz:function(){return ed},c:function(){return Yo},c$:function(){return Mh},c0:function(){return kr},c1:function(){return zr},c2:function(){return _h},c8:function(){return yR},cA:function(){return eh},cC:function(){return nc},cD:function(){return xR},cE:function(){return Gu},cF:function(){return Mp},cG:function(){return fp},cH:function(){return yp},cI:function(){return pl},cM:function(){return Sc},cP:function(){return Fc},cQ:function(){return Ed},cR:function(){return md},cS:function(){return bs},cb:function(){return Gd},cc:function(){return Yr},cd:function(){return Nd},ce:function(){return Ld},cf:function(){return fd},cy:function(){return Br},cz:function(){return Bh},d:function(){return tr},d0:function(){return xh},e:function(){return Fh},f:function(){return Jn},g:function(){return xd},h:function(){return th},i:function(){return jo},j:function(){return Pr},l:function(){return Lr},o:function(){return Wt},v:function(){return Cc},x:function(){return fn},y:function(){return Gi}});const i="169",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=0,o=1,l=2,c=100,u=101,h=102,d=200,p=201,m=202,f=203,g=204,v=205,y=206,_=207,x=208,M=209,b=210,T=211,S=212,w=213,N=214,E=0,A=1,C=2,R=3,I=4,L=5,P=6,D=7,U="attached",O="detached",V=300,F=301,z=302,B=303,k=304,H=306,G=1e3,W=1001,j=1002,X=1003,q=1004,Y=1005,Z=1006,$=1007,J=1008,K=1009,Q=1010,ee=1011,te=1012,ne=1013,ie=1014,re=1015,se=1016,ae=1017,oe=1018,le=1020,ce=35902,ue=35899,he=1021,de=1022,pe=1023,me=1024,fe=1025,ge=1026,ve=1027,ye=1028,_e=1029,xe=1030,Me=1031,be=1033,Te=33776,Se=33777,we=33778,Ne=33779,Ee=35840,Ae=35841,Ce=35842,Re=35843,Ie=36196,Le=37492,Pe=37496,De=37808,Ue=37809,Oe=37810,Ve=37811,Fe=37812,ze=37813,Be
vendor: 6,138 bytes, line 2
2=37814,ke=37815,He=37816,Ge=37817,We=37818,je=37819,Xe=37820,qe=37821,Ye=36492,Ze=36494,$e=36495,Je=36283,Ke=36284,Qe=36285,et=36286,tt=2300,nt=2301,it=2302,rt=2400,st=2401,at=2402,ot=2500,lt=2501,ct="",ut="srgb",ht="srgb-linear",dt="display-p3",pt="display-p3-linear",mt="linear",ft="srgb",gt="rec709",vt="p3",yt=7680,_t=512,xt=513,Mt=514,bt=515,Tt=516,St=517,wt=518,Nt=519,Et=35044,At=35048,Ct="300 es",Rt=2e3,It=2001;class Lt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const Pt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Dt=1234567;const Ut=Math.PI/180,Ot=180/Math.PI;function Vt(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Pt[255&e]+Pt[e>>8&255]+Pt[e>>16&255]+Pt[e>>24&255]+"-"+Pt[255&t]+Pt[t>>8&255]+"-"+Pt[t>>16&15|64]+Pt[t>>24&255]+"-"+Pt[63&n|128]+Pt[n>>8&255]+"-"+Pt[n>>16&255]+Pt[n>>24&255]+Pt[255&i]+Pt[i>>8&255]+Pt[i>>16&255]+Pt[i>>24&255]).toLowerCase()}function Ft(e,t,n){return Math.max(t,Math.min(n,e))}function zt(e,t){return(e%t+t)%t}function Bt(e,t,n){return(1-n)*e+n*t}function kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Ht(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Gt={DEG2RAD:Ut,RAD2DEG:Ot,generateUUID:Vt,clamp:Ft,euclideanModulo:zt,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Bt,damp:function(e,t,n,i){return Bt(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(zt(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(Dt=e);let t=Dt+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Ut},radToDeg:function(e){return e*Ot},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((t+i)/2),u=a((t+i)/2),h=s((t-i)/2),d=a((t-i)/2),p=s((i-t)/2),m=a((i-t)/2);switch(r){case"XYX":e.set(o*u,l*h,l*d,o*c);break;case"YZY":e.set(l*d,o*u,l*h,o*c);break;case"ZXZ":e.set(l*h,l*d,o*u,o*c);break;case"XZX":e.set(o*u,l*m,l*p,o*c);break;case"YXY":e.set(l*p,o*u,l*m,o*c);break;case"ZYZ":e.set(l*m,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Ht,denormalize:kt};class Wt{constructor(e=0,t=0){Wt.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}
vendor: 31,651 bytes, line 2
2sub(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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class jt{constructor(e,t,n,i,r,s,a,o,l){jt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,a,o,l)}set(e,t,n,i,r,s,a,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],_=i[7],x=i[2],M=i[5],b=i[8];return r[0]=s*m+a*v+o*x,r[3]=s*f+a*y+o*M,r[6]=s*g+a*_+o*b,r[1]=l*m+c*v+u*x,r[4]=l*f+c*y+u*M,r[7]=l*g+c*_+u*b,r[2]=h*m+d*v+p*x,r[5]=h*f+d*y+p*M,r[8]=h*g+d*_+p*b,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],c=e[8];return t*s*c-t*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],c=e[8],u=c*s-a*l,h=a*o-c*r,d=l*r-s*o,p=t*u+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=u*m,e[1]=(i*l-c*n)*m,e[2]=(a*n-i*s)*m,e[3]=h*m,e[4]=(c*t-i*o)*m,e[5]=(i*r-a*t)*m,e[6]=d*m,e[7]=(n*o-l*t)*m,e[8]=(s*t-n*r)*m,this}transpose(){let e;const 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){const 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,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+e,-i*l,i*o,-i*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Xt.makeScale(e,t)),this}rotate(e){return this.premultiply(Xt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xt.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){const 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){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])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){const 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)}}const Xt=new jt;function qt(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const Yt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zt(e,t){return new Yt[e](t)}function $t(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Jt(){const e=$t("canvas");return e.style.display="block",e}const Kt={};function Qt(e){e in Kt||(Kt[e]=!0,console.warn(e))}const en=(new jt).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),tn=(new jt).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),nn={[ht]:{transfer:mt,primaries:gt,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e,fromReference:e=>e},[ut]:{transfer:ft,primaries:gt,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[pt]:{transfer:mt,primaries:vt,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>e.applyMatrix3(tn),fromReference:e=>e.applyMatrix3(en)},[dt]:{transfer:ft,primaries:vt,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>e.convertSRGBToLinear().applyMatrix3(tn),fromReference:e=>e.applyMatrix3(en).convertLinearToSRGB()}},rn=new Set([ht,pt]),sn={enabled:!0,_workingColorSpace:ht,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!rn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=nn[t].toReference;return(0,nn[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return nn[e].primaries},getTransfer:function(e){return e===ct?mt:nn[e].transfer},getLuminanceCoefficients:function(e,t=this._workingColorSpace){return e.fromArray(nn[t].luminanceCoefficients)}};function an(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function on(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let ln;class cn{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===ln&&(ln=$t("canvas")),ln.width=e.width,ln.height=e.height;const n=ln.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ln}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=$t("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*an(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*an(t[e]/255)):t[e]=an(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let un=0;class hn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:un++}),this.uuid=Vt(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(dn(i[t].image)):e.push(dn(i[t]))}else e=dn(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function dn(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?cn.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let pn=0;class mn extends Lt{constructor(e=mn.DEFAULT_IMAGE,t=mn.DEFAULT_MAPPING,n=W,i=W,r=Z,s=J,a=pe,o=K,l=mn.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:pn++}),this.uuid=Vt(),this.name="",this.source=new hn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Wt(0,0),this.repeat=new Wt(1,1),this.center=new Wt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new jt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,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!==V)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case G:e.x=e.x-Math.floor(e.x);break;case W:e.x=e.x<0?0:1;break;case j:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case G:e.y=e.y-Math.floor(e.y);break;case W:e.y=e.y<0?0:1;break;case j:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}mn.DEFAULT_IMAGE=null,mn.DEFAULT_MAPPING=V,mn.DEFAULT_ANISOTROPY=4;class fn{constructor(e=0,t=0,n=0,i=1){fn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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=void 0!==e.w?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}sub(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){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,i,r;const s=e.elements,a=s[0],o=s[4],l=s[8],c=s[1],u=s[5],h=s[9],d=s[2],p=s[6],m=s[10];if(Math.abs(o-c)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(a+u+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const e=(a+1)/2,s=(u+1)/2,f=(m+1)/2,g=(o+c)/4,v=(l+d)/4,y=(h+p)/4;return e>s&&e>f?e<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=g/n,r=v/n):s>f?s<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(s),n=g/i,r=y/i):f<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(f),n=v/r,i=y/r),this.set(n,i,r,t),this}let f=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(c-o)*(c-o));return Math.abs(f)<.001&&(f=1),this.x=(p-h)/f,this.y=(l-d)/f,this.z=(c-o)/f,this.w=Math.acos((a+u+m-1)/2),this}setFromMatrixPosition(e){const 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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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}}class gn extends Lt{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new fn(0,0,e,t),this.scissorTest=!1,this.viewport=new fn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Z,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new mn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let e=0;e<s;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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 i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;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;const t=Object.assign({},e.texture.image);return this.texture.source=new hn(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class vn extends gn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class yn extends mn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=X,this.minFilter=X,this.wrapR=W,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class _n extends mn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=X,this.minFilter=X,this.wrapR=W,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,a){let o=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3];const h=r[s+0],d=r[s+1],p=r[s+2],m=r[s+3];if(0===a)return e[t+0]=o,e[t+1]=l,e[t+2]=c,void(e[t+3]=u);if(1===a)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(u!==m||o!==h||l!==d||c!==p){let e=1-a;const t=o*h+l*d+c*p+u*m,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*e+h*r,l=l*e+d*r,c=c*e+p*r,u=u*e+m*r,e===1-a){const e=1/Math.sqrt(o*o+l*l+c*c+u*u);o*=e,l*=e,c*=e,u*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],u=r[s],h=r[s+1],d=r[s+2],p=r[s+3];return e[t]=a*p+c*u+o*d-l*h,e[t+1]=o*p+c*h+l*u-a*d,e[t+2]=l*p+c*d+a*h-o*u,e[t+3]=c*p-a*u-o*h-l*d,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,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,r=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),u=a(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],a=t[5],o=t[9],l=t[2],c=t[6],u=t[10],h=n+a+u;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>a&&n>u){const e=2*Math.sqrt(1+n-a-u);this._w=(c-o)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(a>u){const e=2*Math.sqrt(1+a-n-u);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+u-n-a);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(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(Ft(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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 0===e?(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){const n=e._x,i=e._y,r=e._z,s=e._w,a=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*e._w+n*e._x+i*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=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),u=Math.sin((1-t)*c)/l,h=Math.sin(t*c)/l;return this._w=s*u+this._w*h,this._x=n*u+this._x*h,this._y=i*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*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}}class Mn{constructor(e=0,t=0,n=0){Mn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(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(Tn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Tn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,a=e.z,o=e.w,l=2*(s*i-a*n),c=2*(a*t-r*i),u=2*(r*n-s*t);return this.x=t+o*l+s*u-a*c,this.y=n+o*c+a*l-r*u,this.z=i+o*u+r*c-s*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}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}
vendor: 5,103 bytes, line 2
2lerpVectors(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){const n=e.x,i=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return bn.copy(this).projectOnVector(e),this.sub(bn)}reflect(e){return this.sub(bn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-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}}const bn=new Mn,Tn=new xn;class Sn{constructor(e=new Mn(1/0,1/0,1/0),t=new Mn(-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(Nn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nn.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){const n=Nn.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);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Nn):Nn.fromBufferAttribute(i,t),Nn.applyMatrix4(e.matrixWorld),this.expandByPoint(Nn);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),En.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),En.copy(n.boundingBox)),En.applyMatrix4(e.matrixWorld),this.union(En)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],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,Nn),Nn.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 5,654 bytes, line 2
2s}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(Dn),Un.subVectors(this.max,Dn),An.subVectors(e.a,Dn),Cn.subVectors(e.b,Dn),Rn.subVectors(e.c,Dn),In.subVectors(Cn,An),Ln.subVectors(Rn,Cn),Pn.subVectors(An,Rn);let t=[0,-In.z,In.y,0,-Ln.z,Ln.y,0,-Pn.z,Pn.y,In.z,0,-In.x,Ln.z,0,-Ln.x,Pn.z,0,-Pn.x,-In.y,In.x,0,-Ln.y,Ln.x,0,-Pn.y,Pn.x,0];return!(!Fn(t,An,Cn,Rn,Un)||(t=[1,0,0,0,1,0,0,0,1],!Fn(t,An,Cn,Rn,Un)))&&(On.crossVectors(In,Ln),t=[On.x,On.y,On.z],Fn(t,An,Cn,Rn,Un))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Nn).length()),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()||(wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wn)),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)}}const wn=[new Mn,new Mn,new Mn,new Mn,new Mn,new Mn,new Mn,new Mn],Nn=new Mn,En=new Sn,An=new Mn,Cn=new Mn,Rn=new Mn,In=new Mn,Ln=new Mn,Pn=new Mn,Dn=new Mn,Un=new Mn,On=new Mn,Vn=new Mn;function Fn(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){Vn.fromArray(e,s);const a=r.x*Math.abs(Vn.x)+r.y*Math.abs(Vn.y)+r.z*Math.abs(Vn.z),o=t.dot(Vn),l=n.dot(Vn),c=i.dot(Vn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const zn=new Sn,Bn=new Mn,kn=new Mn;class Hn{constructor(e=new Mn,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){const n=this.center;void 0!==t?n.copy(t):zn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),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){const 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){const 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;Bn.subVectors(e,this.center);const t=Bn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Bn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(kn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Bn.copy(e.center).add(kn)),this.expandByPoint(Bn.copy(e.center).sub(kn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Gn=new Mn,Wn=new Mn,jn=new Mn,Xn=new Mn,qn=new Mn,Yn=new Mn,Zn=new Mn;class $n{constructor(e=new Mn,t=new Mn(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,Gn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const 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){const t=Gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gn.copy(this.origin).addScaledVector(this.direction,t),Gn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Wn.copy(e).add(t).multiplyScalar(.5),jn.copy(t).sub(e).normalize(),Xn.copy(this.origin).sub(Wn);const r=.5*e.distanceTo(t),s=-this.direction.dot(jn),a=Xn.dot(this.direction),o=-Xn.dot(jn),l=Xn.lengthSq(),c=Math.abs(1-s*s);let u,h,d,p;
vendor: 4,830 bytes, line 2
2if(c>0)if(u=s*o-a,h=s*a-o,p=r*c,u>=0)if(h>=-p)if(h<=p){const e=1/c;u*=e,h*=e,d=u*(u+s*h+2*a)+h*(s*u+h+2*o)+l}else h=r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;else h=-r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;else h<=-p?(u=Math.max(0,-(-s*r+a)),h=u>0?-r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l):h<=p?(u=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(u=Math.max(0,-(s*r+a)),h=u>0?r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l);else h=s>0?-r:r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Wn).addScaledVector(jn,h),d}intersectSphere(e,t){Gn.subVectors(e.center,this.origin);const n=Gn.dot(this.direction),i=Gn.dot(Gn)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,s=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,s=(e.min.y-h.y)*c),n>s||r>i||((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),u>=0?(a=(e.min.z-h.z)*u,o=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,o=(e.min.z-h.z)*u),n>o||a>i)||((a>n||n!=n)&&(n=a),(o<i||i!=i)&&(i=o),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,Gn)}intersectTriangle(e,t,n,i,r){qn.subVectors(t,e),Yn.subVectors(n,e),Zn.crossVectors(qn,Yn);let s,a=this.direction.dot(Zn);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Xn.subVectors(this.origin,e);const o=s*this.direction.dot(Yn.crossVectors(Xn,Yn));if(o<0)return null;const l=s*this.direction.dot(qn.cross(Xn));if(l<0||o+l>a)return null;const c=-s*Xn.dot(Zn);return c<0?null:this.at(c/a,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)}}class Jn{constructor(e,t,n,i,r,s,a,o,l,c,u,h,d,p,m,f){Jn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,a,o,l,c,u,h,d,p,m,f)}set(e,t,n,i,r,s,a,o,l,c,u,h,d,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=f,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 Jn).fromArray(this.elements)}copy(e){const 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){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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){const t=this.elements,n=e.elements,i=1/Kn.setFromMatrixColumn(e,0).length(),r=1/Kn.setFromMatrixColumn(e,1).length(),s=1/Kn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,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]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*u,i=a*c,r=a*u;t[0]=o*c,t[4]=-o*u,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-a*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*o}else if("YXZ"===e.order){const e=o*c,n=o*u,i=l*c,r=l*u;t[0]=e+r*a,t[4]=i*a-n,t[8]=s*l,t[1]=s*u,t[5]=s*c,t[9]=-a,t[2]=n*a-i,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*c,n=o*u,i=l*c,r=l*u;t[0]=e-r*a,t[4]=-s*u,t[8]=i+n*a,t[1]=n+i*a,t[5]=s*c,t[9]=r-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*c,n=s*u,i=a*c,r=a*u;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*u,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*c,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=s*c,t[9]=-a*c,t[2]=-l*c,t[6]=n*u+i,t[10]=e-r*u}
vendor: 3,183 bytes, line 2
2else if("XZY"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*c,t[4]=-u,t[8]=l*c,t[1]=e*u+r,t[5]=s*c,t[9]=n*u-i,t[2]=i*u-n,t[6]=a*c,t[10]=r*u+e}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(ei,e,ti)}lookAt(e,t,n){const i=this.elements;return ri.subVectors(e,t),0===ri.lengthSq()&&(ri.z=1),ri.normalize(),ni.crossVectors(n,ri),0===ni.lengthSq()&&(1===Math.abs(n.z)?ri.x+=1e-4:ri.z+=1e-4,ri.normalize(),ni.crossVectors(n,ri)),ni.normalize(),ii.crossVectors(ri,ni),i[0]=ni.x,i[4]=ii.x,i[8]=ri.x,i[1]=ni.y,i[5]=ii.y,i[9]=ri.y,i[2]=ni.z,i[6]=ii.z,i[10]=ri.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],M=i[0],b=i[4],T=i[8],S=i[12],w=i[1],N=i[5],E=i[9],A=i[13],C=i[2],R=i[6],I=i[10],L=i[14],P=i[3],D=i[7],U=i[11],O=i[15];return r[0]=s*M+a*w+o*C+l*P,r[4]=s*b+a*N+o*R+l*D,r[8]=s*T+a*E+o*I+l*U,r[12]=s*S+a*A+o*L+l*O,r[1]=c*M+u*w+h*C+d*P,r[5]=c*b+u*N+h*R+d*D,r[9]=c*T+u*E+h*I+d*U,r[13]=c*S+u*A+h*L+d*O,r[2]=p*M+m*w+f*C+g*P,r[6]=p*b+m*N+f*R+g*D,r[10]=p*T+m*E+f*I+g*U,r[14]=p*S+m*A+f*L+g*O,r[3]=v*M+y*w+_*C+x*P,r[7]=v*b+y*N+_*R+x*D,r[11]=v*T+y*E+_*I+x*U,r[15]=v*S+y*A+_*L+x*O,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],a=e[5],o=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+r*o*u-i*l*u-r*a*h+n*l*h+i*a*d-n*o*d)+e[7]*(+t*o*d-t*l*h+r*s*h-i*s*d+i*l*c-r*o*c)+e[11]*(+t*l*u-t*a*d-r*s*u+n*s*d+r*a*c-n*l*c)+e[15]*(-i*a*c-t*o*u+t*a*h+i*s*u-n*s*h+n*o*c)}transpose(){const e=this.elements;let 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){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],m=e[13],f=e[14],g=e[15],v=u*f*l-m*h*l+m*o*d-a*f*d-u*o*g+a*h*g,y=p*h*l-c*f*l-p*o*d+s*f*d+c*o*g-s*h*g,_=c*m*l-p*u*l+p*a*d-s*m*d-c*a*g+s*u*g,x=p*u*o-c*m*o-p*a*h+s*m*h+c*a*f-s*u*f,M=t*v+n*y+i*_+r*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/M;return e[0]=v*b,e[1]=(m*h*r-u*f*r-m*i*d+n*f*d+u*i*g-n*h*g)*b,e[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*b,e[3]=(u*o*r-a*h*r-u*i*l+n*h*l+a*i*d-n*o*d)*b,e[4]=y*b,e[5]=(c*f*r-p*h*r+p*i*d-t*f*d-c*i*g+t*h*g)*b,e[6]=(p*o*r-s*f*r-p*i*l+t*f*l+s*i*g-t*o*g)*b,e[7]=(s*h*r-c*o*r+c*i*l-t*h*l-s*i*d+t*o*d)*b,e[8]=_*b,e[9]=(p*u*r-c*m*r-p*n*d+t*m*d+c*n*g-t*u*g)*b,e[10]=(s*m*r-p*a*r+p*n*l-t*m*l-s*n*g+t*a*g)*b,e[11]=(c*a*r-s*u*r-c*n*l+t*u*l+s*n*d-t*a*d)*b,e[12]=x*b,e[13]=(c*m*i-p*u*i+p*n*h-t*m*h-c*n*f+t*u*f)*b,e[14]=(p*a*i-s*m*i-p*n*o+t*m*o+s*n*f-t*a*f)*b,e[15]=(s*u*i-c*a*i+c*n*o-t*u*o-s*n*h+t*a
vendor: 7,837 bytes, line 2
2*h)*b,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const 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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}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){const 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){const 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){const 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){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,a=e.y,o=e.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+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,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,a=t._z,o=t._w,l=r+r,c=s+s,u=a+a,h=r*l,d=r*c,p=r*u,m=s*c,f=s*u,g=a*u,v=o*l,y=o*c,_=o*u,x=n.x,M=n.y,b=n.z;return i[0]=(1-(m+g))*x,i[1]=(d+_)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-_)*M,i[5]=(1-(h+g))*M,i[6]=(f+v)*M,i[7]=0,i[8]=(p+y)*b,i[9]=(f-v)*b,i[10]=(1-(h+m))*b,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Kn.set(i[0],i[1],i[2]).length();const s=Kn.set(i[4],i[5],i[6]).length(),a=Kn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Qn.copy(this);const o=1/r,l=1/s,c=1/a;return Qn.elements[0]*=o,Qn.elements[1]*=o,Qn.elements[2]*=o,Qn.elements[4]*=l,Qn.elements[5]*=l,Qn.elements[6]*=l,Qn.elements[8]*=c,Qn.elements[9]*=c,Qn.elements[10]*=c,t.setFromRotationMatrix(Qn),n.x=r,n.y=s,n.z=a,this}makePerspective(e,t,n,i,r,s,a=Rt){const o=this.elements,l=2*r/(t-e),c=2*r/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i);let d,p;if(a===Rt)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==It)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=l,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,s,a=Rt){const o=this.elements,l=1/(t-e),c=1/(n-i),u=1/(s-r),h=(t+e)*l,d=(n+i)*c;let p,m;if(a===Rt)p=(s+r)*u,m=-2*u;else{if(a!==It)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*u,m=-1*u}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])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){const 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}}const Kn=new Mn,Qn=new Jn,ei=new Mn(0,0,0),ti=new Mn(1,1,1),ni=new Mn,ii=new Mn,ri=new Mn,si=new Jn,ai=new xn;class oi{constructor(e=0,t=0,n=0,i=oi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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){const i=e.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Ft(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ft(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ft(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Ft(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Ft(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Ft(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return si.makeRotationFromQuaternion(e),this.setFromRotationMatrix(si,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ai.setFromEuler(this),this.setFromQuaternion(ai,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],void 0!==e[3]&&(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}}oi.DEFAULT_ORDER="XYZ";class li{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let ci=0;const ui=new Mn,hi=new xn,di=new Jn,pi=new Mn,mi=new Mn,fi=new Mn,gi=new xn,vi=new Mn(1,0,0),yi=new Mn(0,1,0),_i=new Mn(0,0,1),xi={type:"added"},Mi={type:"removed"},bi={type:"childadded",child:null},Ti={type:"childremoved",child:null};class Si extends Lt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ci++}),this.uuid=Vt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Si.DEFAULT_UP.clone();const e=new Mn,t=new oi,n=new xn,i=new Mn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),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:i},modelViewMatrix:{value:new Jn},normalMatrix:{value:new jt}}),this.matrix=new Jn,this.matrixWorld=new Jn,this.matrixAutoUpdate=Si.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Si.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new li,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],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)}
vendor: 19,284 bytes, line 2
2setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return hi.setFromAxisAngle(e,t),this.quaternion.multiply(hi),this}rotateOnWorldAxis(e,t){return hi.setFromAxisAngle(e,t),this.quaternion.premultiply(hi),this}rotateX(e){return this.rotateOnAxis(vi,e)}rotateY(e){return this.rotateOnAxis(yi,e)}rotateZ(e){return this.rotateOnAxis(_i,e)}translateOnAxis(e,t){return ui.copy(e).applyQuaternion(this.quaternion),this.position.add(ui.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(vi,e)}translateY(e){return this.translateOnAxis(yi,e)}translateZ(e){return this.translateOnAxis(_i,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(di.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?pi.copy(e):pi.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?di.lookAt(mi,pi,this.up):di.lookAt(pi,mi,this.up),this.quaternion.setFromRotationMatrix(di),i&&(di.extractRotation(i.matrixWorld),hi.setFromRotationMatrix(di),this.quaternion.premultiply(hi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);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(xi),bi.child=e,this.dispatchEvent(bi),bi.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Mi),Ti.child=e,this.dispatchEvent(Ti),Ti.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),di.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),di.multiply(e.parent.matrixWorld)),e.applyMatrix4(di),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xi),bi.child=e,this.dispatchEvent(bi),bi.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,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[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(mi,e,fi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,gi,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(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)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=s(e.geometries),i=s(e.materials),r=s(e.textures),a=s(e.images),o=s(e.shapes),l=s(e.skeletons),c=s(e.animations),u=s(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),u.length>0&&(n.nodes=u)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}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)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Si.DEFAULT_UP=new Mn(0,1,0),Si.DEFAULT_MATRIX_AUTO_UPDATE=!0,Si.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const wi=new Mn,Ni=new Mn,Ei=new Mn,Ai=new Mn,Ci=new Mn,Ri=new Mn,Ii=new Mn,Li=new Mn,Pi=new Mn,Di=new Mn,Ui=new fn,Oi=new fn,Vi=new fn;class Fi{constructor(e=new Mn,t=new Mn,n=new Mn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),wi.subVectors(e,t),i.cross(wi);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){wi.subVectors(i,t),Ni.subVectors(n,t),Ei.subVectors(e,t);const s=wi.dot(wi),a=wi.dot(Ni),o=wi.dot(Ei),l=Ni.dot(Ni),c=Ni.dot(Ei),u=s*l-a*a;if(0===u)return r.set(0,0,0),null;const h=1/u,d=(l*o-a*c)*h,p=(s*c-a*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Ai)&&(Ai.x>=0&&Ai.y>=0&&Ai.x+Ai.y<=1)}static getInterpolation(e,t,n,i,r,s,a,o){return null===this.getBarycoord(e,t,n,i,Ai)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Ai.x),o.addScaledVector(s,Ai.y),o.addScaledVector(a,Ai.z),o)}static getInterpolatedAttribute(e,t,n,i,r,s){return Ui.setScalar(0),Oi.setScalar(0),Vi.setScalar(0),Ui.fromBufferAttribute(e,t),Oi.fromBufferAttribute(e,n),Vi.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Ui,r.x),s.addScaledVector(Oi,r.y),s.addScaledVector(Vi,r.z),s}static isFrontFacing(e,t,n,i){return wi.subVectors(n,t),Ni.subVectors(e,t),wi.cross(Ni).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 wi.subVectors(this.c,this.b),Ni.subVectors(this.a,this.b),.5*wi.cross(Ni).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Fi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Fi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Fi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Fi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Fi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,a;Ci.subVectors(i,n),Ri.subVectors(r,n),Li.subVectors(e,n);const o=Ci.dot(Li),l=Ri.dot(Li);if(o<=0&&l<=0)return t.copy(n);Pi.subVectors(e,i);const c=Ci.dot(Pi),u=Ri.dot(Pi);if(c>=0&&u<=c)return t.copy(i);const h=o*u-c*l;if(h<=0&&o>=0&&c<=0)return s=o/(o-c),t.copy(n).addScaledVector(Ci,s);Di.subVectors(e,r);const d=Ci.dot(Di),p=Ri.dot(Di);if(p>=0&&d<=p)return t.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(n).addScaledVector(Ri,a);const f=c*p-d*u;if(f<=0&&u-c>=0&&d-p>=0)return Ii.subVectors(r,i),a=(u-c)/(u-c+(d-p)),t.copy(i).addScaledVector(Ii,a);const g=1/(f+m+h);return s=m*g,a=h*g,t.copy(n).addScaledVector(Ci,s).addScaledVector(Ri,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const zi={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},Bi={h:0,s:0,l:0},ki={h:0,s:0,l:0};function Hi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Gi{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(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,sn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=sn.workingColorSpace){if(e=zt(e,1),t=Ft(t,0,1),n=Ft(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Hi(r,i,e+1/3),this.g=Hi(r,i,e),this.b=Hi(r,i,e-1/3)}return sn.toWorkingColorSpace(this,i),this}setStyle(e,t=ut){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],a=i[2];switch(s){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(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,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=ut){const n=zi[e.toLowerCase()];return void 0!==n?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=an(e.r),this.g=an(e.g),this.b=an(e.b),this}copyLinearToSRGB(e){return this.r=on(e.r),this.g=on(e.g),this.b=on(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ut){return sn.fromWorkingColorSpace(Wi.copy(this),e),65536*Math.round(Ft(255*Wi.r,0,255))+256*Math.round(Ft(255*Wi.g,0,255))+Math.round(Ft(255*Wi.b,0,255))}getHexString(e=ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.fromWorkingColorSpace(Wi.copy(this),t);const n=Wi.r,i=Wi.g,r=Wi.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const e=s-a;switch(l=c<=.5?e/(s+a):e/(2-s-a),s){case n:o=(i-r)/e+(i<r?6:0);break;case i:o=(r-n)/e+2;break;case r:o=(n-i)/e+4}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=sn.workingColorSpace){return sn.fromWorkingColorSpace(Wi.copy(this),t),e.r=Wi.r,e.g=Wi.g,e.b=Wi.b,e}getStyle(e=ut){sn.fromWorkingColorSpace(Wi.copy(this),e);const t=Wi.r,n=Wi.g,i=Wi.b;return e!==ut?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(Bi),this.setHSL(Bi.h+e,Bi.s+t,Bi.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}
vendor: 2,719 bytes, line 2
2lerpColors(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(Bi),e.getHSL(ki);const n=Bt(Bi.h,ki.h,t),i=Bt(Bi.s,ki.s,t),r=Bt(Bi.l,ki.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}}const Wi=new Gi;Gi.NAMES=zi;let ji=0;class Xi extends Lt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ji++}),this.uuid=Vt(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=g,this.blendDst=v,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Gi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yt,this.stencilZFail=yt,this.stencilZPass=yt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}
vendor: 5,422 bytes, line 2
2if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(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,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==g&&(n.blendSrc=this.blendSrc),this.blendDst!==v&&(n.blendDst=this.blendDst),this.blendEquation!==c&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&
vendor: 7,206 bytes, line 2
2(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}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;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,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){!0===e&&this.version++}}class qi extends Xi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Gi(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 oi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(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}}const Yi=Zi();function Zi(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,s[e]=t|n}for(let e=1024;e<2048;++e)s[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)a[e]=e<<23;a[31]=1199570944,a[32]=2147483648;for(let e=33;e<63;++e)a[e]=2147483648+(e-32<<23);a[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function $i(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Ft(e,-65504,65504),Yi.floatView[0]=e;const t=Yi.uint32View[0],n=t>>23&511;return Yi.baseTable[n]+((8388607&t)>>Yi.shiftTable[n])}function Ji(e){const t=e>>10;return Yi.uint32View[0]=Yi.mantissaTable[Yi.offsetTable[t]+(1023&e)]+Yi.exponentTable[t],Yi.floatView[0]}const Ki={toHalfFloat:$i,fromHalfFloat:Ji},Qi=new Mn,er=new Wt;class tr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Et,this.updateRanges=[],this.gpuType=re,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&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;
vendor: 6,455 bytes, line 2
2for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)er.fromBufferAttribute(this,t),er.applyMatrix3(e),this.setXY(t,er.x,er.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)Qi.fromBufferAttribute(this,t),Qi.applyMatrix3(e),this.setXYZ(t,Qi.x,Qi.y,Qi.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Qi.fromBufferAttribute(this,t),Qi.applyMatrix4(e),this.setXYZ(t,Qi.x,Qi.y,Qi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Qi.fromBufferAttribute(this,t),Qi.applyNormalMatrix(e),this.setXYZ(t,Qi.x,Qi.y,Qi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Qi.fromBufferAttribute(this,t),Qi.transformDirection(e),this.setXYZ(t,Qi.x,Qi.y,Qi.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=kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ht(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=kt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=kt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ht(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=kt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ht(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=kt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array),r=Ht(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const 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!==Et&&(e.usage=this.usage),e}}class nr extends tr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ir extends tr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class rr extends tr{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ji(this.array[e*this.itemSize]);return this.normalized&&(t=kt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize]=$i(t),this}getY(e){let t=Ji(this.array[e*this.itemSize+1]);return this.normalized&&(t=kt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize+1]=$i(t),this}getZ(e){let t=Ji(this.array[e*this.itemSize+2]);return this.normalized&&(t=kt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize+2]=$i(t),this}getW(e){let t=Ji(this.array[e*this.itemSize+3]);return this.normalized&&(t=kt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ht(t,this.array)),this.array[e*this.itemSize+3]=$i(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array)),this.array[e+0]=$i(t),this.array[e+1]=$i(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array)),this.array[e+0]=$i(t),this.array[e+1]=$i(n),this.array[e+2]=$i(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array),r=Ht(r,this.array)),this.array[e+0]=$i(t),this.array[e+1]=$i(n),this.array[e+2]=$i(i),this.array[e+3]=$i(r),this}}class sr extends tr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ar=0;const or=new Jn,lr=new Si,cr=new Mn,ur=new Sn,hr=new Sn,dr=new Mn;class pr extends Lt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ar++}),this.uuid=Vt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(qt(e)?ir:nr)(e,1):this.index=e,this}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 void 0!==this.attributes[e]}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){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new jt).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return or.makeRotationFromQuaternion(e),this.applyMatrix4(or),this}rotateX(e){return or.makeRotationX(e),this.applyMatrix4(or),this}rotateY(e){return or.makeRotationY(e),this.applyMatrix4(or),this}rotateZ(e){return or.makeRotationZ(e),this.applyMatrix4(or),this}translate(e,t,n){return or.makeTranslation(e,t,n),this.applyMatrix4(or),this}scale(e,t,n){return or.makeScale(e,t,n),this.applyMatrix4(or),this}lookAt(e){return lr.lookAt(e),lr.updateMatrix(),this.applyMatrix4(lr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cr).negate(),this.translate(cr.x,cr.y,cr.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new sr(t,3)),this}
vendor: 5,974 bytes, line 2
2computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Sn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Mn(-1/0,-1/0,-1/0),new Mn(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ur.setFromBufferAttribute(n),this.morphTargetsRelative?(dr.addVectors(this.boundingBox.min,ur.min),this.boundingBox.expandByPoint(dr),dr.addVectors(this.boundingBox.max,ur.max),this.boundingBox.expandByPoint(dr)):(this.boundingBox.expandByPoint(ur.min),this.boundingBox.expandByPoint(ur.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Hn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Mn,1/0);if(e){const n=this.boundingSphere.center;if(ur.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];hr.setFromBufferAttribute(n),this.morphTargetsRelative?(dr.addVectors(ur.min,hr.min),ur.expandByPoint(dr),dr.addVectors(ur.max,hr.max),ur.expandByPoint(dr)):(ur.expandByPoint(hr.min),ur.expandByPoint(hr.max))}ur.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)dr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(dr));if(t)for(let r=0,s=t.length;r<s;r++){const s=t[r],a=this.morphTargetsRelative;for(let t=0,r=s.count;t<r;t++)dr.fromBufferAttribute(s,t),a&&(cr.fromBufferAttribute(e,t),dr.add(cr)),i=Math.max(i,n.distanceToSquared(dr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new tr(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),a=[],o=[];for(let e=0;e<n.count;e++)a[e]=new Mn,o[e]=new Mn;const l=new Mn,c=new Mn,u=new Mn,h=new Wt,d=new Wt,p=new Wt,m=new Mn,f=new Mn;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),u.fromBufferAttribute(n,i),h.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),c.sub(l),u.sub(l),d.sub(h),p.sub(h);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(s),f.copy(u).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),a[e].add(m),a[t].add(m),a[i].add(m),o[e].add(f),o[t].add(f),o[i].add(f))}let v=this.groups;0===v.length&&(v=[{start:0,count:e.count}]);for(let t=0,n=v.length;t<n;++t){const n=v[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const y=new Mn,_=new Mn,x=new Mn,M=new Mn;function b(e){x.fromBufferAttribute(i,e),M.copy(x);const t=a[e];y.copy(t),y.sub(x.multiplyScalar(x.dot(t))).normalize(),_.crossVectors(M,t);const n=_.dot(o[e])<0?-1:1;s.setXYZW(e,y.x,y.y,y.z,n)}for(let t=0,n=v.length;t<n;++t){const n=v[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new tr(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Mn,r=new Mn,s=new Mn,a=new Mn,o=new Mn,l=new Mn,c=new Mn,u=new Mn;if(e)for(let h=0,d=e.count;h<d;h+=3){const d=e.getX(h+0),p=e.getX(h+1),m=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,m),c.subVectors(s,r),u.subVectors(i,r),c.cross(u),a.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),a.add(c),o.add(c),l.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let e=0,a=t.count;e<a;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),s.fromBufferAttribute(t,e+2),c.subVectors(s,r),u.subVectors(i,r),c.cross(u),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)dr.fromBufferAttribute(e,t),dr.normalize(),e.setXYZ(t,dr.x,dr.y,dr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,s=new n.constructor(t.length*i);let a=0,o=0;for(let r=0,l=t.length;r<l;r++){a=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)s[o++]=n[a++]}return new tr(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new pr,n=this.index.array,i=this.attributes;for(const r in i){const s=e(i[r],n);t.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],a=r[i];for(let t=0,i=a.length;t<i;t++){const i=e(a[t],n);s.push(i)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 6,293 bytes, line 2
2if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];s.push(i.toJSON(e.data))}s.length>0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let e=0,t=s.length;e<t;e++){const t=s[e];this.addGroup(t.start,t.count,t.materialIndex)}const a=e.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const mr=new Jn,fr=new $n,gr=new Hn,vr=new Mn,yr=new Mn,_r=new Mn,xr=new Mn,Mr=new Mn,br=new Mn,Tr=new Mn,Sr=new Mn;class wr extends Si{constructor(e=new pr,t=new qi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){br.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=a[n],o=r[n];0!==i&&(Mr.fromBufferAttribute(o,e),s?br.addScaledVector(Mr,i):br.addScaledVector(Mr.sub(t),i))}t.add(br)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;void 0!==i&&(null===n.boundingSphere&&n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(r),fr.copy(e.ray).recast(e.near),(!1!==gr.containsPoint(fr.origin)||!(null===fr.intersectSphere(gr,vr)||fr.origin.distanceToSquared(vr)>(e.far-e.near)**2))&&(mr.copy(r).invert(),fr.copy(e.ray).applyMatrix4(mr),(null===n.boundingBox||!1!==fr.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,fr)))}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,u=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=h.length;r<o;r++){const o=h[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3){i=Nr(this,p,e,n,l,c,u,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}}else{for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3){i=Nr(this,s,e,n,l,c,u,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}else if(void 0!==o)if(Array.isArray(s))for(let r=0,a=h.length;r<a;r++){const a=h[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3){i=Nr(this,p,e,n,l,c,u,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,t.push(i))}}else{for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3){i=Nr(this,s,e,n,l,c,u,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}}}function Nr(e,t,n,i,r,s,a,o,l,c){e.getVertexPosition(o,yr),e.getVertexPosition(l,_r),e.getVertexPosition(c,xr);const u=function(e,t,n,i,r,s,a,o){let l;if(l=1===t.side?i.intersectTriangle(a,s,r,!0,o):i.intersectTriangle(r,s,a,0===t.side,o),null===l)return null;Sr.copy(o),Sr.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Sr);return c<n.near||c>n.far?null:{distance:c,point:Sr.clone(),object:e}}(e,t,n,i,yr,_r,xr,Tr);if(u){const e=new Mn;Fi.getBarycoord(Tr,yr,_r,xr,e),r&&(u.uv=Fi.getInterpolatedAttribute(r,o,l,c,e,new Wt)),s&&(u.uv1=Fi.getInterpolatedAttribute(s,o,l,c,e,new Wt)),a&&(u.normal=Fi.getInterpolatedAttribute(a,o,l,c,e,new Mn),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const t={a:o,b:l,c:c,normal:new Mn,materialIndex:0};Fi.getNormal(yr,_r,xr,t.normal),u.face=t,u.barycoord=e}return u}class Er extends pr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],u=[];let h=0,d=0;function p(e,t,n,i,r,s,p,m,f,g,v){const y=s/f,_=p/g,x=s/2,M=p/2,b=m/2,T=f+1,S=g+1;let w=0,N=0;const E=new Mn;for(let s=0;s<S;s++){const a=s*_-M;for(let o=0;o<T;o++){const h=o*y-x;E[e]=h*i,E[t]=a*r,E[n]=b,l.push(E.x,E.y,E.z),E[e]=0,E[t]=0,E[n]=m>0?1:-1,c.push(E.x,E.y,E.z),u.push(o/f),u.push(1-s/g),w+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;
vendor: 13,929 bytes, line 2
2t++){const n=h+t+T*e,i=h+t+T*(e+1),r=h+(t+1)+T*(e+1),s=h+(t+1)+T*e;o.push(n,i,s),o.push(i,r,s),N+=6}a.addGroup(d,N,v),d+=N,h+=w}p("z","y","x",-1,-1,n,t,e,s,r,0),p("z","y","x",1,-1,n,t,-e,s,r,1),p("x","z","y",1,1,e,n,t,i,s,2),p("x","z","y",1,-1,e,n,-t,i,s,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new sr(l,3)),this.setAttribute("normal",new sr(c,3)),this.setAttribute("uv",new sr(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Er(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ar(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Cr(e){const t={};for(let n=0;n<e.length;n++){const i=Ar(e[n]);for(const e in i)t[e]=i[e]}return t}function Rr(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:sn.workingColorSpace}const Ir={clone:Ar,merge:Cr};class Lr extends Xi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ar(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(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){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Pr extends Si{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Jn,this.projectionMatrix=new Jn,this.projectionMatrixInverse=new Jn,this.coordinateSystem=Rt}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)}}const Dr=new Mn,Ur=new Wt,Or=new Wt;class Vr extends Pr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Ot*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Ut*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Ot*Math.atan(Math.tan(.5*Ut*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){Dr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Dr.x,Dr.y).multiplyScalar(-e/Dr.z),Dr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Dr.x,Dr.y).multiplyScalar(-e/Dr.z)}getViewSize(e,t){return this.getViewBounds(e,Ur,Or),t.subVectors(Or,Ur)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Ut*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/a,i*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Fr=-90;class zr extends Si{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Vr(Fr,1,e,t);i.layers=this.layers,this.add(i);const r=new Vr(Fr,1,e,t);r.layers=this.layers,this.add(r);const s=new Vr(Fr,1,e,t);s.layers=this.layers,this.add(s);const a=new Vr(Fr,1,e,t);a.layers=this.layers,this.add(a);const o=new Vr(Fr,1,e,t);o.layers=this.layers,this.add(o);const l=new Vr(Fr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,a,o]=t;for(const e of t)this.remove(e);if(e===Rt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==It)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,u=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,s),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(u,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Br extends mn{constructor(e,t,n,i,r,s,a,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:F,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class kr extends vn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Br(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:Z}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;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Er(5,5,5),r=new Lr({name:"CubemapFromEquirect",uniforms:Ar(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;const s=new wr(i,r),a=t.minFilter;return t.minFilter===J&&(t.minFilter=Z),new zr(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Hr=new Mn,Gr=new Mn,Wr=new jt;class jr{constructor(e=new Mn(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,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Hr.subVectors(n,t).cross(Gr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Hr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const 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){const n=t||Wr.getNormalMatrix(e),i=this.coplanarPoint(Hr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.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)}}const Xr=new Hn,qr=new Mn;class Yr{constructor(e=new jr,t=new jr,n=new jr,i=new jr,r=new jr,s=new jr){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Rt){const n=this.planes,i=e.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],m=i[10],f=i[11],g=i[12],v=i[13],y=i[14],_=i[15];if(n[0].setComponents(o-r,h-l,f-d,_-g).normalize(),n[1].setComponents(o+r,h+l,f+d,_+g).normalize(),n[2].setComponents(o+s,h+c,f+p,_+v).normalize(),n[3].setComponents(o-s,h-c,f-p,_-v).normalize(),n[4].setComponents(o-a,h-u,f-m,_-y).normalize(),t===Rt)n[5].setComponents(o+a,h+u,f+m,_+y).normalize();else{if(t!==It)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(a,u,m,y).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Xr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Xr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xr)}intersectsSprite(e){return Xr.center.set(0,0,0),Xr.radius=.7071067811865476,Xr.a
vendor: 3,596 bytes, line 2
2pplyMatrix4(e.matrixWorld),this.intersectsSphere(Xr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(qr.x=i.normal.x>0?e.max.x:e.min.x,qr.y=i.normal.y>0?e.max.y:e.min.y,qr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(qr)<0)return!1}return!0}containsPoint(e){const 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)}}function Zr(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function $r(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,s=i.byteLength,a=e.createBuffer();let o;if(e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)o=e.FLOAT;else if(i instanceof Uint16Array)o=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=e.SHORT;else if(i instanceof Uint32Array)o=e.UNSIGNED_INT;else if(i instanceof Int32Array)o=e.INT;else if(i instanceof Int8Array)o=e.BYTE;else if(i instanceof Uint8Array)o=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=e.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.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.");(function(t,n,i){const r=n.array,s=n.updateRanges;if(e.bindBuffer(i,t),0===s.length)e.bufferSubData(i,0,r);else{s.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<s.length;e++){const n=s[t],i=s[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++t,s[t]=i)}s.length=t+1;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()})(r.buffer,n,i),r.version=n.version}}}}class Jr extends pr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,s=t/2,a=Math.floor(n),o=Math.floor(i),l=a+1,c=o+1,u=e/a,h=t/o,d=[],p=[],m=[],f=[];for(let e=0;e<c;e++){const t=e*h-s;for(let n=0;n<l;n++){const i=n*u-r;p.push(i,-t,0),m.push(0,0,1),f.push(n/a),f.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<a;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),s=t+1+l*e;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new sr(p,3)),this.setAttribute("normal",new sr(m,3)),this.setAttribute("uv",new sr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jr(e.width,e.height,e.widthSegments,e.heightSegments)}}const Kr
vendor: 20,004 bytes, line 2
2={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660,  0.0556434,\n\t\t-1.5371385,  1.8760108, -0.2040259,\n\t\t-0.4985314,  0.0415560,  1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t
2totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness
vendor: 6,840 bytes, line 2
2) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}
vendor: 5,966 bytes, line 2
2\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid 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 ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;
vendor: 4,695 bytes, line 2
2\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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 ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alph
vendor: 11,921 bytes, line 2
2aB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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 ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
vendor: 9,076 bytes, line 2
2\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n
2#ifdef USE_MIPMAP_BIAS\n    vec4 sampledDiffuseColor = texture2D( map, vMapUv, mipmapBias );\n#else\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n        \n#ifdef USE_MIPMAP_BIAS\n    uniform float mipmapBias;\n#endif\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
vendor: 4,661 bytes, line 2
2\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 25
vendor: 18,431 bytes, line 2
25.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
vendor: 2,005 bytes, line 2
2\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(  1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,  1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,  1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);
vendor: 9,135 bytes, line 2
2\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;
vendor: 5,728 bytes, line 2
2\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
vendor: 37,111 bytes, line 2
2\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},
vendor: 766 bytes, line 2
2Qr={common:{diffuse:{value:new Gi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new jt},alphaMap:{value:null},alphaMapTransform:{value:new jt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new jt}},envmap:{envMap:{value:null},envMapRotation:{value:new jt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new jt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new jt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new jt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new jt},normalScale:{value:new Wt(1,1)}}
vendor: 7,766 bytes, line 2
2,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new jt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new jt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new jt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new jt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Gi(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 Gi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new jt},alphaTest:{value:0},uvTransform:{value:new jt}},sprite:{diffuse:{value:new Gi(16777215)},opacity:{value:1},center:{value:new Wt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new jt},alphaMap:{value:null},alphaMapTransform:{value:new jt},alphaTest:{value:0}}},es={basic:{uniforms:Cr([Qr.common,Qr.specularmap,Qr.envmap,Qr.aomap,Qr.lightmap,Qr.fog]),vertexShader:Kr.meshbasic_vert,fragmentShader:Kr.meshbasic_frag},lambert:{uniforms:Cr([Qr.common,Qr.specularmap,Qr.envmap,Qr.aomap,Qr.lightmap,Qr.emissivemap,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,Qr.fog,Qr.lights,{emissive:{value:new Gi(0)}}]),vertexShader:Kr.meshlambert_vert,fragmentShader:Kr.meshlambert_frag},phong:{uniforms:Cr([Qr.common,Qr.specularmap,Qr.envmap,Qr.aomap,Qr.lightmap,Qr.emissivemap,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,Qr.fog,Qr.lights,{emissive:{value:new Gi(0)},specular:{value:new Gi(1118481)},shininess:{value:30}}]),vertexShader:Kr.meshphong_vert,fragmentShader:Kr.meshphong_frag},standard:{uniforms:Cr([Qr.common,Qr.envmap,Qr.aomap,Qr.lightmap,Qr.emissivemap,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,Qr.roughnessmap,Qr.metalnessmap,Qr.fog,Qr.lights,{emissive:{value:new Gi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Kr.meshphysical_vert,fragmentShader:Kr.meshphysical_frag},toon:{uniforms:Cr([Qr.common,Qr.aomap,Qr.lightmap,Qr.emissivemap,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,Qr.gradientmap,Qr.fog,Qr.lights,{emissive:{value:new Gi(0)}}]),vertexShader:Kr.meshtoon_vert,fragmentShader:Kr.meshtoon_frag},matcap:{uniforms:Cr([Qr.common,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,Qr.fog,{matcap:{value:null}}]),vertexShader:Kr.meshmatcap_vert,fragmentShader:Kr.meshmatcap_frag},points:{uniforms:Cr([Qr.points,Qr.fog]),vertexShader:Kr.points_vert,fragmentShader:Kr.points_frag},dashed:{uniforms:Cr([Qr.common,Qr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Kr.linedashed_vert,fragmentShader:Kr.linedashed_frag},depth:{uniforms:Cr([Qr.common,Qr.displacementmap]),vertexShader:Kr.depth_vert,fragmentShader:Kr.depth_frag},normal:{uniforms:Cr([Qr.common,Qr.bumpmap,Qr.normalmap,Qr.displacementmap,{opacity:{value:1}}]),vertexShader:Kr.meshnormal_vert,fragmentShader:Kr.meshnormal_frag},sprite:{uniforms:Cr([Qr.sprite,Qr.fog]),vertexShader:Kr.sprite_vert,fragmentShader:Kr.sprite_frag},background:{uniforms:{uvTransform:{value:new jt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Kr.background_vert,fragmentShader:Kr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new jt}},vertexShader:Kr.backgroundCube_vert,fragmentShader:Kr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Kr.cube_vert,fragmentShader:Kr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Kr.equirect_vert,fragmentShader:Kr.equirect_frag},distanceRGBA:{uniforms:Cr([Qr.common,Qr.displacementmap,{referencePosition:{value:new Mn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Kr.distanceRGBA_vert,fragmentShader:Kr.distanceRGBA_frag},shadow:{uniforms:Cr([Qr.lights,Qr.fog,{color:{value:new Gi(0)},opacity:{value:1}}]),vertexShader:Kr.shadow_vert,fragmentShader:Kr.shadow_frag}};es.physical={uniforms:Cr([es.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new jt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new jt},clearcoatNormalScale:{value:new Wt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new jt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new jt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new jt},sheen:{value:0},sheenColor:{value:new Gi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new jt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new jt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new jt},transmissionSamplerSize:{value:new Wt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new jt},attenuationDistance:{value:0},attenuationColor:{value:new Gi(0)},specularColor:{value:new Gi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new jt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new jt},anisotropyVector:{value:new Wt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new jt}}]),vertexShader:Kr.meshphysical_vert,fragmentShader:Kr.meshphysical_frag};const ts={r:0,b:0,g:0},ns=new oi,is=new Jn;function rs(e,t,n,i,r,s,a){const o=new Gi(0);let l,c,u=!0===s?0:1,h=null,d=0,p=null;function m(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(ts,Rr(e)),i.buffers.color.setClear(ts.r,ts.g,ts.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),u=t,f(o,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e,f(o,u)},render:function(t){let n=!1;const r=m(t);null===r?f(o,u):r&&r.isColor&&(f(r,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,a),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=m(n);i&&(i.isCubeTexture||i.mapping===H)?(void 0===c&&(c=new wr(new Er(1,1,1),new Lr({name:"Backgroun
2dCubeMaterial",uniforms:Ar(es.backgroundCube.uniforms),vertexShader:es.backgroundCube.vertexShader,fragmentShader:es.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),ns.copy(n.backgroundRotation),ns.x*=-1,ns.y*=-1,ns.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(ns.y*=-1,ns.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(is.makeRotationFromEuler(ns)),c.material.toneMapped=sn.getTransfer(i.colorSpace)!==ft,(h!==i||d!==i.version||p!==e.toneMapping)&&(c.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new wr(new Jr(2,2),new Lr({name:"BackgroundMaterial",uniforms:Ar(es.background.uniforms),vertexShader:es.background.vertexShader,fragmentShader:es.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=sn.getTransfer(i.colorSpace)!==ft,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),(h!==i||d!==i.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function ss(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,a=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function u(){const e=s.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function h(e){d(e,0)}function d(t,n){const i=s.newAttributes,r=s.enabledAttributes,a=s.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),a[t]!==n&&(e.vertexAttribDivisor(t,n),a[t]=n)}function p(){const t=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function m(t,n,i,r,s,a,o){!0===o?e.vertexAttribIPointer(t,n,i,s,a):e.vertexAttribPointer(t,n,i,r,s,a)}function f(){g(),a=!0,s!==r&&(s=r,o(s.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let v=!1;const y=function(t,n,r){const s=!0===r.wireframe;let a=i[t.id];void 0===a&&(a={},i[t.id]=a);let o=a[n.id];void 0===o&&(o={},a[n.id]=o);let l=o[s];return void 0===l&&(l=c(e.createVertexArray()),o[s]=l),l}(f,l,r);s!==y&&(s=y,o(s.object)),v=function(e,t,n,i){const r=s.attributes,a=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=a[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n||n.attribute!==i||i&&n.data!==i.data)return!0;o++}return s.attributesNum!==o||s.index!==i}(n,f,l,g),v&&function(e,t,n,i){const r={},a=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=a[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}s.attributes=r,s.attributesNum=o,s.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(n,i,r,s){u();const a=s.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=a[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,a=o.itemSize,l=t.get(o);if(void 0===l)continue;const c=l.buffer,u=l.type,p=l.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||o.gpuType===ne;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)h(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)m(r.location+e,a/r.locationSize,u,i,l*p,(g+a/r.locationSize*e)*p,f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}
vendor: 29,103 bytes, line 2
2else for(let e=0;e<r.locationSize;e++)h(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)m(r.location+e,a/r.locationSize,u,i,a*p,a/r.locationSize*e*p,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:u,enableAttribute:h,disableUnusedAttributes:p}}function as(e,t,n){let i;function r(t,r,s){0!==s&&(e.drawArraysInstanced(i,t,r,s),n.update(r,i,s))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,s);let a=0;for(let e=0;e<s;e++)a+=r[e];n.update(a,i,1)},this.renderMultiDrawInstances=function(e,s,a,o){if(0===a)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],s[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,s,0,o,0,a);let t=0;for(let e=0;e<a;e++)t+=s[e];for(let e=0;e<o.length;e++)n.update(t,i,o[e])}}}function os(e,t,n,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&t.has("EXT_clip_control");if(!0===c){const e=t.get("EXT_clip_control");e.clipControlEXT(e.LOWER_LEFT_EXT,e.ZERO_TO_ONE_EXT)}const u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(t){return!(t!==pe&&i.convert(t)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))},textureTypeReadable:function(n){const r=n===se&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==K&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==re&&!r)},precision:a,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ls(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new jr,o=new jt,l={value:null,needsUpdate:!1};function c(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==s;++t,n+=4)a.copy(e[t]).applyMatrix4(r,o),a.normal.toArray(c,n),c[n+3]=a.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=s,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(a,o,u){const h=a.clippingPlanes,d=a.clipIntersection,p=a.clipShadows,m=e.get(a);if(!r||null===h||0===h.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=s?0:i,t=4*e;let r=m.clippingState||null;l.value=r,r=c(h,o,t,u);for(let e=0;e!==t;++e)r[e]=n[e];m.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}function cs(e){let t=new WeakMap;function n(e,t){return t===B?e.mapping=F:t===k&&(e.mapping=z),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===B||s===k){if(t.has(r)){return n(t.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new kr(s.height);return a.fromEquirectangularTexture(e,r),t.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class us extends Pr{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=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=i,this.near=r,this.far=s,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,a=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const hs=[.125,.215,.35,.446,.526,.582],ds=20,ps=new us,ms=new Gi;let fs=null,gs=0,vs=0,ys=!1;const _s=(1+Math.sqrt(5))/2,xs=1/_s,Ms=[new Mn(-_s,xs,0),new Mn(_s,xs,0),new Mn(-xs,0,_s),new Mn(xs,0,_s),new Mn(0,_s,-xs),new Mn(0,_s,xs),new Mn(-1,1,-1),new Mn(1,1,-1),new Mn(-1,1,1),new Mn(1,1,1)];let bs=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,i=100){fs=this._renderer.getRenderTarget(),gs=this._renderer.getActiveCubeFace(),vs=this._renderer.getActiveMipmapLevel(),ys=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Es(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ns(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(fs,gs,vs),this._renderer.xr.enabled=ys,e.scissorTest=!1,ws(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===F||e.mapping===z?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),fs=this._renderer.getRenderTarget(),gs=this._renderer.getActiveCubeFace(),vs=this._renderer.getActiveMipmapLevel(),ys=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Z,minFilter:Z,generateMipmaps:!1,type:se,format:pe,colorSpace:ht,depthBuffer:!1},i=Ss(e,t,n),{_lodMax:r}=this;if(({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Ts(r)),null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Ss(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Ts(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(ds),r=new Mn(0,1,0);return new Lr({name:"SphericalGaussianBlur",defines:{n:ds,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new wr(this._lodPlanes[0],e);this._renderer.compile(t,ps)}_sceneToCubeUV(e,t,n,i){const r=new Vr(90,1,t,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(ms),o.toneMapping=0,o.autoClear=!1;const u=new qi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new wr(new Er,u);let d=!1;const p=e.background;p?p.isColor&&(u.color.copy(p),e.background=null,d=!0):(u.color.copy(ms),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(a[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,a[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,a[t]));const l=this._cubeSize;ws(i,n*l,t>2?l:0,l,l),o.setRenderTarget(i),d&&o.render(h,r),o.render(e,r)}h.geometry.dispose(),h.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===F||e.mapping===z;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Es()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ns());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new wr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const a=this._cubeSize;ws(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,ps)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Ms[(i-t-1)%Ms.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new wr(this._lodPlanes[i],l),u=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,m=isFinite(r)?1+Math.floor(3*p):ds;m>ds&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<ds;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<m&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=f,u.latitudinal.value="latitudinal"===s,a&&(u.poleAxis.value=a);const{_lodMax:v}=this;u.dTheta.value=d,u.mipInt.value=v-n;const y=this._sizeLods[i];ws(t,3*y*(i>v-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(c,ps)}};function Ts(e){const t=[],n=[],i=[];let r=e;const s=e-4+1+hs.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);n.push(s);let o=1/s;a>e-4?o=hs[a-e+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,u=1+l,h=[c,c,u,c,u,u,c,c,u,u,c,u],d=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*d),y=new Float32Array(f*p*d),_=new Float32Array(g*p*d);for(let e=0;e<d;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(i,m*p*e),y.set(h,f*p*e);const r=[e,e,e,e,e,e];_.set(r,g*p*e)}const x=new pr;x.setAttribute("position",new tr(v,m)),x.setAttribute("uv",new tr(y,f)),x.setAttribute("faceIndex",new tr(_,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}function Ss(e,t,n){const i=new vn(e,t,n);return i.texture.mapping=H,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ws(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Ns(){return new Lr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Es(){return new Lr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function As(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Cs(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===B||s===k,o=s===F||s===z;if(a||o){let s=t.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new bs(e)),s=a?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;const n=6;for(let i=0;i<n;i++)void 0!==e[i]&&t++;return t===n}(l)?(n=new bs(e),s=a?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Rs(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&Qt("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Is(e,t,n,i){const r={},s=new WeakMap;function a(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);for(const e in o.morphAttributes){const n=o.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(t.remove(l),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let a=0;if(null!==i){const e=i.array;a=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],s=e[t+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const e=r.array;a=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const o=new(qt(n)?ir:nr)(n,1);o.version=a;const l=s.get(e);l&&t.remove(l),s.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",a),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=s.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return s.get(e)}}}function Ls(e,t,n){let i,r,s;function a(t,a,o){0!==o&&(e.drawElementsInstanced(i,a,r,t*s,o),n.update(a,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,s=e.bytesPerElement},this.render=function(t,a){e.drawElements(i,a,r,t*s),n.update(a,i,1)},this.renderInstances=a,this.renderMultiDraw=function(e,s,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,e,0,a);let o=0;for(let e=0;e<a;e++)o+=s[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,c){if(0===l)return;const u=t.get("WEBGL_multi_draw");if(null===u)for(let t=0;t<e.length;t++)a(e[t]/s,o[t],c[t]);else{u.multiDrawElementsInstancedWEBGL(i,o,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Ps(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Ds(e,t,n){const i=new WeakMap,r=new fn;return{update:function(s,a,o){const l=s.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,u=void 0!==c?c.length:0;let h=i.get(a);if(void 0===h||h.count!==u){let e=function(){v.dispose(),i.delete(a),a.removeEventListener("dispose",e)};void 0!==h&&h.texture.dispose();const n=void 0!==a.morphAttributes.position,s=void 0!==a.morphAttributes.normal,o=void 0!==a.morphAttributes.color,l=a.morphAttributes.position||[],c=a.morphAttributes.normal||[],d=a.morphAttributes.color||[];let p=0;!0===n&&(p=1),!0===s&&(p=2),!0===o&&(p=3);let m=a.attributes.position.count*p,f=1;m>t.maxTextureSize&&(f=Math.ceil(m/t.maxTextureSize),m=t.maxTextureSize);const g=new Float32Array(m*f*4*u),v=new yn(g,m,f,u);v.type=re,v.needsUpdate=!0;const y=4*p;for(let e=0;e<u;e++){const t=l[e],i=c[e],a=d[e],u=m*f*4*e;for(let e=0;e<t.count;e++){const l=e*y;!0===n&&(r.fromBufferAttribute(t,e),g[u+l+0]=r.x,g[u+l+1]=r.y,g[u+l+2]=r.z,g[u+l+3]=0),!0===s&&(r.fromBufferAttribute(i,e),g[u+l+4]=r.x,g[u+l+5]=r.y,g[u+l+6]=r.z,g[u+l+7]=0),!0===o&&(r.fromBufferAttribute(a,e),g[u+l+8]=r.x,g[u+l+9]=r.y,g[u+l+10]=r.z,g[u+l+11]=4===a.itemSize?r.w:1)}}h={count:u,texture:v,size:new Wt(m,f)},i.set(a,h),a.addEventListener("dispose",e)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(e,"morphTexture",s.morphTexture,n);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];const n=a.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",n),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}}}function Us(e,t,n,i){let r=new WeakMap;function s(e){const t=e.target;t.removeEventListener("dispose",s),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(a){const o=i.render.frame,l=a.geometry,c=t.get(a,l);if(r.get(c)!==o&&(t.update(c),r.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,e.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,e.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){const e=a.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return c},dispose:function(){r=new WeakMap}}}class Os extends mn{constructor(e,t,n,i,r,s,a,o,l,c=ge){if(c!==ge&&c!==ve)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===ge&&(n=ie),void 0===n&&c===ve&&(n=le),super(null,i,r,s,a,o,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==a?a:X,this.minFilter=void 0!==o?o:X,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const Vs=new mn,Fs=new Os(1,1),zs=new yn,Bs=new _n,ks=new Br,Hs=[],Gs=[],Ws=new Float32Array(16),js=new Float32Array(9),Xs=new Float32Array(4);function qs(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=Hs[r];if(void 0===s&&(s=new Float32Array(r),Hs[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function Ys(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Zs(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function $s(e,t){let n=Gs[t];void 0===n&&(n=new Int32Array(t),Gs[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Js(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ks(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ys(n,t))return;e.uniform2fv(this.addr,t),Zs(n,t)}}function Qs(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Ys(n,t))return;e.uniform3fv(this.addr,t),Zs(n,t)}}function ea(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ys(n,t))return;e.uniform4fv(this.addr,t),Zs(n,t)}}function ta(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Ys(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Zs(n,t)}else{if(Ys(n,i))return;Xs.set(i),e.uniformMatrix2fv(this.addr,!1,Xs),Zs(n,i)}}function na(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Ys(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Zs(n,t)}else{if(Ys(n,i))return;js.set(i),e.uniformMatrix3fv(this.addr,!1,js),Zs(n,i)}}function ia(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Ys(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Zs(n,t)}else{if(Ys(n,i))return;Ws.set(i),e.uniformMatrix4fv(this.addr,!1,Ws),Zs(n,i)}}function ra(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function sa(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ys(n,t))return;e.uniform2iv(this.addr,t),Zs(n,t)}}function aa(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Ys(n,t))return;e.uniform3iv(this.addr,t),Zs(n,t)}}function oa(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ys(n,t))return;e.uniform4iv(this.addr,t),Zs(n,t)}}function la(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function ca(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ys(n,t))return;e.uniform2uiv(this.addr,t),Zs(n,t)}}function ua(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Ys(n,t))return;e.uniform3uiv(this.addr,t),Zs(n,t)}}function ha(e,t){const n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ys(n,t))return;e.uniform4uiv(this.addr,t),Zs(n,t)}}
vendor: 4,585 bytes, line 2
2function da(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(Fs.compareFunction=515,s=Fs):s=Vs,n.setTexture2D(t||s,r)}function pa(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Bs,r)}function ma(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||ks,r)}function fa(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||zs,r)}function ga(e,t){e.uniform1fv(this.addr,t)}function va(e,t){const n=qs(t,this.size,2);e.uniform2fv(this.addr,n)}function ya(e,t){const n=qs(t,this.size,3);e.uniform3fv(this.addr,n)}function _a(e,t){const n=qs(t,this.size,4);e.uniform4fv(this.addr,n)}function xa(e,t){const n=qs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Ma(e,t){const n=qs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function ba(e,t){const n=qs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ta(e,t){e.uniform1iv(this.addr,t)}function Sa(e,t){e.uniform2iv(this.addr,t)}function wa(e,t){e.uniform3iv(this.addr,t)}function Na(e,t){e.uniform4iv(this.addr,t)}function Ea(e,t){e.uniform1uiv(this.addr,t)}function Aa(e,t){e.uniform2uiv(this.addr,t)}function Ca(e,t){e.uniform3uiv(this.addr,t)}function Ra(e,t){e.uniform4uiv(this.addr,t)}function Ia(e,t,n){const i=this.cache,r=t.length,s=$s(n,r);Ys(i,s)||(e.uniform1iv(this.addr,s),Zs(i,s));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||Vs,s[e])}function La(e,t,n){const i=this.cache,r=t.length,s=$s(n,r);Ys(i,s)||(e.uniform1iv(this.addr,s),Zs(i,s));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||Bs,s[e])}function Pa(e,t,n){const i=this.cache,r=t.length,s=$s(n,r);Ys(i,s)||(e.uniform1iv(this.addr,s),Zs(i,s));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||ks,s[e])}function Da(e,t,n){const i=this.cache,r=t.length,s=$s(n,r);Ys(i,s)||(e.uniform1iv(this.addr,s),Zs(i,s));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||zs,s[e])}class Ua{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return Js;case 35664:return Ks;case 35665:return Qs;case 35666:return ea;case 35674:return ta;case 35675:return na;case 35676:return ia;case 5124:case 35670:return ra;case 35667:case 35671:return sa;case 35668:case 35672:return aa;case 35669:case 35673:return oa;case 5125:return la;case 36294:return ca;case 36295:return ua;case 36296:return ha;case 35678:case 36198:case 36298:case 36306:case 35682:return da;case 35679:case 36299:case 36307:return pa;case 35680:case 36300:case 36308:case 36293:return ma;case 36289:case 36303:case 36311:case 36292:return fa}}(t.type)}}class Oa{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ga;case 35664:return va;case 35665:return ya;case 35666:return _a;case 35674:return xa;case 35675:return Ma;case 35676:return ba;case 5124:case 35670:return Ta;case 35667:case 35671:return Sa;case 35668:case 35672:return wa;case 35669:case 35673:return Na;case 5125:return Ea;case 36294:return Aa;case 36295:return Ca;case 36296:return Ra;case 35678:case 36198:case 36298:case 36306:case 35682:return Ia;case 35679:case 36299:case 36307:return La;case 35680:case 36300:case 36308:case 36293:return Pa;case 36289:case 36303:case 36311:case 36292:return Da}}(t.type)}}class Va{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(e,t[s.id],n)}}}const Fa=/(\w+)(\])?(\[|\.)?/g;function za(e,t){e.seq.push(t),e.map[t.id]=t}function Ba(e,t,n){const i=e.name,r=i.length;for(Fa.lastIndex=0;;){const s=Fa.exec(i),a=Fa.lastIndex;let o=s[1];const l="]"===s[2],c=s[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===r){za(n,void 0===c?new Ua(o,e,t):new Oa(o,e,t));break}{let e=n.map[o];void 0===e&&(e=new Va(o),za(n,e)),n=e}}}class ka{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);Ba(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const s=t[r],a=n[s.id];!1!==a.needsUpdate&&s.setValue(e,a.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}
vendor: 11,011 bytes, line 2
2function Ha(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let Ga=0;function Wa(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let e=r;e<s;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function ja(e,t){const n=function(e){const t=sn.getPrimaries(sn.workingColorSpace),n=sn.getPrimaries(e);let i;switch(t===n?i="":t===vt&&n===gt?i="LinearDisplayP3ToLinearSRGB":t===gt&&n===vt&&(i="LinearSRGBToLinearDisplayP3"),e){case ht:case pt:return[i,"LinearTransferOETF"];case ut:case dt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Xa(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const qa=new Mn;function Ya(){sn.getLuminanceCoefficients(qa);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${qa.x.toFixed(4)}, ${qa.y.toFixed(4)}, ${qa.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Za(e){return""!==e}function $a(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ja(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Ka=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qa(e){return e.replace(Ka,to)}const eo=new Map;function to(e,t){let n=Kr[t];if(void 0===n){const e=eo.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Kr[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return Qa(n)}const no=/#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 io(e){return e.replace(no,ro)}function ro(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function so(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function ao(e,t,n,i){const r=e.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case F:case z:t="ENVMAP_TYPE_CUBE";break;case H:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),u=function(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===z&&(t="ENVMAP_MODE_REFRACTION");return t}(n),h=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),d=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Za).join("\n")}(n),m=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),f=r.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Za).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Za).join("\n"),v.length>0&&(v+="\n")):(g=[so(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;
2","#endif","\n"].filter(Za).join("\n"),v=[so(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Kr.tonemapping_pars_fragment:"",0!==n.toneMapping?Xa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Kr.colorspace_pars_fragment,ja("linearToOutputTexel",n.outputColorSpace),Ya(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Za).join("\n")),a=Qa(a),a=$a(a,n),a=Ja(a,n),o=Qa(o),o=$a(o,n),o=Ja(o,n),a=io(a),o=io(o),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===Ct?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ct?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const _=y+g+a,x=y+v+o,M=Ha(r,r.VERTEX_SHADER,_),b=Ha(r,r.FRAGMENT_SHADER,x);
vendor: 22,293 bytes, line 2
2function T(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(M).trim(),s=r.getShaderInfoLog(b).trim();let a=!0,o=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(a=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,f,M,b);else{const e=Wa(r,M,"vertex"),i=Wa(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):(""===i||""===s)&&(o=!1);o&&(t.diagnostics={runnable:a,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:s,prefix:v}})}r.deleteShader(M),r.deleteShader(b),S=new ka(r,f),w=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),s=i.name;let a=1;i.type===e.FLOAT_MAT2&&(a=2),i.type===e.FLOAT_MAT3&&(a=3),i.type===e.FLOAT_MAT4&&(a=4),n[s]={type:i.type,location:e.getAttribLocation(t,s),locationSize:a}}return n}(r,f)}let S,w;r.attachShader(f,M),r.attachShader(f,b),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===S&&T(this),S},this.getAttributes=function(){return void 0===w&&T(this),w};let N=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===N&&(N=r.getProgramParameter(f,37297)),N},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ga++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=M,this.fragmentShader=b,this}let oo=0;class lo{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.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){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new co(e),t.set(e,n)),n}}class co{constructor(e){this.id=oo++,this.code=e,this.usedTimes=0}}function uo(e,t,n,i,r,s,a){const o=new li,l=new lo,c=new Set,u=[],h=r.logarithmicDepthBuffer,d=r.reverseDepthBuffer,p=r.vertexTextures;let m=r.precision;const f={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 g(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(s,o,u,v,y){const _=v.fog,x=y.geometry,M=s.isMeshStandardMaterial?v.environment:null,b=(s.isMeshStandardMaterial?n:t).get(s.envMap||M),T=b&&b.mapping===H?b.image.height:null,S=f[s.type];null!==s.precision&&(m=r.getMaxPrecision(s.precision),m!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",m,"instead."));const w=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,N=void 0!==w?w.length:0;let E,A,C,R,I=0;if(void 0!==x.morphAttributes.position&&(I=1),void 0!==x.morphAttributes.normal&&(I=2),void 0!==x.morphAttributes.color&&(I=3),S){const e=es[S];E=e.vertexShader,A=e.fragmentShader}else E=s.vertexShader,A=s.fragmentShader,l.update(s),C=l.getVertexShaderID(s),R=l.getFragmentShaderID(s);const L=e.getRenderTarget(),P=!0===y.isInstancedMesh,D=!0===y.isBatchedMesh,U=!!s.map,O=!!s.matcap,V=!!b,F=!!s.aoMap,z=!!s.lightMap,B=!!s.bumpMap,k=!!s.normalMap,G=!!s.displacementMap,W=!!s.emissiveMap,j=!!s.metalnessMap,X=!!s.roughnessMap,q=s.anisotropy>0,Y=s.clearcoat>0,Z=s.dispersion>0,$=s.iridescence>0,J=s.sheen>0,K=s.transmission>0,Q=q&&!!s.anisotropyMap,ee=Y&&!!s.clearcoatMap,te=Y&&!!s.clearcoatNormalMap,ne=Y&&!!s.clearcoatRoughnessMap,ie=$&&!!s.iridescenceMap,re=$&&!!s.iridescenceThicknessMap,se=J&&!!s.sheenColorMap,ae=J&&!!s.sheenRoughnessMap,oe=!!s.specularMap,le=!!s.specularColorMap,ce=!!s.specularIntensityMap,ue=K&&!!s.transmissionMap,he=K&&!!s.thicknessMap,de=!!s.gradientMap,pe=!!s.alphaMap,me=s.alphaTest>0,fe=!!s.alphaHash,ge=!!s.extensions;let ve=0;s.toneMapped&&(null===L||!0===L.isXRRenderTarget)&&(ve=e.toneMapping);const ye={shaderID:S,shaderType:s.type,shaderName:s.name,vertexShader:E,fragmentShader:A,defines:s.defines,customVertexShaderID:C,customFragmentShaderID:R,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:m,batching:D,batchingColor:D&&null!==y._colorsTexture,instancing:P,instancingColor:P&&null!==y.instanceColor,instancingMorph:P&&null!==y.morphTexture,supportsVertexTextures:p,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:ht,alphaToCoverage:!!s.alphaToCoverage,map:U,matcap:O,envMap:V,envMapMode:V&&b.mapping,envMapCubeUVHeight:T,aoMap:F,lightMap:z,bumpMap:B,normalMap:k,displacementMap:p&&G,emissiveMap:W,normalMapObjectSpace:k&&1===s.normalMapType,normalMapTangentSpace:k&&0===s.normalMapType,metalnessMap:j,roughnessMap:X,anisotropy:q,anisotropyMap:Q,clearcoat:Y,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:Z,iridescence:$,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:J,sheenColorMap:se,sheenRoughnessMap:ae,specularMap:oe,specularColorMap:le,specularIntensityMap:ce,transmission:K,transmissionMap:ue,thicknessMap:he,gradientMap:de,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:pe,alphaTest:me,alphaHash:fe,combine:s.combine,mapUv:U&&g(s.map.channel),aoMapUv:F&&g(s.aoMap.channel),lightMapUv:z&&g(s.lightMap.channel),bumpMapUv:B&&g(s.bumpMap.channel),normalMapUv:k&&g(s.normalMap.channel),displacementMapUv:G&&g(s.displacementMap.channel),emissiveMapUv:W&&g(s.emissiveMap.channel),metalnessMapUv:j&&g(s.metalnessMap.channel),roughnessMapUv:X&&g(s.roughnessMap.channel),anisotropyMapUv:Q&&g(s.anisotropyMap.channel),clearcoatMapUv:ee&&g(s.clearcoatMap.channel),clearcoatNormalMapUv:te&&g(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&g(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&g(s.iridescenceMap.channel),iridescenceThicknessMapUv:re&&g(s.iridescenceThicknessMap.channel),sheenColorMapUv:se&&g(s.sheenColorMap.channel),sheenRoughnessMapUv:ae&&g(s.sheenRoughnessMap.channel),specularMapUv:oe&&g(s.specularMap.channel),specularColorMapUv:le&&g(s.specularColorMap.channel),specularIntensityMapUv:ce&&g(s.specularIntensityMap.channel),transmissionMapUv:ue&&g(s.transmissionMap.channel),thicknessMapUv:he&&g(s.thicknessMap.channel),alphaMapUv:pe&&g(s.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(k||q),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===y.isPoints&&!!x.attributes.uv&&(U||pe),fog:!!_,useFog:!0===s.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:h,reverseDepthBuffer:d,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:N,morphTextureStride:I,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:ve,decodeVideoTexture:U&&!0===s.map.isVideoTexture&&sn.getTransfer(s.map.colorSpace)===ft,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:ge&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ge&&!0===s.extensions.multiDraw||D)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return ye.vertexUv1s=c.has(1),ye.vertexUv2s=c.has(2),ye.vertexUv3s=c.has(3),c.clear(),ye},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&o.enable(3),t.matcap&&o.enable(4),t.envMap&&o.enable(5),t.normalMapObjectSpace&&o.enable(6),t.normalMapTangentSpace&&o.enable(7),t.clearcoat&&o.enable(8),t.iridescence&&o.enable(9),t.alphaTest&&o.enable(10),t.vertexColors&&o.enable(11),t.vertexAlphas&&o.enable(12),t.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.reverseDepthBuffer&&o.enable(4),t.skinning&&o.enable(5),t.morphTargets&&o.enable(6),t.morphNormals&&o.enable(7),t.morphColors&&o.enable(8),t.premultipliedAlpha&&o.enable(9),t.shadowMapEnabled&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.opaque&&o.enable(17),t.pointsUvs&&o.enable(18),t.decodeVideoTexture&&o.enable(19),t.alphaToCoverage&&o.enable(20),e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=es[t];n=Ir.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=u.length;e<t;e++){const t=u[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new ao(e,n,t,s),u.push(i)),i},releaseProgram:function(e){if(0===--e.usedTimes){const t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function ho(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function po(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function mo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function fo(){const e=[];let t=0;const n=[],i=[],r=[];function s(n,i,r,s,a,o){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:a,group:o},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=a,l.group=o),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,o,l,c){const u=s(e,t,a,o,l,c);a.transmission>0?i.push(u):!0===a.transparent?r.push(u):n.push(u)},unshift:function(e,t,a,o,l,c){const u=s(e,t,a,o,l,c);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||po),i.length>1&&i.sort(t||mo),r.length>1&&r.sort(t||mo)}}}function go(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new fo,e.set(t,[r])):n>=i.length?(r=new fo,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function vo(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Mn,color:new Gi};break;case"SpotLight":n={position:new Mn,direction:new Mn,color:new Gi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Mn,color:new Gi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Mn,skyColor:new Gi,groundColor:new Gi};break;case"RectAreaLight":n={color:new Gi,position:new Mn,halfWidth:new Mn,halfHeight:new Mn}}return e[t.id]=n,n}}}let yo=0;function _o(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function xo(e){const t=new vo,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={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 e=0;e<9;e++)i.probe.push(new Mn);const r=new Mn,s=new Jn,a=new Jn;return{setup:function(r){let s=0,a=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,u=0,h=0,d=0,p=0,m=0,f=0,g=0,v=0,y=0;r.sort(_o);for(let e=0,_=r.length;e<_;e++){const _=r[e],x=_.color,M=_.intensity,b=_.distance,T=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)s+=x.r*M,a+=x.g*M,o+=x.b*M;else if(_.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(_.sh.coefficients[e],M);y++}else if(_.isDirectionalLight){const e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){const e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=T,i.directionalShadowMatrix[l]=_.shadow.matrix,p++}i.directional[l]=e,l++}else if(_.isSpotLight){const e=t.get(_);e.position.setFromMatrixPosition(_.matrixWorld),e.color.copy(x).multiplyScalar(M),e.distance=b,e.coneCos=Math.cos(_.angle),e.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),e.decay=_.decay,i.spot[u]=e;const r=_.shadow;if(_.map&&(i.spotLightMap[g]=_.map,g++,r.updateMatrices(_),_.castShadow&&v++),i.spotLightMatrix[u]=r.matrix,_.castShadow){const e=n.get(_);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[u]=e,i.spotShadowMap[u]=T,f++}u++}else if(_.isRectAreaLight){const e=t.get(_);e.color.copy(x).multiplyScalar(M),e.halfWidth.set(.5*_.width,0,0),e.halfHeight.set(0,.5*_.height,0),i.rectArea[h]=e,h++}else if(_.isPointLight){const e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),e.distance=_.distance,e.decay=_.decay,_.castShadow){const e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=T,i.pointShadowMatrix[c]=_.shadow.matrix,m++}i.point[c]=e,c++}else if(_.isHemisphereLight){const e=t.get(_);e.skyColor.copy(_.color).multiplyScalar(M),e.groundColor.copy(_.groundColor).multiplyScalar(M),i.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Qr.LTC_FLOAT_1,i.rectAreaLTC2=Qr.LTC_FLOAT_2):(i.rectAreaLTC1=Qr.LTC_HALF_1,i.rectAreaLTC2=Qr.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=o;const _=i.hash;(_.directionalLength!==l||_.pointLength!==c||_.spotLength!==u||_.rectAreaLength!==h||_.hemiLength!==d||_.numDirectionalShadows!==p||_.numPointShadows!==m||_.numSpotShadows!==f||_.numSpotMaps!==g||_.numLightProbes!==y)&&(i.directional.length=l,i.spot.length=u,i.rectArea.length=h,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotLightMatrix.length=f+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=y,_.directionalLength=l,_.pointLength=c,_.spotLength=u,_.rectAreaLength=h,_.hemiLength=d,_.numDirectionalShadows=p,_.numPointShadows=m,_.numSpotShadows=f,_.numSpotMaps=g,_.numLightProbes=y,i.version=yo++)},setupView:function(e,t){let n=0,o=0,l=0,c=0,u=0;const h=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){const d=e[t];if(d.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(h),n++}else if(d.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(h),l++}else if(d.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),a.identity(),s.copy(d.matrixWorld),s.premultiply(h),a.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(a),e.halfHeight.applyMatrix4(a),c++}else if(d.isPointLight){const e=i.point[o];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),o++}else if(d.isHemisphereLight){const e=i.hemi[u];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(h),u++}}},state:i}}function Mo(e){const t=new xo(e),n=[],i=[];const r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function bo(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let s;return void 0===r?(s=new Mo(e),t.set(n,[s])):i>=r.length?(s=new Mo(e),r.push(s)):s=r[i],s},dispose:function(){t=new WeakMap}}}class To extends Xi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(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}}class So extends Xi{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 wo(e,t,n){let i=new Yr;const r=new Wt,s=new Wt,c=new fn,u=new To({depthPacking:3201}),h=new So,d={},p=n.maxTextureSize,m={[a]:1,[o]:0,[l]:2}
vendor: 9,169 bytes, line 2
2,f=new Lr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Wt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),g=f.clone();g.defines.HORIZONTAL_PASS=1;const v=new pr;v.setAttribute("position",new tr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new wr(v,f),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let x=this.type;function M(n,i){const s=t.update(y);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,g.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,g.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new vn(r.x,r.y)),f.uniforms.shadow_pass.value=n.map.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,f,y,null),g.uniforms.shadow_pass.value=n.mapPass.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,g,y,null)}function b(t,n,i,r){let s=null;const a=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===i.isPointLight?h:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=d[e];void 0===i&&(i={},d[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",S)),s=r}if(s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:m[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial){e.properties.get(s).light=i}return s}function T(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,u=t.length;c<u;c++){const u=t[c],h=l[u.materialIndex];if(h&&h.visible){const t=b(n,h,a,o);n.onBeforeShadow(e,n,r,s,i,t,u),e.renderBufferDirect(s,null,i,t,n,u),n.onAfterShadow(e,n,r,s,i,t,u)}}}else if(l.visible){const t=b(n,l,a,o);n.onBeforeShadow(e,n,r,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,r,s,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)T(l[e],r,s,a,o)}function S(e){e.target.removeEventListener("dispose",S);for(const t in d){const n=d[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,a){if(!1===_.enabled||!1===_.autoUpdate&&!1===_.needsUpdate||0===t.length)return;const o=e.getRenderTarget(),l=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),h=e.state;h.setBlending(0),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);const d=3!==x&&3===this.type,m=3===x&&3!==this.type;for(let o=0,l=t.length;o<l;o++){const l=t[o],u=l.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const f=u.getFrameExtents();if(r.multiply(f),s.copy(u.mapSize),(r.x>p||r.y>p)&&(r.x>p&&(s.x=Math.floor(p/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>p&&(s.y=Math.floor(p/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null===u.map||!0===d||!0===m){const e=3!==this.type?{minFilter:X,magFilter:X}:{};null!==u.map&&u.map.dispose(),u.map=new vn(r.x,r.y,e),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const g=u.getViewportCount();for(let e=0;e<g;e++){const t=u.getViewport(e);c.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),h.viewport(c),u.updateMatrices(l,e),i=u.getFrustum(),T(n,a,u.camera,l,this.type)}!0!==u.isPointLightShadow&&3===this.type&&M(u,a),u.needsUpdate=!1}x=this.type,_.needsUpdate=!1,e.setRenderTarget(o,l,u)}}const No={[E]:1,[C]:6,[I]:7,[R]:5,[A]:0,[P]:2,[D]:4,[L]:3};function Eo(e){const t=new function(){let t=!1;const n=new fn;let i=null;const r=new fn(0,0,0,0);return{setMask:function(n){i!==n&&!t&&(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,s,a,o){!0===o&&(t*=a,i*=a,s*=a),n.set(t,i,s,a),!1===r.equals(n)&&(e.clearColor(t,i,s,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=!1,i=null,r=null,s=null;return{setReversed:function(e){n=e},setTest:function(t){t?ie(e.DEPTH_TEST):re(e.DEPTH_TEST)},setMask:function(n){i!==n&&!t&&(e.depthMask(n),i=n)},setFunc:function(t){if(n&&(t=No[t]),r!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}r=t}},setLocked:function(e){t=e},setClear:function(t){s!==t&&(e.clearDepth(t),s=t)},reset:function(){t=!1,i=null,r=null,s=null}}},i=new function(){let t=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null;return{setTest:function(n){t||(n?ie(e.STENCIL_TEST):re(e.STENCIL_TEST))},setMask:function(i){n!==i&&!t&&(e.stencilMask(i),n=i)},setFunc:function(t,n,a){(i!==t||r!==n||s!==a)&&(e.stencilFunc(t,n,a),i=t,r=n,s=a)},setOp:function(t,n,i){(a!==t||o!==n||l!==i)&&(e.stencilOp(t,n,i),a=t,o=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null}}},r=new WeakMap,s=new WeakMap;let a={},o={},l=new WeakMap,E=[],A=null,C=!1,R=null,I=null,L=null,P=null,D=null,U=null,O=null,V=new Gi(0,0,0),F=0,z=!1,B=null,k=null,H=null,G=null,W=null;const j=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,q=0;const Y=e.getParameter(e.VERSION);-1!==Y.indexOf("WebGL")?(q=parseFloat(/^WebGL (\d)/.exec(Y)[1]),X=q>=1):-1!==Y.indexOf("OpenGL ES")&&(q=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),X=q>=2);let Z=null,$={};const J=e.getParameter(e.SCISSOR_BOX),K=e.getParameter(e.VIEWPORT),Q=(new fn).fromArray(J),ee=(new fn).fromArray(K);function te(t,n,i,r){const s=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let a=0;a<i;a++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(n+a,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return a}const ne={};function ie(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function re(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}ne[e.TEXTURE_2D]=te(e.TEXTURE_2D,e.TEXTURE_2D,1),ne[e.TEXTURE_CUBE_MAP]=te(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[e.TEXTURE_2D_ARRAY]=te(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ne[e.TEXTURE_3D]=te(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),ie(e.DEPTH_TEST),n.setFunc(3),le(!1),ce(1),ie(e.CULL_FACE),oe(0);const se={[c]:e.FUNC_ADD,[u]:e.FUNC_SUBTRACT,[h]:e.FUNC_REVERSE_SUBTRACT};se[103]=e.MIN,se[104]=e.MAX;const ae={[d]:e.ZERO,[p]:e.ONE,[m]:e.SRC_COLOR,[g]:e.SRC_ALPHA,[b]:e.SRC_ALPHA_SATURATE,[x]:e.DST_COLOR,[y]:e.DST_ALPHA,[f]:e.ONE_MINUS_SRC_COLOR,[v]:e.ONE_MINUS_SRC_ALPHA,[M]:e.ONE_MINUS_DST_COLOR,[_]:e.ONE_MINUS_DST_ALPHA,[T]:e.CONSTANT_COLOR,[S]:e.ONE_MINUS_CONSTANT_COLOR,[w]:e.CONSTANT_ALPHA,[N]:e.ONE_MINUS_CONSTANT_ALPHA};function oe(t,n,i,r,s,a,o,l,u,h){if(0!==t){if(!1===C&&(ie(e.BLEND),C=!0),5===t)s=s||n,a=a||i,o=o||r,(n!==I||s!==D)&&(e.blendEquationSeparate(se[n],se[s]),I=n,D=s),(i!==L||r!==P||a!==U||o!==O)&&(e.blendFuncSeparate(ae[i],ae[r],ae[a],ae[o]),L=i,P=r,U=a,O
vendor: 5,195 bytes, line 2
2=o),(!1===l.equals(V)||u!==F)&&(e.blendColor(l.r,l.g,l.b,u),V.copy(l),F=u),R=t,z=!1;else if(t!==R||h!==z){if((I!==c||D!==c)&&(e.blendEquation(e.FUNC_ADD),I=c,D=c),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}L=null,P=null,U=null,O=null,V.set(0,0,0),F=0,R=t,z=h}}else!0===C&&(re(e.BLEND),C=!1)}function le(t){B!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),B=t)}function ce(t){0!==t?(ie(e.CULL_FACE),t!==k&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):re(e.CULL_FACE),k=t}function ue(t,n,i){t?(ie(e.POLYGON_OFFSET_FILL),(G!==n||W!==i)&&(e.polygonOffset(n,i),G=n,W=i)):re(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:ie,disable:re,bindFramebuffer:function(t,n){return o[t]!==n&&(e.bindFramebuffer(t,n),o[t]=n,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=E,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const s=t.textures;if(i.length!==s.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=s.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=s.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return A!==t&&(e.useProgram(t),A=t,!0)},setBlending:oe,setMaterial:function(r,s){2===r.side?re(e.CULL_FACE):ie(e.CULL_FACE);let a=1===r.side;s&&(a=!a),le(a),1===r.blending&&!1===r.transparent?oe(0):oe(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const o=r.stencilWrite;i.setTest(o),o&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),ue(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?ie(e.SAMPLE_ALPHA_TO_COVERAGE):re(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:le,setCullFace:ce,setLineWidth:function(t){t!==H&&(X&&e.lineWidth(t),H=t)},setPolygonOffset:ue,setScissorTest:function(t){t?ie(e.SCISSOR_TEST):re(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+j-1),Z!==t&&(e.activeTexture(t),Z=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===Z?e.TEXTURE0+j-1:Z);let r=$[i];void 0===r&&(r={type:void 0,texture:void 0},$[i]=r),(r.type!==t||r.texture!==n)&&(Z!==i&&(e.activeTexture(i),Z=i),e.bindTexture(t,n||ne[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=$[Z];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=s.get(n);void 0===i&&(i=new WeakMap,s.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=s.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===Q.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),Q.copy(t))},viewport:function(t){!1===ee.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),ee.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor
vendor: 4,352 bytes, line 2
2(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),a={},Z=null,$={},o={},l=new WeakMap,E=[],A=null,C=!1,R=null,I=null,L=null,P=null,D=null,U=null,O=null,V=new Gi(0,0,0),F=0,z=!1,B=null,k=null,H=null,G=null,W=null,Q.set(0,0,e.canvas.width,e.canvas.height),ee.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function Ao(e,t,n,i){const r=function(e){switch(e){case K:case Q:return{byteLength:1,components:1};case te:case ee:case se:return{byteLength:2,components:1};case ae:case oe:return{byteLength:2,components:4};case ie:case ne:case re:return{byteLength:4,components:1};case ce:case ue:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case he:case me:return e*t;case fe:return e*t*2;case ye:case _e:return e*t/r.components*r.byteLength;case xe:case Me:return e*t*2/r.components*r.byteLength;case de:return e*t*3/r.components*r.byteLength;case pe:case be:return e*t*4/r.components*r.byteLength;case Te:case Se:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case we:case Ne:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ae:case Re:return Math.max(e,16)*Math.max(t,8)/4;case Ee:case Ce:return Math.max(e,8)*Math.max(t,8)/2;case Ie:case Le:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Pe:case De:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ue:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Oe:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Ve:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Fe:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case ze:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Be:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case ke:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case He:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Ge:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case We:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case je:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case Xe:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case qe:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case Ye:case Ze:case $e:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Je:case Ke:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Qe:case et:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const Co={contain:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e},cover:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e},fill:function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e},getByteLength:Ao};function Ro(e,t,n,i,r,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=!(typeof navigator>"u")&&/OculusBrowser/g.test(navigator.userAgent),c=new Wt,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):$t("canvas")}function f(e,t,n){let i=1;const r=B(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof VideoFrame<"u"&&e instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===h&&(h=m(n,s));const a=t?m(n,s):h;return a.width=n,a.height=s,a.getContext("2d").drawImage(e,0,0,n,s),c
vendor: 6,453 bytes, line 2
2onsole.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==X&&e.minFilter!==Z}function v(t){e.generateMipmap(t)}function y(n,i,r,s,a=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGB8UI),r===e.UNSIGNED_SHORT&&(o=e.RGB16UI),r===e.UNSIGNED_INT&&(o=e.RGB32UI),r===e.BYTE&&(o=e.RGB8I),r===e.SHORT&&(o=e.RGB16I),r===e.INT&&(o=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),r===e.UNSIGNED_INT&&(o=e.RGBA32UI),r===e.BYTE&&(o=e.RGBA8I),r===e.SHORT&&(o=e.RGBA16I),r===e.INT&&(o=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),i===e.RGBA){const t=a?mt:sn.getTransfer(s);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===ft?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(t,n){let i;return t?null===n||n===ie||n===le?i=e.DEPTH24_STENCIL8:n===re?i=e.DEPTH32F_STENCIL8:n===te&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===ie||n===le?i=e.DEPTH_COMPONENT24:n===re?i=e.DEPTH_COMPONENT32F:n===te&&(i=e.DEPTH_COMPONENT16),i}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==X&&e.minFilter!==Z?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function M(e){const t=e.target;t.removeEventListener("dispose",M),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=d.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&T(e),0===Object.keys(r).length&&d.delete(n)}i.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function b(t){const n=t.target;n.removeEventListener("dispose",b),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),a.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function T(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete d.get(r)[n.__cacheKey],a.memory.textures--}let S=0;function w(t,r){const s=i.get(t);if(t.isVideoTexture&&function(e){const t=a.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void I(s,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}const N={[G]:e.REPEAT,[W]:e.CLAMP_TO_EDGE,[j]:e.MIRRORED_REPEAT},E={[X]:e.NEAREST,[q]:e.NEAREST_MIPMAP_NEAREST,[Y]:e.NEAREST_MIPMAP_LINEAR,[Z]:e.LINEAR,[$]:e.LINEAR_MIPMAP_NEAREST,[J]:e.LINEAR_MIPMAP_LINEAR},A={[_t]:e.NEVER,[Nt]:e.ALWAYS,[xt]:e.LESS,[bt]:e.LEQUAL,[Mt]:e.EQUAL,[wt]:e.GEQUAL,[Tt]:e.GREATER,[St]:e.NOTEQUAL};function C(n,s){if(s.type===re&&!1===t.has("OES_texture_float_linear")&&(s.magFilter===Z||s.magFilter===$||s.magFilter===Y||s.magFilter===J||s.minFilter===Z||s.minFilter===$||s.minFilter===Y||s.minFilter===J)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,N[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,N[s.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,N[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,E[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,E[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,A[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===X||s.minFilter!==Y&&s.minFilter!==J||s.type===re&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const a=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function R(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M));const r=n.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(e){const t=[];
vendor: 9,380 bytes, line 2
2return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===s[o]&&(s[o]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&T(n)),t.__cacheKey=o,t.__webglTexture=s[o].texture}return i}function I(t,a,o){let l=e.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=e.TEXTURE_3D);const c=R(t,a),u=a.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const h=i.get(u);if(u.version!==h.__version||!0===c){n.activeTexture(e.TEXTURE0+o);const t=sn.getPrimaries(sn.workingColorSpace),i=a.colorSpace===ct?null:sn.getPrimaries(a.colorSpace),d=a.colorSpace===ct||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=f(a.image,!1,r.maxTextureSize);p=z(a,p);const m=s.convert(a.format,a.colorSpace),M=s.convert(a.type);let b,T=y(a.internalFormat,m,M,a.colorSpace,a.isVideoTexture);C(l,a);const S=a.mipmaps,w=!0!==a.isVideoTexture,N=void 0===h.__version||!0===c,E=u.dataReady,A=x(a,p);if(a.isDepthTexture)T=_(a.format===ve,a.type),N&&(w?n.texStorage2D(e.TEXTURE_2D,1,T,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,T,p.width,p.height,0,m,M,null));else if(a.isDataTexture)if(S.length>0){w&&N&&n.texStorage2D(e.TEXTURE_2D,A,T,S[0].width,S[0].height);for(let t=0,i=S.length;t<i;t++)b=S[t],w?E&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,b.width,b.height,m,M,b.data):n.texImage2D(e.TEXTURE_2D,t,T,b.width,b.height,0,m,M,b.data);a.generateMipmaps=!1}else w?(N&&n.texStorage2D(e.TEXTURE_2D,A,T,p.width,p.height),E&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,m,M,p.data)):n.texImage2D(e.TEXTURE_2D,0,T,p.width,p.height,0,m,M,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){w&&N&&n.texStorage3D(e.TEXTURE_2D_ARRAY,A,T,S[0].width,S[0].height,p.depth);for(let t=0,i=S.length;t<i;t++)if(b=S[t],a.format!==pe)if(null!==m)if(w){if(E)if(a.layerUpdates.size>0){const i=Ao(b.width,b.height,a.format,a.type);for(const r of a.layerUpdates){const s=b.data.subarray(r*i/b.data.BYTES_PER_ELEMENT,(r+1)*i/b.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,b.width,b.height,1,m,s,0,0)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,b.width,b.height,p.depth,m,b.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,T,b.width,b.height,p.depth,0,b.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else w?E&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,b.width,b.height,p.depth,m,M,b.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,T,b.width,b.height,p.depth,0,m,M,b.data)}else{w&&N&&n.texStorage2D(e.TEXTURE_2D,A,T,S[0].width,S[0].height);for(let t=0,i=S.length;t<i;t++)b=S[t],a.format!==pe?null!==m?w?E&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,b.width,b.height,m,b.data):n.compressedTexImage2D(e.TEXTURE_2D,t,T,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):w?E&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,b.width,b.height,m,M,b.data):n.texImage2D(e.TEXTURE_2D,t,T,b.width,b.height,0,m,M,b.data)}else if(a.isDataArrayTexture)if(w){if(N&&n.texStorage3D(e.TEXTURE_2D_ARRAY,A,T,p.width,p.height,p.depth),E)if(a.layerUpdates.size>0){const t=Ao(p.width,p.height,a.format,a.type);for(const i of a.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,m,M,r)}a.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,M,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,T,p.width,p.height,p.depth,0,m,M,p.data);else if(a.isData3DTexture)w?(N&&n.texStorage3D(e.TEXTURE_3D,A,T,p.width,p.height,p.depth),E&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,M,p.data)):n.texImage3D(e.TEXTURE_3D,0,T,p.width,p.height,p.depth,0,m,M,p.data);else if(a.isFramebufferTexture){if(N)if(w)n.texStorage2D(e.TEXTURE_2D,A,T,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<A;r++)n.texImage2D(e.TEXTURE_2D,r,T,t,i,0,m,M,null),t>>=1,i>>=1}}else if(S.length>0){if(w&&N){const t=B(S[0]);n.texStorage2D(e.TEXTURE_2D,A,T,t.width,t.height)}for(let t=0,i=S.length;t<i;t++)b=S[t],w?E&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m,M,b):n.texImage2D(e.TEXTURE_2D,t,T,m,M,b);a.generateMipmaps=!1}else if(w){if(N){const t=B(p);n.texStorage2D(e.TEXTURE_2D,A,T,t.width,t.height)}E&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,m,M,p)}else n.texImage2D(e.TEXTURE_2D,0,T,m,M,p);g(a)&&v(l),h.__version=u.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}function L(t,r,a,l,c,u){const h=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=y(a.internalFormat,h,d,a.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>u),i=Math.max(1,r.height>>u);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,u,p,t,i,r.depth,0,h,d,null):n.texImage2D(c,u,p,t,i,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(a).__webglTexture,0,V(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(a).__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function P(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=_(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=V(n);F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,a,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,a,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,a,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const a=t[r],l=s.convert(a.format,a.colorSpace),c=s.convert(a.type),u=y(a.internalFormat,l,c,a.colorSpace),h=V(n);i&&!1===F(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,h,u,n.width,n.height):F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function D(t){const r=i.get(t),s=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){const t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(r.depthTexture).__webglTexture||r.depthTexture.image.width!==r.width||r.depthTexture.image.height!==r.height)&&(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),w(r.depthTexture,0);const s=i.get(r.depthTexture).__webglTexture,a=V(r);if(r.depthTexture.format===ge)F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0,a):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0);else{if(r.depthTexture.format!==ve)throw new Error("Unknown depthTexture format");F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0,a):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0)}}(r.__webglFramebuffer,t)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),P(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),P(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}n.bindFramebuffer(e.FRAMEBUFFER,null)}const U=[],O=[];function V(e){return Math.min(r.maxSamples,e.samples)}function F(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function z(e,t){const n=e.colorSpace,i=e.format,r=e.type;
2return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==ht&&n!==ct&&(sn.getTransfer(n)===ft?(i!==pe||r!==K)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function B(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):typeof VideoFrame<"u"&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=S;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=w,this.setTexture2DArray=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?I(s,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?I(s,t,r):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,a){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,a,o){if(6!==a.image.length)return;const l=R(t,a),c=a.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const u=i.get(c);if(c.version!==u.__version||!0===l){n.activeTexture(e.TEXTURE0+o);
vendor: 18,952 bytes, line 2
2const t=sn.getPrimaries(sn.workingColorSpace),i=a.colorSpace===ct?null:sn.getPrimaries(a.colorSpace),h=a.colorSpace===ct||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);const d=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)m[e]=d||p?p?a.image[e].image:a.image[e]:f(a.image[e],!0,r.maxCubemapSize),m[e]=z(a,m[e]);const _=m[0],M=s.convert(a.format,a.colorSpace),b=s.convert(a.type),T=y(a.internalFormat,M,b,a.colorSpace),S=!0!==a.isVideoTexture,w=void 0===u.__version||!0===l,N=c.dataReady;let E,A=x(a,_);if(C(e.TEXTURE_CUBE_MAP,a),d){S&&w&&n.texStorage2D(e.TEXTURE_CUBE_MAP,A,T,_.width,_.height);for(let t=0;t<6;t++){E=m[t].mipmaps;for(let i=0;i<E.length;i++){const r=E[i];a.format!==pe?null!==M?S?N&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,M,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,T,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?N&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,M,b,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,T,r.width,r.height,0,M,b,r.data)}}}else{if(E=a.mipmaps,S&&w){E.length>0&&A++;const t=B(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,A,T,t.width,t.height)}for(let t=0;t<6;t++)if(p){S?N&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,M,b,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,T,m[t].width,m[t].height,0,M,b,m[t].data);for(let i=0;i<E.length;i++){const r=E[i].image[t].image;S?N&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,M,b,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,T,r.width,r.height,0,M,b,r.data)}}else{S?N&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,M,b,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,T,M,b,m[t]);for(let i=0;i<E.length;i++){const r=E[i];S?N&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,M,b,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,T,M,b,r.image[t])}}}g(a)&&v(e.TEXTURE_CUBE_MAP),u.__version=c.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}(o,t,a):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+a)},this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&L(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&D(t)},this.setupRenderTarget=function(t){const r=t.texture,o=i.get(t),l=i.get(r);t.addEventListener("dispose",b);const c=t.textures,u=!0===t.isWebGLCubeRenderTarget,h=c.length>1;if(h||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,a.memory.textures++),u){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(h)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),a.memory.textures++)}if(t.samples>0&&!1===F(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),a=s.convert(i.type),l=y(i.internalFormat,r,a,i.colorSpace,!0===t.isXRRenderTarget),u=V(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),P(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),C(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)L(o.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else L(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(let r=0,s=c.length;r<s;r++){const s=c[r],a=i.get(s);n.bindTexture(e.TEXTURE_2D,a.__webglTexture),C(e.TEXTURE_2D,s),L(o.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(s)&&v(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),C(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)L(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else L(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&v(i),n.unbindTexture()}t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let s=0,a=r.length;s<a;s++){const a=r[s];if(g(a)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,s=i.get(a).__webglTexture;n.bindTexture(r,s),v(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===F(t)){const r=t.textures,s=t.width,a=t.height;let o=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=i.get(t),h=r.length>1;if(h)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),h){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,s,a,0,0,s,a,o,e.NEAREST),!0===l&&(U.length=0,O.length=0,U.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(c),O.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,O)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);const s=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,s,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=L,this.useMultisampledRTT=F}function Io(e,t){return{convert:function(n,i=""){let r;const s=sn.getTransfer(i);if(n===K)return e.UNSIGNED_BYTE;if(n===ae)return e.UNSIGNED_SHORT_4_4_4_4;if(n===oe)return e.UNSIGNED_SHORT_5_5_5_1;if(n===ce)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===ue)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===Q)return e.BYTE;if(n===ee)return e.SHORT;if(n===te)return e.UNSIGNED_SHORT;if(n===ne)return e.INT;if(n===ie)return e.UNSIGNED_INT;if(n===re)return e.FLOAT;if(n===se)return e.HALF_FLOAT;if(n===he)return e.ALPHA;if(n===de)return e.RGB;if(n===pe)return e.RGBA;if(n===me)return e.LUMINANCE;if(n===fe)return e.LUMINANCE_ALPHA;if(n===ge)return e.DEPTH_COMPONENT;if(n===ve)return e.DEPTH_STENCIL;if(n===ye)return e.RED;if(n===_e)return e.RED_INTEGER;if(n===xe)return e.RG;if(n===Me)return e.RG_INTEGER;if(n===be)return e.RGBA_INTEGER;if(n===Te||n===Se||n===we||n===Ne)if(s===ft){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Te)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Se)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===we)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ne)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Te)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Se)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===we)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ne)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ee||n===Ae||n===Ce||n===Re){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Ee)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ae)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ce)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Re)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Ie||n===Le||n===Pe){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===Ie||n===Le)return s===ft?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Pe)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===De||n===Ue||n===Oe||n===Ve||n===Fe||n===ze||n===Be||n===ke||n===He||n===Ge||n===We||n===je||n===Xe||n===qe){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===De)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ue)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Oe)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ve)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Fe)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ze)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Be)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ke)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===He)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ge)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===We)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===je)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Xe)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===qe)return s===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Ye||n===Ze||n===$e){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===Ye)return s===ft?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ze)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===$e)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Je||n===Ke||n===Qe||n===et){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===Ye)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Ke)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Qe)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===et)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===le?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Lo extends Vr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Po extends Si{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Do={type:"move"};class Uo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Po,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Po,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Mn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Mn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Po,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Mn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Mn),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const 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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Do)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Oo{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new mn;e.properties.get(i).__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Lr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new wr(new Jr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Vo extends Lt{constructor(e,t){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,u=null,h=null,d=null,p=null;const m=new Oo,f=t.getContextAttributes();let g=null,v=null;const y=[],_=[],x=new Wt;let M=null;const b=new Vr;b.layers.enable(1),b.viewport=new fn;const T=new Vr;T.layers.enable(2),T.viewport=new fn;const S=[b,T],w=new Lo;w.layers.enable(1),w.layers.enable(2);let N=null,E=null;function A(e){const t=_.indexOf(e.inputSource);if(-1===t)return;const n=y[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function C(){i.removeEventListener("select",A),i.removeEventListener("selectstart",A),i.removeEventListener("selectend",A),i.removeEventListener("squeeze",A),i.removeEventListener("squeezestart",A),i.removeEventListener("squeezeend",A),i.removeEventListener("end",C),i.removeEventListener("inputsourceschange",R);for(let e=0;e<y.length;e++){const t=_[e];null!==t&&(_[e]=null,y[e]&&y[e].disconnect(t))}N=null,E=null,m.reset(),e.setRenderTarget(g),d=null,h=null,u=null,i=null,v=null,U.stop(),n.isPresenting=!1,e.setPixelRatio(M),e.setSize(x.width,x.height,!1),n.dispatchEvent({type:"sessionend"})}function R(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=_.indexOf(n);i>=0&&(_[i]=null,y[i]&&y[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=_.indexOf(n);if(-1===i){for(let e=0;e<y.length;e++){if(e>=_.length){_.push(n),i=e;break}if(null===_[e]){_[e]=n,i=e;break}}if(-1===i)break}const r=y[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.controllerAutoUpdate=!0,this.getController=function(e){let t=y[e];return void 0===t&&(t=new Uo,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new Uo,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new Uo,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return u},this.getFrame=function(){return p}
vendor: 7,049 bytes, line 2
2,this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",A),i.addEventListener("selectstart",A),i.addEventListener("selectend",A),i.addEventListener("squeeze",A),i.addEventListener("squeezestart",A),i.addEventListener("squeezeend",A),i.addEventListener("end",C),i.addEventListener("inputsourceschange",R),!0!==f.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(x),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,s=null,a=null;f.depth&&(a=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?ve:ge,s=f.stencil?le:ie);const o={colorFormat:t.RGBA8,depthFormat:a,scaleFactor:r};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(o),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),v=new vn(h.textureWidth,h.textureHeight,{format:pe,type:K,depthTexture:new Os(h.textureWidth,h.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===h.ignoreDepthValues})}else{const n={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new vn(d.framebufferWidth,d.framebufferHeight,{format:pe,type:K,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await i.requestReferenceSpace(a),U.setContext(i),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const I=new Mn,L=new Mn;function P(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;let t=e.near,n=e.far;null!==m.texture&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),w.near=T.near=b.near=t,w.far=T.far=b.far=n,(N!==w.near||E!==w.far)&&(i.updateRenderState({depthNear:w.near,depthFar:w.far}),N=w.near,E=w.far);const r=e.parent,s=w.cameras;P(w,r);for(let e=0;e<s.length;e++)P(s[e],r);2===s.length?function(e,t,n){I.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(n.matrixWorld);const i=I.distanceTo(L),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(s[8]+1)/s[0],d=a*u,p=a*h,m=i/(-u+h),f=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=a+m,n=o+m,r=d-f,s=p+(i-f),u=l*o/n*t,h=c*o/n*t;e.projectionMatrix.makePerspective(r,s,u,h,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(w,b,T):w.projectionMatrix.copy(b.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Ot*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,w,r)},this.getCamera=function(){return w},this.getFoveation=function(){if(null!==h||null!==d)return o},this.setFoveation=function(e){o=e,null!==h&&(h.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(w)};let D=null;const U=new Zr;U.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||s),p=r,null!==c){const t=c.views;null!==d&&(e.setRenderTargetFramebuffer(v,d.framebuffer),e.setRenderTarget(v));let n=!1;t.length!==w.cameras.length&&(w.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let s=null;if(null!==d)s=d.getViewport(r);else{const t=u.getViewSubImage(h,r);s=t.viewport,0===i&&(e.setRenderTargetTextures(v,t.colorTexture,h.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(v))}let a=S[i];void 0===a&&(a=new Vr,a.layers.enable(i),a.viewport=new fn,S[i]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===i&&(w.matrix.copy(a.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),!0===n&&w.cameras.push(a)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=u.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&m.init(e,n,i.renderState)}}if(n.controllerAutoUpdate)for(let e=0;e<y.length;e++){const t=_[e],n=y[e];null!==t&&void 0!==n&&n.update(t,r,l||s)}D&&D(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){D=e},this.dispose=function(){}}}const Fo=new oi,zo=new Jn;function Bo(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),s=r.envMap,a=r.envMapRotation;s&&(e.envMap.value=s,Fo.copy(a),Fo.x*=-1,Fo.y*=-1,Fo.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Fo.y*=-1,Fo.z*=-1),e.envMapRotation.value.setFromMatrix4(zo.makeRotationFromEuler(Fo)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.ao
vendor: 4,117 bytes, line 2
2MapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Rr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize
vendor: 17,510 bytes, line 2
2+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,a):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ko(e,t,n,i){let r={},s={},a=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,s=t+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[s];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[s]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.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),t}function u(t){const n=t.target;n.removeEventListener("dispose",u);const i=a.indexOf(n.__bindingPointIndex);a.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,h){let d=r[n.id];void 0===d&&(function(e){const t=e.uniforms;let n=0;const i=16;for(let e=0,r=t.length;e<r;e++){const r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){const t=r[e],s=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=s.length;e<r;e++){const r=c(s[e]),a=n%i,o=a%r.boundary,l=a+o;n+=o,0!==l&&i-l<r.storage&&(n+=i-l),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=r.storage}}}const r=n%i;r>0&&(n+=i-r),e.__size=n,e.__cache={}}(n),d=function(t){const n=function(){for(let e=0;e<o;e++)if(-1===a.indexOf(e))return a.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,s=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,s),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",u));const p=h.program;i.updateUBOMapping(n,p);const m=t.render.frame;s[n.id]!==m&&(function(t){const n=r[t.id],i=t.uniforms,s=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,s)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const a=n[s],o=c(a);"number"==typeof a||"boolean"==typeof a?(r.__data[0]=a,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):a.isMatrix3?(r.__data[0]=a.elements[0],r.__data[1]=a.elements[1],r.__data[2]=a.elements[2],r.__data[3]=0,r.__data[4]=a.elements[3],r.__data[5]=a.elements[4],r.__data[6]=a.elements[5],r.__data[7]=0,r.__data[8]=a.elements[6],r.__data[9]=a.elements[7],r.__data[10]=a.elements[8],r.__data[11]=0):(a.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),s[n.id]=m)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);a=[],r={},s={}}}}class Ho{constructor(e={}){const{canvas:t=Jt(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;let d;if(this.isWebGLRenderer=!0,null!==n){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const p=new Uint32Array(4),m=new Int32Array(4);let f=null,g=null;const v=[],y=[];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._outputColorSpace=ut,this.toneMapping=0,this.toneMappingExposure=1;const _=this;let x=!1,M=0,b=0,T=null,S=-1,w=null;const N=new fn,E=new fn;let A=null;const C=new Gi(0);let R=0,I=t.width,L=t.height,P=1,D=null,U=null;const O=new fn(0,0,I,L),V=new fn(0,0,I,L);let F=!1;const z=new Yr;let B=!1,k=!1;const H=new Jn,G=new Jn,W=new Mn,j=new fn,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let q=!1;function Y(){return null===T?P:1}let Z,$,Q,ee,ne,re,ce,ue,he,de,pe,me,fe,ge,ve,ye,xe,Te,Se,we,Ne,Ee,Ae,Ce,Re=n;function Ie(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${i}`),t.addEventListener("webglcontextlost",De,!1),t.addEventListener("webglcontextrestored",Ue,!1),t.addEventListener("webglcontextcreationerror",Oe,!1),null===Re){const t="webgl2";if(Re=Ie(t,e),null===Re)throw Ie(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Le(){Z=new Rs(Re),Z.init(),Ee=new Io(Re,Z),$=new os(Re,Z,e,Ee),Q=new Eo(Re),$.reverseDepthBuffer&&Q.buffers.depth.setReversed(!0),ee=new Ps(Re),ne=new ho,re=new Ro(Re,Z,Q,ne,$,Ee,ee),ce=new cs(_),ue=new Cs(_),he=new $r(Re),Ae=new ss(Re,he),de=new Is(Re,he,ee,Ae),pe=new Us(Re,de,he,ee),Se=new Ds(Re,$,re),ye=new ls(ne),me=new uo(_,ce,ue,Z,$,Ae,ye),fe=new Bo(_,ne),ge=new go,ve=new bo(Z),Te=new rs(_,ce,ue,Q,pe,d,l),xe=new wo(_,pe,$),Ce=new ko(Re,ee,$,Q),we=new as(Re,Z,ee),Ne=new Ls(Re,Z,ee),ee.programs=me.programs,_.capabilities=$,_.extensions=Z,_.properties=ne,_.renderLists=ge,_.shadowMap=xe,_.state=Q,_.info=ee}Le();const Pe=new Vo(_,Re);function De(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Ue(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const e=ee.autoReset,t=xe.enabled,n=xe.autoUpdate,i=xe.needsUpdate,r=xe.type;Le(),ee.autoReset=e,xe.enabled=t,xe.autoUpdate=n,xe.needsUpdate=i,xe.type=r}function Oe(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ve(e){const t=e.target;t.removeEventListener("dispose",Ve),function(e){(function(e){const t=ne.get(e).programs;void 0!==t&&(t.forEach(function(e){me.releaseProgram(e)}),e.isShaderMaterial&&me.releaseShaderCache(e))})(e),ne.remove(e)}(t)}function Fe(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Ye(e,t,n),e.side=0,e.needsUpdate=!0,Ye(e,t,n),e.side=2):Ye(e,t,n)}this.xr=Pe,this.getContext=function(){return Re},this.getContextAttributes=function(){return Re.getContextAttributes()},this.forceContextLoss=function(){const e=Z.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=Z.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){void 0!==e&&(P=e,this.setSize(I,L,!1))},this.getSize=function(e){return e.set(I,L)},this.setSize=function(e,n,i=!0){Pe.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(I=e,L=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(I*P,L*P).floor()},this.setDrawingBufferSize=function(e,n,i){I=e,L=n,P=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(N)},this.getViewport=function(e){return e.copy(O)},this.setViewport=function(e,t,n,i){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,n,i),Q.viewport(N.copy(O).multiplyScalar(P).round())},this.getScissor=function(e){return e.copy(V)},this.setScissor=function(e,t,n,i){e.isVector4?V.set(e.x,e.y,e.z,e.w):V.set(e,t,n,i),Q.scissor(E.copy(V).multiplyScalar(P).round())},this.getScissorTest=function(){return F},this.setScissorTest=function(e){Q.setScissorTest(F=e)},this.setOpaqueSort=function(e){D=e},this.setTransparentSort=function(e){U=e},this.getClearColor=function(e){return e.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor.apply(Te,arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha.apply(Te,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==T){const t=T.texture.format;e=t===be||t===Me||t===_e}if(e){const e=T.texture.type,t=e===K||e===ie||e===te||e===le||e===ae||e===oe,n=Te.getClearColor(),i=Te.getClearAlpha(),r=n.r,s=n.g,a=n.b;t?(p[0]=r,p[1]=s,p[2]=a,p[3]=i,Re.clearBufferuiv(Re.COLOR,0,p)):(m[0]=r,m[1]=s,m[2]=a,m[3]=i,Re.clearBufferiv(Re.COLOR,0,m))}else i|=Re.COLOR_BUFFER_BIT}t&&(i|=Re.DEPTH_BUFFER_BIT,Re.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),n&&(i|=Re.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Re.clear(i)},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",Ue,!1),t.removeEventListener("webglcontextcreationerror",Oe,!1),ge.dispose(),ve.dispose(),ne.dispose(),ce.dispose(),ue.dispose(),pe.dispose(),Ae.dispose(),Ce.dispose(),me.dispose(),Pe.dispose(),Pe.removeEventListener("sessionstart",Be),Pe.removeEventListener("sessionend",ke),He.stop()},this.renderBufferDirect=function(e,t,n,i,r,s){null===t&&(t=X);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=X),re.resetTextureUnits();const s=t.fog,a=i.isMeshStandardMaterial?t.environment:null,o=null===T?_.outputColorSpace:!0===T.isXRRenderTarget?T.texture.colorSpace:ht,l=(i.isMeshStandardMaterial?ue:ce).get(i.envMap||a),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let m=0;i.toneMapped&&(null===T||!0===T.isXRRenderTarget)&&(m=_.toneMapping);const f=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==f?f.length:0,y=ne.get(i),x=g.state.lights;if(!0===B&&(!0===k||e!==w)){const t=e===w&&i.id===S;ye.setState(i,e,t)}let M=!1;i.version===y.__version?(y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputColorSpace!==o||r.isBatchedMesh&&!1===y.batching||!r.isBatchedMesh&&!0===y.batching||r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing||!r.isInstancedMesh&&!0===y.instancing||r.isSkinnedMesh&&!1===y.skinning||!r.isSkinnedMesh&&!0===y.skinning||r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==l||!0===i.fog&&y.fog!==s||void 0!==y.numClippingPlanes&&(y.numClippingPlanes!==ye.numPlanes||y.numIntersection!==ye.numIntersection)||y.vertexAlphas!==c||y.vertexTangents!==u||y.morphTargets!==h||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==m||y.morphTargetsCount!==v)&&(M=!0):(M=!0,y.__version=i.version);let b=y.currentProgram;!0===M&&(b=Ye(i,t,r));let N=!1,E=!1,A=!1;const C=b.getUniforms(),R=y.uniforms;if(Q.useProgram(b.program)&&(N=!0,E=!0,A=!0),i.id!==S&&(S=i.id,E=!0),N||w!==e){$.reverseDepthBuffer?(H.copy(e.projectionMatrix),function(e){const t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}(H),function(e){const t=e.elements;-1===t[11]?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=1-t[14])}(H),C.setValue(Re,"projectionMatrix",H)):C.setValue(Re,"projectionMatrix",e.projectionMatrix),C.setValue(Re,"viewMatrix",e.matrixWorldInverse);const t=C.map.cameraPosition;void 0!==t&&t.setValue(Re,W.setFromMatrixPosition(e.matrixWorld)),$.logarithmicDepthBuffer&&C.setValue(Re,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(Re,"isOrthographic",!0===e.isOrthographicCamera),w!==e&&(w=e,E=!0,A=!0)}if(r.isSkinnedMesh){C.setOptional(Re,r,"bindMatrix"),C.setOptional(Re,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),C.setValue(Re,"boneTexture",e.boneTexture,re))}r.isBatchedMesh&&(C.setOptional(Re,r,"batchingTexture"),C.setValue(Re,"batchingTexture",r._matricesTexture,re),C.setOptional(Re,r,"batchingIdTexture"),C.setValue(Re,"batchingIdTexture",r._indirectTexture,re),C.setOptional(Re,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(Re,"batchingColorTexture",r._colorsTexture,re));const I=n.morphAttributes;if((void 0!==I.position||void 0!==I.normal||void 0!==I.color)&&Se.update(r,n,b),(E||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,C.setValue(Re,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(R.envMapIntensity.value=t.environmentIntensity),E&&(C.setValue(Re,"toneMappingExposure",_.toneMappingExposure),y.needsLights&&function(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(R,A),s&&!0===i.fog&&fe.refreshFogUniforms(R,s),fe.refreshMaterialUniforms(R,i,P,L,g.state.transmissionRenderTarget[e.id]),ka.upload(Re,Ze(y),R,re)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(ka.upload(Re,Ze(y),R,re),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&C.setValue(Re,"center",r.center),C.setValue(Re,"modelViewMatrix",r.modelViewMatrix),C.setValue(Re,"normalMatrix",r.normalMatrix),C.setValue(Re,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];Ce.update(n,b),Ce.bind(n,b)}}return b}(e,t,n,i,r);Q.setMaterial(i,a);let l=n.index,c=1;if(!0===i.wireframe){if(l=de.getWireframeAttribute(n),void 0===l)return;c=2}const u=n.drawRange,h=n.attributes.position;let d=u.start*c,p=(u.start+u.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=h&&(d=Math.max(d,0),p=Math.min(p,h.count));const m=p-d;if(m<0||m===1/0)return;Ae.setup(r,i,o,n,l);let f,v=we;if(null!==l&&(f=he.get(l),v=Ne,v.setIndex(f)),r.isMesh)!0===i.wireframe?(Q.setLineWidth(i.wireframeLinewidth*Y()),v.setMode(Re.LINES)):v.setMode(Re.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),Q.setLineWidth(e*Y()),r.isLineSegments?v.setMode(Re.LINES):r.isLineLoop?v.setMode(Re.LINE_LOOP):v.setMode(Re.LINE_STRIP)}else r.isPoints?v.setMode(Re.POINTS):r.isSprite&&v.setMode(Re.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)v.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(Z.get("WEBGL_multi_draw"))v.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,s=l?he.get(l).bytesPerElement:1,a=ne.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)a.setValue(Re,"_gl_DrawID",i),v.render(e[i]/s,t[i])}else if(r.isInstancedMesh)v.renderInstances(d,m,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);v.renderInstances(d,m,t)}else v.render(d,m)},this.compile=function(e,t,n=null){null===n&&(n=e),g=ve.get(n),g.init(t),y.push(g),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),g.setupLights();const i=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const s=t[r];Fe(s,n,e),i.add(s)}else Fe(t,n,e),i.add(t)}),y.pop(),g=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>
vendor: 5,750 bytes, line 2
2{function n(){i.forEach(function(e){ne.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==Z.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let ze=null;function Be(){He.stop()}function ke(){He.start()}const He=new Zr;function Ge(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||z.intersectsSprite(e)){i&&j.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=pe.update(e),r=e.material;r.visible&&f.push(e,t,r,n,j.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||z.intersectsObject(e))){const t=pe.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)),j.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let s=0,a=i.length;s<a;s++){const a=i[s],o=r[a.materialIndex];o&&o.visible&&f.push(e,t,o,n,j.z,a)}}else r.visible&&f.push(e,t,r,n,j.z,null)}const r=e.children;for(let e=0,s=r.length;e<s;e++)Ge(r[e],t,n,i)}function We(e,t,n,i){const r=e.opaque,s=e.transmissive,a=e.transparent;g.setupLightsView(n),!0===B&&ye.setGlobalState(_.clippingPlanes,n),i&&Q.viewport(N.copy(i)),r.length>0&&Xe(r,t,n),s.length>0&&Xe(s,t,n),a.length>0&&Xe(a,t,n),Q.buffers.depth.setTest(!0),Q.buffers.depth.setMask(!0),Q.buffers.color.setMask(!0),Q.setPolygonOffset(!1)}function je(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new vn(1,1,{generateMipmaps:!0,type:Z.has("EXT_color_buffer_half_float")||Z.has("EXT_color_buffer_float")?se:K,minFilter:J,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sn.workingColorSpace}));const r=g.state.transmissionRenderTarget[i.id],a=i.viewport||N;r.setSize(a.z,a.w);const o=_.getRenderTarget();_.setRenderTarget(r),_.getClearColor(C),R=_.getClearAlpha(),R<1&&_.setClearColor(16777215,.5),_.clear(),q&&Te.render(n);const l=_.toneMapping;_.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===B&&ye.setGlobalState(_.clippingPlanes,i),Xe(e,n,i),re.updateMultisampleRenderTarget(r),re.updateRenderTargetMipmap(r),!1===Z.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=s.object,o=s.geometry,l=s.material,c=s.group;if(2===l.side&&a.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,qe(a,n,i,o,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(re.updateMultisampleRenderTarget(r),re.updateRenderTargetMipmap(r))}_.setRenderTarget(o),_.setClearColor(C,R),void 0!==c&&(i.viewport=c),_.toneMapping=l}function Xe(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r<s;r++){const s=e[r],a=s.object,o=s.geometry,l=null===i?s.material:i,c=s.group;a.layers.test(n.layers)&&qe(a,t,n,o,l,c)}}function qe(e,t,n,i,r,s){e.onBeforeRender(_,t,n,i,r,s),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(_,t,n,i,e,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,_.renderBufferDirect(n,t,i,r,e,s),r.side=0,r.needsUpdate=!0,_.renderBufferDirect(n,t,i,r,e,s),r.side=2):_.renderBufferDirect(n,t,i,r,e,s),e.onAfterRender(_,t,n,i,r,s)}function Ye(e,t,n){!0!==t.isScene&&(t=X);const i=ne.get(e),r=g.state.lights,s=g.state.shadowsArray,a=r.state.version,o=me.getParameters(e,r.state,s,t,n),l=me.getProgramCacheKey(o);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ue:ce).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Ve),c=new Map,i.programs=c);let u=c.get(l);if(void 0!==u){if(i.currentProgram===u&&i.lightsStateVersion===a)return $e(e,o),u}else o.uniforms=me.getUniforms(e),e.onBuild(n,o,_),e.onBeforeCompile(o,_),u=me.acquireProgram(o,l),c.set(l,u),i.uniforms=o.uniforms;const h=i.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||!0===e.clipping)&&(h.clippingPlanes=ye.uniform),$e(e,o),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=a,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=u,i.uniformsList=null,u}function Ze(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=ka.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function $e(e,t){const n=ne.get(e);
vendor: 4,869 bytes, line 2
2n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}He.setAnimationLoop(function(e){ze&&ze(e)}),typeof self<"u"&&He.setContext(self),this.setAnimationLoop=function(e){ze=e,Pe.setAnimationLoop(e),null===e?He.stop():He.start()},Pe.addEventListener("sessionstart",Be),Pe.addEventListener("sessionend",ke),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Pe.enabled&&!0===Pe.isPresenting&&(!0===Pe.cameraAutoUpdate&&Pe.updateCamera(t),t=Pe.getCamera()),!0===e.isScene&&e.onBeforeRender(_,e,t,T),g=ve.get(e,y.length),g.init(t),y.push(g),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),z.setFromProjectionMatrix(G),k=this.localClippingEnabled,B=ye.init(this.clippingPlanes,k),f=ge.get(e,v.length),f.init(),v.push(f),!0===Pe.enabled&&!0===Pe.isPresenting){const e=_.xr.getDepthSensingMesh();null!==e&&Ge(e,t,-1/0,_.sortObjects)}Ge(e,t,0,_.sortObjects),f.finish(),!0===_.sortObjects&&f.sort(D,U),q=!1===Pe.enabled||!1===Pe.isPresenting||!1===Pe.hasDepthSensing(),q&&Te.addToRenderList(f,e),this.info.render.frame++,!0===B&&ye.beginShadows();const n=g.state.shadowsArray;xe.render(n,e,t),!0===B&&ye.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=f.opaque,r=f.transmissive;if(g.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,s=n.length;t<s;t++){je(i,r,e,n[t])}q&&Te.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];We(f,e,i,i.viewport)}}else r.length>0&&je(i,r,e,t),q&&Te.render(e),We(f,e,t);null!==T&&(re.updateMultisampleRenderTarget(T),re.updateRenderTargetMipmap(T)),!0===e.isScene&&e.onAfterRender(_,e,t),Ae.resetDefaultState(),S=-1,w=null,y.pop(),y.length>0?(g=y[y.length-1],!0===B&&ye.setGlobalState(_.clippingPlanes,g.state.camera)):g=null,v.pop(),f=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(e,t,n){ne.get(e.texture).__webglTexture=t,ne.get(e.depthTexture).__webglTexture=n;const i=ne.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Z.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=ne.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){T=e,M=t,b=n;let i=!0,r=null,s=!1,a=!1;if(e){const o=ne.get(e);if(void 0!==o.__useDefaultFramebuffer)Q.bindFramebuffer(Re.FRAMEBUFFER,null),i=!1;else if(void 0===o.__webglFramebuffer)re.setupRenderTarget(e);else if(o.__hasExternalTextures)re.rebindTextures(e,ne.get(e.texture).__webglTexture,ne.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&ne.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");re.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=ne.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],s=!0):r=e.samples>0&&!1===re.useMultisampledRTT(e)?ne.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,N.copy(e.viewport),E.copy(e.scissor),A=e.scissorTest}else N.copy(O).multiplyScalar(P).floor(),E.copy(V).multiplyScalar(P).floor(),A=F;if(Q.bindFramebuffer(Re.FRAMEBUFFER,r)&&i&&Q.drawBuffers(e,r),Q.viewport(N),Q.scissor(E),Q.setScissorTest(A),s){const i=ne.get(e.texture);Re.framebufferTexture2D(Re.FRAMEBUFFER,Re.COLOR_ATTACHMENT0,Re.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=ne.get(e.texture),r=t||0;Re.framebufferTextureLayer(Re.FRAMEBUFFER,Re.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,a){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ne.get(e).__webglFramebuffer;
vendor: 6,637 bytes, line 2
2if(e.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Q.bindFramebuffer(Re.FRAMEBUFFER,o);try{const a=e.texture,o=a.format,l=a.type;if(!$.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!$.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Re.readPixels(t,n,i,r,Ee.convert(o),Ee.convert(l),s)}finally{const e=null!==T?ne.get(T).__webglFramebuffer:null;Q.bindFramebuffer(Re.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,s,a){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ne.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){const a=e.texture,l=a.format,c=a.type;if(!$.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!$.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){Q.bindFramebuffer(Re.FRAMEBUFFER,o);const e=Re.createBuffer();Re.bindBuffer(Re.PIXEL_PACK_BUFFER,e),Re.bufferData(Re.PIXEL_PACK_BUFFER,s.byteLength,Re.STREAM_READ),Re.readPixels(t,n,i,r,Ee.convert(l),Ee.convert(c),0);const a=null!==T?ne.get(T).__webglFramebuffer:null;Q.bindFramebuffer(Re.FRAMEBUFFER,a);const u=Re.fenceSync(Re.SYNC_GPU_COMMANDS_COMPLETE,0);return Re.flush(),await function(e,t,n){return new Promise(function(i,r){setTimeout(function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}},n)})}(Re,u,4),Re.bindBuffer(Re.PIXEL_PACK_BUFFER,e),Re.getBufferSubData(Re.PIXEL_PACK_BUFFER,0,s),Re.deleteBuffer(e),Re.deleteSync(u),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(Qt("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),a=null!==t?t.x:0,o=null!==t?t.y:0;re.setTexture2D(e,0),Re.copyTexSubImage2D(Re.TEXTURE_2D,n,0,0,a,o,r,s),Q.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let s,a,o,l,c,u;!0!==e.isTexture&&(Qt("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(s=n.max.x-n.min.x,a=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(s=e.image.width,a=e.image.height,o=0,l=0),null!==i?(c=i.x,u=i.y):(c=0,u=0);const h=Ee.convert(t.format),d=Ee.convert(t.type);re.setTexture2D(t,0),Re.pixelStorei(Re.UNPACK_FLIP_Y_WEBGL,t.flipY),Re.pixelStorei(Re.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Re.pixelStorei(Re.UNPACK_ALIGNMENT,t.unpackAlignment);const p=Re.getParameter(Re.UNPACK_ROW_LENGTH),m=Re.getParameter(Re.UNPACK_IMAGE_HEIGHT),f=Re.getParameter(Re.UNPACK_SKIP_PIXELS),g=Re.getParameter(Re.UNPACK_SKIP_ROWS),v=Re.getParameter(Re.UNPACK_SKIP_IMAGES),y=e.isCompressedTexture?e.mipmaps[r]:e.image;Re.pixelStorei(Re.UNPACK_ROW_LENGTH,y.width),Re.pixelStorei(Re.UNPACK_IMAGE_HEIGHT,y.height),Re.pixelStorei(Re.UNPACK_SKIP_PIXELS,o),Re.pixelStorei(Re.UNPACK_SKIP_ROWS,l),e.isDataTexture?Re.texSubImage2D(Re.TEXTURE_2D,r,c,u,s,a,h,d,y.data):e.isCompressedTexture?Re.compressedTexSubImage2D(Re.TEXTURE_2D,r,c,u,y.width,y.height,h,y.data):Re.texSubImage2D(Re.TEXTURE_2D,r,c,u,s,a,h,d,y),Re.pixelStorei(Re.UNPACK_ROW_LENGTH,p),Re.pixelStorei(Re.UNPACK_IMAGE_HEIGHT,m),Re.pixelStorei(Re.UNPACK_SKIP_PIXELS,f),Re.pixelStorei(Re.UNPACK_SKIP_ROWS,g),Re.pixelStorei(Re.UNPACK_SKIP_IMAGES,v),0===r&&t.generateMipmaps&&Re.generateMipmap(Re.TEXTURE_2D),Q.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let s,a,o,l,c,u,h,d,p;!0!==e.isTexture&&(Qt("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const m=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(s=n.max.x-n.min.x,a=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,u=n.min.z):(s=m.width,a=m.height,o=m.depth,l=0,c=0,u=0),null!==i?(h=i.x,d=i.y,p=i.z):(h=0,d=0,p=0);const f=Ee.convert(t.format),g=Ee.convert(t.type);let v;if(t.isData3DTexture)re.setTexture3D(t,0),v=Re.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");re.setTexture2DArray(t,0),v=Re.TEXTURE_2D_ARRAY}Re.pixelStorei(Re.UNPACK_FLIP_Y_WEBGL,t.flipY),Re.pixelStorei(Re.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Re.pixelStorei(Re.UNPACK_ALIGNMENT,t.unpackAlignment);const y=Re.getParameter(Re.UNPACK_ROW_LENGTH),_=Re.getParameter(Re.UNPACK_IMAGE_HEIGHT),x=Re.getParameter(Re.UNPACK_SKIP_PIXELS),M=Re.getParameter(Re.UNPACK_SKIP_ROWS),b=Re.getParameter(Re.UNPACK_SKIP_IMAGES);Re.pixelStorei(Re.UNPACK_ROW_LENGTH,m.width),Re.pixelStorei(Re.UNPACK_IMAGE_HEIGHT,m.height),Re.pixelStorei(Re.UNPACK_SKIP_PIXELS,l),Re.pixelStorei(Re.UNPACK_SKIP_ROWS,c),Re.pixelStorei(Re.UNPACK_SKIP_IMAGES,u),e.isDataTexture||e.isData3DTexture?Re.texSubImage3D(v,r,h,d,p,s,a,o,f,g,m.data):t.isCompressedArrayTexture?Re.compressedTexSubImage3D(v,r,h,d,p,s,a,o,f,m.data):Re.texSubImage3D(v,r,h,d,p,s,a,o,f,g,m),Re.pixelStorei(Re.UNPACK_ROW_LENGTH,y),Re.pixelStorei(Re.UNPACK_IMAGE_HEIGHT,_),Re.pixelStorei(Re.UNPACK_SKIP_PIXELS,x),Re.pixelStorei(Re.UNPACK_SKIP_ROWS,M),Re.pixelStorei(Re.UNPACK_SKIP_IMAGES,b),0===r&&t.generateMipmaps&&Re.generateMipmap(v),Q.unbindTexture()},this.initRenderTarget=function(e){void 0===ne.get(e).__webglFramebuffer&&re.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?re.setTextureCube(e,0):e.isData3DTexture?re.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?re.setTexture2DArray(e,0):re.setTexture2D(e,0),Q.unbindTexture()},this.resetState=function(){M=0,b=0,T=null,Q.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rt}get outputColorSpace(){return this._outputColorSpace}
vendor: 13,715 bytes, line 2
2set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===dt?"display-p3":"srgb",t.unpackColorSpace=sn.workingColorSpace===pt?"display-p3":"srgb"}}class Go{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Gi(e),this.density=t}clone(){return new Go(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}let Wo=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Gi(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}};class jo extends Si{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 oi,this.environmentIntensity=1,this.environmentRotation=new oi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Xo{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Et,this.updateRanges=[],this.version=0,this.uuid=Vt()}onUploadCallback(){}set needsUpdate(e){!0===e&&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 i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Vt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const 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 void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Vt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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}}}const qo=new Mn;class Yo{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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++)qo.fromBufferAttribute(this,t),qo.applyMatrix4(e),this.setXYZ(t,qo.x,qo.y,qo.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)qo.fromBufferAttribute(this,t),qo.applyNormalMatrix(e),this.setXYZ(t,qo.x,qo.y,qo.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)qo.fromBufferAttribute(this,t),qo.transformDirection(e),this.setXYZ(t,qo.x,qo.y,qo.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ht(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ht(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ht(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ht(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ht(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=kt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=kt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=kt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=kt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ht(t,this.array),n=Ht(n,this.array),i=Ht(i,this.array),r=Ht(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new tr(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Yo(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Zo extends Xi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Gi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let $o;const Jo=new Mn,Ko=new Mn,Qo=new Mn,el=new Wt,tl=new Wt,nl=new Jn,il=new Mn,rl=new Mn,sl=new Mn,al=new Wt,ol=new Wt,ll=new Wt;class cl extends Si{constructor(e=new Zo){if(super(),this.isSprite=!0,this.type="Sprite",void 0===$o){$o=new pr;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new Xo(e,5);$o.setIndex([0,1,2,0,2,3]),$o.setAttribute("position",new Yo(t,3,0,!1)),$o.setAttribute("uv",new Yo(t,2,3,!1))}this.geometry=$o,this.material=e,this.center=new Wt(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ko.setFromMatrixScale(this.matrixWorld),nl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ko.multiplyScalar(-Qo.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;ul(il.set(-.5,-.5,0),Qo,s,Ko,i,r),ul(rl.set(.5,-.5,0),Qo,s,Ko,i,r),ul(sl.set(.5,.5,0),Qo,s,Ko,i,r),al.set(0,0),ol.set(1,0),ll.set(1,1);let a=e.ray.intersectTriangle(il,rl,sl,!1,Jo);if(null===a&&(ul(rl.set(-.5,.5,0),Qo,s,Ko,i,r),ol.set(0,1),a=e.ray.intersectTriangle(il,sl,rl,!1,Jo),null===a))return;const o=e.ray.origin.distanceTo(Jo);o<e.near||o>e.far||t.push({distance:o,point:Jo.clone(),uv:Fi.getInterpolation(Jo,il,rl,sl,al,ol,ll,new Wt),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function ul(e,t,n,i,r,s){el.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(tl.x=s*el.x-r*el.y,tl.y=r*el.x+s*el.y):tl.copy(el),e.copy(t),e.x+=tl.x,e.y+=tl.y,e.applyMatrix4(nl)}const hl=new Mn,dl=new Mn;class pl extends Si{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){hl.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(hl);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){hl.setFromMatrixPosition(e.matrixWorld),dl.setFromMatrixPosition(this.matrixWorld);const n=hl.distanceTo(dl)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),!(n>=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,i=n.length;e<i;e++){const i=n[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}const ml=new Mn,fl=new fn,gl=new fn,vl=new Mn,yl=new Jn,_l=new Mn,xl=new Hn,Ml=new Jn,bl=new $n;class Tl extends wr{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=U,this.bindMatrix=new Jn,this.bindMatrixInverse=new Jn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Sn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,_l),this.boundingBox.expandByPoint(_l)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Hn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,_l),this.boundingSphere.expandByPoint(_l)}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,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),xl.copy(this.boundingSphere),xl.applyMatrix4(i),!1!==e.ray.intersectsSphere(xl)&&(Ml.copy(i).invert(),bl.copy(e.ray).applyMatrix4(Ml),(null===this.boundingBox||!1!==bl.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,bl)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new fn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===U?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===O?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 4,652 bytes, line 2
2applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;fl.fromBufferAttribute(i.attributes.skinIndex,e),gl.fromBufferAttribute(i.attributes.skinWeight,e),ml.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=gl.getComponent(e);if(0!==i){const r=fl.getComponent(e);yl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(vl.copy(ml).applyMatrix4(yl),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Sl extends Si{constructor(){super(),this.isBone=!0,this.type="Bone"}}class wl extends mn{constructor(e=null,t=1,n=1,i,r,s,a,o,l=X,c=X,u,h){super(null,s,a,o,l,c,i,r,u,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Nl=new Jn,El=new Jn;class Al{constructor(e=[],t=[]){this.uuid=Vt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)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 e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Jn)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new Jn;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:El;Nl.multiplyMatrices(r,t[i]),Nl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Al(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new wl(t,e,e,pe,re);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Sl),this.bones.push(r),this.boneInverses.push((new Jn).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const s=n[i];e.boneInverses.push(s.toArray())}return e}}class Cl extends tr{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Rl=new Jn,Il=new Jn,Ll=[],Pl=new Sn,Dl=new Jn,Ul=new wr,Ol=new Hn;class Vl extends wr{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Cl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Dl)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Sn),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Rl),Pl.copy(e.boundingBox).applyMatrix4(Rl),this.boundingBox.union(Pl)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Hn),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Rl),Ol.copy(e.boundingSphere).applyMatrix4(Rl),this.boundingSphere.union(Ol)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&
vendor: 3,591 bytes, line 2
2(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ul.geometry=this.geometry,Ul.material=this.material,void 0!==Ul.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Ol.copy(this.boundingSphere),Ol.applyMatrix4(n),!1!==e.ray.intersectsSphere(Ol)))for(let r=0;r<i;r++){this.getMatrixAt(r,Rl),Il.multiplyMatrices(n,Rl),Ul.matrixWorld=Il,Ul.raycast(e,Ll);for(let e=0,n=Ll.length;e<n;e++){const n=Ll[e];n.instanceId=r,n.object=this,t.push(n)}Ll.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new Cl(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new wl(new Float32Array(i*this.count),i,this.count,ye,re));const r=this.morphTexture.source.data.data;let s=0;for(let e=0;e<n.length;e++)s+=n[e];const a=this.geometry.morphTargetsRelative?1:1-s,o=i*e;r[o]=a,r.set(n,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function Fl(e,t){return e.z-t.z}function zl(e,t){return t.z-e.z}class Bl{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const s=i[this.index];r.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t,s.index=n}reset(){this.list.length=0,this.index=0}}const kl=new Jn,Hl=new Jn,Gl=new Jn,Wl=new Gi(1,1,1),jl=new Jn,Xl=new Yr,ql=new Sn,Yl=new Hn,Zl=new Mn,$l=new Mn,Jl=new Mn,Kl=new Bl,Ql=new wr,ec=[];function tc(e,t,n=0){const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)t.setComponent(s+n,r,e.getComponent(s,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}class nc extends wr{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,n=2*t,i){super(new pr,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new wl(t,e,e,pe,re);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new wl(t,e,e,_e,ie);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new wl(t,e,e,pe,re);
2n.colorSpace=sn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),{array:s,itemSize:a,normalized:o}=r,l=new s.constructor(n*a),c=new tr(l,a,o);t.setAttribute(i,c)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new tr(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Sn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,kl),this.getBoundingBoxAt(i,ql).applyMatrix4(kl),e.union(ql)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Hn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,kl),this.getBoundingSphereAt(i,Yl).applyMatrix4(kl),e.union(Yl)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(n=this._availableInstanceIds.pop(),this._drawInfo[n]=t):(n=this._drawInfo.length,this._drawInfo.push(t));const i=this._matricesTexture,r=i.image.data;Gl.toArray(r,16*n),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(Wl.toArray(s.image.data,4*n),s.needsUpdate=!0),n}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const s=this._reservedRanges,a=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(r=s[s.length-1]),i.vertexCount=-1===t?e.getAttribute("position").count:t,i.vertexStart=null===r?0:r.vertexStart+r.vertexCount;const l=e.getIndex(),c=null!==l;if(c&&(i.indexCount=-1===n?l.count:n,i.indexStart=null===r?0:r.indexStart+r.indexCount),-1!==i.indexStart&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,s.push(i),a.push({start:c?i.indexStart:i.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new Sn,sphereInitialized:!1,sphere:new Hn}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=t.getIndex(),a=this._reservedRanges[e];if(i&&s.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,l=a.vertexCount;for(const e in n.attributes){const i=t.getAttribute(e),r=n.getAttribute(e);tc(i,r,o);const s=i.itemSize;for(let e=i.count,t=l;e<t;e++){const t=o+e;for(let e=0;e<s;e++)r.setComponent(t,e,0)}r.needsUpdate=!0,r.addUpdateRange(o*s,l*s)}if(i){const e=a.indexStart;for(let t=0;t<s.count;t++)r.setX(e+t,o+s.getX(t));for(let t=s.count,n=a.indexCount;t<n;t++)r.setX(e+t,o);r.needsUpdate=!0,r.addUpdateRange(e,a.indexCount)}const c=this._bounds[e];null!==t.boundingBox?(c.box.copy(t.boundingBox),c.boxInitialized=!0):c.boxInitialized=!1,null!==t.boundingSphere?(c.sphere.copy(t.boundingSphere),c.sphereInitialized=!0):c.sphereInitialized=!1;const u=this._drawRanges[e],h=t.getAttribute("position");return u.count=i?s.count:h.count,this._visibilityChanged=!0,e}deleteInstance(e){const t=this._drawInfo;return e>=t.length||!1===t[e].active||(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0),this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.box,r=this.geometry;if(!1===n.boxInitialized){i.makeEmpty();const t=r.index,s=r.attributes.position,a=this._drawRanges[e];for(let e=a.start,n=a.start+a.count;e<n;e++){let n=e;t&&(n=t.getX(n)),i.expandByPoint(Zl.fromBufferAttribute(s,n))}n.boxInitialized=!0}return t.copy(i),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.sphere,r=this.geometry;if(!1===n.sphereInitialized){i.makeEmpty(),this.getBoundingBoxAt(e,ql),ql.getCenter(i.center);const t=r.index,s=r.attributes.position,a=this._drawRanges[e];let o=0;for(let e=a.start,n=a.start+a.count;e<n;e++){let n=e;t&&(n=t.getX(n)),Zl.fromBufferAttribute(s,n),o=Math.max(o,i.center.distanceToSquared(Zl))}i.radius=Math.sqrt(o),n.sphereInitialized=!0}return t.copy(i),t}setMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return e>=n.length||!1===n[e].active||(t.toArray(r,16*e),i.needsUpdate=!0),this}getMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture.image.data;return e>=n.length||!1===n[e].active?null:t.fromArray(i,16*e)}setColorAt(e,t){null===this._colorsTexture&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||!1===r[e].active||(t.toArray(i,4*e),n.needsUpdate=!0),this}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||!1===i[e].active?null:t.fromArray(n,4*e)}setVisibleAt(e,t){const n=this._drawInfo;return e>=n.length||!1===n[e].active||n[e].visible===t||(n[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){const t=this._drawInfo;return!(e>=t.length||!1===t[e].active)&&t[e].visible}setGeometryIdAt(e,t){const n=this._drawInfo;return e>=n.length||!1===n[e].active||t<0||t>=this._geometryCount?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||!1===t[e].active?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._drawRanges[e];return t.start=n.start,t.count=n.count,t}raycast(e,t){const n=this._drawInfo,i=this._drawRanges,r=this.matrixWorld,s=this.geometry;Ql.material=this.material,Ql.geometry.index=s.index,Ql.geometry.attributes=s.attributes,null===Ql.geometry.boundingBox&&
vendor: 5,261 bytes, line 2
2(Ql.geometry.boundingBox=new Sn),null===Ql.geometry.boundingSphere&&(Ql.geometry.boundingSphere=new Hn);for(let s=0,a=n.length;s<a;s++){if(!n[s].visible||!n[s].active)continue;const a=n[s].geometryIndex,o=i[a];Ql.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(s,Ql.matrixWorld).premultiply(r),this.getBoundingBoxAt(a,Ql.geometry.boundingBox),this.getBoundingSphereAt(a,Ql.geometry.boundingSphere),Ql.raycast(e,ec);for(let e=0,n=ec.length;e<n;e++){const n=ec[e];n.object=this,n.batchId=s,t.push(n)}ec.length=0}Ql.material=null,Ql.geometry.index=null,Ql.geometry.attributes={},Ql.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(e=>({...e})),this._reservedRanges=e._reservedRanges.map(e=>({...e})),this._drawInfo=e._drawInfo.map(e=>({...e})),this._bounds=e._bounds.map(e=>({boxInitialized:e.boxInitialized,box:e.box.clone(),sphereInitialized:e.sphereInitialized,sphere:e.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),a=null===s?1:s.array.BYTES_PER_ELEMENT,o=this._drawInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,u=this._drawRanges,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;h&&(jl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Xl.setFromProjectionMatrix(jl,e.coordinateSystem));let m=0;if(this.sortObjects){Hl.copy(this.matrixWorld).invert(),Zl.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Hl),$l.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Hl);for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){const t=o[e].geometryIndex;this.getMatrixAt(e,kl),this.getBoundingSphereAt(t,Yl).applyMatrix4(kl);let n=!1;if(h&&(n=!Xl.intersectsSphere(Yl)),!n){const n=Jl.subVectors(Yl.center,Zl).dot($l);Kl.push(u[t],n,e)}}const e=Kl.list,t=this.customSort;null===t?e.sort(r.transparent?zl:Fl):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){const n=e[t];l[m]=n.start*a,c[m]=n.count,p[m]=n.index,m++}Kl.reset()}else for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){const t=o[e].geometryIndex;let n=!1;if(h&&(this.getMatrixAt(e,kl),this.getBoundingSphereAt(t,Yl).applyMatrix4(kl),n=!Xl.intersectsSphere(Yl)),!n){const n=u[t];l[m]=n.start*a,c[m]=n.count,p[m]=e,m++}}d.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,s){this.onBeforeRender(e,null,i,r,s)}}class ic extends Xi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Gi(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}}const rc=new Mn,sc=new Mn,ac=new Jn,oc=new $n,lc=new Hn,cc=new Mn,uc=new Mn;class hc extends Si{constructor(e=new pr,t=new ic){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)rc.fromBufferAttribute(t,e-1),sc.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=rc.distanceTo(sc);e.setAttribute("lineDistance",new sr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(i),lc.radius+=r,!1===e.ray.intersectsSphere(lc))return;ac.copy(i).invert(),oc.copy(e.ray).applyMatrix4(ac);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=n.index,u=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=dc(this,e,oc,o,n,i);
vendor: 4,526 bytes, line 2
2s&&t.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),a=dc(this,e,oc,o,r,s);a&&t.push(a)}}else{const n=Math.max(0,s.start),i=Math.min(u.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=dc(this,e,oc,o,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=dc(this,e,oc,o,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function dc(e,t,n,i,r,s){const a=e.geometry.attributes.position;if(rc.fromBufferAttribute(a,r),sc.fromBufferAttribute(a,s),n.distanceSqToSegment(rc,sc,cc,uc)>i)return;cc.applyMatrix4(e.matrixWorld);const o=t.ray.origin.distanceTo(cc);return o<t.near||o>t.far?void 0:{distance:o,point:uc.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:e}}const pc=new Mn,mc=new Mn;class fc extends hc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)pc.fromBufferAttribute(t,e),mc.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+pc.distanceTo(mc);e.setAttribute("lineDistance",new sr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gc extends hc{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class vc extends Xi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Gi(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}}const yc=new Jn,_c=new $n,xc=new Hn,Mc=new Mn;class bc extends Si{constructor(e=new pr,t=new vc){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),xc.copy(n.boundingSphere),xc.applyMatrix4(i),xc.radius+=r,!1===e.ray.intersectsSphere(xc))return;yc.copy(i).invert(),_c.copy(e.ray).applyMatrix4(yc);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=n.index,c=n.attributes.position;if(null!==l){for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);Mc.fromBufferAttribute(c,r),Tc(Mc,r,o,i,e,t,this)}}else{for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)Mc.fromBufferAttribute(c,n),Tc(Mc,n,o,i,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Tc(e,t,n,i,r,s,a){const o=_c.distanceSqToPoint(e);if(o<n){const n=new Mn;_c.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class Sc extends mn{constructor(e,t,n,i,r,s,a,o,l){super(e,t,n,i,r,s,a,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Z,this.magFilter=void 0!==r?r:Z,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)})}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e==!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class wc extends mn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=X,this.minFilter=X,this.generateMipmaps=!1,this.needsUpdate=!0}}class Nc extends mn{constructor(e,t,n,i,r,s,a,o,l,c,u,h){super(null,s,a,o,l,c,i,r,u,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}
vendor: 20,020 bytes, line 2
2class Ec extends Nc{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=W,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ac extends Nc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,F),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Cc extends mn{constructor(e,t,n,i,r,s,a,o,l){super(e,t,n,i,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Rc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const 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;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){let n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),s=this.getPoint(i),a=t||(r.isVector2?new Wt:new Mn);return a.copy(s).sub(r).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Mn,i=[],r=[],s=[],a=new Mn,o=new Jn;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Mn)}r[0]=new Mn,s[0]=new Mn;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(i[t-1],i[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(Ft(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Ft(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ic extends Rc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t=new Wt){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0===this.aClockwise&&!s&&(r===i?r=-i:r-=i);const a=this.aStartAngle+e*r;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=o-this.aX,i=l-this.aY;o=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(o,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(){const 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}}class Lc extends Ic{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function Pc(){let e=0,t=0,n=0,i=0;function r(r,s,a,o){e=r,t=a,n=-3*r+3*s-2*a-o,i=2*r-2*s+a+o}return{initCatmullRom:function(e,t,n,i,s){r(t,n,s*(n-e),s*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,s,a,o){let l=(t-e)/s-(n-e)/(s+a)+(n-t)/a,c=(n-t)/a-(i-t)/(a+o)+(i-n)/o;l*=a,c*=a,r(t,n,l,c)},calc:function(r){const s=r*r;return e+t*r+n*s+i*(s*r)}}}const Dc=new Mn,Uc=new Pc,Oc=new Pc,Vc=new Pc;class Fc extends Rc{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Mn){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let a,o,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(Dc.subVectors(i[0],i[1]).add(i[0]),a=Dc);const u=i[l%r],h=i[(l+1)%r];if(this.closed||l+2<r?o=i[(l+2)%r]:(Dc.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=Dc),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(a.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(h),e),i=Math.pow(h.distanceToSquared(o),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),Uc.initNonuniformCatmullRom(a.x,u.x,h.x,o.x,t,n,i),Oc.initNonuniformCatmullRom(a.y,u.y,h.y,o.y,t,n,i),Vc.initNonuniformCatmullRom(a.z,u.z,h.z,o.z,t,n,i)}else"catmullrom"===this.curveType&&(Uc.initCatmullRom(a.x,u.x,h.x,o.x,this.tension),Oc.initCatmullRom(a.y,u.y,h.y,o.y,this.tension),Vc.initCatmullRom(a.z,u.z,h.z,o.z,this.tension));return n.set(Uc.calc(c),Oc.calc(c),Vc.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.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++){const n=e.points[t];this.points.push((new Mn).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function zc(e,t,n,i,r){const s=.5*(i-t),a=.5*(r-n),o=e*e;return(2*n-2*i+s+a)*(e*o)+(-3*n+3*i-2*s-a)*o+s*e+n}function Bc(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function kc(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class Hc extends Rc{constructor(e=new Wt,t=new Wt,n=new Wt,i=new Wt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Wt){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(kc(e,i.x,r.x,s.x,a.x),kc(e,i.y,r.y,s.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(){const 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}}class Gc extends Rc{constructor(e=new Mn,t=new Mn,n=new Mn,i=new Mn){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Mn){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(kc(e,i.x,r.x,s.x,a.x),kc(e,i.y,r.y,s.y,a.y),kc(e,i.z,r.z,s.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(){const 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}}class Wc extends Rc{constructor(e=new Wt,t=new Wt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Wt){const n=t;return 1===e?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 Wt){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(){const 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}}class jc extends Rc{constructor(e=new Mn,t=new Mn){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Mn){const n=t;return 1===e?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 Mn){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(){const 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}}class Xc extends Rc{constructor(e=new Wt,t=new Wt,n=new Wt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Wt){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(Bc(e,i.x,r.x,s.x),Bc(e,i.y,r.y,s.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(){const 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}}class qc extends Rc{constructor(e=new Mn,t=new Mn,n=new Mn){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Mn){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(Bc(e,i.x,r.x,s.x),Bc(e,i.y,r.y,s.y),Bc(e,i.z,r.z,s.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(){const 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}}class Yc extends Rc{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Wt){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return n.set(zc(a,o.x,l.x,c.x,u.x),zc(a,o.y,l.y,c.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Wt).fromArray(n))}return this}}var Zc=Object.freeze({__proto__:null,ArcCurve:Lc,CatmullRomCurve3:Fc,CubicBezierCurve:Hc,CubicBezierCurve3:Gc,EllipseCurve:Ic,LineCurve:Wc,LineCurve3:jc,QuadraticBezierCurve:Xc,QuadraticBezierCurve3:qc,SplineCurve:Yc});class $c extends Rc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Zc[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}r++}return null}getLength(){const 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;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const 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){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,o=s.getPoints(a);for(let e=0;e<o.length;e++){const i=o[e];n&&n.equals(i)||(t.push(i),n=i)}}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++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.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++){const n=e.curves[t];this.curves.push((new Zc[n.type]).fromJSON(n))}return this}}class Jc extends $c{constructor(e){super(),this.type="Path",this.currentPoint=new Wt,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){const n=new Wc(this.currentPoint.clone(),new Wt(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new Xc(this.currentPoint.clone(),new Wt(e,t),new Wt(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const a=new Hc(this.currentPoint.clone(),new Wt(e,t),new Wt(n,i),new Wt(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Yc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+a,t+o,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,a,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,s,a,o),this}absellipse(e,t,n,i,r,s,a,o){const l=new Ic(e,t,n,i,r,s,a,o);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Kc extends pr{constructor(e=[new Wt(0,-.5),new Wt(.5,0),new Wt(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Ft(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],c=1/t,u=new Mn,h=new Wt,d=new Mn,p=new Mn,m=new Mn;let f=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(m.x,m.y,m.z);break;default:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let r=0;r<=t;r++){const d=n+r*c*i,p=Math.sin(d),m=Math.cos(d);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,s.push(u.x,u.y,u.z),h.x=r/t,h.y=n/(e.length-1),a.push(h.x,h.y);const i=o[3*n+0]*p,c=o[3*n+1],d=o[3*n+0]*m;l.push(i,c,d)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const i=t+n*e.length,s=i,a=i+e.length,o=i+e.length+1,l=i+1;r.push(s,a,l),r.push(o,l,a)}this.setIndex(r),this.setAttribute("position",new sr(s,3)),this.setAttribute("uv",new sr(a,2)),this.setAttribute("normal",new sr(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kc(e.points,e.segments,e.phiStart,e.phiLength)}}class Qc extends Kc{constructor(e=1,t=1,n=4,i=8){const r=new Jc;r.absarc(0,-t/2,e,1.5*Math.PI,0),r.absarc(0,t/2,e,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Qc(e.radius,e.length,e.capSegments,e.radialSegments)}}class eu extends pr{constructor(e=1,t=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],s=[],a=[],o=[],l=new Mn,c=new Wt;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,u=3;r<=t;r++,u+=3){const h=n+r/t*i;l.x=e*Math.cos(h),l.y=e*Math.sin(h),s.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(s[u]/e+1)/2,c.y=(s[u+1]/e+1)/2,o.push(c.x,c.y)}for(let e=1;e<=t;e++)r.push(e,e+1,0);this.setIndex(r),this.setAttribute("position",new sr(s,3)),this.setAttribute("normal",new sr(a,3)),this.setAttribute("uv",new sr(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eu(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class tu extends pr{constructor(e=1,t=1,n=1,i=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],u=[],h=[],d=[];let p=0;const m=[],f=n/2;let g=0;function v(n){const r=p,s=new Wt,m=new Mn;let v=0;const y=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=i;e++)u.push(0,f*_,0),h.push(0,_,0),d.push(.5,.5),p++;const x=p;for(let e=0;e<=i;e++){const t=e/i*o+a,n=Math.cos(t),r=Math.sin(t);m.x=y*r,m.y=f*_,m.z=y*n,u.push(m.x,m.y,m.z),h.push(0,_,0),s.x=.5*n+.5,s.y=.5*r*_+.5,d.push(s.x,s.y),p++}for(let e=0;e<i;e++){const t=r+e,i=x+e;!0===n?c.push(i,i+1,t):c.push(i+1,i,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}(function(){const s=new Mn,v=new Mn;let y=0;const _=(t-e)/n;for(let l=0;l<=r;l++){const c=[],g=l/r,y=g*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*o+a,l=Math.sin(r),m=Math.cos(r);v.x=y*l,v.y=-g*n+f,v.z=y*m,u.push(v.x,v.y,v.z),s.set(l,_,m).normalize(),h.push(s.x,s.y,s.z),d.push(t,1-g),c.push(p++)}m.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const r=m[i][n],s=m[i+1][n],a=m[i+1][n+1],o=m[i][n+1];e>0&&(c.push(r,s,o),y+=3),t>0&&(c.push(s,a,o),y+=3)}l.addGroup(g,y,0),g+=y})(),!1===s&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new sr(u,3)),this.setAttribute("normal",new sr(h,3)),this.setAttribute("uv",new sr(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class nu extends tu{constructor(e=1,t=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,e,t,n,i,r,s,a),this.type="C
2oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(e){return new nu(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class iu extends pr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function a(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?a:a.clone().lerp(o,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){const n=Math.floor(t/2);t%2==0?(o(s[e][n+1]),o(s[e+1][n]),o(s[e][n])):(o(s[e][n+1]),o(s[e+1][n+1]),o(s[e+1][n]))}}function o(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}(function(e){const n=new Mn,i=new Mn,r=new Mn;for(let s=0;s<t.length;s+=3)l(t[s+0],n),l(t[s+1],i),l(t[s+2],r),a(n,i,r,e)})(i),function(e){const t=new Mn;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new Mn;for(let t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];const n=u(e)/2/Math.PI+.5,i=h(e)/Math.PI+.5;s.push(n,1-i)}(function(){const e=new Mn,t=new Mn,n=new Mn,i=new Mn,a=new Wt,o=new Wt,l=new Wt;for(let h=0,d=0;h<r.length;h+=9,d+=6){e.set(r[h+0],r[h+1],r[h+2]),t.set(r[h+3],r[h+4],r[h+5]),n.set(r[h+6],r[h+7],r[h+8]),a.set(s[d+0],s[d+1]),o.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=u(i);c(a,d+0,e,p),c(o,d+2,t,p),c(l,d+4,n,p)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],n=s[e+2],i=s[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);r>.9&&a<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new sr(r,3)),this.setAttribute("normal",new sr(r.slice(),3)),this.setAttribute("uv",new sr(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iu(e.vertices,e.indices,e.radius,e.details)}}class ru extends iu{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 14,607 bytes, line 2
219,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ru(e.radius,e.detail)}}const su=new Mn,au=new Mn,ou=new Mn,lu=new Fi;class cu extends pr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=Math.pow(10,4),i=Math.cos(Ut*t),r=e.getIndex(),s=e.getAttribute("position"),a=r?r.count:s.count,o=[0,0,0],l=["a","b","c"],c=new Array(3),u={},h=[];for(let e=0;e<a;e+=3){r?(o[0]=r.getX(e),o[1]=r.getX(e+1),o[2]=r.getX(e+2)):(o[0]=e,o[1]=e+1,o[2]=e+2);const{a:t,b:a,c:d}=lu;if(t.fromBufferAttribute(s,o[0]),a.fromBufferAttribute(s,o[1]),d.fromBufferAttribute(s,o[2]),lu.getNormal(ou),c[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,c[1]=`${Math.round(a.x*n)},${Math.round(a.y*n)},${Math.round(a.z*n)}`,c[2]=`${Math.round(d.x*n)},${Math.round(d.y*n)},${Math.round(d.z*n)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=c[e],r=c[t],s=lu[l[e]],a=lu[l[t]],d=`${n}_${r}`,p=`${r}_${n}`;p in u&&u[p]?(ou.dot(u[p].normal)<=i&&(h.push(s.x,s.y,s.z),h.push(a.x,a.y,a.z)),u[p]=null):d in u||(u[d]={index0:o[e],index1:o[t],normal:ou.clone()})}}for(const e in u)if(u[e]){const{index0:t,index1:n}=u[e];su.fromBufferAttribute(s,t),au.fromBufferAttribute(s,n),h.push(su.x,su.y,su.z),h.push(au.x,au.y,au.z)}this.setAttribute("position",new sr(h,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class uu extends Jc{constructor(e){super(e),this.uuid=Vt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;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++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.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++){const n=e.holes[t];this.holes.push((new Jc).fromJSON(n))}return this}}const hu=function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=du(e,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,u,h,d,p;if(i&&(s=function(e,t,n,i){const r=[];let s,a,o,l,c;for(s=0,a=t.length;s<a;s++)o=t[s]*i,l=s<a-1?t[s+1]*i:e.length,c=du(e,o,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Tu(c));for(r.sort(_u),s=0;s<r.length;s++)n=xu(r[s],n);return n}(e,t,s,n)),e.length>80*n){o=c=e[0],l=u=e[1];for(let t=n;t<r;t+=n)h=e[t],d=e[t+1],h<o&&(o=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-o,u-l),p=0!==p?32767/p:0}return mu(s,a,n,o,l,p,0),a};function du(e,t,n,i,r){let s,a;if(r===function(e,t,n,i){let r=0;for(let s=t,a=n-i;s<n;s+=i)r+=(e[a]-e[s])*(e[s+1]+e[a+1]),a=s;return r}(e,t,n,i)>0)for(s=t;s<n;s+=i)a=Pu(s,e[s],e[s+1],a);else for(s=n-i;s>=t;s-=i)a=Pu(s,e[s],e[s+1],a);return a&&Eu(a,a.next)&&(Du(a),a=a.next),a}function pu(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Eu(i,i.next)&&0!==Nu(i.prev,i,i.next))i=i.next;else{if(Du(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function mu(e,t,n,i,r,s,a){if(!e)return;!a&&s&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=bu(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,a,o,l,c=1;do{for(n=e,e=null,s=null,a=0;n;){for(a++,i=n,o=0,t=0;t<c&&(o++,i=i.nextZ,i);t++);for(l=c;o>0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(e,i,r,s);let o,l,c=e;for(;e.prev!==e.next;)if(o=e.prev,l=e.next,s?gu(e,i,r,s):fu(e))t.push(o.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),Du(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?mu(e=vu(pu(e),t,n),t,n,i,r,s,2):2===a&&yu(e,t,n,i,r,s):mu(pu(e),t,n,i,r,s,1);break}}function fu(e){const t=e.prev,n=e,i=e.next;if(Nu(t,n,i)>=0)return!1;const r=t.x,s=n.x,a=i.x,o=t.y,l=n.y,c=i.y,u=r<s?r<a?r:a:s<a?s:a,h=o<l?o<c?o:c:l<c?l:c,d=r>s?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=p&&Su(r,o,s,l,a,c,m.x,m.y)&&Nu(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function gu(e,t,n,i){const r=e.prev,s=e,a=e.next;if(Nu(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,h=s.y,d=a.y,p=o<l?o<c?o:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,f=o>l?o>c?o:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,v=bu(p,m,t,n,i),y=bu(f,g,t,n,i);let _=e.prevZ,x=e.nextZ;for(;_&&_.z>=v&&x&&x.z<=y;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Su(o,u,l,h,c,d,_.x,_.y)&&Nu(_.prev,_,_.next)>=0||(_=_.prevZ,x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Su(o,u,l,h,c,d,x.x,x.y)&&Nu(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;_&&_.z>=v;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Su(o,u,l,h,c,d,_.x,_.y)&&Nu(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Su(o,u,l,h,c,d,x.x,x.y)&&Nu(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function vu(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Eu(r,s)&&Au(r,i,i.next,s)&&Iu(r,s)&&Iu(s,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(s.i/n|0),Du(i),Du(i.next),i=e=s),i=i.next}while(i!==e);return pu(i)}function yu(e,t,n,i,r,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&wu(a,e)){let o=Lu(a,e);return a=pu(a,a.next),o=pu(o,o.next),mu(a,t,n,i,r,s,0),void mu(o,t,n,i,r,s,0)}e=e.next}a=a.next}while(a!==e)}function _u(e,t){return e.x-t.x}function xu(e,t){const n=function(e,t){let n,i=t,r=-1/0;const s=e.x,a=e.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=s&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===s))return n}i=i.next}while(i!==t);if(!n)return null;const o=n,l=n.x,c=n.y;let u,h=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&Su(a<c?s:r,a,l,c,a<c?r:s,a,i.x,i.y)&&(u=Math.abs(a-i.y)/(s-i.x),Iu(i,e)&&(u<h||u===h&&(i.x>n.x||i.x===n.x&&Mu(n,i)))&&(n=i,h=u)),i=i.next}while(i!==o);return n}(e,t);if(!n)return t;const i=Lu(n,e);return pu(i,i.next),pu(n,n.next)}function Mu(e,t){return Nu(e.prev,e,t.prev)<0&&Nu(t.next,e,e.next)<0}function bu(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Tu(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Su(e,t,n,i,r,s,a,o){return(r-a)*(t-o)>=(e-a)*(s-o)&&(e-a)*(i-o)>=(n-a)*(t-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function wu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Au(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Iu(e,t)&&Iu(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Nu(e.prev,e,t.prev)||Nu(e,t.prev,t))||Eu(e,t)&&Nu(e.prev,e,e.next)>0&&Nu(t.prev,t,t.next)>0)}function Nu(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Eu(e,t){return e.x===t.x&&e.y===t.y}function Au(e,t,n,i){const r=Ru(Nu(e,t,n)),s=Ru(Nu(e,t,i)),a=Ru(Nu(n,i,e)),o=Ru(Nu(n,i,t));return!!(r!==s&&a!==o||0===r&&Cu(e,n,t)||0===s&&Cu(e,i,t)||0===a&&Cu(n,e,i)||0===o&&Cu(n,t,i))}function Cu(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ru(e){return e>0?1:e<0?-1:0}function Iu(e,t){return Nu(e.prev,e,e.next)<0?Nu(e,t,e.next)>=0&&Nu(e,e.prev,t)>=0:Nu(e,t,e.prev)<0||Nu(e,e.next,t)<0}function Lu(e,t){const n=new Uu(e.i,e.x,e.y),i=new Uu(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Pu(e,t,n,i){const r=new Uu(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Du(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Uu(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ou{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return Ou.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];Vu(e),Fu(n,e);let s=e.length;t.forEach(Vu);for(let e=0;e<t.length;e++)i.push(s),s+=t[e].length,Fu(n,t[e]);const a=hu(n,i);for(let e=0;e<a.length;e+=3)r.push(a.slice(e,e+3));return r}}function Vu(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Fu(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class zu extends pr{constructor(e=new uu([new Wt(.5,.5),new Wt(-.5,.5),new Wt(-.5,-.5),new Wt(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let t=0,n=e.length;t<n;t++){s(e[t])}function s(e){const s=[],a=void 0!==t.curveSegments?t.curveSegments:12,o=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:.2,h=void 0!==t.bevelSize?t.bevelSize:u-.1,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const m=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:Bu;let g,v,y,_,x,M=!1;m&&(g=m.getSpacedPoints(o),M=!0,c=!1,v=m.computeFrenetFrames(o,!1),y=new Mn,_=new Mn,x=new Mn),c||(p=0,u=0,h=0,d=0);const b=e.extractPoints(a);let T=b.shape;const S=b.holes;if(!Ou.isClockWise(T)){T=T.reverse();for(let e=0,t=S.length;e<t;e++){const t=S[e];Ou.isClockWise(t)&&(S[e]=t.reverse())}}const w=Ou.triangulateShape(T,S),N=T;for(let e=0,t=S.length;e<t;e++){const t=S[e];T=T.concat(t)}function E(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}const A=T.length,C=w.length;function R(e,t,n){let i,r,s;const a=e.x-t.x,o=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=a*a+o*o,h=a*c-o*l;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(l*l+c*c),p=t.x-o/h,m=t.y+a/h,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-e.x,r=m+o*f-e.y;const g=i*i+r*r;if(g<=2)return new Wt(i,r);s=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(c)&&(e=!0),e?(i=-o,r=a,s=Math.sqrt(u)):(i=a,r=o,s=Math.sqrt(u/2))}return new Wt(i/s,r/s)}const I=[];for(let e=0,t=N.length,n=t-1,i=e+1;e<t;e++,n++,i++)n===t&&(n=0),i===t&&(i=0),I[e]=R(N[e],N[n],N[i]);const L=[];let P,D=I.concat();for(let e=0,t=S.length;e<t;e++){const t=S[e];P=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),P[e]=R(t[e],t[i],t[r]);L.push(P),D=D.concat(P)}for(let e=0;e<p;e++){const t=e/p,n=u*Math.cos(t*Math.PI/2),i=h*Math.sin(t*Math.PI/2)+d;for(let e=0,t=N.length;e<t;e++){const t=E(N[e],I[e],i);V(t.x,t.y,-n)}for(let e=0,t=S.length;e<t;e++){const t=S[e];P=L[e];for(let e=0,r=t.length;e<r;e++){const r=E(t[e],P[e],i);V(r.x,r.y,-n)}}}const U=h+d;for(let e=0;e<A;e++){const t=c?E(T[e],D[e],U):T[e];M?(_.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(_).add(y),V(x.x,x.y,x.z)):V(t.x,t.y,0)}for(let e=1;e<=o;e++)for(let t=0;t<A;t++){const n=c?E(T[t],D[t],U):T[t];M?(_.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(_).add(y),V(x.x,x.y,x.z)):V(n.x,n.y,l/o*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=u*Math.cos(t*Math.PI/2),i=h*Math.sin(t*Math.PI/2)+d;for(let e=0,t=N.length;e<t;e++){const t=E(N[e],I[e],i);V(t.x,t.y,l+n)}for(let e=0,t=S.length;e<t;e++){const t=S[e];P=L[e];for(let e=0,r=t.length;e<r;e++){const r=E(t[e],P[e],i);M?V(r.x,r.y+g[o-1].y,g[o-1].x+n):V(r.x,r.y,l+n)}}}function O(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*p;e<n;e++){const n=A*e,s=A*(e+1);z(t+i+n,t+r+n,t+r+s,t+i+s)}}}function V(e,t,n){s.push(e),s.push(t),s.push(n)}function F(e,t,r){B(e),B(t),B(r);const s=i.length/3,a=f.generateTopUV(n,i,s-3,s-2,s-1);k(a[0]),k(a[1]),k(a[2])}function z(e,t,r,s){B(e),B(t),B(s),B(t),B(r),B(s);const a=i.length/3,o=f.generateSideWallUV(n,i,a-6,a-3,a-2,a-1);k(o[0]),k(o[1]),k(o[3]),k(o[1]),k(o[2]),k(o[3])}function B(e){i.push(s[3*e+0]),i.push(s[3*e+1]),i.push(s[3*e+2])}function k(e){r.push(e.x),r.push(e.y)}(function(){const e=i.length/3;if(c){let e=0,t=A*e;for(let e=0;e<C;e++){const n=w[e];F(n[2]+t,n[1]+t,n[0]+t)}e=o+2*p,t=A*e;for(let e=0;e<C;e++){const n=w[e];F(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<C;e++){const t=w[e];F(t[2],t[1],t[0])}for(let e=0;e<C;e++){const t=w[e];F(t[0]+A*o,t[1]+A*o,t[2]+A*o)}}n.addGroup(e,i.length/3-e,0)})(),function(){const e=i.length/3;let t=0;O(N,t),t+=N.length;for(let e=0,n=S.length;e<n;e++){const n=S[e];O(n,t),t+=n.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new sr(i,3)),this.setAttribute("uv",new sr(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){const i=e[t];n.shapes.push(i.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}const i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=(new Zc[i.type]).fromJSON(i)),new zu(n,e.options)}}const Bu={generateTopUV:function(e,t,n,i,r){const s=t[3*n],a=t[3*n+1],o=t[3*i],l=t[3*i+1],c=t[3*r],u=t[3*r+1];return[new Wt(s,a),new Wt(o,l),new Wt(c,u)]},generateSideWallUV:function(e,t,n,i,r,s){const a=t[3*n],o=t[3*n+1],l=t[3*n+2],c=t[3*i],u=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],m=t[3*r+2],f=t[3*s],g=t[3*s+1],v=t[3*s+2];return Math.abs(o-u)<Math.abs(a-c)?[new Wt(a,1-l),new Wt(c,1-h),new Wt(d,1-m),new Wt(f,1-v)]:[new Wt(o,1-l),new Wt(u,1-h),new Wt(p,1-m),new Wt(g,1-v)]}};class ku extends iu{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-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],[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],e,t),this.type="IcosahedronGeometry",this.parameters={radiu
vendor: 4,192 bytes, line 2
2s:e,detail:t}}static fromJSON(e){return new ku(e.radius,e.detail)}}class Hu extends iu{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Hu(e.radius,e.detail)}}class Gu extends pr{constructor(e=.5,t=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const a=[],o=[],l=[],c=[];let u=e;const h=(t-e)/(i=Math.max(1,i)),d=new Mn,p=new Wt;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*s;d.x=u*Math.cos(i),d.y=u*Math.sin(i),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,c.push(p.x,p.y)}u+=h}for(let e=0;e<i;e++){const t=e*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i,s=i+n+1,o=i+n+2,l=i+1;a.push(r,s,l),a.push(s,o,l)}}this.setIndex(a),this.setAttribute("position",new sr(o,3)),this.setAttribute("normal",new sr(l,3)),this.setAttribute("uv",new sr(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gu(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Wu extends pr{constructor(e=new uu([new Wt(0,.5),new Wt(-.5,-.5),new Wt(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],s=[];let a=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(a,o,t),a+=o,o=0;function l(e){const a=i.length/3,l=e.extractPoints(t);let c=l.shape;const u=l.holes;!1===Ou.isClockWise(c)&&(c=c.reverse());for(let e=0,t=u.length;e<t;e++){const t=u[e];!0===Ou.isClockWise(t)&&(u[e]=t.reverse())}const h=Ou.triangulateShape(c,u);for(let e=0,t=u.length;e<t;e++){const t=u[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];i.push(t.x,t.y,0),r.push(0,0,1),s.push(t.x,t.y)}for(let e=0,t=h.length;e<t;e++){const t=h[e],i=t[0]+a,r=t[1]+a,s=t[2]+a;n.push(i,r,s),o+=3}}this.setIndex(n),this.setAttribute("position",new sr(i,3)),this.setAttribute("normal",new sr(r,3)),this.setAttribute("uv",new sr(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Wu(n,e.curveSegments)}}class ju extends pr{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const o=Math.min(s+a,Math.PI);let l=0;const c=[],u=new Mn,h=new Mn,d=[],p=[],m=[],f=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0===d&&0===s?y=.5/t:d===n&&o===Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const o=n/t;u.x=-e*Math.cos(i+o*r)*Math.sin(s+v*a),u.y=e*Math.cos(s+v*a),u.z=e*Math.sin(i+o*r)*Math.sin(s+v*a),p.push(u.x,u.y,u.z),h.copy(u).normalize(),m.push(h.x,h.y,h.z),f.push(o+y,1-v),g.push(l++)}c.push(g)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=c[e][i+1],r=c[e][i],a=c[e+1][i],l=c[e+1][i+1];(0!==e||s>0)&&d.push(t,r,l),(e!==n-1||o<Math.PI)&&d.push(r,a,l)}this.setIndex(d),this.setAttribute("position",new sr(p,3)),this.setAttribute("normal",new sr(m,3)),this.setAttribute("uv",new sr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ju(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Xu extends iu{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Xu(e.radius,e.detail)}}class qu extends pr{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radiu
vendor: 2,075 bytes, line 2
2s:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],o=[],l=[],c=new Mn,u=new Mn,h=new Mn;for(let s=0;s<=n;s++)for(let d=0;d<=i;d++){const p=d/i*r,m=s/n*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(p),u.y=(e+t*Math.cos(m))*Math.sin(p),u.z=t*Math.sin(m),a.push(u.x,u.y,u.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),h.subVectors(u,c).normalize(),o.push(h.x,h.y,h.z),l.push(d/i),l.push(s/n)}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*e+t-1,r=(i+1)*(e-1)+t-1,a=(i+1)*(e-1)+t,o=(i+1)*e+t;s.push(n,r,o),s.push(r,a,o)}this.setIndex(s),this.setAttribute("position",new sr(a,3)),this.setAttribute("normal",new sr(o,3)),this.setAttribute("uv",new sr(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qu(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Yu extends pr{constructor(e=1,t=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],u=new Mn,h=new Mn,d=new Mn,p=new Mn,m=new Mn,f=new Mn,g=new Mn;for(let a=0;a<=n;++a){const y=a/n*r*Math.PI*2;v(y,r,s,e,d),v(y+.01,r,s,e,p),f.subVectors(p,d),g.addVectors(p,d),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,s=-t*Math.cos(r),p=t*Math.sin(r);u.x=d.x+(s*g.x+p*m.x),u.y=d.y+(s*g.y+p*m.y),u.z=d.z+(s*g.z+p*m.z),o.push(u.x,u.y,u.z),h.subVectors(u,d).normalize(),l.push(h.x,h.y,h.z),c.push(a/n),c.push(e/i)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,o=(i+1)*(e-1)+t;a.push(n,r,o),a.push(r,s,o)}function v(e,t,n,i,r){const s=Math.cos(e),a=Math.sin(e),o=n/t*e,l=Math.cos(o);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*a*.5,r.z=i*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new sr(o,3)),this.setAttribute("normal",new sr(l,3)),this.setAttribute("uv",new sr(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}
vendor: 14,230 bytes, line 2
2static fromJSON(e){return new Yu(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Zu extends pr{constructor(e=new qc(new Mn(-1,-1,0),new Mn(-1,1,0),new Mn(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const s=e.computeFrenetFrames(t,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const a=new Mn,o=new Mn,l=new Wt;let c=new Mn;const u=[],h=[],d=[],p=[];function m(r){c=e.getPointAt(r/t,c);const l=s.normals[r],d=s.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),s=-Math.cos(t);o.x=s*l.x+r*d.x,o.y=s*l.y+r*d.y,o.z=s*l.z+r*d.z,o.normalize(),h.push(o.x,o.y,o.z),a.x=c.x+n*o.x,a.y=c.y+n*o.y,a.z=c.z+n*o.z,u.push(a.x,a.y,a.z)}}(function(){for(let e=0;e<t;e++)m(e);m(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,a=(i+1)*(e-1)+t;p.push(n,r,a),p.push(r,s,a)}}()})(),this.setIndex(p),this.setAttribute("position",new sr(u,3)),this.setAttribute("normal",new sr(h,3)),this.setAttribute("uv",new sr(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Zu((new Zc[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class $u extends pr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new Mn,r=new Mn;if(null!==e.index){const s=e.attributes.position,a=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],c=l.start;for(let e=c,o=c+l.count;e<o;e+=3)for(let o=0;o<3;o++){const l=a.getX(e+o),c=a.getX(e+(o+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===Ju(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let e=0,a=s.count/3;e<a;e++)for(let a=0;a<3;a++){const o=3*e+a,l=3*e+(a+1)%3;i.fromBufferAttribute(s,o),r.fromBufferAttribute(s,l),!0===Ju(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new sr(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Ju(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var Ku=Object.freeze({__proto__:null,BoxGeometry:Er,CapsuleGeometry:Qc,CircleGeometry:eu,ConeGeometry:nu,CylinderGeometry:tu,DodecahedronGeometry:ru,EdgesGeometry:cu,ExtrudeGeometry:zu,IcosahedronGeometry:ku,LatheGeometry:Kc,OctahedronGeometry:Hu,PlaneGeometry:Jr,PolyhedronGeometry:iu,RingGeometry:Gu,ShapeGeometry:Wu,SphereGeometry:ju,TetrahedronGeometry:Xu,TorusGeometry:qu,TorusKnotGeometry:Yu,TubeGeometry:Zu,WireframeGeometry:$u});class Qu extends Xi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Gi(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class eh extends Lr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class th extends Xi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Gi(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 Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(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 oi,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}}class nh extends th{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 Wt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ft(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Gi(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 Gi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Gi(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}}class ih extends Xi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Gi(16777215),this.specular=new Gi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new oi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class rh extends Xi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Gi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class sh extends Xi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ah extends Xi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Gi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new oi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(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.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.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.flatShading=e.flatShading,this.fog=e.fog,this}}
vendor: 14,291 bytes, line 2
2class oh extends Xi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Gi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lh extends ic{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ch(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function uh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hh(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function dh(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[a++]=e[i+n]}return r}function ph(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(t.push(s.time),n.push.apply(n,a)),s=e[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(t.push(s.time),a.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(t.push(s.time),n.push(a)),s=e[r++]}while(void 0!==s)}const mh={convertArray:ch,isTypedArray:uh,getKeyframeOrder:hh,sortedArray:dh,flattenJSON:ph,subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const a=[];for(let e=0;e<s.tracks.length;++e){const t=s.tracks[e],o=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const s=t.times[e]*r;if(!(s<n||s>=i)){l.push(t.times[e]);for(let n=0;n<o;++n)c.push(t.values[e*o+n])}}0!==l.length&&(t.times=ch(l,t.times.constructor),t.values=ch(c,t.values.constructor),a.push(t))}s.tracks=a;let o=1/0;for(let e=0;e<s.tracks.length;++e)o>s.tracks[e].times[0]&&(o=s.tracks[e].times[0]);for(let e=0;e<s.tracks.length;++e)s.tracks[e].shift(-1*o);return s.resetDuration(),s},makeClipAdditive:function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let t=0;t<r;++t){const i=n.tracks[t],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const a=e.tracks.find(function(e){return e.name===i.name&&e.ValueTypeName===r});if(void 0===a)continue;let o=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let c=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const h=i.times.length-1;let d;if(s<=i.times[0]){const e=o,t=l-o;d=i.values.slice(e,t)}else if(s>=i.times[h]){const e=h*l+o,t=e+l-o;d=i.values.slice(e,t)}else{const e=i.createInterpolant(),t=o,n=l-o;e.evaluate(s),d=e.resultBuffer.slice(t,n)}"quaternion"===r&&(new xn).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let e=0;e<p;++e){const t=e*u+c;if("quaternion"===r)xn.multiplyQuaternionsFlat(a.values,t,d,0,a.values,t);else{const e=u-2*c;for(let n=0;n<e;++n)a.values[t+n]-=d[n]}}}return e.blendMode=lt,e}};class fh{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let s=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}for(;n<s;){const i=n+s>>>1;e<t[i]?s=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class gh extends fh{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:rt,endingEnd:rt}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case st:r=e,a=2*t-n;break;case at:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case st:s=e,o=2*n-t;break;case at:s=1,o=n+i[1]-i[0];break;default:s=e-1,o=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),m=p*p,f=m*p,g=-h*f+2*h*m-h*p,v=(1+h)*f+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,_=d*f-d*m;for(let e=0;e!==a;++e)r[e]=g*s[c+e]+v*s[l+e]+y*s[o+e]+_*s[u+e];return r}}class vh extends fh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=(n-t)/(i-t),u=1-c;for(let e=0;e!==a;++e)r[e]=s[l+e]*u+s[o+e]*c;return r}}class yh extends fh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class _h{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ch(t,this.TimeBufferType),this.values=ch(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ch(e.times,Array),values:ch(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new yh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new gh(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tt:t=this.InterpolantFactoryMethodDiscrete;break;case nt:t=this.InterpolantFactoryMethodLinear;break;case it:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return tt;case this.InterpolantFactoryMethodLinear:return nt;case this.InterpolantFactoryMethodSmooth:return it}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==s&&n[s]>t;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&uh(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===it,r=e.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=e[a];if(o!==e[a+1]&&(1!==a||o!==e[0]))if(i)r=!0;else{const e=a*n,i=e-n,s=e+n;for(let a=0;a!==n;++a){const n=t[e+a];if(n!==t[i+a]||n!==t[s+a]){r=!0;break}}}if(r){if(a!==s){e[s]=e[a];const i=a*n,r=s*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++s}}if(r>0){e[s]=e[r];for(let e=r*n,i=s*n,a=0;a!==n;++a)t[i+a]=t[e+a];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=t.slice(0,s*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}_h.prototype.TimeBufferType=Float32Array,_h.prototype.ValueBufferType=Float32Array,_h.prototype.DefaultInterpolation=nt;class xh extends _h{constructor(e,t,n){super(e,t,n)}}xh.prototype.ValueTypeName="bool",xh.prototype.ValueBufferType=Array,xh.prototype.DefaultInterpolation=tt,xh.prototype.InterpolantFactoryMethodLinear=void 0,xh.prototype.InterpolantFactoryMethodSmooth=void 0;class Mh extends _h{}Mh.prototype.ValueTypeName="color";class bh extends _h{}bh.prototype.ValueTypeName="number";class Th extends fh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t);let l=e*a;for(let e=l+a;l!==e;l+=4)xn.slerpFlat(r,0,s,l-a,s,l,o);return r}}class Sh extends _h{InterpolantFactoryMethodLinear(e){return new Th(this.times,this.values,this.getValueSize(),e)}}Sh.prototype.ValueTypeName="quaternion",Sh.prototype.InterpolantFactoryMethodSmooth=void 0;class wh extends _h{constructor(e,t,n){super(e,t,n)}}wh.prototype.ValueTypeName="string",wh.prototype.ValueBufferType=Array,wh.prototype.DefaultInterpolation=tt,wh.prototype.InterpolantFactoryMethodLinear=void 0,wh.prototype.InterpolantFactoryMethodSmooth=void 0;class Nh extends _h{}Nh.prototype.ValueTypeName="vector";class Eh{constructor(e="",t=-1,n=[],i=ot){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Vt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(Ah(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(_h.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e<r;e++){let a=[],o=[];a.push((e+r-1)%r,e,(e+1)%r),o.push(0,1,0);const l=hh(a);a=dh(a,1,l),o=dh(o,1,l),!i&&0===a[0]&&(a.push(r),o.push(o[0])),s.push(new bh(".morphTargetInfluences["+t[e].name+"]",a,o).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],s=n.name.match(r);if(s&&s.length>1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],a=[];ph(n,s,a,i),0!==s.length&&r.push(new e(t,s,a))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],s=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new bh(".morphTargetInfluence["+n+"]",e,s))}o=e.length*s}else{const s=".bones["+t[e].name+"]";n(Nh,s+".position",r,"pos",i),n(Sh,s+".quaternion",r,"rot",i),n(Nh,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,o,i,a)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,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(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Ah(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return bh;
vendor: 11,036 bytes, line 2
2case"vector":case"vector2":case"vector3":case"vector4":return Nh;case"color":return Mh;case"quaternion":return Sh;case"bool":case"boolean":return xh;case"string":return wh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];ph(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const Ch={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class Rh{constructor(e,t,n){const i=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===s&&void 0!==i.onStart&&i.onStart(e,a,o),s=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}}const Ih=new Rh;class Lh{constructor(e){this.manager=void 0!==e?e:Ih,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,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}}Lh.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ph={};class Dh extends Error{constructor(e,t){super(e),this.response=t}}class Uh extends Lh{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Ch.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==Ph[e])return void Ph[e].push({onLoad:t,onProgress:n,onError:i});Ph[e]=[],Ph[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||void 0===t.body||void 0===t.body.getReader)return t;const n=Ph[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new Dh(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,a));case"json":return e.json();default:if(void 0===a)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(a),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{Ch.add(e,t);const n=Ph[e];delete Ph[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=Ph[e];if(void 0===n)throw this.manager.itemError(e),t;delete Ph[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}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}}class Oh extends Lh{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=Ch.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;const a=$t("img");function o(){c(),Ch.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class Vh extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new wl,a=new Uh(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:W,s.wrapT=void 0!==n.wrapT?n.wrapT:W,s.magFilter=void 0!==n.magFilter?n.magFilter:Z,s.minFilter=void 0!==n.minFilter?n.minFilter:Z,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=J),1===n.mipmapCount&&(s.minFilter=Z),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,t&&t(s,n)},n,i),s}}class Fh extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=new mn,s=new Oh(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class zh extends Si{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Gi(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){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class Bh extends zh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Si.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Gi(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const kh=new Jn,Hh=new Mn,Gh=new Mn;class Wh{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Wt(512,512),this.map=null,this.mapPass=null,this.matrix=new Jn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yr,this._frameExtents=new Wt(1,1),this._viewportCount=1,this._viewports=[new fn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Hh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Hh),Gh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Gh),t.updateMatrixWorld(),kh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(kh)}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.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class jh extends Wh{constructor(){super(new Vr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*Ot*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Xh extends zh{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Si.DEFAULT_UP),this.updateMatrix(),this.target=new Si,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new jh}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}}const qh=new Jn,Yh=new Mn,Zh=new Mn;class $h extends Wh{constructor(){super(new Vr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Wt(4,2),this._viewportCount=6,this._viewports=[new fn(2,1,1,1),new fn(0,1,1,1),new fn(3,1,1,1),new fn(1,1,1,1),new fn(3,0,1,1),new fn(1,0,1,1)],this._cubeDirections=[new Mn(1,0,0),new Mn(-1,0,0),new Mn(0,0,1),new Mn(0,0,-1),new Mn(0,1,0),new Mn(0,-1,0)],this._cubeUps=[new Mn(0,1,0),new Mn(0,1,0),new Mn(0,1,0),new Mn(0,1,0),new Mn(0,0,1),new Mn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Yh.setFromMatrixPosition(e.matrixWorld),n.position.copy(Yh),Zh.copy(n.position),Zh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Zh),n.updateMatrixWorld(),i.makeTranslation(-Yh.x,-Yh.y,-Yh.z),qh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(qh)}}class Jh extends zh{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new $h}get power(){return 4*this.intensity*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}}class Kh extends Wh{constructor(){super(new us(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}
vendor: 6,089 bytes, line 2
2}class Qh extends zh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Si.DEFAULT_UP),this.updateMatrix(),this.target=new Si,this.shadow=new Kh}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class ed extends zh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class td extends zh{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class nd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Mn)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],n*i*1.092548),t.addScaledVector(s[5],i*r*1.092548),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],n*r*1.092548),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],1.023328*i),t.addScaledVector(s[2],1.023328*r),t.addScaledVector(s[3],1.023328*n),t.addScaledVector(s[4],.858086*n*i),t.addScaledVector(s[5],.858086*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],.858086*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class id extends zh{constructor(e=new nd,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class rd extends Lh{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,s=new Uh(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new Gi).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&
vendor: 2,369 bytes, line 2
2(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new Gi).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Wt).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new Mn).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new fn).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new jt).fromArray(r.value);break;
vendor: 16,298 bytes, line 2
2case"m4":i.uniforms[t].value=(new Jn).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Wt).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Wt).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return rd.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:Qu,SpriteMaterial:Zo,RawShaderMaterial:eh,ShaderMaterial:Lr,PointsMaterial:vc,MeshPhysicalMaterial:nh,MeshStandardMaterial:th,MeshPhongMaterial:ih,MeshToonMaterial:rh,MeshNormalMaterial:sh,MeshLambertMaterial:ah,MeshDepthMaterial:To,MeshDistanceMaterial:So,MeshBasicMaterial:qi,MeshMatcapMaterial:oh,LineDashedMaterial:lh,LineBasicMaterial:ic,Material:Xi}[e]}}class sd{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===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)}}class ad extends pr{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class od extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Uh(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],s=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),a=Zt(r.type,s),o=new Xo(a,r.stride);return o.uuid=r.uuid,t[i]=o,o}const r=e.isInstancedBufferGeometry?new ad:new pr,s=e.data.index;if(void 0!==s){const e=Zt(s.type,s.array);r.setIndex(new tr(e,1))}const a=e.data.attributes;for(const t in a){const n=a[t];let s;if(n.isInterleavedBufferAttribute){const t=i(e.data,n.data);s=new Yo(t,n.itemSize,n.offset,n.normalized)}else{const e=Zt(n.type,n.array);s=new(n.isInstancedBufferAttribute?Cl:tr)(e,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(t,s)}const o=e.data.morphAttributes;if(o)for(const t in o){const n=o[t],s=[];for(let t=0,r=n.length;t<r;t++){const r=n[t];let a;if(r.isInterleavedBufferAttribute){const t=i(e.data,r.data);a=new Yo(t,r.itemSize,r.offset,r.normalized)}else{const e=Zt(r.type,r.array);a=new tr(e,r.itemSize,r.normalized)}void 0!==r.name&&(a.name=r.name),s.push(a)}r.morphAttributes[t]=s}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new Mn;void 0!==c.center&&e.fromArray(c.center),r.boundingSphere=new Hn(e,c.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}class ld extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?sd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const a=new Uh(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){let s=null;try{s=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);r.parse(s,t)},n,i)}async loadAsync(e,t){const n=""===this.path?sd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const i=new Uh(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(e,t),s=JSON.parse(r),a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(s)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,function(){void 0!==t&&t(l)}),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in s)if(s[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,s),o=this.parseObject(e.object,i,a,s,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new uu).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(e){e.isBone&&(i[e.uuid]=e)}),void 0!==e)for(let t=0,r=e.length;t<r;t++){const r=(new Al).fromJSON(e[t],i);n[r.uuid]=r}return n}parseGeometries(e,t){const n={};if(void 0!==e){const i=new od;for(let r=0,s=e.length;r<s;r++){let s;const a=e[r];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(a);break;default:a.type in Ku?s=Ku[a.type].fromJSON(a,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`)}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new rd;r.setTextures(t);for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=Eh.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:Zt(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new Rh(t);r=new Oh(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n.url;if(Array.isArray(r)){const e=[];for(let t=0,n=r.length;t<n;t++){const n=s(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new wl(n.data,n.width,n.height)))}i[n.uuid]=new hn(e)}else{const e=s(n.url);i[n.uuid]=new hn(e)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(e){if("string"==typeof e){const n=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await i.loadAsync(r)}return e.data?{data:Zt(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){i=new Oh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const i=e[t],s=i.url;if(Array.isArray(s)){const e=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new wl(i.data,i.width,i.height)))}n[i.uuid]=new hn(e)}else{const e=await r(i.url);n[i.uuid]=new hn(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const i={};if(void 0!==e)for(let r=0,s=e.length;r<s;r++){const s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const a=t[s.image],o=a.data;let l;Array.isArray(o)?(l=new Br,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new wl:new mn,o&&(l.needsUpdate=!0)),l.source=a,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,cd)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],ud),l.wrapT=n(s.wrap[1],ud)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,hd)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,hd)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(e,t,n,i,r){let s,a,o;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function u(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":s=new jo,void 0!==e.background&&(Number.isInteger(e.background)?s.background=new Gi(e.background):s.background=u(e.background)),void 0!==e.environment&&(s.environment=u(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new Wo(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new Go(e.fog.color,e.fog.density)),""!==e.fog.name&&(s.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(s.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(s.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&s.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(s.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&s.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":s=new Vr(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new us(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new ed(e.color,e.intensity);break;case"DirectionalLight":s=new Qh(e.color,e.intensity),s.target=e.target||"";break;case"PointLight":s=new Jh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new td(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new Xh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),s.target=e.target||"";break;case"HemisphereLight":s=new Bh(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=(new id).fromJSON(e);break;case"SkinnedMesh":a=l(e.geometry),o=c(e.material),s=new Tl(a,o),void 0!==e.bindMode&&(s.bindMode=e.bindMode),void 0!==e.bindMatrix&&s.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(s.skeleton=e.skeleton);break;case"Mesh":a=l(e.geometry),o=c(e.material),s=new wr(a,o);break;case"InstancedMesh":a=l(e.geometry),o=c(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;s=new Vl(a,o,t),s.instanceMatrix=new Cl(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Cl(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":a=l(e.geometry),o=c(e.material),s=new nc(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o),s.geometry=a,s.perObjectFrustumCulled=e.perObjectFrustumCulled,s.sortObjects=e.sortObjects,s._drawRanges=e.drawRanges,s._reservedRanges=e.reservedRanges,s._visibility=e.visibility,s._active=e.active,s._bounds=e.bounds.map(e=>{const t=new Sn;t.min.fromArray(e.boxMin),t.max.fromArray(e.boxMax);const n=new Hn;return n.radius=e.sphereRadius,n.center.fromArray(e.sphereCenter),{boxInitialized:e.boxInitialized,box:t,sphereInitialized:e.sphereInitialized,sphere:n}}),s._maxInstanceCount=e.maxInstanceCount,s._maxVertexCount=e.maxVertexCount,s._maxIndexCount=e.maxIndexCount,s._geometryInitialized=e.geometryInitialized,s._geometryCount=e.geometryCount,s._matricesTexture=u(e.matricesTexture.uuid),void 0!==e.colorsTexture&&(s._c
vendor: 14,574 bytes, line 2
2olorsTexture=u(e.colorsTexture.uuid));break;case"LOD":s=new pl;break;case"Line":s=new hc(l(e.geometry),c(e.material));break;case"LineLoop":s=new gc(l(e.geometry),c(e.material));break;case"LineSegments":s=new fc(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":s=new bc(l(e.geometry),c(e.material));break;case"Sprite":s=new cl(c(e.material));break;case"Group":s=new Po;break;case"Bone":s=new Sl;break;default:s=new Si}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.up&&s.up.fromArray(e.up),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(s.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(s.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),void 0!==e.children){const a=e.children;for(let e=0;e<a.length;e++)s.add(this.parseObject(a[e],t,n,i,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];s.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(s.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);t.target=void 0!==i?i:new Si}})}}const cd={UVMapping:V,CubeReflectionMapping:F,CubeRefractionMapping:z,EquirectangularReflectionMapping:B,EquirectangularRefractionMapping:k,CubeUVReflectionMapping:H},ud={RepeatWrapping:G,ClampToEdgeWrapping:W,MirroredRepeatWrapping:j},hd={NearestFilter:X,NearestMipmapNearestFilter:q,NearestMipmapLinearFilter:Y,LinearFilter:Z,LinearMipmapNearestFilter:$,LinearMipmapLinearFilter:J};class dd extends Lh{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"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=Ch.get(e);if(void 0!==s)return r.manager.itemStart(e),s.then?void s.then(n=>{t&&t(n),r.manager.itemEnd(e)}).catch(e=>{i&&i(e)}):(setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(e,a).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return Ch.add(e,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),Ch.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Ch.add(e,o),r.manager.itemStart(e)}}let pd;class md{static getContext(){return void 0===pd&&(pd=new(window.AudioContext||window.webkitAudioContext)),pd}static setContext(e){pd=e}}class fd extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Uh(this.manager);function a(t){i?i(t):console.error(t),r.manager.itemError(e)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(e){try{const n=e.slice(0);md.getContext().decodeAudioData(n,function(e){t(e)}).catch(a)}catch(e){a(e)}},n,i)}}const gd=new Jn,vd=new Jn,yd=new Jn;class _d{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Vr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Vr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,yd.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(Ut*t.fov*.5)/t.zoom;let s,a;vd.elements[12]=-n,gd.elements[12]=n,s=-r*t.aspect+i,a=r*t.aspect+i,yd.elements[0]=2*t.near/(a-s),yd.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(yd),s=-r*t.aspect-i,a=r*t.aspect-i,yd.elements[0]=2*t.near/(a-s),yd.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(yd)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(vd),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(gd)}}class xd{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Md(),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){const t=Md();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Md(){return performance.now()}const bd=new Mn,Td=new xn,Sd=new Mn,wd=new Mn;let Nd=class extends Si{constructor(){super(),this.type="AudioListener",this.context=md.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new xd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(bd,Td,Sd),Number.isFinite(bd.x)&&Number.isFinite(bd.y)&&Number.isFinite(bd.z))if(wd.set(0,0,-1).applyQuaternion(Td),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(bd.x,e),t.positionY.linearRampToValueAtTime(bd.y,e),t.positionZ.linearRampToValueAtTime(bd.z,e),t.forwardX.linearRampToValueAtTime(wd.x,e),t.forwardY.linearRampToValueAtTime(wd.y,e),t.forwardZ.linearRampToValueAtTime(wd.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(bd.x,bd.y,bd.z),t.setOrientation(wd.x,wd.y,wd.z,n.x,n.y,n.z)}};class Ed extends Si{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||(this.buffer?this.buffer.duration:Number.MAX_VALUE))),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Ad=new Mn,Cd=new xn,Rd=new Mn,Id=new Mn;class Ld extends Ed{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Ad,Cd,Rd),Id.set(0,0,1).applyQuaternion(Cd);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ad.x,e),t.positionY.linearRampToValueAtTime(Ad.y,e),t.positionZ.linearRampToValueAtTime(Ad.z,e),t.orientationX.linearRampToValueAtTime(Id.x,e),t.orientationY.linearRampToValueAtTime(Id.y,e),t.orientationZ.linearRampToValueAtTime(Id.z,e)}else t.setPosition(Ad.x,Ad.y,Ad.z),t.setOrientation(Id.x,Id.y,Id.z)}}class Pd{constructor(e,t,n){let i,r,s;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(0===s){for(let e=0;e!==i;++e)n[r+e]=n[e];
vendor: 4,398 bytes, line 2
2s=t}else{s+=t;const e=t/s;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){xn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;xn.multiplyQuaternionsFlat(e,s,e,t,e,n),xn.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const Dd="\\[\\]\\.:\\/",Ud=new RegExp("["+Dd+"]","g"),Od="[^"+Dd+"]",Vd="[^"+Dd.replace("\\.","")+"]",Fd=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Od)+/(WCOD+)?/.source.replace("WCOD",Vd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Od)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Od)+"$"),zd=["material","materials","bones","map"];class Bd{constructor(e,t,n){this.path=t,this.parsedPath=n||Bd.parseTrackName(t),this.node=Bd.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 Bd.Composite(e,t,n):new Bd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Ud,"")}static parseTrackName(e){const t=Fd.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==zd.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e,i){for(let r=0;r<e.length;r++){const s=e[r];if(!i&&(s.name===t||s.uuid===t))return s;if(i&&s.userData&&s.userData.name===t)return s;const a=n(s.children,i);if(a)return a}return null},i=n(e.children);if(i)return i;{const t=n(e.children,!0);if(t)return t}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 4,981 bytes, line 2
2_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Bd.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const s=e[i];if(void 0===s){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let a=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Bd.Composite=class{constructor(e,t,n){const i=n||Bd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Bd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Bd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Bd.prototype.GetterByBindingType=[Bd.prototype._getValue_direct,Bd.prototype._getValue_array,Bd.prototype._getValue_arrayElement,Bd.prototype._getValue_toArray],Bd.prototype.SetterByBindingTypeAndVersioning=[[Bd.prototype._setValue_direct,Bd.prototype._setValue_direct_setNeedsUpdate,Bd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Bd.prototype._setValue_array,Bd.prototype._setValue_array_setNeedsUpdate,Bd.prototype._setValue_array_setMatr
vendor: 5,030 bytes, line 2
2ixWorldNeedsUpdate],[Bd.prototype._setValue_arrayElement,Bd.prototype._setValue_arrayElement_setNeedsUpdate,Bd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Bd.prototype._setValue_fromArray,Bd.prototype._setValue_fromArray_setNeedsUpdate,Bd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class kd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,a=new Array(s),o={endingStart:rt,endingEnd:rt};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);a[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const s=this._updateTime(t),a=this._updateWeight(e);if(a>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===lt)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(a);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=2202===n;if(0===e)return-1===r||!s||1&~r?i:t-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return t-i}return i}
vendor: 7,638 bytes, line 2
2_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=st,i.endingEnd=st):(i.endingStart=e?this.zeroSlopeAtStart?st:rt:at,i.endingEnd=t?this.zeroSlopeAtEnd?st:rt:at)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=t,a[1]=r+e,o[1]=n,this}}const Hd=new Float32Array(1);class Gd extends Lt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,a=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let u=c[l];if(void 0!==u)++u.referenceCount,s[e]=u;else{if(u=s[e],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;u=new Pd(Bd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,l),s[e]=u}a[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(void 0===s)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const t=s.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),e._byClipCacheIndex=null;delete a.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];void 0===s&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete a[r],0===Object.keys(a).length&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new vh(new Float32Array(2),new Float32Array(2),1,Hd),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s="string"==typeof e?Eh.findByName(i,e):e;const a=null!==s?s.uuid:e,o=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:ot),void 0!==o){const e=o.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new kd(this,s,t,n);return this._bindAction(c,l),this._addInactiveAction(c,a,r),c}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?Eh.findByName(n,e):e,s=r?r.uuid:e,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let a=0;a!==n;++a)t[a]._update(i,e,r,s);const a=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)a[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,s=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,t[r]=s,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const i=n[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const e in i){const t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}let Wd=class e{constructor(e){this.value=e}clone(){return new e(void 0===this.value.clone?this.value:this.value.clone())}},jd=0;class Xd extends Xo{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const qd=new Jn;class Yd{constructor(e,t,n=0,i=1/0){this.ray=new $n(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new li,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
2Unsupported camera type: "+t.type)}setFromXRController(e){return qd.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(qd),this}intersectObject(e,t=!0,n=[]){return $d(e,this,n,t),n.sort(Zd),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)$d(e[i],this,n,t);return n.sort(Zd),n}}function Zd(e,t){return e.distance-t.distance}function $d(e,t,n,i){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(r=!1),!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)$d(i[e],t,n,!0)}}class Jd{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}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=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),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),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ft(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Kd{constructor(e,t,n,i){Kd.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const Qd=new Wt;const ep=new Mn,tp=new Mn;class np{constructor(e=new Mn,t=new Mn){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ep.subVectors(e,this.start),tp.subVectors(this.end,this.start);const n=tp.dot(tp);let i=tp.dot(ep)/n;return t&&(i=Ft(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const ip=new Mn;const rp=new Mn,sp=new Jn,ap=new Jn;function op(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,op(e.children[n]));return t}const lp=new Mn,cp=new Gi,up=new Gi;let hp=class extends fc{constructor(e=10,t=10,n=4473924,i=8947848){n=new Gi(n),i=new Gi(i);const r=t/2,s=e/t,a=e/2,o=[],l=[];for(let e=0,c=0,u=-a;e<=t;e++,u+=s){o.push(-a,0,u,a,0,u),o.push(u,0,-a,u,0,a);const t=e===r?n:i;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new pr;c.setAttribute("position",new sr(o,3)),c.setAttribute("color",new sr(l,3));super(c,new ic({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};const dp=new Mn,pp=new Mn,mp=new Mn;class fp extends Si{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new pr;i.setAttribute("position",new sr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new ic({fog:!1,toneMapped:!1});this.lightPlane=new hc(i,r),this.add(this.lightPlane),i=new pr,i.setAttribute("position",new sr([0,0,0,0,0,1],3)),this.targetLine=new hc(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),dp.setFromMatrixPosition(this.light.matrixWorld),pp.setFromMatrixPosition(this.light.target.matrixWorld),mp.subVectors(pp,dp),this.lightPlane.lookAt(pp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(pp),this.targetLine.scale.z
vendor: 5,158 bytes, line 2
2=mp.length()}}const gp=new Mn,vp=new Pr;class yp extends fc{constructor(e){const t=new pr,n=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function a(e,t){o(e),o(t)}function o(e){i.push(0,0,0),r.push(0,0,0),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),t.setAttribute("position",new sr(i,3)),t.setAttribute("color",new sr(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new Gi(16755200),c=new Gi(16711680),u=new Gi(43775),h=new Gi(16777215),d=new Gi(3355443);this.setColors(l,c,u,h,d)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap;vp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),_p("c",t,e,vp,0,0,-1),_p("t",t,e,vp,0,0,1),_p("n1",t,e,vp,-1,-1,-1),_p("n2",t,e,vp,1,-1,-1),_p("n3",t,e,vp,-1,1,-1),_p("n4",t,e,vp,1,1,-1),_p("f1",t,e,vp,-1,-1,1),_p("f2",t,e,vp,1,-1,1),_p("f3",t,e,vp,-1,1,1),_p("f4",t,e,vp,1,1,1),_p("u1",t,e,vp,.7,1.1,-1),_p("u2",t,e,vp,-.7,1.1,-1),_p("u3",t,e,vp,0,2,-1),_p("cf1",t,e,vp,-1,0,1),_p("cf2",t,e,vp,1,0,1),_p("cf3",t,e,vp,0,-1,1),_p("cf4",t,e,vp,0,1,1),_p("cn1",t,e,vp,-1,0,-1),_p("cn2",t,e,vp,1,0,-1),_p("cn3",t,e,vp,0,-1,-1),_p("cn4",t,e,vp,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function _p(e,t,n,i,r,s,a){gp.set(r,s,a).unproject(i);const o=t[e];if(void 0!==o){const e=n.getAttribute("position");for(let t=0,n=o.length;t<n;t++)e.setXYZ(o[t],gp.x,gp.y,gp.z)}}const xp=new Sn;class Mp extends fc{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new pr;r.setIndex(new tr(n,1)),r.setAttribute("position",new tr(i,3)),super(r,new ic({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&xp.setFromObject(this.object),xp.isEmpty())return;const t=xp.min,n=xp.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class bp extends fc{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new pr;i.setIndex(new tr(n,1)),i.setAttribute("position",new sr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ic({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}const Tp=new Mn;let Sp,wp;let Np=class extends fc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new pr;n.setAttribute("position",new sr(t,3)),n.setAttribute("color",new sr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new ic({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}
2setColors(e,t,n){const i=new Gi,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};class Ep{constructor(){this.type="ShapePath",this.color=new Gi,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Jc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=t[r],a=t[s],o=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[s],o=-o,a=t[r],l=-l),e.y<n.y||e.y>a.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return i}const n=Ou.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new uu,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=e?!l:l;const c=[],u=[];let h,d,p=[],m=0;u[m]=void 0,p[m]=[];for(let t=0,a=i.length;t<a;t++)s=i[t],h=s.getPoints(),r=n(h),r=e?!r:r,r?(!l&&u[m]&&m++,u[m]={s:new uu,p:h},u[m].s.curves=s.curves,l&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!u[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new uu;r.curves=i.curves,t.push(r)}return t}(i);if(u.length>1){let e=!1,n=0;for(let e=0,t=u.length;e<t;e++)c[e]=[];for(let i=0,r=u.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const a=r[s];let o=!0;for(let r=0;r<u.length;r++)t(a.p,u[r].p)&&(i!==r&&n++,o?(o=!1,c[r].push(a)):e=!0);o&&c[i].push(a)}}n>0&&!1===e&&(p=c)}for(let e=0,t=u.length;e<t;e++){a=u[e].s,o.push(a),d=p[e];for(let e=0,t=d.length;e<t;e++)a.holes.push(d[e].h)}return o}}class Ap extends Lt{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(){}disconnect(){}dispose(){}update(){}}const Cp=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class Rp{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=!0===e.object.isSkinnedMesh,this.refreshUniforms=Cp,this.renderId=0}firstInitialization(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}getRenderObjectData(e){let t=this.renderObjects.get(e);return void 0===t&&(t={material:this.getMaterialData(e.material),worldMatrix:e.object.matrixWorld.clone()},e.object.center&&(t.center=e.object.center.clone()),e.object.morphTargetInfluences&&(t.morphTargetInfluences=e.object.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),this.renderObjects.set(e,t)),t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return null!==e.renderer.nodes.modelViewMatrix||null!==e.renderer.nodes.modelNormalViewMatrix}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];null!=i&&("object"==typeof i&&void 0!==i.clone?!0===i.isTexture?t[
2n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e){const{object:t,material:n}=e,i=this.getRenderObjectData(e);if(!0!==i.worldMatrix.equals(t.matrixWorld))return i.worldMatrix.copy(t.matrixWorld),!1;const r=i.material;for(const e in r){const t=r[e],i=n[e];if(void 0!==t.equals){if(!1===t.equals(i))return t.copy(i),!1}else if(!0===i.isTexture){if(t.id!==i.id||t.version!==i.version)return t.id=i.id,t.version=i.version,!1}else if(t!==i)return r[e]=i,!1}if(i.morphTargetInfluences){let e=!1;for(let n=0;n<i.morphTargetInfluences.length;n++)i.morphTargetInfluences[n]!==t.morphTargetInfluences[n]&&(e=!0);if(e)return!0}return i.center&&!1===i.center.equals(t.center)?(i.center.copy(t.center),!0):(null!==e.bundle&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=!0===e.object.static,r=null!==e.bundle&&!0===e.bundle.static&&this.getRenderObjectData(e).version===e.bundle.version;return!i&&!r&&!0!==this.equals(e)}}function Ip(e,t=0){let n=3735928559^t,i=1103547991^t;if(e instanceof Array)for(let t,r=0;r<e.length;r++)t=e[r],n=Math.imul(n^t,2654435761),i=Math.imul(i^t,1597334677);else for(let t,r=0;r<e.length;r++)t=e.charCodeAt(r),n=Math.imul(n^t,2654435761),i=Math.imul(i^t,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&i)+(n>>>0)}const Lp=e=>Ip(e),Pp=e=>Ip(e),Dp=(...e)=>Ip(e);function Up(e,t=!1){const n=[];!0===e.isNode&&(n.push(e.id),e=e.getSelf());for(const{property:i,childNode:r}of Op(e))n.push(n,Ip(i.slice(0,-4)),r.getCacheKey(t));return Ip(n)}function*Op(e,t=!1){for(const n in e){if(!0===n.startsWith("_"))continue;const i=e[n];if(!0===Array.isArray(i))for(let e=0;e<i.length;e++){const r=i[e];r&&(!0===r.isNode||t&&"function"==typeof r.toJSON)&&(yield{property:n,index:e,childNode:r})}else if(i&&!0===i.isNode)yield{property:n,childNode:i};else if("object"==typeof i)for(const e in i){const r=i[e];r&&(!0===r.isNode||t&&"function"==typeof r.toJSON)&&(yield{property:n,index:e,childNode:r})}}}function Vp(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Fp(e,...t){const n=e?e.slice(-4):void 0;return 1===t.length&&("vec2"===n?t=[t[0],t[0]]:"vec3"===n?t=[t[0],t[0],t[0]]:"vec4"===n&&(t=[t[0],t[0],t[0],t[0]])),"color"===e?new Gi(...t):"vec2"===n?new Wt(...t):"vec3"===n?new Mn(...t):"vec4"===n?new fn(...t):"mat3"===n?new jt(...t):"mat4"===n?new Jn(...t):"bool"===e?t[0]||!1:"float"===e||"int"===e||"uint"===e?t[0]||0:"string"===e?t[0]||"":"ArrayBuffer"===e?Bp(t[0]):null}function zp(e){let t="";const n=new Uint8Array(e);for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function Bp(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}var kp=Object.freeze({__proto__:null,arrayBufferToBase64:zp,base64ToArrayBuffer:Bp,getCacheKey:Up,getNodeChildren:Op,getValueFromType:Fp,getValueType:Vp,hash:Dp,hashArray:Pp,hashString:Lp});const Hp={VERTEX:"vertex",FRAGMENT:"fragment"},Gp={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Wp=["fragment","vertex"],jp=["setup","analyze","generate"],Xp=[...Wp,"compute"],qp=["x","y","z","w"];let Yp=0;class Zp extends Lt{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Gp.NONE,this.updateBeforeType=Gp.NONE,this.updateAfterType=Gp.NONE,this.uuid=Gt.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:Yp++})}set needsUpdate(e){!0===e&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,Gp.FRAME)}
2onRenderUpdate(e){return this.onUpdate(e,Gp.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Gp.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Op(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return(!0===(e=e||this.version!==this._cacheKeyVersion)||null===this._cacheKey)&&(this._cacheKey=Up(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const e of this.getChildren())t["node"+n++]=e;return null}analyze(e){if(1===e.increaseUsage(this)){const t=e.getNodeProperties(this);for(const n of Object.values(t))n&&!0===n.isNode&&n.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&!0===n.isNode)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let i=null;const r=e.getBuildStage();if("setup"===r){this.updateReference(e);const t=e.getNodeProperties(this);if(!0!==t.initialized){e.stack.nodes.length;t.initialized=!0,t.outputNode=this.setup(e),null!==t.outputNode&&e.stack.nodes.length;for(const n of Object.values(t))n&&!0===n.isNode&&n.build(e)}}else if("analyze"===r)this.analyze(e);else if("generate"===r)if(1===this.generate.length){const n=this.getNodeType(e),r=e.getDataFromNode(this);i=r.snippet,void 0===i?(i=this.generate(e)||"",r.snippet=i):void 0!==r.flowCodes&&void 0!==e.context.nodeBlock&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,n,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return Op(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:s}of t)void 0!==r?(void 0===n[i]&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=s.toJSON(e.meta).uuid):n[i]=s.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if("object"==typeof e.inputNodes[n]){const i={};for(const r in e.inputNodes[n]){const s=e.inputNodes[n][r];i[r]=t[s]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=void 0===e||"string"==typeof e;i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(void 0===r&&(r={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},!0!==i&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta),i){const t=s(e.textures),n=s(e.images),i=s(e.nodes);t.length>0&&(r.textures=t),n.length>0&&(r.images=n),i.length>0&&(r.nodes=i)}return r}}class $p extends Zp{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){return`${this.node.build(e)}[ ${this.indexNode.build(e,"uint")} ]`}}class Jp extends Zp{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(null===n||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class Kp extends Zp{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const n=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(void 0!==i.propertyName)return e.format(i.propertyName,n,t);if("void"!==n&&"void"!==t&&this.hasDependencies(e)){const r=super.build(e,n),s=e.getVarFromNode(this,null,n),a=e.getPropertyName(s);return e.addLineFlowCode(`${a} = ${r}`,this),i.snippet=r,i.propertyName=a,e.format(i.propertyName,n,t)}}return super.build(e,t)}}class Qp extends Kp{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}
2getNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=this.nodes,r=e.getComponentType(n),s=[];for(const t of i){let n=t.build(e);const i=e.getComponentType(t.getNodeType(e));i!==r&&(n=e.format(n,i,r)),s.push(n)}const a=`${e.getType(n)}( ${s.join(", ")} )`;return e.format(a,n,t)}}const em=qp.join("");class tm extends Zp{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(qp.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let s=null;this.getVectorLength()>=i&&(s=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=n.build(e,s);r=this.components.length===i&&this.components===em.slice(0,this.components.length)?e.format(a,s,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class nm extends Kp{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),s=e.getTypeFromLength(n.length,i.getNodeType(e)),a=i.build(e,s),o=t.build(e,r),l=e.getTypeLength(r),c=[];for(let e=0;e<l;e++){const t=qp[e];t===n[0]?(c.push(a),e+=n.length-1):c.push(o+"."+t)}return`${e.getType(r)}( ${c.join(", ")} )`}}class im extends Kp{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),s=e.getVarFromNode(this),a=e.getPropertyName(s);e.addLineFlowCode(a+" = "+r,this);const o=e.getTypeLength(i),l=[];let c=0;for(let e=0;e<o;e++){const n=qp[e];n===t[c]?(l.push("1.0 - "+a+"."+n),c++):l.push(a+"."+n)}return`${e.getType(i)}( ${l.join(", ")} )`}}class rm extends Zp{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return null===this.nodeType?Vp(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Vp(this.value),e.nodeType=this.nodeType,"ArrayBuffer"===e.valueType&&(e.value=zp(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?Fp(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class sm extends rm{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return e.format(this.generateConst(e),n,t)}}let am=null;const om=new Map;function lm(e,t){if(om.has(e))console.warn(`Redefinition of method chaining ${e}`);else{if("function"!=typeof t)throw new Error(`Node element ${e} is not a function`);om.set(e,t)}}const cm=e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),um=e=>cm(e).split("").sort().join(""),hm={setup(e,t){const n=t.shift();return e(Om(n),...t)},get(e,t,n){if("string"==typeof t&&void 0===e[t]){if(!0!==e.isStackNode&&"assign"===t)return(...e)=>(am.assign(n,...e),n);if(om.has(t)){const i=om.get(t);return e.isStackNode?(...e)=>n.add(i(...e)):(...e)=>i(n,...e)}if("self"===t)return e;if(t.endsWith("Assign")&&om.has(t.slice(0,t.length-6))){const i=om.get(t.
2slice(0,t.length-6));return e.isStackNode?(...e)=>n.assign(e[0],i(...e)):(...e)=>n.assign(i(n,...e))}if(!0===/^[xyzwrgbastpq]{1,4}$/.test(t))return t=cm(t),Um(new tm(n,t));if(!0===/^set[XYZWRGBASTPQ]{1,4}$/.test(t))return t=um(t.slice(3).toLowerCase()),n=>Um(new nm(e,t,n));if(!0===/^flip[XYZWRGBASTPQ]{1,4}$/.test(t))return t=um(t.slice(4).toLowerCase()),()=>Um(new im(Um(e),t));if("width"===t||"height"===t||"depth"===t)return"width"===t?t="x":"height"===t?t="y":"depth"===t&&(t="z"),Um(new tm(e,t));if(!0===/^\d+$/.test(t))return Um(new $p(n,new sm(Number(t),"uint")))}return Reflect.get(e,t,n)},set(e,t,n,i){return"string"!=typeof t||void 0!==e[t]||!0!==/^[xyzwrgbastpq]{1,4}$/.test(t)&&"width"!==t&&"height"!==t&&"depth"!==t&&!0!==/^\d+$/.test(t)?Reflect.set(e,t,n,i):(i[t].assign(n),!0)}},dm=new WeakMap,pm=new WeakMap,mm=function(e,t=null){for(const n in e)e[n]=Um(e[n],t);return e},fm=function(e,t=null){const n=e.length;for(let i=0;i<n;i++)e[i]=Um(e[i],t);return e},gm=function(e,t=null,n=null,i=null){const r=e=>Um(null!==i?Object.assign(e,i):e);return null===t?(...t)=>r(new e(...Vm(t))):null!==n?(n=Um(n),(...i)=>r(new e(t,...Vm(i),n))):(...n)=>r(new e(t,...Vm(n)))},vm=function(e,...t){return Um(new e(...Vm(t)))};class ym extends Zp{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let r=null;if(t.layout){let i=pm.get(e.constructor);void 0===i&&(i=new WeakMap,pm.set(e.constructor,i));let s=i.get(t);void 0===s&&(s=Um(e.buildFunctionNode(t)),i.set(t,s)),null!==e.currentFunctionNode&&e.currentFunctionNode.includes.push(s),r=Um(s.call(n))}else{const i=t.jsFunc,s=null!==n?i(n,e):i(e);r=Um(s)}return t.once&&(i.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return null===t.outputNode&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class _m extends Zp{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Om(e),Um(new ym(this,e))}setup(){return this.call()}}const xm=[!1,!0],Mm=[0,1,2,3],bm=[-1,-2],Tm=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Sm=new Map;for(const e of xm)Sm.set(e,new sm(e));const wm=new Map;for(const e of Mm)wm.set(e,new sm(e,"uint"));const Nm=new Map([...wm].map(e=>new sm(e.value,"int")));for(const e of bm)Nm.set(e,new sm(e,"int"));const Em=new Map([...Nm].map(e=>new sm(e.value)));for(const e of Tm)Em.set(e,new sm(e));for(const e of Tm)Em.set(-e,new sm(-e));const Am={bool:Sm,uint:wm,ints:Nm,float:Em},Cm=new Map([...Sm,...Em]),Rm=(e,t)=>Cm.has(e)?Cm.get(e):!0===e.isNode?e:new sm(e,t),Im=function(e,t=null){return(...n)=>{if((0===n.length||!["bool","float","int","uint"].includes(e)&&n.every(e=>"object"!=typeof e))&&(n=[Fp(e,...n)]),1===n.length&&null!==t&&t.has(n[0]))return Um(t.get(n[0]));if(1===n.length){const t=Rm(n[0],e);return(e=>{try{return e.getNodeType()}catch{return}})(t)===e?Um(t):Um(new Jp(t,e))}const i=n.map(e=>Rm(e));return Um(new Qp(i,e))}},Lm=e=>"object"==typeof e&&null!==e?e.value:e,Pm=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function Dm(e,t){return new Proxy(new _m(e,t),hm)}const Um=(e,t=null)=>function(e,t=null){const n=Vp(e);if("node"===n){let t=dm.get(e);return void 0===t&&(t=new Proxy(e,hm),dm.set(e,t),dm.set(t,t)),t}return null===t&&("float"===n||"boolean"===n)||n&&"shader"!==n&&"string"!==n?Um(Rm(e,t)):"shader"===n?Bm(e):e}(e,t),Om=(e,t=null)=>new mm(e,t),Vm=(e,t=null)=>new fm(e,t),Fm=(...e)=>new gm(...e),zm=(...e)=>new vm(...e),Bm=(e,t)=>{const n=new Dm(e,t),i=(...e)=>{let t;return Om(e),t=e[0]&&e[0].isNode?[...e]:e[0],n.call(t)};return i.shaderNode=n,i.setLayout=e=>(n.setLayout(e),i),i.once=()=>(n.once=!0,i),i};lm("toGlobal",e=>(e.global=!0,e));const km=e=>{am=e},Hm=()=>am,Gm=(...e)=>am.If(...e);function Wm(e){return am&&am.add(e),e}lm("append",Wm);const jm=new Im("color"),Xm=new Im("float",Am.float),qm=new Im("int",Am.ints),Ym=new Im("uint",Am.uint),Zm=new Im("bool",Am.bool),$m=ne
vendor: 1,485 bytes, line 2
2w Im("vec2"),Jm=new Im("ivec2"),Km=new Im("uvec2"),Qm=new Im("bvec2"),ef=new Im("vec3"),tf=new Im("ivec3"),nf=new Im("uvec3"),rf=new Im("bvec3"),sf=new Im("vec4"),af=new Im("ivec4"),of=new Im("uvec4"),lf=new Im("bvec4"),cf=new Im("mat2"),uf=new Im("mat3"),hf=new Im("mat4");lm("toColor",jm),lm("toFloat",Xm),lm("toInt",qm),lm("toUint",Ym),lm("toBool",Zm),lm("toVec2",$m),lm("toIVec2",Jm),lm("toUVec2",Km),lm("toBVec2",Qm),lm("toVec3",ef),lm("toIVec3",tf),lm("toUVec3",nf),lm("toBVec3",rf),lm("toVec4",sf),lm("toIVec4",af),lm("toUVec4",of),lm("toBVec4",lf),lm("toMat2",cf),lm("toMat3",uf),lm("toMat4",hf);const df=Fm($p),pf=(e,t)=>Um(new Jp(Um(e),t));lm("element",df),lm("convert",pf);class mf extends Zp{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=n,this.isUniformGroup=!0}set needsUpdate(e){!0===e&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const ff=e=>new mf(e),gf=(e,t=0)=>new mf(e,!0,t),vf=gf("frame"),yf=gf("render"),_f=ff("object");class xf extends rm{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=_f}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}
2onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(t=>{const i=e(t,n);void 0!==i&&(this.value=i)},t)}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);void 0===r&&(e.setHashNode(this,i),r=this);const s=r.getInputType(e),a=e.getUniformFromNode(r,s,e.shaderStage,this.name||e.context.label),o=e.getPropertyName(a);return void 0!==e.context.label&&delete e.context.label,e.format(o,n,t)}}const Mf=(e,t)=>{const n=Pm(t||e),i=e&&!0===e.isNode?e.node&&e.node.value||e.value:e;return Um(new xf(i,n))};class bf extends Zp{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Tf=(e,t)=>Um(new bf(e,t)),Sf=(e,t)=>Um(new bf(e,t,!0)),wf=zm(bf,"vec4","DiffuseColor"),Nf=zm(bf,"vec3","EmissiveColor"),Ef=zm(bf,"float","Roughness"),Af=zm(bf,"float","Metalness"),Cf=zm(bf,"float","Clearcoat"),Rf=zm(bf,"float","ClearcoatRoughness"),If=zm(bf,"vec3","Sheen"),Lf=zm(bf,"float","SheenRoughness"),Pf=zm(bf,"float","Iridescence"),Df=zm(bf,"float","IridescenceIOR"),Uf=zm(bf,"float","IridescenceThickness"),Of=zm(bf,"float","AlphaT"),Vf=zm(bf,"float","Anisotropy"),Ff=zm(bf,"vec3","AnisotropyT"),zf=zm(bf,"vec3","AnisotropyB"),Bf=zm(bf,"color","SpecularColor"),kf=zm(bf,"float","SpecularF90"),Hf=zm(bf,"float","Shininess"),Gf=zm(bf,"vec4","Output"),Wf=zm(bf,"float","dashSize"),jf=zm(bf,"float","gapSize"),Xf=zm(bf,"float","pointWidth"),qf=zm(bf,"float","IOR"),Yf=zm(bf,"float","Transmission"),Zf=zm(bf,"float","Thickness"),$f=zm(bf,"float","AttenuationDistance"),Jf=zm(bf,"color","AttenuationColor"),Kf=zm(bf,"float","Dispersion");class Qf extends Kp{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return qp.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:i}=this,r=this.needsSplitAssign(e),s=n.getNodeType(e),a=n.context({assign:!0}).build(e),o=i.build(e,s),l=i.getNodeType(e),c=e.getDataFromNode(this);let u;if(!0===c.initialized)"void"!==t&&(u=a);else if(r){const i=e.getVarFromNode(this,null,s),r=e.getPropertyName(i);e.addLineFlowCode(`${r} = ${o}`,this);const l=n.node.context({assign:!0}).build(e);for(let t=0;t<n.components.length;t++){const i=n.components[t];e.addLineFlowCode(`${l}.${i} = ${r}[ ${t} ]`,this)}"void"!==t&&(u=a)}else u=`${a} = ${o}`,("void"===t||"void"===l)&&(e.addLineFlowCode(u,this),"void"!==t&&(u=a));return c.initialized=!0,e.format(u,s,t)}}const eg=Fm(Qf);lm("assign",eg);class tg extends Kp{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters;if(Array.isArray(r))for(let n=0;n<r.length;n++){const s=i[n],a=r[n];t.push(a.build(e,s.type))}else for(const n of i){const i=r[n.name];if(void 0===i)throw new Error(`FunctionCallNode: Input '${n.name}' not found in FunctionNode.`);t.push(i.build(e,n.type))}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const ng=(e,...t)=>(t=t.length>1||t[0]&&!0===t[0].isNode?Vm(t):Om(t[0]),Um(new tg(Um(e),t)));lm("call",ng);class ig extends Kp{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new ig(e,t,n);for(let t=0;t<i.length-1;t++)r=new ig(e,r,i[t]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,i=this.aNode,r=this.bNode,s=i.getNodeType(e),a=typeof r<"u"?r.getNodeType(e):null;if("void"===s||"void"===a)return"void";if("%"===n)return s;if("~"===n||"&"===n||"|"===n||"^"===n||">>"===n||"<<"===n)return e.getIntegerType(s);if("!"===n||"=="===n||"&&"===n||"||"===n||"^^"===n)return"bool";if("<"===n||">"===n||"<="===n||">="===n){const n=t?e.getTypeLength(t):Math.max(e.getTypeLength(s),e.getTypeLength(a));return n>1?`bvec${n}`:"bool"}return"float"===s&&e.isMatrix(a)?a:e.isMatrix(s)&&e.isVector(a)?e.getVectorFromMatrix(s):e.isVector(s)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(s)?a:s}generate(e,t){const n=this.op,i=this.aNode,r=this.bNode,s=this.getNodeType(e,t);let a=null,o=null;"void"!==s?(a=i.getNodeType(e),o=typeof r<"u"?r.getNodeType(e):null,"<"===n||">"===n||"<="===n||">="===n||"=="===n?e.isVector(a)?o=a:a!==o&&(a=o="float"):">>"===n||"<<"===n?(a=s,o=e.changeComponentType(o,"uint")):e.isMatrix(a)&&e.isVector(o)?o=e.getVectorFromMatrix(a):a=e.isVector(a)&&e.isMatrix(o)?e.getVectorFromMatrix(o):o=s):a=o=s;const l=i.build(e,a),c=typeof r<"u"?r.build(e,o):null,u=e.getTypeLength(t),h=e.getFunctionOperator(n);return"void"!==t?"<"===n&&u>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${l}, ${c} )`,s,t):e.format(`( ${l} < ${c} )`,s,t):"<="===n&&u>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${l}, ${c} )`,s,t):e.format(`( ${l} <= ${c} )`,s,t):">"===n&&u>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${l}, ${c} )`,s,t):e.format(`( ${l} > ${c} )`,s,t):">="===n&&u>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${l}, ${c} )`,s,t):e.format(`( ${l} >= ${c} )`,s,t):"!"===n||"~"===n?e.format(`(${n}${l})`,a,t):h?e.format(`${h}( ${l}, ${c} )`,s,t):e.format(`( ${l} ${n} ${c} )`,s,t):"void"!==a?h?e.format(`${h}( ${l}, ${c} )`,s,t):e.format(`${l} ${n} ${c}`,s,t):void 0}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const rg=Fm(ig,"+"),sg=Fm(ig,"-"),ag=Fm(ig,"*"),og=Fm(ig,"/"),lg=Fm(ig,"%"),cg=Fm(ig,"=="),ug=Fm(ig,"!="),hg=Fm(ig,"<"),dg=Fm(ig,">"),pg=Fm(ig,"<="),mg=Fm(ig,">="),fg=Fm(ig,"&&"),gg=Fm(ig,"||"),vg=Fm(ig,"!"),yg=Fm(ig,"^^"),_g=Fm(ig,"&"),xg=Fm(ig,"~"),Mg=Fm(ig,"|"),bg=Fm(ig,"^"),Tg=Fm(ig,"<<"),Sg=Fm(ig,">>");lm("add",rg),lm("sub",sg),lm("mul",ag),lm("div",og),lm("modInt",lg),lm("equal",cg),lm("notEqual",ug),lm("lessThan",hg),lm("greaterThan",dg),lm("lessThanEqual",pg),lm("greaterThanEqual",mg),lm("and",fg),lm("or",gg),lm("not",vg),lm("xor",yg),lm("bitAnd",_g),lm("bitNot",xg),lm("bitOr",Mg),lm("bitXor",bg),lm("shiftLeft",Tg),lm("shiftRight",Sg);const wg=(...e)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),lg(...e));lm("remainder",wg);class Ng extends Kp{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>s&&r>a?t:s>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===Ng.LENGTH||t===Ng.DISTANCE||t===Ng.DOT?"float":t===Ng.CROSS?"vec3":t===Ng.ALL?"bool":t===Ng.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===Ng.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),s=this.aNode,a=this.bNode,o=this.cNode,l=!0===e.renderer.isWebGLRenderer;if(n===Ng.TRANSFORM_DIRECTION){let n=s,i=a;e.isMatrix(n.getNodeType(e))?i=sf(ef(i),0):n=sf(ef(n),0);const r=ag(n,i).xyz;return Wg(r).build(e,t)}if(n===Ng.NEGATE)return e.format("( - "+s.build(e,r)+" )",i,t);if(n===Ng.ONE_MINUS)return sg(1,s).build(e,t);if(n===Ng.RECIPROCAL)return og(1,s).build(e,t);if(n===Ng.DIFFERENCE)return Kg(sg(s,a)).build(e,t);{const c=[];return n===Ng.CROSS||n===Ng.MOD?c.push(s.build(e,i),a.build(e,i)):l&&n===Ng.STEP?c.push(s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":r),a.build(e,r)):l&&(n===Ng.MIN||n===Ng.MAX)||n===Ng.MOD?c.push(s.build(e,r),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":r)):n===Ng.REFRACT?c.push(s.build(e,r),a.build(e,r),o.build(e,"float")):n===Ng.MIX?c.push(s.build(e,r),a.build(e,r),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":r)):(c.push(s.build(e,r)),null!==a&&c.push(a.build(e,r)),null!==o&&c.push(o.build(e,r))),e.format(`${e.getMethod(n,i)}( ${c.join(", ")} )`,i,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Ng.ALL="all",Ng.ANY="any",Ng.EQUALS="equals",Ng.RADIANS="radians",Ng.DEGREES="degrees",Ng.EXP="exp",Ng.EXP2="exp2",Ng.LOG="log",Ng.LOG2
2="log2",Ng.SQRT="sqrt",Ng.INVERSE_SQRT="inversesqrt",Ng.FLOOR="floor",Ng.CEIL="ceil",Ng.NORMALIZE="normalize",Ng.FRACT="fract",Ng.SIN="sin",Ng.COS="cos",Ng.TAN="tan",Ng.ASIN="asin",Ng.ACOS="acos",Ng.ATAN="atan",Ng.ABS="abs",Ng.SIGN="sign",Ng.LENGTH="length",Ng.NEGATE="negate",Ng.ONE_MINUS="oneMinus",Ng.DFDX="dFdx",Ng.DFDY="dFdy",Ng.ROUND="round",Ng.RECIPROCAL="reciprocal",Ng.TRUNC="trunc",Ng.FWIDTH="fwidth",Ng.BITCAST="bitcast",Ng.TRANSPOSE="transpose",Ng.ATAN2="atan2",Ng.MIN="min",Ng.MAX="max",Ng.MOD="mod",Ng.STEP="step",Ng.REFLECT="reflect",Ng.DISTANCE="distance",Ng.DIFFERENCE="difference",Ng.DOT="dot",Ng.CROSS="cross",Ng.POW="pow",Ng.TRANSFORM_DIRECTION="transformDirection",Ng.MIX="mix",Ng.CLAMP="clamp",Ng.REFRACT="refract",Ng.SMOOTHSTEP="smoothstep",Ng.FACEFORWARD="faceforward";const Eg=Xm(1e-6),Ag=Xm(1e6),Cg=Xm(Math.PI),Rg=Xm(2*Math.PI),Ig=Fm(Ng,Ng.ALL),Lg=Fm(Ng,Ng.ANY),Pg=Fm(Ng,Ng.EQUALS),Dg=Fm(Ng,Ng.RADIANS),Ug=Fm(Ng,Ng.DEGREES),Og=Fm(Ng,Ng.EXP),Vg=Fm(Ng,Ng.EXP2),Fg=Fm(Ng,Ng.LOG),zg=Fm(Ng,Ng.LOG2),Bg=Fm(Ng,Ng.SQRT),kg=Fm(Ng,Ng.INVERSE_SQRT),Hg=Fm(Ng,Ng.FLOOR),Gg=Fm(Ng,Ng.CEIL),Wg=Fm(Ng,Ng.NORMALIZE),jg=Fm(Ng,Ng.FRACT),Xg=Fm(Ng,Ng.SIN),qg=Fm(Ng,Ng.COS),Yg=Fm(Ng,Ng.TAN),Zg=Fm(Ng,Ng.ASIN),$g=Fm(Ng,Ng.ACOS),Jg=Fm(Ng,Ng.ATAN),Kg=Fm(Ng,Ng.ABS),Qg=Fm(Ng,Ng.SIGN),ev=Fm(Ng,Ng.LENGTH),tv=Fm(Ng,Ng.NEGATE),nv=Fm(Ng,Ng.ONE_MINUS),iv=Fm(Ng,Ng.DFDX),rv=Fm(Ng,Ng.DFDY),sv=Fm(Ng,Ng.ROUND),av=Fm(Ng,Ng.RECIPROCAL),ov=Fm(Ng,Ng.TRUNC),lv=Fm(Ng,Ng.FWIDTH),cv=Fm(Ng,Ng.BITCAST),uv=Fm(Ng,Ng.TRANSPOSE),hv=Fm(Ng,Ng.ATAN2),dv=Fm(Ng,Ng.MIN),pv=Fm(Ng,Ng.MAX),mv=Fm(Ng,Ng.MOD),fv=Fm(Ng,Ng.STEP),gv=Fm(Ng,Ng.REFLECT),vv=Fm(Ng,Ng.DISTANCE),yv=Fm(Ng,Ng.DIFFERENCE),_v=Fm(Ng,Ng.DOT),xv=Fm(Ng,Ng.CROSS),Mv=Fm(Ng,Ng.POW),bv=Fm(Ng,Ng.POW,2),Tv=Fm(Ng,Ng.POW,3),Sv=Fm(Ng,Ng.POW,4),wv=Fm(Ng,Ng.TRANSFORM_DIRECTION),Nv=e=>ag(Qg(e),Mv(Kg(e),1/3)),Ev=e=>_v(e,e),Av=Fm(Ng,Ng.MIX),Cv=(e,t=0,n=1)=>Um(new Ng(Ng.CLAMP,Um(e),Um(t),Um(n))),Rv=e=>Cv(e),Iv=Fm(Ng,Ng.REFRACT),Lv=Fm(Ng,Ng.SMOOTHSTEP),Pv=Fm(Ng,Ng.FACEFORWARD),Dv=Bm(([e])=>{const t=_v(e.xy,$m(12.9898,78.233)),n=mv(t,Cg);return jg(Xg(n).mul(43758.5453))}),Uv=(e,t,n)=>
2Av(t,n,e),Ov=(e,t,n)=>Lv(t,n,e);lm("all",Ig),lm("any",Lg),lm("equals",Pg),lm("radians",Dg),lm("degrees",Ug),lm("exp",Og),lm("exp2",Vg),lm("log",Fg),lm("log2",zg),lm("sqrt",Bg),lm("inverseSqrt",kg),lm("floor",Hg),lm("ceil",Gg),lm("normalize",Wg),lm("fract",jg),lm("sin",Xg),lm("cos",qg),lm("tan",Yg),lm("asin",Zg),lm("acos",$g),lm("atan",Jg),lm("abs",Kg),lm("sign",Qg),lm("length",ev),lm("lengthSq",Ev),lm("negate",tv),lm("oneMinus",nv),lm("dFdx",iv),lm("dFdy",rv),lm("round",sv),lm("reciprocal",av),lm("trunc",ov),lm("fwidth",lv),lm("atan2",hv),lm("min",dv),lm("max",pv),lm("mod",mv),lm("step",fv),lm("reflect",gv),lm("distance",vv),lm("dot",_v),lm("cross",xv),lm("pow",Mv),lm("pow2",bv),lm("pow3",Tv),lm("pow4",Sv),lm("transformDirection",wv),lm("mix",Uv),lm("clamp",Cv),lm("refract",Iv),lm("smoothstep",Ov),lm("faceForward",Pv),lm("difference",yv),lm("saturate",Rv),lm("cbrt",Nv),lm("transpose",uv),lm("rand",Dv);class Vv extends Zp{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const t=this.ifNode.getNodeType(e);if(null!==this.elseNode){const n=this.elseNode.getNodeType(e);if(e.getTypeLength(n)>e.getTypeLength(t))return n}return t}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,null!==i&&(e.getDataFromNode(i).parentNodeBlock=r);const s=e.getNodeProperties(this);s.condNode=t,s.ifNode=n.context({nodeBlock:n}),s.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(void 0!==i.nodeProperty)return i.nodeProperty;const{condNode:r,ifNode:s,elseNode:a}=e.getNodeProperties(this),o="void"!==t,l=o?Tf(n).build(e):"";i.nodeProperty=l;const c=r.build(e,"bool");e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let u=s.build(e,n);if(u&&(u=o?l+" = "+u+";":"return "+u+";"),e.removeFlowTab().addFlowCode(e.tab+"\t"+u+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,n);t&&(t=o?l+" = "+t+";":"return "+t+";"),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,n,t)}}const Fv=Fm(Vv);lm("select",Fv);const zv=(...e)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),Fv(...e));lm("cond",zv);class Bv extends Zp{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e);return e.setContext(t),n}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const i=this.node.build(e,t);return e.setContext(n),i}}const kv=Fm(Bv),Hv=(e,t)=>kv(e,{label:t});lm("context",kv),lm("label",Hv);class Gv extends Zp{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:n}=this,i=e.getVarFromNode(this,n,e.getVectorType(this.getNodeType(e))),r=e.getPropertyName(i),s=t.build(e,i.type);return e.addLineFlowCode(`${r} = ${s}`,this),r}}const Wv=Fm(Gv);lm("temp",Wv),lm("toVar",(...e)=>Wv(...e).append());class jv extends Zp{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(void 0===n){const i=this.name,r=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,i,r),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation="fragment"===e.shaderStage),n}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),n=this.setupVarying(e);if(void 0===t.propertyName){const i=this.getNodeType(e),r=e.getPropertyName(n,Hp.VERTEX);e.flowNodeFromShaderStage(Hp.VERTEX,this.node,i,r),t.propertyName=r}return e.getPropertyName(n)}}const Xv=Fm(jv);lm("varying",Xv);const qv="WorkingColorSpace",Yv="OutputColorSpace";function Zv(e){let t=null;return e===ht?t="Linear":e===ut&&(t="sRGB"),t}function $v(e,t){return Zv(e)+"To"+Zv(t)}class Jv extends Kp{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}getColorSpace(e,t){return t===qv?sn.workingColorSpace:t===Yv?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{renderer:t}
vendor: 15,041 bytes, line 2
2=e,{colorNode:n}=this,i=this.getColorSpace(e,this.source),r=this.getColorSpace(e,this.target);if(i===r)return n;const s=$v(i,r);let a=null;const o=t.nodes.library.getColorSpaceFunction(s);return null!==o?a=sf(o(n.rgb),n.a):(console.error("ColorSpaceNode: Unsupported Color Space configuration.",s),a=n),a}}const Kv=e=>Um(new Jv(Um(e),qv,Yv)),Qv=e=>Um(new Jv(Um(e),Yv,qv)),ey=(e,t)=>Um(new Jv(Um(e),qv,t)),ty=(e,t)=>Um(new Jv(Um(e),t,qv));lm("toOutputColorSpace",Kv),lm("toWorkingColorSpace",Qv),lm("workingToColorSpace",ey),lm("colorSpaceToWorking",ty);let ny=class extends $p{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,n,i)}};class iy extends Zp{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=Gp.OBJECT}setGroup(e){return this.group=e,this}element(e){return Um(new ny(this,Um(e)))}setNodeType(e){const t=Mf(null,e).getSelf();null!==this.group&&t.setGroup(this.group),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let e=1;e<t.length;e++)n=n[t[e]];return n}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}class ry extends iy{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(yf)}updateReference(e){return this.reference=null!==this.renderer?this.renderer:e.renderer,this.reference}}const sy=(e,t,n)=>Um(new ry(e,t,n));class ay extends Kp{static get type(){return"ToneMappingNode"}constructor(e,t=ly,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}getCacheKey(){return Dp(super.getCacheKey(),this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(0===n)return t;let i=null;const r=e.renderer.nodes.library.getToneMappingFunction(n);return null!==r?i=sf(r(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),i=t),i}}const oy=(e,t,n)=>Um(new ay(e,Um(t),Um(n))),ly=sy("toneMappingExposure","float");lm("toneMapping",(e,t,n)=>oy(t,n,e));class cy extends rm{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=i,this.usage=Et,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(0===this.bufferStride&&0===this.bufferOffset){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),n=this.value,i=e.getTypeLength(t),r=this.bufferStride||i,s=this.bufferOffset,a=!0===n.isInterleavedBuffer?n:new Xo(n,r),o=new Yo(a,i,s);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(n);let r=null;return"vertex"===e.shaderStage||"compute"===e.shaderStage?(this.name=i,r=i):r=Xv(this).build(e,t),r}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const uy=(e,t,n,i)=>Um(new cy(e,t,n,i)),hy=(e,t,n,i)=>uy(e,t,n,i).setUsage(At),dy=(e,t,n,i)=>uy(e,t,n,i).setInstanced(!0),py=(e,t,n,i)=>hy(e,t,n,i).setInstanced(!0);lm("toAttribute",e=>uy(e.value));class my extends Zp{static get type(){return"ComputeNode"}constructor(e,t,n=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=n,this.dispatchCount=0,this.version=1,this.updateBeforeType=Gp.OBJECT,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let n=t[0];for(let e=1;e<t.length;e++)n*=t[e];this.dispatchCount=Math.ceil(e/n)}onInit(){}updateBefore({renderer:e}){e.compute(this)}generate(e){const{shaderStage:t}=e;if("compute"===t){const t=this.computeNode.build(e,"void");""!==t&&e.addLineFlowCode(t,this)}}}const fy=(e,t,n)=>Um(new my(Um(e),t,n));lm("compute",fy);class gy extends Zp{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){return this.node.getNodeType(e)}build(e,...t){const n=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const r=this.node.build(e,...t);return e.setCache(n),r}}const vy=(e,...t)=>Um(new gy(Um(e),...t));lm("cache",vy);class yy extends Zp{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const _y=Fm(yy);lm("bypass",_y);class xy extends Zp{static get type(){return"RemapNode"}constructor(e,t,n,i=Xm(0),r=Xm(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=i,this.outHighNode=r,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:i,outHighNode:r,doClamp:s}=this;let a=e.sub(t).div(n.sub(t));return!0===s&&(a=a.clamp()),a.mul(r.sub(i)).add(i)}}const My=Fm(xy,null,null,{doClamp:!1}),by=Fm(xy);lm("remap",My),lm("remapClamp",by);class Ty extends Zp{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),i=this.snippet;if("void"!==n)return e.format(`( ${i} )`,n,t);e.addLineFlowCode(i,this)}}const Sy=Fm(Ty),wy=e=>(e?Fv(e,Sy("discard")):Sy("discard")).append();lm("discard",wy);class Ny extends Kp{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=n,this.isRenderOutput=!0}setup({context:e}){let t=this.colorNode||e.color;const n=(null!==this.toneMapping?this.toneMapping:e.toneMapping)||0,i=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||ct;return 0!==n&&(t=t.toneMapping(n)),i!==ct&&i!==sn.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}const Ey=(e,t=null,n=null)=>Um(new Ny(Um(e),t,n));lm("renderOutput",Ey);class Ay extends Zp{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(null===t){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const i=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(i)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const i=e.geometry.getAttribute(t),r=e.getTypeFromAttribute(i),s=e.getAttribute(t,r);return"vertex"===e.shaderStage?e.format(s.name,r,n):Xv(this).build(e,n)}return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Cy=(e,t)=>Um(new Ay(e,t)),Ry=e=>Cy("uv"+(e>0?e:""),"vec2");class Iy extends Zp{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),i=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${i} )`,this.getNodeType(e),t)}}const Ly=Fm(Iy);class Py extends xf{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=Gp.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&void 0!==n.width){const{width:e,height:t}=n;this.value=Math.log2(Math.max(e,t))}}}const Dy=Fm(Py);class Uy extends xf{static get type(){return"TextureNode"}constructor(e,t=null,n=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=Gp.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===ie?"uvec4":this.value.type===ne?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ry(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=Mf(this.value.matrix)),this._matrixUniform.mul(ef(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?Gp.FRAME:Gp.NONE,this}setupUV(e,t){const n=this.value;return e.isFlipY()&&(!0===n.isRenderTargetTexture||!0===n.isFramebufferTexture||!0===n.isDepthTexture)&&(t=this.sampler?t.flipY():t.setY(qm(Ly(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.uvNode;(null===n||!0===e.context.forceUVContext)&&e.context.getUV&&(n=e.context.getUV(this)),n||(n=this.getDefaultUV()),!0===this.updateMatrix&&(n=this.getTransformedUV(n)),n=this.setupUV(e,n);let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),t.uvNode=n,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateSnippet(e,t,n,i,r,s,a,o){const l=this.value;let c;return c=i?e.generateTextureLevel(l,t,n,i,s):r?e.generateTextureBias(l,t,n,r,s):o?e.generateTextureGrad(l,t,n,o,s):a?e.generateTextureCompare(l,t,n,a,s):!1===this.sampler?e.generateTextureLoad(l,t,n,s):e.generateTexture(l,t,n,s),c}generate(e,t){const n=e.getNodeProperties(this),i=this.value;if(!i||!0!==i.isTexture)throw new Error("TextureNode: Need a three.js texture.");const r=super.generate(e,"property");if("sampler"===t)return r+"_sampler";if(e.isReference(t))return r;{const s=e.getDataFromNode(this);let a=s.propertyName;if(void 0===a){const{uvNode:t,levelNode:i,biasNode:o,compareNode:l,depthNode:c,gradNode:u}=n,h=this.generateUV(e,t),d=i?i.build(e,"float"):null,p=o?o.build(e,"float"):null,m=c?c.build(e,"int"):null,f=l?l.build(e,"float"):null,g=u?[u[0].build(e,"vec2"),u[1].build(e,"vec2")]:null,v=e.getVarFromNode(this);a=e.getPropertyName(v);const y=this.generateSnippet(e,r,h,d,p,m,f,g);e.addLineFlowCode(`${a} = ${y}`,this),s.snippet=y,s.propertyName=a}let o=a;const l=this.getNodeType(e);return e.needsToWorkingColorSpace(i)&&(o=ty(Sy(o,l),i.colorSpace).setup(e).build(e,l)),e.format(o,l,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){const t=this.clone();return t.uvNode=Um(e),t.referenceNode=this.getSelf(),Um(t)}blur(e){const t=this.clone();return t.biasNode=Um(e).mul(Dy(t)),t.referenceNode=this.getSelf(),Um(t)}level(e){const t=this.clone();return t.levelNode=Um(e),t.referenceNode=this.getSelf(),Um(t)}size(e){return Ly(this,e)}bias(e){const t=this.clone();return t.biasNode=Um(e),t.referenceNode=this.getSelf(),Um(t)}compare(e){const t=this.clone();return t.compareNode=Um(e),t.referenceNode=this.getSelf(),Um(t)}grad(e,t){const n=this.clone();return n.gradNode=[Um(e),Um(t)],n.referenceNode=this.getSelf(),Um(n)}depth(e){const t=this.clone();return t.depthNode=Um(e),t.referenceNode=this.getSelf(),Um(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const Oy=Fm(Uy),Vy=(...e)=>Oy(...e).setSampler(!1),Fy=Mf("float").label("cameraNear").setGroup(yf).onRenderUpdate(({camera:e})=>e.near),zy=Mf("float").label("cameraFar").setGroup(yf).onRenderUpdate(({camera:e})=>e.far),By=Mf("float").label("cameraLogDepth").setGroup(yf).onRenderUpdate(({camera:e})=>2/(Math.log(e.far+1)/Math.LN2)),ky=Mf("mat4").label("cameraProjectionMatrix").setGroup(yf).onRenderUpdate(({camera:e})=>e.projectionMatrix),Hy=Mf("mat4").label("cameraProjectionMatrixInverse").setGroup(yf).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse),Gy=Mf("mat4").label("cameraViewMatrix").setGroup(yf).onRenderUpdate(({camera:e})=>e.matrixWorldInverse),Wy=Mf("mat4").label("cameraWorldMatrix").setGroup(yf).onRenderUpdate(({camera:e})=>e.matrixWorld),jy=Mf("mat3").label("cameraNormalMatrix").setGroup(yf).onRenderUpdate(({camera:e})=>e.normalMatrix),Xy=Mf(new Mn).label("cameraPosition").setGroup(yf).onRenderUpdate(({camera:e},t)=>t.value.setFromMatrixPosition(e.matrixWorld));class qy extends Zp{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Gp.OBJECT,this._uniformNode=new xf(null)}getNodeType(){const e=this.scope;return e===qy.WORLD_MATRIX?"mat4":e===qy.POSITION||e===qy.VIEW_POSITION||e===qy.DIRECTION||e===qy.SCALE?"vec3":void 0}update(e){const t=this.object3d,n=this._uniformNode,i=this.scope;if(i===qy.WORLD_MATRIX)n.value=t.matrixWorld;else if(i===qy.POSITION)n.value=n.value||new Mn,n.value.setFromMatrixPosition(t.matrixWorld);else if(i===qy.SCALE)n.value=n.value||new Mn,n.value.setFromMatrixScale(t.matrixWorld);else if(i===qy.DIRECTION)n.value=n.value||new Mn,t.getWorldDirection(n.value);
2else if(i===qy.VIEW_POSITION){const i=e.camera;n.value=n.value||new Mn,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(i.matrixWorldInverse)}}generate(e){const t=this.scope;return t===qy.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===qy.POSITION||t===qy.VIEW_POSITION||t===qy.DIRECTION||t===qy.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}qy.WORLD_MATRIX="worldMatrix",qy.POSITION="position",qy.SCALE="scale",qy.VIEW_POSITION="viewPosition",qy.DIRECTION="direction";const Yy=Fm(qy,qy.DIRECTION),Zy=Fm(qy,qy.WORLD_MATRIX),$y=Fm(qy,qy.POSITION),Jy=Fm(qy,qy.SCALE),Ky=Fm(qy,qy.VIEW_POSITION);class Qy extends qy{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const e_=zm(Qy,Qy.DIRECTION),t_=zm(Qy,Qy.WORLD_MATRIX),n_=zm(Qy,Qy.POSITION),i_=zm(Qy,Qy.SCALE),r_=zm(Qy,Qy.VIEW_POSITION),s_=Mf(new jt).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),a_=Mf(new Jn).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),o_=Gy.mul(t_).toVar("modelViewMatrix_2"),l_=Bm(e=>
2(e.context.isHighPrecisionModelViewMatrix=!0,Mf("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highPrecisionModelViewMatrix"),c_=Bm(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return Mf("mat3").onObjectUpdate(({object:e,camera:n})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highPrecisionModelNormalMatrix"),u_=Cy("position","vec3"),h_=u_.varying("positionLocal"),d_=u_.varying("positionPrevious"),p_=t_.mul(h_).xyz.varying("v_positionWorld"),m_=h_.transformDirection(t_).varying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),f_=o_.mul(h_).xyz.varying("v_positionView"),g_=f_.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class v_ extends Zp{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:n}=e;return t.coordinateSystem===Rt&&1===n.side?"false":e.getFrontFacing()}}const y_=zm(v_),__=Xm(y_).mul(2).sub(1),x_=Cy("normal","vec3"),M_=Bm(e=>!1===e.geometry.hasAttribute("normal")?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),ef(0,1,0)):x_,"vec3").once()().toVar("normalLocal"),b_=f_.dFdx().cross(f_.dFdy()).normalize().toVar("normalFlat"),T_=Bm(e=>{let t;return t=!0===e.material.flatShading?b_:Xv(C_(M_),"v_normalView").normalize(),t},"vec3").once()().toVar("normalView"),S_=Xv(T_.transformDirection(Gy),"v_normalWorld").normalize().toVar("normalWorld"),w_=Bm(e=>e.context.setupNormal(),"vec3").once()().mul(__).toVar("transformedNormalView"),N_=w_.transformDirection(Gy).toVar("transformedNormalWorld"),E_=Bm(e=>e.context.setupClearcoatNormal(),"vec3").once()().mul(__).toVar("transformedClearcoatNormalView"),A_=Bm(([e,t=t_])=>{const n=uf(t),i=e.div(ef(n[0].dot(n[0]),n[1].dot(n[1]),n[2].dot(n[2])));return n.mul(i).xyz}),C_=Bm(([e],t)=>{const n=t.renderer.nodes.modelNormalViewMatrix;if(null!==n)return n.transformDirection(e);const i=s_.mul(e);return Gy.transformDirection(i)}),R_=Mf(0).onReference(({material:e})=>e).onRenderUpdate(({material:e})=>e.refractionRatio),I_=g_.negate().reflect(w_),L_=g_.negate().refract(w_,R_),P_=I_.transformDirection(Gy).toVar("reflectVector"),D_=L_.transformDirection(Gy).toVar("reflectVector");class U_ extends Uy{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,i=null){super(e,t,n,i),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===F?P_:e.mapping===z?D_:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),ef(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem!==It&&n.isRenderTargetTexture?t:ef(t.x.negate(),t.yz)}generateUV(e,t){return t.build(e,"vec3")}}const O_=Fm(U_);class V_ extends xf{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const F_=(e,t,n)=>Um(new V_(e,t,n));class z_ extends $p{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType();return e.format(t,"vec4",n)}}class B_ extends V_{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null,"vec4"),this.array=e,this.elementType=t,this._elementType=null,this._elementLength=0,this.updateType=Gp.RENDER,this.isArrayBufferNode=!0}getElementType(){return this.elementType||this._elementType}getElementLength(){return this._elementLength}update(){const{array:e,value:t}=this,n=this.getElementLength(),i=this.getElementType();if(1===n)for(let n=0;n<e.length;n++){t[4*n]=e[n]}else if("color"===i)for(let n=0;n<e.length;n++){const i=4*n,r=e[n];t[i]=r.r,t[i+1]=r.g,t[i+2]=r.b||0}else for(let n=0;n<e.length;n++){const i=4*n,r=e[n];t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z||0,t[i+3]=r.w||0}}setup(e){const t=this.array.length;this._elementType=null===this.elementType?Vp(this.array[0]):this.elementType,this._elementLength=e.getTypeLength(this._elementType);let n=Float32Array;return"i"===this._elementType.charAt(0)?n=Int32Array:"u"===this._elementType.charAt(0)&&(n=Uint32Array),this.value=new n(4*t),this.bufferCount=t,this.bufferType=e.changeComponentType("vec4",e.getComponentType(this._elementType)),super.setup(e)}element(e){return Um(new z_(this,Um(e)))}}const k_=(e,t)=>Um(new B_(e,t));class H_ extends $p{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,n,i)}}class G_ extends Zp{static get type(){return"ReferenceNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=Gp.OBJECT}element(e){return Um(new H_(this,Um(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;t=null!==this.count?F_(null,e,this.count):Array.isArray(this.getValueFromReference())?k_(null,e):"texture"===e?Oy(null):"cubeTexture"===e?O_(null):Mf(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateV
vendor: 6,057 bytes, line 2
2alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let e=1;e<t.length;e++)n=n[t[e]];return n}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const W_=(e,t,n)=>Um(new G_(e,t,n)),j_=(e,t,n,i)=>Um(new G_(e,t,i,n));class X_ extends G_{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const q_=(e,t,n)=>Um(new X_(e,t,n)),Y_=Bm(e=>(!1===e.geometry.hasAttribute("tangent")&&e.geometry.computeTangents(),Cy("tangent","vec4")))(),Z_=Y_.xyz.toVar("tangentLocal"),$_=o_.mul(sf(Z_,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),J_=$_.transformDirection(Gy).varying("v_tangentWorld").normalize().toVar("tangentWorld"),K_=$_.toVar("transformedTangentView"),Q_=K_.transformDirection(Gy).normalize().toVar("transformedTangentWorld"),ex=e=>e.mul(Y_.w).xyz,tx=Xv(ex(x_.cross(Y_)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),nx=Xv(ex(M_.cross(Z_)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),ix=Xv(ex(T_.cross($_)),"v_bitangentView").normalize().toVar("bitangentView"),rx=Xv(ex(S_.cross(J_)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),sx=ex(w_.cross(K_)).normalize().toVar("transformedBitangentView"),ax=sx.transformDirection(Gy).normalize().toVar("transformedBitangentWorld"),ox=uf($_,ix,T_),lx=g_.mul(ox),cx=(()=>{let e=zf.cross(g_);return e=e.cross(zf).normalize(),e=Av(e,w_,Vf.mul(Ef.oneMinus()).oneMinus().pow2().pow2()).normalize(),e})(),ux=Bm(e=>{const{eye_pos:t,surf_norm:n,mapN:i,uv:r}=e,s=t.dFdx(),a=t.dFdy(),o=r.dFdx(),l=r.dFdy(),c=n,u=a.cross(c),h=c.cross(s),d=u.mul(o.x).add(h.mul(l.x)),p=u.mul(o.y).add(h.mul(l.y)),m=d.dot(d).max(p.dot(p)),f=__.mul(m.inverseSqrt());return rg(d.mul(i.x,f),p.mul(i.y,f),c.mul(i.z)).normalize()});class hx extends Kp{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=0}setup(e){const{normalMapType:t,scaleNode:n}=this;let i=this.node.mul(2).sub(1);null!==n&&(i=ef(i.xy.mul(n),i.z));let r=null;return 1===t?r=C_(i):0===t&&(r=!0===e.hasGeometryAttribute("tangent")?ox.mul(i).normalize():ux({eye_pos:f_,surf_norm:T_,mapN:i,uv:Ry()})),r}}const dx=Fm(hx),px=Bm(({textureNode:e,bumpScale:t})=>{const n=t=>e.cache().context({getUV:e=>t(e.uvNode||Ry()),forceUVContext:!0}),i=Xm(n(e=>e));return $m(Xm(n(e=>e.add(e.dFdx()))).sub(i),Xm(n(e=>e.add(e.dFdy()))).sub(i)).mul(t)}),mx=Bm(e=>{const{surf_pos:t,surf_norm:n,dHdxy:i}=e,r=t.dFdx().normalize(),s=n,a=t.dFdy().normalize().cross(s),o=s.cross(r),l=r.dot(a).mul(__),c=l.sign().mul(i.x.mul(a).add(i.y.mul(o)));return l.abs().mul(n).sub(c).normalize()});class fx extends Kp{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=px({textureNode:this.textureNode,bumpScale:e});return mx({surf_pos:f_,surf_norm:T_,dHdxy:t})}}const gx=Fm(fx),vx=new Map;class yx extends Zp{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=vx.get(e);return void 0===n&&(n=q_(e,t),vx.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let i=null;if(n===yx.COLOR){const e=void 0!==t.color?this.getColor(n):ef();i=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(n===yx.OPACITY){const e=this.getFloat(n);i=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(n===yx.SPECULAR_STRENGTH)i=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:Xm(1);else if(n===yx.SPECULAR_INTENSITY){const e=this.getFloat(n);i=t.specularMap?e.mul(this.getTexture(n).a):e}else if(n===yx.SPECULAR_COLOR){const e=this.getColor(n);i=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(n).rgb):e}else if(n===yx.ROUGHNESS){const e=this.getFloat(n);i=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(n).g):e}else if(n===yx.METALNESS){const e=this.getFloat(n);i=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(n).b):e}else if(n===yx.EMISSIVE){const e=this.getFloat("emissiveIntensity"),r=this.getColor(n).mul(e);i=t.emissiveMap&&!0===t.emissiveMap.isTexture?r.mul(this.getTexture(n)):r}else if(n===yx.NORMAL)t.normalMap?(i=dx(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType):i=t.bumpMap?gx(this.getTexture("bump").r,this.getFloat("bumpScale")):T_;else if(n===yx.CLEARCOAT){const e=this.getFloat(n);i=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===yx.CLEARCOAT_ROUGHNESS){const e=this.getFloat(n);i=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===yx.CLEARCOAT_NORMAL)i=t.clearcoatNormalMap?dx(this.getTexture(n),this.getCache(n+"Scale","vec2")):T_;else if(n===yx.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));i=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(n===yx.SHEEN_ROUGHNESS){const e=this.getFloat(n);i=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(n).a):e,i=i.clamp(.07,1)}else if(n===yx.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(n);i=cf(nM.x,nM.y,nM.y.negate(),nM.x).mul(e.rg.mul(2).sub($m(1)).normalize().mul(e.b))}else i=nM;else if(n===yx.IRIDESCENCE_THICKNESS){const e=W_("1","float",t.iridescenceThicknessRange);
2if(t.iridescenceThicknessMap){const r=W_("0","float",t.iridescenceThicknessRange);i=e.sub(r).mul(this.getTexture(n).g).add(r)}else i=e}else if(n===yx.TRANSMISSION){const e=this.getFloat(n);i=t.transmissionMap?e.mul(this.getTexture(n).r):e}else if(n===yx.THICKNESS){const e=this.getFloat(n);i=t.thicknessMap?e.mul(this.getTexture(n).g):e}else if(n===yx.IOR)i=this.getFloat(n);else if(n===yx.LIGHT_MAP)i=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===yx.AO_MAP)i=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const t=this.getNodeType(e);i=this.getCache(n,t)}return i}}yx.ALPHA_TEST="alphaTest",yx.COLOR="color",yx.OPACITY="opacity",yx.SHININESS="shininess",yx.SPECULAR="specular",yx.SPECULAR_STRENGTH="specularStrength",yx.SPECULAR_INTENSITY="specularIntensity",yx.SPECULAR_COLOR="specularColor",yx.REFLECTIVITY="reflectivity",yx.ROUGHNESS="roughness",yx.METALNESS="metalness",yx.NORMAL="normal",yx.CLEARCOAT="clearcoat",yx.CLEARCOAT_ROUGHNESS="clearcoatRoughness",yx.CLEARCOAT_NORMAL="clearcoatNormal",yx.EMISSIVE="emissive",yx.ROTATION="rotation",yx.SHEEN="sheen",yx.SHEEN_ROUGHNESS="sheenRoughness",yx.ANISOTROPY="anisotropy",yx.IRIDESCENCE="iridescence",yx.IRIDESCENCE_IOR="iridescenceIOR",yx.IRIDESCENCE_THICKNESS="iridescenceThickness",yx.IOR="ior",yx.TRANSMISSION="transmission",yx.THICKNESS="thickness",yx.ATTENUATION_DISTANCE="attenuationDistance",yx.ATTENUATION_COLOR="attenuationColor",yx.LINE_SCALE="scale",yx.LINE_DASH_SIZE="dashSize",yx.LINE_GAP_SIZE="gapSize",yx.LINE_WIDTH="linewidth",yx.LINE_DASH_OFFSET="dashOffset",yx.POINT_WIDTH="pointWidth",yx.DISPERSION="dispersion",yx.LIGHT_MAP="light",yx.AO_MAP="ao";const _x=zm(yx,yx.ALPHA_TEST),xx=zm(yx,yx.COLOR),Mx=zm(yx,yx.SHININESS),bx=zm(yx,yx.EMISSIVE),Tx=zm(yx,yx.OPACITY),Sx=zm(yx,yx.SPECULAR),wx=zm(yx,yx.SPECULAR_INTENSITY),Nx=zm(yx,yx.SPECULAR_COLOR),Ex=zm(yx,yx.SPECULAR_STRENGTH),Ax=zm(yx,yx.REFLECTIVITY),Cx=zm(yx,yx.ROUGHNESS),Rx=zm(yx,yx.METALNESS),Ix=zm(yx,yx.NORMAL).context({getUV:null}),Lx=zm(yx,yx.CLEARCOAT),Px=zm(yx,yx.CLEARCOAT_ROUGHNESS),Dx=zm(yx,yx.CLEARCOAT_NORMAL).context({getUV:null}),Ux=zm(yx,yx.ROTATION),Ox=zm(yx,yx.SHEEN),Vx=zm(yx,yx.SHEEN_ROUGHNESS),Fx=zm(yx,yx.ANISOTROPY),zx=zm(yx,yx.IRIDESCENCE),Bx=zm(yx,yx.IRIDESCENCE_IOR),kx=zm(yx,yx.IRIDESCENCE_THICKNESS),Hx=zm(yx,yx.TRANSMISSION),Gx=zm(yx,yx.THICKNESS),Wx=zm(yx,yx.IOR),jx=zm(yx,yx.ATTENUATION_DISTANCE),Xx=zm(yx,yx.ATTENUATION_COLOR),qx=zm(yx,yx.LINE_SCALE),Yx=zm(yx,yx.LINE_DASH_SIZE),Zx=zm(yx,yx.LINE_GAP_SIZE),$x=zm(yx,yx.LINE_WIDTH),Jx=zm(yx,yx.LINE_DASH_OFFSET),Kx=zm(yx,yx.POINT_WIDTH),Qx=zm(yx,yx.DISPERSION),eM=zm(yx,yx.LIGHT_MAP),tM=zm(yx,yx.AO_MAP),nM=Mf(new Wt).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))});class iM extends Kp{static get type(){return"ModelViewProjectionNode"}constructor(e=null){super("vec4"),this.positionNode=e}setup(e){if("fragment"===e.shaderStage)return Xv(e.context.mvp);const t=this.positionNode||h_,n=e.renderer.nodes.modelViewMatrix||o_;return ky.mul(n).mul(t)}
2}const rM=Fm(iM);class sM extends Zp{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isInstanceIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let i,r;if(n===sM.VERTEX)i=e.getVertexIndex();else if(n===sM.INSTANCE)i=e.getInstanceIndex();else if(n===sM.DRAW)i=e.getDrawIndex();else if(n===sM.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(n===sM.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else{if(n!==sM.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+n);i=e.getSubgroupIndex()}return r="vertex"===e.shaderStage||"compute"===e.shaderStage?i:Xv(this).build(e,t),r}}sM.VERTEX="vertex",sM.INSTANCE="instance",sM.SUBGROUP="subgroup",sM.INVOCATION_LOCAL="invocationLocal",sM.INVOCATION_SUBGROUP="invocationSubgroup",sM.DRAW="draw";const aM=zm(sM,sM.VERTEX),oM=zm(sM,sM.INSTANCE),lM=zm(sM,sM.SUBGROUP),cM=zm(sM,sM.INVOCATION_SUBGROUP),uM=zm(sM,sM.INVOCATION_LOCAL),hM=zm(sM,sM.DRAW);class dM extends Zp{static get type(){return"InstanceNode"}constructor(e){super("void"),this.instanceMesh=e,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=Gp.FRAME,this.buffer=null,this.bufferColor=null}setup(e){let t=this.instanceMatrixNode,n=this.instanceColorNode;const i=this.instanceMesh;if(null===t){const e=i.instanceMatrix;if(i.count<=1e3)t=F_(e.array,"mat4",Math.max(i.count,1)).element(oM);else{const n=new Xd(e.array,16,1);this.buffer=n;const i=e.usage===At?py:dy,r=[i(n,"vec4",16,0),i(n,"vec4",16,4),i(n,"vec4",16,8),i(n,"vec4",16,12)];t=hf(...r)}this.instanceMatrixNode=t}const r=i.instanceColor;if(r&&null===n){const e=new Cl(r.array,3),t=r.usage===At?py:dy;this.bufferColor=e,n=ef(t(e,"vec3",3,0)),this.instanceColorNode=n}const s=t.mul(h_).xyz;if(h_.assign(s),e.hasGeometryAttribute("normal")){const e=A_(M_,t);M_.assign(e)}null!==this.instanceColorNode&&Sf("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMesh.instanceMatrix.usage!==At&&null!=this.buffer&&this.instanceMesh.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMesh.instanceMatrix.version),this.instanceMesh.instanceColor&&this.instanceMesh.instanceColor.usage!==At&&null!=this.bufferColor&&this.instanceMesh.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceMesh.instanceColor.version)}}const pM=Fm(dM);class mM extends Zp{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=oM:this.batchingIdNode=hM);const t=Bm(([e])=>{const t=Ly(Vy(this.batchMesh._indirectTexture),0),n=qm(e).modInt(qm(t)),i=qm(e).div(qm(t));return Vy(this.batchMesh._indirectTexture,Jm(n,i)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(qm(this.batchingIdNode)),n=this.batchMesh._matricesTexture,i=Ly(Vy(n),0),r=Xm(t).mul(4).toInt().toVar(),s=r.modInt(i),a=r.div(qm(i)),o=hf(Vy(n,Jm(s,a)),Vy(n,Jm(s.add(1),a)),Vy(n,Jm(s.add(2),a)),Vy(n,Jm(s.add(3),a))),l=this.batchMesh._colorsTexture;if(null!==l){const e=Bm(([e])=>{const t=Ly(Vy(l),0).x,n=e,i=n.modInt(t),r=n.div(t);return Vy(l,Jm(i,r)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(t);Sf("vec3","vBatchColor").assign(e)}const c=uf(o);h_.assign(o.mul(h_));const u=M_.div(ef(c[0].dot(c[0]),c[1].dot(c[1]),c[2].dot(c[2]))),h=c.mul(u).xyz;M_.assign(h),e.hasGeometryAttribute("tangent")&&Z_.mulAssign(c)}}const fM=Fm(mM),gM=new WeakMap;class vM extends Zp{static get type(){return"SkinningNode"}constructor(e,t=!1){let n,i,r;super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=Gp.OBJECT,this.skinIndexNode=Cy("skinIndex","uvec4"),this.skinWeightNode=Cy("skinWeight","vec4"),t?(n=W_("bindMatrix","mat4"),i=W_("bindMatrixInverse","mat4"),r=j_("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(n=Mf(e.bindMatrix,"mat4"),i=Mf(e.bindMatrixInverse,"mat4"),r=F_(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=n,this.bindMatrixInverseNode=i,this.boneMatricesNode=r,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=h_){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNo
2de:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),c=e.element(n.w),u=r.mul(t),h=rg(a.mul(i.x).mul(u),o.mul(i.y).mul(u),l.mul(i.z).mul(u),c.mul(i.w).mul(u));return s.mul(h).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=M_){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNode:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),c=e.element(n.w);let u=rg(i.x.mul(a),i.y.mul(o),i.z.mul(l),i.w.mul(c));return u=s.mul(u).mul(r),u.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=j_("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,d_)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")}setup(e){this.needsPreviousBoneMatrices(e)&&d_.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(h_.assign(t),e.hasGeometryAttribute("normal")){const t=this.getSkinnedNormal();M_.assign(t),e.hasGeometryAttribute("tangent")&&Z_.assign(t)}}generate(e,t){if("void"!==t)return h_.build(e,t)}update(e){const t=(this.useReference?e.object:this.skinnedMesh).skeleton;gM.get(t)!==e.frameId&&(gM.set(t,e.frameId),null!==this.previousBoneMatricesNode&&t.previousBoneMatrices.set(t.boneMatrices),t.update())}}const yM=e=>Um(new vM(e,!0));class _M extends Zp{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt()+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const n={};for(let e=0,t=this.params.length-1;e<t;e++){const t=this.params[e],i=!0!==t.isNode&&t.name||this.getVarName(e),r=!0!==t.isNode&&t.type||"int";n[i]=Sy(i,r)}const i=e.addStack();return t.returnsNode=this.params[this.params.length-1](n,i,e),t.stackNode=i,e.removeStack(),t}getNodeType(e){const{returnsNode:t}=this.getProperties(e);return t?t.getNodeType(e):"void"}setup(e){this.getProperties(e)}generate(e){const t=this.getProperties(e),n=this.params,i=t.stackNode;for(let t=0,i=n.length-1;t<i;t++){const i=n[t];let r=null,s=null,a=null,o=null,l=null,c=null;i.isNode?(o="int",a=this.getVarName(t),r="0",s=i.build(e,o),l="<"):(o=i.type||"int",a=i.name||this.getVarName(t),r=i.start,s=i.end,l=i.condition,c=i.update,"number"==typeof r?r=r.toString():r&&r.isNode&&(r=r.build(e,o)),"number"==typeof s?s=s.toString():s&&s.isNode&&(s=s.build(e,o)),void 0!==r&&void 0===s?(r+=" - 1",s="0",l=">="):void 0!==s&&void 0===r&&(r="0",l="<"),void 0===l&&(l=Number(r)>Number(s)?">=":"<"));const u={start:r,end:s},h=u.start,d=u.end;let p="",m="",f="";c||(c="int"===o||"uint"===o?l.includes("<")?"++":"--":l.includes("<")?"+= 1.":"-= 1."),p+=e.getVar(o,a)+" = "+h,m+=a+" "+l+" "+d,f+=a+" "+c;const g=`for ( ${p}; ${m}; ${f} )`;e.addFlowCode((0===t?"\n":"")+e.tab+g+" {\n\n").addFlowTab()}const r=i.build(e,"void"),s=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode("\n"+e.tab+r);for(let t=0,n=this.params.length-1;t<n;t++)e.addFlowCode((0===t?"":e.tab)+"}\n\n").removeFlowTab();return e.addFlowTab(),s}}const xM=(...e)=>Um(new _M(Vm(e,"int"))).append(),MM=()=>Sy("break").append(),bM=new WeakMap,TM=new fn,SM=Bm(({bufferMap:e,influence:t,stride:n,width:i,depth:r,offset:s})=>{const a=qm(aM).mul(n).add(s),o=a.div(i),l=a.sub(o.mul(i));return Vy(e,Jm(l,o)).depth(r).mul(t)});class wM extends Zp{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Mf(1),this.updateType=Gp.OBJECT}setup(e){const{geometry:t}=e,n=void 0!==t.morphAttributes.position,i=t.hasAttribute("normal")&&void 0!==t.morphAttributes.normal,r=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,s=void 0!==r?r.length:0,{texture:a,stride:o,size:l}=function(e){const t=void 0!==e.morphAttributes.position,n=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=void 0!==r?r.length:0;let a=bM.get(e);if(void 0===a||a.count!==s){let r=function(){f.dispose(),bM.delete(e),e.removeEventListener("dispose",r)};void 0!==a&&a.texture.dispose();const o=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],c=e.morphAttributes.color||[];let u=0;!0===t&&(u=1),!0===n&&(u=2),!0===i&&(u=3);let h=e.attributes.position.count*u,d=1;const p=4096;h>p&&(d=Math.ceil(h/p),h=p);const m=new Float32Array(h*d*4*s),f=new yn(m,h,d,s);f.type=re,f.needsUpdate=!0;const g=4*u;for(let e=0;e<s;e++){const r=o[e],s=l[e],a=c[e],u=h*d*4*e;for(let e=0;e<r.count;e++){const o=e*g;!0===t&&(TM.fromBufferAttribute(r,e),m[u+o+0]=TM.x,m[u+o+1]=TM.y,m[u+o+2]=TM.z,m[u+o+3]=0),!0===n&&(TM.fromBufferAttribute(s,e),m[u+o+4]=TM.x,m[u+o+5]=TM.y,m[u+o+6]=TM.z,m[u+o+7]=0),!0===i&&(TM.fromBufferAttribute(a,e),m[u+o+8]=TM.x,m[u+o+9]=TM.y,m[u+o+10]=TM.z,m[u+o+11]=4===a.itemSize?TM.w:1)}}a={count:s,texture:f,stride:u,size:new Wt(h,d)},bM.set(e,a),e.addEventListener("dispose",r)}return a}(t);!0===n&&h_.mulAssign(this.morphBaseInfluence),!0===i&&M_.mulAssign(this.morphBaseInfluence);const c=qm(l.width);xM(s,({i:e})=>{const t=Xm(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(Vy(this.mesh.morphTexture,Jm(qm(e).add(1),qm(oM))).r):t.assign(W_("morphTargetInfluences","float").element
2(e).toVar()),!0===n&&h_.addAssign(SM({bufferMap:a,influence:t,stride:o,width:c,depth:e,offset:qm(0)})),!0===i&&M_.addAssign(SM({bufferMap:a,influence:t,stride:o,width:c,depth:e,offset:qm(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const NM=Fm(wM),EM=(e,t)=>{for(const n of t)if(n.isAnalyticLightNode&&n.light.id===e)return n;return null},AM=new WeakMap;class CM extends Zp{static get type(){return"LightsNode"}constructor(e=[]){super("vec3"),this.totalDiffuseNode=ef().toVar("totalDiffuse"),this.totalSpecularNode=ef().toVar("totalSpecular"),this.outgoingLightNode=ef().toVar("outgoingLight"),this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this.global=!0}getHash(e){if(null===this._lightNodesHash){null===this._lightNodes&&this.setupLightsNode(e);const t=[];for(const e of this._lightNodes)t.push(e.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getDataFromNode(this);for(const n of t.nodes)n.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,i=this._lights.sort((e,t)=>e.id-t.id),r=e.renderer.nodes.library;for(const e of i)if(e.isNode)t.push(Um(e));else{let i=null;if(null!==n&&(i=EM(e.id,n)),null===i){const n=r.getLightNodeClass(e.constructor);if(null===n){console.warn(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}let i=null;AM.has(e)?i=AM.get(e):(i=new n(e),AM.set(e,i)),t.push(i)}}this._lightNodes=t}setup(e){null===this._lightNodes&&this.setupLightsNode(e);const t=e.context,n=t.lightingModel;let i=this.outgoingLightNode;if(n){const{_lightNodes:r,totalDiffuseNode:s,totalSpecularNode:a}=this;t.outgoingLight=i;const o=e.addStack();e.getDataFromNode(this).nodes=o.nodes,n.start(t,o,e);for(const t of r)t.build(e);n.indirect(t,o,e);const{backdrop:l,backdropAlpha:c}=t,{directDiffuse:u,directSpecular:h,indirectDiffuse:d,indirectSpecular:p}=t.reflectedLight;let m=u.add(d);null!==l&&(m=ef(null!==c?c.mix(m,l):l),t.material.transparent=!0),s.assign(m),a.assign(h.add(p)),i.assign(s.add(a)),n.finish(t,o,e),i=i.bypass(e.removeStack())}return i}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}}const RM=Fm(CM);class IM extends Zp{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}generate(){console.warn("Abstract function.")}}class LM extends IM{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class PM extends Bv{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n={directDiffuse:ef().toVar("directDiffuse"),directSpecular:ef().toVar("directSpecular"),indirectDiffuse:ef().toVar("indirectDiffuse"),indirectSpecular:ef().toVar("indirectSpecular")};return{radiance:ef().toVar("radiance"),irradiance:ef().toVar("irradiance"),iblIrradiance:ef().toVar("iblIrradiance"),ambientOcclusion:Xm(1).toVar("ambientOcclusion"),reflectedLight:n,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const DM=Fm(PM);class UM extends IM{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let OM,VM;class FM extends Zp{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===FM.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=Gp.NONE;return(this.scope===FM.SIZE||this.scope===FM.VIEWPORT)&&(e=Gp.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===FM.VIEWPORT?null!==t?VM.copy(t.viewport):(e.getViewport(VM),VM.multiplyScalar(e.getPixelRatio())):null!==t?(OM.width=t.width,OM.height=t.height):e.getDrawingBufferSize(OM)}setup(){const e=this.scope;let t=null;return t=e===FM.SIZE?Mf(OM||(OM=new Wt)):e===FM.VIEWPORT?Mf(VM||(VM=new fn)):$m(kM.div(BM)),t}generate(e){if(this.scope===FM.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(BM).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}FM.COORDINATE="coordinate",FM.VIEWPORT="viewport",FM.SIZE="size",FM.UV="uv";const zM=zm(FM,FM.UV),BM=zm(FM,FM.SIZE),kM=zm(FM,FM.COORDINATE),HM=zm(FM,FM.VIEWPORT),GM=HM.zw,WM=kM.sub(HM.xy),jM=WM.div(GM),XM=Bm(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),BM),"vec2").once()(),qM=Bm(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),zM),"vec2").once()(),YM=Bm(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),zM.flipY()),"vec2").once()(),ZM=new Wt;class $M extends Uy{static get type(){return"ViewportTextureNode"}constructor(e=zM,t=null,n=null){null===n&&((n=new wc).minFilter=J),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=Gp.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(ZM);const n=this.value;(n.image.width!==ZM.width||n.image.height!==ZM.height)&&(n.image.width=ZM.width,n.image.height=ZM.height,n.needsUpdate=!0);const i=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=i}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}
2const JM=Fm($M),KM=Fm($M,null,null,{generateMipmaps:!0});let QM=null;class eb extends $M{static get type(){return"ViewportDepthTextureNode"}constructor(e=zM,t=null){null===QM&&(QM=new Os),super(e,t,QM)}}const tb=Fm(eb);class nb extends Zp{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===nb.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===nb.DEPTH_BASE)null!==n&&(i=ab().assign(n));else if(t===nb.DEPTH)i=e.isPerspectiveCamera?rb(f_.z,Fy,zy):ib(f_.z,Fy,zy);else if(t===nb.LINEAR_DEPTH)if(null!==n)if(e.isPerspectiveCamera){const e=sb(n,Fy,zy);i=ib(e,Fy,zy)}else i=n;else i=ib(f_.z,Fy,zy);return i}}nb.DEPTH_BASE="depthBase",nb.DEPTH="depth",nb.LINEAR_DEPTH="linearDepth";const ib=(e,t,n)=>e.add(t).div(t.sub(n)),rb=(e,t,n)=>t.add(e).mul(n).div(n.sub(t).mul(e)),sb=(e,t,n)=>t.mul(n).div(n.sub(t).mul(e).sub(n)),ab=Fm(nb,nb.DEPTH_BASE),ob=zm(nb,nb.DEPTH),lb=Fm(nb,nb.LINEAR_DEPTH),cb=lb(tb());ob.assign=e=>ab(e);class ub extends Zp{static get type(){return"ClippingNode"}constructor(e=ub.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{localClipIntersection:n,localClippingCount:i,globalClippingCount:r}=t,s=r+i,a=n?s-i:s;return this.scope===ub.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(t.planes,s,a):this.setupDefault(t.planes,s,a)}setupAlphaToCoverage(e,t,n){return Bm(()=>{const i=k_(e),r=Tf("float","distanceToPlane"),s=Tf("float","distanceToGradient"),a=Tf("float","clipOpacity");let o;if(a.assign(1),xM(n,({i:e})=>{o=i.element(e),r.assign(f_.dot(o.xyz).negate().add(o.w)),s.assign(r.fwidth().div(2)),a.mulAssign(Lv(s.negate(),s,r)),a.equal(0).discard()}),n<t){const e=Tf("float","unionclipOpacity");e.assign(1),xM({start:n,end:t},({i:t})=>{o=i.element(t),r.assign(f_.dot(o.xyz).negate().add(o.w)),s.assign(r.fwidth().div(2)),e.mulAssign(Lv(s.negate(),s,r).oneMinus())}),a.mulAssign(e.oneMinus())}wf.a.mulAssign(a),wf.a.equal(0).discard()})()}setupDefault(e,t,n){return Bm(()=>{const i=k_(e);let r;if(xM(n,({i:e})=>{r=i.element(e),f_.dot(r.xyz).greaterThan(r.w).discard()}),n<t){const e=Tf("bool","clipped");e.assign(!0),xM({start:n,end:t},({i:t})=>{r=i.element(t),e.assign(f_.dot(r.xyz).greaterThan(r.w).and(e))}),e.discard()}})()}}ub.ALPHA_TO_COVERAGE="alphaToCoverage",ub.DEFAULT="default";class hb extends Xi{static get type(){return"NodeMaterial"}constructor(){super(),this.isNodeMaterial=!0,this.type=this.constructor.type,this.forceSinglePass=!1,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.depthNode=null,this.shadowNode=null,this.shadowPositionNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+Up(this)}build(e){this.setup(e)}setupObserver(e){return new Rp(e)}setup(e){let t;e.context.setupNormal=()=>this.setupNormal(e),e.addStack(),e.stack.outputNode=this.vertexNode||this.setupPosition(e),e.addFlow("vertex",e.removeStack()),e.addStack();const n=this.setupClipping(e);if(!0===this.depthWrite&&this.setupDepth(e),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const i=this.setupLighting(e);null!==n&&e.stack.add(n);const r=sf(i,wf.a).max(0);if(t=this.setupOutput(e,r),Gf.assign(t),null!==this.outputNode&&(t=this.outputNode),null!==e.renderer.getRenderTarget()){const n=e.renderer.getMRT(),i=this.mrtNode;null!==n?(t=n,null!==i&&(t=n.merge(i))):null!==i&&(t=i)}}else{let n=this.fragmentNode;!0!==n.isOutputStructNode&&(n=sf(n)),t=this.setupOutput(e,n)}e.stack.outputNode=t,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{globalClippingCount:t,localClippingCount:n}=e.clippingContext;let i=null;if(t||n){const t=e.renderer.samples;this.alphaToCoverage&&t>1?i=Um(new ub(ub.ALPHA_TO_COVERAGE)):e.stack.add(Um(new ub))}return i}setupDepth(e){const{renderer:t}=e;let n=this.depthNode;if(null===n){const e="getMRT"in t&&t.getMRT();e&&e.has("depth")?n=e.get("depth"):!0===t.logarithmicDepthBuffer&&(n=rM().w.add(1).log2().mul(By).mul(.5))}null!==n&&ob.assign(n).append()}setupPosition(e){const{object:t}=e,n=t.geometry;if(e.addStack(),(n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&NM(t).append(),!0===t.isSkinnedMesh&&yM(t).append(),this.displacementMap){const e=q_("displacementMap","texture"),t=q_("displacementScale","float"),n=q_("displacementBias","float");h_.addAssign(M_.normalize().mul(e.x.mul(t).add(n)))}t.isBatchedMesh&&fM(t).append(),t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&pM(t).append(),null!==this.positionNode&&h_.assign(this.positionNode);const i=rM();return e.context.vertex=e.removeStack(),e.context.mvp=i,i}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?sf(this.colorNode):xx;!0===this.vertexColors&&t.hasAttribute("color")&&(n=sf(n.xyz.mul(Cy("color","vec3")),n.a)),e.instanceColor&&(n=Sf("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Sf("vec3","vBatchColor").mul(n)),wf.assign(n);const i=this.opacityNode?Xm(this.opacityNode):Tx;if(wf.a.assign(wf.a.mul(i)),null!==this.alphaTestNode||this.alphaTest>0){const e=null!==this.alphaTestNode?Xm(this.alphaTestNode):_x;wf.a.lessThanEqual(e).discard()}!1===this.transparent&&1===this.blending&&!1===this.alphaToCoverage&&wf.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?ef(0):wf.rgb}setupNormal(){return this.normalNode?ef(this.normalNode):Ix}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?q_("envMap","cubeTexture"):q_("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new UM(eM)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);if(i&&i.isLightingNode&&t.push(i),null!==this.aoNode||e.material.aoMap){const e=null!==this.aoNode?this.aoNode:tM;t.push(new LM(e))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=RM([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:r}=this,s=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(s&&s.getScope().getLights().length>0){const t=this.setupLightingModel(e);a=DM(s,t,n,i)}else null!==n&&(a=ef(null!==i?Av(a,n,i):n));return(r&&!0===r.isNode||t.emissive&&!0===t.emissive.isColor)&&(Nf.assign(ef(r||bx)),a=a.add(Nf)),a}setupOutput(e,t){if(!0===this.fog){const n=e.fogNode;n&&(t=sf(n.mix(t.rgb,n.colorNode),t.a))}return t}setDefaultValues(e){for(const t in e){const n=e[t];void 0===this[t]&&(this[t]=n,n&&n.clone&&(this[t]=n.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const n=Xi.prototype.toJSON.call(this,e),i=Op(this);n.inputNodes={};for(const{property:t,childNode:r}of i)n.inputNodes[t]=r.toJSON(e).uuid;function r(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(t){const t=r(e.textures),i=r(e.images),s=r(e.nodes);t.length>0&&(n.textures=t),i.length>0&&(n.images=i),s.length>0&&(n.nodes=s)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.depthNode=e.depthNode,this.shadowNode=e.shadowNode,this.shadowPositionNode=e.shadowPositionNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const db=new vc;const pb=new ic;const mb=new lh;const fb=new lh;const gb=e=>Um(e).mul(.5).add(.5),vb=new sh;class yb extends Kp{static get type(){return"EquirectUVNode"}constructor(e=m_){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan2(e.x).mul(1/(2*Math.PI)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return $m(t,n)}}const _b=Fm(yb);class xb extends kr{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace
vendor: 4,917 bytes, line 2
2=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r=new Er(5,5,5),s=_b(m_),a=new hb;a.colorNode=Oy(t,s,0),a.side=1,a.blending=0;const o=new wr(r,a),l=new jo;l.add(o),t.minFilter===J&&(t.minFilter=Z);const c=new zr(1,10,this),u=e.getMRT();return e.setMRT(null),c.update(e,l),e.setMRT(u),t.minFilter=n,t.currentGenerateMipmaps=i,o.geometry.dispose(),o.material.dispose(),this}}const Mb=new WeakMap;class bb extends Kp{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=O_();const t=new Br;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=Gp.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const e=i.isTextureNode?i.value:n[i.property];if(e&&e.isTexture){const n=e.mapping;if(n===B||n===k){if(Mb.has(e)){const t=Mb.get(e);Sb(t,e.mapping),this._cubeTexture=t}else{const n=e.image;if(null!=(r=n)&&r.height>0){const i=new xb(n.height);i.fromEquirectangularTexture(t,e),Sb(i.texture,e.mapping),this._cubeTexture=i.texture,Mb.set(e,i.texture),e.addEventListener("dispose",Tb)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}var r}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function Tb(e){const t=e.target;t.removeEventListener("dispose",Tb);const n=Mb.get(t);void 0!==n&&(Mb.delete(t),n.dispose())}function Sb(e,t){t===B?e.mapping=F:t===k&&(e.mapping=z)}const wb=Fm(bb);class Nb extends IM{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=wb(this.envNode)}}class Eb extends IM{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=Xm(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Ab{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Cb extends Ab{constructor(){super()}indirect(e,t,n){const i=e.ambientOcclusion,r=e.reflectedLight,s=n.context.irradianceLightMap;r.indirectDiffuse.assign(sf(0)),s?r.indirectDiffuse.addAssign(s):r.indirectDiffuse.addAssign(sf(1,1,1,0)),r.indirectDiffuse.mulAssign(i),r.indirectDiffuse.mulAssign(wf.rgb)}finish(e,t,n){const i=n.material,r=e.outgoingLight,s=n.context.environment;if(s)switch(i.combine){case 0:r.rgb.assign(Av(r.rgb,r.rgb.mul(s.rgb),Ex.mul(Ax)));break;case 1:r.rgb.assign(Av(r.rgb,s.rgb,Ex.mul(Ax)));break;case 2:r.rgb.addAssign(s.rgb.mul(Ex.mul(Ax)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",i.combine)}}}const Rb=new qi;const Ib=Bm(({f0:e,f90:t,dotVH:n})=>{const i=n.mul(-5.55473).sub(6.98316).mul(n).exp2();return e.mul(i.oneMinus()).add(t.mul(i))}),Lb=Bm(e=>e.diffuseColor.mul(1/Math.PI)),Pb=Bm(({dotNH:e})=>Hf.mul(Xm(.5)).add(1).mul(Xm(1/Math.PI)).mul(e.pow(Hf))),Db=Bm(({lightDirection:e})=>{const t=e.add(g_).normalize(),n=w_.dot(t).clamp(),i=g_.dot(t).clamp(),r=Ib({f0:Bf,f90:1,dotVH:i}),s=Xm(.25),a=Pb({dotNH:n});return r.mul(s).mul(a)});class Ub extends Cb{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const i=w_.dot(e).clamp().mul(t);n.directDiffuse.addAssign(i.mul(Lb({diffuseColor:wf.rgb}))),!0===this.specular&&n.directSpecular.addAssign(i.mul(Db({lightDirection:e})).mul(Ex))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(Lb({diffuseColor:wf}))),n.indirectDiffuse.mulAssign(e)}}const Ob=new ah;const Vb=new ih;const Fb=Bm(()=>{const e=T_.dFdx().abs().max(T_.dFdy().abs());return e.x.max(e.y).max(e.z)}),zb=Bm(e=>{const{roughness:t}=e,n=Fb();let i=t.max(.0525);return i=i.add(n),i=i.min(1),i}),Bb=Bm(({alpha:e,dotNL:t,dotNV:n})=>{const i=e.pow2(),r=t.mul(i.add(i.oneMinus().mul(n.pow2())).sqrt()),s=n.mul(i.add(i.oneMinus().mul(t.pow2())).sqrt());return og(.5,r.add(s).max(Eg))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),kb=Bm(({alphaT:e,alphaB:t,dotTV:n,dotBV:i,dotTL:r,dotBL:s,dotNV:a,dotNL:o})=>{const l=o.mul(ef(e.mul(n),t.mul(i),a).length()),c=a.mul(ef(e.mul(r),t.mul(s),o).length());return og(.5,l.add(c)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),Hb=Bm(({alpha:e,dotNH:t})=>{const n=e.pow2(),i=t.pow2().mul(n.oneMinus()).oneMinus();return n.div(i.pow2()).mul(1/Math.PI)}
2).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),Gb=Xm(1/Math.PI),Wb=Bm(({alphaT:e,alphaB:t,dotNH:n,dotTH:i,dotBH:r})=>{const s=e.mul(t),a=ef(t.mul(i),e.mul(r),s.mul(n)),o=a.dot(a),l=s.div(o);return Gb.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),jb=Bm(e=>{const{lightDirection:t,f0:n,f90:i,roughness:r,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:o}=e,l=e.normalView||w_,c=r.pow2(),u=t.add(g_).normalize(),h=l.dot(t).clamp(),d=l.dot(g_).clamp(),p=l.dot(u).clamp(),m=g_.dot(u).clamp();let f,g,v=Ib({f0:n,f90:i,dotVH:m});if(Lm(a)&&(v=Pf.mix(v,s)),Lm(o)){const e=Ff.dot(t),n=Ff.dot(g_),i=Ff.dot(u),r=zf.dot(t),s=zf.dot(g_),a=zf.dot(u);f=kb({alphaT:Of,alphaB:c,dotTV:n,dotBV:s,dotTL:e,dotBL:r,dotNV:d,dotNL:h}),g=Wb({alphaT:Of,alphaB:c,dotNH:p,dotTH:i,dotBH:a})}else f=Bb({alpha:c,dotNL:h,dotNV:d}),g=Hb({alpha:c,dotNH:p});return v.mul(f).mul(g)}),Xb=Bm(({roughness:e,dotNV:t})=>{const n=sf(-1,-.0275,-.572,.022),i=sf(1,.0425,1.04,-.04),r=e.mul(n).add(i),s=r.x.mul(r.x).min(t.mul(-9.28).exp2()).mul(r.x).add(r.y);return $m(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),qb=Bm(e=>{const{dotNV:t,specularColor:n,specularF90:i,roughness:r}=e,s=Xb({dotNV:t,roughness:r});return n.mul(s.x).add(i.mul(s.y))}),Yb=Bm(({f:e,f90:t,dotVH:n})=>{const i=n.oneMinus().saturate(),r=i.mul(i),s=i.mul(r,r).clamp(0,.9999);return e.sub(ef(t).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),Zb=Bm(({roughness:e,dotNH:t})=>{const n=e.pow2(),i=Xm(1).div(n),r=t.pow2().oneMinus().max(.0078125);return Xm(2).add(i).mul(r.pow(i.mul(.5))).div(2*Math.PI)}
vendor: 4,174 bytes, line 2
2).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),$b=Bm(({dotNV:e,dotNL:t})=>Xm(1).div(Xm(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),Jb=Bm(({lightDirection:e})=>{const t=e.add(g_).normalize(),n=w_.dot(e).clamp(),i=w_.dot(g_).clamp(),r=w_.dot(t).clamp(),s=Zb({roughness:Lf,dotNH:r}),a=$b({dotNV:i,dotNL:n});return If.mul(s).mul(a)}),Kb=Bm(({N:e,V:t,roughness:n})=>{const i=e.dot(t).saturate(),r=$m(n,i.oneMinus().sqrt());return r.assign(r.mul(.984375).add(.0078125)),r}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),Qb=Bm(({f:e})=>{const t=e.length();return pv(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),eT=Bm(({v1:e,v2:t})=>{const n=e.dot(t),i=n.abs().toVar(),r=i.mul(.0145206).add(.4965155).mul(i).add(.8543985).toVar(),s=i.add(4.1616724).mul(i).add(3.417594).toVar(),a=r.div(s),o=n.greaterThan(0).select(a,pv(n.mul(n).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),tT=Bm(({N:e,V:t,P:n,mInv:i,p0:r,p1:s,p2:a,p3:o})=>{const l=s.sub(r).toVar(),c=o.sub(r).toVar(),u=l.cross(c),h=ef().toVar();return Gm(u.dot(n.sub(r)).greaterThanEqual(0),()=>{const l=t.sub(e.mul(t.dot(e))).normalize(),c=e.cross(l).negate(),u=i.mul(uf(l,c,e).transpose()).toVar(),d=u.mul(r.sub(n)).normalize().toVar(),p=u.mul(s.sub(n)).normalize().toVar(),m=u.mul(a.sub(n)).normalize().toVar(),f=u.mul(o.sub(n)).normalize().toVar(),g=ef(0).toVar();g.addAssign(eT({v1:d,v2:p})),g.addAssign(eT({v1:p,v2:m})),g.addAssign(eT({v1:m,v2:f})),g.addAssign(eT({v1:f,v2:d})),h.assign(ef(Qb({f:g})))}),h}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),nT=1/6,iT=e=>ag(nT,ag(e,ag(e,e.negate().add(3)).sub(3)).add(1)),rT=e=>ag(nT,ag(e,ag(e,ag(3,e).sub(6))).add(4)),sT=e=>ag(nT,ag(e,ag(e,ag(-3,e).add(3)).add(3)).add(1)),aT=e=>ag(nT,Mv(e,3)),oT=e=>iT(e).add(rT(e)),lT=e=>sT(e).add(aT(e)),cT=e=>rg(-1,rT(e).div(iT(e).add(rT(e)))),uT=e=>rg(1,aT(e).div(sT(e).add(aT(e)))),hT=(e,t,n)=>{const i=e.uvNode,r=ag(i,t.zw).add(.5),s=Hg(r),a=jg(r),o=oT(a.x),l=lT(a.x),c=cT(a.x),u=uT(a.x),h=cT(a.y),d=uT(a.y),p=$m(s.x.add(c),s.y.add(h)).sub(.5).mul(t.xy),m=$m(s.x.add(u),s.y.add(h)).sub(.5).mul(t.xy),f=$m(s.x.add(c),s.y.add(d)).sub(.5).mul(t.xy),g=$m(s.x.add(u),s.y.add(d)).sub(.5).mul(t.xy),v=oT(a.y).mul(rg(o.mul(e.uv(p).level(n)),l.mul(e.uv(m).level(n)))),y=lT(a.y).mul(rg(o.mul(e.uv(f).level(n)),l.mul(e.uv(g).level(n))));return v.add(y)},dT=Bm(([e,t=Xm(3)])=>{const n=$m(e.size(qm(t))),i=$m(e.size(qm(t.add(1)))),r=og(1,n),s=og(1,i),a=hT(e,sf(r,n),Hg(t)),o=hT(e,sf(s,i),Gg(t));return jg(t).mix(a,o)}),pT=Bm(([e,t,n,i,r])=>{const s=ef(Iv(t.negate(),Wg(e),og(1,i))),a=ef(ev(r[0].xyz),ev(r[1].xyz),ev(r[2].xyz));return Wg(s).mul(n.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),mT=Bm(([e,t])=>e.mul(Cv(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),fT=KM(),gT=Bm(([e,t,n])=>{const i=fT.uv(e),r=zg(Xm(BM.x)).mul(mT(t,n));return dT(i,r)}),vT=Bm(([e,t,n])=>(Gm(n.notEqual(0),()=>{const i=Fg(t).negate().div(n);return Og(i.negate().mul(e))}),ef(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),yT=Bm(([e,t,n,i,r,s,a,o,l,c,u,h,d,p,m])=>{let f,g;if(m){f=sf().toVar(),g=ef().toVar();const r=u.sub(1).mul(m.mul(.025)),s=ef(u.sub(r),u,u.add(r));xM({start:0,end:3},({i:r})=>
vendor: 13,135 bytes, line 2
2{const u=s.element(r),m=pT(e,t,h,u,o),v=a.add(m),y=c.mul(l.mul(sf(v,1))),_=$m(y.xy.div(y.w)).toVar();_.addAssign(1),_.divAssign(2),_.assign($m(_.x,_.y.oneMinus()));const x=gT(_,n,u);f.element(r).assign(x.element(r)),f.a.addAssign(x.a),g.element(r).assign(i.element(r).mul(vT(ev(m),d,p).element(r)))}),f.a.divAssign(3)}else{const r=pT(e,t,h,u,o),s=a.add(r),m=c.mul(l.mul(sf(s,1))),v=$m(m.xy.div(m.w)).toVar();v.addAssign(1),v.divAssign(2),v.assign($m(v.x,v.y.oneMinus())),f=gT(v,n,u),g=i.mul(vT(ev(r),d,p))}const v=g.rgb.mul(f.rgb),y=e.dot(t).clamp(),_=ef(qb({dotNV:y,specularColor:r,specularF90:s,roughness:n})),x=g.r.add(g.g,g.b).div(3);return sf(_.oneMinus().mul(v),f.a.oneMinus().mul(x).oneMinus())}),_T=uf(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),xT=(e,t)=>e.sub(t).div(e.add(t)).pow2(),MT=(e,t)=>{const n=e.mul(2*Math.PI*1e-9),i=ef(54856e-17,44201e-17,52481e-17),r=ef(1681e3,1795300,2208400),s=ef(43278e5,93046e5,66121e5),a=Xm(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(n.mul(2239900).add(t.x).cos()).mul(n.pow2().mul(-45282e5).exp());let o=i.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(n).add(t).cos()).mul(n.pow2().negate().mul(s).exp());return o=ef(o.x.add(a),o.y,o.z).div(1.0685e-7),_T.mul(o)},bT=Bm(({outsideIOR:e,eta2:t,cosTheta1:n,thinFilmThickness:i,baseF0:r})=>{const s=Av(e,t,Lv(0,.03,i)),a=e.div(s).pow2().mul(Xm(1).sub(n.pow2())),o=Xm(1).sub(a).sqrt(),l=xT(s,e),c=Ib({f0:l,f90:1,dotVH:n}),u=c.oneMinus(),h=s.lessThan(e).select(Math.PI,0),d=Xm(Math.PI).sub(h),p=(e=>{const t=e.sqrt();return ef(1).add(t).div(ef(1).sub(t))})(r.clamp(0,.9999)),m=xT(p,s.toVec3()),f=Ib({f0:m,f90:1,dotVH:o}),g=ef(p.x.lessThan(s).select(Math.PI,0),p.y.lessThan(s).select(Math.PI,0),p.z.lessThan(s).select(Math.PI,0)),v=s.mul(i,o,2),y=ef(d).add(g),_=c.mul(f).clamp(1e-5,.9999),x=_.sqrt(),M=u.pow2().mul(f).div(ef(1).sub(_));let b=c.add(M),T=M.sub(u);for(let e=1;e<=2;++e){T=T.mul(x);const t=MT(Xm(e).mul(v),Xm(e).mul(y)).mul(2);b=b.add(T.mul(t))}return b.max(ef(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),TT=Bm(({normal:e,viewDir:t,roughness:n})=>{const i=e.dot(t).saturate(),r=n.pow2(),s=Fv(n.lessThan(.25),Xm(-339.2).mul(r).add(Xm(161.4).mul(n)).sub(25.9),Xm(-8.48).mul(r).add(Xm(14.3).mul(n)).sub(9.95)),a=Fv(n.lessThan(.25),Xm(44).mul(r).sub(Xm(23.7).mul(n)).add(3.26),Xm(1.97).mul(r).sub(Xm(3.27).mul(n)).add(.72));return Fv(n.lessThan(.25),0,Xm(.1).mul(n).sub(.025)).add(s.mul(i).add(a).exp()).mul(1/Math.PI).saturate()}),ST=ef(.04),wT=Xm(1);class NT extends Ab{constructor(e=!1,t=!1,n=!1,i=!1,r=!1,s=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=r,this.dispersion=s,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=ef().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=ef().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=ef().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=ef().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=ef().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=w_.dot(g_).clamp();this.iridescenceFresnel=bT({outsideIOR:Xm(1),eta2:Df,cosTheta1:e,thinFilmThickness:Uf,baseF0:Bf}),this.iridescenceF0=Yb({f:this.iridescenceFresnel,f90:1,dotVH:e})}if(!0===this.transmission){const t=p_,n=Xy.sub(p_).normalize(),i=N_;e.backdrop=yT(i,n,Ef,wf,Bf,kf,t,t_,Gy,ky,qf,Zf,Jf,$f,this.dispersion?Kf:null),e.backdropAlpha=Yf,wf.a.mulAssign(Av(1,e.backdrop.a,Yf))}}computeMultiscattering(e,t,n){const i=w_.dot(g_).clamp(),r=Xb({roughness:Ef,dotNV:i}),s=(this.iridescenceF0?Pf.mix(Bf,this.iridescenceF0):Bf).mul(r.x).add(n.mul(r.y)),a=r.x.add(r.y).oneMinus(),o=Bf.add(Bf.oneMinus().mul(.047619)),l=s.mul(o).div(a.mul(o).oneMinus());e.addAssign(s),t.addAssign(l.mul(a))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const i=w_.dot(e).clamp().mul(t);if(!0===this.sheen&&this.sheenSpecularDirect.addAssign(i.mul(Jb({lightDirection:e}))),!0===this.clearcoat){const n=E_.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(n.mul(jb({lightDirection:e,f0:ST,f90:wT,roughness:Rf,normalView:E_})))}n.directDiffuse.addAssign(i.mul(Lb({diffuseColor:wf.rgb}))),n.directSpecular.addAssign(i.mul(jb({lightDirection:e,f0:Bf,f90:1,roughness:Ef,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:r,ltc_1:s,ltc_2:a}){const o=t.add(n).sub(i),l=t.sub(n).sub(i),c=t.sub(n).add(i),u=t.add(n).add(i),h=w_,d=g_,p=f_.toVar(),m=Kb({N:h,V:d,roughness:Ef}),f=s.uv(m).toVar(),g=a.uv(m).toVar(),v=uf(ef(f.x,0,f.y),ef(0,1,0),ef(f.z,0,f.w)).toVar(),y=Bf.mul(g.x).add(Bf.oneMinus().mul(g.y)).toVar();r.directSpecular.addAssign(e.mul(y).mul(tT({N:h,V:d,P:p,mInv:v,p0:o,p1:l,p2:c,p3:u}))),r.directDiffuse.addAssign(e.mul(wf).mul(tT({N:h,V:d,P:p,mInv:uf(1,0,0,0,1,0,0,0,1),p0:o,p1:l,p2:c,p3:u})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(Lb({diffuseColor:wf})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(t.mul(If,TT({normal:w_,viewDir:g_,roughness:Lf}))),!0===this.clearcoat){const e=E_.dot(g_).clamp(),t=qb({dotNV:e,specularColor:ST,specularF90:wT,roughness:Rf});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=ef().toVar("singleScattering"),r=ef().toVar("multiScattering"),s=t.mul(1/Math.PI);this.computeMultiscattering(i,r,kf);const a=i.add(r),o=wf.mul(a.r.max(a.g).max(a.b).oneMinus());n.indirectSpecular.addAssign(e.mul(i)),n.indirectSpecular.addAssign(r.mul(s)),n.indirectDiffuse.addAssign(o.mul(s))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const n=w_.dot(g_).clamp().add(e),i=Ef.mul(-16).oneMinus().negate().exp2(),r=e.sub(n.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(e),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(r)}finish(e){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=E_.dot(g_).clamp(),n=Ib({dotVH:e,f0:ST,f90:wT}),i=t.mul(Cf.mul(n).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(Cf));t.assign(i)}if(!0===this.sheen){const e=If.r.max(If.g).max(If.b).mul(.157).oneMinus(),n=t.mul(e).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(n)}}}const ET=Xm(1),AT=Xm(-2),CT=Xm(.8),RT=Xm(-1),IT=Xm(.4),LT=Xm(2),PT=Xm(.305),DT=Xm(3),UT=Xm(.21),OT=Xm(4),VT=Xm(4),FT=Xm(16),zT=Bm(([e])=>{const t=ef(Kg(e)).toVar(),n=Xm(-1).toVar();return Gm(t.x.greaterThan(t.z),()=>{Gm(t.x.greaterThan(t.y),()=>{n.assign(Fv(e.x.greaterThan(0),0,3))}).Else(()=>{n.assign(Fv(e.y.greaterThan(0),1,4))})}).Else(()=>{Gm(t.z.greaterThan(t.y),()=>{n.assign(Fv(e.z.greaterThan(0),2,5))}).Else(()=>{n.assign(Fv(e.y.greaterThan(0),1,4))})}),n}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),BT=Bm(([e,t])=>{const n=$m().toVar();return Gm(t.equal(0),()=>{n.assign($m(e.z,e.y).div(Kg(e.x)))}).ElseIf(t.equal(1),()=>{n.assign($m(e.x.negate(),e.z.negate()).div(Kg(e.y)))}).ElseIf(t.equal(2),()=>{n.assign($m(e.x.negate(),e.y).div(Kg(e.z)))}).ElseIf(t.equal(3),()=>{n.assign($m(e.z.negate(),e.y).div(Kg(e.x)))}).ElseIf(t.equal(4),()=>{n.assign($m(e.x.negate(),e.z).div(Kg(e.y)))}).Else(()=>{n.assign($m(e.x,e.y).div(Kg(e.z)))}),ag(.5,n.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),kT=Bm(([e])=>{const t=Xm(0).toVar();return Gm(e.greaterThanEqual(CT),()=>{t.assign(ET.sub(e).mul(RT.sub(AT)).div(ET.sub(CT)).add(AT))}).ElseIf(e.greaterThanEqual(IT),()=>{t.assign(CT.sub(e).mul(LT.sub(RT)).div(CT.sub(IT)).add(RT))}).ElseIf(e.greaterThanEqual(PT),()=>{t.assign(IT.sub(e).mul(DT.sub(LT)).div(IT.sub(PT)).add(LT))}).ElseIf(e.greaterThanEqual(UT),()=>{t.assign(PT.sub(e).mul(OT.sub(DT)).div(PT.sub(UT)).add(DT))}).Else(()=>{t.assign(Xm(-2).mul(zg(ag(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),HT=Bm(([e,t])=>{const n=e.toVar();n.assign(ag(2,n).sub(1));const i=ef(n,1).toVar();return Gm(t.equal(0),()=>{i.assign(i.zyx)}).ElseIf(t.equal(1),()=>{i.assign(i.xzy),i.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{i.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{i.assign(i.zyx),i.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{i.assign(i.xzy),i.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{i.z.mulAssign(-1)}),i}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),GT=Bm(([e,t,n,i,r,s])=>{const a=Xm(n),o=ef(t),l=Cv(kT(a),AT,s),c=jg(l),u=Hg(l),h=ef(WT(e,o,u,i,r,s)).toVar();return Gm(c.notEqual(0),()=>{const t=ef(WT(e,o,u.add(1),i,r,s)).toVar();h.assign(Av(h,t,c))}),h}),WT=Bm(([e,t,n,i,r,s])=>{const a=Xm(n).toVar(),o=ef(t),l=Xm(zT(o)).toVar(),c=Xm(pv(VT.sub(a),0)).toVar();a.assign(pv(a,VT));const u=Xm(Vg(a)).toVar(),h=$m(BT(o,l).mul(u.sub(2)).add(1)).toVar();return Gm(l.greaterThan(2),()=>{h.y.addAssign(u),l.subAssign(3)}),h.x.addAssign(l.mul(u)),h.x.addAssign(c.mul(ag(3,FT))),h.y.addAssign(ag(4,Vg(s).sub(u))),h.x.mulAssign(i),h.y.mulAssign(r),e.uv(h).grad($m(),$m())}),jT=Bm(({envMap:e,mipInt:t,outputDirection:n,theta:i,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const l=qg(i),c=n.mul(l).add(r.cross(n).mul(Xg(i))).add(r.mul(r.dot(n).mul(l.oneMinus())));return WT(e,c,t,s,a,o)}),XT=Bm(({n:e,latitudinal:t,poleAxis:n,outputDirection:i,weights:r,samples:s,dTheta:a,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})=>{const d=ef(Fv(t,n,xv(n,i))).toVar();Gm(Ig(d.equals(ef(0))),()=>{d.assign(ef(i.z,0,i.x.negate()))}),d.assign(Wg(d));const p=ef().toVar();return p.addAssign(r.element(qm(0)).mul(jT({theta:0,axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),xM({start:qm(1),end:e},({i:e})=>{Gm(e.greaterThanEqual(s),()=>{MM()});const t=Xm(a.mul(Xm(e))).toVar();p.addAssign(r.element(e).mul(jT({theta:t.mul(-1),axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),p.addAssign(r.element(e).mul(jT({theta:t,axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})))}),sf(p,1)});let qT=null;const YT=new WeakMap;class ZT extends Kp{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const i=new mn;i.isRenderTargetTexture=!0,this._texture=Oy(i),this._width=Mf(0),this._height=Mf(0),this._maxMip=Mf(0),this.updateBeforeType=Gp.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(e=!0===n.isPMREMTexture?n:function(e){let t=YT.get(e);if((void 0!==t?t.pmremVersion:-1)!==e.pmremVersion){const n=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const n=6;for(let i=0;i<n;i++)void 0!==e[i]&&t++;return t===n}(n))return null;t=qT.fromCubemap(e,t)}else{if(!function(e){return null!=e&&e.height>0}(n))return null;t=qT.fromEquirectangular(e,t)}t.pmremVersion=e.pmremVersion,YT.set(e,t)}return t.texture}(n),null!==e&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){null===qT&&(qT=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Rt&&!0!==n.isPMREMTexture&&!0===n.isRenderTargetTexture&&(t=ef(t.x.negate(),t.yz));let i=this.levelNode;return null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),GT(this._texture,t,i,this._width,this._height,this._maxMip)}}const $T=Fm(ZT),JT=new WeakMap;class KT extends IM{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const e=n.isTextureNode?n.value:t[n.property];let i=JT.get(e);void 0===i&&(i=$T(e),JT.set(e,i)),n=i}const i=t.envMap?W_("envMapIntensity","float",e.material):W_("environmentIntensity","float",e.scene),r=!0===t.useAnisotropy||t.anisotropy>0?cx:w_,s=n.context(QT(Ef,r)).mul(i),a=n.context(eS(N_)).mul(Math.PI).mul(i),o=vy(s),l=vy(a);
vendor: 4,871 bytes, line 2
2e.context.radiance.addAssign(o),e.context.iblIrradiance.addAssign(l);const c=e.context.lightingModel.clearcoatRadiance;if(c){const e=n.context(QT(Rf,E_)).mul(i),t=vy(e);c.addAssign(t)}}}const QT=(e,t)=>{let n=null;return{getUV:()=>(null===n&&(n=g_.negate().reflect(t),n=e.mul(e).mix(n,t).normalize(),n=n.transformDirection(Gy)),n),getTextureLevel:()=>e}},eS=e=>({getUV:()=>e,getTextureLevel:()=>Xm(1)}),tS=new th;class nS extends hb{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(tS),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new KT(t):null}setupLightingModel(){return new NT}setupSpecular(){const e=Av(ef(.04),wf.rgb,Af);Bf.assign(e),kf.assign(1)}setupVariants(){const e=this.metalnessNode?Xm(this.metalnessNode):Rx;Af.assign(e);let t=this.roughnessNode?Xm(this.roughnessNode):Cx;t=zb({roughness:t}),Ef.assign(t),this.setupSpecular(),wf.assign(sf(wf.rgb.mul(e.oneMinus()),wf.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const iS=new nh;class rS extends nS{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(iS),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?Xm(this.iorNode):Wx;qf.assign(e),Bf.assign(Av(dv(bv(qf.sub(1).div(qf.add(1))).mul(Nx),ef(1)).mul(wx),wf.rgb,Af)),kf.assign(Av(wx,1,Af))}setupLightingModel(){return new NT(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?Xm(this.clearcoatNode):Lx,t=this.clearcoatRoughnessNode?Xm(this.clearcoatRoughnessNode):Px;Cf.assign(e),Rf.assign(zb({roughness:t}))}if(this.useSheen){const e=this.sheenNode?ef(this.sheenNode):Ox,t=this.sheenRoughnessNode?Xm(this.sheenRoughnessNode):Vx;If.assign(e),Lf.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?Xm(this.iridescenceNode):zx,t=this.iridescenceIORNode?Xm(this.iridescenceIORNode):Bx,n=this.iridescenceThicknessNode?Xm(this.iridescenceThicknessNode):kx;Pf.assign(e),Df.assign(t),Uf.assign(n)}if(this.useAnisotropy){const e=(this.anisotropyNode?$m(this.anisotropyNode):Fx).toVar();Vf.assign(e.length()),Gm(Vf.equal(0),()=>{e.assign($m(1,0))}).Else(()=>{e.divAssign($m(Vf)),Vf.assign(Vf.saturate())}),Of.assign(Vf.pow2().mix(Ef.pow2(),1)),Ff.assign(ox[0].mul(e.x).add(ox[1].mul(e.y))),zf.assign(ox[1].mul(e.x).sub(ox[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?Xm(this.transmissionNode):Hx,t=this.thicknessNode?Xm(this.thicknessNode):Gx,n=this.attenuationDistanceNode?Xm(this.attenuationDistanceNode):jx,i=this.attenuationColorNode?ef(this.attenuationColorNode):Xx;if(Yf.assign(e),Zf.assign(t),$f.assign(n),Jf.assign(i),this.useDispersion){const e=this.dispersionNode?Xm(this.dispersionNode):Qx;Kf.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?ef(this.clearcoatNormalNode):Dx}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dis
2persionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class sS extends NT{constructor(e,t,n,i){super(e,t,n),this.useSSS=i}direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){if(!0===this.useSSS){const i=r.material,{thicknessColorNode:s,thicknessDistortionNode:a,thicknessAmbientNode:o,thicknessAttenuationNode:l,thicknessPowerNode:c,thicknessScaleNode:u}=i,h=e.add(w_.mul(a)).normalize(),d=Xm(g_.dot(h.negate()).saturate().pow(c).mul(u)),p=ef(d.add(o).mul(s));n.directDiffuse.addAssign(p.mul(l.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r)}}const aS=Bm(({normal:e,lightDirection:t,builder:n})=>{const i=e.dot(t),r=$m(i.mul(.5).add(.5),0);if(n.material.gradientMap){const e=q_("gradientMap","texture").context({getUV:()=>r});return ef(e.r)}{const e=r.fwidth().mul(.5);return Av(ef(.7),ef(1),Lv(Xm(.7).sub(e.x),Xm(.7).add(e.x),r.x))}});class oS extends Ab{direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){const s=aS({normal:x_,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Lb({diffuseColor:wf.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(Lb({diffuseColor:wf}))),n.indirectDiffuse.mulAssign(e)}}const lS=new rh;class cS extends Kp{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=ef(g_.z,0,g_.x.negate()).normalize(),t=g_.cross(e);return $m(e.dot(w_),t.dot(w_)).mul(.495).add(.5)}}const uS=zm(cS),hS=new oh;const dS=new vc;class pS extends Kp{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),i=t.sin();return cf(e,i,i.negate(),e).mul(n)}{const e=t,i=hf(sf(1,0,0,0),sf(0,qg(e.x),Xg(e.x).negate(),0),sf(0,Xg(e.x),qg(e.x),0),sf(0,0,0,1)),r=hf(sf(qg(e.y),0,Xg(e.y),0),sf(0,1,0,0),sf(Xg(e.y).negate(),0,qg(e.y),0),sf(0,0,0,1)),s=hf(sf(qg(e.z),Xg(e.z).negate(),0,0),sf(Xg(e.z),qg(e.z),0,0),sf(0,0,1,0),sf(0,0,0,1));return i.mul(r).mul(s).mul(sf(n,1)).xyz}}}const mS=Fm(pS),fS=new Zo;class gS extends Ab{constructor(){super(),this.shadowNode=Xm(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){wf.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(wf.rgb)}}const vS=new Qu;const yS=Bm(({texture:e,uv:t})=>{const n=ef().toVar();return Gm(t.x.lessThan(1e-4),()=>{n.assign(ef(1,0,0))}).ElseIf(t.y.lessThan(1e-4),()=>{n.assign(ef(0,1,0))}).ElseIf(t.z.lessThan(1e-4),()=>{n.assign(ef(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{n.assign(ef(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{n.assign(ef(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{n.assign(ef(0,0,-1))}).Else(()=>{const i=e.uv(t.add(ef(-.01,0,0))).r.sub(e.uv(t.add(ef(.01,0,0))).r),r=e.uv(t.add(ef(0,-.01,0))).r.sub(e.uv(t.add(ef(0,.01,0))).r),s=e.uv(t.add(ef(0,0,-.01))).r.sub(e.uv(t.add(ef(0,0,.01))).r);n.assign(ef(i,r,s))}),n.normalize()});class _S extends Uy{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return ef(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){return t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return yS({texture:this,uv:e})}}const xS=Fm(_S);class MS extends Lh{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,n,i){const r=new Uh(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,n=>{try{t(this.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),this.manager.itemError(e)}},n,i)}parseNodes(e){const t={};if(void 0!==e){for(const n of e){const{uuid:e,type:i}=n;t[e]=this.createNodeFromType(i),t[e].uuid=e}const n={nodes:t,textures:this.textures};for(const i of e)i.meta=n,t[i.uuid].deserialize(i),delete i.meta}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const n={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=n,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(console.error("THREE.NodeLoader: Node type not found:",e),Xm()):Um(new this.nodes[e])}}class bS extends rd{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),n=this.nodes,i=e.inputNodes;for(const e in i){const r=i[e];t[e]=n[r]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class TS{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class SS{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}
vendor: 5,291 bytes, line 2
2class wS{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class NS extends wS{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class ES{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let AS=0;class CS{constructor(e=null){this.id=AS++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class RS extends bf{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}class IS extends Zp{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.language=n,this.includes=t}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const n of t)n.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const LS=Fm(IS);class PS extends IS{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return void 0===n&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),i=n.name,r=n.type,s=e.getCodeFromNode(this,r);""!==i&&(s.name=i);const a=e.getPropertyName(s),o=this.getNodeFunction(e).getCode(a);return s.code=o+"\n","property"===t?a:e.format(`${a}()`,r,t)}}const DS=(e,t=[],n="")=>{for(let e=0;e<t.length;e++){const n=t[e];"function"==typeof n&&(t[e]=n.functionNode)}const i=Um(new PS(e,t,n)),r=(...e)=>i.call(...e);return r.functionNode=i,r};class US{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class OS extends US{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class VS extends US{constructor(e,t=new Wt){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class FS extends US{constructor(e,t=new Mn){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class zS extends US{constructor(e,t=new fn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class BS extends US{constructor(e,t=new Gi){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class kS extends US{constructor(e,t=new jt){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class HS extends US{constructor(e,t=new Jn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class GS extends OS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class WS extends VS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class jS extends FS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class XS extends zS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class qS extends BS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class YS extends kS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class ZS extends HS{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class $S extends Zp{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const n=new Dm(t);return this._currentCond=Fv(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new Dm(t),i=Fv(e,n);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new Dm(e),this}build(e,...t){const n=Hm();km(this);for(const t of this.nodes)t.build(e,"void");return km(n),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const JS=Fm($S);class KS{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),void 0===t)return;return t.get(e[e.length-1])}set(e,t){let n=this.weakMap;for(let t=0;t<e.length;t++){const i=e[t];!1===n.has(i)&&n.set(i,new WeakMap),n=n.get(i)}return n.set(e[e.length-1],t)}delete(e){let t=this.weakMap;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),void 0===t)return!1;return t.delete(e[e.length-1])}}const QS=[.125,.215,.35,.446,.526,.582],ew=20,tw=new us(-1,1,1,-1,0,1),nw=new Vr(90,1),iw=new Gi;
vendor: 4,285 bytes, line 2
2let rw=null,sw=0,aw=0;const ow=(1+Math.sqrt(5))/2,lw=1/ow,cw=[new Mn(-ow,lw,0),new Mn(ow,lw,0),new Mn(-lw,0,ow),new Mn(lw,0,ow),new Mn(0,ow,-lw),new Mn(0,ow,lw),new Mn(-1,1,-1),new Mn(1,1,-1),new Mn(-1,1,1),new Mn(1,1,1)],uw=[3,1,5,0,4,2],hw=HT(Ry(),Cy("faceIndex")).normalize(),dw=ef(hw.x,hw.y.negate(),hw.z);class pw{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}fromScene(e,t=0,n=.1,i=100){rw=this._renderer.getRenderTarget(),sw=this._renderer.getActiveCubeFace(),aw=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=vw(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=yw(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(rw,sw,aw),e.scissorTest=!1,fw(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===F||e.mapping===z?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),rw=this._renderer.getRenderTarget(),sw=this._renderer.getActiveCubeFace(),aw=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Z,minFilter:Z,generateMipmaps:!1,type:se,format:pe,colorSpace:ht},i=mw(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=mw(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas,lodMeshes:this._lodMeshes}=function(e){const t=[],n=[],i=[],r=[];let s=e;const a=e-4+1+QS.length;for(let o=0;o<a;o++){const a=Math.pow(2,s);n.push(a);let l=1/a;o>e-4?l=QS[o-e+4-1]:0===o&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,f=3,g=2,v=1,y=new Float32Array(f*m*p),_=new Float32Array(g*m*p),x=new Float32Array(v*m*p);for(let e=0;e<p;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0],r=uw[e];y.set(i,f*m*r),_.set(d,g*m*r);const s=[r,r,r,r,r,r];x.set(s,v*m*r)}const M=new pr;M.setAttribute("position",new tr(y,f)),M.setAttribute("uv",new tr(_,g)),M.setAttribute("faceIndex",new tr(x,v)),t.push(M),r.push(new wr(M,null)),s>4&&s--}return{lodPlanes:t,sizeLods:n,sigmas:i,lodMeshes:r}}(i)),this._blurMaterial=function(e,t,n){const i=k_(new Array(ew).fill(0)),r=Mf(new Mn(0,1,0)),s=Mf(0),a=Xm(ew),o=Mf(0),l=Mf(1),c=Oy(null),u=Mf(0),h=Xm(1/t),d=Xm(1/n),p=Xm(e),m={n:a,latitudinal:o,weights:i,poleAxis:r,outputDirection:dw,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p},f=gw("blur");return f.uniforms=m,f.fragmentNode=XT({...m,latitudinal:o.equal(1)}),f}(i,e,t)}return i}async _compileMaterial(e){const t=new wr(this._lodPlanes[0],e);await this._renderer.compile(t,tw)}_sceneToCubeUV(e,t,n,i){const r=nw;r.near=t,r.far=n;const s=[-1,1,-1,-1,-1,-1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear;o.getClearColor(iw),o.autoClear=!1;let c=this._backgroundBox;
2if(null===c){const e=new qi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1});c=new wr(new Er,e)}let u=!1;const h=e.background;h?h.isColor&&(c.material.color.copy(h),e.background=null,u=!0):(c.material.color.copy(iw),u=!0),o.setRenderTarget(i),o.clear(),u&&o.render(c,r);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(a[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,a[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,a[t]));const l=this._cubeSize;fw(i,n*l,t>2?l:0,l,l),o.render(e,r)}o.autoClear=l,e.background=h}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===F||e.mapping===z;i?null===this._cubemapMaterial&&(this._cubemapMaterial=vw(e)):null===this._equirectMaterial&&(this._equirectMaterial=yw(e));const r=i?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const s=this._lodMeshes[0];s.material=r;const a=this._cubeSize;fw(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,tw)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=cw[(i-t-1)%cw.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[i];c.material=l;const u=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,m=isFinite(r)?1+Math.floor(3*p):ew;m>ew&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<ew;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<m&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;e.texture.frame=(e.texture.frame||0)+1,u.envMap.value=e.texture,u.samples.value=m,u.weights.array=f,u.latitudinal.value="latitudinal"===s?1:0,a&&(u.poleAxis.value=a);const{_lodMax:v}=this;u.dTheta.value=d,u.mipInt.value=v-n;const y=this._sizeLods[i];fw(t,3*y*(i>v-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(c,tw)}}
vendor: 5,176 bytes, line 2
2function mw(e,t,n){const i=new gn(e,t,n);return i.texture.mapping=H,i.texture.name="PMREM.cubeUv",i.texture.isPMREMTexture=!0,i.scissorTest=!0,i}function fw(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function gw(e){const t=new hb;return t.depthTest=!1,t.depthWrite=!1,t.blending=0,t.name=`PMREM_${e}`,t}function vw(e){const t=gw("cubemap");return t.fragmentNode=O_(e,dw),t}function yw(e){const t=gw("equirect");return t.fragmentNode=Oy(e,_b(dw),0),t}let _w=0;class xw{constructor(e="",t=[],n=0,i=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=i,this.id=_w++}}const Mw=new WeakMap,bw=new Map([[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Tw=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),Sw=e=>(e=Number(e))+(e%1?"":".0");class ww{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.monitor=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=JS(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new CS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=Mw.get(this.renderer);return void 0===e&&(e=new KS,Mw.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new gn(e,t,n)}createCubeRenderTarget(e,t){return new xb(e,t)}createPMREMGenerator(){return new pw(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const n=this.getBindGroupsCache(),i=[];let r,s=!0;for(const e of t)i.push(e),s=s&&!0!==e.groupNode.shared;return s?(r=n.get(i),void 0===r&&(r=new xw(e,i,this.bindingsIndexes[e].group,i),n.set(i,r))):r=new xw(e,i,this.bindingsIndexes[e].group,i),r}getBindGroupArray(e,t){const n=this.bindings[t];let i=n[e];return void 0===i&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(null===e){const t={},n=this.bindings;for(const e of Xp)for(const i in n[e]){const r=n[e][i];(t[i]||(t[i]=[])).push(...r)}e=[];for(const n in t){const i=t[n],r=this._getBindGroup(n,i);e.push(r)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){const n=e[t];this.bindingsIndexes[n.name].group=t,n.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){!1===this.nodes.includes(e)&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}buildUpdateNodes(){for(const e of this.nodes){const t=e.getUpdateType(),n=e.getUpdateBeforeType(),i=e.getUpdateAfterType();t!==Gp.NONE&&this.updateNodes.push(e.getSelf()),n!==Gp.NONE&&this.updateBeforeNodes.push(e.getSelf()),i!==Gp.NONE&&this.updateAfterNodes.push(e.getSelf())}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Z||e.magFilter===$||e.magFilter===Y||e.magFilter===J||e.minFilter===Z||e.minFilter===$||e.minFilter===Y||e.minFilter===J}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}getSharedContext(){return this.context,this.context}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return void 0===n.cache&&(n.cache=new CS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){console.warn("Abstract function.")}getInstanceIndex(){console.warn("Abstract function.")}getDrawIndex(){console.warn("Abstract function.")}getFrontFacing(){console.warn("Abstract function.")}getFragCoord(){console.warn("Abstract function.")}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=void 0===t.usageCount?1:t.usageCount+1,t.usageCount}generateTexture(){console.warn("Abstract function.")}generateTextureLod(){console.warn("Abstract function.")}generateConst(e,t=null){if(null===t&&("float"===e||"int"===e||"uint"===e?t=0:"bool"===e?t=!1:"color"===e?t=new Gi:"vec2"===e?t=new Wt:"vec3"===e?t=new Mn:"vec4"===e&&(t=new fn)),"float"===e)return Sw(t);
vendor: 1,029 bytes, line 2
2if("int"===e)return`${Math.round(t)}`;if("uint"===e)return t>=0?`${Math.round(t)}u`:"0u";if("bool"===e)return t?"true":"false";if("color"===e)return`${this.getType("vec3")}( ${Sw(t.r)}, ${Sw(t.g)}, ${Sw(t.b)} )`;const n=this.getTypeLength(e),i=this.getComponentType(e),r=e=>this.generateConst(i,e);if(2===n)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(3===n)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(4===n)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(n>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const n=this.attributes;for(const t of n)if(t.name===e)return t;const i=new TS(e,t);return n.push(i),i}getPropertyName(e){return e.name}isVector(e){return/ve
vendor: 4,793 bytes, line 2
2c\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===ne)return"int";if(t===ie)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;const n=bw.get(e);return("float"===t?"":t[0])+n}getTypeFromArray(e){return Tw.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,i=e.itemSize,r=e.normalized;let s;return!(e instanceof rr)&&!0!==r&&(s=this.getTypeFromArray(n)),this.getTypeFromLength(i,s)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return null!==n?Number(n[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}addStack(){return this.stack=JS(this.stack),this.stacks.push(Hm()||this.stack),km(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,km(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){let i=(n=null===n?e.isGlobal(this)?this.globalCache:this.cache:n).getData(e);return void 0===i&&(i={},n.setData(e,i)),void 0===i[t]&&(i[t]={}),i[t]}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let i=n.bufferAttribute;if(void 0===i){const r=this.uniforms.index++;i=new TS("nodeAttribute"+r,t,e),this.bufferAttributes.push(i),n.bufferAttribute=i}return i}getStructTypeFromNode(e,t=this.shaderStage){const n=this.getDataFromNode(e,t);if(void 0===n.structType){const i=this.structs.index++;e.name=`StructType${i}`,this.structs[t].push(e),n.structType=e}return e}getUniformFromNode(e,t,n=this.shaderStage,i=null){"in"===i&&(console.warn('NodeBuilder: "in" is a reserved word, using "inValue" instead.',e,i),e.name="inValue",i=e.name);const r=this.getDataFromNode(e,n,this.globalCache);let s=r.uniform;if(void 0===s){const a=this.uniforms.index++;s=new SS(i||"nodeUniform"+a,t,e),this.uniforms[n].push(s),r.uniform=s}return s}getVarFromNode(e,t=null,n=e.getNodeType(this),i=this.shaderStage){const r=this.getDataFromNode(e,i);let s=r.variable;if(void 0===s){const e=this.vars[i]||(this.vars[i]=[]);null===t&&(t="nodeVar"+e.length),s=new wS(t,n),e.push(s),r.variable=s}return s}getVaryingFromNode(e,t=null,n=e.getNodeType(this)){const i=this.getDataFromNode(e,"any");let r=i.varying;if(void 0===r){const e=this.varyings,s=e.length;null===t&&(t="nodeVarying"+s),r=new NS(t,n),e.push(r),i.varying=r}return r}getCodeFromNode(e,t,n=this.shaderStage){const i=this.getDataFromNode(e);let r=i.code;if(void 0===r){const e=this.codes[n]||(this.codes[n]=[]),s=e.length;r=new ES("nodeCode"+s,t),e.push(r),i.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:i}=this.getDataFromNode(e);let r=!0,s=t;for(;s;){if(!0===i.get(s)){r=!1;break}s=this.getDataFromNode(s).parentNodeBlock}if(r)for(const e of n)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,n){const i=this.getDataFromNode(e),r=i.flowCodes||(i.flowCodes=[]),s=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);r.push(t),s.set(n,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}buildFunctionNode(e){const t=new PS,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};
2for(const e of t.inputs)n[e.name]=new RS(e.type,e.name);e.layout=null;const i=e.call(n),r=this.flowStagesNode(i,t.type);return e.layout=t,r}flowStagesNode(e,t=null){const n=this.flow,i=this.vars,r=this.cache,s=this.buildStage,a=this.stack,o={code:""};this.flow=o,this.vars={},this.cache=new CS,this.stack=JS();for(const n of jp)this.setBuildStage(n),o.result=e.build(this,t);return o.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=i,this.cache=r,this.stack=a,this.setBuildStage(s),o}getFunctionOperator(){return null}flowChildNode(e,t=null){const n=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=n,i}flowNodeFromShaderStage(e,t,n=null,i=null){const r=this.shaderStage;this.setShaderStage(e);const s=this.flowChildNode(t,n);return null!==i&&(s.code+=`${this.tab+i} = ${s.result};\n`),this.flowCode[e]=this.flowCode[e]+s.code,this.setShaderStage(r),s}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return`${this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(void 0!==n)for(const e of n)t+=`${this.getVar(e.type,e.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(void 0!==t)for(const e of t)n+=e.code+"\n";return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){console.warn("Abstract function.")}build(){const{object:e,material:t,renderer:n}=this;if(null!==t){let e=n.nodes.library.fromMaterial(t);null===e&&(console.error(`NodeMaterial: Material "${t.type}" is not compatible.`),e=new hb),e.build(this)}else this.addFlow("compute",e);for(const e of jp){this.setBuildStage(e),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const t of Xp){this.setShaderStage(t);const n=this.flowNodes[t];for(const t of n)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if("float"===t||"int"===t||"uint"===t)return new GS(e);if("vec2"===t||"ivec2"===t||"uvec2"===t)return new WS(e);if("vec3"===t||"ivec3"===t||"uvec3"===t)return new jS(e);if("vec4"===t||"ivec4"===t||"uvec4"===t)return new XS(e);if("color"===t)return new qS(e);if("mat3"===t)return new YS(e);if("mat4"===t)return new ZS(e);throw new Error(`Uniform "${t}" not declared.`)}createNodeMaterial(e="NodeMaterial"){throw new Error(`THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${e}() instead.`)}format(e,t,n){if((t=this.getVectorType(t))===(n=this.getVectorType(n))||null===n||this.isReference(n))return e;const i=this.getTypeLength(t),r=this.getTypeLength(n);return 16===i&&9===r?`${this.getType(n)}(${e}[0].xyz, ${e}[1].xyz, ${e}[2].xyz)`:9===i&&4===r?`${this.getType(n)}(${e}[0].xy, ${e}[1].xy)`:i>4||r>4||0===r?e:i===r?`${this.getType(n)}( ${e} )`:i>r?this.format(`${e}.${"xyz".slice(0,r)}`,this.getTypeFromLength(r,this.getComponentType(t)),n):4===r&&i>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===i?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===i&&r>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${i} - Node System\n`}}class Nw{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.startTime=null,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return void 0===n&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===Gp.FRAME){const{frameMap:t}=this._getMaps(this.updateBeforeMap,n);
2t.get(n)!==this.frameId&&!1!==e.updateBefore(this)&&t.set(n,this.frameId)}else if(t===Gp.RENDER){const{renderMap:t}=this._getMaps(this.updateBeforeMap,n);t.get(n)!==this.renderId&&!1!==e.updateBefore(this)&&t.set(n,this.renderId)}else t===Gp.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===Gp.FRAME){const{frameMap:t}=this._getMaps(this.updateAfterMap,n);t.get(n)!==this.frameId&&!1!==e.updateAfter(this)&&t.set(n,this.frameId)}else if(t===Gp.RENDER){const{renderMap:t}=this._getMaps(this.updateAfterMap,n);t.get(n)!==this.renderId&&!1!==e.updateAfter(this)&&t.set(n,this.renderId)}else t===Gp.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===Gp.FRAME){const{frameMap:t}=this._getMaps(this.updateMap,n);t.get(n)!==this.frameId&&!1!==e.update(this)&&t.set(n,this.frameId)}else if(t===Gp.RENDER){const{renderMap:t}=this._getMaps(this.updateMap,n);t.get(n)!==this.renderId&&!1!==e.update(this)&&t.set(n,this.renderId)}else t===Gp.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class Ew{constructor(e,t,n=null,i="",r=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=r}}Ew.isNodeFunctionInput=!0;class Aw extends Zp{static get type(){return"StructTypeNode"}constructor(e){super(),this.types=e,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class Cw extends Zp{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let i=0;i<t.length;i++)n.push(t[i].getNodeType(e));this.nodeType=e.getStructTypeFromNode(new Aw(n)).name}generate(e,t){const n=e.getOutputStructName(),i=this.members,r=""!==n?n+".":"";for(let n=0;n<i.length;n++){const s=i[n].build(e,t);e.addLineFlowCode(`${r}m${n} = ${s}`,this)}return n}}const Rw=Fm(Cw);function Iw(e,t){for(let n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}class Lw extends Cw{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return void 0!==this.outputNodes[e]}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes};return Pw(t)}setup(e){const t=this.outputNodes,n=[],i=e.renderer.getRenderTarget().textures;for(const e in t){n[Iw(i,e)]=sf(t[e])}return this.members=n,super.setup(e)}}const Pw=Fm(Lw);class Dw extends Zp{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(null===n){let i=null,r=-1;for(const n of this.functionNodes){const s=n.shaderNode.layout;if(null===s)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=s.inputs;if(t.length===a.length){let s=0;for(let n=0;n<t.length;n++){const i=t[n],r=a[n];i.getNodeType(e)===r.type?s++:s=0}s>r&&(i=n,r=s)}}this._candidateFnCall=n=i(...t)}return n}}const Uw=Fm(Dw),Ow=e=>(...t)=>Uw(e,...t);class Vw extends xf{static get type(){return"TimerNode"}constructor(e=Vw.LOCAL,t=1,n=0){super(n),this.scope=e,this.scale=t,this.updateType=Gp.FRAME}update(e){const t=this.scope,n=this.scale;t===Vw.LOCAL?this.value+=e.deltaTime*n:t===Vw.DELTA?this.value=e.deltaTime*n:t===Vw.FRAME?this.value=e.frameId:this.value=e.time*n}serialize(e){super.serialize(e),e.scope=this.scope,e.scale=this.scale}deserialize(e){super.deserialize(e),this.scope=e.scope,this.scale=e.scale}}Vw.LOCAL="local",Vw.GLOBAL="global",Vw.DELTA="delta",Vw.FRAME="frame";const Fw=(e,t=0)=>Um(new Vw(Vw.LOCAL,e,t)),zw=zm(Vw,Vw.FRAME).toUint();class Bw extends Zp{static get type(){return"OscNode"}constructor(e=Bw.SINE,t=Fw()){super(),this.method=e,this.timeNode=t}getNodeType(e){return this.timeNode.getNodeType(e)}setup(){const e=this.method,t=Um(this.timeNode);let n=null;return e===Bw.SINE?n=t.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5):e===Bw.SQUARE?n=t.fract().round():e===Bw.TRIANGLE?n=t.add(.5).fract().mul(2).sub(1).abs():e===Bw.SAWTOOTH&&(n=t.fract()),n}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Bw.SINE="sine",Bw.SQUARE="square",Bw.TRIANGLE="triangle",Bw.SAWTOOTH="sawtooth";
vendor: 5,564 bytes, line 2
2const kw=Fm(Bw,Bw.SINE),Hw=Fm(Bw,Bw.SQUARE),Gw=Fm(Bw,Bw.TRIANGLE),Ww=Fm(Bw,Bw.SAWTOOTH);class jw extends Zp{static get type(){return"SpriteSheetUVNode"}constructor(e,t=Ry(),n=Xm(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:r}=n,s=e.mod(i.mul(r)).floor(),a=s.mod(i),o=r.sub(s.add(1).div(i).ceil()),l=n.reciprocal(),c=$m(a,o);return t.add(c).mul(l)}}const Xw=Fm(jw);class qw extends $p{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.bufferObject&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(n=!1===e.isAvailable("storageBuffer")?!0===this.node.bufferObject&&!0!==i?e.generatePBO(this):this.node.build(e):super.generate(e),!0!==i){const i=this.getNodeType(e);n=e.format(n,i,t)}return n}}const Yw=Fm(qw);class Zw extends Zp{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,i=Xm(1),r=h_,s=M_){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=i,this.positionNode=r,this.normalNode=s}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:i,positionNode:r,normalNode:s}=this;let a=s.abs().normalize();a=a.div(a.dot(ef(1)));const o=r.yz.mul(i),l=r.zx.mul(i),c=r.xy.mul(i),u=e.value,h=null!==t?t.value:u,d=null!==n?n.value:u,p=Oy(u,o).mul(a.x),m=Oy(h,l).mul(a.y),f=Oy(d,c).mul(a.z);return rg(p,m,f)}}const $w=Fm(Zw),Jw=new jr,Kw=new Mn,Qw=new Mn,eN=new Mn,tN=new Jn,nN=new Mn(0,0,-1),iN=new fn,rN=new Mn,sN=new Mn,aN=new fn,oN=new Wt,lN=new gn,cN=zM.flipX();let uN=!1;class hN extends Uy{static get type(){return"ReflectorNode"}constructor(e={}){super(lN.texture,cN);const{target:t=new Si,resolution:n=1,generateMipmaps:i=!1,bounces:r=!0}=e;this.target=t,this.resolution=n,this.generateMipmaps=i,this.bounces=r,this.updateBeforeType=r?Gp.RENDER:Gp.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(oN),e.setSize(Math.round(oN.width*n),Math.round(oN.height*n))}setup(e){return this._updateResolution(lN,e.renderer),super.setup(e)}getTextureNode(){return this.textureNode}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new gn(0,0,{type:se}),!0===this.generateMipmaps&&(t.texture.minFilter=1008,t.texture.generateMipmaps=!0),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&uN)return!1;uN=!0;const{scene:t,camera:n,renderer:i,material:r}=e,{target:s}=this,a=this.getVirtualCamera(n),o=this.getRenderTarget(a);if(i.getDrawingBufferSize(oN),this._updateResolution(o,i),Qw.setFromMatrixPosition(s.matrixWorld),eN.setFromMatrixPosition(n.matrixWorld),tN.extractRotation(s.matrixWorld),Kw.set(0,0,1),Kw.applyMatrix4(tN),rN.subVectors(Qw,eN),rN.dot(Kw)>0)return;rN.reflect(Kw).negate(),rN.add(Qw),tN.extractRotation(n.matrixWorld),nN.set(0,0,-1),nN.applyMatrix4(tN),nN.add(eN),sN.subVectors(Qw,nN),sN.reflect(Kw).negate(),sN.add(Qw),a.coordinateSystem=n.coordinateSystem,a.position.copy(rN),a.up.set(0,1,0),a.up.applyMatrix4(tN),a.up.reflect(Kw),a.lookAt(sN),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),Jw.setFromNormalAndCoplanarPoint(Kw,Qw),Jw.applyMatrix4(a.matrixWorldInverse),iN.set(Jw.normal.x,Jw.normal.y,Jw.normal.z,Jw.constant);const l=a.projectionMatrix;aN.x=(Math.sign(iN.x)+l.elements[8])/l.elements[0],aN.y=(Math.sign(iN.y)+l.elements[9])/l.elements[5],aN.z=-1,aN.w=(1+l.elements[10])/l.elements[14],iN.multiplyScalar(1/iN.dot(aN));l.elements[2]=iN.x,l.elements[6]=iN.y,l.elements[10]=iN.z-0,l.elements[14]=iN.w,this.value=o.texture,r.visible=!1;const c=i.getRenderTarget(),u=i.getMRT();i.setMRT(null),i.setRenderTarget(o),i.render(t,a),i.setMRT(u),i.setRenderTarget(c),r.visible=!0,uN=!1}}const dN=new us(-1,1,1,-1,0,1);class pN extends pr{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new sr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new sr(t,2))}}const mN=new pN;class fN extends wr{constructor(e=null){super(mN,e),this.camera=dN,this.isQuadMesh=!0}renderAsync(e){return e.renderAsync(this,dN)}render(e){e.render(this,dN)}}const gN=new Wt;class vN extends Uy{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:se}){const r=new gn(t,n,i);super(r.texture,Ry()),this.node=e,this.width=t,this.height=n,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this.updateMap=new WeakMap,this._rttNode=null,this._quadMesh=new fN(new hb),this.updateBeforeType=Gp.RENDER}get autoSize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoSize){this.pixelRatio=e.getPixelRatio();const t=e.getSize(gN);this.setSize(t.width,t.height)}this._quadMesh.material.fragmentNode=this._rttNode;
2const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new Uy(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yN=(e,...t)=>Um(new vN(Um(e),...t)),_N=(e,...t)=>e.isTextureNode?e:yN(e,...t);class xN extends Ay{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let n;return n=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new fn(1,1,1,1)),n}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}class MN extends Zp{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const bN=zm(MN);class TN extends Zp{static get type(){return"SceneNode"}constructor(e=TN.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=null!==this.scene?this.scene:e.scene;let i;return t===TN.BACKGROUND_BLURRINESS?i=W_("backgroundBlurriness","float",n):t===TN.BACKGROUND_INTENSITY?i=W_("backgroundIntensity","float",n):console.error("THREE.SceneNode: Unknown scope:",t),i}}TN.BACKGROUND_BLURRINESS="backgroundBlurriness",TN.BACKGROUND_INTENSITY="backgroundIntensity";const SN=zm(TN,TN.BACKGROUND_BLURRINESS),wN=zm(TN,TN.BACKGROUND_INTENSITY),NN="storage",EN="read-only-storage",AN="write-only",CN="read-only";class RN extends V_{static get type(){return"StorageBufferNode"}constructor(e,t,n=0){super(e,t,n),this.isStorageBufferNode=!0,this.access=NN,this.isAtomic=!1,this.bufferObject=!1,this.bufferCount=n,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(0===this.bufferCount){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return"storageBuffer"}element(e){return Yw(this,e)}setBufferObject(e){return this.bufferObject=e,this}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(EN)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}generate(e){if(e.isAvailable("storageBuffer"))return super.generate(e);const t=this.getNodeType(e);null===this._attribute&&(this._attribute=uy(this.value),this._varying=Xv(this._attribute));const n=this._varying.build(e,t);return e.registerTransform(n,this._attribute),n}}class IN extends Uy{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=AN}getInputType(){return"storageTexture"}setup(e){super.setup(e);e.getNodeProperties(this).storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let n;return n=null!==this.storeNode?this.generateStore(e):super.generate(e,t),n}toReadOnly(){return this.setAccess(CN)}toWriteOnly(){return this.setAccess(AN)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i}=t,r=super.generate(e,"property"),s=n.build(e,"uvec2"),a=i.build(e,"vec4"),o=e.generateTextureStore(e,r,s,a);e.addLineFlowCode(o,this)}}const LN=Fm(IN);class PN extends G_{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}class DN extends Kp{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}
2const UN=Fm(DN);let ON=null;class VN extends $M{static get type(){return"ViewportSharedTextureNode"}constructor(e=zM,t=null){null===ON&&(ON=new wc),super(e,t,ON)}updateReference(){return this}}const FN=Fm(VN),zN=new Wt;class BN extends Uy{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class kN extends BN{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class HN extends Kp{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const r=new Os;r.isRenderTargetTexture=!0,r.name="depth";const s=new gn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:se,...i});s.texture.name="output",s.depthTexture=r,this.renderTarget=s,this.updateBeforeType=Gp.FRAME,this._textures={output:s.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Mf(0),this._cameraFar=Mf(0),this._mrt=null,this.isPassNode=!0}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return void 0===t&&(t=this.renderTarget.texture.clone(),t.isRenderTargetTexture=!0,t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),t.isRenderTargetTexture=!0,this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const n=this._textures[e],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(this._textureNodes[e]=t=Um(new kN(this,e)),this._textureNodes[e].updateTexture()),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),this._previousTextureNodes[e]=t=Um(new kN(this,e,!0)),this._previousTextureNodes[e].updateTexture()),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const n=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=sb(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const n=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=ib(r,n,i)}return t}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,!0===e.backend.isWebGLBackend&&(this.renderTarget.samples=0),this.renderTarget.depthTexture.isMultisampleRenderTargetTexture=this.renderTarget.samples>1,this.scope===HN.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(zN);this.setSize(r.width,r.height);const s=t.getRenderTarget(),a=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const e in this._previousTextures)this.toggleTexture(e);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,i),t.setRenderTarget(s),t.setMRT(a)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget.setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}HN.COLOR="color",HN.DEPTH="depth";const GN=(e,t)=>Um(new BN(e,t)),WN=new fN,jN=new fN;class XN extends Kp{static get type(){return"GaussianBlurNode"}constructor(e,t=null,n=2){super("vec4"),this.textureNode=e,this.directionNode=t,this.sigma=n,this._invSize=Mf(new Wt),this._passDirection=Mf(new Wt),this._horizontalRT=new gn,this._horizontalRT.texture.name="GaussianBlurNode.horizontal",this._verticalRT=new gn,this._verticalRT.texture.name="GaussianBlurNode.vertical",this._textureNode=GN(this,this._verticalRT.texture),this.updateBeforeType=Gp.RENDER,this.resolution=new Wt(1,1)}setSize(e,t){e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._invSize.value.set(1/e,1/t),this._horizontalRT.setSize(e,t),this._verticalRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value,r=t.getRenderTarget(),s=t.getMRT(),a=n.value;WN.material=this._material,jN.material=this._material,this.setSize(i.image.width,i.image.height);const o=i.type;this._horizontalRT.texture.type=o,this._verticalRT.texture.type=o,t.setMRT(null),t.setRenderTarget(this._horizontalRT),this._passDirection.value.set(1,0),WN.render(t),n.value=this._horizontalRT.texture,t.setRenderTarget(this._verticalRT),this._passDirection.value.set(0,1),jN.render(t),t.setRenderTarget(r),t.setMRT(s),n.value=a}getTextureNode(){return this._textureNode}setup(e){const t=this.textureNode;if(!0!==t.isTextureNode)return console.error("GaussianBlurNode requires a TextureNode."),sf();const n=t.uvNode||Ry(),i=$m(this.directionNode||1),r=e=>t.uv(e),s=Bm(()=>{const e=3+2*this.sigma,t=this._getCoefficients(e),s=this._invSize,a=i.mul(this._passDirection),o=Xm(t[0]).toVar(),l=sf(r(n).mul(o)).toVar();for(let i=1;i<e;i++){const e=Xm(i),c=Xm(t[i]),u=$m(a.mul(s.mul(e))).toVar(),h=sf(r(n.add(u))),d=sf(r(n.sub(u)));l.addAssign(h.add(d).mul(c)),o.addAssign(ag(2,c))}return l.div(o)}),a=this._material||(this._material=new hb);a.fragmentNode=s().context(e.getSharedContext()),a.name="Gaussian_blur",a.needsUpdate=!0;return e.getNodeProperties(this).textureNode=t,this._textureNode}dispose(){this._horizontalRT.dispose(),this._verticalRT.dispose()}_getCoefficients(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return t}}const qN=new Wt,YN=new fN;class ZN extends Kp{static get type(){return"AfterImageNode"}constructor(e,t=.96){super(e),this.textureNode=e,this.textureNodeOld=Oy(),this.damp=Mf(t),this._compRT=new gn,this._compRT.texture.name="AfterImageNode.comp",this._oldRT=new gn,this._oldRT.texture.name="AfterImageNode.old",this._textureNode=GN(this,this._compRT.texture),this.updateBeforeType=Gp.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._compRT.setSize(e,t),this._oldRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value.type;this._compRT.texture.type=i,this._oldRT.texture.type=i,t.getDrawingBufferSize(qN),this.setSize(qN.x,qN.y);const r=t.getRenderTarget(),s=n.value;this.textureNodeOld.value=this._oldRT.texture,t.setRenderTarget(this._compRT),YN.render(t);const a=this._oldRT;this._oldRT=this._compRT,this._compRT=a,t.setRenderTarget(r),n.value=s}setup(e){const t=this.textureNode,n=this.textureNodeOld,i=t.uvNode||Ry();n.uvNode=i;const r=Bm(([e,t])=>{const n=Xm(t).toVar(),i=sf(e).toVar();return pv(Qg(i.sub(n)),0)}),s=Bm(()=>{const e=sf(n),s=sf((e=>t.uv(e))(i));return e.mulAssign(this.damp.mul(r(e,.1))),pv(s,e)}),a=this._materialComposed||(this._materialComposed=new hb);a.name="AfterImage",a.fragmentNode=s(),YN.material=a;return e.getNodeProperties(this).textureNode=t,this._textureNode}
2dispose(){this._compRT.dispose(),this._oldRT.dispose()}}const $N=Bm(([e])=>tE(e.rgb)),JN=Bm(([e,t=Xm(1)])=>t.mix(tE(e.rgb),e.rgb)),KN=Bm(([e,t=Xm(1)])=>{const n=rg(e.r,e.g,e.b).div(3),i=e.r.max(e.g.max(e.b)),r=i.sub(n).mul(t).mul(-3);return Av(e.rgb,i,r)}),QN=Bm(([e,t=Xm(1)])=>{const n=ef(.57735,.57735,.57735),i=t.cos();return ef(e.rgb.mul(i).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(_v(n,e.rgb).mul(i.oneMinus())))))}),eE=new Mn,tE=(e,t=ef(...sn.getLuminanceCoefficients(eE)))=>_v(e,t),nE=(e,t)=>Av(ef(0),e,tE(e).sub(t).max(0)),iE=new fN;class rE extends Kp{static get type(){return"AnamorphicNode"}constructor(e,t,n,i){super("vec4"),this.textureNode=e,this.tresholdNode=t,this.scaleNode=n,this.colorNode=ef(.1,0,1),this.samples=i,this.resolution=new Wt(1,1),this._renderTarget=new gn,this._renderTarget.texture.name="anamorphic",this._invSize=Mf(new Wt),this._textureNode=GN(this,this._renderTarget.texture),this.updateBeforeType=Gp.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._invSize.value.set(1/e,1/t),e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._renderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value;this._renderTarget.texture.type=i.type;const r=t.getRenderTarget(),s=n.value;iE.material=this._material,this.setSize(i.image.width,i.image.height),t.setRenderTarget(this._renderTarget),iE.render(t),t.setRenderTarget(r),n.value=s}setup(e){const t=this.textureNode,n=t.uvNode||Ry(),i=Bm(()=>{const e=this.samples,i=Math.floor(e/2),r=ef(0).toVar();return xM({start:-i,end:i},({i:e})=>{const s=Xm(e).abs().div(i).oneMinus(),a=(e=>t.uv(e))($m(n.x.add(this._invSize.x.mul(e).mul(this.scaleNode)),n.y)),o=nE(a,this.tresholdNode).mul(s);r.addAssign(o)}),r.mul(this.colorNode)}),r=this._material||(this._material=new hb);r.name="Anamorphic",r.fragmentNode=i();return e.getNodeProperties(this).textureNode=t,this._textureNode}dispose(){this._renderTarget.dispose()}}class sE extends Kp{static get type(){return"SobelOperatorNode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=Gp.RENDER,this._invSize=Mf(new Wt)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const{textureNode:e}=this,t=e.uvNode||Ry(),n=t=>e.uv(t);return Bm(()=>{const e=this._invSize,i=uf(-1,-2,-1,0,0,0,1,2,1),r=uf(-1,0,1,-2,0,2,-1,0,1),s=tE(n(t.add(e.mul($m(-1,-1)))).xyz),a=tE(n(t.add(e.mul($m(-1,0)))).xyz),o=tE(n(t.add(e.mul($m(-1,1)))).xyz),l=tE(n(t.add(e.mul($m(0,-1)))).xyz),c=tE(n(t.add(e.mul($m(0,0)))).xyz),u=tE(n(t.add(e.mul($m(0,1)))).xyz),h=tE(n(t.add(e.mul($m(1,-1)))).xyz),d=tE(n(t.add(e.mul($m(1,0)))).xyz),p=tE(n(t.add(e.mul($m(1,1)))).xyz),m=rg(i[0][0].mul(s),i[1][0].mul(l),i[2][0].mul(h),i[0][1].mul(a),i[1][1].mul(c),i[2][1].mul(d),i[0][2].mul(o),i[1][2].mul(u),i[2][2].mul(p)),f=rg(r[0][0].mul(s),r[1][0].mul(l),r[2][0].mul(h),r[0][1].mul(a),r[1][1].mul(c),r[2][1].mul(d),r[0][2].mul(o),r[1][2].mul(u),r[2][2].mul(p)),g=m.mul(m).add(f.mul(f)).sqrt();return sf(ef(g),1)})()}}class aE extends Kp{static get type(){return"DepthOfFieldNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.viewZNode=t,this.focusNode=n,this.apertureNode=i,this.maxblurNode=r,this._aspect=Mf(0),this.updateBeforeType=Gp.RENDER}updateBefore(){const e=this.textureNode.value;this._aspect.value=e.image.width/e.image.height}setup(){const e=this.textureNode,t=e.uvNode||Ry(),n=t=>e.uv(t);return Bm(()=>{const e=$m(1,this._aspect),i=this.focusNode.add(this.viewZNode),r=$m(Cv(i.mul(this.apertureNode),this.maxblurNode.negate(),this.maxblurNode)),s=r.mul(.9),a=r.mul(.7),o=r.mul(.4);let l=sf(0);return l=l.add(n(t)),l=l.add(n(t.add($m(0,.4).mul(e).mul(r)))),l=l.add(n(t.add($m(.15,.37).mul(e).mul(r)))),l=l.add(n(t.add($m(.29,.29).mul(e).mul(r)))),l=l.add(n(t.add($m(-.37,.15).mul(e).mul(r)))),l=l.add(n(t.add($m(.4,0).mul(e).mul(r)))),l=l.add(n(t.add($m(.37,-.15).mul(e).mul(r)))),l=l.add(n(t.add($m(.29,-.29).mul(e).mul(r)))),l=l.add(n(t.add($m(-.15,-.37).mul(e).mul(r)))),l=l.add(n(t.add($m(0,-.4).mul(e).mul(r)))),l=l.add(n(t.add($m(-.15,.37).mul(e).mul(r)))),l=l.add(n(t.add($m(-.29,.29).mul(e).mul(r)))),l=l.add(n(t.add($m(.37,.15).mul(e).mul(r)))),l=l.add(n(t.add($m(-.4,0).mul(e).mul(r)))),l=l.add(n(t.add($m(-.37,-.15).mul(e).mul(r)))),l=l.add(n(t.add($m(-.29,-.29).mul(e).mul(r)))),l=l.add(n(t.add($m(.15,-.37).mul(e).mul(r)))),l=l.add(n(t.add($m(.15,.37).mul(e).mul(s)))),l=l.add(n(t.add($m(-.37,.15).mul(e).mul(s)))),l=l.add(n(t.add($m(.37,-.15).mul(e).mul(s)))),l=l.add(n(t.add($m(-.15,-.37).mul(e).mul(s)))),l=l.add(n(t.add($m(-.15,.37).mul(e).mul(s)))),l=l.add(n(t.add($m(.37,.15).mul(e).mul(s)))),l=l.add(n(t.add($m(-.37,-.15).mul(e).mul(s)))),l=l.add(n(t.add($m(.15,-.37).mul(e).mul(s)))),l=l.add(n(t.add($m(.29,.29).mul(e).mul(a)))),l=l.add(n(t.add($m(.4,0).mul(e).mul(a)))),l=l.add(n(t.add($m(.29,-.29).mul(e).mul(a)))),l=l.add(n(t.add($m(0,-.4).mul(e).mul(a)))),l=l.add(n(t.add($m(-.29,.29).mul(e).mul(a)))),l=l.add(n(t.add($m(-.4,0).mul(e).mul(a)))),l=l.add(n(t.add($m(-.29,-.29).mul(e).mul(a)))),l=l.add(n(t.add($m(0,.4).mul(e).mul(a)))),l=l.add(n(t.add($m(.29,.29).mul(e).mul(o)))),l=l.add(n(t.add($m(.4,0).mul(e).mul(o)))),l=l.add(n(t.add($m(.29,-.29).mul(e).mul(o)))),l=l.add(n(t.add($m(0,-.4).mul(e).mul(o)))),l=l.add(n(t.add($m(-.29,.29).mul(e).mul(o)))),l=l.add(n(t.add($m(-.4,0).mul(e).mul(o)))),l=l.add(n(t.add($m(-.29,-.29).mul(e).mul(o)))),l=l.add(n(t.add($m(0,.4).mul(e).mul(o)))),l=l.div(41),l.a=1,sf(l)})()}}class oE extends Kp{static get type(){return"DotScreenNode"}constructor(e,t=new Wt(.5,.5),n=1.57,i=1){super("vec4"),this.inputNode=e,this.center=Mf(t),this.angle=Mf(n),this.scale=Mf(i)}setup(){const e=this.inputNode,t=Bm(()=>{const e=Xg(this.angle),t=qg(this.angle),n=Ry().mul(BM).sub(this.center),i=$m(t.mul(n.x).sub(e.mul(n.y)),e.mul(n.x).add(t.mul(n.y))).mul(this.scale);return Xg(i.x).mul(Xg(i.y)).mul(4)});return Bm(()=>{const n=e,i=rg(n.r,n.g,n.b).div(3);return sf(ef(i.mul(10).sub(5).add(t())),n.a)})()}}class lE extends Kp{static get type(){return"RGBShiftNode"}constructor(e,t=.005,n=0){super("vec4"),this.textureNode=e,this.amount=Mf(t),this.angle=Mf(n)}setup(){const{textureNode:e}=this,t=e.uvNode||Ry(),n=t=>e.uv(t);return Bm(()=>{const e=$m(qg(this.angle),Xg(this.angle)).mul(this.amount),i=n(t.add(e)),r=n(t),s=n(t.sub(e));return sf(i.r,r.g,s.b,r.a)})()}}class cE extends Kp{static get type(){return"FilmNode"}constructor(e,t=null,n=null){super(),this.inputNode=e,this.intensityNode=t,this.uvNode=n}setup(){const e=this.uvNode||Ry();return Bm(()=>{const t=this.inputNode.rgb,n=Dv(jg(e.add(Fw())));let i=t.add(t.mul(Cv(n.add(.1),0,1)));return null!==this.intensityNode&&(i=Av(t,i,this.intensityNode)),sf(i,this.inputNode.a)})()}}const uE=Fm(cE);class hE extends Kp{static get type(){return"Lut3DNode"}constructor(e,t,n,i){super(),this.inputNode=e,this.lutNode=t,this.size=Mf(n),this.intensityNode=i}setup(){const{inputNode:e,lutNode:t}=this;return Bm(()=>{const n=e,i=Xm(1).div(this.size),r=Xm(.5).div(this.size),s=ef(r).add(n.rgb.mul(Xm(1).sub(i))),a=sf((e=>t.uv(e))(s).rgb,n.a);return sf(Av(n,a,this.intensityNode))})()}}const dE=new fN,pE=new Gi,mE=new Wt;class fE extends Kp{static get type(){return"GTAONode"}constructor(e,t,n){super(),this.depthNode=e,this.normalNode=t,this.radius=Mf(.25),this.resolution=Mf(new Wt),this.thickness=Mf(1),this.distanceExponent=Mf(1),this.distanceFallOff=Mf(1),this.scale=Mf(1),this.noiseNode=Oy(function(e=5){const t=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),n=function(e){const t=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),n=t*t,i=Array(n).fill(0);let r=Math.floor(t/2),s=t-1;for(let e=1;e<=n;)-1===r&&s===t?(s=t-2,r=0):(s===t&&(s=0),r<0&&(r=t-1)),0===i[r*t+s]?(i[r*t+s]=e++,s++,r--):(s-=2,r++);return i}(t),i=n.length,r=new Uint8Array(4*i);for(let e=0;e<i;++e){const t=n[e],s=2*Math.PI*t/i,a=new Mn(Math.cos(s),Math.sin(s),0).normalize();r[4*e]=255*(.5*a.x+.5),r[4*e+1]=255*(.5*a.y+.5),r[4*e+2]=127,r[4*e+3]=255}const s=new wl(r,t,t);return s.wrapS=G,s.wrapT=G,s.needsUpdate=!0,s}()),this.cameraProjectionMatrix=Mf(n.projectionMatrix),this.cameraProjectionMatrixInverse=Mf(n.projectionMatrixInverse),this.SAMPLES=Mf(16),this._aoRenderTarget=new gn,this._aoRenderTarget.texture.name="GTAONode.AO",this._material=null,this._textureNode=GN(this,this._aoRenderTarget.texture),this.updateBeforeType=Gp.FRAME}getTextureNode(){return this._textureNode}setSize(e,t){this.resolution.value.set(e,t),this._aoRenderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(mE),i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(pE);const s=t.getClearAlpha();dE.material=this._material,this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(16777215,1),t.setRenderTarget(this._aoRenderTarget),dE.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(pE,s)}setup(e){const t=Ry(),n=e=>this.depthNode.uv(e).x,i=e=>this.noiseNode.uv(e),r=Bm(([e])=>{const t=this.cameraProjectionMatrix.mul(sf(e,1));let i=t.xy.div(t.w).mul(.5).add(.5).toVar();i=$m(i.x,i.y.oneMinus());const r=n(i);return ef(i,r)}),s=Bm(([e,t])=>{e=$m(e.x,e.y.oneMinus()).mul(2).sub(1);const n=sf(ef(e,t),1),i=sf(this.cameraProjectionMatrixInverse.mul(n));return i.xyz.div(i.w)}),a=Bm(()=>{const e=n(t);e.greaterThanEqual(1).discard();const a=s(t,e),o=this.normalNode.rgb.normalize(),l=this.radius,c=Ly(this.noiseNode,0);let u=$m(t.x,t.y.oneMinus());u=u.mul(this.resolution.div(c));const h=i(u),d=h.xyz.mul(2).sub(1),p=ef(d.xy,0).normalize(),m=ef(p.y.mul(-1),p.x,0),f=uf(p,m,ef(0,0,1)),g=this.SAMPLES.lessThan(30).select(3,5),v=rg(this.SAMPLES,g.sub(1)).div(g),y=Xm(0).toVar();return xM({start:qm(0),end:g,type:"int",condition:"<"},({i:e})=>{const t=Xm(e).div(Xm(g)).mul(Cg),n=sf(qg(t),Xg(t),0,rg(.5,ag(.5,h.w)));n.xyz=Wg(f.mul(n.xyz));const i=Wg(a.xyz.negate()),c=Wg(xv(n.xyz,i)),u=xv(c,i),d=Wg(o.sub(c.mul(_v(o,c)))),p=xv(d,c),m=$m(_v(i,p),_v(i,p.negate())).toVar();xM({end:v,type:"int",name:"j",condition:"<"},({j:e})=>{const t=n.xyz.mul(l).mul(n.w).mul(Mv(og(Xm(e).add(1),Xm(v)),this.distanceExponent)),o=r(a.add(t)),c=s(o.xy,o.z).sub(a);Gm(Kg(c.z).lessThan(this.thickness),()=>{const t=_v(i,Wg(c));m.x.addAssign(pv(0,ag(t.sub(m.x),Av(1,Xm(2).div(Xm(e).add(2)),this.distanceFallOff))))});const u=r(a.sub(t)),h=s(u.xy,u.z).sub(a);Gm(Kg(h.z).lessThan(this.thickness),()=>
2{const t=_v(i,Wg(h));m.y.addAssign(pv(0,ag(t.sub(m.y),Av(1,Xm(2).div(Xm(e).add(2)),this.distanceFallOff))))})});const _=Bg(sg(1,m.mul(m))),x=_v(d,u),M=_v(d,i),b=ag(.5,$g(m.y).sub($g(m.x)).add(_.x.mul(m.x).sub(_.y.mul(m.y)))),T=ag(.5,sg(2,m.x.mul(m.x)).sub(m.y.mul(m.y))),S=x.mul(b).add(M.mul(T));y.addAssign(S)}),y.assign(Cv(y.div(g),0,1)),y.assign(Mv(y,this.scale)),sf(ef(y),1)}),o=this._material||(this._material=new hb);return o.fragmentNode=a().context(e.getSharedContext()),o.name="GTAO",o.needsUpdate=!0,this._textureNode}dispose(){this._aoRenderTarget.dispose()}}class gE extends Kp{static get type(){return"DenoiseNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.noiseNode=i,this.cameraProjectionMatrixInverse=Mf(r.projectionMatrixInverse),this.lumaPhi=Mf(5),this.depthPhi=Mf(5),this.normalPhi=Mf(5),this.radius=Mf(5),this.index=Mf(0),this._resolution=Mf(new Wt),this._sampleVectors=k_(function(e,t,n){const i=function(e,t,n){const i=[];for(let r=0;r<e;r++){const s=2*Math.PI*t*r/e,a=Math.pow(r/(e-1),n);i.push(new Mn(Math.cos(s),Math.sin(s),a))}return i}(e,t,n),r=[];for(let t=0;t<e;t++){const e=i[t];r.push(e)}return r}(16,2,1)),this.updateBeforeType=Gp.RENDER}updateBefore(){const e=this.textureNode.value;this._resolution.value.set(e.image.width,e.image.height)}setup(){const e=Ry(),t=e=>this.textureNode.uv(e),n=e=>this.depthNode.uv(e).x,i=e=>this.normalNode.uv(e),r=e=>this.noiseNode.uv(e),s=Bm(([e,t])=>{e=$m(e.x,e.y.oneMinus()).mul(2).sub(1);const n=sf(ef(e,t),1),i=sf(this.cameraProjectionMatrixInverse.mul(n));return i.xyz.div(i.w)}),a=Bm(([e,r,a,o])=>{const l=t(o),c=n(o),u=i(o).rgb.normalize(),h=l.rgb,d=s(o,c),p=_v(r,u).toVar(),m=Mv(pv(p,0),this.normalPhi).toVar(),f=Kg(tE(h).sub(tE(e))).toVar(),g=pv(Xm(1).sub(f.div(this.lumaPhi)),0).toVar(),v=Kg(_v(a.sub(d),r)).toVar(),y=pv(Xm(1).sub(v.div(this.depthPhi)),0),_=g.mul(y).mul(m);return sf(h.mul(_),_)}),o=Bm(([e])=>{const o=n(e),l=i(e).rgb.normalize(),c=t(e);Gm(o.greaterThanEqual(1).or(_v(l,l).equal(0)),()=>c);const u=ef(c.rgb),h=s(e,o),d=Ly(this.noiseNode,0);let p=$m(e.x,e.y.oneMinus());p=p.mul(this._resolution.div(d));const m=r(p),f=Xg(m.element(this.index.mod(4).mul(2).mul(Cg))),g=qg(m.element(this.index.mod(4).mul(2).mul(Cg))),v=$m(f,g),y=cf(v.x,v.y.negate(),v.x,v.y),_=Xm(1).toVar(),x=ef(c.rgb).toVar();return xM({start:qm(0),end:qm(16),type:"int",condition:"<"},({i:t})=>{const n=this._sampleVectors.element(t).toVar(),i=y.mul(n.xy.mul(Xm(1).add(n.z.mul(this.radius.sub(1))))).div(this._resolution).toVar(),r=e.add(i).toVar(),s=a(u,l,h,r);x.addAssign(s.xyz),_.addAssign(s.w)}),Gm(_.greaterThan(Xm(0)),()=>{x.divAssign(_)}),sf(x,c.a)}).setLayout({name:"denoise",type:"vec4",inputs:[{name:"uv",type:"vec2"}]});return Bm(()=>o(e))()}}class vE extends Kp{static get type(){return"FXAANode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=Gp.RENDER,this._invSize=Mf(new Wt)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const e=this.textureNode.bias(-100),t=e.uvNode||Ry(),n=t=>e.uv(t),i=(t,n,i)=>e.uv(t.add(n.mul(i))),r=qm(5),s=Bm(([e,t])=>{const n=sf(t).toVar(),i=sf(e).toVar(),r=sf(Kg(i.sub(n))).toVar();return pv(pv(pv(r.r,r.g),r.b),r.a)}),a=Bm(([e,t,a,o])=>{const l=n(e).toVar(),c=i(e,$m(0,-1),t.xy).toVar(),u=i(e,$m(1,0),t.xy).toVar(),h=i(e,$m(0,1),t.xy).toVar(),d=i(e,$m(-1,0),t.xy).toVar(),p=s(l,h).toVar(),m=s(l,c).toVar(),f=s(l,u).toVar(),g=s(l,d).toVar(),v=pv(p,pv(m,pv(f,g))).toVar();Gm(v.lessThan(a),()=>l);const y=sg(p.add(m),f.add(g)).toVar();y.mulAssign(o),Gm(Kg(y).lessThan(.3),()=>{const n=f.greaterThan(g).select(1,-1).toVar(),r=m.greaterThan(p).select(1,-1).toVar(),a=$m(n,r).toVar(),v=i(e,$m(a.x,a.y),t.xy),_=s(l,v).toVar(),x=i(e,$m(a.x.negate(),a.y.negate()),t.xy),M=s(l,x).toVar();y.assign(M.sub(_)),y.mulAssign(o),Gm(Kg(y).lessThan(.3),()=>{const e=h.add(c).add(u).add(d);return Av(l,e.mul(.25),.4)})});const _=$m().toVar();Gm(y.lessThanEqual(0),()=>{h.assign(d),c.assign(u),_.x.assign(0),_.y.assign(t.y)}).Else(()=>{_.x.assign(t.x),_.y.assign(0)});const x=s(l,h).toVar(),M=s(l,c).toVar();Gm(x.lessThanEqual(M),()=>{h.assign(c)});const b=qm(0).toVar(),T=qm(0).toVar(),S=Xm(0).toVar(),w=Xm(0).toVar(),N=$m(e).toVar(),E=$m(e).toVar(),A=qm(0).toVar(),C=qm(0).toVar();xM(r,({i:t})=>{const i=t.add(1).toVar();Gm(b.equal(0),()=>{S.addAssign(i),N.assign(e.add(_.mul(S)));const r=n(N.xy),a=s(r,l).toVar(),o=s(r,h).toVar();Gm(a.greaterThan(o),()=>{b.assign(1)}),A.assign(t)}),Gm(T.equal(0),()=>{w.addAssign(i),E.assign(e.sub(_.mul(w)));const r=n(E.xy),a=s(r,l).toVar(),o=s(r,h).toVar();Gm(a.greaterThan(o),()=>{T.assign(1)}),C.assign(t)}),Gm(b.equal(1).or(T.equal(1)),()=>{MM()})}),Gm(b.equal(0).and(T.equal(0)),()=>l);const R=Xm(1).toVar(),I=Xm(1).toVar();Gm(b.equal(1),()=>{R.assign(Xm(A).div(Xm(r.sub(1))))}),Gm(T.equal(1),()=>{I.assign(Xm(C).div(Xm(r.sub(1))))});const L=dv(R,I);return L.assign(Mv(L,.5)),L.assign(Xm(1).sub(L)),Av(l,h,L.mul(.5))}).setLayout({name:"FxaaPixelShader",type:"vec4",inputs:[{name:"uv",type:"vec2"},{name:"fxaaQualityRcpFrame",type:"vec2"},{name:"fxaaQualityEdgeThreshold",type:"float"},{name:"fxaaQualityinvEdgeThreshold",type:"float"}]});return Bm(()=>{const e=Xm(.2),n=Xm(1).div(e);return a(t,this._invSize,e,n)})()}}const yE=new fN,_E=new Gi(0,0,0),xE=new Gi,ME=new Wt,bE=new Wt(1,0),TE=new Wt(0,1);class SE extends Kp{static get type(){return"BloomNode"}constructor(e,t=1,n=0,i=0){super(),this.inputNode=e,this.strength=Mf(t),this.radius=Mf(n),this.threshold=Mf(i),this.smoothWidth=Mf(.01),this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new gn(1,1,{type:se}),this._renderTargetBright.texture.name="UnrealBloomPass.bright",this._renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this._nMips;e++){const t=new gn(1,1,{type:se});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this._renderTargetsHorizontal.push(t);const n=new gn(1,1,{type:se});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this._renderTargetsVertical.push(n)}this._compositeMaterial=null,this._highPassFilterMaterial=null,this._separableBlurMaterials=[],this._textureNodeBright=Oy(this._renderTargetBright.texture),this._textureNodeBlur0=Oy(this._renderTargetsVertical[0].texture),this._textureNodeBlur1=Oy(this._renderTargetsVertical[1].texture),this._textureNodeBlur2=Oy(this._renderTargetsVertical[2].texture),this._textureNodeBlur3=Oy(this._renderTargetsVertical[3].texture),this._textureNodeBlur4=Oy(this._renderTargetsVertical[4].texture),this._textureOutput=GN(this,this._renderTargetsHorizontal[0].texture),this.updateBeforeType=Gp.FRAME}getTextureNode(){return this._textureOutput}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this._renderTargetBright.setSize(n,i);for(let e=0;e<this._nMips;e++)this._renderTargetsHorizontal[e].setSize(n,i),this._renderTargetsVertical[e].setSize(n,i),this._separableBlurMaterials[e].invSize.value.set(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(ME);this.setSize(n.width,n.height);const i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(xE);const s=t.getClearAlpha();this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(_E,0),t.setRenderTarget(this._renderTargetBright),yE.material=this._highPassFilterMaterial,yE.render(t);let a=this._renderTargetBright;for(let e=0;e<this._nMips;e++)yE.material=this._separableBlurMaterials[e],this._separableBlurMaterials[e].colorTexture.value=a.texture,this._separableBlurMaterials[e].direction.value=bE,t.setRenderTarget(this._renderTargetsHorizontal[e]),t.clear(),yE.render(t),this._separableBlurMaterials[e].colorTexture.value=this._renderTargetsHorizontal[e].texture,this._separableBlurMaterials[e].direction.value=TE,t.setRenderTarget(this._renderTargetsVertical[e]),t.clear(),yE.render(t),a=this._renderTargetsVertical[e];t.setRenderTarget(this._renderTargetsHorizontal[0]),t.clear(),yE.material=this._compositeMaterial,yE.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(xE,s)}setup(e){const t=Bm(()=>{const e=this.inputNode,t=tE(e.rgb),n=Lv(this.threshold,this.threshold.add(this.smoothWidth),t);return Av(sf(0),e,n)});this._highPassFilterMaterial=this._highPassFilterMaterial||new hb,this._highPassFilterMaterial.fragmentNode=t().context(e.getSharedContext()),this._highPassFilterMaterial.name="Bloom_highPass",this._highPassFilterMaterial.needsUpdate=!0;const n=[3,5,7,9,11];for(let t=0;t<this._nMips;t++)this._separableBlurMaterials.push(this._getSeperableBlurMaterial(e,n[t]));const i=k_([1,.8,.6,.4,.2]),r=k_([new Mn(1,1,1),new Mn(1,1,1),new Mn(1,1,1),new Mn(1,1,1),new Mn(1,1,1)]),s=Bm(([e,t])=>{const n=Xm(1.2).sub(e);return Av(e,n,t)}).setLayout({name:"lerpBloomFactor",type:"float",inputs:[{name:"factor",type:"float"},{name:"radius",type:"float"}]}),a=Bm(()=>
2{const e=s(i.element(0),this.radius).mul(sf(r.element(0),1)).mul(this._textureNodeBlur0),t=s(i.element(1),this.radius).mul(sf(r.element(1),1)).mul(this._textureNodeBlur1),n=s(i.element(2),this.radius).mul(sf(r.element(2),1)).mul(this._textureNodeBlur2),a=s(i.element(3),this.radius).mul(sf(r.element(3),1)).mul(this._textureNodeBlur3),o=s(i.element(4),this.radius).mul(sf(r.element(4),1)).mul(this._textureNodeBlur4);return e.add(t).add(n).add(a).add(o).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new hb,this._compositeMaterial.fragmentNode=a().context(e.getSharedContext()),this._compositeMaterial.name="Bloom_comp",this._compositeMaterial.needsUpdate=!0,this._textureOutput}dispose(){for(let e=0;e<this._renderTargetsHorizontal.length;e++)this._renderTargetsHorizontal[e].dispose();for(let e=0;e<this._renderTargetsVertical.length;e++)this._renderTargetsVertical[e].dispose();this._renderTargetBright.dispose()}_getSeperableBlurMaterial(e,t){const n=[];for(let e=0;e<t;e++)n.push(.39894*Math.exp(-.5*e*e/(t*t))/t);const i=Oy(),r=k_(n),s=Mf(new Wt),a=Mf(new Wt(.5,.5)),o=Ry(),l=e=>i.uv(e),c=Bm(()=>{const e=r.element(0).toVar(),n=l(o).rgb.mul(e).toVar();return xM({start:qm(1),end:qm(t),type:"int",condition:"<"},({i:t})=>{const i=Xm(t),c=r.element(t),u=a.mul(s).mul(i),h=l(o.add(u)).rgb,d=l(o.sub(u)).rgb;n.addAssign(rg(h,d).mul(c)),e.addAssign(Xm(2).mul(c))}),sf(n.div(e),1)}),u=new hb;return u.fragmentNode=c().context(e.getSharedContext()),u.name="Bloom_seperable",u.needsUpdate=!0,u.colorTexture=i,u.direction=a,u.invSize=s,u}}class wE extends Kp{static get type(){return"TransitionNode"}constructor(e,t,n,i,r,s){super(),this.textureNodeA=e,this.textureNodeB=t,this.mixTextureNode=n,this.mixRatioNode=i,this.thresholdNode=r,this.useTextureNode=s}setup(){const{textureNodeA:e,textureNodeB:t,mixTextureNode:n,mixRatioNode:i,thresholdNode:r,useTextureNode:s}=this,a=e=>{const t=e.uvNode||Ry();return e.uv(t)};return Bm(()=>{const o=a(e),l=a(t),c=sf().toVar();return Gm(s.equal(qm(1)),()=>{const e=a(n),t=i.mul(r.mul(2).add(1)).sub(r),s=Cv(sg(e.r,t).mul(Xm(1).div(r)),0,1);c.assign(Av(o,l,s))}).Else(()=>{c.assign(Av(l,o,i))}),c})()}}class NE extends Kp{static get type(){return"PixelationNode"}constructor(e,t,n,i,r,s){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.pixelSize=i,this.normalEdgeStrength=r,this.depthEdgeStrength=s,this._resolution=Mf(new fn),this.updateBeforeType=Gp.RENDER}updateBefore(){const e=this.textureNode.value,t=e.image.width,n=e.image.height;this._resolution.value.set(t,n,1/t,1/n)}setup(){const{textureNode:e,depthNode:t,normalNode:n}=this,i=e.uvNode||Ry(),r=t.uvNode||Ry(),s=n.uvNode||Ry(),a=(e,n)=>t.uv(r.add($m(e,n).mul(this._resolution.zw))).r,o=(e,t)=>n.uv(s.add($m(e,t).mul(this._resolution.zw))).rgb.normalize(),l=(e,t,n,i)=>{const r=a(e,t).sub(n),s=o(e,t),l=ef(1,1,1),c=_v(i.sub(s),l),u=Cv(Lv(-.01,.01,c),0,1),h=Cv(Qg(r.mul(.25).add(.0025)),0,1);return Xm(1).sub(_v(i,s)).mul(h).mul(u)};return Bm(()=>{const t=e.uv(i),n=Tf("float","depth"),r=Tf("vec3","normal");Gm(this.depthEdgeStrength.greaterThan(0).or(this.normalEdgeStrength.greaterThan(0)),()=>{n.assign(a(0,0)),r.assign(o(0,0))});const s=Tf("float","dei");Gm(this.depthEdgeStrength.greaterThan(0),()=>{s.assign((e=>{const t=Tf("float","diff");return t.addAssign(Cv(a(1,0).sub(e))),t.addAssign(Cv(a(-1,0).sub(e))),t.addAssign(Cv(a(0,1).sub(e))),t.addAssign(Cv(a(0,-1).sub(e))),Hg(Lv(.01,.02,t).mul(2)).div(2)})(n))});const c=Tf("float","nei");Gm(this.normalEdgeStrength.greaterThan(0),()=>{c.assign(((e,t)=>{const n=Tf("float","indicator");return n.addAssign(l(0,-1,e,t)),n.addAssign(l(0,1,e,t)),n.addAssign(l(-1,0,e,t)),n.addAssign(l(1,0,e,t)),fv(.1,n)})(n,r))});const u=s.greaterThan(0).select(Xm(1).sub(s.mul(this.depthEdgeStrength)),c.mul(this.normalEdgeStrength).add(1));return t.mul(u)})()}}class EE extends HN{static get type(){return"PixelationPassNode"}constructor(e,t,n=6,i=.3,r=.4){super("color",e,t,{minFilter:X,magFilter:X}),this.pixelSize=n,this.normalEdgeStrength=i,this.depthEdgeStrength=r,this.isPixelationPassNode=!0,this._mrt=Pw({output:Gf,normal:T_})}setSize(e,t){const n=this.pixelSize.value?this.pixelSize.value:this.pixelSize,i=Math.floor(e/n),r=Math.floor(t/n);super.setSize(i,r)}setup(){return((e,t,n,i=6,r=.3,s=.4)=>Um(new NE(_N(e),_N(t),_N(n),Um(i),Um(r),Um(s))))(super.getTextureNode("output"),super.getTextureNode("depth"),super.getTextureNode("normal"),this.pixelSize,this.normalEdgeStrength,this.depthEdgeStrength)}}const AE=new Wt;class CE extends HN{static get type(){return"SSAAPassNode"}constructor(e,t){super(HN.COLOR,e,t),this.isSSAAPassNode=!0,this.sampleLevel=4,this.unbiased=!0,this.clearColor=new Gi(0),this.clearAlpha=0,this._currentClearColor=new Gi,this.sampleWeight=Mf(1),this.sampleRenderTarget=null,this._quadMesh=new fN}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(AE);this.setSize(r.width,r.height),this.sampleRenderTarget.setSize(this.renderTarget.width,this.renderTarget.height),t.getClearColor(this._currentClearColor);const s=t.getClearAlpha(),a=t.getRenderTarget(),o=t.getMRT(),l=t.autoClear;this._cameraNear.value=i.near,this._cameraFar.value=i.far,t.setMRT(this.getMRT()),t.autoClear=!1;const c=RE[Math.max(0,Math.min(this.sampleLevel,5))],u=1/c.length,h={fullWidth:this.renderTarget.width,fullHeight:this.renderTarget.height,offsetX:0,offsetY:0,width:this.renderTarget.width,height:this.renderTarget.height},d=Object.assign({},i.view);d.enabled&&Object.assign(h,d);for(let e=0;e<c.length;e++){const r=c[e];
2if(i.setViewOffset&&i.setViewOffset(h.fullWidth,h.fullHeight,h.offsetX+.0625*r[0],h.offsetY+.0625*r[1],h.width,h.height),this.sampleWeight.value=u,this.unbiased){const t=(e+.5)/c.length-.5;this.sampleWeight.value+=.03125*t}t.setClearColor(this.clearColor,this.clearAlpha),t.setRenderTarget(this.sampleRenderTarget),t.clear(),t.render(n,i),t.setRenderTarget(this.renderTarget),0===e&&(t.setClearColor(0,0),t.clear()),this._quadMesh.render(t)}t.copyTextureToTexture(this.sampleRenderTarget.depthTexture,this.renderTarget.depthTexture),i.setViewOffset&&d.enabled?i.setViewOffset(d.fullWidth,d.fullHeight,d.offsetX,d.offsetY,d.width,d.height):i.clearViewOffset&&i.clearViewOffset(),t.setRenderTarget(a),t.setMRT(o),t.autoClear=l,t.setClearColor(this._currentClearColor,s)}setup(e){let t;null===this.sampleRenderTarget&&(this.sampleRenderTarget=this.renderTarget.clone());const n=this.getMRT();if(null!==n){const e={};for(const t in n.outputNodes){const n=Iw(this.sampleRenderTarget.textures,t);n>=0&&(e[t]=Oy(this.sampleRenderTarget.textures[n]).mul(this.sampleWeight))}t=Pw(e)}else t=Oy(this.sampleRenderTarget.texture).mul(this.sampleWeight);return this._quadMesh.material=new hb,this._quadMesh.material.fragmentNode=t,this._quadMesh.material.transparent=!0,this._quadMesh.material.depthTest=!1,this._quadMesh.material.depthWrite=!1,this._quadMesh.material.premultipliedAlpha=!0,this._quadMesh.material.blending=2,this._quadMesh.material.normals=!1,this._quadMesh.material.name="SSAA",super.setup(e)}dispose(){super.dispose(),null!==this.sampleRenderTarget&&this.sampleRenderTarget.dispose()}}const RE=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],IE=new Wt;class LE extends HN{static get type(){return"StereoPassNode"}constructor(e,t){super(HN.COLOR,e,t),this.isStereoPassNode=!0,this.stereo=new _d,this.stereo.aspect=.5}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i,stereo:r,renderTarget:s}=this;this._pixelRatio=t.getPixelRatio(),r.cameraL.coordinateSystem=t.coordinateSystem,r.cameraR.coordinateSystem=t.coordinateSystem,r.update(i);const a=t.getSize(IE);this.setSize(a.width,a.height);const o=t.autoClear;t.autoClear=!1;const l=t.getRenderTarget(),c=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const e in this._previousTextures)this.toggleTexture(e);t.setRenderTarget(s),t.setMRT(this._mrt),t.clear(),s.scissorTest=!0,s.scissor.set(0,0,s.width/2,s.height),s.viewport.set(0,0,s.width/2,s.height),t.render(n,r.cameraL),s.scissor.set(s.width/2,0,s.width/2,s.height),s.viewport.set(s.width/2,0,s.width/2,s.height),t.render(n,r.cameraR),s.scissorTest=!1,t.setRenderTarget(l),t.setMRT(c),t.autoClear=o}}const PE=new Wt,DE=new fN;class UE extends HN{static get type(){return"StereoCompositePassNode"}constructor(e,t){super(HN.COLOR,e,t),this.isStereoCompositePassNode=!0,this.stereo=new _d;const n={minFilter:Z,magFilter:X,type:se};this._renderTargetL=new gn(1,1,n),this._renderTargetR=new gn(1,1,n),this._mapLeft=Oy(this._renderTargetL.texture),this._mapRight=Oy(this._renderTargetR.texture),this._material=null}updateStereoCamera(e){this.stereo.cameraL.coordinateSystem=e,this.stereo.cameraR.coordinateSystem=e,this.stereo.update(this.camera)}setSize(e,t){super.setSize(e,t),this._renderTargetL.setSize(this.renderTarget.width,this.renderTarget.height),this._renderTargetR.setSize(this.renderTarget.width,this.renderTarget.height)}updateBefore(e){const{renderer:t}=e,{scene:n,stereo:i,renderTarget:r}=this;this._pixelRatio=t.getPixelRatio(),this.updateStereoCamera(t.coordinateSystem);const s=t.getSize(PE);this.setSize(s.width,s.height);const a=t.getRenderTarget();t.setRenderTarget(this._renderTargetL),t.render(n,i.cameraL),t.setRenderTarget(this._renderTargetR),t.render(n,i.cameraR),t.setRenderTarget(r),DE.material=this._material,DE.render(t),t.setRenderTarget(a)}dispose(){super.dispose(),this._renderTargetL.dispose(),this._renderTargetR.dispose(),null!==this._material&&this._material.dispose()}}class OE extends UE{static get type(){return"AnaglyphPassNode"}constructor(e,t){super(e,t),this.isAnaglyphPassNode=!0,this._colorMatrixLeft=Mf((new jt).fromArray([.4561,-.0400822,-.0152161,.500484,-.0378246,-.0205971,.176381,-.0157589,-.00546856])),this._colorMatrixRight=Mf((new jt).fromArray([-.0434706,.378476,-.0721527,-.0879388,.73364,-.112961,-.00155529,-.0184503,1.2264]))}setup(e){const t=Ry(),n=Bm(()=>{const e=this._mapLeft.uv(t),n=this._mapRight.uv(t),i=Cv(this._colorMatrixLeft.mul(e.rgb).add(this._colorMatrixRight.mul(n.rgb)));return sf(i.rgb,pv(e.a,n.a))}),i=this._material||(this._material=new hb);return i.fragmentNode=n().context(e.getSharedContext()),i.name="Anaglyph",i.needsUpdate=!0,super.setup(e)}}class VE extends UE{static get type(){return"ParallaxBarrierPassNode"}constructor(e,t){super(e,t),this.isParallaxBarrierPassNode=!0}setup(e){const t=Ry(),n=Bm(()=>{const e=sf().toVar();return Gm(mv(kM.y,2).greaterThan(1),()=>{e.assign(this._mapLeft.uv(t))}).Else(()=>{e.assign(this._mapRight.uv(t))}),e}),i=this._material||(this._material=new hb);return i.fragmentNode=n().context(e.getSharedContext()),i.needsUpdate=!0,super.setup(e)}}class FE extends HN{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,r){super(HN.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((e,n,i,r,s,a,o)=>
vendor: 13,659 bytes, line 2
2{if((s.isMeshToonMaterial||s.isMeshToonNodeMaterial)&&!1===s.wireframe){const l=this._getOutlineMaterial(s);t.renderObject(e,n,i,r,l,a,o)}t.renderObject(e,n,i,r,s,a,o)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new hb;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=1;const t=M_.negate(),n=ky.mul(o_),i=Xm(1),r=n.mul(sf(h_,1)),s=n.mul(sf(h_.add(t),1)),a=Wg(r.sub(s));return e.vertexNode=r.add(a.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=sf(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}class zE extends Zp{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outpuType=null,this.events=new Lt,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return null!==this.outputType}set value(e){this._value!==e&&(this._cache&&"URL"===this.inputType&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&null===this._cache&&"URL"===this.inputType&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&null!==e.value&&void 0!==e.value&&(("URL"===this.inputType||"String"===this.inputType)&&"string"==typeof e.value||"Number"===this.inputType&&"number"==typeof e.value||"Vector2"===this.inputType&&e.value.isVector2||"Vector3"===this.inputType&&e.value.isVector3||"Vector4"===this.inputType&&e.value.isVector4||"Color"===this.inputType&&e.value.isColor||"Matrix3"===this.inputType&&e.value.isMatrix3||"Matrix4"===this.inputType&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:Xm()}serialize(e){super.serialize(e),null!==this.value?"ArrayBuffer"===this.inputType?e.value=zp(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;null!==e.value&&(t="ArrayBuffer"===e.inputType?Bp(e.value):"Texture"===e.inputType?e.meta.textures[e.value]:e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const BE=Fm(zE);class kE extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(null!==t){const i=t(...n);return this.set(e,i),i}}}class HE{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const GE=new kE;class WE extends Zp{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new kE,this._output=BE(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return void 0===n[e]?n[e]=BE(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):void 0===n[e]?(n[e]=BE(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const n=this.getObject()[e];if("function"==typeof n)return n(...t)}async callAsync(e,...t){const n=this.getObject()[e];if("function"==typeof n)return"AsyncFunction"===n.constructor.name?await n(...t):n(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){null!==e?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),null!==this._object)return this._object;const e=new HE(this),t=GE.get("THREE"),n=GE.get("TSL"),i=this.getMethod(this.codeNode),r=[e,this._local,GE,()=>this.refresh(),(e,t)=>this.setOutput(e,t),t,n];this._object=i(...r);const s=this._object.layout;if(s&&(!1===s.cache&&this._local.clear(),this._output.outputType=s.outputType||null,Array.isArray(s.elements)))for(const e of s.elements){const t=e.id||e.name;e.inputType&&(void 0===this.getParameter(t)&&this.setParameter(t,null),this.getParameter(t).inputType=e.inputType),e.outputType&&(void 0===this.getOutput(t)&&this.setOutput(t,null),this.getOutput(t).outputType=e.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const e in this.parameters){let t=this.parameters[e];t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:Xm()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),null!==this._method)return this._method;const e=["layout","init","main","dispose"].join(", "),t="\nreturn { ...output, "+e+" };",n="var "+e+"; var output = {};\n"+this.codeNode.code+t;return this._method=new Function(...["parameters","local","global","refresh","setOutput","THREE","TSL"],n),this._method}dispose(){null!==this._method&&(this._object&&"function"==typeof this._object.dispose&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[Lp(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Pp(t)}set needsUpdate(e){!0===e&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return null===this.codeNode||(!0===this._needsOutputUpdate&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value),this}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const jE=Fm(WE);class XE extends Zp{static get type(){return"FogNode"}constructor(e,t){super("float"),this.isFogNode=!0,this.colorNode=e,this.factorNode=t}getViewZNode(e){let t;const n=e.context.getViewZ;return void 0!==n&&(t=n(this)),(t||f_.z).negate()}setup(){return this.factorNode}}const qE=Fm(XE);class YE extends XE{static get type(){return"FogRangeNode"}constructor(e,t,n){super(e),this.isFogRangeNode=!0,this.nearNode=t,this.farNode=n}setup(e){const t=this.getViewZNode(e);return Lv(this.nearNode,this.farNode,t)}}const ZE=Fm(YE);class $E extends XE{static get type(){return"FogExp2Node"}constructor(e,t){super(e),this.isFogExp2Node=!0,this.densityNode=t}setup(e){const t=this.getViewZNode(e),n=this.densityNode;return n.mul(n,t,t).negate().exp().oneMinus()}}const JE=Fm($E);let KE=null,QE=null;class eA extends Zp{static get type(){return"RangeNode"}constructor(e=Xm(),t=Xm()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Vp(this.minNode.value)),n=e.getTypeLength(Vp(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.minNode.value,r=this.maxNode.value,s=e.getTypeLength(Vp(i)),a=e.getTypeLength(Vp(r));KE=KE||new fn,QE=QE||new fn,KE.setScalar(0),QE.setScalar(0),1===s?KE.setScalar(i):i.isColor?KE.set(i.r,i.g,i.b):KE.set(i.x,i.y,i.z||0,i.w||0),1===a?QE.setScalar(r):r.isColor?QE.set(r.r,r.g,r.b):QE.set(r.x,r.y,r.z||0,r.w||0);const o=4,l=o*t.count,c=new Float32Array(l);for(let e=0;e<l;e++){const t=e%o,n=KE.getComponent(t),i=QE.getComponent(t);c[e]=Gt.lerp(n,i,Math.random())}const u=this.getNodeType(e);if(t.count<=4096)n=F_(c,"vec4",t.count).element(oM).convert(u);else{const t=new Cl(c,4);e.geometry.setAttribute("__range"+this.id,t),n=dy(t).convert(u)}}else n=Xm(0);return n}}const tA=Fm(eA),nA=Bm(({depthTexture:e,shadowCoord:t})=>Oy(e,t.xy).compare(t.z)),iA=Bm(({depthTexture:e,shadowCoord:t,shadow:n})=>{const i=(t,n)=>Oy(e,t).compare(n),r=W_("mapSize","vec2",n).setGroup(yf),s=W_("radius","float",n).setGroup(yf),a=$m(1).div(r),o=a.x.negate().mul(s),l=a.y.negate().mul(s),c=a.x.mul(s),u=a.y.mul(s),h=o.div(2),d=l.div(2),p=c.div(2),m=u.div(2);return rg(i(t.xy.add($m(o,l)),t.z),i(t.xy.add($m(0,l)),t.z),i(t.xy.add($m(c,l)),t.z),i(t.xy.add($m(h,d)),t.z),i(t.xy.add($m(0,d)),t.z),i(t.xy.add($m(p,d)),t.z),i(t.xy.add($m(o,0)),t.z),i(t.xy.add($m(h,0)),t.z),i(t.xy,t.z),i(t.xy.add($m(p,0)),t.z),i(t.xy.add($m(c,0)),t.z),i(t.xy.add($m(h,m)),t.z),i(t.xy.add($m(0,m)),t.z),i(t.xy.add($m(p,m)),t.z),i(t.xy.add($m(o,u)),t.z),i(t.xy.add($m(0,u)),t.z),i(t.xy.add($m(c,u)),t.z)).mul(1/17)}),rA=Bm(({depthTexture:e,shadowCoord:t,shadow:n})=>{const i=(t,n)=>Oy(e,t).compare(n),r=W_("mapSize","vec2",n).setGroup(yf),s=$m(1).div(r),a=s.x,o=s.y,l=t.xy,c=jg(l.mul(r).add(.5));return l.subAssign(c.mul(s)),rg(i(l,t.z),i(l.add($m(a,0)),t.z),i(l.add($m(0,o)),t.z),i(l.add(s),t.z),Av(i(l.add($m(a.negate(),0)),t.z),i(l.add($m(a.mul(2),0)),t.z),c.x),Av(i(l.add($m(a.negate(),o)),t.z),i(l.add($m(a.mul(2),o)),t.z),c.x),Av(i(l.add($m(0,o.negate())),t.z),i(l.add($m(0,o.mul(2))),t.z),c.y),Av(i(l.add($m(a,o.negate())),t.z),i(l.add($m(a,o.mul(2))),t.z),c.y),Av(Av(i(l.add($m(a.negate(),o.negate())),t.z),i(l.add($m(a.mul(2),o.negate())),t.z),c.x),Av(i(l.add($m(a.negate(),o.mul(2))),t.z),i(l.add($m(a.mul(2),o.mul(2))),t.z),c.x),c.y)).mul(1/9)}),sA=Bm(({depthTexture:e,shadowCoord:t})=>{const n=Xm(1).toVar(),i=Oy(e).uv(t.xy).rg,r=fv(t.z,i.x);return Gm(r.notEqual(Xm(1)),()=>{const e=t.z.sub(i.x),s=pv(0,i.y.mul(i.y));let a=s.div(s.add(e.mul(e)));a=Cv(sg(a,.3).div(.95-.3)),n.assign(Cv(pv(r,a)))}),n}),aA=Bm(({samples:e,radius:t,size:n,shadowPass:i})=>{const r=Xm(0).toVar(),s=Xm(0).toVar(),a=e.lessThanEqual(Xm(1)).select(Xm(0),Xm(2).div(e.sub(1))),o=e.lessThanEqual(Xm(1)).select(Xm(0),Xm(-1));xM({start:qm(0),end:qm(e),type:"int",condition:"<"},({i:e})=>{const l=o.add(Xm(e).mul(a)),c=i.uv(rg(kM.xy,$m(0,l).mul(t)).div(n)).x;r.addAssign(c),s.addAssign(c.mul(c))}),r.divAssign(e),s.divAssign(e);const l=Bg(s.sub(r.mul(r)));return $m(r,l)}),oA=Bm(({samples:e,radius:t,size:n,shadowPass:i})=>{const r=Xm(0).toVar(),s=Xm(0).toVar(),a=e.lessThanEqual(Xm(1)).select(Xm(0),Xm(2).div(e.sub(1))),o=e.lessThanEqual(Xm(1)).select(Xm(0),Xm(-1));xM({start:qm(0),end:qm(e),type:"int",condition:"<"},({i:e})=>{const l=o.add(Xm(e).mul(a)),c=i.uv(rg(kM.xy,$m(l,0).mul(t)).div(n));r.addAssign(c.x),s.addAssign(rg(c.y.mul(c.y),c.x.mul(c.x)))}),r.divAssign(e),s.divAssign(e);const l=Bg(s.sub(r.mul(r)));return $m(r,l)}),lA=[nA,iA,rA,sA];let cA=null;const uA=new fN;class hA extends IM{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.updateType=Gp.FRAME,this.light=e,this.color=new Gi,this.colorNode=Mf(this.color).setGroup(yf),this.baseColorNode=null,this.shadowMap=null,this.shadowNode=null,this.shadowColorNode=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this.isAnalyticLightNode=!0}getCacheKey(){return Dp(super.getCacheKey(),this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadow(e){const{object:t,renderer:n}=e;if(!1===n.shadowMap.enabled)return;let i=this.shadowColorNode;if(null===i){null===cA&&(cA=new hb,cA.fragmentNode=sf(0,0,0,1),cA.isShadowNodeMaterial=!0,cA.name="ShadowMaterial");const r=n.shadowMap.type,s=this.light.shadow,a=new Os;a.compareFunction=513;const o=e.createRenderTarget(s.mapSize.width,s.mapSize.height);if(o.depthTexture=a,s.camera.updateProjectionMatrix(),3===r){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:xe,type:se}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:xe,type:se});const t=Oy(a),n=Oy(this.vsmShadowMapVertical.texture),i=W_("blurSamples","float",s).setGroup(yf),r=W_("radius","float",s).setGroup(yf),o=W_("mapSize","vec2",s).setGroup(yf);let l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new hb);l.fragmentNode=aA({samples:i,radius:r,size:o,shadowPass:t}).context(e.getSharedContext()),l.name="VSMVertical",l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new hb),l.fragmentNode=oA({samples:i,radius:r,size:o,shadowPass:n}).context(e.getSharedContext()),l.name="VSMHorizontal"}const l=W_("intensity","float",s).setGroup(yf),c=W_("bias","float",s).setGroup(yf),u=W_("normalBias","float",s).setGroup(yf),h=t.material.shadowPositionNode||p_;
2let d=Mf(s.matrix).setGroup(yf).mul(h.add(S_.mul(u)));d=d.xyz.div(d.w);let p=d.z.add(c);n.coordinateSystem===It&&(p=p.mul(2).sub(1)),d=ef(d.x,d.y.oneMinus(),p);const m=d.x.greaterThanEqual(0).and(d.x.lessThanEqual(1)).and(d.y.greaterThanEqual(0)).and(d.y.lessThanEqual(1)).and(d.z.lessThanEqual(1)),f=s.filterNode||lA[n.shadowMap.type]||null;if(null===f)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const g=Oy(o.texture,d),v=m.select(f({depthTexture:3===r?this.vsmShadowMapHorizontal.texture:a,shadowCoord:d,shadow:s}),Xm(1));this.shadowMap=o,this.light.shadow.map=o,this.shadowNode=v,this.shadowColorNode=i=this.colorNode.mul(Av(1,v.rgb.mix(g,1),l.mul(g.a))),this.baseColorNode=this.colorNode}this.colorNode=i,this.updateBeforeType=Gp.RENDER}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&this.disposeShadow()}updateShadow(e){const{shadowMap:t,light:n}=this,{renderer:i,scene:r,camera:s}=e,a=i.shadowMap.type,o=t.depthTexture.version;this._depthVersionCached=o;const l=r.overrideMaterial;r.overrideMaterial=cA,t.setSize(n.shadow.mapSize.width,n.shadow.mapSize.height),n.shadow.updateMatrices(n),n.shadow.camera.layers.mask=s.layers.mask;const c=i.getRenderTarget(),u=i.getRenderObjectFunction();i.setRenderObjectFunction((e,...t)=>{(!0===e.castShadow||e.receiveShadow&&3===a)&&i.renderObject(e,...t)}),i.setRenderTarget(t),i.render(r,n.shadow.camera),i.setRenderObjectFunction(u),!0!==n.isPointLight&&3===a&&this.vsmPass(e,n),i.setRenderTarget(c),r.overrideMaterial=l}vsmPass(e,t){const{renderer:n}=e;this.vsmShadowMapVertical.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),n.setRenderTarget(this.vsmShadowMapVertical),uA.material=this.vsmMaterialVertical,uA.render(n),n.setRenderTarget(this.vsmShadowMapHorizontal),uA.material=this.vsmMaterialHorizontal,uA.render(n)}disposeShadow(){this.shadowMap.dispose(),this.shadowMap=null,null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),this.shadowNode=null,this.shadowColorNode=null,this.baseColorNode=null,this.updateBeforeType=Gp.NONE}updateBefore(e){const t=this.light.shadow;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const dA=Bm(e=>{const{lightDistance:t,cutoffDistance:n,decayExponent:i}=e,r=t.pow(i).max(.01).reciprocal();return n.greaterThan(0).select(r.mul(t.div(n).pow4().oneMinus().clamp().pow2()),r)});let pA;function mA(e){pA=pA||new WeakMap;let t=pA.get(e);return void 0===t&&pA.set(e,t={}),t}function fA(e){const t=mA(e);return t.position||(t.position=Mf(new Mn).setGroup(yf).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.matrixWorld)))}function gA(e){const t=mA(e);return t.targetPosition||(t.targetPosition=Mf(new Mn).setGroup(yf).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.target.matrixWorld)))}function vA(e){const t=mA(e);return t.viewPosition||(t.viewPosition=Mf(new Mn).setGroup(yf).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new Mn,n.value.setFromMatrixPosition(e.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const yA=e=>Gy.transformDirection(fA(e).sub(gA(e))),_A=Bm(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),n=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return n.shiftRight(22).bitXor(n).toFloat().mul(1/2**32)}),xA=(e,t)=>Mv(ag(4,e.mul(sg(1,e))),t),MA=Bm(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),bA=Bm(([e])=>ef(MA(e.z.add(MA(e.y.mul(1)))),MA(e.z.add(MA(e.x.mul(1)))),MA(e.y.add(MA(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",input
vendor: 10,236 bytes, line 2
2s:[{name:"p",type:"vec3"}]}),TA=Bm(([e,t,n])=>{const i=ef(e).toVar(),r=Xm(1.4).toVar(),s=Xm(0).toVar(),a=ef(i).toVar();return xM({start:Xm(0),end:Xm(3),type:"float",condition:"<="},()=>{const e=ef(bA(a.mul(2))).toVar();i.addAssign(e.add(n.mul(Xm(.1).mul(t)))),a.mulAssign(1.8),r.mulAssign(1.5),i.mulAssign(1.2);const o=Xm(MA(i.z.add(MA(i.x.add(MA(i.y)))))).toVar();s.addAssign(o.div(r)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"p",type:"vec3"},{name:"spd",type:"float"},{name:"time",type:"float"}]}),SA=Bm(([e,t,n=$m(.5)])=>mS(e.sub(n),t).add(n)),wA=Bm(([e,t,n=$m(.5)])=>{const i=e.sub(n),r=i.dot(i),s=r.mul(r).mul(t);return e.add(i.mul(s))}),NA=Bm(({position:e=null,horizontal:t=!0,vertical:n=!1})=>{let i;null!==e?(i=t_.toVar(),i[3][0]=e.x,i[3][1]=e.y,i[3][2]=e.z):i=t_;const r=Gy.mul(i);return Lm(t)&&(r[0][0]=t_[0].length(),r[0][1]=0,r[0][2]=0),Lm(n)&&(r[1][0]=0,r[1][1]=t_[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,ky.mul(r).mul(h_)}),EA=Bm(([e=null])=>{const t=lb();return lb(tb(e)).sub(t).lessThan(0).select(zM,e)}),AA=new WeakMap;class CA extends Kp{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.updateType=Gp.OBJECT,this.updateAfterType=Gp.OBJECT,this.previousModelWorldMatrix=Mf(new Jn),this.previousProjectionMatrix=Mf(new Jn).setGroup(yf),this.previousCameraViewMatrix=Mf(new Jn)}update({frameId:e,camera:t,object:n}){const i=IA(n);this.previousModelWorldMatrix.value.copy(i);const r=RA(t);r.frameId!==e&&(r.frameId=e,void 0===r.previousProjectionMatrix?(r.previousProjectionMatrix=new Jn,r.previousCameraViewMatrix=new Jn,r.currentProjectionMatrix=new Jn,r.currentCameraViewMatrix=new Jn,r.previousProjectionMatrix.copy(t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){IA(e).copy(e.matrixWorld)}setup(){const e=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),t=ky.mul(o_).mul(h_),n=this.previousProjectionMatrix.mul(e).mul(d_),i=t.xy.div(t.w),r=n.xy.div(n.w);return sg(i,r)}}function RA(e){let t=AA.get(e);return void 0===t&&(t={},AA.set(e,t)),t}function IA(e,t=0){const n=RA(e);let i=n[t];return void 0===i&&(n[t]=i=new Jn),i}const LA=zm(CA),PA=Bm(([e,t])=>dv(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"burnBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),DA=Bm(([e,t])=>dv(e.div(t.oneMinus()),1)).setLayout({name:"dodgeBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UA=Bm(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"screenBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),OA=Bm(([e,t])=>Av(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),fv(.5,e))).setLayout({name:"overlayBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),VA=Bm(([e,t,n=qm(16)])=>{const i=t=>e.uv(t),r=Ry(),s=i(r).toVar(),a=Xm(n);return xM({start:qm(1),end:n,type:"int",condition:"<="},({i:e})=>{const n=t.mul(Xm(e).div(a.sub(1)).sub(.5));s.addAssign(i(r.add(n)))}),s.divAssign(a),s}),FA=Bm(([e,t=1])=>{const n=e,i=tE(n.rgb),r=ef(i),s=dv(1,pv(0,Xm(10).mul(i.sub(.45)))),a=r.mul(n.rgb).mul(2),o=Xm(2).mul(r.oneMinus()).mul(n.rgb.oneMinus()).oneMinus(),l=Av(a,o,s),c=n.a.mul(t),u=c.mul(l.rgb);return u.addAssign(n.rgb.mul(c.oneMinus())),sf(u,n.a)}),zA=Bm(([e])=>{const t=ef(e);return sf(_v(t,ef(.393,.769,.189)),_v(t,ef(.349,.686,.168)),_v(t,ef(.272,.534,.131)),e.a)}),BA=Bm(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),n=e.mul(.0773993808),i=e.lessThanEqual(.04045);return Av(t,n,i)}).setLayout({name:"sRGBToLinearSRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),kA=Bm(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),n=e.mul(12.92),i=e.lessThanEqual(.0031308);return Av(t,n,i)}).setLayout({name:"linearSRGBTosRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),HA=Bm(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),GA=Bm(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),WA=Bm(([e,t])=>{const n=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),i=e.mul(e.mul(6.2).add(1.7)).add(.06);return n.div(i).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),jA=Bm(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),n=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(n)}),XA=Bm(([e,t])=>{const n=uf(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),i=uf(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=n.mul(e),e=jA(e),(e=i.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),qA=uf(ef(1.6605,-.1246,-.0182),ef(-.5876,1.1329,-.1006),ef(-.0728,-.0083,1.1187)),YA=uf(ef(.6274,.0691,.0164),ef(.3293,.9195,.088),ef(.0433,.0113,.8956)),ZA=Bm(([e])=>{const t=ef(e).toVar(),n=ef(t.mul(t)).toVar(),i=ef(n.mul(n)).toVar();return Xm(15.5).mul(i.mul(n)).sub(ag(40.14,i.mul(t))).add(ag(31.96,i).sub(ag(6.868,n.mul(t))).add(ag(.4298,n).add(ag(.1191,t).sub(.00232))))}),$A=Bm(([e,t])=>{const n=ef(e).toVar(),i=uf(ef(.856627153315983,.137318972929847,.11189821299995),ef(.0951212405381588,.761241990602591,.0767994186031903),ef(.0482516061458583,.101439036467562,.811302368396859)),r=uf(ef(1.1271005818144368,-.1413297634984383,-.14132976349843826),ef(-.11060664309660323,1.157823702216272,-.11060664309660294),ef(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=Xm(-12.47393),a=Xm(4.026069);return n.mulAssign(t),n.assign(YA.mul(n)),n.assign(i.mul(n)),n.assign(pv(n,1e-10)),n.assign(zg(n)),n.assign(n.sub(s).div(a.sub(s))),n.assign(Cv(n,0,1)),n.assign(ZA(n)),n.assign(r.mul(n)),n.assign(Mv(pv(ef(0),n),ef(2.2))),n.assign(qA.mul(n)),n.assign(Cv(n,0,1)),n}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JA=Bm(([e,t])=>{const n=Xm(.76),i=Xm(.15);e=e.mul(t);const r=dv(e.r,dv(e.g,e.b)),s=Fv(r.lessThan(.08),r.sub(ag(6.25,r.mul(r))),.04);e.subAssign(s);const a=pv(e.r,pv(e.g,e.b));Gm(a.lessThan(n),()=>e);const o=sg(1,n),l=sg(1,o.mul(o).div(a.add(o.sub(n))));e.mulAssign(l.div(a));const c=sg(1,og(1,i.mul(a.sub(l)).add(1)));return Av(e,ef(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class KA extends Zp{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),i=this.getNodeType(e);return"compute"===e.shaderStage?e.format(n,i,t):(console.warn(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const QA=(e,t)=>Um(new KA(e,t)),eC=QA("numWorkgroups","uvec3"),tC=QA("workgroupId","uvec3"),nC=QA("localId","uvec3"),iC=QA("subgroupSize","uint");const rC=Fm(class extends Zp{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;!0===n.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}});class sC extends $p{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),!0!==i){const i=this.getNodeType(e);n=e.format(n,i,t)}return n}}class aC extends Zp{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.scope=e}label(e){return this.name=e,this}getHash(){return this.uuid}setScope(e){return this.scope=e,this}getInputType(){return`${this.scope}Array`}element(e){return Um(new sC(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class oC extends Kp{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),i=this.getInputType(e),r=this.pointerNode,s=this.valueNode,a=[];a.push(`&${r.build(e,i)}`),a.push(s.build(e,i));const o=`${e.getMethod(t,n)}( ${a.join(", ")} )`;if(null!==this.storeNode){const t=this.storeNode.build(e,i);e.addLineFlowCode(`${t} = ${o}`,this)}else e.addLineFlowCode(o,this)}}oC.ATOMIC_LOAD="atomicLoad",oC.ATOMIC_STORE="atomicStore",oC.ATOMIC_ADD="atomicAdd",oC.ATOMIC_SUB="atomicSub",oC.ATOMIC_MAX="atomicMax",oC.ATOMIC_MIN="atomicMin",oC.ATOMIC_AND="atomicAnd",oC.ATOMIC_OR="atomicOr",oC.ATOMIC_XOR="atomicXor";const lC=Fm(oC),cC=(e,t,n,i)=>{const r=lC(e,t,n,i);return r.append(),r},uC=Bm(([e=Ry()])=>{const t=e.mul(2),n=t.x.floor(),i=t.y.floor();return n.add(i).mod(2).sign()}),hC=Bm(([e,t,n])=>{const i=Xm(n).toVar(),r=Xm(t).toVar(),s=Zm(e).toVar();return Fv(s,r,i)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),dC=Bm(([e,t])=>{const n=Zm(t).toVar(),i=Xm(e).toVar();return Fv(n,i.negate(),i)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),pC=Bm(([e])=>{const t=Xm(e).toVar();return qm(Hg(t))}
vendor: 4,305 bytes, line 2
2).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),mC=Bm(([e,t])=>{const n=Xm(e).toVar();return t.assign(pC(n)),n.sub(Xm(t))}),fC=Ow([Bm(([e,t,n,i,r,s])=>{const a=Xm(s).toVar(),o=Xm(r).toVar(),l=Xm(i).toVar(),c=Xm(n).toVar(),u=Xm(t).toVar(),h=Xm(e).toVar(),d=Xm(sg(1,o)).toVar();return sg(1,a).mul(h.mul(d).add(u.mul(o))).add(a.mul(c.mul(d).add(l.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Bm(([e,t,n,i,r,s])=>{const a=Xm(s).toVar(),o=Xm(r).toVar(),l=ef(i).toVar(),c=ef(n).toVar(),u=ef(t).toVar(),h=ef(e).toVar(),d=Xm(sg(1,o)).toVar();return sg(1,a).mul(h.mul(d).add(u.mul(o))).add(a.mul(c.mul(d).add(l.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),gC=Ow([Bm(([e,t,n,i,r,s,a,o,l,c,u])=>{const h=Xm(u).toVar(),d=Xm(c).toVar(),p=Xm(l).toVar(),m=Xm(o).toVar(),f=Xm(a).toVar(),g=Xm(s).toVar(),v=Xm(r).toVar(),y=Xm(i).toVar(),_=Xm(n).toVar(),x=Xm(t).toVar(),M=Xm(e).toVar(),b=Xm(sg(1,p)).toVar(),T=Xm(sg(1,d)).toVar();return Xm(sg(1,h)).toVar().mul(T.mul(M.mul(b).add(x.mul(p))).add(d.mul(_.mul(b).add(y.mul(p))))).add(h.mul(T.mul(v.mul(b).add(g.mul(p))).add(d.mul(f.mul(b).add(m.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Bm(([e,t,n,i,r,s,a,o,l,c,u])=>{const h=Xm(u).toVar(),d=Xm(c).toVar(),p=Xm(l).toVar(),m=ef(o).toVar(),f=ef(a).toVar(),g=ef(s).toVar(),v=ef(r).toVar(),y=ef(i).toVar(),_=ef(n).toVar(),x=ef(t).toVar(),M=ef(e).toVar(),b=Xm(sg(1,p)).toVar(),T=Xm(sg(1,d)).toVar();return Xm(sg(1,h)).toVar().mul(T.mul(M.mul(b).add(x.mul(p))).add(d.mul(_.mul(b).add(y.mul(p))))).add(h.mul(T.mul(v.mul(b).add(g.mul(p))).add(d.mul(f.mul(b).add(m.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),vC=Ow([Bm(([e,t,n])=>{const i=Xm(n).toVar(),r=Xm(t).toVar(),s=Ym(e).toVar(),a=Ym(s.bitAnd(Ym(7))).toVar(),o=Xm(hC(a.lessThan(Ym(4)),r,i)).toVar(),l=Xm(ag(2,hC(a.lessThan(Ym(4)),i,r))).toVar();return dC(o,Zm(a.bitAnd(Ym(1)))).add(dC(l,Zm(a.bitAnd(Ym(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=Xm(t).toVar(),o=Ym(e).toVar(),l=Ym(o.bitAnd(Ym(15))).toVar(),c=Xm(hC(l.lessThan(Ym(8)),a,s)).toVar(),u=Xm(hC(l.lessThan(Ym(4)),s,hC(l.equal(Ym(12)).or(l.equal(Ym(14))),a,r))).toVar();return dC(c,Zm(l.bitAnd(Ym(1)))).add(dC(u,Zm(l.bitAnd(Ym(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]})]),yC=Ow([Bm(([e,t,n])=>{const i=Xm(n).toVar(),r=Xm(t).toVar(),s=nf(e).toVar();return ef(vC(s.x,r,i),vC(s.y,r,i),vC(s.z,r,i))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=Xm(t).toVar(),o=nf(e).toVar();return ef(vC(o.x,a,s,r),vC(o.y,a,s,r),vC(o.z,a,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]})]),_C=Bm(([e])=>{const t=Xm(e).toVar();return ag(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),xC=Bm(([e])=>{const t=Xm(e).toVar();return ag(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),MC=Ow([_C,Bm(([e])=>{const t=ef(e).toVar();return ag(.6616,t)}
vendor: 8,082 bytes, line 2
2).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),bC=Ow([xC,Bm(([e])=>{const t=ef(e).toVar();return ag(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),TC=Bm(([e,t])=>{const n=qm(t).toVar(),i=Ym(e).toVar();return i.shiftLeft(n).bitOr(i.shiftRight(qm(32).sub(n)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),SC=Bm(([e,t,n])=>{e.subAssign(n),e.bitXorAssign(TC(n,qm(4))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(TC(e,qm(6))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(TC(t,qm(8))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(TC(n,qm(16))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(TC(e,qm(19))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(TC(t,qm(4))),t.addAssign(e)}),wC=Bm(([e,t,n])=>{const i=Ym(n).toVar(),r=Ym(t).toVar(),s=Ym(e).toVar();return i.bitXorAssign(r),i.subAssign(TC(r,qm(14))),s.bitXorAssign(i),s.subAssign(TC(i,qm(11))),r.bitXorAssign(s),r.subAssign(TC(s,qm(25))),i.bitXorAssign(r),i.subAssign(TC(r,qm(16))),s.bitXorAssign(i),s.subAssign(TC(i,qm(4))),r.bitXorAssign(s),r.subAssign(TC(s,qm(14))),i.bitXorAssign(r),i.subAssign(TC(r,qm(24))),i}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),NC=Bm(([e])=>{const t=Ym(e).toVar();return Xm(t).div(Xm(Ym(qm(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),EC=Bm(([e])=>{const t=Xm(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),AC=Ow([Bm(([e])=>{const t=qm(e).toVar(),n=Ym(Ym(1)).toVar(),i=Ym(Ym(qm(3735928559)).add(n.shiftLeft(Ym(2))).add(Ym(13))).toVar();return wC(i.add(Ym(t)),i,i)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Bm(([e,t])=>{const n=qm(t).toVar(),i=qm(e).toVar(),r=Ym(Ym(2)).toVar(),s=Ym().toVar(),a=Ym().toVar(),o=Ym().toVar();return s.assign(a.assign(o.assign(Ym(qm(3735928559)).add(r.shiftLeft(Ym(2))).add(Ym(13))))),s.addAssign(Ym(i)),a.addAssign(Ym(n)),wC(s,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Bm(([e,t,n])=>{const i=qm(n).toVar(),r=qm(t).toVar(),s=qm(e).toVar(),a=Ym(Ym(3)).toVar(),o=Ym().toVar(),l=Ym().toVar(),c=Ym().toVar();return o.assign(l.assign(c.assign(Ym(qm(3735928559)).add(a.shiftLeft(Ym(2))).add(Ym(13))))),o.addAssign(Ym(s)),l.addAssign(Ym(r)),c.addAssign(Ym(i)),wC(o,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Bm(([e,t,n,i])=>{const r=qm(i).toVar(),s=qm(n).toVar(),a=qm(t).toVar(),o=qm(e).toVar(),l=Ym(Ym(4)).toVar(),c=Ym().toVar(),u=Ym().toVar(),h=Ym().toVar();return c.assign(u.assign(h.assign(Ym(qm(3735928559)).add(l.shiftLeft(Ym(2))).add(Ym(13))))),c.addAssign(Ym(o)),u.addAssign(Ym(a)),h.addAssign(Ym(s)),SC(c,u,h),c.addAssign(Ym(r)),wC(c,u,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Bm(([e,t,n,i,r])=>{const s=qm(r).toVar(),a=qm(i).toVar(),o=qm(n).toVar(),l=qm(t).toVar(),c=qm(e).toVar(),u=Ym(Ym(5)).toVar(),h=Ym().toVar(),d=Ym().toVar(),p=Ym().toVar();return h.assign(d.assign(p.assign(Ym(qm(3735928559)).add(u.shiftLeft(Ym(2))).add(Ym(13))))),h.addAssign(Ym(c)),d.addAssign(Ym(l)),p.addAssign(Ym(o)),SC(h,d,p),h.addAssign(Ym(a)),d.addAssign(Ym(s)),wC(h,d,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),CC=Ow([Bm(([e,t])=>{const n=qm(t).toVar(),i=qm(e).toVar(),r=Ym(AC(i,n)).toVar(),s=nf().toVar();return s.x.assign(r.bitAnd(qm(255))),s.y.assign(r.shiftRight(qm(8)).bitAnd(qm(255))),s.z.assign(r.shiftRight(qm(16)).bitAnd(qm(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Bm(([e,t,n])=>{const i=qm(n).toVar(),r=qm(t).toVar(),s=qm(e).toVar(),a=Ym(AC(s,r,i)).toVar(),o=nf().toVar();return o.x.assign(a.bitAnd(qm(255))),o.y.assign(a.shiftRight(qm(8)).bitAnd(qm(255))),o.z.assign(a.shiftRight(qm(16)).bitAnd(qm(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),RC=Ow([Bm(([e])=>{const t=$m(e).toVar(),n=qm().toVar(),i=qm().toVar(),r=Xm(mC(t.x,n)).toVar(),s=Xm(mC(t.y,i)).toVar(),a=Xm(EC(r)).toVar(),o=Xm(EC(s)).toVar(),l=Xm(fC(vC(AC(n,i),r,s),vC(AC(n.add(qm(1)),i),r.sub(1),s),vC(AC(n,i.add(qm(1))),r,s.sub(1)),vC(AC(n.add(qm(1)),i.add(qm(1))),r.sub(1),s.sub(1)),a,o)).toVar();return MC(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Bm(([e])=>{const t=ef(e).toVar(),n=qm().toVar(),i=qm().toVar(),r=qm().toVar(),s=Xm(mC(t.x,n)).toVar(),a=Xm(mC(t.y,i)).toVar(),o=Xm(mC(t.z,r)).toVar(),l=Xm(EC(s)).toVar(),c=Xm(EC(a)).toVar(),u=Xm(EC(o)).toVar(),h=Xm(gC(vC(AC(n,i,r),s,a,o),vC(AC(n.add(qm(1)),i,r),s.sub(1),a,o),vC(AC(n,i.add(qm(1)),r),s,a.sub(1),o),vC(AC(n.add(qm(1)),i.add(qm(1)),r),s.sub(1),a.sub(1),o),vC(AC(n,i,r.add(qm(1))),s,a,o.sub(1)),vC(AC(n.add(qm(1)),i,r.add(qm(1))),s.sub(1),a,o.sub(1)),vC(AC(n,i.add(qm(1)),r.add(qm(1))),s,a.sub(1),o.sub(1)),vC(AC(n.add(qm(1)),i.add(qm(1)),r.add(qm(1))),s.sub(1),a.sub(1),o.sub(1)),l,c,u)).toVar();return bC(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),IC=Ow([Bm(([e])=>{const t=$m(e).toVar(),n=qm().toVar(),i=qm().toVar(),r=Xm(mC(t.x,n)).toVar(),s=Xm(mC(t.y,i)).toVar(),a=Xm(EC(r)).toVar(),o=Xm(EC(s)).toVar(),l=ef(fC(yC(CC(n,i),r,s),yC(CC(n.add(qm(1)),i),r.sub(1),s),yC(CC(n,i.add(qm(1))),r,s.sub(1)),yC(CC(n.add(qm(1)),i.add(qm(1))),r.sub(1),s.sub(1)),a,o)).toVar();return MC(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Bm(([e])=>{const t=ef(e).toVar(),n=qm().toVar(),i=qm().toVar(),r=qm().toVar(),s=Xm(mC(t.x,n)).toVar(),a=Xm(mC(t.y,i)).toVar(),o=Xm(mC(t.z,r)).toVar(),l=Xm(EC(s)).toVar(),c=Xm(EC(a)).toVar(),u=Xm(EC(o)).toVar(),h=ef(gC(yC(CC(n,i,r),s,a,o),yC(CC(n.add(qm(1)),i,r),s.sub(1),a,o),yC(CC(n,i.add(qm(1)),r),s,a.sub(1),o),yC(CC(n.add(qm(1)),i.add(qm(1)),r),s.sub(1),a.sub(1),o),yC(CC(n,i,r.add(qm(1))),s,a,o.sub(1)),yC(CC(n.add(qm(1)),i,r.add(qm(1))),s.sub(1),a,o.sub(1)),yC(CC(n,i.add(qm(1)),r.add(qm(1))),s,a.sub(1),o.sub(1)),yC(CC(n.add(qm(1)),i.add(qm(1)),r.add(qm(1))),s.sub(1),a.sub(1),o.sub(1)),l,c,u)).toVar();return bC(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),LC=Ow([Bm(([e])=>{const t=Xm(e).toVar(),n=qm(pC(t)).toVar();return NC(AC(n))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Bm(([e])=>{const t=$m(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar();return NC(AC(n,i))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Bm(([e])=>{const t=ef(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar(),r=qm(pC(t.z)).toVar();return NC(AC(n,i,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Bm(([e])=>{const t=sf(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar(),r=qm(pC(t.z)).toVar(),s=qm(pC(t.w)).toVar();return NC(AC(n,i,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),PC=Ow([Bm(([e])=>{const t=Xm(e).toVar(),n=qm(pC(t)).toVar();return ef(NC(AC(n,qm(0))),NC(AC(n,qm(1))),NC(AC(n,qm(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Bm(([e])=>{const t=$m(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar();return ef(NC(AC(n,i,qm(0))),NC(AC(n,i,qm(1))),NC(AC(n,i,qm(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Bm(([e])=>{const t=ef(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar(),r=qm(pC(t.z)).toVar();return ef(NC(AC(n,i,r,qm(0))),NC(AC(n,i,r,qm(1))),NC(AC(n,i,r,qm(2))))}
vendor: 4,944 bytes, line 2
2).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Bm(([e])=>{const t=sf(e).toVar(),n=qm(pC(t.x)).toVar(),i=qm(pC(t.y)).toVar(),r=qm(pC(t.z)).toVar(),s=qm(pC(t.w)).toVar();return ef(NC(AC(n,i,r,s,qm(0))),NC(AC(n,i,r,s,qm(1))),NC(AC(n,i,r,s,qm(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),DC=Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=qm(t).toVar(),o=ef(e).toVar(),l=Xm(0).toVar(),c=Xm(1).toVar();return xM(a,()=>{l.addAssign(c.mul(RC(o))),c.mulAssign(r),o.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),UC=Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=qm(t).toVar(),o=ef(e).toVar(),l=ef(0).toVar(),c=Xm(1).toVar();return xM(a,()=>{l.addAssign(c.mul(IC(o))),c.mulAssign(r),o.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),OC=Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=qm(t).toVar(),o=ef(e).toVar();return $m(DC(o,a,s,r),DC(o.add(ef(qm(19),qm(193),qm(17))),a,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),VC=Bm(([e,t,n,i])=>{const r=Xm(i).toVar(),s=Xm(n).toVar(),a=qm(t).toVar(),o=ef(e).toVar(),l=ef(UC(o,a,s,r)).toVar(),c=Xm(DC(o.add(ef(qm(19),qm(193),qm(17))),a,s,r)).toVar();return sf(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),FC=Ow([Bm(([e,t,n,i,r,s,a])=>{const o=qm(a).toVar(),l=Xm(s).toVar(),c=qm(r).toVar(),u=qm(i).toVar(),h=qm(n).toVar(),d=qm(t).toVar(),p=$m(e).toVar(),m=ef(PC($m(d.add(u),h.add(c)))).toVar(),f=$m(m.x,m.y).toVar();f.subAssign(.5),f.mulAssign(l),f.addAssign(.5);const g=$m($m(Xm(d),Xm(h)).add(f)).toVar(),v=$m(g.sub(p)).toVar();return Gm(o.equal(qm(2)),()=>Kg(v.x).add(Kg(v.y))),Gm(o.equal(qm(3)),()=>pv(Kg(v.x),Kg(v.y))),_v(v,v)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Bm(([e,t,n,i,r,s,a,o,l])=>{const c=qm(l).toVar(),u=Xm(o).toVar(),h=qm(a).toVar(),d=qm(s).toVar(),p=qm(r).toVar(),m=qm(i).toVar(),f=qm(n).toVar(),g=qm(t).toVar(),v=ef(e).toVar(),y=ef(PC(ef(g.add(p),f.add(d),m.add(h)))).toVar();y.subAssign(.5),y.mulAssign(u),y.addAssign(.5);const _=ef(ef(Xm(g),Xm(f),Xm(m)).add(y)).toVar(),x=ef(_.sub(v)).toVar();return Gm(c.equal(qm(2)),()=>Kg(x.x).add(Kg(x.y)).add(Kg(x.z))),Gm(c.equal(qm(3)),()=>pv(pv(Kg(x.x),Kg(x.y)),Kg(x.z))),_v(x,x)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),zC=Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=$m(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=$m(mC(s.x,a),mC(s.y,o)).toVar(),c=Xm(1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{const n=Xm(FC(l,e,t,a,o,r,i)).toVar();c.assign(dv(c,n))})}),Gm(i.equal(qm(0)),()=>{c.assign(Bg(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BC=Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=$m(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=$m(mC(s.x,a),mC(s.y,o)).toVar(),c=$m(1e6,1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{const n=Xm(FC(l,e,t,a,o,r,i)).toVar();Gm(n.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(n)}).ElseIf(n.lessThan(c.y),()=>{c.y.assign(n)})})}),Gm(i.equal(qm(0)),()=>{c.assign(Bg(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),kC=Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=$m(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=$m(mC(s.x,a),mC(s.y,o)).toVar(),c=ef(1e6,1e6,1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{const n=Xm(FC(l,e,t,a,o,r,i)).toVar();Gm(n.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(n)}).ElseIf(n.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(n)}).ElseIf(n.lessThan(c.z),()=>{c.z.assign(n)})})}),Gm(i.equal(qm(0)),()=>{c.assign(Bg(c))}),c}
vendor: 8,566 bytes, line 2
2).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),HC=Ow([zC,Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=ef(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=qm().toVar(),c=ef(mC(s.x,a),mC(s.y,o),mC(s.z,l)).toVar(),u=Xm(1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{xM({start:-1,end:qm(1),name:"z",condition:"<="},({z:n})=>{const s=Xm(FC(c,e,t,n,a,o,l,r,i)).toVar();u.assign(dv(u,s))})})}),Gm(i.equal(qm(0)),()=>{u.assign(Bg(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),GC=Ow([BC,Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=ef(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=qm().toVar(),c=ef(mC(s.x,a),mC(s.y,o),mC(s.z,l)).toVar(),u=$m(1e6,1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{xM({start:-1,end:qm(1),name:"z",condition:"<="},({z:n})=>{const s=Xm(FC(c,e,t,n,a,o,l,r,i)).toVar();Gm(s.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(s)}).ElseIf(s.lessThan(u.y),()=>{u.y.assign(s)})})})}),Gm(i.equal(qm(0)),()=>{u.assign(Bg(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),WC=Ow([kC,Bm(([e,t,n])=>{const i=qm(n).toVar(),r=Xm(t).toVar(),s=ef(e).toVar(),a=qm().toVar(),o=qm().toVar(),l=qm().toVar(),c=ef(mC(s.x,a),mC(s.y,o),mC(s.z,l)).toVar(),u=ef(1e6,1e6,1e6).toVar();return xM({start:-1,end:qm(1),name:"x",condition:"<="},({x:e})=>{xM({start:-1,end:qm(1),name:"y",condition:"<="},({y:t})=>{xM({start:-1,end:qm(1),name:"z",condition:"<="},({z:n})=>{const s=Xm(FC(c,e,t,n,a,o,l,r,i)).toVar();Gm(s.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(s)}).ElseIf(s.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(s)}).ElseIf(s.lessThan(u.z),()=>{u.z.assign(s)})})})}),Gm(i.equal(qm(0)),()=>{u.assign(Bg(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),jC=Bm(([e])=>{const t=e.y,n=e.z,i=ef().toVar();return Gm(t.lessThan(1e-4),()=>{i.assign(ef(n,n,n))}).Else(()=>{let r=e.x;r=r.sub(Hg(r)).mul(6).toVar();const s=qm(ov(r)),a=r.sub(Xm(s)),o=n.mul(t.oneMinus()),l=n.mul(t.mul(a).oneMinus()),c=n.mul(t.mul(a.oneMinus()).oneMinus());Gm(s.equal(qm(0)),()=>{i.assign(ef(n,c,o))}).ElseIf(s.equal(qm(1)),()=>{i.assign(ef(l,n,o))}).ElseIf(s.equal(qm(2)),()=>{i.assign(ef(o,n,c))}).ElseIf(s.equal(qm(3)),()=>{i.assign(ef(o,l,n))}).ElseIf(s.equal(qm(4)),()=>{i.assign(ef(c,o,n))}).Else(()=>{i.assign(ef(n,o,l))})}),i}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),XC=Bm(([e])=>{const t=ef(e).toVar(),n=Xm(t.x).toVar(),i=Xm(t.y).toVar(),r=Xm(t.z).toVar(),s=Xm(dv(n,dv(i,r))).toVar(),a=Xm(pv(n,pv(i,r))).toVar(),o=Xm(a.sub(s)).toVar(),l=Xm().toVar(),c=Xm().toVar(),u=Xm().toVar();return u.assign(a),Gm(a.greaterThan(0),()=>{c.assign(o.div(a))}).Else(()=>{c.assign(0)}),Gm(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Gm(n.greaterThanEqual(a),()=>{l.assign(i.sub(r).div(o))}).ElseIf(i.greaterThanEqual(a),()=>{l.assign(rg(2,r.sub(n).div(o)))}).Else(()=>{l.assign(rg(4,n.sub(i).div(o)))}),l.mulAssign(1/6),Gm(l.lessThan(0),()=>{l.addAssign(1)})}),ef(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),qC=Bm(([e])=>{const t=ef(e).toVar(),n=rf(dg(t,ef(.04045))).toVar(),i=ef(t.div(12.92)).toVar(),r=ef(Mv(pv(t.add(ef(.055)),ef(0)).div(1.055),ef(2.4))).toVar();return Av(i,r,n)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),YC=(e,t)=>{e=Xm(e),t=Xm(t);const n=$m(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return Lv(e.sub(n),e.add(n),t)},ZC=(e,t,n,i)=>Av(e,t,n[i].clamp()),$C=(e,t,n,i,r)=>Av(e,t,YC(n,i[r])),JC=Bm(([e,t])=>{const n=e.x,i=e.y,r=e.z;let s=t.element(0).mul(.886227);return s=s.add(t.element(1).mul(1.023328).mul(i)),s=s.add(t.element(2).mul(1.023328).mul(r)),s=s.add(t.element(3).mul(1.023328).mul(n)),s=s.add(t.element(4).mul(.858086).mul(n).mul(i)),s=s.add(t.element(5).mul(.858086).mul(i).mul(r)),s=s.add(t.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(t.element(7).mul(.858086).mul(n).mul(r)),s=s.add(t.element(8).mul(.429043).mul(ag(n,n).sub(ag(i,i)))),s});class KC extends hA{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Mf(0).setGroup(yf),this.decayExponentNode=Mf(0).setGroup(yf)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setup(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,s=e.context.lightingModel,a=vA(r).sub(f_),o=a.normalize(),l=a.length(),c=dA({lightDistance:l,cutoffDistance:n,decayExponent:i}),u=t.mul(c),h=e.context.reflectedLight;s.direct({lightDirection:o,lightColor:u,reflectedLight:h},e.stack,e)}}class QC extends hA{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,i=yA(this.light),r=e.context.reflectedLight;t.direct({lightDirection:i,lightColor:n,reflectedLight:r},e.stack,e)}}const eR=new Jn,tR=new Jn;let nR=null;class iR extends hA{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Mf(new Mn).setGroup(yf),this.halfWidth=Mf(new Mn).setGroup(yf)}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;tR.identity(),eR.copy(t.matrixWorld),eR.premultiply(n),tR.extractRotation(eR),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(tR),this.halfHeight.value.applyMatrix4(tR)}setup(e){let t,n;super.setup(e),e.isAvailable("float32Filterable")?(t=Oy(nR.LTC_FLOAT_1),n=Oy(nR.LTC_FLOAT_2)):(t=Oy(nR.LTC_HALF_1),n=Oy(nR.LTC_HALF_2));const{colorNode:i,light:r}=this,s=e.context.lightingModel,a=vA(r),o=e.context.reflectedLight;s.directRectArea({lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:o,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){nR=e}}class rR extends hA{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Mf(0).setGroup(yf),this.penumbraCosNode=Mf(0).setGroup(yf),this.cutoffDistanceNode=Mf(0).setGroup(yf),this.decayExponentNode=Mf(0).setGroup(yf)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return Lv(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:i,decayExponentNode:r,light:s}=this,a=vA(s).sub(f_),o=a.normalize(),l=o.dot(yA(s)),c=this.getSpotAttenuation(l),u=a.length(),h=dA({lightDistance:u,cutoffDistance:i,decayExponent:r}),d=n.mul(c).mul(h),p=e.context.reflectedLight;t.direct({lightDirection:o,lightColor:d,reflectedLight:p},e.stack,e)}}class sR extends rR{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&!0===t.isTexture){const i=e.acos().mul(1/Math.PI);n=Oy(t,$m(i,0),0).r}else n=super.getSpotAttenuation(e);return n}}class aR extends hA{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class oR extends hA{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=fA(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Mf(new Gi).setGroup(yf)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,r=T_.dot(i).mul(.5).add(.5),s=Av(n,t,r);e.context.irradiance.addAssign(s)}}class lR extends hA{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new Mn);this.lightProbe=k_(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=JC(S_,this.lightProbe);
2e.context.irradiance.addAssign(t)}}class cR{parseFunction(){console.warn("Abstract function.")}}class uR{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}uR.isNodeFunction=!0;const hR=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,dR=/[a-z_0-9]+/gi,pR="#pragma main";class mR extends uR{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:s,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(pR),n=-1!==t?e.slice(t+12):e,i=n.match(hR);if(null!==i&&5===i.length){const r=i[4],s=[];let a=null;for(;null!==(a=dR.exec(r));)s.push(a);const o=[];let l=0;for(;l<s.length;){const e="const"===s[l][0];!0===e&&l++;let t=s[l][0];"in"===t||"out"===t||"inout"===t?l++:t="";const n=s[l++][0];let i=Number.parseInt(s[l][0]);!1===Number.isNaN(i)?l++:i=null;const r=s[l++][0];o.push(new Ew(n,r,i,t,e))}const c=n.substring(i[0].length),u=void 0!==i[3]?i[3]:"";return{type:i[2],inputs:o,name:u,precision:void 0!==i[1]?i[1]:"",inputsCode:r,blockCode:c,headerCode:-1!==t?e.slice(0,t):""}}throw new Error("FunctionNode: Function is not a GLSL code.")})(e);super(t,n,i,r),this.inputsCode=s,this.blockCode=a,this.headerCode=o}getCode(e=this.name){let t;const n=this.blockCode;if(""!==n){const{type:i,inputsCode:r,headerCode:s,precision:a}=this;let o=`${i} ${e} ( ${r.trim()} )`;""!==a&&(o=`${a} ${o}`),t=s+o+n}else t="";return t}}class fR extends cR{parseFunction(e){return new mR(e)}}class gR{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map,this.colorSpaceNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(null!==n){t=new n;for(const n in e)t[n]=e[n]}return t}addColorSpace(e,t){this.addType(e,t,this.colorSpaceNodes)}getColorSpaceFunction(e){return this.colorSpaceNodes.get(e)||null}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t.name,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t))console.warn(`Redefinition of node ${t}`);else{if("function"!=typeof e)throw new Error(`Node class ${e.name} is not a class.`);if("function"==typeof t||"object"==typeof t)throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}}addClass(e,t,n){if(n.has(t))console.warn(`Redefinition of node ${t.name}`);else{if("function"!=typeof e)throw new Error(`Node class ${e.name} is not a class.`);if("function"!=typeof t)throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}}class vR extends Xh{constructor(e,t,n,i,r,s){super(e,t,n,i,r,s),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class yR extends gR{constructor(){super(),this.addLight(KC,Jh),this.addLight(QC,Qh),this.addLight(iR,td),this.addLight(rR,Xh),this.addLight(aR,ed),this.addLight(oR,Bh),this.addLight(lR,id),this.addLight(sR,vR),this.addToneMapping(HA,1),this.addToneMapping(GA,2),this.addToneMapping(WA,3),this.addToneMapping(XA,4),this.addToneMapping($A,6),this.addToneMapping(JA,7),this.addColorSpace(kA,$v(ht,ut)),this.addColorSpace(BA,$v(ut,ht))}}if(typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),typeof window<"u"){try{window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:"file:///build_root/build/audemarspiguetprogram-p85452-uk93928/ap-com/ap-com-ui/ap-com-ui-app-package/node_modules/@audemarspiguet/needle-3d-players/players/15245OR_OO_A206VE_01/dist/assets/[email protected]",revision:i})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+i),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=i}const _R=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:4,AONode:LM,AddEquation:c,AddOperation:2,AdditiveAnimationBlendMode:lt,AdditiveBlending:2,AfterImageNode:ZN,AgXToneMapping:6,AlphaFormat:he,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:ed,AmbientLightNode:aR,AnaglyphPassNode:OE,AnalyticLightNode:hA,AnamorphicNode:rE,AnimationAction:kd,AnimationClip:Eh,AnimationLoader:class extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Uh(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Eh.parse(e[n]);t.push(i)}return t}},AnimationMixer:Gd,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Vt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let a,o=e.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],h=u.uuid;let d=t[h];if(void 0===d){d=o++,t[h]=d,e.push(u);for(let e=0,t=s;e!==t;++e)r[e].push(new Bd(u,n[e],i[e]))}else if(d<l){a=e[d];const o=--l,c=e[o];t[c.uuid]=d,e[d]=c,t[h]=o,e[o]=u;for(let e=0,t=s;e!==t;++e){const t=r[e],s=t[o];let a=t[d];t[d]=s,void 0===a&&(a=new Bd(u,n[e],i[e])),t[o]=a}}else e[d]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
2cture when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s],o=a.uuid,l=t[o];if(void 0!==l&&l>=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[o]=s,e[s]=a;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=t[o];if(void 0!==l)if(delete t[o],l<r){const a=--r,o=e[a],c=--s,u=e[c];t[o.uuid]=l,e[l]=o,t[u.uuid]=a,e[a]=u,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[a],r=t[c];t[l]=i,t[a]=r,t.pop()}}else{const r=--s,a=e[r];r>0&&(t[a.uuid]=l),e[l]=a,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,s.push(e),a.push(t),r.push(u);for(let n=c,i=o.length;n!==i;++n){const i=o[n];u[n]=new Bd(i,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];t[e[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}},AnimationUtils:mh,ArcCurve:Lc,ArrayCamera:Lo,ArrayElementNode:$p,ArrowHelper:class extends Si{constructor(e=new Mn(0,0,1),t=new Mn(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===Sp&&(Sp=new pr,Sp.setAttribute("position",new sr([0,0,0,0,1,0],3)),wp=new tu(0,.5,1,5,1),wp.translate(0,-.5,0)),this.position.copy(t),this.line=new hc(Sp,new ic({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new wr(wp,new qi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Tp.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Tp,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AssignNode:Qf,AttachedBindMode:U,AttributeNode:Ay,Audio:Ed,AudioAnalyser:class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},AudioContext:md,AudioListener:Nd,AudioLoader:fd,AxesHelper:Np,BRDF_GGX:jb,BRDF_Lambert:Lb,BackSide:1,BasicDepthPacking:3200,BasicEnvironmentNode:Nb,BasicNodeLibrary:yR,BasicShadowMap:0,BatchNode:mM,BatchedMesh:nc,BloomNode:SE,Bone:Sl,BooleanKeyframeTrack:xh,Box2:class{constructor(e=new Wt(1/0,1/0),t=new Wt(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Qd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}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}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))}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}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qd).distanceTo(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}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)}},Box3:Sn,Box3Helper:bp,BoxGeometry:Er,BoxHelper:Mp,Break:MM,BufferAttribute:tr,BufferAttributeNode:cy,BufferGeometry:pr,BufferGeometryLoader:od,BufferNode:V_,BumpMapNode:fx,BypassNode:yy,ByteType:Q,Cache:Ch,
2CacheNode:gy,Camera:Pr,CameraHelper:yp,CanvasTexture:Cc,CapsuleGeometry:Qc,CatmullRomCurve3:Fc,CineonToneMapping:3,CircleGeometry:eu,ClampToEdgeWrapping:W,Clock:xd,CodeNode:IS,Color:Gi,ColorKeyframeTrack:Mh,ColorManagement:sn,ColorSpaceNode:Jv,CompressedArrayTexture:Ec,CompressedCubeTexture:Ac,CompressedTexture:Nc,CompressedTextureLoader:class extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],a=new Nc,o=new Uh(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function c(c){o.load(e[c],function(e){const n=r.parse(e,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=Z),a.image=s,a.format=n.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else o.load(e,function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){s[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)s[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),s[t].format=n.format,s[t].width=n.width,s[t].height=n.height}a.image=s}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=Z),a.format=n.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}},ComputeNode:my,ConeGeometry:nu,ConstNode:sm,ConstantAlphaFactor:213,ConstantColorFactor:211,ContextNode:Bv,Continue:()=>Sy("continue").append(),Controls:Ap,ConvertNode:Jp,CubeCamera:zr,CubeReflectionMapping:F,CubeRefractionMapping:z,CubeTexture:Br,CubeTextureLoader:class extends Lh{constructor(e){super(e)}load(e,t,n,i){const r=new Br;r.colorSpace=ut;const s=new Oh(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(e[n],function(e){r.images[n]=e,a++,6===a&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let t=0;t<e.length;++t)o(t);return r}},CubeTextureNode:U_,CubeUVReflectionMapping:H,CubicBezierCurve:Hc,CubicBezierCurve3:Gc,CubicInterpolant:gh,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:Rc,CurvePath:$c,CustomBlending:5,CustomToneMapping:5,CylinderGeometry:tu,Cylindrical:class{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}},DFGApprox:Xb,D_GGX:Hb,Data3DTexture:_n,DataArrayTexture:yn,DataTexture:wl,DataTextureLoader:Vh,DataUtils:Ki,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:Ih,DenoiseNode:gE,DepthFormat:ge,DepthOfFieldNode:aE,DepthStencilFormat:ve,DepthTexture:Os,DetachedBindMode:O,DirectionalLight:Qh,DirectionalLightHelper:fp,DirectionalLightNode:QC,Discard:wy,DiscreteInterpolant:yh,DisplayP3ColorSpace:dt,DodecahedronGeometry:ru,DotScreenNode:oE,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:At,DynamicReadUsage:35049,EPSILON:Eg,EdgesGeometry:cu,EllipseCurve:Ic,EnvironmentNode:KT,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectUVNode:yb,EquirectangularReflectionMapping:B,EquirectangularRefractionMapping:k,Euler:oi,EventDispatcher:Lt,ExpressionNode:Ty,ExtrudeGeometry:zu,FXAANode:vE,F_Schlick:Ib,FileLoader:Uh,FilmNode:cE,Float16BufferAttribute:rr,Float32BufferAttribute:sr,FloatType:re,Fn:Bm,Fog:Wo,FogExp2:Go,FogExp2Node:$E,FogNode:XE,FogRangeNode:YE,FramebufferTexture:wc,FrontFacingNode:v_,FrontSide:0,Frustum:Yr,FunctionCallNode:tg,FunctionNode:PS,FunctionOverloadingNode:Dw,GLBufferAttribute:class{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}},GLSL1:"100",GLSL3:Ct,GLSLNodeParser:fR,GTAONode:fE,GaussianBlurNode:XN,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:hp,Group:Po,HalfFloatType:se,HemisphereLight:Bh,HemisphereLightHelper:class extends Si{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Hu(t);i.rotateY(.5*Math.PI),this.material=new qi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new tr(s,3)),this.add(new wr(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");cp.copy(this.light.color),up.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?cp:up;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(lp.setFromMatrixPosition(this.light.matrixWorld).negate())}},HemisphereLightNode:oR,IESSpotLightNode:sR,INFINITY:Ag,IcosahedronGeometry:ku,If:Gm,ImageBitmapLoader:dd,ImageLoader:Oh,ImageUtils:cn,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,IndexNode:sM,InstanceNode:dM,InstancedBufferAttribute:Cl,InstancedBufferGeometry:ad,InstancedInterleavedBuffer:Xd,InstancedMesh:Vl,InstancedPointsNodeMaterial:class extends hb{static get type(){return"InstancedPointsNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.pointWidth=1,this.pointColorNode=null,this.pointWidthNode=null,this.setDefaultValues(db),this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor;this.vertexNode=Bm(()=>{const e=Cy("instancePosition").xyz,t=sf(o_.mul(sf(e,1))),n=HM.z.div(HM.w),i=ky.mul(t),r=u_.xy.toVar();return r.mulAssign(this.pointWidthNode?this.pointWidthNode:Kx),r.assign(r.div(HM.z)),r.y.assign(r.y.mul(n)),r.assign(r.mul(i.w)),i.addAssign(sf(r,0,0)),i})(),this.fragmentNode=Bm(()=>{const i=Xm(1).toVar(),r=Ev(Ry().mul(2).sub(1));if(t&&e.samples>1){const e=Xm(r.fwidth()).toVar();i.assign(Lv(e.oneMinus(),e.add(1),r).oneMinus())}else r.greaterThan(1).discard();let s;return s=this.pointColorNode?this.pointColorNode:n?Cy("instanceColor").mul(xx):xx,i.mulAssign(Tx),sf(s,i)})()}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}},Int16BufferAttribute:class extends tr{constructor(e,t,n){super(new Int16Array(e),t,n)}},Int32BufferAttribute:class extends tr{constructor(e,t,n){super(new Int32Array(e),t,n)}},Int8BufferAttribute:class extends tr{constructor(e,t,n){super(new Int8Array(e),t,n)}},IntType:ne,InterleavedBuffer:Xo,InterleavedBufferAttribute:Yo,Interpolant:fh,InterpolateDiscrete:tt,InterpolateLinear:nt,InterpolateSmooth:it,InvertStencilOp:5386,IrradianceNode:UM,JoinNode:Qp,KeepStencilOp:yt,KeyframeTrack:_h,LOD:pl,LatheGeometry:Kc,Layers:li,LessCompare:513,LessDepth:2,LessEqualCompare:515,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:zh,LightProbe:id,LightProbeNode:lR,LightingContextNode:PM,LightingModel:Ab,LightingNode:IM,LightsNode:CM,Line:hc,Line2NodeMaterial:class extends hb{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.lights=!1,this.setDefaultValues(fb),this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.useDash=e.dashed,this.useWorldUnits=!1,this.dashOffset=0,this.lineWidth=1,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor,i=this.dashed,r=this.worldUnits,s=Bm(({start:e,end:t})=>
2{const n=ky.element(2).element(2),i=ky.element(3).element(2).mul(-.5).div(n).sub(e.z).div(t.z.sub(e.z));return sf(Av(e.xyz,t.xyz,i),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=Bm(()=>{const e=Cy("instanceStart"),t=Cy("instanceEnd"),n=sf(o_.mul(sf(e,1))).toVar("start"),a=sf(o_.mul(sf(t,1))).toVar("end");r&&(Sf("vec3","worldStart").assign(n.xyz),Sf("vec3","worldEnd").assign(a.xyz));const o=HM.z.div(HM.w),l=ky.element(2).element(3).equal(-1);Gm(l,()=>{Gm(n.z.lessThan(0).and(a.z.greaterThan(0)),()=>{a.assign(s({start:n,end:a}))}).ElseIf(a.z.lessThan(0).and(n.z.greaterThanEqual(0)),()=>{n.assign(s({start:a,end:n}))})});const c=ky.mul(n),u=ky.mul(a),h=c.xyz.div(c.w),d=u.xyz.div(u.w),p=d.xy.sub(h.xy).toVar();p.x.assign(p.x.mul(o)),p.assign(p.normalize());const m=sf().toVar();if(r){const e=a.xyz.sub(n.xyz).normalize(),t=Av(n.xyz,a.xyz,.5).normalize(),r=e.cross(t).normalize(),s=e.cross(r),o=Sf("vec4","worldPos");o.assign(u_.y.lessThan(.5).select(n,a));const l=$x.mul(.5);o.addAssign(sf(u_.x.lessThan(0).select(r.mul(l),r.mul(l).negate()),0)),i||(o.addAssign(sf(u_.y.lessThan(.5).select(e.mul(l).negate(),e.mul(l)),0)),o.addAssign(sf(s.mul(l),0)),Gm(u_.y.greaterThan(1).or(u_.y.lessThan(0)),()=>{o.subAssign(sf(s.mul(2).mul(l),0))})),m.assign(ky.mul(o));const c=ef().toVar();c.assign(u_.y.lessThan(.5).select(h,d)),m.z.assign(c.z.mul(m.w))}else{const e=$m(p.y,p.x.negate()).toVar("offset");p.x.assign(p.x.div(o)),e.x.assign(e.x.div(o)),e.assign(u_.x.lessThan(0).select(e.negate(),e)),Gm(u_.y.lessThan(0),()=>{e.assign(e.sub(p))}).ElseIf(u_.y.greaterThan(1),()=>{e.assign(e.add(p))}),e.assign(e.mul($x)),e.assign(e.div(HM.w)),m.assign(u_.y.lessThan(.5).select(c,u)),e.assign(e.mul(m.w)),m.assign(m.add(sf(e,0,0)))}return m})();const a=Bm(({p1:e,p2:t,p3:n,p4:i})=>{const r=e.sub(n),s=i.sub(n),a=t.sub(e),o=r.dot(s),l=s.dot(a),c=r.dot(a),u=s.dot(s),h=a.dot(a).mul(u).sub(l.mul(l)),d=o.mul(l).sub(c.mul(u)).div(h).clamp(),p=o.add(l.mul(d)).div(u).clamp();return $m(d,p)});this.fragmentNode=Bm(()=>{const s=Ry();if(i){const e=this.offsetNode?Xm(this.offsetNodeNode):Jx,t=this.dashScaleNode?Xm(this.dashScaleNode):qx,n=this.dashSizeNode?Xm(this.dashSizeNode):Yx,i=this.dashSizeNode?Xm(this.dashGapNode):Zx;Wf.assign(n),jf.assign(i);const r=Cy("instanceDistanceStart"),a=Cy("instanceDistanceEnd"),o=u_.y.lessThan(.5).select(t.mul(r),qx.mul(a)),l=Xv(o.add(Jx)),c=e?l.add(e):l;s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),c.mod(Wf.add(jf)).greaterThan(Wf).discard()}const o=Xm(1).toVar("alpha");if(r){const n=Sf("vec3","worldStart"),r=Sf("vec3","worldEnd"),s=Sf("vec4","worldPos").xyz.normalize().mul(1e5),l=r.sub(n),c=a({p1:n,p2:r,p3:ef(0,0,0),p4:s}),u=n.add(l.mul(c.x)),h=s.mul(c.y),d=u.sub(h).length().div($x);if(!i)if(t&&e.samples>1){const e=d.fwidth();o.assign(Lv(e.negate().add(.5),e.add(.5),d).oneMinus())}else d.greaterThan(.5).discard()}else if(t&&e.samples>1){const e=s.x,t=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),n=e.mul(e).add(t.mul(t)),i=Xm(n.fwidth()).toVar("dlen");Gm(s.y.abs().greaterThan(1),()=>{o.assign(Lv(i.oneMinus(),i.add(1),n).oneMinus())})}else Gm(s.y.abs().greaterThan(1),()=>{const e=s.x,t=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));e.mul(e).add(t.mul(t)).greaterThan(1).discard()});let l;if(this.lineColorNode)l=this.lineColorNode;else if(n){const e=Cy("instanceColorStart"),t=Cy("instanceColorEnd");l=u_.y.lessThan(.5).select(e,t).mul(xx)}else l=xx;return sf(l,o)})()}get worldUnits(){return this.useWorldUnits}set worldUnits(e){this.useWorldUnits!==e&&(this.useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this.useDash}set dashed(e){this.useDash!==e&&(this.useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}},Line3:np,LineBasicMaterial:ic,LineBasicNodeMaterial:class extends hb{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.lights=!1,this.setDefaultValues(pb),this.setValues(e)}},LineCurve:Wc,LineCurve3:jc,LineDashedMaterial:lh,LineDashedNodeMaterial:class extends hb{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.lights=!1,this.setDefaultValues(mb),this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode,t=this.dashScaleNode?Xm(this.dashScaleNode):qx,n=this.dashSizeNode?Xm(this.dashSizeNode):Yx,i=this.dashSizeNode?Xm(this.dashGapNode):Zx;Wf.assign(n),jf.assign(i);const r=Xv(Cy("lineDistance").mul(t));(e?r.add(e):r).mod(Wf.add(jf)).greaterThan(Wf).discard()}},LineLoop:gc,LineSegments:fc,LinearDisplayP3ColorSpace:pt,LinearFilter:Z,LinearInterpolant:vh,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:J,LinearMipmapNearestFilter:$,LinearSRGBColorSpace:ht,LinearToneMapping:1,LinearTransfer:mt,Loader:Lh,LoaderUtils:sd,LoadingManager:Rh,Loop:xM,LoopNode:_M,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,LuminanceAlphaFormat:fe,LuminanceFormat:me,Lut3DNode:hE,MOUSE:r,MRTNode:Lw,MatcapUVNode:cS,Material:Xi,MaterialLoader:rd,MaterialNode:yx,MaterialReferenceNode:X_,MathUtils:Gt,Matrix2:Kd,Matrix3:jt,Matr
2ix4:Jn,MaxEquation:104,MaxMipLevelNode:Py,Mesh:wr,MeshBasicMaterial:qi,MeshBasicNodeMaterial:class extends hb{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Rb),this.setValues(e)}setupNormal(){return T_}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Nb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Eb(eM)),t}setupOutgoingLight(){return wf.rgb}setupLightingModel(){return new Cb}},MeshDepthMaterial:To,MeshDistanceMaterial:So,MeshLambertMaterial:ah,MeshLambertNodeMaterial:class extends hb{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Ob),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Nb(t):null}setupLightingModel(){return new Ub(!1)}},MeshMatcapMaterial:oh,MeshMatcapNodeMaterial:class extends hb{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(hS),this.setValues(e)}setupVariants(e){const t=uS;let n;n=e.material.matcap?q_("matcap","texture").context({getUV:()=>t}):ef(Av(.2,.8,t.y)),wf.rgb.mulAssign(n.rgb)}},MeshNormalMaterial:sh,MeshNormalNodeMaterial:class extends hb{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(vb),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?Xm(this.opacityNode):Tx;wf.assign(sf(gb(w_),e))}},MeshPhongMaterial:ih,MeshPhongNodeMaterial:class extends hb{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Vb),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Nb(t):null}setupLightingModel(){return new Ub}setupVariants(){const e=(this.shininessNode?Xm(this.shininessNode):Mx).max(1e-4);Hf.assign(e);const t=this.specularNode||Sx;Bf.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}},MeshPhysicalMaterial:nh,MeshPhysicalNodeMaterial:rS,MeshSSSNodeMaterial:class extends rS{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=Xm(.1),this.thicknessAmbientNode=Xm(0),this.thicknessAttenuationNode=Xm(.1),this.thicknessPowerNode=Xm(2),this.thicknessScaleNode=Xm(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new sS(this.useClearcoat,this.useSheen,this.useIridescence,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}},MeshStandardMaterial:th,MeshStandardNodeMaterial:nS,MeshToonMaterial:rh,MeshToonNodeMaterial:class extends hb{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(lS),this.setValues(e)}setupLightingModel(){return new oS}},MinEquation:103,MirroredRepeatWrapping:j,MixOperation:1,ModelNode:Qy,ModelViewProjectionNode:iM,MorphNode:wM,MultiplyBlending:4,MultiplyOperation:0,NearestFilter:X,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:Y,NearestMipmapNearestFilter:q,NeutralToneMapping:7,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:ct,NoToneMapping:0,Node:Zp,NodeAttribute:TS,NodeBuilder:ww,NodeCache:CS,NodeCode:ES,NodeFrame:Nw,NodeFunctionInput:Ew,NodeLoader:MS,NodeMaterial:hb,NodeMaterialLoader:bS,NodeMaterialObserver:Rp,NodeObjectLoader:class extends ld{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const n=super.parse(e,t);return this._nodesJSON=null,n}parseNodes(e,t){if(void 0!==e){const n=new MS;return n.setNodes(this.nodes),n.setTextures(t),n.parseNodes(e)}return{}}parseMaterials(e,t){const n={};if(void 0!==e){const i=this.parseNodes(this._nodesJSON,t),r=new bS;r.setTextures(t),r.setNodes(i),r.setNodeMaterials(this.nodeMaterials);for(let t=0,i=e.length;t<i;t++){const i=e[t];n[i.uuid]=r.parse(i)}}return n}},NodeShaderStage:Hp,NodeType:{BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"}
vendor: 4,836 bytes, line 2
2,NodeUniform:SS,NodeUpdateType:Gp,NodeUtils:kp,NodeVar:wS,NodeVarying:NS,NormalAnimationBlendMode:ot,NormalBlending:1,NormalMapNode:hx,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:bh,Object3D:Si,Object3DNode:qy,ObjectLoader:ld,ObjectSpaceNormalMap:1,OctahedronGeometry:Hu,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:v,OneMinusSrcColorFactor:203,OrthographicCamera:us,OscNode:Bw,OutputStructNode:Cw,P3Primaries:vt,PCFShadowMap:1,PCFSoftShadowMap:2,PI:Cg,PI2:Rg,PMREMGenerator:bs,PMREMNode:ZT,ParallaxBarrierPassNode:VE,ParameterNode:RS,PassNode:HN,Path:Jc,PerspectiveCamera:Vr,PhongLightingModel:Ub,PhysicalLightingModel:NT,PixelationPassNode:EE,Plane:jr,PlaneGeometry:Jr,PlaneHelper:class extends hc{constructor(e,t=1,n=16776960){const i=n,r=new pr;r.setAttribute("position",new sr([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new ic({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const s=new pr;s.setAttribute("position",new sr([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new wr(s,new qi({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:Jh,PointLightHelper:class extends wr{constructor(e,t,n){super(new ju(t,4,2),new qi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},PointLightNode:KC,PointUVNode:MN,Points:bc,PointsMaterial:vc,PointsNodeMaterial:class extends hb{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.lights=!1,this.transparent=!0,this.sizeNode=null,this.setDefaultValues(dS),this.setValues(e)}copy(e){return this.sizeNode=e.sizeNode,super.copy(e)}},PolarGridHelper:class extends fc{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new Gi(r),s=new Gi(s);const a=[],o=[];if(t>1)for(let n=0;n<t;n++){const i=n/t*(2*Math.PI),l=Math.sin(i)*e,c=Math.cos(i)*e;a.push(0,0,0),a.push(l,0,c);const u=1&n?r:s;o.push(u.r,u.g,u.b),o.push(u.r,u.g,u.b)}for(let t=0;t<n;t++){const l=1&t?r:s,c=e-e/n*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c;a.push(n,0,r),o.push(l.r,l.g,l.b),t=(e+1)/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c,a.push(n,0,r),o.push(l.r,l.g,l.b)}}const l=new pr;l.setAttribute("position",new sr(a,3)),l.setAttribute("color",new sr(o,3));super(l,new ic({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:iu,PositionalAudio:Ld,PosterizeNode:DN,PropertyBinding:Bd,PropertyMixer:Pd,PropertyNode:bf,QuadraticBezierCurve:Xc,QuadraticBezierCurve3:qc,Quaternion:xn,QuaternionKeyframeTrack:Sh,QuaternionLinearInterpolant:Th,RED_GREEN_RGTC2_Format:Qe,RED_RGTC1_Format:Je,REVISION:i,RGBADepthPacking:3201,RGBAFormat:pe,RGBAIntegerFormat:be,RGBA_ASTC_10x10_Format:je,RGBA_ASTC_10x5_Format:He,RGBA_ASTC_10x6_Format:Ge,RGBA_ASTC_10x8_Format:We,RGBA_ASTC_12x10_Format:Xe,RGBA_ASTC_12x12_Format:qe,RGBA_ASTC_4x4_Format:De,RGBA_ASTC_5x4_Format:Ue,RGBA_ASTC_5x5_Format:Oe,RGBA_ASTC_6x5_Format:Ve,RGBA_ASTC_6x6_Format:Fe,RGBA_ASTC_8x5_Format:ze,RGBA_ASTC_8x6_Format:Be,RGBA_ASTC_8x8_Format:ke,RGBA_BPTC_Format:Ye,RGBA_ETC2_EAC_Format:Pe,RGBA_PVRTC_2BPPV1_Format:Re,RGBA_PVRTC_4BPPV1_Format:Ce,RGBA_S3TC_DXT1_Format:Se,RGBA_S3TC_DXT3_Format:we,RGBA_S3TC_DXT5_Format:Ne,RGBDepthPacking:3202,RGBFormat:de,RGBIntegerFormat:1032,RGBShiftNode:lE,RGB_BPTC_SIGNED_Format:Ze,RGB_BPTC_UNSIGNED_Format:$e,RGB_ETC1_Format:Ie,RGB_ETC2_Format:Le,RGB_PVRTC_2BPPV1_Format:Ae,RGB_PVRTC_4BPPV1_Format:Ee,RGB_S3TC_DXT1_Format:Te,RGDepthPacking:3203,RGFormat:xe,RGIntegerFormat:Me,RTTNode:vN,RangeNode:eA,RawShaderMaterial:eh,Ray:$n,Raycaster:Yd,Rec709Primaries:gt,RectAreaLight:td,RectAreaLightNode:iR,RedFormat:ye,RedIntegerFormat:_e,ReferenceNode:G_,ReflectorNode:hN,ReinhardToneMapping:2,RemapNode:xy,RenderOutputNode:Ny,RenderTarget:gn,RendererReferenceNode:ry,RepeatWrapping:G,ReplaceStencilOp:7681,Return:()=>Sy("return").append(),ReverseSubtractEquation:102,RingGeometry:Gu,RotateNode:pS,SIGNED_RED_GREEN_RGTC2_Format:et,SIGNED_RED_RGT
2C1_Format:Ke,SRGBColorSpace:ut,SRGBTransfer:ft,SSAAPassNode:CE,Scene:jo,SceneNode:TN,Schlick_to_F0:Yb,ScreenNode:FM,ScriptableNode:WE,ScriptableValueNode:zE,SetNode:nm,ShaderChunk:Kr,ShaderLib:es,ShaderMaterial:Lr,ShaderNode:Dm,ShadowMaterial:Qu,ShadowNodeMaterial:class extends hb{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(vS),this.setValues(e)}setupLightingModel(){return new gS}},Shape:uu,ShapeGeometry:Wu,ShapePath:Ep,ShapeUtils:Ou,ShortType:ee,Skeleton:Al,SkeletonHelper:class extends fc{constructor(e){const t=op(e),n=new pr,i=[],r=[],s=new Gi(0,0,1),a=new Gi(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new sr(i,3)),n.setAttribute("color",new sr(r,3));super(n,new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");ap.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const r=t[e];r.parent&&r.parent.isBone&&(sp.multiplyMatrices(ap,r.matrixWorld),rp.setFromMatrixPosition(sp),i.setXYZ(n,rp.x,rp.y,rp.z),sp.multiplyMatrices(ap,r.parent.matrixWorld),rp.setFromMatrixPosition(sp),i.setXYZ(n+1,rp.x,rp.y,rp.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:Tl,SkinningNode:vM,SobelOperatorNode:sE,Source:hn,Sphere:Hn,SphereGeometry:ju,Spherical:Jd,SphericalHarmonics3:nd,SplineCurve:Yc,SplitNode:tm,SpotLight:Xh,SpotLightHelper:class extends Si{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new pr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e<n;e++,t++){const r=e/n*Math.PI*2,s=t/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new sr(i,3));const r=new ic({fog:!1,toneMapped:!1});this.cone=new fc(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),ip.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ip),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},SpotLightNode:rR,Sprite:cl,SpriteMaterial:Zo,SpriteNodeMaterial:class extends hb{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this.lights=!1,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(fS),this.setValues(e)}setupPosition({object:e,camera:t,context:n}){const i=this.sizeAttenuation,{positionNode:r,rotationNode:s,scaleNode:a}=this,o=h_;let l=o_.mul(ef(r||0)),c=$m(t_[0].xyz.length(),t_[1].xyz.length());null!==a&&(c=c.mul(a)),!i&&t.isPerspectiveCamera&&(c=c.mul(l.z.negate()));let u=o.xy;if(e.center&&!0===e.center.isVector2){const e=((e,t,n)=>Um(new iy(e,t,n)))("center","vec2");u=u.sub(e.sub(.5))}u=u.mul(c);const h=Xm(s||Ux),d=mS(u,h);l=sf(l.xy.add(d),l.zw);const p=ky.mul(l);return n.vertex=o,p}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},SpriteSheetUVNode:jw,SrcAlphaFactor:g,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StackNode:$S,StaticCopyUsage:35046,StaticDrawUsage:Et,StaticReadUsage:35045,StereoCamera:_d,StereoPassNode:LE,StorageArrayElementNode:qw,StorageBufferNode:RN,StorageTextureNode:IN,StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:wh,SubtractEquation:101,SubtractiveBlending:3,TBNViewMatrix:ox,TOUCH:s,TangentSpaceNormalMap:0,TempNode:Kp,TetrahedronGeometry:Xu,Texture:mn,Texture3DNode:_S,TextureLoader:Fh,TextureNode:Uy,TextureSizeNode:Iy,TextureUtils:Co,TimerNode:Vw,ToneMappingNode:ay,ToonOutlinePassNode:FE,TorusGeometry:qu,TorusKnotGeometry:Yu,TransitionNode:wE,Triangle:Fi,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TriplanarTexturesNode:Zw,TubeGeometry:Zu,UVMapping:V,Uint16BufferAttribute:nr,Uint32BufferAttribute:ir,Uint8BufferAttribute:class extends tr{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Uint8ClampedBufferAttribute:class extends tr{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Uniform:Wd,UniformArrayNode:B_,UniformGroupNode:mf,UniformNode:xf,UniformsGroup:class extends Lt{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:jd++}),this.name="",this.usage=Et,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){const n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Qr,UniformsUtils:Ir,UnsignedByteType:K,UnsignedInt101111Type:ue,UnsignedInt248Type:le,UnsignedInt5999Type:ce,UnsignedIntType:ie,UnsignedShort4444Type:ae,UnsignedShort5551Type:oe,UnsignedShortType:te,UserDataNode:PN,VSMShadowMap:3,V_GGX_SmithCorrelated:Bb,VarNode:Gv,VaryingNode:jv,Vector2:Wt,Vector3:Mn,Vector4:fn,VectorKeyframeTrack:Nh,VertexColorNode:xN,VideoTexture:Sc,ViewportDepthNode:nb,Vie
2wportDepthTextureNode:eb,ViewportSharedTextureNode:VN,ViewportTextureNode:$M,VolumeNodeMaterial:class extends hb{static get type(){return"VolumeNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.isVolumeNodeMaterial=!0,this.testNode=null,this.setValues(e)}setup(e){const t=xS(this.map,null,0),n=Bm(({orig:e,dir:t})=>{const n=ef(-.5),i=ef(.5),r=t.reciprocal(),s=n.sub(e).mul(r),a=i.sub(e).mul(r),o=dv(s,a),l=pv(s,a),c=pv(o.x,pv(o.y,o.z)),u=dv(l.x,dv(l.y,l.z));return $m(c,u)});this.fragmentNode=Bm(()=>{const e=Xv(ef(a_.mul(sf(Xy,1)))),i=Xv(u_.sub(e)).normalize(),r=$m(n({orig:e,dir:i})).toVar();r.x.greaterThan(r.y).discard(),r.assign($m(pv(r.x,0),r.y));const s=ef(e.add(r.x.mul(i))).toVar(),a=ef(i.abs().reciprocal()).toVar(),o=Xm(dv(a.x,dv(a.y,a.z))).toVar("delta");o.divAssign(q_("steps","float"));const l=sf(q_("base","color"),0).toVar();return xM({type:"float",start:r.x,end:r.y,update:"+= delta"},()=>{const e=Tf("float","d").assign(t.uv(s.add(.5)).r);null!==this.testNode?this.testNode({map:t,mapValue:e,probe:s,finalColor:l}).append():(l.a.assign(1),MM()),s.addAssign(i.mul(o))}),l.a.equal(0).discard(),sf(l)})(),super.setup(e)}},WebGL3DRenderTarget:class extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new _n(null,e,t,n),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new yn(null,e,t,n),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:Rt,WebGLCubeRenderTarget:kr,WebGLMultipleRenderTargets:class extends vn{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}},WebGLRenderTarget:vn,WebGLRenderer:Ho,WebGLUtils:Io,WebGPUCoordinateSystem:It,WireframeGeometry:$u,WrapAroundEnding:at,ZeroCurvatureEnding:rt,ZeroFactor:200,ZeroSlopeEnding:st,ZeroStencilOp:0,abs:Kg,acesFilmicToneMapping:XA,acos:$g,add:rg,addMethodChaining:lm,addNodeElement:function(e){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},afterImage:(e,t)=>Um(new ZN(_N(e),t)),agxToneMapping:$A,all:Ig,alphaT:Of,anaglyphPass:(e,t)=>Um(new OE(e,t)),anamorphic:(e,t=.9,n=3,i=32)=>Um(new rE(_N(e),Um(t),Um(n),i)),and:fg,anisotropy:Vf,anisotropyB:zf,anisotropyT:Ff,any:Lg,ao:(e,t,n)=>Um(new fE(Um(e),Um(t),n)),append:Wm,arrayBuffer:e=>Um(new sm(e,"ArrayBuffer")),asin:Zg,assign:eg,atan:Jg,atan2:hv,atomicAdd:(e,t,n=null)=>cC(oC.ATOMIC_ADD,e,t,n),atomicAnd:(e,t,n=null)=>cC(oC.ATOMIC_AND,e,t,n),atomicFunc:cC,atomicMax:(e,t,n=null)=>cC(oC.ATOMIC_MAX,e,t,n),atomicMin:(e,t,n=null)=>cC(oC.ATOMIC_MIN,e,t,n),atomicOr:(e,t,n=null)=>cC(oC.ATOMIC_OR,e,t,n),atomicStore:(e,t,n=null)=>cC(oC.ATOMIC_STORE,e,t,n),atomicSub:(e,t,n=null)=>cC(oC.ATOMIC_SUB,e,t,n),atomicXor:(e,t,n=null)=>cC(oC.ATOMIC_XOR,e,t,n),attenuationColor:Jf,attenuationDistance:$f,attribute:Cy,backgroundBlurriness:SN,backgroundIntensity:wN,batch:fM,billboarding:NA,bitAnd:_g,bitNot:xg,bitOr:Mg,bitXor:bg,bitangentGeometry:tx,bitangentLocal:nx,bitangentView:ix,bitangentWorld:rx,bitcast:cv,bleach:FA,bloom:(e,t,n,i)=>Um(new SE(Um(e),t,n,i)),blur:XT,bool:Zm,buffer:F_,bufferAttribute:uy,bumpMap:gx,burn:PA,bvec2:Qm,bvec3:rf,bvec4:lf,bypass:_y,cache:vy,call:ng,cameraFar:zy,cameraLogDepth:By,cameraNear:Fy,cameraNormalMatrix:jy,cameraPosition:Xy,cameraProjectionMatrix:ky,cameraProjectionMatrixInverse:Hy,cameraViewMatrix:Gy,cameraWorldMatrix:Wy,cbrt:Nv,ceil:Gg,checker:uC,cineonToneMapping:WA,clamp:Cv,clearcoat:Cf,clearcoatRoughness:Rf,code:LS,color:jm,colorSpaceToWorking:ty,colorToDirection:e=>Um(e).mul(2).sub(1),compute:fy,cond:zv,context:kv,convert:pf,convertToTexture:_N,cos:qg,createCanvasElement:Jt,cross:xv,cubeTexture:O_,dFdx:iv,dFdy:rv,dashSize:Wf,defaultBuildStages:jp,defaultShaderStages:Wp,defined:Lm,degrees:Ug,denoise:(e,t,n,i,r)=>Um(new gE(_N(e),Um(t),Um(n),Um(i),r)),densityFog:JE,depth:ob,depthPass:(e,t)=>Um(new HN(HN.DEPTH,e,t)),difference:yv,diffuseColor:wf,directionToColor:gb,dispersion:Kf,distance:vv,div:og,dodge:DA,dof:(e,t,n=1,i=.025,r=1)=>Um(new aE(_N(e),Um(t),Um(n),Um(i),Um(r))),dot:_v,dotScreen:(e,t,n,i)=>
vendor: 4,666 bytes, line 2
2Um(new oE(Um(e),t,n,i)),drawIndex:hM,dynamicBufferAttribute:hy,element:df,emissive:Nf,equal:cg,equals:Pg,equirectUV:_b,exp:Og,exp2:Vg,expression:Sy,faceDirection:__,faceForward:Pv,film:uE,float:Xm,floor:Hg,fog:qE,fract:jg,frameGroup:vf,frameId:zw,frontFacing:y_,fwidth:lv,fxaa:e=>Um(new vE(_N(e))),gain:(e,t)=>e.lessThan(.5)?xA(e.mul(2),t).div(2):sg(1,xA(ag(sg(1,e),2),t).div(2)),gapSize:jf,gaussianBlur:(e,t,n)=>Um(new XN(_N(e),t,n)),getColorSpaceMethod:$v,getConstNodeType:Pm,getCurrentStack:Hm,getDirection:HT,getDistanceAttenuation:dA,getGeometryRoughness:Fb,getRoughness:zb,getShIrradianceAt:JC,getTextureIndex:Iw,global:GE,glsl:(e,t)=>LS(e,t,"glsl"),glslFn:(e,t)=>DS(e,t,"glsl"),grayscale:$N,greaterThan:dg,greaterThanEqual:mg,hash:_A,highPrecisionModelNormalViewMatrix:c_,highPrecisionModelViewMatrix:l_,hue:QN,instance:pM,instanceIndex:oM,instancedBufferAttribute:dy,instancedDynamicBufferAttribute:py,int:qm,inverseSqrt:kg,invocationLocalIndex:uM,invocationSubgroupIndex:cM,ior:qf,iridescence:Pf,iridescenceIOR:Df,iridescenceThickness:Uf,ivec2:Jm,ivec3:tf,ivec4:af,js:(e,t)=>LS(e,t,"js"),label:Hv,length:ev,lengthSq:Ev,lessThan:hg,lessThanEqual:pg,lightPosition:fA,lightTargetDirection:yA,lightTargetPosition:gA,lightViewPosition:vA,lightingContext:DM,lights:RM,linearDepth:lb,linearSRGBTosRGB:kA,linearToneMapping:HA,localId:nC,log:Fg,log2:zg,loop:(...e)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),xM(...e)),luminance:tE,lut3D:(e,t,n,i)=>Um(new hE(Um(e),Um(t),n,Um(i))),mat2:cf,mat3:uf,mat4:hf,matcapUV:uS,materialAOMap:tM,materialAlphaTest:_x,materialAnisotropy:Fx,materialAnisotropyVector:nM,materialAttenuationColor:Xx,materialAttenuationDistance:jx,materialClearcoat:Lx,materialClearcoatNormal:Dx,materialClearcoatRoughness:Px,materialColor:xx,materialDispersion:Qx,materialEmissive:bx,materialIOR:Wx,materialIridescence:zx,materialIridescenceIOR:Bx,materialIridescenceThickness:kx,materialLightMap:eM,materialLineDashOffset:Jx,materialLineDashSize:Yx,materialLineGapSize:Zx,materialLineScale:qx,materialLineWidth:$x,materialMetalness:Rx,materialNormal:Ix,materialOpacity:Tx,materialPointWidth:Kx,materialReference:q_,materialReflectivity:Ax,materialRefractionRatio:R_,materialRotation:Ux,materialRoughness:Cx,materialSheen:Ox,materialSheenRoughness:Vx,materialShininess:Mx,materialSpecular:Sx,materialSpecularColor:Nx,materialSpecularIntensity:wx,materialSpecularStrength:Ex,materialThickness:Gx,materialTransmission:Hx,max:pv,maxMipLevel:Dy,metalness:Af,min:dv,mix:Av,mixElement:Uv,mod:mv,modInt:lg,modelDirection:e_,modelNormalMatrix:s_,modelPosition:n_,modelScale:i_,modelViewMatrix:o_,modelViewPosition:r_,modelViewProjection:rM,modelWorldMatrix:t_,modelWorldMatrixInverse:a_,morphReference:NM,motionBlur:VA,mrt:Pw,mul:ag,mx_aastep:YC,mx_cell_noise_float:(e=Ry())=>LC(e.convert("vec2|vec3")),mx_contrast:(e,t=1,n=.5)=>Xm(e).sub(n).mul(t).add(n),mx_fractal_noise_float:(e=Ry(),t=3,n=2,i=.5,r=1)=>DC(e,qm(t),n,i).mul(r),mx_fractal_noise_vec2:(e=Ry(),t=3,n=2,i=.5,r=1)=>OC(e,qm(t),n,i).mul(r),mx_fractal_noise_vec3:(e=Ry(),t=3,n=2,i=.5,r=1)=>UC(e,qm(t),n,i).mul(r),mx_fractal_noise_vec4:(e=Ry(),t=3,n=2,i=.5,r=1)=>VC(e,qm(t),n,i).mul(r),mx_hsvtorgb:jC,mx_noise_float:(e=Ry(),t=1,n=0)=>RC(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec3:(e=Ry(),t=1,n=0)=>IC(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec4:(e=Ry(),t=1,n=0)=>(e=e.convert("vec2|vec3"),sf(IC(e),RC(e.add($m(19,73)))).mul(t).add(n)),mx_ramplr:(e,t,n=Ry())=>ZC(e,t,n,"x"),mx_ramptb:(e,t,n=Ry())=>ZC(e,t,n,"y"),mx_rgbtohsv:XC,mx_safepower:(e,t=1)=>(e=Xm(e)).abs().pow(t).mul(e.sign()),mx_splitlr:(e,t,n,i=Ry())=>$C(e,t,n,i,"x"),mx_splittb:(e,t,n,i=Ry())=>$C(e,t,n,i,"y"),mx_srgb_texture_to_lin_rec709:qC,mx_transform_uv:(e=1,t=0,n=Ry())=>n.mul(e).add(t),mx_worley_noise_float:(e=Ry(),t=1)=>HC(e.convert("vec2|vec3"),t,qm(1)),mx_worley_noise_vec2:(e=Ry(),t=1)=>GC(e.convert("vec2|vec3"),t,qm(1)),mx_worley_noise_vec3:(e=Ry(),t=1)=>WC(e.convert("vec2|vec3"),t,qm(1)),negate:tv,neutralToneMapping:JA,nodeArray:Vm,nodeImmutable:zm,nodeObject:Um,nodeObjects:Om,nodeProxy:Fm,normalFlat:b_,normalGeometry:x_,normalLocal:M_,normalMap:dx,normalView:T_,normalWorld:S_,normalize:Wg,not:vg,notEqual:ug,numWorkgroups:eC,objectDirection:Yy,objectGroup:_f,objectPosition:$y,objectScale:Jy,objectViewPosition:Ky,objectWorldMatrix:Zy,oneMinus:nv,or:gg,orthographicDepthToViewZ:(e,t,n)=>t.sub(n).mul(e).sub(t),oscSawtooth:Ww,oscSine:kw,oscSquare:Hw,oscTriangle:Gw,output:Gf,outputStruct:Rw,overlay:OA,overloadingFn:Ow,parabola:xA,parallaxBarrierPass:(e,t)=>Um(new VE(e,t)),parallaxDirection:lx,parallaxUV:(e,t)=>e.sub(lx.mul(t)),parameter:(e,t)=>Um(new RS(e,t)),pass:(e,t,n)=>
2Um(new HN(HN.COLOR,e,t,n)),passTexture:GN,pcurve:(e,t,n)=>Mv(og(Mv(e,t),rg(Mv(e,t),Mv(sg(1,e),n))),1/t),perspectiveDepthToViewZ:sb,pixelationPass:(e,t,n,i,r)=>Um(new EE(e,t,n,i,r)),pmremTexture:$T,pointUV:bN,pointWidth:Xf,positionGeometry:u_,positionLocal:h_,positionPrevious:d_,positionView:f_,positionViewDirection:g_,positionWorld:p_,positionWorldDirection:m_,posterize:UN,pow:Mv,pow2:bv,pow3:Tv,pow4:Sv,property:Tf,radians:Dg,rand:Dv,range:tA,rangeFog:ZE,reciprocal:av,reference:W_,referenceBuffer:j_,reflect:gv,reflectVector:P_,reflectView:I_,reflector:e=>Um(new hN(e)),refract:Iv,refractVector:D_,refractView:L_,reinhardToneMapping:GA,remainder:wg,remap:My,remapClamp:by,renderGroup:yf,renderOutput:Ey,rendererReference:sy,rgbShift:(e,t,n)=>Um(new lE(_N(e),t,n)),rotate:mS,rotateUV:SA,roughness:Ef,round:sv,rtt:yN,sRGBToLinearSRGB:BA,sampler:e=>(!0===e.isNode?e:Oy(e)).convert("sampler"),saturate:Rv,saturation:JN,screen:UA,screenCoordinate:kM,screenSize:BM,screenUV:zM,scriptable:jE,scriptableValue:BE,select:Fv,sepia:zA,setCurrentStack:km,shaderStages:Xp,sharedUniformGroup:gf,sheen:If,sheenRoughness:Lf,shiftLeft:Tg,shiftRight:Sg,shininess:Hf,sign:Qg,sin:Xg,sinc:(e,t)=>Xg(Cg.mul(t.mul(e).sub(1))).div(Cg.mul(t.mul(e).sub(1))),skinning:e=>Um(new vM(e)),skinningReference:yM,smoothstep:Lv,smoothstepElement:Ov,sobel:e=>Um(new sE(_N(e))),specularColor:Bf,specularF90:kf,spherizeUV:wA,split:(e,t)=>Um(new tm(Um(e),t)),spritesheetUV:Xw,sqrt:Bg,ssaaPass:(e,t)=>Um(new CE(e,t)),stack:JS,step:fv,stereoPass:(e,t)=>Um(new LE(e,t)),storage:(e,t,n)=>Um(new RN(e,t,n)),storageBarrier:()=>rC("storage").append(),storageObject:(e,t,n)=>Um(new RN(e,t,n).setBufferObject(!0)),storageTexture:LN,string:(e="")=>Um(new sm(e,"string")),sub:sg,subgroupIndex:lM,subgroupSize:iC,tan:Yg,tangentGeometry:Y_,tangentLocal:Z_,tangentView:$_,tangentWorld:J_,temp:Wv,texture:Oy,texture3D:xS,textureBarrier:()=>rC("texture").append(),textureBicubic:dT,textureCubeUV:GT,textureLoad:Vy,textureSize:Ly,textureStore:(e,t,n)=>{const i=LN(e,t,n);return null!==n&&i.append(),i},thickness:Zf,threshold:nE,timerDelta:(e,t=0)=>Um(new Vw(Vw.DELTA,e,t)),timerGlobal:(e,t=0)=>Um(new Vw(Vw.GLOBAL,e,t)),timerLocal:Fw,toOutputColorSpace:Kv,toWorkingColorSpace:Qv,toneMapping:oy,toneMappingExposure:ly,toonOutlinePass:(e,t,n=new Gi(0,0,0),i=.003,r=1)=>Um(new FE(e,t,Um(n),Um(i),Um(r))),transformDirection:wv,transformNormal:A_,transformNormalToView:C_,transformedBentNormalView:cx,transformedBitangentView:sx,transformedBitangentWorld:ax,transformedClearcoatNormalView:E_,transformedNormalView:w_,transformedNormalWorld:N_,transformedTangentView:K_,transformedTangentWorld:Q_,transition:(e,t,n,i=0,r=.1,s=0)=>Um(new wE(_N(e),_N(t),_N(n),Um(i),Um(r),Um(s))),transmission:Yf,transpose:uv,tri:MA,tri3:bA,triNoise3D:TA,triplanarTexture:(...e)=>$w(...e),triplanarTextures:$w,trunc:ov,tslFn:(...e)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),Bm(...e)),uint:Ym,uniform:Mf,uniformArray:k_,uniformGroup:ff,uniforms:(e,t)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),Um(new B_(e,t))),userData:(e,t,n)=>Um(new PN(e,t,n)),uv:Ry,uvec2:Km,uvec3:nf,uvec4:of,varying:Xv,varyingProperty:Sf,vec2:$m,vec3:ef,vec4:sf,vectorComponents:qp,velocity:LA,vertexColor:(...e)=>Um(new xN(...e)),vertexIndex:aM,vibrance:KN,viewZToOrthographicDepth:ib,viewZToPerspectiveDepth:rb,viewport:HM,viewportBottomLeft:YM,viewportCoordinate:WM,viewportDepthTexture:tb,viewportLinearDepth:cb,viewportMipTexture:KM,viewportResolution:XM,viewportSafeUV:EA,viewportSharedTexture:FN,viewportSize:GM,viewportTexture:JM,viewportTopLeft:qM,viewportUV:jM,wgsl:(e,t)=>LS(e,t,"wgsl"),wgslFn:(e,t)=>DS(e,t,"wgsl"),workgroupArray:(e,t)=>Um(new aC("Workgroup",e,t)),workgroupBarrier:()=>rC("workgroup").append(),workgroupId:tC,workingToColorSpace:ey,xor:yg},Symbol.toStringTag,{value:"Module"}));class xR{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if("InstancedMesh"!==e.constructor.name)return;const n=this.writer,i=n.extensionsUsed,r={};t.extensions=t.extensions||{},t.extensions[this.name]=r;let s=new Jn;const a=new Array,o=new Array,l=new Array;for(let t=0;t<e.count;t++){e.getMatrixAt(t,s);let n=new Mn,i=new xn,r=new Mn;s.decompose(n,i,r),a.push(n.x,n.y,n.z),o.push(i.x,i.y,i.z,i.w),l.push(r.x,r.y,r.z)}const c=new Float32Array(a),u=new Float32Array(o),h=new Float32Array(l);r.attributes={TRANSLATION:n.processAccessor(new tr(c,3)),ROTATION:n.processAccessor(new tr(u,4)),SCALE:n.processAccessor(new tr(h,3))},i[this.name]=!0}}n.d(t,["aM",0,Gt,"aR",0,sn,"aj",0,es,"am",0,Ir,"an",0,Qr,"ao",0,T_,"ap",0,Wp,"aq",0,Kr,"bC",0,Ih,"bF",0,r,"bG",0,s,"bu",0,Ki,"cT",0,_R,"s",0,ht])}}]);

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.