1import"./DsnmJJEf.js";import"./D4gFHNwz.js";import{o as xl}from"./Dx9NhIZD.js";import{p as vl,o as vt,w as Li,av as mr,f as Wa,d as Ml,x as jn,r as Sl,t as El,b as ea,c as yl,l as hc,v as dc,m as pc}from"./Cl5ceSHh.js";import{i as mc}from"./dc8HcU7N.js";import{i as bl,c as Tl}from"./DrGi5eyc.js";import{b as ns}from"./k0lfUlRU.js";import{p as Rt}from"./L0jsOtlk.js";const Xa="186",gc=0,po=1,_c=2,Kr=1,xc=2,tr=3,ni=0,qt=1,_n=2,Ln=0,ir=1,ln=2,mo=3,go=4,vc=5,Pi=100,Mc=101,Sc=102,Ec=103,yc=104,bc=200,Tc=201,Ac=202,wc=203,Al=204,wl=205,Rc=206,Cc=207,Pc=208,Lc=209,Dc=210,Ic=211,Uc=212,Nc=213,Fc=214,ta=0,na=1,ia=2,ar=3,ra=4,sa=5,aa=6,oa=7,Rl=0,Oc=1,Bc=2,Mn=0,Cl=1,Pl=2,Ll=3,Dl=4,Il=5,Ul=6,Nl=7,Fl=300,ii=301,Oi=302,vs=303,Ms=304,ms=306,la=1e3,Pn=1001,ca=1002,It=1003,zc=1004,gr=1005,Bt=1006,Ss=1007,ei=1008,nn=1009,Ol=1010,Bl=1011,or=1012,qa=1013,Sn=1014,xn=1015,En=1016,Ya=1017,Za=1018,lr=1020,zl=35902,Gl=35899,Hl=1021,Vl=1022,un=1023,Un=1026,ti=1027,kl=1028,Ka=1029,ri=1030,$a=1031,Ja=1033,$r=33776,Jr=33777,Qr=33778,jr=33779,ua=35840,fa=35841,ha=35842,da=35843,pa=36196,ma=37492,ga=37496,_a=37488,xa=37489,is=37490,va=37491,Ma=37808,Sa=37809,Ea=37810,ya=37811,ba=37812,Ta=37813,Aa=37814,wa=37815,Ra=37816,Ca=37817,Pa=37818,La=37819,Da=37820,Ia=37821,Ua=36492,Na=36494,Fa=36495,Oa=36283,Ba=36284,rs=36285,za=36286,Gc=3200,_o=0,Hc=1,Wn="",Xt="srgb",ss="srgb-linear",as="linear",dt="srgb",Es=7680,Vc=519,kc=512,Wc=513,Xc=514,Qa=515,qc=516,Yc=517,ja=518,Zc=519,Wl=35044,xo="300 es",vn=2e3,os=2001;function Kc(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function ls(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function $c(){const i=ls("canvas");return i.style.display="block",i}const vo={};function cs(...i){const e="THREE."+i.shift();console.log(e,...i)}function Xl(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function We(...i){i=Xl(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function lt(...i){i=Xl(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Ui(...i){const e=i.join(" ");e in vo||(vo[e]=!0,We(...i))}function Jc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const Qc={[ta]:na,[ia]:aa,[ra]:oa,[ar]:sa,[na]:ta,[aa]:ia,[oa]:ra,[sa]:ar};class ai{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Ft=["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 Mo=1234567;const Ni=Math.PI/180,cr=180/Math.PI;function Dn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ft[i&255]+Ft[i>>8&255]+Ft[i>>16&255]+Ft[i>>24&255]+"-"+Ft[e&255]+Ft[e>>8&255]+"-"+Ft[e>>16&15|64]+Ft[e>>24&255]+"-"+Ft[t&63|128]+Ft[t>>8&255]+"-"+Ft[t>>16&255]+Ft[t>>24&255]+Ft[n&255]+Ft[n>>8&255]+Ft[n>>16&255]+Ft[n>>24&255]).toLowerCase()}function rt(i,e,t){return Math.max(e,Math.min(t,i))}function eo(i,e){return(i%e+e)%e}function jc(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}
vendor: 4,415 bytes, line 1
1function eu(i,e,t){return i!==e?(t-i)/(e-i):0}function rr(i,e,t){return(1-t)*i+t*e}function tu(i,e,t,n){return rr(i,e,1-Math.exp(-t*n))}function nu(i,e=1){return e-Math.abs(eo(i,e*2)-e)}function iu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function ru(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function su(i,e){return i+Math.floor(Math.random()*(e-i+1))}function au(i,e){return i+Math.random()*(e-i)}function ou(i){return i*(.5-Math.random())}function lu(i){i!==void 0&&(Mo=i);let e=Mo+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function cu(i){return i*Ni}function uu(i){return i*cr}function fu(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function hu(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function du(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function pu(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),c=a(t/2),l=s((e+n)/2),d=a((e+n)/2),g=s((e-n)/2),u=a((e-n)/2),h=s((n-e)/2),x=a((n-e)/2);switch(r){case"XYX":i.set(o*d,c*g,c*u,o*l);break;case"YZY":i.set(c*u,o*d,c*g,o*l);break;case"ZXZ":i.set(c*g,c*u,o*d,o*l);break;case"XZX":i.set(o*d,c*x,c*h,o*l);break;case"YXY":i.set(c*h,o*d,c*x,o*l);break;case"ZYZ":i.set(c*x,c*h,o*d,o*l);break;default:We("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function cn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:case Uint8ClampedArray:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function pt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const Wi={DEG2RAD:Ni,RAD2DEG:cr,generateUUID:Dn,clamp:rt,euclideanModulo:eo,mapLinear:jc,inverseLerp:eu,lerp:rr,damp:tu,pingpong:nu,smoothstep:iu,smootherstep:ru,randInt:su,randFloat:au,randFloatSpread:ou,seededRandom:lu,degToRad:cu,radToDeg:uu,isPowerOfTwo:fu,ceilPowerOfTwo:hu,floorPowerOfTwo:du,setQuaternionFromProperEuler:pu,normalize:pt,denormalize:cn},oo=class oo{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}
vendor: 39,873 bytes, line 1
1round(){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(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rt(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),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};oo.prototype.isVector2=!0;let $e=oo;class zi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let c=n[r+0],l=n[r+1],d=n[r+2],g=n[r+3],u=s[a+0],h=s[a+1],x=s[a+2],S=s[a+3];if(g!==S||c!==u||l!==h||d!==x){let m=c*u+l*h+d*x+g*S;m<0&&(u=-u,h=-h,x=-x,S=-S,m=-m);let f=1-o;if(m<.9995){const E=Math.acos(m),w=Math.sin(E);f=Math.sin(f*E)/w,o=Math.sin(o*E)/w,c=c*f+u*o,l=l*f+h*o,d=d*f+x*o,g=g*f+S*o}else{c=c*f+u*o,l=l*f+h*o,d=d*f+x*o,g=g*f+S*o;const E=1/Math.sqrt(c*c+l*l+d*d+g*g);c*=E,l*=E,d*=E,g*=E}}e[t]=c,e[t+1]=l,e[t+2]=d,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],c=n[r+1],l=n[r+2],d=n[r+3],g=s[a],u=s[a+1],h=s[a+2],x=s[a+3];return e[t]=o*x+d*g+c*h-l*u,e[t+1]=c*x+d*u+l*g-o*h,e[t+2]=l*x+d*h+o*u-c*g,e[t+3]=d*x-o*g-c*u-l*h,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),d=o(r/2),g=o(s/2),u=c(n/2),h=c(r/2),x=c(s/2);switch(a){case"XYZ":this._x=u*d*g+l*h*x,this._y=l*h*g-u*d*x,this._z=l*d*x+u*h*g,this._w=l*d*g-u*h*x;break;case"YXZ":this._x=u*d*g+l*h*x,this._y=l*h*g-u*d*x,this._z=l*d*x-u*h*g,this._w=l*d*g+u*h*x;break;case"ZXY":this._x=u*d*g-l*h*x,this._y=l*h*g+u*d*x,this._z=l*d*x+u*h*g,this._w=l*d*g-u*h*x;break;case"ZYX":this._x=u*d*g-l*h*x,this._y=l*h*g+u*d*x,this._z=l*d*x-u*h*g,this._w=l*d*g+u*h*x;break;case"YZX":this._x=u*d*g+l*h*x,this._y=l*h*g+u*d*x,this._z=l*d*x-u*h*g,this._w=l*d*g-u*h*x;break;case"XZY":this._x=u*d*g-l*h*x,this._y=l*h*g-u*d*x,this._z=l*d*x+u*h*g,this._w=l*d*g+u*h*x;break;default:We("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],d=t[6],g=t[10],u=n+o+g;if(u>0){const h=.5/Math.sqrt(u+1);this._w=.25/h,this._x=(d-c)*h,this._y=(s-l)*h,this._z=(a-r)*h}else if(n>o&&n>g){const h=2*Math.sqrt(1+n-o-g);this._w=(d-c)/h,this._x=.25*h,this._y=(r+a)/h,this._z=(s+l)/h}else if(o>g){const h=2*Math.sqrt(1+o-n-g);this._w=(s-l)/h,this._x=(r+a)/h,this._y=.25*h,this._z=(c+d)/h}else{const h=2*Math.sqrt(1+g-n-o);this._w=(a-r)/h,this._x=(s+l)/h,this._y=(c+d)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(rt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,d=t._w;return this._x=n*d+a*o+r*l-s*c,this._y=r*d+a*c+s*o-n*l,this._z=s*d+a*l+n*c-r*o,this._w=a*d-n*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),d=Math.sin(l);c=Math.sin(c*l)/d,t=Math.sin(t*l)/d,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return 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(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*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}}const lo=class lo{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(So.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(So.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*n),d=2*(o*t-s*r),g=2*(s*n-a*t);return this.x=t+c*l+a*g-o*d,this.y=n+c*d+o*l-s*g,this.z=r+c*g+s*d-a*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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=r*c-s*o,this.y=s*a-n*c,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ys.copy(this).projectOnVector(e),this.sub(ys)}reflect(e){return this.sub(ys.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};lo.prototype.isVector3=!0;let F=lo;const ys=new F,So=new zi,co=class co{constructor(e,t,n,r,s,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l)}set(e,t,n,r,s,a,o,c,l){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=c,d[6]=n,d[7]=a,d[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,r=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],d=n[4],g=n[7],u=n[2],h=n[5],x=n[8],S=r[0],m=r[3],f=r[6],E=r[1],w=r[4],M=r[7],A=r[2],y=r[5],R=r[8];return s[0]=a*S+o*E+c*A,s[3]=a*m+o*w+c*y,s[6]=a*f+o*M+c*R,s[1]=l*S+d*E+g*A,s[4]=l*m+d*w+g*y,s[7]=l*f+d*M+g*R,s[2]=u*S+h*E+x*A,s[5]=u*m+h*w+x*y,s[8]=u*f+h*M+x*R,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],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8];return t*a*d-t*o*l-n*s*d+n*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8],g=d*a-o*l,u=o*c-d*s,h=l*s-a*c,x=t*g+n*u+r*h;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=g*S,e[1]=(r*l-d*n)*S,e[2]=(o*n-r*a)*S,e[3]=u*S,e[4]=(d*t-r*c)*S,e[5]=(r*s-o*t)*S,e[6]=h*S,e[7]=(n*c-l*t)*S,e[8]=(a*t-n*s)*S,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,r,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return Ui("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(bs.makeScale(e,t)),this}rotate(e){return Ui("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(bs.makeRotation(-e)),this}translate(e,t){return Ui("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(bs.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 r=0;r<9;r++)if(t[r]!==n[r])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)}};co.prototype.isMatrix3=!0;let Ye=co;const bs=new Ye,Eo=new Ye().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),yo=new Ye().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mu(){const i={enabled:!0,workingColorSpace:ss,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===dt&&(r.r=In(r.r),r.g=In(r.g),r.b=In(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===dt&&(r.r=Fi(r.r),r.g=Fi(r.g),r.b=Fi(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Wn?as:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Ui("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Ui("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[ss]:{primaries:e,whitePoint:n,transfer:as,toXYZ:Eo,fromXYZ:yo,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Xt},outputColorSpaceConfig:{drawingBufferColorSpace:Xt}},[Xt]:{primaries:e,whitePoint:n,transfer:dt,toXYZ:Eo,fromXYZ:yo,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Xt}}}),i}const st=mu();function In(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Fi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let di;class gu{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{di===void 0&&(di=ls("canvas")),di.width=e.width,di.height=e.height;const r=di.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=di}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ls("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=In(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(In(t[n]/255)*255):t[n]=In(t[n]);return{data:t,width:e.width,height:e.height}}else return We("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let _u=0;class to{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:_u++}),this.uuid=Dn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Ts(r[a].image)):s.push(Ts(r[a]))}else s=Ts(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ts(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?gu.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(We("Texture: Unable to serialize Texture."),{})}let xu=0;const As=new F;class zt extends ai{constructor(e=zt.DEFAULT_IMAGE,t=zt.DEFAULT_MAPPING,n=Pn,r=Pn,s=Bt,a=ei,o=un,c=nn,l=zt.DEFAULT_ANISOTROPY,d=Wn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xu++}),this.uuid=Dn(),this.name="",this.source=new to(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new $e(0,0),this.repeat=new $e(1,1),this.center=new $e(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ye,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(As).x}get height(){return this.source.getSize(As).y}get depth(){return this.source.getSize(As).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){We(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){We(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,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!==Fl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case la:e.x=e.x-Math.floor(e.x);break;case Pn:e.x=e.x<0?0:1;break;case ca:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case la:e.y=e.y-Math.floor(e.y);break;case Pn:e.y=e.y<0?0:1;break;case ca:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}zt.DEFAULT_IMAGE=null;zt.DEFAULT_MAPPING=Fl;zt.DEFAULT_ANISOTROPY=1;const uo=class uo{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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("THREE.Vector4: 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("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}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,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);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,r,s;const c=e.elements,l=c[0],d=c[4],g=c[8],u=c[1],h=c[5],x=c[9],S=c[2],m=c[6],f=c[10];if(Math.abs(d-u)<.01&&Math.abs(g-S)<.01&&Math.abs(x-m)<.01){if(Math.abs(d+u)<.1&&Math.abs(g+S)<.1&&Math.abs(x+m)<.1&&Math.abs(l+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(l+1)/2,M=(h+1)/2,A=(f+1)/2,y=(d+u)/4,R=(g+S)/4,_=(x+m)/4;return w>M&&w>A?w<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(w),r=y/n,s=R/n):M>A?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=y/r,s=_/r):A<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(A),n=R/s,r=_/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-x)*(m-x)+(g-S)*(g-S)+(u-d)*(u-d));return Math.abs(E)<.001&&(E=1),this.x=(m-x)/E,this.y=(g-S)/E,this.z=(u-d)/E,this.w=Math.acos((l+h+f-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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this.w=rt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this.w=rt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};uo.prototype.isVector4=!0;let yt=uo;class vu extends ai{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Bt,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new yt(0,0,e,t),this.scissorTest=!1,this.viewport=new yt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new zt(r),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Bt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new to(r)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){const t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class fn extends vu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ql extends zt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Mu extends zt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}}const ps=class ps{constructor(e,t,n,r,s,a,o,c,l,d,g,u,h,x,S,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l,d,g,u,h,x,S,m)}set(e,t,n,r,s,a,o,c,l,d,g,u,h,x,S,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=d,f[10]=g,f[14]=u,f[3]=h,f[7]=x,f[11]=S,f[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ps().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 this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(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){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/pi.setFromMatrixColumn(e,0).length(),s=1/pi.setFromMatrixColumn(e,1).length(),a=1/pi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,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,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(r),l=Math.sin(r),d=Math.cos(s),g=Math.sin(s);if(e.order==="XYZ"){const u=a*d,h=a*g,x=o*d,S=o*g;t[0]=c*d,t[4]=-c*g,t[8]=l,t[1]=h+x*l,t[5]=u-S*l,t[9]=-o*c,t[2]=S-u*l,t[6]=x+h*l,t[10]=a*c}else if(e.order==="YXZ"){const u=c*d,h=c*g,x=l*d,S=l*g;t[0]=u+S*o,t[4]=x*o-h,t[8]=a*l,t[1]=a*g,t[5]=a*d,t[9]=-o,t[2]=h*o-x,t[6]=S+u*o,t[10]=a*c}else if(e.order==="ZXY"){const u=c*d,h=c*g,x=l*d,S=l*g;t[0]=u-S*o,t[4]=-a*g,t[8]=x+h*o,t[1]=h+x*o,t[5]=a*d,t[9]=S-u*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const u=a*d,h=a*g,x=o*d,S=o*g;t[0]=c*d,t[4]=x*l-h,t[8]=u*l+S,t[1]=c*g,t[5]=S*l+u,t[9]=h*l-x,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const u=a*c,h=a*l,x=o*c,S=o*l;t[0]=c*d,t[4]=S-u*g,t[8]=x*g+h,t[1]=g,t[5]=a*d,t[9]=-o*d,t[2]=-l*d,t[6]=h*g+x,t[10]=u-S*g}else if(e.order==="XZY"){const u=a*c,h=a*l,x=o*c,S=o*l;t[0]=c*d,t[4]=-g,t[8]=l*d,t[1]=u*g+S,t[5]=a*d,t[9]=h*g-x,t[2]=x*g-h,t[6]=o*d,t[10]=S*g+u}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(Su,e,Eu)}lookAt(e,t,n){const r=this.elements;return $t.subVectors(e,t),$t.lengthSq()===0&&($t.z=1),$t.normalize(),Bn.crossVectors(n,$t),Bn.lengthSq()===0&&(Math.abs(n.z)===1?$t.x+=1e-4:$t.z+=1e-4,$t.normalize(),Bn.crossVectors(n,$t)),Bn.normalize(),_r.crossVectors($t,Bn),r[0]=Bn.x,r[4]=_r.x,r[8]=$t.x,r[1]=Bn.y,r[5]=_r.y,r[9]=$t.y,r[2]=Bn.z,r[6]=_r.z,r[10]=$t.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],d=n[1],g=n[5],u=n[9],h=n[13],x=n[2],S=n[6],m=n[10],f=n[14],E=n[3],w=n[7],M=n[11],A=n[15],y=r[0],R=r[4],_=r[8],b=r[12],P=r[1],I=r[5],O=r[9],H=r[13],U=r[2],V=r[6],q=r[10],K=r[14],ee=r[3],Y=r[7],$=r[11],te=r[15];return s[0]=a*y+o*P+c*U+l*ee,s[4]=a*R+o*I+c*V+l*Y,s[8]=a*_+o*O+c*q+l*$,s[12]=a*b+o*H+c*K+l*te,s[1]=d*y+g*P+u*U+h*ee,s[5]=d*R+g*I+u*V+h*Y,s[9]=d*_+g*O+u*q+h*$,s[13]=d*b+g*H+u*K+h*te,s[2]=x*y+S*P+m*U+f*ee,s[6]=x*R+S*I+m*V+f*Y,s[10]=x*_+S*O+m*q+f*$,s[14]=x*b+S*H+m*K+f*te,s[3]=E*y+w*P+M*U+A*ee,s[7
vendor: 4,158 bytes, line 1
1]=E*R+w*I+M*V+A*Y,s[11]=E*_+w*O+M*q+A*$,s[15]=E*b+w*H+M*K+A*te,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],r=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],d=e[2],g=e[6],u=e[10],h=e[14],x=e[3],S=e[7],m=e[11],f=e[15],E=c*h-l*u,w=o*h-l*g,M=o*u-c*g,A=a*h-l*d,y=a*u-c*d,R=a*g-o*d;return t*(S*E-m*w+f*M)-n*(x*E-m*A+f*y)+r*(x*w-S*A+f*R)-s*(x*M-S*y+m*R)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],c=e[2],l=e[6],d=e[10];return t*(a*d-o*l)-n*(s*d-o*c)+r*(s*l-a*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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8],g=e[9],u=e[10],h=e[11],x=e[12],S=e[13],m=e[14],f=e[15],E=t*o-n*a,w=t*c-r*a,M=t*l-s*a,A=n*c-r*o,y=n*l-s*o,R=r*l-s*c,_=d*S-g*x,b=d*m-u*x,P=d*f-h*x,I=g*m-u*S,O=g*f-h*S,H=u*f-h*m,U=E*H-w*O+M*I+A*P-y*b+R*_;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/U;return e[0]=(o*H-c*O+l*I)*V,e[1]=(r*O-n*H-s*I)*V,e[2]=(S*R-m*y+f*A)*V,e[3]=(u*y-g*R-h*A)*V,e[4]=(c*P-a*H-l*b)*V,e[5]=(t*H-r*P+s*b)*V,e[6]=(m*M-x*R-f*w)*V,e[7]=(d*R-u*M+h*w)*V,e[8]=(a*O-o*P+l*_)*V,e[9]=(n*P-t*O-s*_)*V,e[10]=(x*y-S*M+f*E)*V,e[11]=(g*M-d*y-h*E)*V,e[12]=(o*b-a*I-c*_)*V,e[13]=(t*I-n*b+r*_)*V,e[14]=(S*w-x*A-m*E)*V,e[15]=(d*A-g*w+u*E)*V,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,d=s*o;return this.set(l*a+n,l*o-r*c,l*c+r*o,0,l*o+r*c,d*o+n,d*c-r*a,0,l*c-r*o,d*c+r*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,d=a+a,g=o+o,u=s*l,h=s*d,x=s*g,S=a*d,m=a*g,f=o*g,E=c*l,w=c*d,M=c*g,A=n.x,y=n.y,R=n.z;return r[0]=(1-(S+f))*A,r[1]=(h+M)*A,r[2]=(x-w)*A,r[3]=0,r[4]=(h-M)*y,r[5]=(1-(u+f))*y,r[6]=(m+E)*y,r[7]=0,r[8]=(x+w)*R,r[9]=(m-E)*R,r[10]=(1-(u+S))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=pi.set(r[0],r[1],r[2]).length();const o=pi.set(r[4],r[5],r[6]).length(),c=pi.set(r[8],r[9],r[10]).length();s<0&&(a=-a),sn.copy(this);const l=1/a,d=1/o,g=1/c;return sn.elements[0]*=l,sn.elements[1]*=l,sn.elements[2]*=l,sn.elements[4]*=d,sn.elements[5]*=d,sn.elements[6]*=d,sn.elements[8]*=g,sn.elements[9]*=g,sn.elements[10]*=g,t.setFromRotationMatrix(sn),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,r,s,a,o=vn,c=!1){const l=this.elements,d=2*s/(t-e),g=2*s/(n-r),u=(t+e)/(t-e),h=(n+r)/(n-r);let x,S;if(c)x=s/(a-s),S=a*s/(a-s);else if(o===vn)x=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===os)x=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=d,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=g,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10
vendor: 25,282 bytes, line 1
1]=x,l[14]=S,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=vn,c=!1){const l=this.elements,d=2/(t-e),g=2/(n-r),u=-(t+e)/(t-e),h=-(n+r)/(n-r);let x,S;if(c)x=1/(a-s),S=a/(a-s);else if(o===vn)x=-2/(a-s),S=-(a+s)/(a-s);else if(o===os)x=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=d,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=g,l[9]=0,l[13]=h,l[2]=0,l[6]=0,l[10]=x,l[14]=S,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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}};ps.prototype.isMatrix4=!0;let Et=ps;const pi=new F,sn=new Et,Su=new F(0,0,0),Eu=new F(1,1,1),Bn=new F,_r=new F,$t=new F,bo=new Et,To=new zi;class si{constructor(e=0,t=0,n=0,r=si.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,s=r[0],a=r[4],o=r[8],c=r[1],l=r[5],d=r[9],g=r[2],u=r[6],h=r[10];switch(t){case"XYZ":this._y=Math.asin(rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,h),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-rt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,h),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(rt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-g,h),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-rt(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(u,h),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(rt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,l),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(o,h));break;case"XZY":this._z=Math.asin(-rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,h),this._y=0);break;default:We("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return bo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(bo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return To.setFromEuler(this),this.setFromQuaternion(To,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}si.DEFAULT_ORDER="XYZ";class Yl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let yu=0;const Ao=new F,mi=new zi,bn=new Et,xr=new F,Xi=new F,bu=new F,Tu=new zi,wo=new F(1,0,0),Ro=new F(0,1,0),Co=new F(0,0,1),Po={type:"added"},Au={type:"removed"},gi={type:"childadded",child:null},ws={type:"childremoved",child:null};class Gt extends ai{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yu++}),this.uuid=Dn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Gt.DEFAULT_UP.clone();const e=new F,t=new si,n=new zi,r=new F(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),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:r},modelViewMatrix:{value:new Et},normalMatrix:{value:new Ye}}),this.matrix=new Et,this.matrixWorld=new Et,this.matrixAutoUpdate=Gt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Gt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return mi.setFromAxisAngle(e,t),this.quaternion.multiply(mi),this}rotateOnWorldAxis(e,t){return mi.setFromAxisAngle(e,t),this.quaternion.premultiply(mi),this}rotateX(e){return this.rotateOnAxis(wo,e)}rotateY(e){return this.rotateOnAxis(Ro,e)}rotateZ(e){return this.rotateOnAxis(Co,e)}translateOnAxis(e,t){return Ao.copy(e).applyQuaternion(this.quaternion),this.position.add(Ao.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wo,e)}translateY(e){return this.translateOnAxis(Ro,e)}translateZ(e){return this.translateOnAxis(Co,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?xr.copy(e):xr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bn.lookAt(Xi,xr,this.up):bn.lookAt(xr,Xi,this.up),this.quaternion.setFromRotationMatrix(bn),r&&(bn.extractRotation(r.matrixWorld),mi.setFromRotationMatrix(bn),this.quaternion.premultiply(mi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(lt("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(Po),gi.child=e,this.dispatchEvent(gi),gi.child=null):lt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Au),ws.child=e,this.dispatchEvent(ws),ws.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),bn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bn.multiply(e.parent.matrixWorld)),e.applyMatrix4(bn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Po),gi.child=e,this.dispatchEvent(gi),gi.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,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].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(Xi,e,bu),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xi,Tu,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?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,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,d=c.length;l<d;l++){const g=c[l];s(e.shapes,g)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];r.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),d=a(e.images),g=a(e.shapes),u=a(e.skeletons),h=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),d.length>0&&(n.images=d),g.length>0&&(n.shapes=g),u.length>0&&(n.skeletons=u),h.length>0&&(n.animations=h),x.length>0&&(n.nodes=x)}return n.object=r,n;function a(o){const c=[];for(const l in o){const d=o[l];delete d.metadata,c.push(d)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}Gt.DEFAULT_UP=new F(0,1,0);Gt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Gt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Cn extends Gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const wu={type:"move"};class Rs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Cn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Cn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Cn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){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}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const S of e.hand.values()){const m=t.getJointPose(S,n),f=this._getHandJoint(l,S);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const d=l.joints["index-finger-tip"],g=l.joints["thumb-tip"],u=d.position.distanceTo(g.position),h=.02,x=.005;l.inputState.pinching&&u>h+x?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=h-x&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(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,this.dispatchEvent(wu)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Cn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Zl={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},zn={h:0,s:0,l:0},vr={h:0,s:0,l:0};function Cs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Xt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,st.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=st.workingColorSpace){return this.r=e,this.g=t,this.b=n,st.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=st.workingColorSpace){if(e=eo(e,1),t=rt(t,0,1),n=rt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Cs(a,s,e+1/3),this.g=Cs(a,s,e),this.b=Cs(a,s,e-1/3)}return st.colorSpaceToWorking(this,r),this}setStyle(e,t=Xt){function n(s){s!==void 0&&parseFloat(s)<1&&We("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:We("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);We("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Xt){const n=Zl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):We("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=In(e.r),this.g=In(e.g),this.b=In(e.b),this}copyLinearToSRGB(e){return this.r=Fi(e.r),this.g=Fi(e.g),this.b=Fi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Xt){return st.workingToColorSpace(Ot.copy(this),e),Math.round(rt(Ot.r*255,0,255))*65536+Math.round(rt(Ot.g*255,0,255))*256+Math.round(rt(Ot.b*255,0,255))}getHexString(e=Xt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=st.workingColorSpace){st.workingToColorSpace(Ot.copy(this),t);const n=Ot.r,r=Ot.g,s=Ot.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let c,l;const d=(o+a)/2;if(o===a)c=0,l=0;else{const g=a-o;switch(l=d<=.5?g/(a+o):g/(2-a-o),a){case n:c=(r-s)/g+(r<s?6:0);break;case r:c=(s-n)/g+2;break;case s:c=(n-r)/g+4;break}c/=6}return e.h=c,e.s=l,e.l=d,e}getRGB(e,t=st.workingColorSpace){return st.workingToColorSpace(Ot.copy(this),t),e.r=Ot.r,e.g=Ot.g,e.b=Ot.b,e}getStyle(e=Xt){st.workingToColorSpace(Ot.copy(this),e);const t=Ot.r,n=Ot.g,r=Ot.b;return e!==Xt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(zn),this.setHSL(zn.h+e,zn.s+t,z
vendor: 5,125 bytes, line 1
1n.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(zn),e.getHSL(vr);const n=rr(zn.h,vr.h,t),r=rr(zn.s,vr.s,t),s=rr(zn.l,vr.l,t);return this.setHSL(n,r,s),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,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,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 Ot=new Xe;Xe.NAMES=Zl;class no{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Xe(e),this.near=t,this.far=n}clone(){return new no(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Ru extends Gt{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 si,this.environmentIntensity=1,this.environmentRotation=new si,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}}const an=new F,Tn=new F,Ps=new F,An=new F,_i=new F,xi=new F,Lo=new F,Ls=new F,Ds=new F,Is=new F,Us=new yt,Ns=new yt,Fs=new yt;class Qt{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),an.subVectors(e,t),r.cross(an);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){an.subVectors(r,t),Tn.subVectors(n,t),Ps.subVectors(e,t);const a=an.dot(an),o=an.dot(Tn),c=an.dot(Ps),l=Tn.dot(Tn),d=Tn.dot(Ps),g=a*l-o*o;if(g===0)return s.set(0,0,0),null;const u=1/g,h=(l*c-o*d)*u,x=(a*d-o*c)*u;return s.set(1-h-x,x,h)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,An)===null?!1:An.x>=0&&An.y>=0&&An.x+An.y<=1}static getInterpolation(e,t,n,r,s,a,o,c){return this.getBarycoord(e,t,n,r,An)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,An.x),c.addScaledVector(a,An.y),c.addScaledVector(o,An.z),c)}static getInterpolatedAttribute(e,t,n,r,s,a){return Us.setScalar(0),Ns.setScalar(0),Fs.setScalar(0),Us.fromBufferAttribute(e,t),Ns.fromBufferAttribute(e,n),Fs.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Us,s.x),a.addScaledVector(Ns,s.y),a.addScaledVector(Fs,s.z),a}static isFrontFacing(e,t,n,r){return an.subVectors(n,t),Tn.subVectors(e,t),an.cross(Tn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 an.subVectors(this.c,this.b),Tn.subVectors(this.a,this.b),an.cross(Tn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Qt.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 6,209 bytes, line 1
1getInterpolation(e,t,n,r,s){return Qt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Qt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;_i.subVectors(r,n),xi.subVectors(s,n),Ls.subVectors(e,n);const c=_i.dot(Ls),l=xi.dot(Ls);if(c<=0&&l<=0)return t.copy(n);Ds.subVectors(e,r);const d=_i.dot(Ds),g=xi.dot(Ds);if(d>=0&&g<=d)return t.copy(r);const u=c*g-d*l;if(u<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(n).addScaledVector(_i,a);Is.subVectors(e,s);const h=_i.dot(Is),x=xi.dot(Is);if(x>=0&&h<=x)return t.copy(s);const S=h*l-c*x;if(S<=0&&l>=0&&x<=0)return o=l/(l-x),t.copy(n).addScaledVector(xi,o);const m=d*x-h*g;if(m<=0&&g-d>=0&&h-x>=0)return Lo.subVectors(s,r),o=(g-d)/(g-d+(h-x)),t.copy(r).addScaledVector(Lo,o);const f=1/(m+S+u);return a=S*f,o=u*f,t.copy(n).addScaledVector(_i,a).addScaledVector(xi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class fr{constructor(e=new F(1/0,1/0,1/0),t=new F(-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(on.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(on.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=on.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(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,on):on.fromBufferAttribute(s,a),on.applyMatrix4(e.matrixWorld),this.expandByPoint(on);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Mr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Mr.copy(n.boundingBox)),Mr.applyMatrix4(e.matrixWorld),this.union(Mr)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],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,on),on.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qi),Sr.subVectors(this.max,qi),vi.subVectors(e.a,qi),Mi.subVectors(e.b,qi),Si.subVectors(e.c,qi),Gn.subVectors(Mi,vi),Hn.subVectors(Si,Mi),Zn.subVectors(vi,Si);let t=[0,-Gn.z,Gn.y,0,-Hn.z,Hn.y,0,-Zn.z,Zn.y,Gn.z,0,-Gn.x,Hn.z,0,-Hn.x,Zn.z,0,-Zn.x,-Gn.y,Gn.x,0,-Hn.y,Hn.x,0,-Zn.y,Zn.x,0];return!Os(t,vi,Mi,Si,Sr)||(t=[1,0,0,0,1,0,0,0,1],!Os(t,vi,Mi,Si,Sr))?!1:(Er.crossVectors(Gn,Hn),t=[Er.x,Er.y,Er.z],Os(t,vi,Mi,Si,Sr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,on).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(on).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const wn=[new F,new F,new F,new F,new F,new F,new F,new F],on=new F,Mr=new fr,vi=new F,Mi=new F,Si=new F,Gn=new F,Hn=new F,Zn=new F,qi=new F,Sr=new F,Er=new F,Kn=new F;function Os(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Kn.fromArray(i,s);const o=r.x*Math.abs(Kn.x)+r.y*Math.abs(Kn.y)+r.z*Math.abs(Kn.z),c=e.dot(Kn),l=t.dot(Kn),d=n.dot(Kn);
vendor: 5,088 bytes, line 1
1if(Math.max(-Math.max(c,l,d),Math.min(c,l,d))>o)return!1}return!0}const At=new F,yr=new $e;let Cu=0;class gt extends ai{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Cu++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Wl,this.updateRanges=[],this.gpuType=xn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)yr.fromBufferAttribute(this,t),yr.applyMatrix3(e),this.setXY(t,yr.x,yr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)At.fromBufferAttribute(this,t),At.applyMatrix3(e),this.setXYZ(t,At.x,At.y,At.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)At.fromBufferAttribute(this,t),At.applyMatrix4(e),this.setXYZ(t,At.x,At.y,At.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)At.fromBufferAttribute(this,t),At.applyNormalMatrix(e),this.setXYZ(t,At.x,At.y,At.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)At.fromBufferAttribute(this,t),At.transformDirection(e),this.setXYZ(t,At.x,At.y,At.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=cn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=cn(t,this.array)),t}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=cn(t,this.array)),t}setY(e,t){return this.normalized&&(t=pt(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=cn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=pt(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=cn(t,this.array)),t}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),r=pt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),r=pt(r,this.array),s=pt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,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 e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}}class Kl extends gt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class $l extends gt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Dt extends gt{constructor(e,t,n){super(new Float32Array(e),t,n)}}const Pu=new fr,Yi=new F,Bs=new F;class hr{constructor(e=new F,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;t!==void 0?n.copy(t):Pu.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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)}
vendor: 17,774 bytes, line 1
1applyMatrix4(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;Yi.subVectors(e,this.center);const t=Yi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Yi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Bs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Yi.copy(e.center).add(Bs)),this.expandByPoint(Yi.copy(e.center).sub(Bs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let Lu=0;const en=new Et,zs=new Gt,Ei=new F,Jt=new fr,Zi=new fr,Lt=new F;class wt extends ai{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Lu++}),this.uuid=Dn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Kc(e)?$l:Kl)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ye().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return en.makeRotationFromQuaternion(e),this.applyMatrix4(en),this}rotateX(e){return en.makeRotationX(e),this.applyMatrix4(en),this}rotateY(e){return en.makeRotationY(e),this.applyMatrix4(en),this}rotateZ(e){return en.makeRotationZ(e),this.applyMatrix4(en),this}translate(e,t,n){return en.makeTranslation(e,t,n),this.applyMatrix4(en),this}scale(e,t,n){return en.makeScale(e,t,n),this.applyMatrix4(en),this}lookAt(e){return zs.lookAt(e),zs.updateMatrix(),this.applyMatrix4(zs.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ei).negate(),this.translate(Ei.x,Ei.y,Ei.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Dt(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&We("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){lt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Jt.setFromBufferAttribute(s),this.morphTargetsRelative?(Lt.addVectors(this.boundingBox.min,Jt.min),this.boundingBox.expandByPoint(Lt),Lt.addVectors(this.boundingBox.max,Jt.max),this.boundingBox.expandByPoint(Lt)):(this.boundingBox.expandByPoint(Jt.min),this.boundingBox.expandByPoint(Jt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&<('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new hr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){lt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const n=this.boundingSphere.center;if(Jt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Zi.setFromBufferAttribute(o),this.morphTargetsRelative?(Lt.addVectors(Jt.min,Zi.min),Jt.expandByPoint(Lt),Lt.addVectors(Jt.max,Zi.max),Jt.expandByPoint(Lt)):(Jt.expandByPoint(Zi.min),Jt.expandByPoint(Zi.max))}Jt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Lt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Lt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,d=o.count;l<d;l++)Lt.fromBufferAttribute(o,l),c&&(Ei.fromBufferAttribute(e,l),Lt.add(Ei)),r=Math.max(r,n.distanceToSquared(Lt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&<('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(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){lt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new gt(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new F,c[_]=new F;const l=new F,d=new F,g=new F,u=new $e,h=new $e,x=new $e,S=new F,m=new F;function f(_,b,P){l.fromBufferAttribute(n,_),d.fromBufferAttribute(n,b),g.fromBufferAttribute(n,P),u.fromBufferAttribute(s,_),h.fromBufferAttribute(s,b),x.fromBufferAttribute(s,P),d.sub(l),g.sub(l),h.sub(u),x.sub(u);const I=1/(h.x*x.y-x.x*h.y);isFinite(I)&&(S.copy(d).multiplyScalar(x.y).addScaledVector(g,-h.y).multiplyScalar(I),m.copy(g).multiplyScalar(h.x).addScaledVector(d,-x.x).multiplyScalar(I),o[_].add(S),o[b].add(S),o[P].add(S),c[_].add(m),c[b].add(m),c[P].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let _=0,b=E.length;_<b;++_){const P=E[_],I=P.start,O=P.count;for(let H=I,U=I+O;H<U;H+=3)f(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const w=new F,M=new F,A=new F,y=new F;function R(_){A.fromBufferAttribute(r,_),y.copy(A);const b=o[_];w.copy(b),w.sub(A.multiplyScalar(A.dot(b))).normalize(),M.crossVectors(y,b);const I=M.dot(c[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,I)}for(let _=0,b=E.length;_<b;++_){const P=E[_],I=P.start,O=P.count;for(let H=I,U=I+O;H<U;H+=3)R(e.getX(H+0)),R(e.getX(H+1)),R(e.getX(H+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new gt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,h=n.count;u<h;u++)n.setXYZ(u,0,0,0);const r=new F,s=new F,a=new F,o=new F,c=new F,l=new F,d=new F,g=new F;if(e)for(let u=0,h=e.count;u<h;u+=3){const x=e.getX(u+0),S=e.getX(u+1),m=e.getX(u+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,m),d.subVectors(a,s),g.subVectors(r,s),d.cross(g),o.fromBufferAttribute(n,x),c.fromBufferAttribute(n,S),l.fromBufferAttribute(n,m),o.add(d),c.add(d),l.add(d),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(S,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let u=0,h=t.count;u<h;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),d.subVectors(a,s),g.subVectors(r,s),d.cross(g),n.setXYZ(u+0,d.x,d.y,d.z),n.setXYZ(u+1,d.x,d.y,d.z),n.setXYZ(u+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Lt.fromBufferAttribute(e,t),Lt.normalize(),e.setXYZ(t,Lt.x,Lt.y,Lt.z)}toNonIndexed(){function e(o,c){const l=o.array,d=o.itemSize,g=o.normalized,u=new l.constructor(c.length*d);let h=0,x=0;for(let S=0,m=c.length;S<m;S++){o.isInterleavedBufferAttribute?h=c[S]*o.data.stride+o.offset:h=c[S]*d;for(let f=0;f<d;f++)u[x++]=l[h++]}return new gt(u,d,g)}if(this.index===null)return We("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new wt,n=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let d=0,g=l.length;d<g;d++){const u=l[d],h=e(u,n);c.push(h)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],d=[];for(let g=0,u=l.length;g<u;g++){const h=l[g];d.push(h.toJSON(e.data))}d.length>0&&(r[c]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const l in r){const d=r[l];this.setAttribute(l,d.clone(t))}const s=e.morphAttributes;for(const l in s){const d=[],g=s[l];for(let u=0,h=g.length;u<h;u++)d.push(g[u].clone(t));this.morphAttributes[l]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,d=a.length;l<d;l++){const g=a[l];this.addGroup(g.start,g.count,g.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Du{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Wl,this.updateRanges=[],this.version=0,this.uuid=Dn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Dn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(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){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Dn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer)));const t={uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride};return t.usage=this.usage,t}}const Vt=new F;class us{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix4(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.applyNormalMatrix(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.transformDirection(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=cn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=pt(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=cn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=cn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=cn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=cn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),r=pt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),r=pt(r,this.array),s=pt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){cs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new gt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new us(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){cs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Gs=new F,Iu=new F,Uu=new Ye;class kn{constructor(e=new F(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,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=Gs.subVectors(n,t).cross(Iu.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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,n=!0){const r=e.delta(Gs),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;
1const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}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||Uu.getNormalMatrix(e),r=this.coplanarPoint(Gs).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),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)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}let Nu=0;class oi extends ai{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Nu++}),this.uuid=Dn(),this.name="",this.type="Material",this.blending=ir,this.side=ni,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Al,this.blendDst=wl,this.blendEquation=Pi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=ar,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Vc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Es,this.stencilZFail=Es,this.stencilZPass=Es,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){We(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){We(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
1n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(s=>s.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe
1!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.
vendor: 7,978 bytes, line 1
1iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(n=>new kn().fromJSON(n))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new $e().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new $e().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,670 bytes, line 1
1adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class es extends oi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(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 yi;const Ki=new F,bi=new F,Ti=new F,Ai=new $e,$i=new $e,Jl=new Et,br=new F,Ji=new F,Tr=new F,Do=new $e,Hs=new $e,Io=new $e;class Vs extends Gt{constructor(e=new es){if(super(),this.isSprite=!0,this.type="Sprite",yi===void 0){yi=new wt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Du(t,5);yi.setIndex([0,1,2,0,2,3]),yi.setAttribute("position",new us(n,3,0,!1)),yi.setAttribute("uv",new us(n,2,3,!1))}this.geometry=yi,this.material=e,this.center=new $e(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&<('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),bi.setFromMatrixScale(this.matrixWorld),Jl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ti.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&bi.multiplyScalar(-Ti.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;Ar(br.set(-.5,-.5,0),Ti,a,bi,r,s),Ar(Ji.set(.5,-.5,0),Ti,a,bi,r,s),Ar(Tr.set(.5,.5,0),Ti,a,bi,r,s),Do.set(0,0),Hs.set(1,0),Io.set(1,1);let o=e.ray.intersectTriangle(br,Ji,Tr,!1,Ki);if(o===null&&(Ar(Ji.set(-.5,.5,0),Ti,a,bi,r,s),Hs.set(0,1),o=e.ray.intersectTriangle(br,Tr,Ji,!1,Ki),o===null))return;const c=e.ray.origin.distanceTo(Ki);c<e.near||c>e.far||t.push({distance:c,point:Ki.clone(),uv:Qt.getInterpolation(Ki,br,Ji,Tr,Do,Hs,Io,new $e),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ar(i,e,t,n,r,s){Ai.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?($i.x=s*Ai.x-r*Ai.y,$i.y=r*Ai.x+s*Ai.y):$i.copy(Ai),i.copy(e),i.x+=$i.x,i.y+=$i.y,i.applyMatrix4(Jl)}const Rn=new F,ks=new F,wr=new F,Rr=new F;class io{constructor(e=new F,t=new F(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,Rn)),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=Rn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Rn.copy(this.origin).addScaledVector(this.direction,t),Rn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ks.copy(e).add(t).multiplyScalar(.5),wr.copy(t).sub(e).normalize(),Rr.copy(this.origin).sub(ks);const s=e.distanceTo(t)*.5,a=-this.direction.dot(wr),o=Rr.dot(this.direction),c=-Rr.dot(wr),l=Rr.lengthSq(),d=Math.abs(1-a*a);let g,u,h,x;if(d>0)if(g=a*c-o,u=a*o-c,x=s*d,g>=0)if(u>=-x)if(u<=x){const S=1/d;g*=S,u*=S,h=g*(g+a*u+2*o)+u*(a*g+u+2*c)+l}else u=s,g=Math.max(0,-(a*u+o)),h=-g*g+u*(u+2*c)+l;else u=-s,g=Math.max(0,-(a*u+o)),h=-g*g+u*(u+2*c)+l;else u<=-x?(g=Math.max(0,-(-a*s+o)),u=g>0?-s:Math.min(Math.max(-s,-c),s),h=-g*g+u*(u+2*c)+l):u<=x?(g=0,u=Math.min(Math.max(-s,-c),s),h=u*(u+2*c)+l):(g=Math.max(0,-(a*s+o)),u=g>0?s:Math.min(Math.max(-s,-c),s),h=-g*g+u*(u+2*c)+l);else u=a>0?-s:s,g=Math.max(0,-(a*u+o)),h=-g*g+u*(u+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,g),r&&r.copy(ks).addScaledVector(wr,u),h}
1intersectSphere(e,t){if(e.radius<0)return null;Rn.subVectors(e.center,this.origin);const n=Rn.dot(this.direction),r=Rn.dot(Rn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?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 n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,c;const l=1/this.direction.x,d=1/this.direction.y,g=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),d>=0?(s=(e.min.y-u.y)*d,a=(e.max.y-u.y)*d):(s=(e.max.y-u.y)*d,a=(e.min.y-u.y)*d),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),g>=0?(o=(e.min.z-u.z)*g,c=(e.max.z-u.z)*g):(o=(e.max.z-u.z)*g,c=(e.min.z-u.z)*g),n>c||o>r)||((o>n||n!==n)&&(n=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Rn)!==null}intersectTriangle(e,t,n,r,s){const a=this.origin,o=this.direction,c=o.x,l=o.y,d=o.z,g=e.x-a.x,u=e.y-a.y,h=e.z-a.z,x=t.x-a.x,S=t.y-a.y,m=t.z-a.z,f=n.x-a.x,E=n.y-a.y,w=n.z-a.z,M=Math.abs(c),A=Math.abs(l),y=Math.abs(d);let R,_,b,P,I,O,H,U,V,q,K,ee;if(M>=A&&M>=y?(b=c,O=g,V=x,ee=f,c>=0?(R=l,_=d,P=u,I=h,H=S,U=m,q=E,K=w):(R=d,_=l,P=h,I=u,H=m,U=S,q=w,K=E)):A>=y?(b=l,O=u,V=S,ee=E,l>=0?(R=d,_=c,P=h,I=g,H=m,U=x,q=w,K=f):(R=c,_=d,P=g,I=h,H=x,U=m,q=f,K=w)):(b=d,O=h,V=m,ee=w,d>=0?(R=c,_=l,P=g,I=u,H=x,U=S,q=f,K=E):(R=l,_=c,P=u,I=g,H=S,U=x,q=E,K=f)),b===0)return null;const Y=R/b,$=_/b,te=1/b,we=P-Y*O,De=I-$*O,nt=H-Y*V,Ke=U-$*V,He=q-Y*ee,Z=K-$*ee,j=He*Ke-Z*nt,Se=we*Z-De*He,Ge=nt*De-Ke*we;if(r){if(j<0||Se<0||Ge<0)return null}else if((j<0||Se<0||Ge<0)&&(j>0||Se>0||Ge>0))return null;const fe=j+Se+Ge;if(fe===0)return null;const re=te*(j*O+Se*V+Ge*ee);return(fe>0?re<0:re>0)?null:this.at(re/fe,s)}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 fs extends oi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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 si,this.combine=Rl,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 Uo=new Et,$n=new io,Cr=new hr,No=new F,Pr=new F,Lr=new F,Dr=new F,Ws=new F,Ir=new F,Fo=new F,Ur=new F;class Wt extends Gt{constructor(e=new wt,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ir.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const d=o[c],g=s[c];d!==0&&(Ws.fromBufferAttribute(g,e),a?Ir.addScaledVector(Ws,d):Ir.addScaledVector(Ws.sub(t),d))}t.add(Ir)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Cr.copy(n.boundingSphere),Cr.applyMatrix4(s),$n.copy(e.ray).recast(e.near),!(Cr.containsPoint($n.origin)===!1&&($n.intersectSphere(Cr,No)===null||$n.origin.distanceToSquared(No)>(e.far-e.near)**2))&&(Uo.copy(s).invert(),$n.copy(e.ray).applyMatrix4(Uo),!(n.boundingBox!==null&&$n.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,$n)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,d=s.attributes.uv1,g=s.attributes.normal,u=s.groups,h=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const m=u[x],f=a[m.materialIndex],E=Math.max(m.start,h.start),w=Math.min(o.count,Math.min(m.start+m.count,h.start+h.count));for(let M=E,A=w;M<A;M+=3){const y=o.getX(M),R=o.getX(M+1),_=o.getX(M+2);r=Nr(this,f,e,n,l,d,g,y,R,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const x=Math.max(0,h.start),S=Math.min(o.count,h.start+h.count);for(let m=x,f=S;m<f;m+=3){const E=o.getX(m),w=o.getX(m+1),M=o.getX(m+2);r=Nr(this,a,e,n,l,d,g,E,w,M),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const m=u[x],f=a[m.materialIndex],E=Math.max(m.start,h.start),w=Math.min(c.count,Math.min(m.start+m.count,h.start+h.count));for(let M=E,A=w;M<A;M+=3){const y=M,R=M+1,_=M+2;r=Nr(this,f,e,n,l,d,g,y,R,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const x=Math.max(0,h.start),S=Math.min(c.count,h.start+h.count);for(let m=x,f=S;m<f;m+=3){const E=m,w=m+1,M=m+2;
vendor: 9,121 bytes, line 1
1r=Nr(this,a,e,n,l,d,g,E,w,M),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function Fu(i,e,t,n,r,s,a,o){let c;if(e.side===qt?c=n.intersectTriangle(a,s,r,!0,o):c=n.intersectTriangle(r,s,a,e.side===ni,o),c===null)return null;Ur.copy(o),Ur.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(Ur);return l<t.near||l>t.far?null:{distance:l,point:Ur.clone(),object:i}}function Nr(i,e,t,n,r,s,a,o,c,l){i.getVertexPosition(o,Pr),i.getVertexPosition(c,Lr),i.getVertexPosition(l,Dr);const d=Fu(i,e,t,n,Pr,Lr,Dr,Fo);if(d){const g=new F;Qt.getBarycoord(Fo,Pr,Lr,Dr,g),r&&(d.uv=Qt.getInterpolatedAttribute(r,o,c,l,g,new $e)),s&&(d.uv1=Qt.getInterpolatedAttribute(s,o,c,l,g,new $e)),a&&(d.normal=Qt.getInterpolatedAttribute(a,o,c,l,g,new F),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const u={a:o,b:c,c:l,normal:new F,materialIndex:0};Qt.getNormal(Pr,Lr,Dr,u.normal),d.face=u,d.barycoord=g}return d}class Ou extends zt{constructor(e=null,t=1,n=1,r,s,a,o,c,l=It,d=It,g,u){super(null,a,o,c,l,d,r,s,g,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Jn=new hr,Bu=new $e(.5,.5),Fr=new F;class Ql{constructor(e=new kn,t=new kn,n=new kn,r=new kn,s=new kn,a=new kn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),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=vn,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],d=s[4],g=s[5],u=s[6],h=s[7],x=s[8],S=s[9],m=s[10],f=s[11],E=s[12],w=s[13],M=s[14],A=s[15];if(r[0].setComponents(l-a,h-d,f-x,A-E).normalize(),r[1].setComponents(l+a,h+d,f+x,A+E).normalize(),r[2].setComponents(l+o,h+g,f+S,A+w).normalize(),r[3].setComponents(l-o,h-g,f-S,A-w).normalize(),n)r[4].setComponents(c,u,m,M).normalize(),r[5].setComponents(l-c,h-u,f-m,A-M).normalize();else if(r[4].setComponents(l-c,h-u,f-m,A-M).normalize(),t===vn)r[5].setComponents(l+c,h+u,f+m,A+M).normalize();else if(t===os)r[5].setComponents(c,u,m,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Jn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Jn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Jn)}intersectsSprite(e){Jn.center.set(0,0,0);const t=Bu.distanceTo(e.center);return Jn.radius=.7071067811865476+t,Jn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Jn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Fr.x=r.normal.x>0?e.max.x:e.min.x,Fr.y=r.normal.y>0?e.max.y:e.min.y,Fr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Fr)<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)}}class Ga extends oi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(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 hs=new F,ds=new F,Oo=new Et,Qi=new io,Or=new hr,Xs=new F,Bo=new F;class zu extends Gt{constructor(e=new wt,t=new Ga){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)hs.fromBufferAttribute(t,r-1),ds.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=hs.distanceTo(ds);e.setAttribute("lineDistance",new Dt(n,1))}else We("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Or.copy(n.boundingSphere),Or.applyMatrix4(r),Or.radius+=s,e.ray.intersectsSphere(Or)===!1)return;Oo.copy(r).invert(),Qi.copy(e.ray).applyMatrix4(Oo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,d=n.index,u=n.attributes.position;if(d!==null){const h=Math.max(0,a.start),x=Math.min(d.count,a.start+a.count);for(let S=h,m=x-1;S<m;S+=l){const f=d.getX(S),E=d.getX(S+1),w=Br(this,e,Qi,c,f,E,S);w&&t.push(w)}if(this.isLineLoop){const S=d.getX(x-1),m=d.getX(h),f=Br(this,e,Qi,c,S,m,x-1);f&&t.push(f)}}else{const h=Math.max(0,a.start),x=Math.min(u.count,a.start+a.count);for(let S=h,m=x-1;S<m;S+=l){const f=Br(this,e,Qi,c,S,S+1,S);f&&t.push(f)}if(this.isLineLoop){const S=Br(this,e,Qi,c,x-1,h,x-1);S&&t.push(S)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Br(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(hs.fromBufferAttribute(o,r),ds.fromBufferAttribute(o,s),t.distanceSqToSegment(hs,ds,Xs,Bo)>n)return;Xs.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Xs);if(!(l<e.near||l>e.far))return{distance:l,point:Bo.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const zo=new F,Go=new F;class Ho extends zu{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)zo.fromBufferAttribute(t,r),Go.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+zo.distanceTo(Go);e.setAttribute("lineDistance",new Dt(n,1))}else We("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Gu extends oi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Xe(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 Vo=new Et,Ha=new io,zr=new hr,Gr=new F;class Hr extends Gt{constructor(e=new wt,t=new Gu){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),zr.copy(n.boundingSphere),zr.applyMatrix4(r),zr.radius+=s,e.ray.intersectsSphere(zr)===!1)return;Vo.copy(r).invert(),Ha.copy(e.ray).applyMatrix4(Vo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,g=n.attributes.position;if(l!==null){const u=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);for(let x=u,S=h;x<S;x++){const m=l.getX(x);Gr.fromBufferAttribute(g,m),ko(Gr,m,c,r,e,t,this)}}else{const u=Math.max(0,a.start),h=Math.min(g.count,a.start+a.count);for(let x=u,S=h;x<S;x++)Gr.fromBufferAttribute(g,x),ko(Gr,x,c,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function ko(i,e,t,n,r,s,a){const o=Ha.distanceSqToPoint(i);if(o<t){const c=new F;Ha.closestPointToPoint(i,c),c.applyMatrix4(n);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class jl extends zt{constructor(e=[],t=ii,n,r,s,a,o,c,l,d){super(e,t,n,r,s,a,o,c,l,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Hu extends zt{constructor(e,t,n,r,s,a,o,c,l){super(e,t,n,r,s,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ur extends zt{constructor(e,t,n=Sn,r,s,a,o=It,c=It,l,d=Un,g=1){
vendor: 6,695 bytes, line 1
1if(d!==Un&&d!==ti)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:g};super(u,r,s,a,o,c,d,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new to(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}}class Vu extends ur{constructor(e,t=Sn,n=ii,r,s,a=It,o=It,c,l=Un){const d={width:e,height:e,depth:1},g=[d,d,d,d,d,d];super(e,e,t,n,r,s,a,o,c,l),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ec extends zt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class dr extends wt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],d=[],g=[];let u=0,h=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,r,a,2),x("x","z","y",1,-1,e,n,-t,r,a,3),x("x","y","z",1,-1,e,t,n,r,s,4),x("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new Dt(l,3)),this.setAttribute("normal",new Dt(d,3)),this.setAttribute("uv",new Dt(g,2));function x(S,m,f,E,w,M,A,y,R,_,b){const P=M/R,I=A/_,O=M/2,H=A/2,U=y/2,V=R+1,q=_+1;let K=0,ee=0;const Y=new F;for(let $=0;$<q;$++){const te=$*I-H;for(let we=0;we<V;we++){const De=we*P-O;Y[S]=De*E,Y[m]=te*w,Y[f]=U,l.push(Y.x,Y.y,Y.z),Y[S]=0,Y[m]=0,Y[f]=y>0?1:-1,d.push(Y.x,Y.y,Y.z),g.push(we/R),g.push(1-$/_),K+=1}}for(let $=0;$<_;$++)for(let te=0;te<R;te++){const we=u+te+V*$,De=u+te+V*($+1),nt=u+(te+1)+V*($+1),Ke=u+(te+1)+V*$;c.push(we,De,Ke),c.push(De,nt,Ke),ee+=6}o.addGroup(h,ee,b),h+=ee,u+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Gi extends wt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const s=[],a=[];o(r),l(n),d(),this.setAttribute("position",new Dt(s,3)),this.setAttribute("normal",new Dt(s.slice(),3)),this.setAttribute("uv",new Dt(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(E){const w=new F,M=new F,A=new F;for(let y=0;y<t.length;y+=3)h(t[y+0],w),h(t[y+1],M),h(t[y+2],A),c(w,M,A,E)}function c(E,w,M,A){const y=A+1,R=[];for(let _=0;_<=y;_++){R[_]=[];const b=E.clone().lerp(M,_/y),P=w.clone().lerp(M,_/y),I=y-_;for(let O=0;O<=I;O++)O===0&&_===y?R[_][O]=b:R[_][O]=b.clone().lerp(P,O/I)}for(let _=0;_<y;_++)for(let b=0;b<2*(y-_)-1;b++){const P=Math.floor(b/2);b%2===0?(u(R[_][P+1]),u(R[_+1][P]),u(R[_][P])):(u(R[_][P+1]),u(R[_+1][P+1]),u(R[_+1][P]))}}function l(E){const w=new F;for(let M=0;M<s.length;M+=3)w.x=s[M+0],w.y=s[M+1],w.z=s[M+2],w.normalize().multiplyScalar(E),s[M+0]=w.x,s[M+1]=w.y,s[M+2]=w.z}function d(){const E=new F;for(let w=0;w<s.length;w+=3){E.x=s[w+0],E.y=s[w+1],E.z=s[w+2];const M=m(E)/2/Math.PI+.5,A=f(E)/Math.PI+.5;a.push(M,1-A)}x(),g()}function g(){for(let E=0;E<a.length;E+=6){const w=a[E+0],M=a[E+2],A=a[E+4],y=Math.max(w,M,A),R=Math.min(w,M,A);y>.9&&R<.1&&(w<.2&&(a[E+0]+=1),M<.2&&(a[E+2]+=1),A<.2&&(a[E+4]+=1))}}function u(E){s.push(E.x,E.y,E.z)}function h(E,w){const M=E*3;w.x=e[M+0],w.y=e[M+1],w.z=e[M+2]}function x(){const E=new F,w=new F,M=new F,A=new F,y=new $e,R=new $e,_=new $e;for(let b=0,P=0;b<s.length;b+=9,P+=6){E.set(s[b+0],s[b+1],s[b+2]),w.set(s[b+3],s[b+4],s[b+5]),M.set(s[b+6],s[b+7],s[b+8]),y.set(a[P+0],a[P+1]),R.set(a[P+2],a[P+3]),_.set(a[P+4],a[P+5]),A.copy(E).add(w).add(M).divideScalar(3);const I=m(A);S(y,P+0,E,I),S(R,P+2,w,I),S(_,P+4,M,I)}}function S(E,w,M,A){A<0&&E.x===1&&(a[w]=E.x-1),M.x===0&&M.z===0&&(a[w]=A/2/Math.PI+.5)}function m(E){return Math.atan2(E.z,-E.x)}function f(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gi(e.vertices,e.indices,e.radius,e.detail)}}class ro extends Gi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ro(e.radius,e.detail)}}const Vr=new F,kr=new F,qs=new F,Wr=new Qt;class ku extends wt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(Ni*t),a=e.getIndex(),o=e.getAttribute("position"),c=a?a.count:o.count,l=[0,0,0],d=["a","b","c"],g=new Array(3),u={},h=[];for(let x=0;x<c;x+=3){a?(l[0]=a.getX(x),l[1]=a.getX(x+1),l[2]=a.getX(x+2)):(l[0]=x,l[1]=x+1,l[2]=x+2);const{a:S,b:m,c:f}=Wr;if(S.fromBufferAttribute(o,l[0]),m.fromBufferAttribute(o,l[1]),f.fromBufferAttribute(o,l[2]),Wr.getNormal(qs),g[0]=`${Math.round(S.x*r)},${Math.round(S.y*r)},${Math.round(S.z*r)}`,g[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,g[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(g[0]===g[1]||g[1]===g[2]||g[2]===g[0]))for(let E=0;E<3;E++){const w=(E+1)%3,M=g[E],A=g[w],y=Wr[d[E]],R=Wr[d[w]],_=`${M}_${A}`,b=`${A}_${M}`;b in u&&u[b]?(qs.dot(u[b].normal)<=s&&(h.push(y.x,y.y,y.z),h.push(R.x,R.y,R.z)),u[b]=null):_ in u||(u[_]={index0:l[E],index1:l[w],normal:qs.clone()})}}for(const x in u)if(u[x]){const{index0:S,index1:m}=u[x];Vr.fromBufferAttribute(o,S),kr.fromBufferAttribute(o,m),h.push(Vr.x,Vr.y,Vr.z),h.push(kr.x,kr.y,kr.z)}this.setAttribute("position",new Dt(h,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class sr extends Gi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=[-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],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}
1static fromJSON(e){return new sr(e.radius,e.detail)}}class so extends Gi{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new so(e.radius,e.detail)}}class gs extends wt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),c=Math.floor(r),l=o+1,d=c+1,g=e/o,u=t/c,h=[],x=[],S=[],m=[];for(let f=0;f<d;f++){const E=f*u-a;for(let w=0;w<l;w++){const M=w*g-s;x.push(M,-E,0),S.push(0,0,1),m.push(w/o),m.push(1-f/c)}}for(let f=0;f<c;f++)for(let E=0;E<o;E++){const w=E+l*f,M=E+l*(f+1),A=E+1+l*(f+1),y=E+1+l*f;h.push(w,M,y),h.push(M,A,y)}this.setIndex(h),this.setAttribute("position",new Dt(x,3)),this.setAttribute("normal",new Dt(S,3)),this.setAttribute("uv",new Dt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gs(e.width,e.height,e.widthSegments,e.heightSegments)}}class ao extends Gi{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ao(e.radius,e.detail)}}class Di extends wt{constructor(e=1,t=.4,n=12,r=48,s=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:s,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);const c=[],l=[],d=[],g=[],u=new F,h=new F,x=new F;for(let S=0;S<=n;S++){const m=a+S/n*o;for(let f=0;f<=r;f++){const E=f/r*s;h.x=(e+t*Math.cos(m))*Math.cos(E),h.y=(e+t*Math.cos(m))*Math.sin(E),h.z=t*Math.sin(m),l.push(h.x,h.y,h.z),u.x=e*Math.cos(E),u.y=e*Math.sin(E),x.subVectors(h,u).normalize(),d.push(x.x,x.y,x.z),g.push(f/r),g.push(S/n)}}for(let S=1;S<=n;S++)for(let m=1;m<=r;m++){const f=(r+1)*S+m-1,E=(r+1)*(S-1)+m-1,w=(r+1)*(S-1)+m,M=(r+1)*S+m;c.push(f,E,M),c.push(E,w,M)}this.setIndex(c),this.setAttribute("position",new Dt(l,3)),this.setAttribute("normal",new Dt(d,3)),this.setAttribute("uv",new Dt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Di(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc,e.thetaStart,e.thetaLength)}}function Bi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(Wo(r))r.isRenderTargetTexture?(We("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(Wo(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function kt(i){const e={};for(let t=0;t<i.length;t++){const n=Bi(i[t]);for(const r in n)e[r]=n[r]}return e}function Wo(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Wu(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function tc(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:st.workingColorSpace}const Xu={clone:Bi,merge:kt};var qu=`void main() { 2 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3}`,Yu=`void main() { 4 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 5}`;class rn extends oi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=qu,this.fragmentShader=Yu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Bi(e.uniforms),this.uniformsGroups=Wu(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}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 r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Xe().setHex(r.value);break;case"v2":this.uniforms[n].value=new $e().fromArray(r.value);break;case"v3":this.uniforms[n].value=new F().fromArray(r.value);break;case"v4":this.uniforms[n].value=new yt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Ye().fromArray(r.value);break;
5case"m4":this.uniforms[n].value=new Et().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Zu extends rn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ku extends oi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Gc,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 $u extends oi{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}}const Xr=new F,qr=new zi,pn=new F;class nc extends Gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Et,this.projectionMatrix=new Et,this.projectionMatrixInverse=new Et,this.coordinateSystem=vn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Xr,qr,pn),pn.x===1&&pn.y===1&&pn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Xr,qr,pn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Xr,qr,pn),pn.x===1&&pn.y===1&&pn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Xr,qr,pn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Vn=new F,Xo=new $e,qo=new $e;class tn extends nc{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=cr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ni*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return cr*2*Math.atan(Math.tan(Ni*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Vn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Vn.x,Vn.y).multiplyScalar(-e/Vn.z),Vn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Vn.x,Vn.y).multiplyScalar(-e/Vn.z)}getViewSize(e,t){return this.getViewBounds(e,Xo,qo),t.subVectors(qo,Xo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ni*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*n/l,r*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class ic extends nc{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
5phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(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,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=d*this.view.offsetY,c=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const wi=-90,Ri=1;class Ju extends Gt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new tn(wi,Ri,e,t);r.layers=this.layers,this.add(r);const s=new tn(wi,Ri,e,t);s.layers=this.layers,this.add(s);const a=new tn(wi,Ri,e,t);a.layers=this.layers,this.add(a);const o=new tn(wi,Ri,e,t);o.layers=this.layers,this.add(o);const c=new tn(wi,Ri,e,t);c.layers=this.layers,this.add(c);const l=new tn(wi,Ri,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===os)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,d]=this.children,g=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=S,e.setRenderTarget(n,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(g,u,h),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class Qu extends tn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const fo=class fo{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}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,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};fo.prototype.isMatrix2=!0;let Yo=fo;function Zo(i,e,t,n){const r=ju(n);switch(t){case Hl:return i*e;case kl:return i*e/r.components*r.byteLength;case Ka:return i*e/r.components*r.byteLength;case ri:return i*e*2/r.components*r.byteLength;case $a:return i*e*2/r.components*r.byteLength;case Vl:return i*e*3/r.components*r.byteLength;case un:return i*e*4/r.components*r.byteLength;case Ja:return i*e*4/r.components*r.byteLength;case $r:case Jr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Qr:case jr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case fa:case da:return Math.max(i,16)*Math.max(e,8)/4;case ua:case ha:return Math.max(i,8)*Math.max(e,8)/2;case pa:case ma:case _a:case xa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ga:case is:case va:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ma:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Sa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Ea:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case ya:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case ba:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ta:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Aa:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case wa:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Ra:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Ca:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Pa:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case La:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Da:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Ia:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ua:case Na:case Fa:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Oa:case Ba:return Math.ceil(i/4)*Math.ceil(e/4)*8;case rs:case za:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ju(i){switch(i){case nn:case Ol:return{byteLength:1,components:1};case or:case Bl:case En:return{byteLength:2,components:1};case Ya:case Za:return{byteLength:2,components:4};case Sn:case qa:case xn:return{byteLength:4,components:1};case zl:case Gl:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Xa}}));typeof window<"u"&&(window.__THREE__?We("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Xa);function rc(){let i=null,e=!1,t=null,n=null;function r(s,a){n=i.requestAnimationFrame(r),t(s,a)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function ef(i){const e=new WeakMap;function t(o,c){const l=o.array,d=o.usage,g=l.byteLength,u=i.createBuffer();i.bindBuffer(c,u),i.bufferData(c,l,d),o.onUploadCallback();let h;if(l instanceof Float32Array)h=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)h=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?h=i.HALF_FLOAT:h=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)h=i.SHORT;else if(l instanceof Uint32Array)h=i.UNSIGNED_INT;else if(l instanceof Int32Array)h=i.INT;else if(l instanceof Int8Array)h=i.BYTE;else if(l instanceof Uint8Array)h=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)h=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:u,type:h,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:g}}function n(o,c,l){const d=c.array,g=c.updateRanges;if(i.bindBuffer(l,o),g.length===0)i.bufferSubData(l,0,d);else{g.sort((h,x)=>h.start-x.start);let u=0;for(let h=1;h<g.length;h++){const x=g[u],S=g[h];
vendor: 5,158 bytes, lines 5-118
5S.start<=x.start+x.count+1?x.count=Math.max(x.count,S.start+S.count-x.start):(++u,g[u]=S)}g.length=u+1;for(let h=0,x=g.length;h<x;h++){const S=g[h];i.bufferSubData(l,S.start*d.BYTES_PER_ELEMENT,d,S.start,S.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var tf=`#ifdef USE_ALPHAHASH 6 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 7#endif`,nf=`#ifdef USE_ALPHAHASH 8 const float ALPHA_HASH_SCALE = 0.05; 9 float hash2D( vec2 value ) { 10 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 11 } 12 float hash3D( vec3 value ) { 13 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 14 } 15 float getAlphaHashThreshold( vec3 position ) { 16 float maxDeriv = max( 17 length( dFdx( position.xyz ) ), 18 length( dFdy( position.xyz ) ) 19 ); 20 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 21 vec2 pixScales = vec2( 22 exp2( floor( log2( pixScale ) ) ), 23 exp2( ceil( log2( pixScale ) ) ) 24 ); 25 vec2 alpha = vec2( 26 hash3D( floor( pixScales.x * position.xyz ) ), 27 hash3D( floor( pixScales.y * position.xyz ) ) 28 ); 29 float lerpFactor = fract( log2( pixScale ) ); 30 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 31 float a = min( lerpFactor, 1.0 - lerpFactor ); 32 vec3 cases = vec3( 33 x * x / ( 2.0 * a * ( 1.0 - a ) ), 34 ( x - 0.5 * a ) / ( 1.0 - a ), 35 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 36 ); 37 float threshold = ( x < ( 1.0 - a ) ) 38 ? ( ( x < a ) ? cases.x : cases.y ) 39 : cases.z; 40 return clamp( threshold , 1.0e-6, 1.0 ); 41 } 42#endif`,rf=`#ifdef USE_ALPHAMAP 43 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 44#endif`,sf=`#ifdef USE_ALPHAMAP 45 uniform sampler2D alphaMap; 46#endif`,af=`#ifdef USE_ALPHATEST 47 #ifdef ALPHA_TO_COVERAGE 48 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 49 if ( diffuseColor.a == 0.0 ) discard; 50 #else 51 if ( diffuseColor.a < alphaTest ) discard; 52 #endif 53#endif`,of=`#ifdef USE_ALPHATEST 54 uniform float alphaTest; 55#endif`,lf=`#ifdef USE_AOMAP 56 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 57 reflectedLight.indirectDiffuse *= ambientOcclusion; 58 #if defined( USE_CLEARCOAT ) 59 clearcoatSpecularIndirect *= ambientOcclusion; 60 #endif 61 #if defined( USE_SHEEN ) 62 sheenSpecularIndirect *= ambientOcclusion; 63 #endif 64 #if defined( USE_ENVMAP ) && defined( STANDARD ) 65 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 66 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 67 #endif 68#endif`,cf=`#ifdef USE_AOMAP 69 uniform sampler2D aoMap; 70 uniform float aoMapIntensity; 71#endif`,uf=`#ifdef USE_BATCHING 72 #if ! defined( GL_ANGLE_multi_draw ) 73 #define gl_DrawID _gl_DrawID 74 uniform int _gl_DrawID; 75 #endif 76 uniform highp sampler2D batchingTexture; 77 uniform highp usampler2D batchingIdTexture; 78 mat4 getBatchingMatrix( const in float i ) { 79 int size = textureSize( batchingTexture, 0 ).x; 80 int j = int( i ) * 4; 81 int x = j % size; 82 int y = j / size; 83 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 84 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 85 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 86 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 87 return mat4( v1, v2, v3, v4 ); 88 } 89 float getIndirectIndex( const in int i ) { 90 int size = textureSize( batchingIdTexture, 0 ).x; 91 int x = i % size; 92 int y = i / size; 93 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 94 } 95#endif 96#ifdef USE_BATCHING_COLOR 97 uniform sampler2D batchingColorTexture; 98 vec4 getBatchingColor( const in float i ) { 99 int size = textureSize( batchingColorTexture, 0 ).x; 100 int j = int( i ); 101 int x = j % size; 102 int y = j / size; 103 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 104 } 105#endif`,ff=`#ifdef USE_BATCHING 106 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 107#endif`,hf=`vec3 transformed = vec3( position ); 108#ifdef USE_ALPHAHASH 109 vPosition = vec3( position ); 110#endif`,df=`vec3 objectNormal = vec3( normal ); 111#ifdef USE_TANGENT 112 vec3 objectTangent = vec3( tangent.xyz ); 113#endif`,pf=`float G_BlinnPhong_Implicit( ) { 114 return 0.25; 115} 116float D_BlinnPhong( const in float shininess, const in float dotNH ) { 117 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 118}
119vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 120 vec3 halfDir = normalize( lightDir + viewDir ); 121 float dotNH = saturate( dot( normal, halfDir ) ); 122 float dotVH = saturate( dot( viewDir, halfDir ) ); 123 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 124 float G = G_BlinnPhong_Implicit( ); 125 float D = D_BlinnPhong( shininess, dotNH ); 126 return F * ( G * D ); 127} // validated`,mf=`#ifdef USE_IRIDESCENCE 128 const mat3 XYZ_TO_REC709 = mat3( 129 3.2404542, -0.9692660, 0.0556434, 130 -1.5371385, 1.8760108, -0.2040259, 131 -0.4985314, 0.0415560, 1.0572252 132 ); 133 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 134 vec3 sqrtF0 = sqrt( fresnel0 ); 135 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 136 } 137 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 138 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 139 } 140 float IorToFresnel0( float transmittedIor, float incidentIor ) { 141 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 142 } 143 vec3 evalSensitivity( float OPD, vec3 shift ) { 144 float phase = 2.0 * PI * OPD * 1.0e-9; 145 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 146 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 147 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 148 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 149 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 150 xyz /= 1.0685e-7; 151 vec3 rgb = XYZ_TO_REC709 * xyz; 152 return rgb; 153 } 154 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 155 vec3 I; 156 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 157 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 158 float cosTheta2Sq = 1.0 - sinTheta2Sq; 159 if ( cosTheta2Sq < 0.0 ) { 160 return vec3( 1.0 ); 161 } 162 float cosTheta2 = sqrt( cosTheta2Sq ); 163 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 164 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165 float T121 = 1.0 - R12; 166 float phi12 = 0.0; 167 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 168 float phi21 = PI - phi12; 169 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 170 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 171 vec3 phi23 = vec3( 0.0 ); 172 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 173 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 174 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 175 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 176 vec3 phi = vec3( phi21 ) + phi23; 177 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 178 vec3 r123 = sqrt( R123 ); 179 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 180 vec3 C0 = R12 + Rs; 181 I = C0; 182 vec3 Cm = Rs - T121; 183 for ( int m = 1; m <= 2; ++ m ) { 184 Cm *= r123; 185 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 186 I += Cm * Sm; 187 } 188 return max( I, vec3( 0.0 ) ); 189 } 190#endif`,gf=`#ifdef USE_BUMPMAP 191 uniform sampler2D bumpMap; 192 uniform float bumpScale; 193 vec2 dHdxy_fwd() { 194 vec2 dSTdx = dFdx( vBumpMapUv ); 195 vec2 dSTdy = dFdy( vBumpMapUv ); 196 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 197 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 198 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 199 return vec2( dBx, dBy ); 200 } 201 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 202 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 203 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 204 vec3 vN = surf_norm; 205 vec3 R1 = cross( vSigmaY, vN ); 206 vec3 R2 = cross( vN, vSigmaX ); 207 float fDet = dot( vSigmaX, R1 ) * faceDirection; 208 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 209 return normalize( abs( fDet ) * surf_norm - vGrad ); 210 } 211#endif`,_f=`#if NUM_CLIPPING_PLANES > 0 212 vec4 plane; 213 #ifdef ALPHA_TO_COVERAGE 214 float distanceToPlane, distanceGradient; 215 float clipOpacity = 1.0; 216 #pragma unroll_loop_start 217 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 218 plane = clippingPlanes[ i ]; 219 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 220 distanceGradient = fwidth( distanceToPlane ) / 2.0; 221 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 222 if ( clipOpacity == 0.0 ) discard; 223 } 224 #pragma unroll_loop_end 225 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 226 float unionClipOpacity = 1.0; 227 #pragma unroll_loop_start 228 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 229 plane = clippingPlanes[ i ]; 230 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 231 distanceGradient = fwidth( distanceToPlane ) / 2.0; 232 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 233 } 234 #pragma unroll_loop_end 235 clipOpacity *= 1.0 - unionClipOpacity; 236 #endif 237 diffuseColor.a *= clipOpacity; 238 if ( diffuseColor.a == 0.0 ) discard; 239 #else 240 #pragma unroll_loop_start 241 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 242 plane = clippingPlanes[ i ]; 243 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 244 } 245 #pragma unroll_loop_end 246 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 247 bool clipped = true; 248 #pragma unroll_loop_start 249 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 250 plane = clippingPlanes[ i ]; 251 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 252 } 253 #pragma unroll_loop_end 254 if ( clipped ) discard; 255 #endif 256 #endif 257#endif`,xf=`#if NUM_CLIPPING_PLANES > 0 258 varying vec3 vClipPosition; 259 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 260#endif`,vf=`#if NUM_CLIPPING_PLANES > 0 261 varying vec3 vClipPosition; 262#endif`,Mf=`#if NUM_CLIPPING_PLANES > 0 263 vClipPosition = - mvPosition.xyz; 264#endif`,Sf=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 265 diffuseColor *= vColor; 266#endif`,Ef=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 267 varying vec4 vColor; 268#endif`,yf=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 269 varying vec4 vColor; 270#endif`,bf=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 271 vColor = vec4( 1.0 ); 272#endif 273#ifdef USE_COLOR_ALPHA 274 vColor *= color; 275#elif defined( USE_COLOR ) 276 vColor.rgb *= color; 277#endif 278#ifdef USE_INSTANCING_COLOR 279 vColor.rgb *= instanceColor.rgb; 280#endif 281#ifdef USE_BATCHING_COLOR 282 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 283#endif`,Tf=`#define PI 3.141592653589793 284#define PI2 6.283185307179586 285#define PI_HALF 1.5707963267948966 286#define RECIPROCAL_PI 0.3183098861837907 287#define RECIPROCAL_PI2 0.15915494309189535 288#define EPSILON 1e-6 289#ifndef saturate 290#define saturate( a ) clamp( a, 0.0, 1.0 ) 291#endif 292#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 293float pow2( const in float x ) { return x*x; } 294vec3 pow2( const in vec3 x ) { return x*x; } 295float pow3( const in float x ) { return x*x*x; } 296float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 297float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 298float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 299highp float rand( const in vec2 uv ) { 300 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 301 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 302 return fract( sin( sn ) * c ); 303} 304#ifdef HIGH_PRECISION 305 float precisionSafeLength( vec3 v ) { return length( v ); } 306#else 307 float precisionSafeLength( vec3 v ) { 308 float maxComponent = max3( abs( v ) ); 309 return length( v / maxComponent ) * maxComponent; 310 } 311#endif 312struct IncidentLight { 313 vec3 color; 314 vec3 direction; 315 bool visible; 316}; 317struct ReflectedLight { 318 vec3 directDiffuse; 319 vec3 directSpecular; 320 vec3 indirectDiffuse; 321 vec3 indirectSpecular; 322}; 323#ifdef USE_ALPHAHASH 324 varying vec3 vPosition; 325#endif 326vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 327 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 328} 329#define inverseTransformDirection transformDirectionByInverseViewMatrix 330vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { 331 return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); 332} 333vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { 334 return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); 335} 336bool isPerspectiveMatrix( mat4 m ) { 337 return m[ 2 ][ 3 ] == - 1.0; 338} 339vec2 equirectUv( in vec3 dir ) { 340 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 341 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 342 return vec2( u, v ); 343}
344vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 345 return RECIPROCAL_PI * diffuseColor; 346} 347vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 348 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 349 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 350} 351float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 352 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 353 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 354} // validated`,Af=`#ifdef ENVMAP_TYPE_CUBE_UV 355 #define cubeUV_minMipLevel 4.0 356 #define cubeUV_minTileSize 16.0 357 float getFace( vec3 direction ) { 358 vec3 absDirection = abs( direction ); 359 float face = - 1.0; 360 if ( absDirection.x > absDirection.z ) { 361 if ( absDirection.x > absDirection.y ) 362 face = direction.x > 0.0 ? 0.0 : 3.0; 363 else 364 face = direction.y > 0.0 ? 1.0 : 4.0; 365 } else { 366 if ( absDirection.z > absDirection.y ) 367 face = direction.z > 0.0 ? 2.0 : 5.0; 368 else 369 face = direction.y > 0.0 ? 1.0 : 4.0; 370 } 371 return face; 372 } 373 vec2 getUV( vec3 direction, float face ) { 374 vec2 uv; 375 if ( face == 0.0 ) { 376 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 377 } else if ( face == 1.0 ) { 378 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 379 } else if ( face == 2.0 ) { 380 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 381 } else if ( face == 3.0 ) { 382 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 383 } else if ( face == 4.0 ) { 384 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 385 } else { 386 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 387 } 388 return 0.5 * ( uv + 1.0 ); 389 } 390 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 391 float face = getFace( direction ); 392 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 393 mipInt = max( mipInt, cubeUV_minMipLevel ); 394 float faceSize = exp2( mipInt ); 395 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 396 if ( face > 2.0 ) { 397 uv.y += faceSize; 398 face -= 3.0; 399 } 400 uv.x += face * faceSize; 401 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 402 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 403 uv.x *= CUBEUV_TEXEL_WIDTH; 404 uv.y *= CUBEUV_TEXEL_HEIGHT; 405 #ifdef texture2DGradEXT 406 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 407 #else 408 return texture2D( envMap, uv ).rgb; 409 #endif 410 } 411 #define cubeUV_r0 1.0 412 #define cubeUV_m0 - 2.0 413 #define cubeUV_r1 0.8 414 #define cubeUV_m1 - 1.0 415 #define cubeUV_r4 0.4 416 #define cubeUV_m4 2.0 417 #define cubeUV_r5 0.305 418 #define cubeUV_m5 3.0 419 #define cubeUV_r6 0.21 420 #define cubeUV_m6 4.0 421 float roughnessToMip( float roughness ) { 422 float mip = 0.0; 423 if ( roughness >= cubeUV_r1 ) { 424 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 425 } else if ( roughness >= cubeUV_r4 ) { 426 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 427 } else if ( roughness >= cubeUV_r5 ) { 428 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 429 } else if ( roughness >= cubeUV_r6 ) { 430 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 431 } else { 432 mip = - 2.0 * log2( 1.16 * roughness ); } 433 return mip; 434 } 435 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 436 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 437 float mipF = fract( mip ); 438 float mipInt = floor( mip ); 439 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 440 if ( mipF == 0.0 ) { 441 return vec4( color0, 1.0 ); 442 } else { 443 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 444 return vec4( mix( color0, color1, mipF ), 1.0 ); 445 } 446 } 447#endif`,wf=`vec3 transformedNormal = objectNormal; 448#ifdef USE_TANGENT 449 vec3 transformedTangent = objectTangent; 450#endif 451#ifdef USE_BATCHING 452 mat3 bm = mat3( batchingMatrix ); 453 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 454 transformedNormal = bm * transformedNormal; 455 #ifdef USE_TANGENT 456 transformedTangent = bm * transformedTangent; 457 #endif 458#endif 459#ifdef USE_INSTANCING 460 mat3 im = mat3( instanceMatrix ); 461 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 462 transformedNormal = im * transformedNormal; 463 #ifdef USE_TANGENT 464 transformedTangent = im * transformedTangent; 465 #endif 466#endif 467transformedNormal = normalMatrix * transformedNormal; 468#ifdef FLIP_SIDED 469 transformedNormal = - transformedNormal; 470#endif 471#ifdef USE_TANGENT 472 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 473#endif`,Rf=`#ifdef USE_DISPLACEMENTMAP 474 uniform sampler2D displacementMap; 475 uniform float displacementScale; 476 uniform float displacementBias; 477#endif`,Cf=`#ifdef USE_DISPLACEMENTMAP 478 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
478placementBias ); 479#endif`,Pf=`#ifdef USE_EMISSIVEMAP 480 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 481 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 482 emissiveColor = sRGBTransferEOTF( emissiveColor ); 483 #endif 484 totalEmissiveRadiance *= emissiveColor.rgb; 485#endif`,Lf=`#ifdef USE_EMISSIVEMAP 486 uniform sampler2D emissiveMap; 487#endif`,Df="gl_FragColor = linearToOutputTexel( gl_FragColor );",If=`vec4 LinearTransferOETF( in vec4 value ) { 488 return value; 489} 490vec4 sRGBTransferEOTF( in vec4 value ) { 491 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 492} 493vec4 sRGBTransferOETF( in vec4 value ) { 494 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 495}`,Uf=`#ifdef USE_ENVMAP 496 #ifdef ENV_WORLDPOS 497 vec3 cameraToFrag; 498 if ( isOrthographic ) { 499 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 500 } else { 501 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 502 } 503 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 504 #ifdef ENVMAP_MODE_REFLECTION 505 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 506 #else 507 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 508 #endif 509 #else 510 vec3 reflectVec = vReflect; 511 #endif 512 #ifdef ENVMAP_TYPE_CUBE 513 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); 514 #ifdef ENVMAP_BLENDING_MULTIPLY 515 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 516 #elif defined( ENVMAP_BLENDING_MIX ) 517 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 518 #elif defined( ENVMAP_BLENDING_ADD ) 519 outgoingLight += envColor.xyz * specularStrength * reflectivity; 520 #endif 521 #endif 522#endif`,Nf=`#ifdef USE_ENVMAP 523 uniform float envMapIntensity; 524 uniform mat3 envMapRotation; 525 #ifdef ENVMAP_TYPE_CUBE 526 uniform samplerCube envMap; 527 #else 528 uniform sampler2D envMap; 529 #endif 530#endif`,Ff=`#ifdef USE_ENVMAP 531 uniform float reflectivity; 532 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 533 #define ENV_WORLDPOS 534 #endif 535 #ifdef ENV_WORLDPOS 536 varying vec3 vWorldPosition; 537 uniform float refractionRatio; 538 #else 539 varying vec3 vReflect; 540 #endif 541#endif`,Of=`#ifdef USE_ENVMAP 542 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 543 #define ENV_WORLDPOS 544 #endif 545 #ifdef ENV_WORLDPOS 546 547 varying vec3 vWorldPosition; 548 #else 549 varying vec3 vReflect; 550 uniform float refractionRatio; 551 #endif 552#endif`,Bf=`#ifdef USE_ENVMAP 553 #ifdef ENV_WORLDPOS 554 vWorldPosition = worldPosition.xyz; 555 #else 556 vec3 cameraToVertex; 557 if ( isOrthographic ) { 558 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 559 } else {
560 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 561 } 562 vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 563 #ifdef ENVMAP_MODE_REFLECTION 564 vReflect = reflect( cameraToVertex, worldNormal ); 565 #else 566 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 567 #endif 568 #endif 569#endif`,zf=`#ifdef USE_FOG 570 vFogDepth = - mvPosition.z; 571#endif`,Gf=`#ifdef USE_FOG 572 varying float vFogDepth; 573#endif`,Hf=`#ifdef USE_FOG 574 #ifdef FOG_EXP2 575 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 576 #else 577 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 578 #endif 579 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 580#endif`,Vf=`#ifdef USE_FOG 581 uniform vec3 fogColor; 582 varying float vFogDepth; 583 #ifdef FOG_EXP2 584 uniform float fogDensity; 585 #else 586 uniform float fogNear; 587 uniform float fogFar; 588 #endif 589#endif`,kf=`#ifdef USE_GRADIENTMAP 590 uniform sampler2D gradientMap; 591#endif 592vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 593 float dotNL = dot( normal, lightDirection ); 594 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 595 #ifdef USE_GRADIENTMAP 596 return vec3( texture2D( gradientMap, coord ).r ); 597 #else 598 vec2 fw = fwidth( coord ) * 0.5; 599 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 600 #endif 601}`,Wf=`#ifdef USE_LIGHTMAP 602 uniform sampler2D lightMap; 603 uniform float lightMapIntensity; 604#endif`,Xf=`LambertMaterial material; 605material.diffuseColor = diffuseColor.rgb; 606material.specularStrength = specularStrength;`,qf=`varying vec3 vViewPosition; 607struct LambertMaterial { 608 vec3 diffuseColor; 609 float specularStrength; 610}; 611void 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 ) { 612 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 613 vec3 irradiance = dotNL * directLight.color; 614 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 615} 616void 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 ) { 617 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 618} 619#define RE_Direct RE_Direct_Lambert 620#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Yf=`uniform bool receiveShadow; 621uniform vec3 ambientLightColor; 622#if defined( USE_LIGHT_PROBES ) 623 uniform vec3 lightProbe[ 9 ]; 624#endif 625vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 626 float x = normal.x, y = normal.y, z = normal.z; 627 vec3 result = shCoefficients[ 0 ] * 0.886227; 628 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 629 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 630 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 631 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 632 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 633 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 634 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 635 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 636 return result; 637} 638vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 639 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 640 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 641 return irradiance; 642} 643vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 644 vec3 irradiance = ambientLightColor; 645 return irradiance; 646} 647float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 648 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 649 if ( cutoffDistance > 0.0 ) { 650 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 651 } 652 return distanceFalloff; 653} 654float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 655 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 656} 657#if NUM_SUN_LIGHTS > 0 658 struct SunLight { 659 vec3 direction; 660 vec3 color; 661 }; 662 uniform SunLight sunLights[ NUM_SUN_LIGHTS ]; 663 void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) { 664 light.color = sunLight.color; 665 light.direction = sunLight.direction; 666 light.visible = true; 667 } 668#endif 669#if NUM_DIR_LIGHTS > 0 670 struct DirectionalLight { 671 vec3 direction; 672 vec3 color; 673 }; 674 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 675 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 676 light.color = directionalLight.color; 677 light.direction = directionalLight.direction; 678 light.visible = true; 679 } 680#endif 681#if NUM_POINT_LIGHTS > 0 682 struct PointLight { 683 vec3 position; 684 vec3 color; 685 float distance; 686 float decay; 687 }; 688 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 689 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 690 vec3 lVector = pointLight.position - geometryPosition; 691 light.direction = normalize( lVector ); 692 float lightDistance = length( lVector ); 693 light.color = pointLight.color; 694 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 695 light.visible = ( light.color != vec3( 0.0 ) ); 696 } 697#endif
698#if NUM_SPOT_LIGHTS > 0 699 struct SpotLight { 700 vec3 position; 701 vec3 direction; 702 vec3 color; 703 float distance; 704 float decay; 705 float coneCos; 706 float penumbraCos; 707 }; 708 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 709 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 710 vec3 lVector = spotLight.position - geometryPosition; 711 light.direction = normalize( lVector ); 712 float angleCos = dot( light.direction, spotLight.direction ); 713 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 714 if ( spotAttenuation > 0.0 ) { 715 float lightDistance = length( lVector ); 716 light.color = spotLight.color * spotAttenuation; 717 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 718 light.visible = ( light.color != vec3( 0.0 ) ); 719 } else { 720 light.color = vec3( 0.0 ); 721 light.visible = false; 722 } 723 } 724#endif 725#if NUM_RECT_AREA_LIGHTS > 0 726 struct RectAreaLight { 727 vec3 color; 728 vec3 position; 729 vec3 halfWidth; 730 vec3 halfHeight; 731 }; 732 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 733 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 734#endif 735#if NUM_HEMI_LIGHTS > 0 736 struct HemisphereLight { 737 vec3 direction; 738 vec3 skyColor; 739 vec3 groundColor; 740 }; 741 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 742 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 743 float dotNL = dot( normal, hemiLight.direction ); 744 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 745 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 746 return irradiance; 747 } 748#endif 749#include <lightprobes_pars_fragment>`,Zf=`#ifdef USE_ENVMAP 750 vec3 getIBLIrradiance( const in vec3 normal ) { 751 #ifdef ENVMAP_TYPE_CUBE_UV 752 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 753 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 754 return PI * envMapColor.rgb * envMapIntensity; 755 #else 756 return vec3( 0.0 ); 757 #endif 758 } 759 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 760 #ifdef ENVMAP_TYPE_CUBE_UV 761 vec3 reflectVec = reflect( - viewDir, normal ); 762 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 763 reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); 764 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 765 return envMapColor.rgb * envMapIntensity; 766 #else 767 return vec3( 0.0 ); 768 #endif 769 } 770 #ifdef USE_RETROREFLECTION 771 vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 772 #ifdef ENVMAP_TYPE_CUBE_UV 773 vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) ); 774 retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix ); 775 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness ); 776 return envMapColor.rgb * envMapIntensity; 777 #else 778 return vec3( 0.0 ); 779 #endif 780 } 781 #endif 782 #ifdef USE_ANISOTROPY 783 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 784 #ifdef ENVMAP_TYPE_CUBE_UV 785 vec3 bentNormal = cross( bitangent, viewDir ); 786 bentNormal = normalize( cross( bentNormal, bitangent ) ); 787 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 788 return getIBLRadiance( viewDir, bentNormal, roughness ); 789 #else 790 return vec3( 0.0 ); 791 #endif 792 } 793 #ifdef USE_RETROREFLECTION 794 vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 795 #ifdef ENVMAP_TYPE_CUBE_UV 796 vec3 bentNormal = cross( bitangent, viewDir ); 797 bentNormal = normalize( cross( bentNormal, bitangent ) ); 798 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 799 return getIBLRetroRadiance( viewDir, bentNormal, roughness ); 800 #else 801 return vec3( 0.0 ); 802 #endif 803 } 804 #endif 805 #endif 806#endif`,Kf=`ToonMaterial material; 807material.diffuseColor = diffuseColor.rgb;`,$f=`varying vec3 vViewPosition; 808struct ToonMaterial { 809 vec3 diffuseColor; 810}; 811void 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 ) { 812 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 813 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 814} 815void 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 ) { 816 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 817} 818#define RE_Direct RE_Direct_Toon 819#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Jf=`BlinnPhongMaterial material; 820material.diffuseColor = diffuseColor.rgb; 821material.specularColor = specular; 822material.specularShininess = shininess; 823material.specularStrength = specularStrength;`,Qf=`varying vec3 vViewPosition; 824struct BlinnPhongMaterial { 825 vec3 diffuseColor; 826 vec3 specularColor; 827 float specularShininess; 828 float specularStrength; 829}; 830void 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 ) {
831 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 832 vec3 irradiance = dotNL * directLight.color; 833 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 834 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 835} 836void 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 ) { 837 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 838} 839#define RE_Direct RE_Direct_BlinnPhong 840#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,jf=`PhysicalMaterial material; 841material.diffuseColor = diffuseColor.rgb; 842material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 843material.metalness = metalnessFactor; 844vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 845float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 846material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 847material.roughness = min( material.roughness, 1.0 ); 848#ifdef IOR 849 material.ior = ior; 850 #ifdef USE_SPECULAR 851 float specularIntensityFactor = specularIntensity; 852 vec3 specularColorFactor = specularColor; 853 #ifdef USE_SPECULAR_COLORMAP 854 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 855 #endif 856 #ifdef USE_SPECULAR_INTENSITYMAP 857 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 858 #endif 859 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 860 #else 861 float specularIntensityFactor = 1.0; 862 vec3 specularColorFactor = vec3( 1.0 ); 863 material.specularF90 = 1.0; 864 #endif 865 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 866 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 867#else 868 material.specularColor = vec3( 0.04 ); 869 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 870 material.specularF90 = 1.0; 871#endif 872#ifdef USE_CLEARCOAT 873 material.clearcoat = clearcoat; 874 material.clearcoatRoughness = clearcoatRoughness; 875 material.clearcoatF0 = vec3( 0.04 ); 876 material.clearcoatF90 = 1.0; 877 #ifdef USE_CLEARCOATMAP 878 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 879 #endif 880 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 881 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 882 #endif 883 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 884 material.clearcoatRoughness += geometryRoughness; 885 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 886#endif 887#ifdef USE_DISPERSION 888 material.dispersion = dispersion; 889#endif 890#ifdef USE_RETROREFLECTION 891 material.retroreflectivity = retroreflectivity; 892#endif 893#ifdef USE_IRIDESCENCE 894 material.iridescence = iridescence; 895 material.iridescenceIOR = iridescenceIOR; 896 #ifdef USE_IRIDESCENCEMAP 897 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 898 #endif 899 #ifdef USE_IRIDESCENCE_THICKNESSMAP 900 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 901 #else 902 material.iridescenceThickness = iridescenceThicknessMaximum; 903 #endif 904#endif 905#ifdef USE_SHEEN 906 material.sheenColor = sheenColor; 907 #ifdef USE_SHEEN_COLORMAP 908 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 909 #endif 910 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 911 #ifdef USE_SHEEN_ROUGHNESSMAP 912 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 913 #endif 914#endif 915#ifdef USE_ANISOTROPY 916 #ifdef USE_ANISOTROPYMAP 917 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 918 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 919 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 920 #else 921 vec2 anisotropyV = anisotropyVector; 922 #endif 923 material.anisotropy = length( anisotropyV ); 924 if( material.anisotropy == 0.0 ) { 925 anisotropyV = vec2( 1.0, 0.0 ); 926 } else { 927 anisotropyV /= material.anisotropy; 928 material.anisotropy = saturate( material.anisotropy ); 929 } 930 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
931 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 932 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 933#endif`,eh=`uniform sampler2D dfgLUT; 934struct PhysicalMaterial { 935 vec3 diffuseColor; 936 vec3 diffuseContribution; 937 vec3 specularColor; 938 vec3 specularColorBlended; 939 float roughness; 940 float metalness; 941 float specularF90; 942 float dispersion; 943 vec2 dfg; 944 vec3 multiScatteringCompensation; 945 #ifdef USE_RETROREFLECTION 946 float retroreflectivity; 947 #endif 948 #ifdef USE_CLEARCOAT 949 float clearcoat; 950 float clearcoatRoughness; 951 vec3 clearcoatF0; 952 float clearcoatF90; 953 #endif 954 #ifdef USE_IRIDESCENCE 955 float iridescence; 956 float iridescenceIOR; 957 float iridescenceThickness; 958 vec3 iridescenceFresnel; 959 vec3 iridescenceF0Dielectric; 960 vec3 iridescenceF0Metallic; 961 #endif 962 #ifdef USE_SHEEN 963 vec3 sheenColor; 964 float sheenRoughness; 965 #endif 966 #ifdef IOR 967 float ior; 968 #endif 969 #ifdef USE_TRANSMISSION 970 float transmission; 971 float transmissionAlpha; 972 float thickness; 973 float attenuationDistance; 974 vec3 attenuationColor; 975 #endif 976 #ifdef USE_ANISOTROPY 977 float anisotropy; 978 float alphaT; 979 vec3 anisotropyT; 980 vec3 anisotropyB; 981 #endif 982}; 983vec3 clearcoatSpecularDirect = vec3( 0.0 ); 984vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 985vec3 sheenSpecularDirect = vec3( 0.0 ); 986vec3 sheenSpecularIndirect = vec3(0.0 ); 987vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 988 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 989 float x2 = x * x; 990 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 991 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 992} 993float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 994 float a2 = pow2( alpha ); 995 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 996 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 997 return 0.5 / max( gv + gl, EPSILON ); 998} 999float D_GGX( const in float alpha, const in float dotNH ) { 1000 float a2 = pow2( alpha ); 1001 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1002 return RECIPROCAL_PI * a2 / pow2( denom ); 1003} 1004#ifdef USE_ANISOTROPY 1005 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1006 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1007 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1008 return 0.5 / max( gv + gl, EPSILON ); 1009 } 1010 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1011 float a2 = alphaT * alphaB; 1012 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1013 highp float v2 = dot( v, v ); 1014 float w2 = a2 / v2; 1015 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1016 } 1017#endif 1018#ifdef USE_CLEARCOAT 1019 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1020 vec3 f0 = material.clearcoatF0; 1021 float f90 = material.clearcoatF90; 1022 float roughness = material.clearcoatRoughness; 1023 float alpha = pow2( roughness ); 1024 vec3 halfDir = normalize( lightDir + viewDir ); 1025 float dotNL = saturate( dot( normal, lightDir ) ); 1026 float dotNV = saturate( dot( normal, viewDir ) ); 1027 float dotNH = saturate( dot( normal, halfDir ) ); 1028 float dotVH = saturate( dot( viewDir, halfDir ) ); 1029 vec3 F = F_Schlick( f0, f90, dotVH ); 1030 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1031 float D = D_GGX( alpha, dotNH ); 1032 return F * ( V * D ); 1033 } 1034#endif 1035vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1036 vec3 f0 = material.specularColorBlended; 1037 float f90 = material.specularF90; 1038 float roughness = material.roughness; 1039 float alpha = pow2( roughness ); 1040 vec3 halfDir = normalize( lightDir + viewDir ); 1041 float dotNL = saturate( dot( normal, lightDir ) ); 1042 float dotNV = saturate( dot( normal, viewDir ) ); 1043 float dotNH = saturate( dot( normal, halfDir ) );
1044 float dotVH = saturate( dot( viewDir, halfDir ) ); 1045 vec3 F = F_Schlick( f0, f90, dotVH ); 1046 #ifdef USE_IRIDESCENCE 1047 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1048 #endif 1049 #ifdef USE_ANISOTROPY 1050 float dotTL = dot( material.anisotropyT, lightDir ); 1051 float dotTV = dot( material.anisotropyT, viewDir ); 1052 float dotTH = dot( material.anisotropyT, halfDir ); 1053 float dotBL = dot( material.anisotropyB, lightDir ); 1054 float dotBV = dot( material.anisotropyB, viewDir ); 1055 float dotBH = dot( material.anisotropyB, halfDir ); 1056 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1057 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1058 #else 1059 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1060 float D = D_GGX( alpha, dotNH ); 1061 #endif 1062 return F * ( V * D ); 1063} 1064vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1065 const float LUT_SIZE = 64.0; 1066 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1067 const float LUT_BIAS = 0.5 / LUT_SIZE; 1068 float dotNV = saturate( dot( N, V ) ); 1069 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1070 uv = uv * LUT_SCALE + LUT_BIAS; 1071 return uv; 1072} 1073float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1074 float l = length( f ); 1075 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1076} 1077vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1078 float x = dot( v1, v2 ); 1079 float y = abs( x ); 1080 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1081 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1082 float v = a / b; 1083 float theta_sintheta = ( x >
1083 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1084 return cross( v1, v2 ) * theta_sintheta; 1085} 1086vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1087 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1088 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1089 vec3 lightNormal = cross( v1, v2 ); 1090 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1091 vec3 T1, T2; 1092 T1 = normalize( V - N * dot( V, N ) ); 1093 T2 = - cross( N, T1 ); 1094 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1095 vec3 coords[ 4 ]; 1096 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1097 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1098 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1099 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1100 coords[ 0 ] = normalize( coords[ 0 ] ); 1101 coords[ 1 ] = normalize( coords[ 1 ] ); 1102 coords[ 2 ] = normalize( coords[ 2 ] ); 1103 coords[ 3 ] = normalize( coords[ 3 ] ); 1104 vec3 vectorFormFactor = vec3( 0.0 ); 1105 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1106 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1107 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1108 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1109 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1110 return vec3( result ); 1111} 1112#if defined( USE_SHEEN ) 1113float D_Charlie( float roughness, float dotNH ) { 1114 float alpha = pow2( roughness ); 1115 float invAlpha = 1.0 / alpha; 1116 float cos2h = dotNH * dotNH; 1117 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1118 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1119} 1120float V_Neubelt( float dotNV, float dotNL ) { 1121 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1122} 1123vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1124 vec3 halfDir = normalize( lightDir + viewDir ); 1125 float dotNL = saturate( dot( normal, lightDir ) ); 1126 float dotNV = saturate( dot( normal, viewDir ) ); 1127 float dotNH = saturate( dot( normal, halfDir ) ); 1128 float D = D_Charlie( sheenRoughness, dotNH ); 1129 float V = V_Neubelt( dotNV, dotNL ); 1130 return sheenColor * ( D * V ); 1131} 1132#endif 1133float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1134 float dotNV = saturate( dot( normal, viewDir ) ); 1135 float r2 = roughness * roughness; 1136 float rInv = 1.0 / ( roughness + 0.1 ); 1137 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1138 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1139 float DG = exp( a * dotNV + b ); 1140 return saturate( DG ); 1141} 1142vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1143 float dotNV = saturate( dot( normal, viewDir ) ); 1144 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1145 return specularColor * fab.x + specularF90 * fab.y; 1146} 1147#ifdef USE_IRIDESCENCE 1148void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) { 1149#else 1150void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) { 1151#endif 1152 #ifdef USE_IRIDESCENCE 1153 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1154 #else 1155 vec3 Fr = specularColor; 1156 #endif 1157 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1158 float Ess = fab.x + fab.y; 1159 float Ems = 1.0 - Ess; 1160 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1161 singleScatter += FssEss; 1162 multiScatter += Fms * Ems; 1163} 1164#if NUM_RECT_AREA_LIGHTS > 0 1165 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1166 vec3 normal = geometryNormal; 1167 vec3 viewDir = geometryViewDir; 1168 vec3 position = geometryPosition;
1169 vec3 lightPos = rectAreaLight.position; 1170 vec3 halfWidth = rectAreaLight.halfWidth; 1171 vec3 halfHeight = rectAreaLight.halfHeight; 1172 vec3 lightColor = rectAreaLight.color; 1173 float roughness = material.roughness; 1174 vec3 rectCoords[ 4 ]; 1175 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1176 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1177 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1178 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1179 vec4 t1 = texture2D( ltc_1, uv ); 1180 vec4 t2 = texture2D( ltc_2, uv ); 1181 mat3 mInv = mat3( 1182 vec3( t1.x, 0, t1.y ), 1183 vec3( 0, 1, 0 ), 1184 vec3( t1.z, 0, t1.w ) 1185 ); 1186 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1187 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1188 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1189 #ifdef USE_CLEARCOAT 1190 vec3 Ncc = geometryClearcoatNormal; 1191 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1192 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1193 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1194 mat3 mInvClearcoat = mat3( 1195 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1196 vec3( 0, 1, 0 ), 1197 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1198 ); 1199 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1200 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1201 #endif 1202 } 1203#endif 1204void 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 ) { 1205 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1206 vec3 irradiance = dotNL * directLight.color; 1207 #ifdef USE_CLEARCOAT 1208 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1209 vec3 ccIrradiance = dotNLcc * directLight.color; 1210 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1211 #endif 1212 #ifdef USE_SHEEN 1213 1214 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1215 1216 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1217 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1218 1219 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1220 1221 irradiance *= sheenEnergyComp; 1222 1223 #endif 1224 vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1225 #ifdef USE_RETROREFLECTION 1226 vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal ); 1227 vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material ); 1228 specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) ); 1229 #endif 1230 reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation; 1231 vec3 halfDir = normalize( directLight.direction + geometryViewDir ); 1232 float dotVH = saturate( dot( geometryViewDir, halfDir ) ); 1233 vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH ); 1234 #ifdef USE_RETROREFLECTION 1235 vec3 retroHalfDir = normalize( directLight.direction + retroViewDir ); 1236 float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) ); 1237 vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH ); 1238 F = mix( F, retroF, saturate( material.retroreflectivity ) ); 1239 #endif 1240 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F ); 1241} 1242void 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 ) { 1243 vec3 singleScattering = vec3( 0.0 ); 1244 vec3 multiScattering = vec3( 0.0 );
1245 #ifdef USE_IRIDESCENCE 1246 computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering ); 1247 #else 1248 computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering ); 1249 #endif 1250 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering ); 1251 #ifdef USE_SHEEN 1252 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1253 sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI; 1254 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1255 diffuse *= sheenEnergyComp; 1256 #endif 1257 reflectedLight.indirectDiffuse += diffuse; 1258} 1259void 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) { 1260 #ifdef USE_CLEARCOAT 1261 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1262 #endif 1263 #ifdef USE_SHEEN 1264 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1265 #endif 1266 vec3 singleScatteringDielectric = vec3( 0.0 ); 1267 vec3 multiScatteringDielectric = vec3( 0.0 ); 1268 vec3 singleScatteringMetallic = vec3( 0.0 ); 1269 vec3 multiScatteringMetallic = vec3( 0.0 ); 1270 #ifdef USE_IRIDESCENCE 1271 computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric ); 1272 computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic ); 1273 #else 1274 computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric ); 1275 computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic ); 1276 #endif 1277 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1278 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1279 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1280 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1281 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1282 vec3 indirectSpecular = radiance * singleScattering; 1283 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1284 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1285 #ifdef USE_SHEEN 1286 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1287 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1288 indirectSpecular *= sheenEnergyComp; 1289 indirectDiffuse *= sheenEnergyComp; 1290 #endif 1291 reflectedLight.indirectSpecular += indirectSpecular; 1292 reflectedLight.indirectDiffuse += indirectDiffuse; 1293} 1294#define RE_Direct RE_Direct_Physical 1295#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1296#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1297#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1298float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1299 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1300}`,th=` 1301vec3 geometryPosition = - vViewPosition; 1302vec3 geometryNormal = normal; 1303vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1304vec3 geometryClearcoatNormal = vec3( 0.0 ); 1305#ifdef USE_CLEARCOAT 1306 geometryClearcoatNormal = clearcoatNormal; 1307#endif
1308#ifdef USE_IRIDESCENCE 1309 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1310 if ( material.iridescenceThickness == 0.0 ) { 1311 material.iridescence = 0.0; 1312 } else { 1313 material.iridescence = saturate( material.iridescence ); 1314 } 1315 if ( material.iridescence > 0.0 ) { 1316 vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1317 vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1318 material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness ); 1319 material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi ); 1320 material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi ); 1321 } 1322#endif 1323#ifdef STANDARD 1324 float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) ); 1325 material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg; 1326 #if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 ) 1327 float EssMs = material.dfg.x + material.dfg.y; 1328 material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 ); 1329 #endif 1330#endif 1331IncidentLight directLight; 1332#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1333 PointLight pointLight; 1334 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1335 PointLightShadow pointLightShadow; 1336 #endif 1337 #pragma unroll_loop_start 1338 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1339 pointLight = pointLights[ i ]; 1340 getPointLightInfo( pointLight, geometryPosition, directLight ); 1341 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1342 pointLightShadow = pointLightShadows[ i ]; 1343 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1344 #endif 1345 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1346 } 1347 #pragma unroll_loop_end 1348#endif 1349#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1350 SpotLight spotLight; 1351 vec4 spotColor; 1352 vec3 spotLightCoord; 1353 bool inSpotLightMap; 1354 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1355 SpotLightShadow spotLightShadow; 1356 #endif 1357 #pragma unroll_loop_start 1358 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1359 spotLight = spotLights[ i ]; 1360 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1361 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1362 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1363 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1364 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1365 #else 1366 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1367 #endif 1368 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1369 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1370 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1371 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1372 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1373 #endif 1374 #undef SPOT_LIGHT_MAP_INDEX 1375 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1376 spotLightShadow = spotLightShadows[ i ]; 1377 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1378 #endif 1379 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1380 } 1381 #pragma unroll_loop_end 1382#endif 1383#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct ) 1384 SunLight sunLight; 1385 #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0 1386 SunLightShadow sunLightShadow; 1387 #endif 1388 #pragma unroll_loop_start 1389 for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) { 1390 sunLight = sunLights[ i ]; 1391 getSunLightInfo( sunLight, directLight ); 1392 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS ) 1393 sunLightShadow = sunLightShadows[ i ]; 1394 directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0; 1395 #endif 1396 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1397 } 1398 #pragma unroll_loop_end 1399#endif 1400#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1401 DirectionalLight directionalLight; 1402 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1403 DirectionalLightShadow directionalLightShadow; 1404 #endif 1405 #pragma unroll_loop_start 1406 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1407 directionalLight = directionalLights[ i ]; 1408 getDirectionalLightInfo( directionalLight, directLight ); 1409 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1410 directionalLightShadow = directionalLightShadows[ i ]; 1411 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1412 #endif 1413 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1414 } 1415 #pragma unroll_loop_end 1416#endif 1417#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1418 RectAreaLight rectAreaLight; 1419 #pragma unroll_loop_start 1420 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1421 rectAreaLight = rectAreaLights[ i ]; 1422 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1423 } 1424 #pragma unroll_loop_end 1425#endif 1426#if defined( RE_IndirectDiffuse ) 1427 vec3 iblIrradiance = vec3( 0.0 ); 1428 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1429 #if defined( USE_LIGHT_PROBES ) 1430 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1431 #endif 1432 #if ( NUM_HEMI_LIGHTS > 0 ) 1433 #pragma unroll_loop_start 1434 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1435 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1436 } 1437 #pragma unroll_loop_end 1438 #endif 1439 #ifdef USE_LIGHT_PROBES_GRID 1440 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 1441 vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); 1442 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 1443 #endif 1444#endif 1445#if defined( RE_IndirectSpecular ) 1446 vec3 radiance = vec3( 0.0 ); 1447 vec3 clearcoatRadiance = vec3( 0.0 ); 1448#endif`,nh=`#if defined( RE_IndirectDiffuse ) 1449 #ifdef USE_LIGHTMAP 1450 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1451 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1452 irradiance += lightMapIrradiance; 1453 #endif 1454 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1455 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1456 iblIrradiance += getIBLIrradiance( geometryNormal ); 1457 #endif 1458 #endif 1459#endif 1460#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1461 #ifdef USE_ANISOTROPY 1462 vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1463 #else 1464 vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1465 #endif 1466 #ifdef USE_RETROREFLECTION 1467 #ifdef USE_ANISOTROPY 1468 vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1469 #else 1470 vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness ); 1471 #endif 1472 iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) ); 1473 #endif 1474 radiance += iblRadiance; 1475 #ifdef USE_CLEARCOAT 1476 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1477 #endif 1478#endif`,ih=`#if defined( RE_IndirectDiffuse ) 1479 #if defined( LAMBERT ) || defined( PHONG ) 1480 irradiance += iblIrradiance; 1481 #endif 1482 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1483#endif 1484#if defined( RE_IndirectSpecular ) 1485 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1486#endif`,rh=`#ifdef USE_LIGHT_PROBES_GRID 1487uniform highp sampler3D probesSH; 1488uniform vec3 probesMin; 1489uniform vec3 probesMax; 1490uniform vec3 probesResolution; 1491vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 1492 vec3 res = probesResolution; 1493 vec3 gridRange = probesMax - probesMin; 1494 vec3 resMinusOne = res - 1.0; 1495 vec3 probeSpacing = gridRange / resMinusOne; 1496 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 1497 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 1498 uvw = uvw * resMinusOne / res + 0.5 / res; 1499 float nz = res.z; 1500 float paddedSlices = nz + 2.0; 1501 float atlasDepth = 7.0 * paddedSlices; 1502 float uvZBase = uvw.z * nz + 1.0; 1503 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 1504 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 1505 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 1506 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 1507 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 1508 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 1509 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 1510 vec3 c0 = s0.xyz; 1511 vec3 c1 = vec3( s0.w, s1.xy ); 1512 vec3 c2 = vec3( s1.zw, s2.x ); 1513 vec3 c3 = s2.yzw; 1514 vec3 c4 = s3.xyz; 1515 vec3 c5 = vec3( s3.w, s4.xy ); 1516 vec3 c6 = vec3( s4.zw, s5.x ); 1517 vec3 c7 = s5.yzw; 1518 vec3 c8 = s6.xyz; 1519 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 1520 vec3 result = c0 * 0.886227; 1521 result += c1 * 2.0 * 0.511664 * y; 1522 result += c2 * 2.0 * 0.511664 * z; 1523 result += c3 * 2.0 * 0.511664 * x; 1524 result += c4 * 2.0 * 0.429043 * x * y; 1525 result += c5 * 2.0 * 0.429043 * y * z; 1526 result += c6 * ( 0.743125 * z * z - 0.247708 ); 1527 result += c7 * 2.0 * 0.429043 * x * z; 1528 result += c8 * 0.429043 * ( x * x - y * y ); 1529 return max( result, vec3( 0.0 ) ); 1530} 1531#endif`,sh=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1532 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1533#endif`,ah=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1534 uniform float logDepthBufFC; 1535 varying float vFragDepth; 1536 varying float vIsPerspective; 1537#endif`,oh=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1538 varying float vFragDepth; 1539 varying float vIsPerspective; 1540#endif`,lh=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1541 vFragDepth = 1.0 + gl_Position.w; 1542 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1543#endif`,ch=`#ifdef USE_MAP 1544 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1545 #ifdef DECODE_VIDEO_TEXTURE 1546 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1547 #endif 1548 diffuseColor *= sampledDiffuseColor; 1549#endif`,uh=`#ifdef USE_MAP 1550 uniform sampler2D map; 1551#endif`,fh=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1552 #if defined( USE_POINTS_UV ) 1553 vec2 uv = vUv; 1554 #else 1555 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1556 #endif 1557#endif 1558#ifdef USE_MAP 1559 diffuseColor *= texture2D( map, uv ); 1560#endif 1561#ifdef USE_ALPHAMAP 1562 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1563#endif`,hh=`#if defined( USE_POINTS_UV ) 1564 varying vec2 vUv; 1565#else 1566 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1567 uniform mat3 uvTransform; 1568 #endif 1569#endif 1570#ifdef USE_MAP 1571 uniform sampler2D map; 1572#endif 1573#ifdef USE_ALPHAMAP 1574 uniform sampler2D alphaMap; 1575#endif`,dh=`float metalnessFactor = metalness; 1576#ifdef USE_METALNESSMAP 1577 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1578 metalnessFactor *= texelMetalness.b; 1579#endif`,ph=`#ifdef USE_METALNESSMAP 1580 uniform sampler2D metalnessMap; 1581#endif`,mh=`#ifdef USE_INSTANCING_MORPH 1582 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1583 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1584 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1585 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1586 } 1587#endif`,gh=`#if defined( USE_MORPHCOLORS ) 1588 vColor *= morphTargetBaseInfluence; 1589 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1590 #if defined( USE_COLOR_ALPHA ) 1591 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1592 #elif defined( USE_COLOR ) 1593 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1594 #endif 1595 } 1596#endif`,_h=`#ifdef USE_MORPHNORMALS 1597 objectNormal *= morphTargetBaseInfluence; 1598 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1599 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1600 } 1601#endif`,xh=`#ifdef USE_MORPHTARGETS 1602 #ifndef USE_INSTANCING_MORPH 1603 uniform float morphTargetBaseInfluence; 1604 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1605 #endif 1606 uniform sampler2DArray morphTargetsTexture; 1607 uniform ivec2 morphTargetsTextureSize; 1608 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1609 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1610 int y = texelIndex / morphTargetsTextureSize.x; 1611 int x = texelIndex - y * morphTargetsTextureSize.x; 1612 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1613 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1614 } 1615#endif`,vh=`#ifdef USE_MORPHTARGETS 1616 transformed *= morphTargetBaseInfluence; 1617 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1618 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1619 } 1620#endif`,Mh=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1621#ifdef FLAT_SHADED 1622 vec3 fdx = dFdx( vViewPosition ); 1623 vec3 fdy = dFdy( vViewPosition ); 1624 vec3 normal = normalize( cross( fdx, fdy ) ); 1625#else 1626 vec3 normal = normalize( vNormal ); 1627 #ifdef DOUBLE_SIDED 1628 normal *= faceDirection; 1629 #endif 1630#endif 1631#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1632 #ifdef USE_TANGENT 1633 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1634 #else 1635 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1636 #if defined( USE_NORMALMAP ) 1637 vNormalMapUv 1638 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1639 vClearcoatNormalMapUv 1640 #else 1641 vUv 1642 #endif 1643 ); 1644 #endif 1645 #ifdef DOUBLE_SIDED 1646 tbn[0] *= faceDirection; 1647 tbn[1] *= faceDirection; 1648 #endif 1649#endif 1650#ifdef USE_CLEARCOAT_NORMALMAP 1651 #ifdef USE_TANGENT 1652 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1653 #else 1654 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1655 #endif 1656 #ifdef DOUBLE_SIDED 1657 tbn2[0] *= faceDirection; 1658 tbn2[1] *= faceDirection; 1659 #endif 1660#endif 1661vec3 nonPerturbedNormal = normal;`,Sh=`#ifdef USE_NORMALMAP_OBJECTSPACE 1662 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1663 #ifdef FLIP_SIDED 1664 normal = - normal; 1665 #endif 1666 #ifdef DOUBLE_SIDED 1667 normal = normal * faceDirection; 1668 #endif 1669 normal = normalize( normalMatrix * normal ); 1670#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1671 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1672 #if defined( USE_PACKED_NORMALMAP ) 1673 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 1674 #endif 1675 mapN.xy *= normalScale; 1676 normal = normalize( tbn * map
1676N ); 1677#elif defined( USE_BUMPMAP ) 1678 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1679#endif`,Eh=`#ifndef FLAT_SHADED 1680 varying vec3 vNormal; 1681 #ifdef USE_TANGENT 1682 varying vec3 vTangent; 1683 varying vec3 vBitangent; 1684 #endif 1685#endif`,yh=`#ifndef FLAT_SHADED 1686 varying vec3 vNormal; 1687 #ifdef USE_TANGENT 1688 varying vec3 vTangent; 1689 varying vec3 vBitangent; 1690 #endif 1691#endif`,bh=`#ifndef FLAT_SHADED 1692 vNormal = normalize( transformedNormal ); 1693 #ifdef USE_TANGENT 1694 vTangent = normalize( transformedTangent ); 1695 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1696 #ifdef FLIP_SIDED 1697 vBitangent = - vBitangent; 1698 #endif 1699 #endif 1700#endif`,Th=`#ifdef USE_NORMALMAP 1701 uniform sampler2D normalMap; 1702 uniform vec2 normalScale; 1703#endif 1704#ifdef USE_NORMALMAP_OBJECTSPACE 1705 uniform mat3 normalMatrix; 1706#endif 1707#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1708 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1709 vec3 q0 = dFdx( eye_pos.xyz ); 1710 vec3 q1 = dFdy( eye_pos.xyz ); 1711 vec2 st0 = dFdx( uv.st ); 1712 vec2 st1 = dFdy( uv.st ); 1713 vec3 N = surf_norm; 1714 vec3 q1perp = cross( q1, N ); 1715 vec3 q0perp = cross( N, q0 ); 1716 vec3 T = q1perp * st0.x + q0perp * st1.x; 1717 vec3 B = q1perp * st0.y + q0perp * st1.y; 1718 float det = max( dot( T, T ), dot( B, B ) ); 1719 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1720 return mat3( T * scale, B * scale, N ); 1721 } 1722#endif`,Ah=`#ifdef USE_CLEARCOAT 1723 vec3 clearcoatNormal = nonPerturbedNormal; 1724#endif`,wh=`#ifdef USE_CLEARCOAT_NORMALMAP 1725 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1726 clearcoatMapN.xy *= clearcoatNormalScale; 1727 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1728#endif`,Rh=`#ifdef USE_CLEARCOATMAP 1729 uniform sampler2D clearcoatMap; 1730#endif 1731#ifdef USE_CLEARCOAT_NORMALMAP 1732 uniform sampler2D clearcoatNormalMap; 1733 uniform vec2 clearcoatNormalScale; 1734#endif 1735#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1736 uniform sampler2D clearcoatRoughnessMap; 1737#endif`,Ch=`#ifdef USE_IRIDESCENCEMAP 1738 uniform sampler2D iridescenceMap; 1739#endif 1740#ifdef USE_IRIDESCENCE_THICKNESSMAP 1741 uniform sampler2D iridescenceThicknessMap; 1742#endif`,Ph=`#ifdef OPAQUE 1743diffuseColor.a = 1.0; 1744#endif 1745#ifdef USE_TRANSMISSION 1746diffuseColor.a *= material.transmissionAlpha; 1747#endif 1748gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Lh=`vec3 packNormalToRGB( const in vec3 normal ) { 1749 return normalize( normal ) * 0.5 + 0.5; 1750} 1751vec3 unpackRGBToNormal( const in vec3 rgb ) { 1752 return 2.0 * rgb.xyz - 1.0; 1753} 1754const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1755const float Inv255 = 1. / 255.; 1756const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1757const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1758const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1759const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1760vec4 packDepthToRGBA( const in float v ) { 1761 if( v <= 0.0 ) 1762 return vec4( 0., 0., 0., 0. ); 1763 if( v >= 1.0 ) 1764 return vec4( 1., 1., 1., 1. ); 1765 float vuf; 1766 float af = modf( v * PackFactors.a, vuf ); 1767 float bf = modf( vuf * ShiftRight8, vuf ); 1768 float gf = modf( vuf * ShiftRight8, vuf ); 1769 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1770} 1771vec3 packDepthToRGB( const in float v ) { 1772 if( v <= 0.0 ) 1773 return vec3( 0., 0., 0. ); 1774 if( v >= 1.0 ) 1775 return vec3( 1., 1., 1. ); 1776 float vuf; 1777 float bf = modf( v * PackFactors.b, vuf ); 1778 float gf = modf( vuf * ShiftRight8, vuf ); 1779 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1780} 1781vec2 packDepthToRG( const in float v ) { 1782 if( v <= 0.0 ) 1783 return vec2( 0., 0. ); 1784 if( v >= 1.0 ) 1785 return vec2( 1., 1. ); 1786 float vuf; 1787 float gf = modf( v * 256., vuf ); 1788 return vec2( vuf * Inv255, gf ); 1789} 1790float unpackRGBAToDepth( const in vec4 v ) { 1791 return dot( v, UnpackFactors4 ); 1792} 1793float unpackRGBToDepth( const in vec3 v ) { 1794 return dot( v, UnpackFactors3 ); 1795} 1796float unpackRGToDepth( const in vec2 v ) { 1797 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1798} 1799vec4 pack2HalfToRGBA( const in vec2 v ) {
1800 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1801 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1802} 1803vec2 unpackRGBATo2Half( const in vec4 v ) { 1804 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1805} 1806float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1807 return ( viewZ + near ) / ( near - far ); 1808} 1809float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1810 #ifdef USE_REVERSED_DEPTH_BUFFER 1811 1812 return depth * ( far - near ) - far; 1813 #else 1814 return depth * ( near - far ) - near; 1815 #endif 1816} 1817float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1818 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1819} 1820float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1821 1822 #ifdef USE_REVERSED_DEPTH_BUFFER 1823 return ( near * far ) / ( ( near - far ) * depth - near ); 1824 #else 1825 return ( near * far ) / ( ( far - near ) * depth - far ); 1826 #endif 1827}`,Dh=`#ifdef PREMULTIPLIED_ALPHA 1828 gl_FragColor.rgb *= gl_FragColor.a; 1829#endif`,Ih=`vec4 mvPosition = vec4( transformed, 1.0 ); 1830#ifdef USE_BATCHING 1831 mvPosition = batchingMatrix * mvPosition; 1832#endif 1833#ifdef USE_INSTANCING 1834 mvPosition = instanceMatrix * mvPosition; 1835#endif 1836mvPosition = modelViewMatrix * mvPosition; 1837gl_Position = projectionMatrix * mvPosition;`,Uh=`#ifdef DITHERING 1838 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1839#endif`,Nh=`#ifdef DITHERING 1840 vec3 dithering( vec3 color ) { 1841 float grid_position = rand( gl_FragCoord.xy ); 1842 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1843 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1844 return color + dither_shift_RGB; 1845 } 1846#endif`,Fh=`float roughnessFactor = roughness; 1847#ifdef USE_ROUGHNESSMAP 1848 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1849 roughnessFactor *= texelRoughness.g; 1850#endif`,Oh=`#ifdef USE_ROUGHNESSMAP 1851 uniform sampler2D roughnessMap; 1852#endif`,Bh=`#if NUM_SPOT_LIGHT_COORDS > 0 1853 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1854#endif 1855#if NUM_SPOT_LIGHT_MAPS > 0 1856 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1857#endif 1858#ifdef USE_SHADOWMAP 1859 #if NUM_SUN_LIGHT_SHADOWS > 0 1860 #define SUN_LIGHT_CASCADES 2 1861 #if defined( SHADOWMAP_TYPE_PCF ) 1862 uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ]; 1863 #else 1864 uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ]; 1865 #endif 1866 uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ]; 1867 uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ]; 1868 varying vec4 vSunShadowWorldPosition; 1869 varying vec3 vSunShadowWorldNormal; 1870 struct SunLightShadow { 1871 float shadowIntensity; 1872 float shadowBias; 1873 float shadowNormalBias; 1874 float shadowRadius; 1875 vec2 shadowMapSize; 1876 }; 1877 uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ]; 1878 #endif 1879 #if NUM_DIR_LIGHT_SHADOWS > 0 1880 #if defined( SHADOWMAP_TYPE_PCF ) 1881 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1882 #else 1883 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1884 #endif 1885 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1886 struct DirectionalLightShadow { 1887 float shadowIntensity; 1888 float shadowBias; 1889 float shadowNormalBias; 1890 float shadowRadius; 1891 vec2 shadowMapSize; 1892 }; 1893 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1894 #endif 1895 #if NUM_SPOT_LIGHT_SHADOWS > 0 1896 #if defined( SHADOWMAP_TYPE_PCF ) 1897 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1898 #else 1899 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1900 #endif 1901 struct SpotLightShadow { 1902 float shadowIntensity; 1903 float shadowBias; 1904 float shadowNormalBias; 1905 float shadowRadius; 1906 vec2 shadowMapSize; 1907 }; 1908 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1909 #endif 1910 #if NUM_POINT_LIGHT_SHADOWS > 0 1911 #if defined( SHADOWMAP_TYPE_PCF ) 1912 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1913 #elif defined( SHADOWMAP_TYPE_BASIC ) 1914 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1915 #endif 1916 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1917 struct PointLightShadow { 1918 float shadowIntensity; 1919 float shadowBias; 1920 float shadowNormalBias; 1921 float shadowRadius; 1922 vec2 shadowMapSize; 1923 float shadowCameraNear; 1924 float shadowCameraFar; 1925 }; 1926 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1927 #endif 1928 #if defined( SHADOWMAP_TYPE_PCF ) 1929 float interleavedGradientNoise( vec2 position ) {
1930 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1931 } 1932 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1933 const float goldenAngle = 2.399963229728653; 1934 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1935 float theta = float( sampleIndex ) * goldenAngle + phi; 1936 return vec2( cos( theta ), sin( theta ) ) * r; 1937 } 1938 #endif 1939 #if defined( SHADOWMAP_TYPE_PCF ) 1940 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1941 float shadow = 1.0; 1942 shadowCoord.xyz /= shadowCoord.w; 1943 shadowCoord.z += shadowBias; 1944 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1945 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1946 if ( frustumTest ) { 1947 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1948 float radius = shadowRadius * texelSize.x; 1949 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1950 shadow = ( 1951 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1952 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1953 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1954 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1955 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1956 ) * 0.2; 1957 } 1958 return mix( 1.0, shadow, shadowIntensity ); 1959 } 1960 #elif defined( SHADOWMAP_TYPE_VSM ) 1961 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1962 float shadow = 1.0; 1963 shadowCoord.xyz /= shadowCoord.w; 1964 #ifdef USE_REVERSED_DEPTH_BUFFER 1965 shadowCoord.z -= shadowBias; 1966 #else 1967 shadowCoord.z += shadowBias; 1968 #endif 1969 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1970 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1971 if ( frustumTest ) { 1972 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1973 float mean = distribution.x; 1974 float variance = distribution.y * distribution.y; 1975 #ifdef USE_REVERSED_DEPTH_BUFFER 1976 float hard_shadow = step( mean, shadowCoord.z ); 1977 #else 1978 float hard_shadow = step( shadowCoord.z, mean ); 1979 #endif 1980 1981 if ( hard_shadow == 1.0 ) { 1982 shadow = 1.0; 1983 } else { 1984 variance = max( variance, 0.0000001 ); 1985 float d = shadowCoord.z - mean; 1986 float p_max = variance / ( variance + d * d ); 1987 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1988 shadow = max( hard_shadow, p_max ); 1989 } 1990 } 1991 return mix( 1.0, shadow, shadowIntensity ); 1992 } 1993 #else 1994 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1995 float shadow = 1.0; 1996 shadowCoord.xyz /= shadowCoord.w; 1997 #ifdef USE_REVERSED_DEPTH_BUFFER 1998 shadowCoord.z -= shadowBias; 1999 #else 2000 shadowCoord.z += shadowBias; 2001 #endif 2002 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 2003 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 2004 if ( frustumTest ) { 2005 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 2006 #ifdef USE_REVERSED_DEPTH_BUFFER 2007 shadow = step( depth, shadowCoord.z ); 2008 #else 2009 shadow = step( shadowCoord.z, depth ); 2010 #endif 2011 } 2012 return mix( 1.0, shadow, shadowIntensity ); 2013 } 2014 #endif 2015 #if NUM_SUN_LIGHT_SHADOWS > 0 2016 float getSunShadow( 2017 #if defined( SHADOWMAP_TYPE_PCF ) 2018 sampler2DShadow shadowMap, 2019 #else 2020 sampler2D shadowMap, 2021 #endif 2022 SunLightShadow sunLightShadow, 2023 int shadowIndex 2024 ) { 2025 vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 ); 2026 float viewDepth = vSunShadowWorldPosition.w; 2027 int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES; 2028 float shadow = 1.0; 2029 for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) { 2030 vec4 cascade = sunShadowCascade[ cascadeOffset + i ]; 2031 if ( viewDepth >= cascade.x && viewDepth < cascade.y ) { 2032 float cascadeShadow = getShadow( 2033 shadowMap, 2034 sunLightShadow.shadowMapSize, 2035 sunLightShadow.shadowIntensity, 2036 sunLightShadow.shadowBias, 2037 sunLightShadow.shadowRadius, 2038 sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition 2039 ); 2040 shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) ); 2041 } 2042 } 2043 return shadow; 2044 } 2045 #endif 2046 #if NUM_POINT_LIGHT_SHADOWS > 0 2047 #if defined( SHADOWMAP_TYPE_PCF ) 2048 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 2049 float shadow = 1.0; 2050 vec3 lightToPosition = shadowCoord.xyz; 2051 vec3 bd3D = normalize( lightToPosition ); 2052 vec3 absVec = abs( lightToPosition ); 2053 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 2054 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 2055 #ifdef USE_REVERSED_DEPTH_BUFFER 2056 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2057 dp -= shadowBias; 2058 #else 2059 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 2060 dp += shadowBias; 2061 #endif 2062 float texelSize = shadowRadius / shadowMapSize.x; 2063 vec3 absDir = abs( bd3D ); 2064 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 2065 tangent = normalize( cross( bd3D, tangent ) ); 2066 vec3 bitangent = cross( bd3D, tangent ); 2067 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 2068 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 2069 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 2070 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 2071 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 2072 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 2073 shadow = ( 2074 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 2075 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 2076 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 2077 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 2078 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 2079 ) * 0.2; 2080 } 2081 return mix( 1.0, shadow, shadowIntensity ); 2082 } 2083 #elif defined( SHADOWMAP_TYPE_BASIC ) 2084 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 2085 float shadow = 1.0; 2086 vec3 lightToPosition = shadowCoord.xyz; 2087 vec3 absVec = abs( lightToPosition ); 2088 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 2089 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 2090 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 2091 dp += shadowBias; 2092 vec3 bd3D = normalize( lightToPosition ); 2093 float depth = textureCube( shadowMap, bd3D ).r; 2094 #ifdef USE_REVERSED_DEPTH_BUFFER 2095 depth = 1.0 - depth; 2096 #endif 2097 shadow = step( dp, depth ); 2098 } 2099 return mix( 1.0, shadow, shadowIntensity ); 2100 } 2101 #endif 2102 #endif 2103#endif`,zh=`#if NUM_SPOT_LIGHT_COORDS > 0 2104 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 2105 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 2106#endif 2107#ifdef USE_SHADOWMAP 2108 #if NUM_SUN_LIGHT_SHADOWS > 0 2109 varying vec4 vSunShadowWorldPosition; 2110 varying vec3 vSunShadowWorldNormal; 2111 #endif 2112 #if NUM_DIR_LIGHT_SHADOWS > 0 2113 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 2114 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 2115 struct DirectionalLightShadow { 2116 float shadowIntensity; 2117 float shadowBias; 2118 float shadowNormalBias; 2119 float shadowRadius; 2120 vec2 shadowMapSize; 2121 }; 2122 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 2123 #endif 2124 #if NUM_SPOT_LIGHT_SHADOWS > 0 2125 struct SpotLightShadow { 2126 float shadowIntensity; 2127 float shadowBias; 2128 float shadowNormalBias; 2129 float shadowRadius; 2130 vec2 shadowMapSize; 2131 }; 2132 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2133 #endif 2134 #if NUM_POINT_LIGHT_SHADOWS > 0 2135 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2136 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2137 struct PointLightShadow { 2138 float shadowIntensity; 2139 float shadowBias; 2140 float shadowNormalBias; 2141 float shadowRadius; 2142 vec2 shadowMapSize; 2143 float shadowCameraNear; 2144 float shadowCameraFar; 2145 }; 2146 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2147 #endif 2148#endif`,Gh=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2149 #ifdef HAS_NORMAL 2150 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 2151 #else 2152 vec3 shadowWorldNormal = vec3( 0.0 ); 2153 #endif 2154 vec4 shadowWorldPosition; 2155#endif 2156#if defined( USE_SHADOWMAP ) 2157 #if NUM_SUN_LIGHT_SHADOWS > 0 2158 vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z ); 2159 vSunShadowWorldNormal = shadowWorldNormal; 2160 #endif 2161 #if NUM_DIR_LIGHT_SHADOWS > 0 2162 #pragma unroll_loop_start 2163 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2164 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2165 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2166 } 2167 #pragma unroll_loop_end 2168 #endif 2169 #if NUM_POINT_LIGHT_SHADOWS > 0 2170 #pragma unroll_loop_start 2171 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2172 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2173 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2174 } 2175 #pragma unroll_loop_end 2176 #endif 2177#endif
2178#if NUM_SPOT_LIGHT_COORDS > 0 2179 #pragma unroll_loop_start 2180 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2181 shadowWorldPosition = worldPosition; 2182 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2183 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2184 #endif 2185 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2186 } 2187 #pragma unroll_loop_end 2188#endif`,Hh=`float getShadowMask() { 2189 float shadow = 1.0; 2190 #ifdef USE_SHADOWMAP 2191 #if NUM_SUN_LIGHT_SHADOWS > 0 2192 SunLightShadow sunLight; 2193 #pragma unroll_loop_start 2194 for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) { 2195 sunLight = sunLightShadows[ i ]; 2196 shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0; 2197 } 2198 #pragma unroll_loop_end 2199 #endif 2200 #if NUM_DIR_LIGHT_SHADOWS > 0 2201 DirectionalLightShadow directionalLight; 2202 #pragma unroll_loop_start 2203 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2204 directionalLight = directionalLightShadows[ i ]; 2205 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2206 } 2207 #pragma unroll_loop_end 2208 #endif 2209 #if NUM_SPOT_LIGHT_SHADOWS > 0 2210 SpotLightShadow spotLight; 2211 #pragma unroll_loop_start 2212 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2213 spotLight = spotLightShadows[ i ]; 2214 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2215 } 2216 #pragma unroll_loop_end 2217 #endif 2218 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2219 PointLightShadow pointLight; 2220 #pragma unroll_loop_start 2221 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2222 pointLight = pointLightShadows[ i ]; 2223 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2224 } 2225 #pragma unroll_loop_end 2226 #endif 2227 #endif 2228 return shadow; 2229}`,Vh=`#ifdef USE_SKINNING 2230 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2231 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2232 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2233 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2234#endif`,kh=`#ifdef USE_SKINNING 2235 uniform mat4 bindMatrix; 2236 uniform mat4 bindMatrixInverse; 2237 uniform highp sampler2D boneTexture; 2238 mat4 getBoneMatrix( const in float i ) { 2239 int size = textureSize( boneTexture, 0 ).x; 2240 int j = int( i ) * 4; 2241 int x = j % size; 2242 int y = j / size; 2243 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2244 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2245 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2246 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2247 return mat4( v1, v2, v3, v4 ); 2248 } 2249#endif`,Wh=`#ifdef USE_SKINNING 2250 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2251 vec4 skinned = vec4( 0.0 ); 2252 skinned += boneMatX * skinVertex * skinWeight.x; 2253 skinned += boneMatY * skinVertex * skinWeight.y; 2254 skinned += boneMatZ * skinVertex * skinWeight.z; 2255 skinned += boneMatW * skinVertex * skinWeight.w; 2256 transformed = ( bindMatrixInverse * skinned ).xyz; 2257#endif`,Xh=`#ifdef USE_SKINNING 2258 mat4 skinMatrix = mat4( 0.0 ); 2259 skinMatrix += skinWeight.x * boneMatX; 2260 skinMatrix += skinWeight.y * boneMatY; 2261 skinMatrix += skinWeight.z * boneMatZ; 2262 skinMatrix += skinWeight.w * boneMatW; 2263 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2264 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2265 #ifdef USE_TANGENT 2266 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2267 #endif 2268#endif`,qh=`float specularStrength; 2269#ifdef USE_SPECULARMAP 2270 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2271 specularStrength = texelSpecular.r; 2272#else 2273 specularStrength = 1.0; 2274#endif`,Yh=`#ifdef USE_SPECULARMAP 2275 uniform sampler2D specularMap; 2276#endif`,Zh=`#if defined( TONE_MAPPING ) 2277 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2278#endif`,Kh=`#ifndef saturate 2279#define saturate( a ) clamp( a, 0.0, 1.0 ) 2280#endif 2281uniform float toneMappingExposure; 2282vec3 LinearToneMapping( vec3 color ) { 2283 return saturate( toneMappingExposure * color ); 2284} 2285vec3 ReinhardToneMapping( vec3 color ) { 2286 color *= toneMappingExposure; 2287 return saturate( color / ( vec3( 1.0 ) + color ) ); 2288} 2289vec3 CineonToneMapping( vec3 color ) { 2290 color *= toneMappingExposure; 2291 color = max( vec3( 0.0 ), color - 0.004 ); 2292 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2293} 2294vec3 RRTAndODTFit( vec3 v ) { 2295 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2296 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2297 return a / b; 2298} 2299vec3 ACESFilmicToneMapping( vec3 color ) { 2300 const mat3 ACESInputMat = mat3( 2301 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2302 vec3( 0.04823, 0.01566, 0.83777 ) 2303 ); 2304 const mat3 ACESOutputMat = mat3( 2305 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2306 vec3( -0.07367, -0.00605, 1.07602 ) 2307 ); 2308 color *= toneMappingExposure / 0.6; 2309 color = ACESInputMat * color; 2310 color = RRTAndODTFit( color ); 2311 color = ACESOutputMat * color; 2312 return saturate( color ); 2313} 2314const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2315 vec3( 1.6605, - 0.1246, - 0.0182 ), 2316 vec3( - 0.5876, 1.1329, - 0.1006 ), 2317 vec3( - 0.0728, - 0.0083, 1.1187 ) 2318); 2319const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2320 vec3( 0.6274, 0.0691, 0.0164 ), 2321 vec3( 0.3293, 0.9195, 0.0880 ), 2322 vec3( 0.0433, 0.0113, 0.8956 ) 2323); 2324vec3 agxDefaultContrastApprox( vec3 x ) { 2325 vec3 x2 = x * x; 2326 vec3 x4 = x2 * x2; 2327 return + 15.5 * x4 * x2 2328 - 40.14 * x4 * x 2329 + 31.96 * x4 2330 - 6.868 * x2 * x 2331 + 0.4298 * x2 2332 + 0.1191 * x 2333 - 0.00232; 2334} 2335vec3 AgXToneMapping( vec3 color ) { 2336 const mat3 AgXInsetMatrix = mat3( 2337 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2338 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2339 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2340 );
2341 const mat3 AgXOutsetMatrix = mat3( 2342 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2343 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2344 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2345 ); 2346 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2347 color *= toneMappingExposure; 2348 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2349 color = AgXInsetMatrix * color; 2350 color = max( color, 1e-10 ); color = log2( color ); 2351 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2352 color = clamp( color, 0.0, 1.0 ); 2353 color = agxDefaultContrastApprox( color ); 2354 color = AgXOutsetMatrix * color; 2355 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2356 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2357 color = clamp( color, 0.0, 1.0 ); 2358 return color; 2359} 2360vec3 NeutralToneMapping( vec3 color ) { 2361 const float StartCompression = 0.8 - 0.04; 2362 const float Desaturation = 0.15; 2363 color *= toneMappingExposure; 2364 float x = min( color.r, min( color.g, color.b ) ); 2365 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2366 color -= offset; 2367 float peak = max( color.r, max( color.g, color.b ) ); 2368 if ( peak < StartCompression ) return color; 2369 float d = 1. - StartCompression; 2370 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2371 color *= newPeak / peak; 2372 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2373 return mix( color, vec3( newPeak ), g ); 2374} 2375vec3 CustomToneMapping( vec3 color ) { return color; }`,$h=`#ifdef USE_TRANSMISSION 2376 material.transmission = transmission; 2377 material.transmissionAlpha = 1.0; 2378 material.thickness = thickness; 2379 material.attenuationDistance = attenuationDistance; 2380 material.attenuationColor = attenuationColor; 2381 #ifdef USE_TRANSMISSIONMAP 2382 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2383 #endif 2384 #ifdef USE_THICKNESSMAP 2385 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2386 #endif 2387 vec3 pos = vWorldPosition; 2388 vec3 v = normalize( cameraPosition - pos ); 2389 vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix ); 2390 vec4 transmitted = getIBLVolumeRefraction( 2391 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2392 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2393 material.attenuationColor, material.attenuationDistance ); 2394 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2395 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2396#endif`,Jh=`#ifdef USE_TRANSMISSION 2397 uniform float transmission; 2398 uniform float thickness; 2399 uniform float attenuationDistance; 2400 uniform vec3 attenuationColor; 2401 #ifdef USE_TRANSMISSIONMAP 2402 uniform sampler2D transmissionMap; 2403 #endif 2404 #ifdef USE_THICKNESSMAP 2405 uniform sampler2D thicknessMap; 2406 #endif 2407 uniform vec2 transmissionSamplerSize; 2408 uniform sampler2D transmissionSamplerMap; 2409 uniform mat4 modelMatrix; 2410 uniform mat4 projectionMatrix; 2411 varying vec3 vWorldPosition; 2412 float w0( float a ) { 2413 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2414 } 2415 float w1( float a ) { 2416 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2417 } 2418 float w2( float a ){ 2419 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2420 } 2421 float w3( float a ) { 2422 return ( 1.0 / 6.0 ) * ( a * a * a ); 2423 } 2424 float g0( float a ) { 2425 return w0( a ) + w1( a ); 2426 } 2427 float g1( float a ) { 2428 return w2( a ) + w3( a ); 2429 } 2430 float h0( float a ) { 2431 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2432 } 2433 float h1( float a ) { 2434 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2435 } 2436 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2437 uv = uv * texelSize.zw + 0.5; 2438 vec2 iuv = floor( uv ); 2439 vec2 fuv = fract( uv ); 2440 float g0x = g0( fuv.x ); 2441 float g1x = g1( fuv.x ); 2442 float h0x = h0( fuv.x ); 2443 float h1x = h1( fuv.x ); 2444 float h0y = h0( fuv.y ); 2445 float h1y = h1( fuv.y ); 2446 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2447 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2448 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2449 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2450 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2451 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2452 } 2453 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2454 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2455 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2456 vec2 fLodSizeInv = 1.0 / fLodSize; 2457 vec2 cLodSizeInv = 1.0 / cLodSize; 2458 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2459 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2460 return mix( fSample, cSample, fract( lod ) ); 2461 } 2462 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2463 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2464 vec3 modelScale; 2465 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2466 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2467 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2468 return normalize( refractionVector ) * thickness * modelScale; 2469 } 2470 float applyIorToRoughness( const in float roughness, const in float ior ) { 2471 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2472 } 2473 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2474 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2475 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2476 } 2477 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2478 if ( isinf( attenuationDistance ) ) { 2479 return vec3( 1.0 ); 2480 } else { 2481 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2482 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2483 } 2484 } 2485 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2486 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2487 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2488 const in vec3 attenuationColor, const in float attenuationDistance ) { 2489 vec4 transmittedLight; 2490 vec3 transmittance; 2491 #ifdef USE_DISPERSION 2492 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2493 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2494 for ( int i = 0; i < 3; i ++ ) { 2495 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2496 vec3 refractedRayExit = position + transmissionRay; 2497 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2498 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2499 refractionCoords += 1.0; 2500 refractionCoords /= 2.0; 2501 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2502 transmittedLight[ i ] = transmissionSample[ i ]; 2503 transmittedLight.a += transmissionSample.a; 2504 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2505 } 2506 transmittedLight.a /= 3.0; 2507 #else 2508 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2509 vec3 refractedRayExit = position + transmissionRay; 2510 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2511 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2512 refractionCoords += 1.0; 2513 refractionCoords /= 2.0; 2514 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2515 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2516 #endif 2517 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2518 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2519 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2520 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2521 } 2522#endif`,Qh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2523 varying vec2 vUv; 2524#endif 2525#ifdef USE_MAP 2526 varying vec2 vMapUv; 2527#endif 2528#ifdef USE_ALPHAMAP
2529 varying vec2 vAlphaMapUv; 2530#endif 2531#ifdef USE_LIGHTMAP 2532 varying vec2 vLightMapUv; 2533#endif 2534#ifdef USE_AOMAP 2535 varying vec2 vAoMapUv; 2536#endif 2537#ifdef USE_BUMPMAP 2538 varying vec2 vBumpMapUv; 2539#endif 2540#ifdef USE_NORMALMAP 2541 varying vec2 vNormalMapUv; 2542#endif 2543#ifdef USE_EMISSIVEMAP 2544 varying vec2 vEmissiveMapUv; 2545#endif 2546#ifdef USE_METALNESSMAP 2547 varying vec2 vMetalnessMapUv; 2548#endif 2549#ifdef USE_ROUGHNESSMAP 2550 varying vec2 vRoughnessMapUv; 2551#endif 2552#ifdef USE_ANISOTROPYMAP 2553 varying vec2 vAnisotropyMapUv; 2554#endif 2555#ifdef USE_CLEARCOATMAP 2556 varying vec2 vClearcoatMapUv; 2557#endif 2558#ifdef USE_CLEARCOAT_NORMALMAP 2559 varying vec2 vClearcoatNormalMapUv; 2560#endif 2561#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2562 varying vec2 vClearcoatRoughnessMapUv; 2563#endif 2564#ifdef USE_IRIDESCENCEMAP 2565 varying vec2 vIridescenceMapUv; 2566#endif 2567#ifdef USE_IRIDESCENCE_THICKNESSMAP 2568 varying vec2 vIridescenceThicknessMapUv; 2569#endif 2570#ifdef USE_SHEEN_COLORMAP 2571 varying vec2 vSheenColorMapUv; 2572#endif 2573#ifdef USE_SHEEN_ROUGHNESSMAP 2574 varying vec2 vSheenRoughnessMapUv; 2575#endif 2576#ifdef USE_SPECULARMAP 2577 varying vec2 vSpecularMapUv; 2578#endif 2579#ifdef USE_SPECULAR_COLORMAP 2580 varying vec2 vSpecularColorMapUv; 2581#endif 2582#ifdef USE_SPECULAR_INTENSITYMAP 2583 varying vec2 vSpecularIntensityMapUv; 2584#endif 2585#ifdef USE_TRANSMISSIONMAP 2586 uniform mat3 transmissionMapTransform; 2587 varying vec2 vTransmissionMapUv; 2588#endif 2589#ifdef USE_THICKNESSMAP 2590 uniform mat3 thicknessMapTransform; 2591 varying vec2 vThicknessMapUv; 2592#endif`,jh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2593 varying vec2 vUv; 2594#endif 2595#ifdef USE_MAP 2596 uniform mat3 mapTransform; 2597 varying vec2 vMapUv; 2598#endif 2599#ifdef USE_ALPHAMAP 2600 uniform mat3 alphaMapTransform; 2601 varying vec2 vAlphaMapUv; 2602#endif 2603#ifdef USE_LIGHTMAP 2604 uniform mat3 lightMapTransform; 2605 varying vec2 vLightMapUv; 2606#endif 2607#ifdef USE_AOMAP 2608 uniform mat3 aoMapTransform; 2609 varying vec2 vAoMapUv; 2610#endif 2611#ifdef USE_BUMPMAP 2612 uniform mat3 bumpMapTransform; 2613 varying vec2 vBumpMapUv; 2614#endif 2615#ifdef USE_NORMALMAP 2616 uniform mat3 normalMapTransform; 2617 varying vec2 vNormalMapUv; 2618#endif 2619#ifdef USE_DISPLACEMENTMAP 2620 uniform mat3 displacementMapTransform; 2621 varying vec2 vDisplacementMapUv; 2622#endif 2623#ifdef USE_EMISSIVEMAP 2624 uniform mat3 emissiveMapTransform; 2625 varying vec2 vEmissiveMapUv; 2626#endif 2627#ifdef USE_METALNESSMAP 2628 uniform mat3 metalnessMapTransform; 2629 varying vec2 vMetalnessMapUv; 2630#endif 2631#ifdef USE_ROUGHNESSMAP 2632 uniform mat3 roughnessMapTransform; 2633 varying vec2 vRoughnessMapUv; 2634#endif 2635#ifdef USE_ANISOTROPYMAP 2636 uniform mat3 anisotropyMapTransform; 2637 varying vec2 vAnisotropyMapUv; 2638#endif 2639#ifdef USE_CLEARCOATMAP 2640 uniform mat3 clearcoatMapTransform; 2641 varying vec2 vClearcoatMapUv; 2642#endif 2643#ifdef USE_CLEARCOAT_NORMALMAP 2644 uniform mat3 clearcoatNormalMapTransform; 2645 varying vec2 vClearcoatNormalMapUv; 2646#endif 2647#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2648 uniform mat3 clearcoatRoughnessMapTransform; 2649 varying vec2 vClearcoatRoughnessMapUv; 2650#endif 2651#ifdef USE_SHEEN_COLORMAP 2652 uniform mat3 sheenColorMapTransform; 2653 varying vec2 vSheenColorMapUv; 2654#endif 2655#ifdef USE_SHEEN_ROUGHNESSMAP 2656 uniform mat3 sheenRoughnessMapTransform; 2657 varying vec2 vSheenRoughnessMapUv; 2658#endif 2659#ifdef USE_IRIDESCENCEMAP 2660 uniform mat3 iridescenceMapTransform; 2661 varying vec2 vIridescenceMapUv; 2662#endif 2663#ifdef USE_IRIDESCENCE_THICKNESSMAP 2664 uniform mat3 iridescenceThicknessMapTransform; 2665 varying vec2 vIridescenceThicknessMapUv; 2666#endif 2667#ifdef USE_SPECULARMAP 2668 uniform mat3 specularMapTransform; 2669 varying vec2 vSpecularMapUv; 2670#endif 2671#ifdef USE_SPECULAR_COLORMAP 2672 uniform mat3 specularColorMapTransform; 2673 varying vec2 vSpecularColorMapUv; 2674#endif 2675#ifdef USE_SPECULAR_INTENSITYMAP 2676 uniform mat3 specularIntensityMapTransform; 2677 varying vec2 vSpecularIntensityMapUv; 2678#endif 2679#ifdef USE_TRANSMISSIONMAP 2680 uniform mat3 transmissionMapTransform; 2681 varying vec2 vTransmissionMapUv; 2682#endif 2683#ifdef USE_THICKNESSMAP 2684 uniform mat3 thicknessMapTransform; 2685 varying vec2 vThicknessMapUv; 2686#endif`,ed=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2687 vUv = vec3( uv, 1 ).xy; 2688#endif 2689#ifdef USE_MAP 2690 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2691#endif 2692#ifdef USE_ALPHAMAP 2693 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2694#endif 2695#ifdef USE_LIGHTMAP 2696 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2697#endif 2698#ifdef USE_AOMAP 2699 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2700#endif 2701#ifdef USE_BUMPMAP 2702 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2703#endif 2704#ifdef USE_NORMALMAP 2705 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2706#endif 2707#ifdef USE_DISPLACEMENTMAP 2708 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2709#endif 2710#ifdef USE_EMISSIVEMAP 2711 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2712#endif 2713#ifdef USE_METALNESSMAP 2714 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2715#endif 2716#ifdef USE_ROUGHNESSMAP 2717 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2718#endif 2719#ifdef USE_ANISOTROPYMAP 2720 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2721#endif 2722#ifdef USE_CLEARCOATMAP 2723 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2724#endif 2725#ifdef USE_CLEARCOAT_NORMALMAP 2726 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2727#endif 2728#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2729 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2730#endif
2731#ifdef USE_IRIDESCENCEMAP 2732 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2733#endif 2734#ifdef USE_IRIDESCENCE_THICKNESSMAP 2735 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2736#endif 2737#ifdef USE_SHEEN_COLORMAP 2738 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2739#endif 2740#ifdef USE_SHEEN_ROUGHNESSMAP 2741 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2742#endif 2743#ifdef USE_SPECULARMAP 2744 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2745#endif 2746#ifdef USE_SPECULAR_COLORMAP 2747 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2748#endif 2749#ifdef USE_SPECULAR_INTENSITYMAP 2750 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2751#endif 2752#ifdef USE_TRANSMISSIONMAP 2753 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2754#endif 2755#ifdef USE_THICKNESSMAP 2756 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2757#endif`,td=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2758 vec4 worldPosition = vec4( transformed, 1.0 ); 2759 #ifdef USE_BATCHING 2760 worldPosition = batchingMatrix * worldPosition; 2761 #endif 2762 #ifdef USE_INSTANCING 2763 worldPosition = instanceMatrix * worldPosition; 2764 #endif 2765 worldPosition = modelMatrix * worldPosition; 2766#endif`;const nd=`varying vec2 vUv; 2767uniform mat3 uvTransform; 2768void main() { 2769 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2770 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2771}`,id=`uniform sampler2D t2D; 2772uniform float backgroundIntensity; 2773varying vec2 vUv; 2774void main() { 2775 vec4 texColor = texture2D( t2D, vUv ); 2776 #ifdef DECODE_VIDEO_TEXTURE 2777 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2778 #endif 2779 texColor.rgb *= backgroundIntensity; 2780 gl_FragColor = texColor; 2781 #include <tonemapping_fragment> 2782 #include <colorspace_fragment> 2783}`,rd=`varying vec3 vWorldDirection; 2784#include <common> 2785void main() { 2786 vWorldDirection = transformDirection( position, modelMatrix ); 2787 #include <begin_vertex> 2788 #include <project_vertex> 2789 gl_Position.z = gl_Position.w; 2790}`,sd=`#ifdef ENVMAP_TYPE_CUBE 2791 uniform samplerCube envMap; 2792#elif defined( ENVMAP_TYPE_CUBE_UV ) 2793 uniform sampler2D envMap; 2794#endif 2795uniform float backgroundBlurriness; 2796uniform float backgroundIntensity; 2797uniform mat3 backgroundRotation; 2798varying vec3 vWorldDirection; 2799#include <cube_uv_reflection_fragment> 2800void main() { 2801 #ifdef ENVMAP_TYPE_CUBE 2802 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 2803 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2804 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2805 #else 2806 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2807 #endif 2808 texColor.rgb *= backgroundIntensity; 2809 gl_FragColor = texColor; 2810 #include <tonemapping_fragment> 2811 #include <colorspace_fragment> 2812}`,ad=`varying vec3 vWorldDirection; 2813#include <common> 2814void main() { 2815 vWorldDirection = transformDirection( position, modelMatrix ); 2816 #include <begin_vertex> 2817 #include <project_vertex> 2818 gl_Position.z = gl_Position.w; 2819}`,od=`uniform samplerCube tCube; 2820uniform float tFlip; 2821uniform float opacity; 2822varying vec3 vWorldDirection; 2823void main() { 2824 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2825 gl_FragColor = texColor; 2826 gl_FragColor.a *= opacity; 2827 #include <tonemapping_fragment> 2828 #include <colorspace_fragment> 2829}`,ld=`#include <common> 2830#include <batching_pars_vertex> 2831#include <uv_pars_vertex> 2832#include <displacementmap_pars_vertex> 2833#include <morphtarget_pars_vertex> 2834#include <skinning_pars_vertex> 2835#include <logdepthbuf_pars_vertex> 2836#include <clipping_planes_pars_vertex> 2837varying vec2 vHighPrecisionZW; 2838void main() { 2839 #include <uv_vertex> 2840 #include <batching_vertex> 2841 #include <skinbase_vertex> 2842 #include <morphinstance_vertex> 2843 #ifdef USE_DISPLACEMENTMAP 2844 #include <beginnormal_vertex> 2845 #include <morphnormal_vertex> 2846 #include <skinnormal_vertex> 2847 #endif 2848 #include <begin_vertex> 2849 #include <morphtarget_vertex> 2850 #include <skinning_vertex> 2851 #include <displacementmap_vertex> 2852 #include <project_vertex> 2853 #include <logdepthbuf_vertex> 2854 #include <clipping_planes_vertex> 2855 vHighPrecisionZW = gl_Position.zw; 2856}`,cd=`#if DEPTH_PACKING == 3200 2857 uniform float opacity; 2858#endif 2859#include <common> 2860#include <packing> 2861#include <uv_pars_fragment> 2862#include <map_pars_fragment> 2863#include <alphamap_pars_fragment> 2864#include <alphatest_pars_fragment> 2865#include <alphahash_pars_fragment> 2866#include <logdepthbuf_pars_fragment> 2867#include <clipping_planes_pars_fragment> 2868varying vec2 vHighPrecisionZW; 2869void main() { 2870 vec4 diffuseColor = vec4( 1.0 ); 2871 #include <clipping_planes_fragment> 2872 #if DEPTH_PACKING == 3200 2873 diffuseColor.a = opacity; 2874 #endif 2875 #include <map_fragment> 2876 #include <alphamap_fragment> 2877 #include <alphatest_fragment> 2878 #include <alphahash_fragment> 2879 #include <logdepthbuf_fragment> 2880 #ifdef USE_REVERSED_DEPTH_BUFFER 2881 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2882 #else 2883 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2884 #endif 2885 #if DEPTH_PACKING == 3200 2886 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2887 #elif DEPTH_PACKING == 3201 2888 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2889 #elif DEPTH_PACKING == 3202 2890 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2891 #elif DEPTH_PACKING == 3203 2892 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2893 #endif 2894}`,ud=`#define DISTANCE 2895varying vec3 vWorldPosition; 2896#include <common> 2897#include <batching_pars_vertex> 2898#include <uv_pars_vertex> 2899#include <displacementmap_pars_vertex> 2900#include <morphtarget_pars_vertex> 2901#include <skinning_pars_vertex> 2902#include <clipping_planes_pars_vertex> 2903void main() { 2904 #include <uv_vertex> 2905 #include <batching_vertex> 2906 #include <skinbase_vertex> 2907 #include <morphinstance_vertex> 2908 #ifdef USE_DISPLACEMENTMAP 2909 #include <beginnormal_vertex> 2910 #include <morphnormal_vertex> 2911 #include <skinnormal_vertex> 2912 #endif 2913 #include <begin_vertex> 2914 #include <morphtarget_vertex> 2915 #include <skinning_vertex> 2916 #include <displacementmap_vertex> 2917 #include <project_vertex> 2918 #include <worldpos_vertex> 2919 #include <clipping_planes_vertex> 2920 vWorldPosition = worldPosition.xyz; 2921}`,fd=`#define DISTANCE 2922uniform vec3 referencePosition; 2923uniform float nearDistance; 2924uniform float farDistance; 2925varying vec3 vWorldPosition; 2926#include <common> 2927#include <uv_pars_fragment> 2928#include <map_pars_fragment> 2929#include <alphamap_pars_fragment> 2930#include <alphatest_pars_fragment> 2931#include <alphahash_pars_fragment> 2932#include <clipping_planes_pars_fragment> 2933void main() { 2934 vec4 diffuseColor = vec4( 1.0 ); 2935 #include <clipping_planes_fragment> 2936 #include <map_fragment> 2937 #include <alphamap_fragment> 2938 #include <alphatest_fragment> 2939 #include <alphahash_fragment> 2940 float dist = length( vWorldPosition - referencePosition ); 2941 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2942 dist = saturate( dist ); 2943 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2944}`,hd=`varying vec3 vWorldDirection; 2945#include <common> 2946void main() { 2947 vWorldDirection = transformDirection( position, modelMatrix ); 2948 #include <begin_vertex> 2949 #include <project_vertex> 2950}`,dd=`uniform sampler2D tEquirect; 2951varying vec3 vWorldDirection; 2952#include <common> 2953void main() { 2954 vec3 direction = normalize( vWorldDirection ); 2955 vec2 sampleUV = equirectUv( direction ); 2956 gl_FragColor = texture2D( tEquirect, sampleUV ); 2957 #include <tonemapping_fragment> 2958 #include <colorspace_fragment> 2959}`,pd=`uniform float scale; 2960attribute float lineDistance; 2961varying float vLineDistance; 2962#include <common> 2963#include <uv_pars_vertex> 2964#include <color_pars_vertex> 2965#include <fog_pars_vertex> 2966#include <morphtarget_pars_vertex> 2967#include <logdepthbuf_pars_vertex> 2968#include <clipping_planes_pars_vertex> 2969void main() { 2970 vLineDistance = scale * lineDistance; 2971 #include <uv_vertex> 2972 #include <color_vertex> 2973 #include <morphinstance_vertex> 2974 #include <morphcolor_vertex> 2975 #include <begin_vertex> 2976 #include <morphtarget_vertex> 2977 #include <project_vertex> 2978 #include <logdepthbuf_vertex> 2979 #include <clipping_planes_vertex> 2980 #include <fog_vertex> 2981}`,md=`uniform vec3 diffuse; 2982uniform float opacity; 2983uniform float dashSize; 2984uniform float totalSize; 2985varying float vLineDistance; 2986#include <common> 2987#include <color_pars_fragment> 2988#include <uv_pars_fragment> 2989#include <map_pars_fragment> 2990#include <fog_pars_fragment> 2991#include <logdepthbuf_pars_fragment> 2992#include <clipping_planes_pars_fragment> 2993void main() { 2994 vec4 diffuseColor = vec4( diffuse, opacity ); 2995 #include <clipping_planes_fragment> 2996 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2997 discard; 2998 } 2999 vec3 outgoingLight = vec3( 0.0 ); 3000 #include <logdepthbuf_fragment> 3001 #include <map_fragment> 3002 #include <color_fragment> 3003 outgoingLight = diffuseColor.rgb; 3004 #include <opaque_fragment> 3005 #include <tonemapping_fragment> 3006 #include <colorspace_fragment> 3007 #include <fog_fragment> 3008 #include <premultiplied_alpha_fragment> 3009}`,gd=`#include <common> 3010#include <batching_pars_vertex> 3011#include <uv_pars_vertex> 3012#include <envmap_pars_vertex> 3013#include <color_pars_vertex> 3014#include <fog_pars_vertex> 3015#include <morphtarget_pars_vertex> 3016#include <skinning_pars_vertex> 3017#include <logdepthbuf_pars_vertex> 3018#include <clipping_planes_pars_vertex> 3019void main() { 3020 #include <uv_vertex> 3021 #include <color_vertex> 3022 #include <morphinstance_vertex> 3023 #include <morphcolor_vertex> 3024 #include <batching_vertex> 3025 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 3026 #include <beginnormal_vertex> 3027 #include <morphnormal_vertex> 3028 #include <skinbase_vertex> 3029 #include <skinnormal_vertex> 3030 #include <defaultnormal_vertex> 3031 #endif 3032 #include <begin_vertex> 3033 #include <morphtarget_vertex> 3034 #include <skinning_vertex> 3035 #include <project_vertex> 3036 #include <logdepthbuf_vertex> 3037 #include <clipping_planes_vertex> 3038 #include <worldpos_vertex> 3039 #include <envmap_vertex> 3040 #include <fog_vertex> 3041}`,_d=`uniform vec3 diffuse; 3042uniform float opacity; 3043#ifndef FLAT_SHADED 3044 varying vec3 vNormal; 3045#endif 3046#include <common> 3047#include <dithering_pars_fragment> 3048#include <color_pars_fragment> 3049#include <uv_pars_fragment> 3050#include <map_pars_fragment> 3051#include <alphamap_pars_fragment> 3052#include <alphatest_pars_fragment> 3053#include <alphahash_pars_fragment> 3054#include <aomap_pars_fragment> 3055#include <lightmap_pars_fragment> 3056#include <envmap_common_pars_fragment> 3057#include <envmap_pars_fragment> 3058#include <fog_pars_fragment> 3059#include <specularmap_pars_fragment> 3060#include <logdepthbuf_pars_fragment> 3061#include <clipping_planes_pars_fragment> 3062void main() { 3063 vec4 diffuseColor = vec4( diffuse, opacity ); 3064 #include <clipping_planes_fragment> 3065 #include <logdepthbuf_fragment> 3066 #include <map_fragment> 3067 #include <color_fragment> 3068 #include <alphamap_fragment> 3069 #include <alphatest_fragment> 3070 #include <alphahash_fragment> 3071 #include <specularmap_fragment> 3072 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3073 #ifdef USE_LIGHTMAP 3074 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 3075 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 3076 #else 3077 reflectedLight.indirectDiffuse += vec3( 1.0 ); 3078 #endif 3079 #include <aomap_fragment> 3080 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 3081 vec3 outgoingLight = reflectedLight.indirectDiffuse; 3082 #include <envmap_fragment> 3083 #include <opaque_fragment> 3084 #include <tonemapping_fragment> 3085 #include <colorspace_fragment> 3086 #include <fog_fragment> 3087 #include <premultiplied_alpha_fragment> 3088 #include <dithering_fragment> 3089}`,xd=`#define LAMBERT 3090varying vec3 vViewPosition; 3091#include <common> 3092#include <batching_pars_vertex> 3093#include <uv_pars_vertex> 3094#include <displacementmap_pars_vertex> 3095#include <envmap_pars_vertex> 3096#include <color_pars_vertex> 3097#include <fog_pars_vertex> 3098#include <normal_pars_vertex> 3099#include <morphtarget_pars_vertex> 3100#include <skinning_pars_vertex> 3101#include <shadowmap_pars_vertex> 3102#include <logdepthbuf_pars_vertex> 3103#include <clipping_planes_pars_vertex> 3104void main() { 3105 #include <uv_vertex> 3106 #include <color_vertex> 3107 #include <morphinstance_vertex> 3108 #include <morphcolor_vertex> 3109 #include <batching_vertex> 3110 #include <beginnormal_vertex> 3111 #include <morphnormal_vertex> 3112 #include <skinbase_vertex> 3113 #include <skinnormal_vertex> 3114 #include <defaultnormal_vertex> 3115 #include <normal_vertex> 3116 #include <begin_vertex> 3117 #include <morphtarget_vertex> 3118 #include <skinning_vertex> 3119 #include <displacementmap_vertex> 3120 #include <project_vertex> 3121 #include <logdepthbuf_vertex> 3122 #include <clipping_planes_vertex> 3123 vViewPosition = - mvPosition.xyz; 3124 #include <worldpos_vertex> 3125 #include <envmap_vertex> 3126 #include <shadowmap_vertex> 3127 #include <fog_vertex> 3128}`,vd=`#define LAMBERT 3129uniform vec3 diffuse; 3130uniform vec3 emissive; 3131uniform float opacity; 3132#include <common> 3133#include <dithering_pars_fragment> 3134#include <color_pars_fragment> 3135#include <uv_pars_fragment> 3136#include <map_pars_fragment> 3137#include <alphamap_pars_fragment> 3138#include <alphatest_pars_fragment> 3139#include <alphahash_pars_fragment> 3140#include <aomap_pars_fragment> 3141#include <lightmap_pars_fragment> 3142#include <emissivemap_pars_fragment> 3143#include <cube_uv_reflection_fragment> 3144#include <envmap_common_pars_fragment> 3145#include <envmap_pars_fragment> 3146#include <envmap_physical_pars_fragment> 3147#include <fog_pars_fragment> 3148#include <bsdfs> 3149#include <lights_pars_begin> 3150#include <normal_pars_fragment> 3151#include <lights_lambert_pars_fragment> 3152#include <shadowmap_pars_fragment> 3153#include <bumpmap_pars_fragment> 3154#include <normalmap_pars_fragment> 3155#include <specularmap_pars_fragment> 3156#include <logdepthbuf_pars_fragment> 3157#include <clipping_planes_pars_fragment> 3158void main() { 3159 vec4 diffuseColor = vec4( diffuse, opacity ); 3160 #include <clipping_planes_fragment> 3161 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3162 vec3 totalEmissiveRadiance = emissive; 3163 #include <logdepthbuf_fragment> 3164 #include <map_fragment> 3165 #include <color_fragment> 3166 #include <alphamap_fragment> 3167 #include <alphatest_fragment> 3168 #include <alphahash_fragment> 3169 #include <specularmap_fragment> 3170 #include <normal_fragment_begin> 3171 #include <normal_fragment_maps> 3172 #include <emissivemap_fragment> 3173 #include <lights_lambert_fragment> 3174 #include <lights_fragment_begin> 3175 #include <lights_fragment_maps> 3176 #include <lights_fragment_end> 3177 #include <aomap_fragment> 3178 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3179 #include <envmap_fragment> 3180 #include <opaque_fragment> 3181 #include <tonemapping_fragment> 3182 #include <colorspace_fragment> 3183 #include <fog_fragment> 3184 #include <premultiplied_alpha_fragment> 3185 #include <dithering_fragment> 3186}`,Md=`#define MATCAP 3187varying vec3 vViewPosition; 3188#include <common> 3189#include <batching_pars_vertex> 3190#include <uv_pars_vertex> 3191#include <color_pars_vertex> 3192#include <displacementmap_pars_vertex> 3193#include <fog_pars_vertex> 3194#include <normal_pars_vertex> 3195#include <morphtarget_pars_vertex> 3196#include <skinning_pars_vertex> 3197#include <logdepthbuf_pars_vertex> 3198#include <clipping_planes_pars_vertex> 3199void main() { 3200 #include <uv_vertex> 3201 #include <color_vertex> 3202 #include <morphinstance_vertex> 3203 #include <morphcolor_vertex> 3204 #include <batching_vertex> 3205 #include <beginnormal_vertex> 3206 #include <morphnormal_vertex> 3207 #include <skinbase_vertex> 3208 #include <skinnormal_vertex> 3209 #include <defaultnormal_vertex> 3210 #include <normal_vertex> 3211 #include <begin_vertex> 3212 #include <morphtarget_vertex> 3213 #include <skinning_vertex> 3214 #include <displacementmap_vertex> 3215 #include <project_vertex> 3216 #include <logdepthbuf_vertex> 3217 #include <clipping_planes_vertex> 3218 #include <fog_vertex> 3219 vViewPosition = - mvPosition.xyz; 3220}`,Sd=`#define MATCAP 3221uniform vec3 diffuse; 3222uniform float opacity; 3223uniform sampler2D matcap; 3224varying vec3 vViewPosition; 3225#include <common> 3226#include <dithering_pars_fragment> 3227#include <color_pars_fragment> 3228#include <uv_pars_fragment> 3229#include <map_pars_fragment> 3230#include <alphamap_pars_fragment> 3231#include <alphatest_pars_fragment> 3232#include <alphahash_pars_fragment> 3233#include <fog_pars_fragment> 3234#include <normal_pars_fragment> 3235#include <bumpmap_pars_fragment> 3236#include <normalmap_pars_fragmen
3236t> 3237#include <logdepthbuf_pars_fragment> 3238#include <clipping_planes_pars_fragment> 3239void main() { 3240 vec4 diffuseColor = vec4( diffuse, opacity ); 3241 #include <clipping_planes_fragment> 3242 #include <logdepthbuf_fragment> 3243 #include <map_fragment> 3244 #include <color_fragment> 3245 #include <alphamap_fragment> 3246 #include <alphatest_fragment> 3247 #include <alphahash_fragment> 3248 #include <normal_fragment_begin> 3249 #include <normal_fragment_maps> 3250 vec3 viewDir = normalize( vViewPosition ); 3251 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3252 vec3 y = cross( viewDir, x ); 3253 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3254 #ifdef USE_MATCAP 3255 vec4 matcapColor = texture2D( matcap, uv ); 3256 #else 3257 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3258 #endif 3259 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3260 #include <opaque_fragment> 3261 #include <tonemapping_fragment> 3262 #include <colorspace_fragment> 3263 #include <fog_fragment> 3264 #include <premultiplied_alpha_fragment> 3265 #include <dithering_fragment> 3266}`,Ed=`#define NORMAL 3267#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3268 varying vec3 vViewPosition; 3269#endif 3270#include <common> 3271#include <batching_pars_vertex> 3272#include <uv_pars_vertex> 3273#include <displacementmap_pars_vertex> 3274#include <normal_pars_vertex> 3275#include <morphtarget_pars_vertex> 3276#include <skinning_pars_vertex> 3277#include <logdepthbuf_pars_vertex> 3278#include <clipping_planes_pars_vertex> 3279void main() { 3280 #include <uv_vertex> 3281 #include <batching_vertex> 3282 #include <beginnormal_vertex> 3283 #include <morphinstance_vertex> 3284 #include <morphnormal_vertex> 3285 #include <skinbase_vertex> 3286 #include <skinnormal_vertex> 3287 #include <defaultnormal_vertex> 3288 #include <normal_vertex> 3289 #include <begin_vertex> 3290 #include <morphtarget_vertex> 3291 #include <skinning_vertex> 3292 #include <displacementmap_vertex> 3293 #include <project_vertex> 3294 #include <logdepthbuf_vertex> 3295 #include <clipping_planes_vertex> 3296#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3297 vViewPosition = - mvPosition.xyz; 3298#endif 3299}`,yd=`#define NORMAL 3300uniform float opacity; 3301#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3302 varying vec3 vViewPosition; 3303#endif 3304#include <uv_pars_fragment> 3305#include <normal_pars_fragment> 3306#include <bumpmap_pars_fragment> 3307#include <normalmap_pars_fragment> 3308#include <logdepthbuf_pars_fragment> 3309#include <clipping_planes_pars_fragment> 3310void main() { 3311 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3312 #include <clipping_planes_fragment> 3313 #include <logdepthbuf_fragment> 3314 #include <normal_fragment_begin> 3315 #include <normal_fragment_maps> 3316 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3317 #ifdef OPAQUE 3318 gl_FragColor.a = 1.0; 3319 #endif 3320}`,bd=`#define PHONG 3321varying vec3 vViewPosition; 3322#include <common> 3323#include <batching_pars_vertex> 3324#include <uv_pars_vertex> 3325#include <displacementmap_pars_vertex> 3326#include <envmap_pars_vertex> 3327#include <color_pars_vertex> 3328#include <fog_pars_vertex> 3329#include <normal_pars_vertex> 3330#include <morphtarget_pars_vertex> 3331#include <skinning_pars_vertex> 3332#include <shadowmap_pars_vertex> 3333#include <logdepthbuf_pars_vertex> 3334#include <clipping_planes_pars_vertex> 3335void main() { 3336 #include <uv_vertex> 3337 #include <color_vertex> 3338 #include <morphcolor_vertex> 3339 #include <batching_vertex> 3340 #include <beginnormal_vertex> 3341 #include <morphinstance_vertex> 3342 #include <morphnormal_vertex> 3343 #include <skinbase_vertex> 3344 #include <skinnormal_vertex> 3345 #include <defaultnormal_vertex> 3346 #include <normal_vertex> 3347 #include <begin_vertex> 3348 #include <morphtarget_vertex> 3349 #include <skinning_vertex> 3350 #include <displacementmap_vertex> 3351 #include <project_vertex> 3352 #include <logdepthbuf_vertex> 3353 #include <clipping_planes_vertex> 3354 vViewPosition = - mvPosition.xyz; 3355 #include <worldpos_vertex> 3356 #include <envmap_vertex> 3357 #include <shadowmap_vertex> 3358 #include <fog_vertex> 3359}`,Td=`#define PHONG 3360uniform vec3 diffuse; 3361uniform vec3 emissive; 3362uniform vec3 specular; 3363uniform float shininess; 3364uniform float opacity; 3365#include <common> 3366#include <dithering_pars_fragment> 3367#include <color_pars_fragment> 3368#include <uv_pars_fragment> 3369#include <map_pars_fragment> 3370#include <alphamap_pars_fragment> 3371#include <alphatest_pars_fragment> 3372#include <alphahash_pars_fragment> 3373#include <aomap_pars_fragment> 3374#include <lightmap_pars_fragment> 3375#include <emissivemap_pars_fragment> 3376#include <cube_uv_reflection_fragment> 3377#include <envmap_common_pars_fragment> 3378#include <envmap_pars_fragment> 3379#include <envmap_physical_pars_fragment> 3380#include <fog_pars_fragment> 3381#include <bsdfs> 3382#include <lights_pars_begin> 3383#include <normal_pars_fragment> 3384#include <lights_phong_pars_fragment> 3385#include <shadowmap_pars_fragment> 3386#include <bumpmap_pars_fragment> 3387#include <normalmap_pars_fragment> 3388#include <specularmap_pars_fragment> 3389#include <logdepthbuf_pars_fragment> 3390#include <clipping_planes_pars_fragment> 3391void main() { 3392 vec4 diffuseColor = vec4( diffuse, opacity ); 3393 #include <clipping_planes_fragment> 3394 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3395 vec3 totalEmissiveRadiance = emissive; 3396 #include <logdepthbuf_fragment> 3397 #include <map_fragment> 3398 #include <color_fragment> 3399 #include <alphamap_fragment> 3400 #include <alphatest_fragment> 3401 #include <alphahash_fragment> 3402 #include <specularmap_fragment> 3403 #include <normal_fragment_begin> 3404 #include <normal_fragment_maps> 3405 #include <emissivemap_fragment> 3406 #include <lights_phong_fragment> 3407 #include <lights_fragment_begin> 3408 #include <lights_fragment_maps> 3409 #include <lights_fragment_end> 3410 #include <aomap_fragment> 3411 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3412 #include <envmap_fragment> 3413 #include <opaque_fragment> 3414 #include <tonemapping_fragment> 3415 #include <colorspace_fragment> 3416 #include <fog_fragment> 3417 #include <premultiplied_alpha_fragment> 3418 #include <dithering_fragment> 3419}`,Ad=`#define STANDARD 3420varying vec3 vViewPosition; 3421#ifdef USE_TRANSMISSION 3422 varying vec3 vWorldPosition; 3423#endif 3424#include <common> 3425#include <batching_pars_vertex> 3426#include <uv_pars_vertex> 3427#include <displacementmap_pars_vertex> 3428#include <color_pars_vertex> 3429#include <fog_pars_vertex> 3430#include <normal_pars_vertex> 3431#include <morphtarget_pars_vertex> 3432#include <skinning_pars_vertex> 3433#include <shadowmap_pars_vertex> 3434#include <logdepthbuf_pars_vertex> 3435#include <clipping_planes_pars_vertex> 3436void main() { 3437 #include <uv_vertex> 3438 #include <color_vertex> 3439 #include <morphinstance_vertex> 3440 #include <morphcolor_vertex> 3441 #include <batching_vertex> 3442 #include <beginnormal_vertex> 3443 #include <morphnormal_vertex> 3444 #include <skinbase_vertex> 3445 #include <skinnormal_vertex> 3446 #include <defaultnormal_vertex> 3447 #include <normal_vertex> 3448 #include <begin_vertex> 3449 #include <morphtarget_vertex> 3450 #include <skinning_vertex> 3451 #include <displacementmap_vertex> 3452 #include <project_vertex> 3453 #include <logdepthbuf_vertex> 3454 #include <clipping_planes_vertex> 3455 vViewPosition = - mvPosition.xyz; 3456 #include <worldpos_vertex> 3457 #include <shadowmap_vertex> 3458 #include <fog_vertex> 3459#ifdef USE_TRANSMISSION 3460 vWorldPosition = worldPosition.xyz; 3461#endif 3462}`,wd=`#define STANDARD 3463#ifdef PHYSICAL 3464 #define IOR 3465 #define USE_SPECULAR 3466#endif 3467uniform vec3 diffuse; 3468uniform vec3 emissive; 3469uniform float roughness; 3470uniform float metalness; 3471uniform float opacity; 3472#ifdef IOR 3473 uniform float ior; 3474#endif 3475#ifdef USE_SPECULAR 3476 uniform float specularIntensity; 3477 uniform vec3 specularColor; 3478 #ifdef USE_SPECULAR_COLORMAP 3479 uniform sampler2D specularColorMap; 3480 #endif 3481 #ifdef USE_SPECULAR_INTENSITYMAP 3482 uniform sampler2D specularIntensityMap; 3483 #endif 3484#endif 3485#ifdef USE_CLEARCOAT 3486 uniform float clearcoat; 3487 uniform float clearcoatRoughness; 3488#endif 3489#ifdef USE_DISPERSION 3490 uniform float dispersion; 3491#endif 3492#ifdef USE_RETROREFLECTION 3493 uniform float retroreflectivity; 3494#endif
3495#ifdef USE_IRIDESCENCE 3496 uniform float iridescence; 3497 uniform float iridescenceIOR; 3498 uniform float iridescenceThicknessMinimum; 3499 uniform float iridescenceThicknessMaximum; 3500#endif 3501#ifdef USE_SHEEN 3502 uniform vec3 sheenColor; 3503 uniform float sheenRoughness; 3504 #ifdef USE_SHEEN_COLORMAP 3505 uniform sampler2D sheenColorMap; 3506 #endif 3507 #ifdef USE_SHEEN_ROUGHNESSMAP 3508 uniform sampler2D sheenRoughnessMap; 3509 #endif 3510#endif 3511#ifdef USE_ANISOTROPY 3512 uniform vec2 anisotropyVector; 3513 #ifdef USE_ANISOTROPYMAP 3514 uniform sampler2D anisotropyMap; 3515 #endif 3516#endif 3517varying vec3 vViewPosition; 3518#include <common> 3519#include <dithering_pars_fragment> 3520#include <color_pars_fragment> 3521#include <uv_pars_fragment> 3522#include <map_pars_fragment> 3523#include <alphamap_pars_fragment> 3524#include <alphatest_pars_fragment> 3525#include <alphahash_pars_fragment> 3526#include <aomap_pars_fragment> 3527#include <lightmap_pars_fragment> 3528#include <emissivemap_pars_fragment> 3529#include <iridescence_fragment> 3530#include <cube_uv_reflection_fragment> 3531#include <envmap_common_pars_fragment> 3532#include <envmap_physical_pars_fragment> 3533#include <fog_pars_fragment> 3534#include <lights_pars_begin> 3535#include <normal_pars_fragment> 3536#include <lights_physical_pars_fragment> 3537#include <transmission_pars_fragment> 3538#include <shadowmap_pars_fragment> 3539#include <bumpmap_pars_fragment> 3540#include <normalmap_pars_fragment> 3541#include <clearcoat_pars_fragment> 3542#include <iridescence_pars_fragment> 3543#include <roughnessmap_pars_fragment> 3544#include <metalnessmap_pars_fragment> 3545#include <logdepthbuf_pars_fragment> 3546#include <clipping_planes_pars_fragment> 3547void main() { 3548 vec4 diffuseColor = vec4( diffuse, opacity ); 3549 #include <clipping_planes_fragment> 3550 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3551 vec3 totalEmissiveRadiance = emissive; 3552 #include <logdepthbuf_fragment> 3553 #include <map_fragment> 3554 #include <color_fragment> 3555 #include <alphamap_fragment> 3556 #include <alphatest_fragment> 3557 #include <alphahash_fragment> 3558 #include <roughnessmap_fragment> 3559 #include <metalnessmap_fragment> 3560 #include <normal_fragment_begin> 3561 #include <normal_fragment_maps> 3562 #include <clearcoat_normal_fragment_begin> 3563 #include <clearcoat_normal_fragment_maps> 3564 #include <emissivemap_fragment> 3565 #include <lights_physical_fragment> 3566 #include <lights_fragment_begin> 3567 #include <lights_fragment_maps> 3568 #include <lights_fragment_end> 3569 #include <aomap_fragment> 3570 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3571 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3572 #include <transmission_fragment> 3573 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3574 #ifdef USE_SHEEN 3575 3576 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3577 3578 #endif 3579 #ifdef USE_CLEARCOAT 3580 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3581 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3582 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3583 #endif 3584 #include <opaque_fragment> 3585 #include <tonemapping_fragment> 3586 #include <colorspace_fragment> 3587 #include <fog_fragment> 3588 #include <premultiplied_alpha_fragment> 3589 #include <dithering_fragment> 3590}`,Rd=`#define TOON 3591varying vec3 vViewPosition; 3592#include <common> 3593#include <batching_pars_vertex> 3594#include <uv_pars_vertex> 3595#include <displacementmap_pars_vertex> 3596#include <color_pars_vertex> 3597#include <fog_pars_vertex> 3598#include <normal_pars_vertex> 3599#include <morphtarget_pars_vertex> 3600#include <skinning_pars_vertex> 3601#include <shadowmap_pars_vertex> 3602#include <logdepthbuf_pars_vertex> 3603#include <clipping_planes_pars_vertex> 3604void main() { 3605 #include <uv_vertex> 3606 #include <color_vertex> 3607 #include <morphinstance_vertex> 3608 #include <morphcolor_vertex> 3609 #include <batching_vertex> 3610 #include <beginnormal_vertex> 3611 #include <morphnormal_vertex> 3612 #include <skinbase_vertex> 3613 #include <skinnormal_vertex> 3614 #include <defaultnormal_vertex> 3615 #include <normal_vertex> 3616 #include <begin_vertex> 3617 #include <morphtarget_vertex> 3618 #include <skinning_vertex> 3619 #include <displacementmap_vertex> 3620 #include <project_vertex> 3621 #include <logdepthbuf_vertex> 3622 #include <clipping_planes_vertex> 3623 vViewPosition = - mvPosition.xyz; 3624 #include <worldpos_vertex> 3625 #include <shadowmap_vertex> 3626 #include <fog_vertex> 3627}`,Cd=`#define TOON 3628uniform vec3 diffuse; 3629uniform vec3 emissive; 3630uniform float opacity; 3631#include <common> 3632#include <dithering_pars_fragment> 3633#include <color_pars_fragment> 3634#include <uv_pars_fragment> 3635#include <map_pars_fragment> 3636#include <alphamap_pars_fragment> 3637#include <alphatest_pars_fragment> 3638#include <alphahash_pars_fragment> 3639#include <aomap_pars_fragment> 3640#include <lightmap_pars_fragment> 3641#include <emissivemap_pars_fragment> 3642#include <gradientmap_pars_fragment> 3643#include <fog_pars_fragment> 3644#include <bsdfs> 3645#include <lights_pars_begin> 3646#include <normal_pars_fragment> 3647#include <lights_toon_pars_fragment> 3648#include <shadowmap_pars_fragment> 3649#include <bumpmap_pars_fragment> 3650#include <normalmap_pars_fragment> 3651#include <logdepthbuf_pars_fragment> 3652#include <clipping_planes_pars_fragment> 3653void main() { 3654 vec4 diffuseColor = vec4( diffuse, opacity ); 3655 #include <clipping_planes_fragment> 3656 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3657 vec3 totalEmissiveRadiance = emissive; 3658 #include <logdepthbuf_fragment> 3659 #include <map_fragment> 3660 #include <color_fragment> 3661 #include <alphamap_fragment> 3662 #include <alphatest_fragment> 3663 #include <alphahash_fragment> 3664 #include <normal_fragment_begin> 3665 #include <normal_fragment_maps> 3666 #include <emissivemap_fragment> 3667 #include <lights_toon_fragment> 3668 #include <lights_fragment_begin> 3669 #include <lights_fragment_maps> 3670 #include <lights_fragment_end> 3671 #include <aomap_fragment> 3672 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3673 #include <opaque_fragment> 3674 #include <tonemapping_fragment> 3675 #include <colorspace_fragment> 3676 #include <fog_fragment> 3677 #include <premultiplied_alpha_fragment> 3678 #include <dithering_fragment> 3679}`,Pd=`uniform float size; 3680uniform float scale; 3681#include <common> 3682#include <color_pars_vertex> 3683#include <fog_pars_vertex> 3684#include <morphtarget_pars_vertex> 3685#include <logdepthbuf_pars_vertex> 3686#include <clipping_planes_pars_vertex> 3687#ifdef USE_POINTS_UV 3688 varying vec2 vUv; 3689 uniform mat3 uvTransform; 3690#endif 3691void main() { 3692 #ifdef USE_POINTS_UV 3693 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3694 #endif 3695 #include <color_vertex> 3696 #include <morphinstance_vertex> 3697 #include <morphcolor_vertex> 3698 #include <begin_vertex> 3699 #include <morphtarget_vertex> 3700 #include <project_vertex> 3701 gl_PointSize = size; 3702 #ifdef USE_SIZEATTENUATION 3703 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3704 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3705 #endif 3706 #include <logdepthbuf_vertex> 3707 #include <clipping_planes_vertex> 3708 #include <worldpos_vertex> 3709 #include <fog_vertex> 3710}`,Ld=`uniform vec3 diffuse; 3711uniform float opacity; 3712#include <common> 3713#include <color_pars_fragment> 3714#include <map_particle_pars_fragment> 3715#include <alphatest_pars_fragment> 3716#include <alphahash_pars_fragment> 3717#include <fog_pars_fragment> 3718#include <logdepthbuf_pars_fragment> 3719#include <clipping_planes_pars_fragment> 3720void main() { 3721 vec4 diffuseColor = vec4( diffuse, opacity ); 3722 #include <clipping_planes_fragment> 3723 vec3 outgoingLight = vec3( 0.0 ); 3724 #include <logdepthbuf_fragment> 3725 #include <map_particle_fragment> 3726 #include <color_fragment> 3727 #include <alphatest_fragment> 3728 #include <alphahash_fragment> 3729 outgoingLight = diffuseColor.rgb; 3730 #include <opaque_fragment> 3731 #include <tonemapping_fragment> 3732 #include <colorspace_fragment> 3733 #include <fog_fragment> 3734 #include <premultiplied_alpha_fragment> 3735}`,Dd=`#include <common> 3736#include <batching_pars_vertex> 3737#include <fog_pars_vertex> 3738#include <morphtarget_pars_vertex> 3739#include <skinning_pars_vertex> 3740#include <logdepthbuf_pars_vertex> 3741#include <shadowmap_pars_vertex> 3742void main() { 3743 #include <batching_vertex> 3744 #include <beginnormal_vertex> 3745 #include <morphinstance_vertex> 3746 #include <morphnormal_vertex> 3747 #include <skinbase_vertex> 3748 #include <skinnormal_vertex> 3749 #include <defaultnormal_vertex> 3750 #include <begin_vertex> 3751 #include <morphtarget_vertex> 3752 #include <skinning_vertex> 3753 #include <project_vertex> 3754 #include <logdepthbuf_vertex> 3755 #include <worldpos_vertex> 3756 #include <shadowmap_vertex> 3757 #include <fog_vertex> 3758}`,Id=`uniform vec3 color; 3759uniform float opacity; 3760#include <common> 3761#include <fog_pars_fragment> 3762#include <bsdfs> 3763#include <lights_pars_begin> 3764#include <logdepthbuf_pars_fragment> 3765#include <shadowmap_pars_fragment> 3766#include <shadowmask_pars_fragment> 3767void main() { 3768 #include <logdepthbuf_fragment> 3769 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3770 #include <tonemapping_fragment> 3771 #include <colorspace_fragment> 3772 #include <fog_fragment> 3773 #include <premultiplied_alpha_fragment> 3774}`,Ud=`uniform float rotation; 3775uniform vec2 center; 3776#include <common> 3777#include <uv_pars_vertex> 3778#include <fog_pars_vertex> 3779#include <logdepthbuf_pars_vertex> 3780#include <clipping_planes_pars_vertex> 3781void main() { 3782 #include <uv_vertex> 3783 vec4 mvPosition = modelViewMatrix[ 3 ]; 3784 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3785 #ifndef USE_SIZEATTENUATION 3786 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3787 if ( isPerspective ) scale *= - mvPosition.z; 3788 #endif 3789 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3790 vec2 rotatedPosition; 3791 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3792 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3793 mvPosition.xy += rotatedPosition; 3794 gl_Position = projectionMatrix * mvPosition; 3795 #include <logdepthbuf_vertex> 3796 #include <clipping_planes_vertex> 3797 #include <fog_vertex> 3798}`,Nd=`uniform vec3 diffuse; 3799uniform float opacity; 3800#include <common> 3801#include <uv_pars_fragment> 3802#include <map_pars_fragment> 3803#include <alphamap_pars_fragment> 3804#include <alphatest_pars_fragment> 3805#include <alphahash_pars_fragment> 3806#include <fog_pars_fragment> 3807#include <logdepthbuf_pars_fragment> 3808#include <clipping_planes_pars_fragment> 3809void main() { 3810 vec4 diffuseColor = vec4( diffuse, opacity ); 3811 #include <clipping_planes_fragment> 3812 vec3 outgoingLight = vec3( 0.0 ); 3813 #include <logdepthbuf_fragment> 3814 #include <map_fragment> 3815 #include <alphamap_fragment> 3816 #include <alphatest_fragment> 3817 #include <alphahash_fragment> 3818 outgoingLight = diffuseColor.rgb; 3819 #include <opaque_fragment> 3820 #include <tonemapping_fragment> 3821 #include <colorspace_fragment> 3822 #include <fog_fragment> 3823}`,Qe={alphahash_fragment:tf,alphahash_pars_fragment:nf,alphamap_fragment:rf,alphamap_pars_fragment:sf,alphatest_fragment:af,alphatest_pars_fragment:of,aomap_fragment:lf,aomap_pars_fragment:cf,batching_pars_vertex:uf,batching_vertex:ff,begin_vertex:hf,beginnormal_vertex:df,bsdfs:pf,iridescence_fragment:mf,bumpmap_pars_fragment:gf,clipping_planes_fragment:_f,clipping_planes_pars_fragment:xf,clipping_planes_pars_vertex:vf,clipping_planes_vertex:Mf,color_fragment:Sf,color_pars_fragment:Ef,color_pars_vertex:yf,color_vertex:bf,common:Tf,cube_uv_reflection_fragment:Af,defaultnormal_vertex:wf,displacementmap_pars_vertex:Rf,displacementmap_vertex:Cf,emissivemap_fragment:Pf,emissivemap_pars_fragment:Lf,colorspace_fragment:Df,colorspace_pars_fragment:If,envmap_fragment:Uf,envmap_common_pars_fragment:Nf,envmap_pars_fragment:Ff,envmap_pars_vertex:Of,envmap_physical_pars_fragment:Zf,envmap_vertex:Bf,fog_vertex:zf,fog_pars_vertex:Gf,fog_fragment:Hf,fog_pars_fragment:Vf,gradientmap_pars_fragment:kf,lightmap_pars_fragment:Wf,lights_lambert_fragment:Xf,lights_lambert_pars_fragment:qf,lights_pars_begin:Yf,lights_toon_fragment:Kf,lights_toon_pars_fragment:$f,lights_phong_fragment:Jf,lights_phong_pars_fragment:Qf,lights_physical_fragment:jf,lights_physical_pars_fragment:eh,lights_fragment_begin:th,lights_fragment_maps:nh,lights_fragment_end:ih,lightprobes_pars_fragment:rh,logdepthbuf_fragment:sh,logdepthbuf_pars_fragment:ah,logdepthbuf_pars_vertex:oh,logdepthbuf_vertex:lh,map_fragment:ch,map_pars_fragment:uh,map_particle_fragment:fh,map_particle_pars_fragment:hh,metalnessmap_fragment:dh,metalnessmap_pars_fragment:ph,morphinstance_vertex:mh,morphcolor_vertex:gh,morphnormal_vertex:_h,morphtarget_pars_vertex:xh,morphtarget_vertex:vh,normal_fragment_begin:Mh,normal_fragment_maps:Sh,normal_pars_fragment:Eh,normal_pars_vertex:yh,normal_vertex:bh,normalmap_pars_fragment:Th,clearcoat_normal_fragment_begin:Ah,clearcoat_normal_fragment_maps:wh,clearcoat_pars_fragment:Rh,iridescence_pars_fragment:Ch,opaque_fragment:Ph,packing:Lh,premultiplied_alpha_fragment:Dh,project_vertex:Ih,dithering_fragment:Uh,dithering_pars_fragment:Nh,roughnessmap_fragment:Fh,roughnessmap_pars_fragment:Oh,shadowmap_pars_fragment:Bh,shadowmap_pars_vertex:zh,shadowmap_vertex:Gh,shadowmask_pars_fragment:Hh,skinbase_vertex:Vh,skinning_pars_vertex:kh,skinning_vertex:Wh,skinnormal_vertex:Xh,specularmap_fragment:qh,specularmap_pars_fragment:Yh,tonemapping_fragment:Zh,tonemapping_pars_fragment:Kh,transmission_fragment:$h,transmission_pars_fragment:Jh,uv_pars_fragment:Qh,uv_pars_vertex:jh,uv_vertex:ed,worldpos_vertex:td,background_vert:nd,background_frag:id,backgroundCube_vert:rd,backgroundCube_frag:sd,cube_vert:ad,cube_frag:od,depth_vert:ld,depth_frag:cd,distance_vert:ud,distance_frag:fd,equirect_vert:hd,equirect_frag:dd,linedashed_vert:pd,linedashed_frag:md,meshbasic_vert:gd,meshbasic_frag:_d,meshlambert_vert:xd,meshlambert_frag:vd,meshmatcap_vert:Md,meshmatcap_frag:Sd,meshnormal_vert:Ed,meshnormal_frag:yd,meshphong_vert:bd,meshphong_frag:Td,meshphysical_vert:Ad,meshphysical_frag:wd,meshtoon_vert:Rd,meshtoon_frag:Cd,points_vert:Pd,points_frag:Ld,shadow_vert:Dd,shadow_frag:Id,sprite_vert:Ud,sprite_frag:Nd},ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},envmap:{envMap:{value:null},envMapRotation:{value:new Ye},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new $e(1,1)}}
vendor: 7,106 bytes, line 3823
3823,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new F},probesMax:{value:new F},probesResolution:{value:new F}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0},uvTransform:{value:new Ye}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new $e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}}},gn={basic:{uniforms:kt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:kt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:kt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:kt([ge.common,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.roughnessmap,ge.metalnessmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:kt([ge.common,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.gradientmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:kt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:kt([ge.points,ge.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:kt([ge.common,ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:kt([ge.common,ge.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:kt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:kt([ge.sprite,ge.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ye}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distance:{uniforms:kt([ge.common,ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distance_vert,fragmentShader:Qe.distance_frag},shadow:{uniforms:kt([ge.lights,ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};gn.physical={uniforms:kt([gn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new $e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new $e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye},anisotropyVector:{value:new $e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ye}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};const Yr={r:0,b:0,g:0},Fd=new Et,sc=new Ye;sc.set(-1,0,0,0,1,0,0,0,1);
vendor: 14,587 bytes, line 3823
3823function Od(i,e,t,n,r,s){const a=new Xe(0);let o=r===!0?0:1,c,l,d=null,g=0,u=null;function h(E){let w=E.isScene===!0?E.background:null;if(w&&w.isTexture){const M=E.backgroundBlurriness>0;w=e.get(w,M)}return w}function x(E){let w=!1;const M=h(E);M===null?m(a,o):M&&M.isColor&&(m(M,1),w=!0);const A=i.xr.getEnvironmentBlendMode();A==="additive"?t.buffers.color.setClear(0,0,0,1,s):A==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(E,w){const M=h(w);M&&(M.isCubeTexture||M.mapping===ms)?(l===void 0&&(l=new Wt(new dr(1,1,1),new rn({name:"BackgroundCubeMaterial",uniforms:Bi(gn.backgroundCube.uniforms),vertexShader:gn.backgroundCube.vertexShader,fragmentShader:gn.backgroundCube.fragmentShader,side:qt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(A,y,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Fd.makeRotationFromEuler(w.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(sc),l.material.toneMapped=st.getTransfer(M.colorSpace)!==dt,(d!==M||g!==M.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,d=M,g=M.version,u=i.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new Wt(new gs(2,2),new rn({name:"BackgroundMaterial",uniforms:Bi(gn.background.uniforms),vertexShader:gn.background.vertexShader,fragmentShader:gn.background.fragmentShader,side:ni,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=st.getTransfer(M.colorSpace)!==dt,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||g!==M.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,d=M,g=M.version,u=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function m(E,w){E.getRGB(Yr,tc(i)),t.buffers.color.setClear(Yr.r,Yr.g,Yr.b,w,s)}function f(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(E,w=1){a.set(E),o=w,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(E){o=E,m(a,o)},render:x,addToRenderList:S,dispose:f}}function Bd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(I,O,H,U,V){let q=!1;const K=g(I,U,H,O);s!==K&&(s=K,l(s.object)),q=h(I,U,H,V),q&&x(I,U,H,V),V!==null&&e.update(V,i.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,M(I,O,H,U),V!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function c(){return i.createVertexArray()}function l(I){return i.bindVertexArray(I)}function d(I){return i.deleteVertexArray(I)}function g(I,O,H,U){const V=U.wireframe===!0;let q=n[O.id];q===void 0&&(q={},n[O.id]=q);const K=I.isInstancedMesh===!0?I.id:0;let ee=q[K];ee===void 0&&(ee={},q[K]=ee);let Y=ee[H.id];Y===void 0&&(Y={},ee[H.id]=Y);let $=Y[V];return $===void 0&&($=u(c()),Y[V]=$),$}function u(I){const O=[],H=[],U=[];for(let V=0;V<t;V++)O[V]=0,H[V]=0,U[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:H,attributeDivisors:U,object:I,attributes:{},index:null}}function h(I,O,H,U){const V=s.attributes,q=O.attributes;let K=0;const ee=H.getAttributes();for(const Y in ee)if(ee[Y].location>=0){const te=V[Y];let we=q[Y];if(we===void 0&&(Y==="instanceMatrix"&&I.instanceMatrix&&(we=I.instanceMatrix),Y==="instanceColor"&&I.instanceColor&&(we=I.instanceColor)),te===void 0||te.attribute!==we||we&&te.data!==we.data)return!0;K++}return s.attributesNum!==K||s.index!==U}function x(I,O,H,U){const V={},q=O.attributes;let K=0;const ee=H.getAttributes();for(const Y in ee)if(ee[Y].location>=0){let te=q[Y];te===void 0&&(Y==="instanceMatrix"&&I.instanceMatrix&&(te=I.instanceMatrix),Y==="instanceColor"&&I.instanceColor&&(te=I.instanceColor));const we={};we.attribute=te,te&&te.data&&(we.data=te.data),V[Y]=we,K++}s.attributes=V,s.attributesNum=K,s.index=U}function S(){const I=s.newAttributes;for(let O=0,H=I.length;O<H;O++)I[O]=0}function m(I){f(I,0)}function f(I,O){const H=s.newAttributes,U=s.enabledAttributes,V=s.attributeDivisors;H[I]=1,U[I]===0&&(i.enableVertexAttribArray(I),U[I]=1),V[I]!==O&&(i.vertexAttribDivisor(I,O),V[I]=O)}function E(){const I=s.newAttributes,O=s.enabledAttributes;for(let H=0,U=O.length;H<U;H++)O[H]!==I[H]&&(i.disableVertexAttribArray(H),O[H]=0)}function w(I,O,H,U,V,q,K){K===!0?i.vertexAttribIPointer(I,O,H,V,q):i.vertexAttribPointer(I,O,H,U,V,q)}function M(I,O,H,U){S();const V=U.attributes,q=H.getAttributes(),K=O.defaultAttributeValues;for(const ee in q){const Y=q[ee];if(Y.location>=0){let $=V[ee];if($===void 0&&(ee==="instanceMatrix"&&I.instanceMatrix&&($=I.instanceMatrix),ee==="instanceColor"&&I.instanceColor&&($=I.instanceColor)),$!==void 0){const te=$.normalized,we=$.itemSize,De=e.get($);if(De===void 0)continue;const nt=De.buffer,Ke=De.type,He=De.bytesPerElement,Z=Ke===i.INT||Ke===i.UNSIGNED_INT||$.gpuType===qa;if($.isInterleavedBufferAttribute){const j=$.data,Se=j.stride,Ge=$.offset;if(j.isInstancedInterleavedBuffer){for(let fe=0;fe<Y.locationSize;fe++)f(Y.location+fe,j.meshPerAttribute);I.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let fe=0;fe<Y.locationSize;fe++)m(Y.location+fe);i.bindBuffer(i.ARRAY_BUFFER,nt);for(let fe=0;fe<Y.locationSize;fe++)w(Y.location+fe,we/Y.locationSize,Ke,te,Se*He,(Ge+we/Y.locationSize*fe)*He,Z)}else{if($.isInstancedBufferAttribute){for(let j=0;j<Y.locationSize;j++)f(Y.location+j,$.meshPerAttribute);I.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let j=0;j<Y.locationSize;j++)m(Y.location+j);i.bindBuffer(i.ARRAY_BUFFER,nt);for(let j=0;j<Y.locationSize;j++)w(Y.location+j,we/Y.locationSize,Ke,te,we*He,we/Y.locationSize*j*He,Z)}}else if(K!==void 0){const te=K[ee];if(te!==void 0)switch(te.length){case 2:i.vertexAttrib2fv(Y.location,te);break;case 3:i.vertexAttrib3fv(Y.location,te);break;case 4:i.vertexAttrib4fv(Y.location,te);break;default:i.vertexAttrib1fv(Y.location,te)}}}}E()}function A(){b();for(const I in n){const O=n[I];for(const H in O){const U=O[H];for(const V in U){const q=U[V];for(const K in q)d(q[K].object),delete q[K];delete U[V]}}delete n[I]}}function y(I){if(n[I.id]===void 0)return;const O=n[I.id];for(const H in O){const U=O[H];for(const V in U){const q=U[V];for(const K in q)d(q[K].object),delete q[K];delete U[V]}}delete n[I.id]}function R(I){for(const O in n){const H=n[O];for(const U in H){const V=H[U];if(V[I.id]===void 0)continue;const q=V[I.id];for(const K in q)d(q[K].object),delete q[K];delete V[I.id]}}}function _(I){for(const O in n){const H=n[O],U=I.isInstancedMesh===!0?I.id:0,V=H[U];if(V!==void 0){for(const q in V){const K=V[q];for(const ee in K)d(K[ee].object),delete K[ee];delete V[q]}delete H[U],Object.keys(H).length===0&&delete n[O]}}}function b(){P(),a=!0,s!==r&&(s=r,l(s.object))}function P(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:b,resetDefaultState:P,dispose:A,releaseStatesOfGeometry:y,releaseStatesOfObject:_,releaseStatesOfProgram:R,initAttributes:S,enableAttribute:m,disableUnusedAttributes:E}}function zd(i,e,t){let n;function r(c){n=c}function s(c,l){i.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,d){d!==0&&(i.drawArraysInstanced(n,c,l,d),t.update(l,n,d))}function o(c,l,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,d);let u=0;for(let h=0;h<d;h++)u+=l[h];t.update(u,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Gd(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(R){return!(R!==un&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const _=R===En&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==nn&&R!==xn&&!_&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE))}function c(R){if(R==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const d=c(l);d!==l&&(We("WebGLRenderer:",l,"not supported, using",d,"instead."),l=d);const g=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&We("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const h=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),A=i.getParameter(i.MAX_SAMPLES),y=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:g,reversedDepthBuffer:u,maxTextures:h,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:E,maxVaryings:w,maxFragmentUniforms:M,maxSamples:A,samples:y}}function Hd(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new kn,o=new Ye,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(g,u){const h=g.length!==0||u||n!==0||r;return r=u,n=g.length,h},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(g,u){t=d(g,u,0)},this.setState=function(g,u,h){const x=g.clippingPlanes,S=g.clipIntersection,m=g.clipShadows,f=i.get(g);if(!r||x===null||x.length===0||s&&!m)s?d(null):l();else{const E=s?0:n,w=E*4;let M=f.clippingState||null;c.value=M,M=d(x,u,w,h);for(let A=0;A!==w;++A)M[A]=t[A];f.clippingState=M,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(g,u,h,x){const S=g!==null?g.length:0;let m=null;if(S!==0){if(m=c.value,x!==!0||m===null){const f=h+S*4,E=u.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<f)&&(m=new Float32Array(f));for(let w=0,M=h;w!==S;++w,M+=4)a.copy(g[w]).applyMatrix4(E,o),a.normal.toArray(m,M),m[M+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,m}}const Ii=4,Vd=6,kd=20,Wd=256,ji=new ic,Ko=new Xe;let Ys=null,Zs=0,Ks=0,$s=!1;const Xd=new F,Qn=new F;class $o{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=Xd}=s;Ys=this._renderer.getRenderTarget(),Zs=this._renderer.getActiveCubeFace(),Ks=this._renderer.getActiveMipmapLevel(),$s=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=jo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Qo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(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(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ys,Zs,Ks),this._renderer.xr.enabled=$s,e.scissorTest=!1,Ci(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ii||e.mapping===Oi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ys=this._renderer.getRenderTarget(),Zs=this._renderer.getActiveCubeFace(),Ks=this._renderer.getActiveMipmapLevel(),$s=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:Bt,minFilter:Bt,generateMipmaps:!1,type:En,format:un,colorSpace:ss,depthBuffer:!1},r=Jo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Jo(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=qd(s)),this._blurMaterial=Zd(s,e,t),this._ggxMaterial=Yd(s,e,t)}return r}_compileMaterial(e){const t=new Wt(new wt,e);this._renderer.compile(t,ji)}
3823_sceneToCubeUV(e,t,n,r,s){const c=new tn(90,1,t,n),l=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,u=g.autoClear,h=g.toneMapping;g.getClearColor(Ko),g.toneMapping=Mn,g.autoClear=!1,g.state.buffers.depth.getReversed()&&(g.setRenderTarget(r),g.clearDepth(),g.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Wt(new dr,new fs({name:"PMREM.Background",side:qt,depthWrite:!1,depthTest:!1})));const S=this._backgroundBox,m=S.material;let f=!1;const E=e.background;E?E.isColor&&(m.color.copy(E),e.background=null,f=!0):(m.color.copy(Ko),f=!0);for(let w=0;w<6;w++){const M=w%3;M===0?(c.up.set(0,l[w],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+d[w],s.y,s.z)):M===1?(c.up.set(0,0,l[w]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+d[w],s.z)):(c.up.set(0,l[w],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+d[w]));const A=this._cubeSize;Ci(r,M*A,w>2?A:0,A,A),g.setRenderTarget(r),f&&g.render(S,c),g.render(e,c)}g.toneMapping=h,g.autoClear=u,e.background=E}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===ii||e.mapping===Oi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=jo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Qo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;Ci(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,ji)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),g=Math.sqrt(l*l-d*d),u=l*1.25,h=g*u,{_lodMax:x}=this,S=this._sizeLods[n],m=3*S*(n>x-Ii?n-x+Ii:0),f=4*(this._cubeSize-S);c.envMap.value=e.texture,c.roughness.value=h,c.mipInt.value=x-t,Ci(s,m,f,3*S,2*S),r.setRenderTarget(s),r.render(o,ji),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=x-n,Ci(e,m,f,3*S,2*S),r.setRenderTarget(e),r.render(o,ji)}_blur(e,t,n,r){const s=this._pingPongRenderTarget,a=Math.min(r,Math.PI)/Math.SQRT2;this._blurPass(e,s,t,n,a),this._blurPass(s,e,n,n,a)}_blurPass(e,t,n,r,s){const a=this._renderer,o=this._blurMaterial,c=this._lodMeshes[r];c.material=o;const l=o.uniforms;l.envMap.value=e.texture,l.sigma.value=s,l.mipInt.value=this._lodMax-n;const d=this._sizeLods[r],g=3*d*(r>this._lodMax-Ii?r-this._lodMax+Ii:0),u=4*(this._cubeSize-d);Ci(t,g,u,3*d,2*d),a.setRenderTarget(t),a.render(c,ji)}}function qd(i){const e=[],t=[];let n=i;const r=i-Ii+1+Vd;for(let s=0;s<r;s++){const a=Math.pow(2,n);e.push(a);const o=1/(a-2),c=-o,l=1+o,d=[c,c,l,c,l,l,c,c,l,l,c,l],g=6,u=6,h=3,x=new Float32Array(h*u*g),S=new Float32Array(h*u*g);for(let f=0;f<g;f++){const E=f%3*2/3-1,w=f>2?0:-1,M=[E,w,0,E+2/3,w,0,E+2/3,w+1,0,E,w,0,E+2/3,w+1,0,E,w+1,0];x.set(M,h*u*f);for(let A=0;A<u;A++){const y=d[A*2]*2-1,R=d[A*2+1]*2-1;f===0?Qn.set(1,R,y):f===1?Qn.set(-y,1,-R):f===2?Qn.set(-y,R,1):f===3?Qn.set(-1,R,-y):f===4?Qn.set(-y,-1,R):Qn.set(y,R,-1),Qn.toArray(S,(f*u+A)*h)}}const m=new wt;m.setAttribute("position",new gt(x,h)),m.setAttribute("outputDirection",new gt(S,h)),t.push(new Wt(m,null)),n>Ii&&n--}return{lodMeshes:t,sizeLods:e}}function Jo(i,e,t){const n=new fn(i,e,t);return n.texture.mapping=ms,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ci(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Yd(i,e,t){return new rn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Wd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:_s(),fragmentShader:` 3824 3825 precision highp float; 3826 precision highp int; 3827 3828 varying vec3 vOutputDirection; 3829 3830 uniform sampler2D envMap; 3831 uniform float roughness; 3832 uniform float mipInt; 3833 3834 #define ENVMAP_TYPE_CUBE_UV 3835 #include <cube_uv_reflection_fragment> 3836 3837 #define PI 3.14159265359 3838 3839 // Van der Corput radical inverse 3840 float radicalInverse_VdC(uint bits) { 3841 bits = (bits << 16u) | (bits >> 16u); 3842 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3843 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3844 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3845 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3846 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3847 } 3848 3849 // Hammersley sequence 3850 vec2 hammersley(uint i, uint N) { 3851 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3852 } 3853 3854 // GGX VNDF importance sampling (Eric Heitz 2018) 3855 // "Sampling the GGX Distribution of Visible Normals" 3856 // https://jcgt.org/published/0007/04/01/ 3857 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3858 float alpha = roughness * roughness; 3859 3860 // Section 4.1: Orthonormal basis 3861 vec3 T1 = vec3(1.0, 0.0, 0.0); 3862 vec3 T2 = cross(V, T1); 3863 3864 // Section 4.2: Parameterization of projected area 3865 float r = sqrt(Xi.x); 3866 float phi = 2.0 * PI * Xi.y; 3867 float t1 = r * cos(phi); 3868 float t2 = r * sin(phi); 3869 float s = 0.5 * (1.0 + V.z); 3870 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3871 3872 // Section 4.3: Reprojection onto hemisphere 3873 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3874 3875 // Section 3.4: Transform back to ellipsoid configuration 3876 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3877 } 3878 3879 void main() { 3880 vec3 N = normalize(vOutputDirection); 3881 vec3 V = N; // Assume view direction equals normal for pre-filtering 3882 3883 vec3 prefilteredColor = vec3(0.0); 3884 float totalWeight = 0.0; 3885 3886 // For very low roughness, just sample the environment directly 3887 if (roughness < 0.001) { 3888 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3889 return; 3890 } 3891 3892 // Tangent space basis for VNDF sampling 3893 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3894 vec3 tangent = normalize(cross(up, N)); 3895 vec3 bitangent = cross(N, tangent); 3896
3897 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3898 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3899 3900 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3901 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3902 3903 // Transform H back to world space 3904 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3905 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3906 3907 float NdotL = max(dot(N, L), 0.0); 3908 3909 if(NdotL > 0.0) { 3910 // Sample environment at fixed mip level 3911 // VNDF importance sampling handles the distribution filtering 3912 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3913 3914 // Weight by NdotL for the split-sum approximation 3915 // VNDF PDF naturally accounts for the visible microfacet distribution 3916 prefilteredColor += sampleColor * NdotL; 3917 totalWeight += NdotL; 3918 } 3919 } 3920 3921 if (totalWeight > 0.0) { 3922 prefilteredColor = prefilteredColor / totalWeight; 3923 } 3924 3925 gl_FragColor = vec4(prefilteredColor, 1.0); 3926 } 3927 `,blending:Ln,depthTest:!1,depthWrite:!1})}function Zd(i,e,t){return new rn({name:"SphericalGaussianBlur",defines:{SAMPLES:kd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:_s(),fragmentShader:` 3928 3929 precision highp float; 3930 precision highp int; 3931 3932 varying vec3 vOutputDirection; 3933 3934 uniform sampler2D envMap; 3935 uniform float sigma; 3936 uniform float mipInt; 3937 3938 #define ENVMAP_TYPE_CUBE_UV 3939 #include <cube_uv_reflection_fragment> 3940 3941 #define PI 3.14159265359 3942 #define GOLDEN_ANGLE 2.39996322973 3943 3944 void main() { 3945 3946 if ( sigma == 0.0 ) { 3947 3948 gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 ); 3949 return; 3950 3951 } 3952 3953 vec3 outputDirection = normalize( vOutputDirection ); 3954 3955 vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 ); 3956 vec3 tangent = normalize( cross( up, outputDirection ) ); 3957 vec3 bitangent = cross( outputDirection, tangent ); 3958 3959 // Truncate the kernel at three standard deviations or at the antipode. 3960 float thetaMax = min( 3.0 * sigma, PI ); 3961 float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) ); 3962 3963 vec3 accumColor = vec3( 0.0 ); 3964 float accumWeight = 0.0; 3965 3966 for ( int i = 0; i < SAMPLES; i ++ ) { 3967 3968 // Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral. 3969 float stratum = ( float( i ) + 0.5 ) / float( SAMPLES ); 3970 float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) ); 3971 float phi = float( i ) * GOLDEN_ANGLE; 3972 3973 vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent; 3974 vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset; 3975 3976 // Correct the planar sample density to solid angle. 3977 float weight = sin( theta ) / theta; 3978 3979 accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt ); 3980 accumWeight += weight; 3981 3982 } 3983 3984 gl_FragColor = vec4( accumColor / accumWeight, 1.0 ); 3985 3986 } 3987 `,blending:Ln,depthTest:!1,depthWrite:!1})}function Qo(){return new rn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_s(),fragmentShader:` 3988 3989 precision mediump float; 3990 precision mediump int; 3991 3992 varying vec3 vOutputDirection; 3993 3994 uniform sampler2D envMap; 3995 3996 #include <common> 3997 3998 void main() { 3999 4000 vec3 outputDirection = normalize( vOutputDirection ); 4001 vec2 uv = equirectUv( outputDirection ); 4002 4003 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 4004 4005 } 4006 `,blending:Ln,depthTest:!1,depthWrite:!1})}function jo(){return new rn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_s(),fragmentShader:` 4007 4008 precision mediump float; 4009 precision mediump int; 4010 4011 uniform float flipEnvMap; 4012 4013 varying vec3 vOutputDirection; 4014 4015 uniform samplerCube envMap; 4016 4017 void main() { 4018 4019 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 4020 4021 } 4022 `,blending:Ln,depthTest:!1,depthWrite:!1})}function _s(){return` 4023 4024 precision mediump float; 4025 precision mediump int; 4026 4027 attribute vec3 outputDirection; 4028 4029 varying vec3 vOutputDirection; 4030 4031 void main() { 4032 4033 vOutputDirection = outputDirection; 4034 gl_Position = vec4( position, 1.0 ); 4035 4036 } 4037 `}class ac extends fn{constructor(e=1,t={}
vendor: 26,090 bytes, lines 4037-4153
4037){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new jl(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 4038 4039 varying vec3 vWorldDirection; 4040 4041 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 4042 4043 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 4044 4045 } 4046 4047 void main() { 4048 4049 vWorldDirection = transformDirection( position, modelMatrix ); 4050 4051 #include <begin_vertex> 4052 #include <project_vertex> 4053 4054 } 4055 `,fragmentShader:` 4056 4057 uniform sampler2D tEquirect; 4058 4059 varying vec3 vWorldDirection; 4060 4061 #include <common> 4062 4063 void main() { 4064 4065 vec3 direction = normalize( vWorldDirection ); 4066 4067 vec2 sampleUV = equirectUv( direction ); 4068 4069 gl_FragColor = texture2D( tEquirect, sampleUV ); 4070 4071 } 4072 `},r=new dr(5,5,5),s=new rn({name:"CubemapFromEquirect",uniforms:Bi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:qt,blending:Ln});s.uniforms.tEquirect.value=t;const a=new Wt(r,s),o=t.minFilter;return t.minFilter===ei&&(t.minFilter=Bt),new Ju(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function Kd(i){let e=new WeakMap,t=new WeakMap,n=null;function r(u,h=!1){return u==null?null:h?a(u):s(u)}function s(u){if(u&&u.isTexture){const h=u.mapping;if(h===vs||h===Ms)if(e.has(u)){const x=e.get(u).texture;return o(x,u.mapping)}else{const x=u.image;if(x&&x.height>0){const S=new ac(x.height);return S.fromEquirectangularTexture(i,u),e.set(u,S),u.addEventListener("dispose",l),o(S.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const h=u.mapping,x=h===vs||h===Ms,S=h===ii||h===Oi;if(x||S){let m=t.get(u);const f=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new $o(i)),m=x?n.fromEquirectangular(u,m):n.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),m.texture;if(m!==void 0)return m.texture;{const E=u.image;return x&&E&&E.height>0||S&&E&&c(E)?(n===null&&(n=new $o(i)),m=x?n.fromEquirectangular(u):n.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),u.addEventListener("dispose",d),m.texture):null}}}return u}function o(u,h){return h===vs?u.mapping=ii:h===Ms&&(u.mapping=Oi),u}function c(u){let h=0;const x=6;for(let S=0;S<x;S++)u[S]!==void 0&&h++;return h===x}function l(u){const h=u.target;h.removeEventListener("dispose",l);const x=e.get(h);x!==void 0&&(e.delete(h),x.dispose())}function d(u){const h=u.target;h.removeEventListener("dispose",d);const x=t.get(h);x!==void 0&&(t.delete(h),x.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:g}}function $d(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Ui("WebGLRenderer: "+n+" extension not supported."),r}}}function Jd(i,e,t,n){const r={},s=new WeakMap;function a(g){const u=g.target;u.index!==null&&e.remove(u.index);for(const x in u.attributes)e.remove(u.attributes[x]);u.removeEventListener("dispose",a),delete r[u.id];const h=s.get(u);h&&(e.remove(h),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(g,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function c(g){const u=g.attributes;for(const h in u)e.update(u[h],i.ARRAY_BUFFER)}function l(g){const u=[],h=g.index,x=g.attributes.position;let S=0;if(x===void 0)return;if(h!==null){const E=h.array;S=h.version;for(let w=0,M=E.length;w<M;w+=3){const A=E[w+0],y=E[w+1],R=E[w+2];u.push(A,y,y,R,R,A)}}else{const E=x.array;S=x.version;for(let w=0,M=E.length/3-1;w<M;w+=3){const A=w+0,y=w+1,R=w+2;u.push(A,y,y,R,R,A)}}const m=new(x.count>=65535?$l:Kl)(u,1);m.version=S;const f=s.get(g);f&&e.remove(f),s.set(g,m)}function d(g){const u=s.get(g);if(u){const h=g.index;h!==null&&u.version<h.version&&l(g)}else l(g);return s.get(g)}return{get:o,update:c,getWireframeAttribute:d}}function Qd(i,e,t){let n;function r(g){n=g}let s,a;function o(g){s=g.type,a=g.bytesPerElement}function c(g,u){i.drawElements(n,u,s,g*a),t.update(u,n,1)}function l(g,u,h){h!==0&&(i.drawElementsInstanced(n,u,s,g*a,h),t.update(u,n,h))}function d(g,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,u,0,s,g,0,h);let S=0;for(let m=0;m<h;m++)S+=u[m];t.update(S,n,1)}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=d}function jd(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:lt("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function ep(i,e,t){const n=new WeakMap,r=new yt;function s(a,o,c){const l=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,g=d!==void 0?d.length:0;let u=n.get(o);if(u===void 0||u.count!==g){let b=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",b)};u!==void 0&&u.texture.dispose();const h=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,S=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let w=0;h===!0&&(w=1),x===!0&&(w=2),S===!0&&(w=3);let M=o.attributes.position.count*w,A=1;M>e.maxTextureSize&&(A=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const y=new Float32Array(M*A*4*g),R=new ql(y,M,A,g);R.type=xn,R.needsUpdate=!0;const _=w*4;for(let P=0;P<g;P++){const I=m[P],O=f[P],H=E[P],U=M*A*4*P;for(let V=0;V<I.count;V++){const q=V*_;h===!0&&(r.fromBufferAttribute(I,V),y[U+q+0]=r.x,y[U+q+1]=r.y,y[U+q+2]=r.z,y[U+q+3]=0),x===!0&&(r.fromBufferAttribute(O,V),y[U+q+4]=r.x,y[U+q+5]=r.y,y[U+q+6]=r.z,y[U+q+7]=0),S===!0&&(r.fromBufferAttribute(H,V),y[U+q+8]=r.x,y[U+q+9]=r.y,y[U+q+10]=r.z,y[U+q+11]=H.itemSize===4?r.w:1)}}u={count:g,texture:R,size:new $e(M,A)},n.set(o,u),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let h=0;for(let S=0;S<l.length;S++)h+=l[S];const x=o.morphTargetsRelative?1:1-h;c.getUniforms().setValue(i,"morphTargetBaseInfluence",x),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function tp(i,e,t,n,r){let s=new WeakMap;function a(l){const d=r.render.frame,g=l.geometry,u=e.get(l,g);if(s.get(u)!==d&&(e.update(u),s.set(u,d)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),s.get(l)!==d&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),s.set(l,d))),l.isSkinnedMesh){const h=l.skeleton;s.get(h)!==d&&(h.update(),s.set(h,d))}return u}function o(){s=new WeakMap}function c(l){const d=l.target;d.removeEventListener("dispose",c),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const np={[Cl]:"LINEAR_TONE_MAPPING",[Pl]:"REINHARD_TONE_MAPPING",[Ll]:"CINEON_TONE_MAPPING",[Dl]:"ACES_FILMIC_TONE_MAPPING",[Ul]:"AGX_TONE_MAPPING",[Nl]:"NEUTRAL_TONE_MAPPING",[Il]:"CUSTOM_TONE_MAPPING"};function ip(i,e,t,n,r,s){const a=new fn(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1});let o=null,c=null;const l=new wt;l.setAttribute("position",new Dt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Dt([0,2,0,0,2,0],2));const d=new Zu({uniforms:{tDiffuse:{value:null}},vertexShader:` 4073 precision highp float; 4074 4075 uniform mat4 modelViewMatrix; 4076 uniform mat4 projectionMatrix; 4077 4078 attribute vec3 position; 4079 attribute vec2 uv; 4080 4081 varying vec2 vUv; 4082 4083 void main() { 4084 vUv = uv; 4085 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4086 }`,fragmentShader:` 4087 precision highp float; 4088 4089 uniform sampler2D tDiffuse; 4090 4091 varying vec2 vUv; 4092 4093 #include <tonemapping_pars_fragment> 4094 #include <colorspace_pars_fragment> 4095 4096 void main() { 4097 gl_FragColor = texture2D( tDiffuse, vUv ); 4098 4099 #ifdef LINEAR_TONE_MAPPING 4100 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 4101 #elif defined( REINHARD_TONE_MAPPING ) 4102 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 4103 #elif defined( CINEON_TONE_MAPPING ) 4104 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 4105 #elif defined( ACES_FILMIC_TONE_MAPPING ) 4106 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 4107 #elif defined( AGX_TONE_MAPPING ) 4108 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4109 #elif defined( NEUTRAL_TONE_MAPPING ) 4110 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4111 #elif defined( CUSTOM_TONE_MAPPING ) 4112 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4113 #endif 4114 4115 #ifdef SRGB_TRANSFER 4116 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4117 #endif 4118 }`,depthTest:!1,depthWrite:!1}),g=new Wt(l,d),u=new ic(-1,1,1,-1,0,1);let h=null,x=null,S=!1,m,f=null,E=[],w=!1;this.setSize=function(M,A){a.setSize(M,A),o!==null&&o.setSize(M,A),c!==null&&c.setSize(M,A);for(let y=0;y<E.length;y++){const R=E[y];R.setSize&&R.setSize(M,A)}},this.setEffects=function(M){E=M,w=E.length>0&&E[0].isRenderPass===!0;const A=a.width,y=a.height;E.length>0&&o===null&&(o=new fn(A,y,{type:En,depthBuffer:!1,stencilBuffer:!1}),c=new fn(A,y,{type:En,depthBuffer:!1,stencilBuffer:!1}));for(let R=0;R<E.length;R++){const _=E[R];_.setSize&&_.setSize(A,y)}},this.begin=function(M,A){if(S||M.toneMapping===Mn&&E.length===0)return!1;if(f=A,A!==null){const y=A.width,R=A.height;(a.width!==y||a.height!==R)&&this.setSize(y,R)}return w===!1&&M.setRenderTarget(a),m=M.toneMapping,M.toneMapping=Mn,!0},this.hasRenderPass=function(){return w},this.end=function(M,A){M.toneMapping=m,S=!0;let y=a,R=o;for(let _=0;_<E.length;_++){const b=E[_];b.enabled!==!1&&(b.render(M,R,y,A),b.needsSwap!==!1&&(y=R,R=R===o?c:o))}if(h!==M.outputColorSpace||x!==M.toneMapping){h=M.outputColorSpace,x=M.toneMapping,d.defines={},st.getTransfer(h)===dt&&(d.defines.SRGB_TRANSFER="");const _=np[x];_&&(d.defines[_]=""),d.needsUpdate=!0}d.uniforms.tDiffuse.value=y.texture,M.setRenderTarget(f),M.render(g,u),f=null,S=!1},this.isCompositing=function(){return S},this.dispose=function(){a.dispose(),o!==null&&o.dispose(),c!==null&&c.dispose(),l.dispose(),d.dispose()}}const oc=new zt,Va=new ur(1,1),lc=new ql,cc=new Mu,uc=new jl,el=[],tl=[],nl=new Float32Array(16),il=new Float32Array(9),rl=new Float32Array(4);function Hi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=el[r];if(s===void 0&&(s=new Float32Array(r),el[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function Ct(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Pt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function xs(i,e){let t=tl[e];t===void 0&&(t=new Int32Array(e),tl[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function rp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function sp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ct(t,e))return;i.uniform2fv(this.addr,e),Pt(t,e)}}function ap(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ct(t,e))return;i.uniform3fv(this.addr,e),Pt(t,e)}}function op(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ct(t,e))return;i.uniform4fv(this.addr,e),Pt(t,e)}}function lp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Pt(t,e)}else{if(Ct(t,n))return;rl.set(n),i.uniformMatrix2fv(this.addr,!1,rl),Pt(t,n)}}function cp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Pt(t,e)}else{if(Ct(t,n))return;il.set(n),i.uniformMatrix3fv(this.addr,!1,il),Pt(t,n)}}function up(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Pt(t,e)}else{if(Ct(t,n))return;nl.set(n),i.uniformMatrix4fv(this.addr,!1,nl),Pt(t,n)}}function fp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function hp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ct(t,e))return;i.uniform2iv(this.addr,e),Pt(t,e)}}function dp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ct(t,e))return;i.uniform3iv(this.addr,e),Pt(t,e)}}function pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ct(t,e))return;i.uniform4iv(this.addr,e),Pt(t,e)}}function mp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function gp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ct(t,e))return;i.uniform2uiv(this.addr,e),Pt(t,e)}}function _p(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ct(t,e))return;i.uniform3uiv(this.addr,e),Pt(t,e)}}function xp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ct(t,e))return;i.uniform4uiv(this.addr,e),Pt(t,e)}}function vp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(Va.compareFunction=t.isReversedDepthBuffer()?ja:Qa,s=Va):s=oc,t.setTexture2D(e||s,r)}function Mp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||cc,r)}function Sp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||uc,r)}function Ep(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||lc,r)}function yp(i){switch(i){case 5126:return rp;case 35664:return sp;case 35665:return ap;case 35666:return op;case 35674:return lp;case 35675:return cp;case 35676:return up;case 5124:case 35670:return fp;case 35667:case 35671:return hp;case 35668:case 35672:return dp;case 35669:case 35673:return pp;case 5125:return mp;case 36294:return gp;case 36295:return _p;case 36296:return xp;case 35678:case 36198:case 36298:case 36306:case 35682:return vp;case 35679:case 36299:case 36307:return Mp;case 35680:case 36300:case 36308:case 36293:return Sp;case 36289:case 36303:case 36311:case 36292:return Ep}}function bp(i,e){i.uniform1fv(this.addr,e)}function Tp(i,e){const t=Hi(e,this.size,2);i.uniform2fv(this.addr,t)}function Ap(i,e){const t=Hi(e,this.size,3);i.uniform3fv(this.addr,t)}function wp(i,e){const t=Hi(e,this.size,4);i.uniform4fv(this.addr,t)}function Rp(i,e){const t=Hi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Cp(i,e){const t=Hi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Pp(i,e){const t=Hi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Lp(i,e){i.uniform1iv(this.addr,e)}function Dp(i,e){i.uniform2iv(this.addr,e)}function Ip(i,e){i.uniform3iv(this.addr,e)}function Up(i,e){i.uniform4iv(this.addr,e)}function Np(i,e){i.uniform1uiv(this.addr,e)}function Fp(i,e){i.uniform2uiv(this.addr,e)}function Op(i,e){i.uniform3uiv(this.addr,e)}function Bp(i,e){i.uniform4uiv(this.addr,e)}function zp(i,e,t){const n=this.cache,r=e.length,s=xs(t,r);Ct(n,s)||(i.uniform1iv(this.addr,s),Pt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=Va:a=oc;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Gp(i,e,t){const n=this.cache,r=e.length,s=xs(t,r);Ct(n,s)||(i.uniform1iv(this.addr,s),Pt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||cc,s[a])}function Hp(i,e,t){const n=this.cache,r=e.length,s=xs(t,r);Ct(n,s)||(i.uniform1iv(this.addr,s),Pt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||uc,s[a])}function Vp(i,e,t){const n=this.cache,r=e.length,s=xs(t,r);Ct(n,s)||(i.uniform1iv(this.addr,s),Pt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||lc,s[a])}function kp(i){switch(i){case 5126:return bp;case 35664:return Tp;case 35665:return Ap;case 35666:return wp;case 35674:return Rp;case 35675:return Cp;case 35676:return Pp;case 5124:case 35670:return Lp;case 35667:case 35671:return Dp;case 35668:case 35672:return Ip;case 35669:case 35673:return Up;case 5125:return Np;case 36294:return Fp;case 36295:return Op;case 36296:return Bp;case 35678:case 36198:case 36298:case 36306:case 35682:return zp;case 35679:case 36299:case 36307:return Gp;case 35680:case 36300:case 36308:case 36293:return Hp;case 36289:case 36303:case 36311:case 36292:return Vp}}class Wp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=yp(t.type)}}class Xp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=kp(t.type)}}class qp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Js=/(\w+)(\])?(\[|\.)?/g;function sl(i,e){i.seq.push(e),i.map[e.id]=e}function Yp(i,e,t){const n=i.name,r=n.length;for(Js.lastIndex=0;;){const s=Js.exec(n),a=Js.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){sl(t,l===void 0?new Wp(o,i,e):new Xp(o,i,e));break}else{let g=t.map[o];g===void 0&&(g=new qp(o),sl(t,g)),t=g}}}class ts{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);Yp(o,c,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function al(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Zp=37297;let Kp=0;function $p(i,e){const t=i.split(` 4119`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 4120`)}const ol=new Ye;function Jp(i){st._getMatrix(ol,st.workingColorSpace,i);const e=`mat3( ${ol.elements.map(t=>t.toFixed(4))} )`;switch(st.getTransfer(i)){case as:return[e,"LinearTransferOETF"];case dt:return[e,"sRGBTransferOETF"];default:return We("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ll(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 4121 4122`+s+` 4123 4124`+$p(i.getShaderSource(e),o)}else return s}function Qp(i,e){const t=Jp(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 4125`)}const jp={[Cl]:"Linear",[Pl]:"Reinhard",[Ll]:"Cineon",[Dl]:"ACESFilmic",[Ul]:"AgX",[Nl]:"Neutral",[Il]:"Custom"};function em(i,e){const t=jp[e];return t===void 0?(We("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Zr=new F;function tm(){st.getLuminanceCoefficients(Zr);const i=Zr.x.toFixed(4),e=Zr.y.toFixed(4),t=Zr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 4126`)}function nm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(nr).join(` 4127`)}function im(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 4128`)}function rm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function nr(i){return i!==""}function cl(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ul(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const sm=/^[ \t]*#include +<([\w\d./]+)>/gm;function ka(i){return i.replace(sm,om)}const am=new Map;function om(i,e){let t=Qe[e];if(t===void 0){const n=am.get(e);if(n!==void 0)t=Qe[n],We('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return ka(t)}const lm=/#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 fl(i){return i.replace(lm,cm)}function cm(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function hl(i){let e=`precision ${i.precision} float; 4129 precision ${i.precision} int; 4130 precision ${i.precision} sampler2D; 4131 precision ${i.precision} samplerCube; 4132 precision ${i.precision} sampler3D; 4133 precision ${i.precision} sampler2DArray; 4134 precision ${i.precision} sampler2DShadow; 4135 precision ${i.precision} samplerCubeShadow; 4136 precision ${i.precision} sampler2DArrayShadow; 4137 precision ${i.precision} isampler2D; 4138 precision ${i.precision} isampler3D; 4139 precision ${i.precision} isamplerCube; 4140 precision ${i.precision} isampler2DArray; 4141 precision ${i.precision} usampler2D; 4142 precision ${i.precision} usampler3D; 4143 precision ${i.precision} usamplerCube; 4144 precision ${i.precision} usampler2DArray; 4145 `;return i.precision==="highp"?e+=` 4146#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 4147#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 4148#define LOW_PRECISION`),e}const um={[Kr]:"SHADOWMAP_TYPE_PCF",[tr]:"SHADOWMAP_TYPE_VSM"};function fm(i){return um[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const hm={[ii]:"ENVMAP_TYPE_CUBE",[Oi]:"ENVMAP_TYPE_CUBE",[ms]:"ENVMAP_TYPE_CUBE_UV"};function dm(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":hm[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const pm={[Oi]:"ENVMAP_MODE_REFRACTION"};function mm(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":pm[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const gm={[Rl]:"ENVMAP_BLENDING_MULTIPLY",[Oc]:"ENVMAP_BLENDING_MIX",[Bc]:"ENVMAP_BLENDING_ADD"};function _m(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":gm[i.combine]||"ENVMAP_BLENDING_NONE"}function xm(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function vm(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=fm(t),l=dm(t),d=mm(t),g=_m(t),u=xm(t),h=nm(t),x=im(s),S=r.createProgram();let m,f,E=t.glslVersion?"#version "+t.glslVersion+` 4149`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(nr).join(` 4150`),m.length>0&&(m+=` 4151`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(nr).join(` 4152`),f.length>0&&(f+=` 4153`)):(m=[hl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.extensionCl
vendor: 6,617 bytes, lines 4153-4155
4153ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 4154`].filter(nr).join(` 4155`),f=[hl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+d:"",t.envMap?"#define "+g:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IR
4155IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Mn?"#define TONE_MAPPING":"",t.toneMapping!==Mn?Qe.tonemapping_pars_fragment:"",t.toneMapping!==Mn?em("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,Qp("linearToOutputTexel",t.outputColorSpace),tm(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 4156`].filter(nr).join(` 4157`)),a=ka(a),a=cl(a,t),a=ul(a,t),o=ka(o),o=cl(o,t),o=ul(o,t),a=fl(a),o=fl(o),t.isRawShaderMaterial!==!0&&(E=`#version 300 es 4158`,m=[h,"#define attribute in","#define varying out","#define texture2D texture"].join(` 4159`)+` 4160`+m,f=["#define varying in",t.glslVersion===xo?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===xo?"":"#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(` 4161`)+` 4162`+f);const w=E+m+a,M=E+f+o,A=al(r,r.VERTEX_SHADER,w),y=al(r,r.FRAGMENT_SHADER,M);r.attachShader(S,A),r.attachShader(S,y),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S);function R(I){if(i.debug.checkShaderErrors){const O=r.getProgramInfoLog(S)||"",H=r.getShaderInfoLog(A)||"",U=r.getShaderInfoLog(y)||"",V=O.trim(),q=H.trim(),K=U.trim();let ee=!0,Y=!0;if(r.getProgramParameter(S,r.LINK_STATUS)===!1)if(ee=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,S,A,y);else{const $=ll(r,A,"vertex"),te=ll(r,y,"fragment");lt("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,r.VALIDATE_STATUS)+` 4163 4164Material Name: `+I.name+` 4165Material Type: `+I.type+` 4166 4167Program Info Log: `+V+` 4168`+$+` 4169`+te)}else V!==""?We("WebGLProgram: Program Info Log:",V):(q===""||K==="")&&(Y=!1);Y&&(I.diagnostics={runnable:ee,programLog:V,vertexShader:{log:q,prefix:m},fragmentShader:{log:K,prefix:f}})}r.deleteShader(A),r.deleteShader(y),_=new ts(r,S),b=rm(r,S)}let _;this.getUniforms=function(){return _===void 0&&R(this),_};let b;this.getAttributes=function(){return b===void 0&&R(this),b};let P=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=r.getProgramParameter(S,Zp)),P},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Kp++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=A,this.fragmentShader=y,this}let Mm=0;class Sm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Em(e),t.set(e,n)),n}}class Em{constructor(e){this.id=Mm++,this.code=e,this.usedTimes=0}}function ym(i){return i===ri||i===is||i===rs}
4169function bm(i,e,t,n,r,s){const a=new Yl,o=new Sm,c=new Set,l=[],d=new Map,g=n.logarithmicDepthBuffer;let u=n.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 x(_){return c.add(_),_===0?"uv":`uv${_}`}function S(_,b,P,I,O,H){const U=I.fog,V=O.geometry,q=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?I.environment:null,K=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,ee=e.get(_.envMap||q,K),Y=ee&&ee.mapping===ms?ee.image.height:null,$=h[_.type];_.precision!==null&&(u=n.getMaxPrecision(_.precision),u!==_.precision&&We("WebGLProgram.getParameters:",_.precision,"not supported, using",u,"instead."));const te=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,we=te!==void 0?te.length:0;let De=0;V.morphAttributes.position!==void 0&&(De=1),V.morphAttributes.normal!==void 0&&(De=2),V.morphAttributes.color!==void 0&&(De=3);let nt,Ke,He,Z;if($){const ht=gn[$];nt=ht.vertexShader,Ke=ht.fragmentShader}else{nt=_.vertexShader,Ke=_.fragmentShader;const ht=o.getVertexShaderStage(_),at=o.getFragmentShaderStage(_);o.update(_,ht,at),He=ht.id,Z=at.id}const j=i.getRenderTarget(),Se=i.state.buffers.depth.getReversed(),Ge=O.isInstancedMesh===!0,fe=O.isBatchedMesh===!0,re=!!_.map,Ne=!!_.matcap,xe=!!ee,Re=!!_.aoMap,Ve=!!_.lightMap,Be=!!_.bumpMap&&_.wireframe===!1,ye=!!_.normalMap,qe=!!_.displacementMap,it=!!_.emissiveMap,ze=!!_.metalnessMap,je=!!_.roughnessMap,C=_.anisotropy>0,ut=_.clearcoat>0,Ze=_.dispersion>0,T=_.retroreflectivity>0,p=_.iridescence>0,N=_.sheen>0,G=_.transmission>0,W=C&&!!_.anisotropyMap,ie=ut&&!!_.clearcoatMap,ae=ut&&!!_.clearcoatNormalMap,X=ut&&!!_.clearcoatRoughnessMap,J=p&&!!_.iridescenceMap,se=p&&
vendor: 4,759 bytes, line 4169
4169!!_.iridescenceThicknessMap,be=N&&!!_.sheenColorMap,le=N&&!!_.sheenRoughnessMap,oe=!!_.specularMap,ve=!!_.specularColorMap,Ie=!!_.specularIntensityMap,ke=G&&!!_.transmissionMap,D=G&&!!_.thicknessMap,ue=!!_.gradientMap,Q=!!_.alphaMap,ce=_.alphaTest>0,de=!!_.alphaHash,ne=!!_.extensions;let Ue=Mn;_.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ue=i.toneMapping);const Ce={shaderID:$,shaderType:_.type,shaderName:_.name,vertexShader:nt,fragmentShader:Ke,defines:_.defines,customVertexShaderID:He,customFragmentShaderID:Z,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:u,batching:fe,batchingColor:fe&&O._colorsTexture!==null,instancing:Ge,instancingColor:Ge&&O.instanceColor!==null,instancingMorph:Ge&&O.morphTexture!==null,outputColorSpace:j===null?i.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:st.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:re,matcap:Ne,envMap:xe,envMapMode:xe&&ee.mapping,envMapCubeUVHeight:Y,aoMap:Re,lightMap:Ve,bumpMap:Be,normalMap:ye,displacementMap:qe,emissiveMap:it,normalMapObjectSpace:ye&&_.normalMapType===Hc,normalMapTangentSpace:ye&&_.normalMapType===_o,packedNormalMap:ye&&_.normalMapType===_o&&ym(_.normalMap.format),metalnessMap:ze,roughnessMap:je,anisotropy:C,anisotropyMap:W,clearcoat:ut,clearcoatMap:ie,clearcoatNormalMap:ae,clearcoatRoughnessMap:X,dispersion:Ze,retroreflection:T,iridescence:p,iridescenceMap:J,iridescenceThicknessMap:se,sheen:N,sheenColorMap:be,sheenRoughnessMap:le,specularMap:oe,specularColorMap:ve,specularIntensityMap:Ie,transmission:G,transmissionMap:ke,thicknessMap:D,gradientMap:ue,opaque:_.transparent===!1&&_.blending===ir&&_.alphaToCoverage===!1,alphaMap:Q,alphaTest:ce,alphaHash:de,combine:_.combine,mapUv:re&&x(_.map.channel),aoMapUv:Re&&x(_.aoMap.channel),lightMapUv:Ve&&x(_.lightMap.channel),bumpMapUv:Be&&x(_.bumpMap.channel),normalMapUv:ye&&x(_.normalMap.channel),displacementMapUv:qe&&x(_.displacementMap.channel),emissiveMapUv:it&&x(_.emissiveMap.channel),metalnessMapUv:ze&&x(_.metalnessMap.channel),roughnessMapUv:je&&x(_.roughnessMap.channel),anisotropyMapUv:W&&x(_.anisotropyMap.channel),clearcoatMapUv:ie&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:ae&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:X&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:J&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:se&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:be&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:le&&x(_.sheenRoughnessMap.channel),specularMapUv:oe&&x(_.specularMap.channel),specularColorMapUv:ve&&x(_.specularColorMap.channel),specularIntensityMapUv:Ie&&x(_.specularIntensityMap.channel),transmissionMapUv:ke&&x(_.transmissionMap.channel),thicknessMapUv:D&&x(_.thicknessMap.channel),alphaMapUv:Q&&x(_.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(ye||C),vertexNormals:!!V.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!V.attributes.uv&&(re||Q),fog:!!U,useFog:_.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||V.attributes.normal===void 0&&ye===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Se,skinning:O.isSkinnedMesh===!0,hasPositionAttribute:V.attributes.position!==void 0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:we,morphTextureStride:De,numSunLights:b.sun.length,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numSunLightShadows:b.sunShadowMap.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numLightProbeGrids:H.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:i.shadowMap.enabled&&P.length>0,shadowMapType:i.shadowMap.type,toneMapping:Ue,decodeVideoTexture:re&&_.map.isVideoTexture===!0&&st.getTransfer(_.map.colorSpace)===dt,decodeVideoTextureEmissive:it&&_.emissiveMap.isVideoTexture===!0&&st.getTransfer(_.emissiveMap.colorSpace)===dt,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===_n,flipSided:_.side===qt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionCl
vendor: 13,107 bytes, line 4169
4169ipCullDistance:ne&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ne&&_.extensions.multiDraw===!0||fe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce}function m(_){const b=[];if(_.shaderID?b.push(_.shaderID):(b.push(_.customVertexShaderID),b.push(_.customFragmentShaderID)),_.defines!==void 0)for(const P in _.defines)b.push(P),b.push(_.defines[P]);return _.isRawShaderMaterial===!1&&(f(b,_),E(b,_),b.push(i.outputColorSpace)),b.push(_.customProgramCacheKey),b.join()}function f(_,b){_.push(b.precision),_.push(b.outputColorSpace),_.push(b.envMapMode),_.push(b.envMapCubeUVHeight),_.push(b.mapUv),_.push(b.alphaMapUv),_.push(b.lightMapUv),_.push(b.aoMapUv),_.push(b.bumpMapUv),_.push(b.normalMapUv),_.push(b.displacementMapUv),_.push(b.emissiveMapUv),_.push(b.metalnessMapUv),_.push(b.roughnessMapUv),_.push(b.anisotropyMapUv),_.push(b.clearcoatMapUv),_.push(b.clearcoatNormalMapUv),_.push(b.clearcoatRoughnessMapUv),_.push(b.iridescenceMapUv),_.push(b.iridescenceThicknessMapUv),_.push(b.sheenColorMapUv),_.push(b.sheenRoughnessMapUv),_.push(b.specularMapUv),_.push(b.specularColorMapUv),_.push(b.specularIntensityMapUv),_.push(b.transmissionMapUv),_.push(b.thicknessMapUv),_.push(b.combine),_.push(b.fogExp2),_.push(b.sizeAttenuation),_.push(b.morphTargetsCount),_.push(b.morphAttributeCount),_.push(b.numSunLights),_.push(b.numDirLights),_.push(b.numPointLights),_.push(b.numSpotLights),_.push(b.numSpotLightMaps),_.push(b.numHemiLights),_.push(b.numRectAreaLights),_.push(b.numSunLightShadows),_.push(b.numDirLightShadows),_.push(b.numPointLightShadows),_.push(b.numSpotLightShadows),_.push(b.numSpotLightShadowsWithMaps),_.push(b.numLightProbes),_.push(b.shadowMapType),_.push(b.toneMapping),_.push(b.numClippingPlanes),_.push(b.numClipIntersection),_.push(b.depthPacking)}function E(_,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.retroreflection&&a.enable(24),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),b.packedNormalMap&&a.enable(22),b.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),b.numLightProbeGrids>0&&a.enable(22),b.hasPositionAttribute&&a.enable(23),_.push(a.mask)}function w(_){const b=h[_.type];let P;if(b){const I=gn[b];P=Xu.clone(I.uniforms)}else P=_.uniforms;return P}function M(_,b){let P=d.get(b);return P!==void 0?++P.usedTimes:(P=new vm(i,b,_,r),l.push(P),d.set(b,P)),P}function A(_){if(--_.usedTimes===0){const b=l.indexOf(_);l[b]=l[l.length-1],l.pop(),d.delete(_.cacheKey),_.destroy()}}function y(_){o.remove(_)}function R(){o.dispose()}return{getParameters:S,getProgramCacheKey:m,getUniforms:w,acquireProgram:M,releaseProgram:A,releaseShaderCache:y,programs:l,dispose:R}}function Tm(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,c){i.get(a)[o]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Am(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function dl(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function pl(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u){let h=0;return u.isInstancedMesh&&(h+=2),u.isSkinnedMesh&&(h+=1),h}function o(u,h,x,S,m,f){let E=i[e];return E===void 0?(E={id:u.id,object:u,geometry:h,material:x,materialVariant:a(u),groupOrder:S,renderOrder:u.renderOrder,z:m,group:f},i[e]=E):(E.id=u.id,E.object=u,E.geometry=h,E.material=x,E.materialVariant=a(u),E.groupOrder=S,E.renderOrder=u.renderOrder,E.z=m,E.group=f),e++,E}function c(u,h,x,S,m,f,E){E.reversedDepth===!0&&(m=-m);const w=o(u,h,x,S,m,f);x.transmission>0?n.push(w):x.transparent===!0?r.push(w):t.push(w)}function l(u,h,x,S,m,f){const E=o(u,h,x,S,m,f);x.transmission>0?n.unshift(E):x.transparent===!0?r.unshift(E):t.unshift(E)}function d(u,h){t.length>1&&t.sort(u||Am),n.length>1&&n.sort(h||dl),r.length>1&&r.sort(h||dl)}function g(){for(let u=e,h=i.length;u<h;u++){const x=i[u];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:c,unshift:l,finish:g,sort:d}}function wm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new pl,i.set(n,[a])):r>=s.length?(a=new pl,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Rm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return i[e.id]=t,t}}}function Cm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Pm=0;function Lm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Dm(i){const e=new Rm,t=Cm(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new F);const r=new F,s=new Et,a=new Et;function o(l){let d=0,g=0,u=0;for(let O=0;O<9;O++)n.probe[O].set(0,0,0);let h=0,x=0,S=0,m=0,f=0,E=0,w=0,M=0,A=0,y=0,R=0,_=0,b=0,P=0;l.sort(Lm);for(let O=0,H=l.length;O<H;O++){const U=l[O],V=U.color,q=U.intensity,K=U.distance;let ee=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===ri?ee=U.shadow.map.texture:ee=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)d+=V.r*q,g+=V.g*q,u+=V.b*q;else if(U.isLightProbe){for(let Y=0;Y<9;Y++)n.probe[Y].addScaledVector(U.sh.coefficients[Y],q);P++}else if(U.isSunLight){const Y=e.get(U);if(Y.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const $=U.shadow,te=t.get(U);te.shadowIntensity=$.intensity,te.shadowBias=$.bias,te.shadowNormalBias=$.normalBias,te.shadowRadius=$.radius,te.shadowMapSize.copy($.mapSize).multiply($.getFrameExtents()),n.sunShadow[x]=te,n.sunShadowMap[x]=ee;const we=$.getViewportCount();for(let De=0;De<we;De++)n.sunShadowMatrix[S+De]=$.getMatrix(De),n.sunShadowCascade[S+De]=$._cascadeData[De];S+=we,x++}n.sun[h]=Y,h++}else if(U.isDirectionalLight){const Y=e.get(U);if(Y.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const $=U.shadow,te=t.get(U);te.shadowIntensity=$.intensity,te.shadowBias=$.bias,te.shadowNormalBias=$.normalBias,te.shadowRadius=$.radius,te.shadowMapSize=$.mapSize,n.directionalShadow[m]=te,n.directionalShadowMap[m]=ee,n.directionalShadowMatrix[m]=U.shadow.matrix,A++}n.directional[m]=Y,m++}else if(U.isSpotLight){const Y=e.get(U);Y.position.setFromMatrixPosition(U.matrixWorld),Y.color.copy(V).multiplyScalar(q),Y.distance=K,Y.coneCos=Math.cos(U.angle),Y.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),Y.decay=U.decay,n.spot[E]=Y;const $=U.shadow;if(U.map&&(n.spotLightMap[_]=U.map,_++,$.updateMatrices(U),U.castShadow&&b++),n.spotLightMatrix[E]=$.matrix,U.castShadow){const te=t.get(U);te.shadowIntensity=$.intensity,te.shadowBias=$.bias,te.shadowNormalBias=$.normalBias,te.shadowRadius=$.radius,te.shadowMapSize=$.mapSize,n.spotShadow[E]=te,n.spotShadowMap[E]=ee,R++}E++}else if(U.isRectAreaLight){const Y=e.get(U);Y.color.copy(V).multiplyScalar(q),Y.halfWidth.set(U.width*.5,0,0),Y.halfHeight.set(0,U.height*.5,0),n.rectArea[w]=Y,w++}else if(U.isPointLight){const Y=e.get(U);if(Y.color.copy(U.color).multiplyScalar(U.intensity),Y.distance=U.distance,Y.decay=U.decay,U.castShadow){const $=U.shadow,te=t.get(U);te.shadowIntensity=$.intensity,te.shadowBias=$.bias,te.shadowNormalBias=$.normalBias,te.shadowRadius=$.radius,te.shadowMapSize=$.mapSize,te.shadowCameraNear=$.camera.near,te.shadowCameraFar=$.camera.far,n.pointShadow[f]=te,n.pointShadowMap[f]=ee,n.pointShadowMatrix[f]=U.shadow.matrix,y++}n.point[f]=Y,f++}else if(U.isHemisphereLight){const Y=e.get(U);Y.skyColor.copy(U.color).multiplyScalar(q),Y.groundColor.copy(U.groundColor).multiplyScalar(q),n.hemi[M]=Y,M++}}w>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ge.LTC_FLOAT_1,n.rectAreaLTC2=ge.LTC_FLOAT_2):(n.rectAreaLTC1=ge.LTC_HALF_1,n.rectAreaLTC2=ge.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=g,n.ambient[2]=u;const I=n.hash;(I.sunLength!==h||I.directionalLength!==m||I.pointLength!==f||I.spotLength!==E||I.rectAreaLength!==w||I.hemiLength!==M||I.numSunShadows!==x||I.numDirectionalShadows!==A||I.numPointShadows!==y||I.numSpotShadows!==R||I.numSpotMaps!==_||I.numLightProbes!==P)&&(n.sun.length=h,n.directional.length=m,n.spot.length=E,n.rectArea.length=w,n.point.length=f,n.hemi.length=M,n.sunShadow.length=x,n.sunShadowMap.length=x,n.sunShadowMatrix.length=S,n.sunShadowCascade.length=S,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.directionalShadowMatrix.length=A,n.pointShadow.length=y,n.pointShadowMap.length=y,n.pointShadowMatrix.length=y,n.spotShadow.length=R,n.spotShadowMap.length=R,n.spotLightMatrix.length=R+_-b,n.spotLightMap.length=_,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=P,I.sunLength=h,I.directionalLength=m,I.pointLength=f,I.spotLength=E,I.rectAreaLength=w,I.hemiLength=M,I.numSunShadows=x,I.numDirectionalShadows=A,I.numPointShadows=y,I.numSpotShadows=R,I.numSpotMaps=_,I.numLightProbes=P,n.version=Pm++)}function c(l,d){let g=0,u=0,h=0,x=0,S=0,m=0;const f=d.matrixWorldInverse;for(let E=0,w=l.length;E<w;E++){const M=l[E];if(M.isSunLight){const A=n.sun[g];A.direction.setFromMatrixPosition(M.matrixWorld),A.direction.transformDirection(f),g++}else if(M.isDirectionalLight){const A=n.directional[u];A.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(f),u++}else if(M.isSpotLight){const A=n.spot[x];A.position.setFromMatrixPosition(M.matrixWorld),A.position.applyMatrix4(f),A.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(f),x++}else if(M.isRectAreaLight){const A=n.rectArea[S];A.position.setFromMatrixPosition(M.matrixWorld),A.position.applyMatrix4(f),a.identity(),s.copy(M.matrixWorld),s.premultiply(f),a.extractRotation(s),A.halfWidth.set(M.width*.5,0,0),A.halfHeight.set(0,M.height*.5,0),A.halfWidth.applyMatrix4(a),A.halfHeight.applyMatrix4(a),S++}
vendor: 4,987 bytes, lines 4169-4196
4169else if(M.isPointLight){const A=n.point[h];A.position.setFromMatrixPosition(M.matrixWorld),A.position.applyMatrix4(f),h++}else if(M.isHemisphereLight){const A=n.hemi[m];A.direction.setFromMatrixPosition(M.matrixWorld),A.direction.transformDirection(f),m++}}}return{setup:o,setupView:c,state:n}}function ml(i){const e=new Dm(i),t=[],n=[],r=[];function s(u){g.camera=u,t.length=0,n.length=0,r.length=0}function a(u){t.push(u)}function o(u){n.push(u)}function c(u){r.push(u)}function l(){e.setup(t)}function d(u){e.setupView(t,u)}const g={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:g,setupLights:l,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function Im(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new ml(i),e.set(r,[o])):s>=a.length?(o=new ml(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Um=`void main() { 4170 gl_Position = vec4( position, 1.0 ); 4171}`,Nm=`uniform sampler2D shadow_pass; 4172uniform vec2 resolution; 4173uniform float radius; 4174void main() { 4175 const float samples = float( VSM_SAMPLES ); 4176 float mean = 0.0; 4177 float squared_mean = 0.0; 4178 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4179 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4180 for ( float i = 0.0; i < samples; i ++ ) { 4181 float uvOffset = uvStart + i * uvStride; 4182 #ifdef HORIZONTAL_PASS 4183 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4184 mean += distribution.x; 4185 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4186 #else 4187 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4188 mean += depth; 4189 squared_mean += depth * depth; 4190 #endif 4191 } 4192 mean = mean / samples; 4193 squared_mean = squared_mean / samples; 4194 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4195 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4196}`,Fm=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],Om=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],gl=new Et,er=new F,Qs=new F;function Bm(i,e,t){let n=new Ql;const r=new $e,s=new $e,a=new yt,o=new Ku,c=new $u,l={},d=t.maxTextureSize,g={[ni]:qt,[qt]:ni,[_n]:_n},u=new rn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $e},radius:{value:4}},vertexShader:Um,fragmentShader:Nm}),h=u.clone();h.defines.HORIZONTAL_PASS=1;const x=new wt;x.setAttribute("position",new gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new Wt(x,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Kr;let f=this.type;this.render=function(y,R,_){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||y.length===0)return;this.type===xc&&(We("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Kr);const b=i.getRenderTarget(),P=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),O=i.state;O.setBlending(Ln),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const H=f!==this.type;H&&R.traverse(function(U){U.material&&(Array.isArray(U.material)?U.material.forEach(V=>V.needsUpdate=!0):U.material.needsUpdate=!0)});for(let U=0,V=y.length;U<V;U++){const q=y[U],K=q.shadow;if(K===void 0){We("WebGLShadowMap:",q,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;r.copy(K.mapSize);const ee=K.getFrameExtents();r.multiply(ee),s.copy(K.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/ee.x),r.x=s.x*ee.x,K.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/ee.y),r.y=s.y*ee.y,K.mapSize.y=s.y));const Y=i.state.buffers.depth.getReversed();if(K.camera._reversedDepth=Y,K.map===null||H===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===tr){if(q.isPointLight){We("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new fn(r.x,r.y,{format:ri,type:En,minFilter:Bt,magFilter:Bt,generateMipmaps:!1}),K.map.texture.name=q.name+".shadowMap",K.map.depthTexture=new ur(r.x,r.y,xn),K.map.depthTexture.name=q.name+".shadowMapDepth",K.map.depthTexture.format=Un,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=It,K.map.depthTexture.magFilter=It}else q.isPointLight?(K.map=new ac(r.x),K.map.depthTexture=new Vu(r.x,Sn)):(K.map=new fn(r.x,r.y),K.map.depthTexture=new ur(r.x,r.y,Sn)),K.map.depthTexture.name=q.name+".shadowMap",K.map.depthTexture.format=Un,this.type===Kr?(K.map.depthTexture.compareFunction=Y?ja:Qa,K.map.depthTexture.minFilter=Bt,K.map.depthTexture.magFilter=Bt):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=It,K.map.depthTexture.magFilter=It);K.camera.updateProjectionMatrix()}
vendor: 9,590 bytes, line 4196
4196K.map.isWebGLCubeRenderTarget!==!0&&(K.map.width!==r.x||K.map.height!==r.y)&&K.map.setSize(r.x,r.y);const $=K.map.isWebGLCubeRenderTarget?6:K.getViewportCount();q.isPointLight!==!0&&K.updateMatrices(q,_);for(let te=0;te<$;te++){const we=K.getCamera(te);if(q.isPointLight){const De=K.camera,nt=K.matrix,Ke=q.distance||De.far;Ke!==De.far&&(De.far=Ke,De.updateProjectionMatrix()),er.setFromMatrixPosition(q.matrixWorld),De.position.copy(er),Qs.copy(De.position),Qs.add(Fm[te]),De.up.copy(Om[te]),De.lookAt(Qs),De.updateMatrixWorld(),nt.makeTranslation(-er.x,-er.y,-er.z),gl.multiplyMatrices(De.projectionMatrix,De.matrixWorldInverse),K._frustum.setFromProjectionMatrix(gl,De.coordinateSystem,De.reversedDepth)}if(K.map.isWebGLCubeRenderTarget)i.setRenderTarget(K.map,te),i.clear();else{te===0&&(i.setRenderTarget(K.map),i.clear());const De=K.getViewport(te);a.set(s.x*De.x,s.y*De.y,s.x*De.z,s.y*De.w),O.viewport(a)}n=K.getFrustum(te),M(R,_,we,q,this.type)}K.isPointLightShadow!==!0&&this.type===tr&&E(K,_),K.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(b,P,I)};function E(y,R){const _=e.update(S);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,h.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,h.needsUpdate=!0),y.mapPass===null?y.mapPass=new fn(r.x,r.y,{format:ri,type:En}):(y.mapPass.width!==y.map.width||y.mapPass.height!==y.map.height)&&y.mapPass.setSize(y.map.width,y.map.height),u.uniforms.shadow_pass.value=y.map.depthTexture,u.uniforms.resolution.value.set(y.map.width,y.map.height),u.uniforms.radius.value=y.radius,i.setRenderTarget(y.mapPass),i.clear(),i.renderBufferDirect(R,null,_,u,S,null),h.uniforms.shadow_pass.value=y.mapPass.texture,h.uniforms.resolution.value.set(y.map.width,y.map.height),h.uniforms.radius.value=y.radius,i.setRenderTarget(y.map),i.clear(),i.renderBufferDirect(R,null,_,h,S,null)}function w(y,R,_,b){let P=null;const I=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(I!==void 0)P=I;else if(P=_.isPointLight===!0?c:o,i.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const O=P.uuid,H=R.uuid;let U=l[O];U===void 0&&(U={},l[O]=U);let V=U[H];V===void 0&&(V=P.clone(),U[H]=V,R.addEventListener("dispose",A)),P=V}if(P.visible=R.visible,P.wireframe=R.wireframe,b===tr?P.side=R.shadowSide!==null?R.shadowSide:R.side:P.side=R.shadowSide!==null?R.shadowSide:g[R.side],P.alphaMap=R.alphaMap,P.alphaTest=R.alphaToCoverage===!0?.5:R.alphaTest,P.map=R.map,P.clipShadows=R.clipShadows,P.clippingPlanes=R.clippingPlanes,P.clipIntersection=R.clipIntersection,P.displacementMap=R.displacementMap,P.displacementScale=R.displacementScale,P.displacementBias=R.displacementBias,P.wireframeLinewidth=R.wireframeLinewidth,P.linewidth=R.linewidth,_.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const O=i.properties.get(P);O.light=_}return P}function M(y,R,_,b,P){if(y.visible===!1)return;if(y.layers.test(R.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&P===tr)&&(!y.frustumCulled||y.intersectsFrustum(n))){y.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,y.matrixWorld);const H=e.update(y),U=y.material;if(Array.isArray(U)){const V=H.groups;for(let q=0,K=V.length;q<K;q++){const ee=V[q],Y=U[ee.materialIndex];if(Y&&Y.visible){const $=w(y,Y,b,P);y.onBeforeShadow(i,y,R,_,H,$,ee),i.renderBufferDirect(_,null,H,$,y,ee),y.onAfterShadow(i,y,R,_,H,$,ee)}}}else if(U.visible){const V=w(y,U,b,P);y.onBeforeShadow(i,y,R,_,H,V,null),i.renderBufferDirect(_,null,H,V,y,null),y.onAfterShadow(i,y,R,_,H,V,null)}}const O=y.children;for(let H=0,U=O.length;H<U;H++)M(O[H],R,_,b,P)}function A(y){y.target.removeEventListener("dispose",A);for(const _ in l){const b=l[_],P=y.target.uuid;P in b&&(b[P].dispose(),delete b[P])}}}function zm(i,e){function t(){let D=!1;const ue=new yt;let Q=null;const ce=new yt(0,0,0,0);return{setMask:function(de){Q!==de&&!D&&(i.colorMask(de,de,de,de),Q=de)},setLocked:function(de){D=de},setClear:function(de,ne,Ue,Ce,ht){ht===!0&&(de*=Ce,ne*=Ce,Ue*=Ce),ue.set(de,ne,Ue,Ce),ce.equals(ue)===!1&&(i.clearColor(de,ne,Ue,Ce),ce.copy(ue))},reset:function(){D=!1,Q=null,ce.set(-1,0,0,0)}}}function n(){let D=!1,ue=!1,Q=null,ce=null,de=null;return{setReversed:function(ne){if(ue!==ne){const Ue=e.get("EXT_clip_control");ne?Ue.clipControlEXT(Ue.LOWER_LEFT_EXT,Ue.ZERO_TO_ONE_EXT):Ue.clipControlEXT(Ue.LOWER_LEFT_EXT,Ue.NEGATIVE_ONE_TO_ONE_EXT),ue=ne;const Ce=de;de=null,this.setClear(Ce)}},getReversed:function(){return ue},setTest:function(ne){ne?j(i.DEPTH_TEST):Se(i.DEPTH_TEST)},setMask:function(ne){Q!==ne&&!D&&(i.depthMask(ne),Q=ne)},setFunc:function(ne){if(ue&&(ne=Qc[ne]),ce!==ne){switch(ne){case ta:i.depthFunc(i.NEVER);break;case na:i.depthFunc(i.ALWAYS);break;case ia:i.depthFunc(i.LESS);break;case ar:i.depthFunc(i.LEQUAL);break;case ra:i.depthFunc(i.EQUAL);break;case sa:i.depthFunc(i.GEQUAL);break;case aa:i.depthFunc(i.GREATER);break;case oa:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ce=ne}},setLocked:function(ne){D=ne},setClear:function(ne){de!==ne&&(de=ne,ue&&(ne=1-ne),i.clearDepth(ne))},reset:function(){D=!1,Q=null,ce=null,de=null,ue=!1}}}function r(){let D=!1,ue=null,Q=null,ce=null,de=null,ne=null,Ue=null,Ce=null,ht=null;return{setTest:function(at){D||(at?j(i.STENCIL_TEST):Se(i.STENCIL_TEST))},setMask:function(at){ue!==at&&!D&&(i.stencilMask(at),ue=at)},setFunc:function(at,Ut,Yt){(Q!==at||ce!==Ut||de!==Yt)&&(i.stencilFunc(at,Ut,Yt),Q=at,ce=Ut,de=Yt)},setOp:function(at,Ut,Yt){(ne!==at||Ue!==Ut||Ce!==Yt)&&(i.stencilOp(at,Ut,Yt),ne=at,Ue=Ut,Ce=Yt)},setLocked:function(at){D=at},setClear:function(at){ht!==at&&(i.clearStencil(at),ht=at)},reset:function(){D=!1,ue=null,Q=null,ce=null,de=null,ne=null,Ue=null,Ce=null,ht=null}}}const s=new t,a=new n,o=new r,c=new WeakMap,l=new WeakMap;let d={},g={},u={},h=new WeakMap,x=[],S=null,m=!1,f=null,E=null,w=null,M=null,A=null,y=null,R=null,_=new Xe(0,0,0),b=0,P=!1,I=null,O=null,H=null,U=null,V=null;const q=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,ee=0;const Y=i.getParameter(i.VERSION);Y.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(Y)[1]),K=ee>=1):Y.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),K=ee>=2);let $=null,te={};const we=i.getParameter(i.SCISSOR_BOX),De=i.getParameter(i.VIEWPORT),nt=new yt().fromArray(we),Ke=new yt().fromArray(De);function He(D,ue,Q,ce){const de=new Uint8Array(4),ne=i.createTexture();i.bindTexture(D,ne),i.texParameteri(D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(D,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ue=0;Ue<Q;Ue++)D===i.TEXTURE_3D||D===i.TEXTURE_2D_ARRAY?i.texImage3D(ue,0,i.RGBA,1,1,ce,0,i.RGBA,i.UNSIGNED_BYTE,de):i.texImage2D(ue+Ue,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,de);return ne}const Z={};Z[i.TEXTURE_2D]=He(i.TEXTURE_2D,i.TEXTURE_2D,1),Z[i.TEXTURE_CUBE_MAP]=He(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[i.TEXTURE_2D_ARRAY]=He(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Z[i.TEXTURE_3D]=He(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),j(i.DEPTH_TEST),a.setFunc(ar),Be(!1),ye(po),j(i.CULL_FACE),Re(Ln);function j(D){d[D]!==!0&&(i.enable(D),d[D]=!0)}function Se(D){d[D]!==!1&&(i.disable(D),d[D]=!1)}function Ge(D,ue){return u[D]!==ue?(i.bindFramebuffer(D,ue),u[D]=ue,D===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ue),D===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ue),!0):!1}function fe(D,ue){let Q=x,ce=!1;if(D){Q=h.get(ue),Q===void 0&&(Q=[],h.set(ue,Q));const de=D.textures;if(Q.length!==de.length||Q[0]!==i.COLOR_ATTACHMENT0){for(let ne=0,Ue=de.length;ne<Ue;ne++)Q[ne]=i.COLOR_ATTACHMENT0+ne;Q.length=de.length,ce=!0}}else Q[0]!==i.BACK&&(Q[0]=i.BACK,ce=!0);ce&&i.drawBuffers(Q)}function re(D){return S!==D?(i.useProgram(D),S=D,!0):!1}const Ne={[Pi]:i.FUNC_ADD,[Mc]:i.FUNC_SUBTRACT,[Sc]:i.FUNC_REVERSE_SUBTRACT};Ne[Ec]=i.MIN,Ne[yc]=i.MAX;const xe={[bc]:i.ZERO,[Tc]:i.ONE,[Ac]:i.SRC_COLOR,[Al]:i.SRC_ALPHA,[Dc]:i.SRC_ALPHA_SATURATE,[Pc]:i.DST_COLOR,[Rc]:i.DST_ALPHA,[wc]:i.ONE_MINUS_SRC_COLOR,[wl]:i.ONE_MINUS_SRC_ALPHA,[Lc]:i.ONE_MINUS_DST_COLOR,[Cc]:i.ONE_MINUS_DST_ALPHA,[Ic]:i.CONSTANT_COLOR,[Uc]:i.ONE_MINUS_CONSTANT_COLOR,[Nc]:i.CONSTANT_ALPHA,[Fc]:i.ONE_MINUS_CONSTANT_ALPHA};function Re(D,ue,Q,ce,de,ne,Ue,Ce,ht,at){if(D===Ln){m===!0&&(Se(i.BLEND),m=!1);return}if(m===!1&&(j(i.BLEND),m=!0),D!==vc){if(D!==f||at!==P){if((E!==Pi||A!==Pi)&&(i.blendEquation(i.FUNC_ADD),E=Pi,A=Pi),at)switch(D){case ir:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ln:i.blendFunc(i.ONE,i.ONE);break;case mo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case go:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:lt("WebGLState: Invalid blending: ",D);break}else switch(D){case ir:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ln:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case mo:lt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case go:lt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:lt("WebGLState: Invalid blending: ",D);break}w=null,M=null,y=null,R=null,_.set(0,0,0),b=0,f=D,P=at}return}de=de||ue,ne=ne||Q,Ue=Ue||ce,(ue!==E||de!==A)&&(i.blendEquationSeparate(Ne[ue],Ne[de]),E=ue,A=de),(Q!==w||ce!==M||ne!==y||Ue!==R)&&(i.blendFuncSeparate(xe[Q],xe[ce],xe[ne],xe[Ue]),w=Q,M=ce,y=ne,R=Ue),(Ce.equals(_)===!1||ht!==b)&&(i.blendColor
vendor: 9,552 bytes, line 4196
4196(Ce.r,Ce.g,Ce.b,ht),_.copy(Ce),b=ht),f=D,P=!1}function Ve(D,ue){D.side===_n?Se(i.CULL_FACE):j(i.CULL_FACE);let Q=D.side===qt;ue&&(Q=!Q),Be(Q),D.blending===ir&&D.transparent===!1?Re(Ln):Re(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),s.setMask(D.colorWrite);const ce=D.stencilWrite;o.setTest(ce),ce&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),it(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?j(i.SAMPLE_ALPHA_TO_COVERAGE):Se(i.SAMPLE_ALPHA_TO_COVERAGE)}function Be(D){I!==D&&(D?i.frontFace(i.CW):i.frontFace(i.CCW),I=D)}function ye(D){D!==gc?(j(i.CULL_FACE),D!==O&&(D===po?i.cullFace(i.BACK):D===_c?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Se(i.CULL_FACE),O=D}function qe(D){D!==H&&(K&&i.lineWidth(D),H=D)}function it(D,ue,Q){D?(j(i.POLYGON_OFFSET_FILL),(U!==ue||V!==Q)&&(U=ue,V=Q,a.getReversed()&&(ue=-ue),i.polygonOffset(ue,Q))):Se(i.POLYGON_OFFSET_FILL)}function ze(D){D?j(i.SCISSOR_TEST):Se(i.SCISSOR_TEST)}function je(D){D===void 0&&(D=i.TEXTURE0+q-1),$!==D&&(i.activeTexture(D),$=D)}function C(D,ue,Q){Q===void 0&&($===null?Q=i.TEXTURE0+q-1:Q=$);let ce=te[Q];ce===void 0&&(ce={type:void 0,texture:void 0},te[Q]=ce),(ce.type!==D||ce.texture!==ue)&&($!==Q&&(i.activeTexture(Q),$=Q),i.bindTexture(D,ue||Z[D]),ce.type=D,ce.texture=ue)}function ut(){const D=te[$];D!==void 0&&D.type!==void 0&&(i.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function Ze(){try{i.compressedTexImage2D(...arguments)}catch(D){lt("WebGLState:",D)}}function T(){try{i.compressedTexImage3D(...arguments)}catch(D){lt("WebGLState:",D)}}function p(){try{i.texSubImage2D(...arguments)}catch(D){lt("WebGLState:",D)}}function N(){try{i.texSubImage3D(...arguments)}catch(D){lt("WebGLState:",D)}}function G(){try{i.compressedTexSubImage2D(...arguments)}catch(D){lt("WebGLState:",D)}}function W(){try{i.compressedTexSubImage3D(...arguments)}catch(D){lt("WebGLState:",D)}}function ie(){try{i.texStorage2D(...arguments)}catch(D){lt("WebGLState:",D)}}function ae(){try{i.texStorage3D(...arguments)}catch(D){lt("WebGLState:",D)}}function X(){try{i.texImage2D(...arguments)}catch(D){lt("WebGLState:",D)}}function J(){try{i.texImage3D(...arguments)}catch(D){lt("WebGLState:",D)}}function se(D){return g[D]!==void 0?g[D]:i.getParameter(D)}function be(D,ue){g[D]!==ue&&(i.pixelStorei(D,ue),g[D]=ue)}function le(D){nt.equals(D)===!1&&(i.scissor(D.x,D.y,D.z,D.w),nt.copy(D))}function oe(D){Ke.equals(D)===!1&&(i.viewport(D.x,D.y,D.z,D.w),Ke.copy(D))}function ve(D,ue){let Q=l.get(ue);Q===void 0&&(Q=new WeakMap,l.set(ue,Q));let ce=Q.get(D);ce===void 0&&(ce=i.getUniformBlockIndex(ue,D.name),Q.set(D,ce))}function Ie(D,ue){const ce=l.get(ue).get(D);c.get(ue)!==ce&&(i.uniformBlockBinding(ue,ce,D.__bindingPointIndex),c.set(ue,ce))}function ke(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),d={},g={},$=null,te={},u={},h=new WeakMap,x=[],S=null,m=!1,f=null,E=null,w=null,M=null,A=null,y=null,R=null,_=new Xe(0,0,0),b=0,P=!1,I=null,O=null,H=null,U=null,V=null,nt.set(0,0,i.canvas.width,i.canvas.height),Ke.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:j,disable:Se,bindFramebuffer:Ge,drawBuffers:fe,useProgram:re,setBlending:Re,setMaterial:Ve,setFlipSided:Be,setCullFace:ye,setLineWidth:qe,setPolygonOffset:it,setScissorTest:ze,activeTexture:je,bindTexture:C,unbindTexture:ut,compressedTexImage2D:Ze,compressedTexImage3D:T,texImage2D:X,texImage3D:J,pixelStorei:be,getParameter:se,updateUBOMapping:ve,uniformBlockBinding:Ie,texStorage2D:ie,texStorage3D:ae,texSubImage2D:p,texSubImage3D:N,compressedTexSubImage2D:G,compressedTexSubImage3D:W,scissor:le,viewport:oe,reset:ke}}function Gm(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new $e,d=new WeakMap,g=new Set;let u;const h=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(T,p){return x?new OffscreenCanvas(T,p):ls("canvas")}function m(T,p,N){let G=1;const W=Ze(T);if((W.width>N||W.height>N)&&(G=N/Math.max(W.width,W.height)),G<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const ie=Math.floor(G*W.width),ae=Math.floor(G*W.height);u===void 0&&(u=S(ie,ae));const X=p?S(ie,ae):u;return X.width=ie,X.height=ae,X.getContext("2d").drawImage(T,0,0,ie,ae),We("WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+ie+"x"+ae+")."),X}else return"data"in T&&We("WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),T;return T}function f(T){return T.generateMipmaps}function E(T){i.generateMipmap(T)}function w(T){return T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?i.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(T,p,N,G,W,ie=!1){if(T!==null){if(i[T]!==void 0)return i[T];We("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let ae;G&&(ae=e.get("EXT_texture_norm16"),ae||We("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let X=p;if(p===i.RED&&(N===i.FLOAT&&(X=i.R32F),N===i.HALF_FLOAT&&(X=i.R16F),N===i.UNSIGNED_BYTE&&(X=i.R8),N===i.UNSIGNED_SHORT&&ae&&(X=ae.R16_EXT),N===i.SHORT&&ae&&(X=ae.R16_SNORM_EXT)),p===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.R8UI),N===i.UNSIGNED_SHORT&&(X=i.R16UI),N===i.UNSIGNED_INT&&(X=i.R32UI),N===i.BYTE&&(X=i.R8I),N===i.SHORT&&(X=i.R16I),N===i.INT&&(X=i.R32I)),p===i.RG&&(N===i.FLOAT&&(X=i.RG32F),N===i.HALF_FLOAT&&(X=i.RG16F),N===i.UNSIGNED_BYTE&&(X=i.RG8),N===i.UNSIGNED_SHORT&&ae&&(X=ae.RG16_EXT),N===i.SHORT&&ae&&(X=ae.RG16_SNORM_EXT)),p===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RG8UI),N===i.UNSIGNED_SHORT&&(X=i.RG16UI),N===i.UNSIGNED_INT&&(X=i.RG32UI),N===i.BYTE&&(X=i.RG8I),N===i.SHORT&&(X=i.RG16I),N===i.INT&&(X=i.RG32I)),p===i.RGB_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RGB8UI),N===i.UNSIGNED_SHORT&&(X=i.RGB16UI),N===i.UNSIGNED_INT&&(X=i.RGB32UI),N===i.BYTE&&(X=i.RGB8I),N===i.SHORT&&(X=i.RGB16I),N===i.INT&&(X=i.RGB32I)),p===i.RGBA_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RGBA8UI),N===i.UNSIGNED_SHORT&&(X=i.RGBA16UI),N===i.UNSIGNED_INT&&(X=i.RGBA32UI),N===i.BYTE&&(X=i.RGBA8I),N===i.SHORT&&(X=i.RGBA16I),N===i.INT&&(X=i.RGBA32I)),p===i.RGB&&(N===i.UNSIGNED_SHORT&&ae&&(X=ae.RGB16_EXT),N===i.SHORT&&ae&&(X=ae.RGB16_SNORM_EXT),N===i.UNSIGNED_INT_5_9_9_9_REV&&(X=i.RGB9_E5),N===i.UNSIGNED_INT_10F_11F_11F_REV&&(X=i.R11F_G11F_B10F)),p===i.RGBA){const J=ie?as:st.getTransfer(W);N===i.FLOAT&&(X=i.RGBA32F),N===i.HALF_FLOAT&&(X=i.RGBA16F),N===i.UNSIGNED_BYTE&&(X=J===dt?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT&&ae&&(X=ae.RGBA16_EXT),N===i.SHORT&&ae&&(X=ae.RGBA16_SNORM_EXT),N===i.UNSIGNED_SHORT_4_4_4_4&&(X=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(X=i.RGB5_A1)}return(X===i.R16F||X===i.R32F||X===i.RG16F||X===i.RG32F||X===i.RGBA16F||X===i.RGBA32F)&&e.get("EXT_color_buffer_float"),X}function A(T,p){let N;return T?p===null||p===Sn||p===lr?N=i.DEPTH24_STENCIL8:p===xn?N=i.DEPTH32F_STENCIL8:p===or&&(N=i.DEPTH24_STENCIL8,We("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):p===null||p===Sn||p===lr?N=i.DEPTH_COMPONENT24:p===xn?N=i.DEPTH_COMPONENT32F:p===or&&(N=i.DEPTH_COMPONENT16),N}function y(T,p){return f(T)===!0||T.isFramebufferTexture&&T.minFilter!==It&&T.minFilter!==Bt?Math.log2(Math.max(p.width,p.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?p.mipmaps.length:1}function R(T){const p=T.target;p.removeEventListener("dispose",R),b(p),p.isVideoTexture&&d.delete(p),p.isHTMLTexture&&g.delete(p)}function _(T){const p=T.target;
vendor: 6,752 bytes, line 4196
4196p.removeEventListener("dispose",_),I(p)}function b(T){const p=n.get(T);if(p.__webglInit===void 0)return;const N=T.source,G=h.get(N);if(G){const W=G[p.__cacheKey];W.usedTimes--,W.usedTimes===0&&P(T),Object.keys(G).length===0&&h.delete(N)}n.remove(T)}function P(T){const p=n.get(T);i.deleteTexture(p.__webglTexture);const N=T.source,G=h.get(N);delete G[p.__cacheKey],a.memory.textures--}function I(T){const p=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let G=0;G<6;G++){if(Array.isArray(p.__webglFramebuffer[G]))for(let W=0;W<p.__webglFramebuffer[G].length;W++)i.deleteFramebuffer(p.__webglFramebuffer[G][W]);else i.deleteFramebuffer(p.__webglFramebuffer[G]);p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer[G])}else{if(Array.isArray(p.__webglFramebuffer))for(let G=0;G<p.__webglFramebuffer.length;G++)i.deleteFramebuffer(p.__webglFramebuffer[G]);else i.deleteFramebuffer(p.__webglFramebuffer);if(p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer),p.__webglMultisampledFramebuffer&&i.deleteFramebuffer(p.__webglMultisampledFramebuffer),p.__webglColorRenderbuffer)for(let G=0;G<p.__webglColorRenderbuffer.length;G++)p.__webglColorRenderbuffer[G]&&i.deleteRenderbuffer(p.__webglColorRenderbuffer[G]);p.__webglDepthRenderbuffer&&i.deleteRenderbuffer(p.__webglDepthRenderbuffer)}const N=T.textures;for(let G=0,W=N.length;G<W;G++){const ie=n.get(N[G]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(N[G])}n.remove(T)}let O=0;function H(){O=0}function U(){return O}function V(T){O=T}function q(){const T=O;return T>=r.maxTextures&&We("WebGLTextures: Trying to use "+(T+1)+" texture units while this GPU supports only "+r.maxTextures),O+=1,T}function K(T){const p=[];return p.push(T.wrapS),p.push(T.wrapT),p.push(T.wrapR||0),p.push(T.magFilter),p.push(T.minFilter),p.push(T.anisotropy),p.push(T.internalFormat),p.push(T.format),p.push(T.type),p.push(T.generateMipmaps),p.push(T.premultiplyAlpha),p.push(T.flipY),p.push(T.unpackAlignment),p.push(T.colorSpace),p.join()}function ee(T,p){const N=n.get(T);if(T.isVideoTexture&&C(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&N.__version!==T.version){const G=T.image;if(G===null)We("WebGLRenderer: Texture marked for update but no image data found.");else if(G.complete===!1)We("WebGLRenderer: Texture marked for update but image is incomplete");else{Se(N,T,p);return}}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+p)}function Y(T,p){const N=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Se(N,T,p);return}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+p)}function $(T,p){const N=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Se(N,T,p);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+p)}function te(T,p){const N=n.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&N.__version!==T.version){Ge(N,T,p);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+p)}const we={[la]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[ca]:i.MIRRORED_REPEAT},De={[It]:i.NEAREST,[zc]:i.NEAREST_MIPMAP_NEAREST,[gr]:i.NEAREST_MIPMAP_LINEAR,[Bt]:i.LINEAR,[Ss]:i.LINEAR_MIPMAP_NEAREST,[ei]:i.LINEAR_MIPMAP_LINEAR},nt={[kc]:i.NEVER,[Zc]:i.ALWAYS,[Wc]:i.LESS,[Qa]:i.LEQUAL,[Xc]:i.EQUAL,[ja]:i.GEQUAL,[qc]:i.GREATER,[Yc]:i.NOTEQUAL};function Ke(T,p){if(p.type===xn&&e.has("OES_texture_float_linear")===!1&&(p.magFilter===Bt||p.magFilter===Ss||p.magFilter===gr||p.magFilter===ei||p.minFilter===Bt||p.minFilter===Ss||p.minFilter===gr||p.minFilter===ei)&&We("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,we[p.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,we[p.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&&i.texParameteri(T,i.TEXTURE_WRAP_R,we[p.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,De[p.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,De[p.minFilter]),p.compareFunction&&(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,nt[p.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(p.magFilter===It||p.minFilter!==gr&&p.minFilter!==ei||p.type===xn&&e.has("OES_texture_float_linear")===!1)return;if(p.anisotropy>1||n.get(p).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");i.texParameterf(T,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(p.anisotropy,r.getMaxAnisotropy())),n.get(p).__currentAnisotropy=p.anisotropy}}}function He(T,p){let N=!1;T.__webglInit===void 0&&(T.__webglInit=!0,p.addEventListener("dispose",R));const G=p.source;let W=h.get(G);W===void 0&&(W={},h.set(G,W));const ie=K(p);if(ie!==T.__cacheKey){W[ie]===void 0&&(W[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),W[ie].usedTimes++;const ae=W[T.__cacheKey];ae!==void 0&&(W[T.__cacheKey].usedTimes--,ae.usedTimes===0&&P(p)),T.__cacheKey=ie,T.__webglTexture=W[ie].texture}return N}function Z(T,p,N){return Math.floor(Math.floor(T/N)/p)}function j(T,p,N,G){const ie=T.updateRanges;if(ie.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,p.width,p.height,N,G,p.data);else{ie.sort((be,le)=>be.start-le.start);let ae=0;for(let be=1;be<ie.length;be++){const le=ie[ae],oe=ie[be],ve=le.start+le.count,Ie=Z(oe.start,p.width,4),ke=Z(le.start,p.width,4);oe.start<=ve+1&&Ie===ke&&Z(oe.start+oe.count-1,p.width,4)===Ie?le.count=Math.max(le.count,oe.start+oe.count-le.start):(++ae,ie[ae]=oe)}ie.length=ae+1;const X=t.getParameter(i.UNPACK_ROW_LENGTH),J=t.getParameter(i.UNPACK_SKIP_PIXELS),se=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,p.width);for(let be=0,le=ie.length;be<le;be++){const oe=ie[be],ve=Math.floor(oe.start/4),Ie=Math.ceil(oe.count/4),ke=ve%p.width,D=Math.floor(ve/p.width),ue=Ie,Q=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,ke),t.pixelStorei(i.UNPACK_SKIP_ROWS,D),t.texSubImage2D(i.TEXTURE_2D,0,ke,D,ue,Q,N,G,p.data)}T.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,X),t.pixelStorei(i.UNPACK_SKIP_PIXELS,J),t.pixelStorei(i.UNPACK_SKIP_ROWS,se)}}function Se(T,p,N){let G=i.TEXTURE_2D;(p.isDataArrayTexture||p.isCompressedArrayTexture)&&(G=i.TEXTURE_2D_ARRAY),p.isData3DTexture&&(G=i.TEXTURE_3D);const W=He(T,p),ie=p.source;t.bindTexture(G,T.__webglTexture,i.TEXTURE0+N);const ae=n.get(ie);if(ie.version!==ae.__version||W===!0){if(t.activeTexture(i.TEXTURE0+N),(typeof ImageBitmap<"u"&&p.image instanceof ImageBitmap)===!1){const Q=st.getPrimaries(st.workingColorSpace),ce=p.colorSpace
4196===Wn?null:st.getPrimaries(p.colorSpace),de=p.colorSpace===Wn||Q===ce?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,de)}t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment);let J=m(p.image,!1,r.maxTextureSize);J=ut(p,J);const se=s.convert(p.format,p.colorSpace),be=s.convert(p.type);let le=M(p.internalFormat,se,be,p.normalized,p.colorSpace,p.isVideoTexture);Ke(G,p);let oe;const ve=p.mipmaps,Ie=p.isVideoTexture!==!0,ke=ae.__version===void 0||W===!0,D=ie.dataReady,ue=y(p,J);if(p.isDepthTexture)le=A(p.format===ti,p.type),ke&&(Ie?t.texStorage2D(i.TEXTURE_2D,1,le,J.width,J.height):t.texImage2D(i.TEXTURE_2D,0,le,J.width,J.height,0,se,be,null));else if(p.isDataTexture)if(ve.length>0){Ie&&ke&&t.texStorage2D(i.TEXTURE_2D,ue,le,ve[0].width,ve[0].height);for(let Q=0,ce=ve.length;Q<ce;Q++)oe=ve[Q],Ie?D&&t.texSubImage2D(i.TEXTURE_2D,Q,0,0,oe.width,oe.height,se,be,oe.data):t.texImage2D(i.TEXTURE_2D,Q,le,oe.width,oe.height,0,se,be,oe.data);p.generateMipmaps=!1}else Ie?(ke&&t.texStorage2D(i.TEXTURE_2D,ue,le,J.width,J.height),D&&j(p,J,se,be)):t.texImage2D(i.TEXTURE_2D,0,le,J.width,J.height,0,se,be,J.data);else if(p.isCompressedTexture)if(p.isCompressedArrayTexture){Ie&&ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ue,le,ve[0].width,ve[0].height,J.depth);for(let Q=0,ce=ve.length;Q<ce;Q++)if(oe=ve[Q],p.format!==un)if(se!==null)if(Ie){if(D)if(p.layerUpdates.size>0){const de=Zo(oe.width,oe.height,p.format,p.type);for(const ne of p.layerUpdates){const Ue=oe.data.subarray(ne*de/oe.data.BYTES_PER_ELEMENT,(ne+1)*de/oe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Q,0,0,ne,oe.width,oe.height,1,se,Ue)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Q,0,0,0,oe.width,oe.height,J.depth,se,oe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Q,le,oe.width,oe.height,J.depth,0,oe.data,0,0);else We("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?D&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Q,0,0,0,oe.width,oe.height,J.depth,se,be,oe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Q,le,oe.width,oe.height,J.depth,0,se,be,oe.data);p.layerUpdates.size>0&&p.clearLayerUpdates()}else{Ie&&ke&&t.texStorage2D(i.TEXTURE_2D,ue,le,ve[0].width,ve[0].height);for(let Q=0,ce=ve.length;Q<ce;Q++)oe=ve[Q],p.format!==un?se!==null?Ie?D&&t.compressedTexSubImage2D(i.TEXTURE_2D,Q,0,0,oe.width,oe.height,se,oe.data):t.compressedTexImage2D(i.TEXTURE_2D,Q,le,oe.width,oe.height,0,oe.data):We("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ie?D&&t.texSubImage2D(i.TEXTURE_2D,Q,0,0,oe.width,oe.height,se,be,oe.data):t.texImage2D(i.TEXTURE_2D,Q,le,oe.width,oe.height,0,se,be,oe.data)}else if(p.isDataArrayTexture)if(Ie){if(ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ue,le,J.width,J.height,J.depth),D)if(p.layerUpdates.size>0){const Q=Zo(J.width,J.height,p.format,p.type);for(const ce of p.layerUpdates){const de=J.data.subarray(ce*Q/J.data.BYTES_PER_ELEMENT,(ce+1)*Q/J.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ce,J.width,J.height,1,se,be,de)}p.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,se,be,J.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,le,J.width,J.height,J.depth,0,se,be,J.data);else if(p.isData3DTexture)Ie?(ke&&t.texStorage3D(i.TEXTURE_3D,ue,le,J.width,J.height,J.depth),D&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,se,be,J.data)):t.texImage3D(i.TEXTURE_3D,0,le,J.width,J.height,J.depth,0,se,be,J.data);else if(p.isFramebufferTexture){if(ke)if(Ie)t.texStorage2D(i.TEXTURE_2D,ue,le,J.width,J.height);else{let Q=J.width,ce=J.height;for(let de=0;de<ue;de++)t.texImage2D(i.TEXTURE_2D,de,le,Q,ce,0,se,be,null),Q>>=1,ce>>=1}}else if(p.isHTMLTexture){if("texElementImage2D"in i){const Q=i.canvas;if(Q.hasAttribute("layoutsubtree")||Q.setAttribute("layoutsubtree","true"),J.parentNode!==Q){Q.appendChild(J),g.add(p),Q.onpaint=ce=>{const de=ce.changedElements;for(const ne of g)de.includes(ne.image)&&(ne.needsUpdate=!0)},Q.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,J);else{const de=i.RGBA,ne=i.RGBA,Ue=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,de,ne,Ue,J)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(ve.length>0){if(Ie&&ke){const Q=Ze(ve[0]);t.texStorage2D(i.TEXTURE_2D,ue,le,Q.width,Q.height)}for(let Q=0,ce=ve.length;Q<ce;Q++)oe=ve[Q],Ie?D&&t.texSubImage2D(i.TEXTURE_2D,Q,0,0,se,be,oe):t.texImage2D(i.TEXTURE_2D,Q,le,se,be,oe);p.generateMipmaps=!1}else if(Ie){if(ke){const Q=Ze(J);t.texStorage2D(i.TEXTURE_2D,ue,le,Q.width,Q.height)}D&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,se,be,J)}else t.texImage2D(i.TEXTURE_2D,0,le,se,be,J);f(p)&&E(G),ae.__version=ie.version,p.onUpdate&&p.onUpdate(p)}T.__version=p.version}function Ge(T,p,N){if(p.image.length!==6)return;const G=He(T,p),W=p.source;t.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+N);const ie=n.get(W);if(W.version!==ie.__version||G===!0){t.activeTexture(i.TEXTURE0+N);
vendor: 28,088 bytes, lines 4196-4220
4196const ae=st.getPrimaries(st.workingColorSpace),X=p.colorSpace===Wn?null:st.getPrimaries(p.colorSpace),J=p.colorSpace===Wn||ae===X?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,J);const se=p.isCompressedTexture||p.image[0].isCompressedTexture,be=p.image[0]&&p.image[0].isDataTexture,le=[];for(let ne=0;ne<6;ne++)!se&&!be?le[ne]=m(p.image[ne],!0,r.maxCubemapSize):le[ne]=be?p.image[ne].image:p.image[ne],le[ne]=ut(p,le[ne]);const oe=le[0],ve=s.convert(p.format,p.colorSpace),Ie=s.convert(p.type),ke=M(p.internalFormat,ve,Ie,p.normalized,p.colorSpace),D=p.isVideoTexture!==!0,ue=ie.__version===void 0||G===!0,Q=W.dataReady;let ce=y(p,oe);Ke(i.TEXTURE_CUBE_MAP,p);let de;if(se){D&&ue&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ce,ke,oe.width,oe.height);for(let ne=0;ne<6;ne++){de=le[ne].mipmaps;for(let Ue=0;Ue<de.length;Ue++){const Ce=de[Ue];p.format!==un?ve!==null?D?Q&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue,0,0,Ce.width,Ce.height,ve,Ce.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue,ke,Ce.width,Ce.height,0,Ce.data):We("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?Q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue,0,0,Ce.width,Ce.height,ve,Ie,Ce.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue,ke,Ce.width,Ce.height,0,ve,Ie,Ce.data)}}}else{if(de=p.mipmaps,D&&ue){de.length>0&&ce++;const ne=Ze(le[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ce,ke,ne.width,ne.height)}for(let ne=0;ne<6;ne++)if(be){D?Q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,le[ne].width,le[ne].height,ve,Ie,le[ne].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,ke,le[ne].width,le[ne].height,0,ve,Ie,le[ne].data);for(let Ue=0;Ue<de.length;Ue++){const ht=de[Ue].image[ne].image;D?Q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue+1,0,0,ht.width,ht.height,ve,Ie,ht.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue+1,ke,ht.width,ht.height,0,ve,Ie,ht.data)}}else{D?Q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,ve,Ie,le[ne]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,ke,ve,Ie,le[ne]);for(let Ue=0;Ue<de.length;Ue++){const Ce=de[Ue];D?Q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue+1,0,0,ve,Ie,Ce.image[ne]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ue+1,ke,ve,Ie,Ce.image[ne])}}}f(p)&&E(i.TEXTURE_CUBE_MAP),ie.__version=W.version,p.onUpdate&&p.onUpdate(p)}T.__version=p.version}function fe(T,p,N,G,W,ie){const ae=s.convert(N.format,N.colorSpace),X=s.convert(N.type),J=M(N.internalFormat,ae,X,N.normalized,N.colorSpace),se=n.get(p),be=n.get(N);if(be.__renderTarget=p,!se.__hasExternalTextures){const le=Math.max(1,p.width>>ie),oe=Math.max(1,p.height>>ie);W===i.TEXTURE_3D||W===i.TEXTURE_2D_ARRAY?t.texImage3D(W,ie,J,le,oe,p.depth,0,ae,X,null):t.texImage2D(W,ie,J,le,oe,0,ae,X,null)}t.bindFramebuffer(i.FRAMEBUFFER,T),je(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,G,W,be.__webglTexture,0,ze(p)):(W===i.TEXTURE_2D||W>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&W<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,G,W,be.__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function re(T,p,N){if(i.bindRenderbuffer(i.RENDERBUFFER,T),p.depthBuffer){const G=p.depthTexture,W=G&&G.isDepthTexture?G.type:null,ie=A(p.stencilBuffer,W),ae=p.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;je(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ze(p),ie,p.width,p.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,ze(p),ie,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,ie,p.width,p.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ae,i.RENDERBUFFER,T)}else{const G=p.textures;for(let W=0;W<G.length;W++){const ie=G[W],ae=s.convert(ie.format,ie.colorSpace),X=s.convert(ie.type),J=M(ie.internalFormat,ae,X,ie.normalized,ie.colorSpace);je(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ze(p),J,p.width,p.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,ze(p),J,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,J,p.width,p.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ne(T,p,N){const G=p.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,T),!(p.depthTexture&&p.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const W=n.get(p.depthTexture);if(W.__renderTarget=p,(!W.__webglTexture||p.depthTexture.image.width!==p.width||p.depthTexture.image.height!==p.height)&&(p.depthTexture.image.width=p.width,p.depthTexture.image.height=p.height,p.depthTexture.needsUpdate=!0),G){if(W.__webglInit===void 0&&(W.__webglInit=!0,p.depthTexture.addEventListener("dispose",R)),W.__webglTexture===void 0){W.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,W.__webglTexture),Ke(i.TEXTURE_CUBE_MAP,p.depthTexture);const se=s.convert(p.depthTexture.format),be=s.convert(p.depthTexture.type);let le;p.depthTexture.format===Un?le=i.DEPTH_COMPONENT24:p.depthTexture.format===ti&&(le=i.DEPTH24_STENCIL8);for(let oe=0;oe<6;oe++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,le,p.width,p.height,0,se,be,null)}}else ee(p.depthTexture,0);const ie=W.__webglTexture,ae=ze(p),X=G?i.TEXTURE_CUBE_MAP_POSITIVE_X+N:i.TEXTURE_2D,J=p.depthTexture.format===ti?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(p.depthTexture.format===Un)je(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,X,ie,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,J,X,ie,0);else if(p.depthTexture.format===ti)je(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,X,ie,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,J,X,ie,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function xe(T){const p=n.get(T),N=T.isWebGLCubeRenderTarget===!0;if(p.__boundDepthTexture!==T.depthTexture){const G=T.depthTexture;if(p.__depthDisposeCallback&&p.__depthDisposeCallback(),G){const W=()=>{delete p.__boundDepthTexture,delete p.__depthDisposeCallback,G.removeEventListener("dispose",W)};G.addEventListener("dispose",W),p.__depthDisposeCallback=W}p.__boundDepthTexture=G}if(T.depthTexture&&!p.__autoAllocateDepthBuffer)if(N)for(let G=0;G<6;G++)Ne(p.__webglFramebuffer[G],T,G);else{const G=T.texture.mipmaps;G&&G.length>0?Ne(p.__webglFramebuffer[0],T,0):Ne(p.__webglFramebuffer,T,0)}else if(N){p.__webglDepthbuffer=[];for(let G=0;G<6;G++)if(t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[G]),p.__webglDepthbuffer[G]===void 0)p.__webglDepthbuffer[G]=i.createRenderbuffer(),re(p.__webglDepthbuffer[G],T,!1);else{const W=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=p.__webglDepthbuffer[G];i.bindRenderbuffer(i.RENDERBUFFER,ie),i.framebufferRenderbuffer(i.FRAMEBUFFER,W,i.RENDERBUFFER,ie)}}else{const G=T.texture.mipmaps;if(G&&G.length>0?t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer),p.__webglDepthbuffer===void 0)p.__webglDepthbuffer=i.createRenderbuffer(),re(p.__webglDepthbuffer,T,!1);else{const W=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=p.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ie),i.framebufferRenderbuffer(i.FRAMEBUFFER,W,i.RENDERBUFFER,ie)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Re(T,p,N){const G=n.get(T);p!==void 0&&fe(G.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&xe(T)}function Ve(T){const p=T.texture,N=n.get(T),G=n.get(p);T.addEventListener("dispose",_);const W=T.textures,ie=T.isWebGLCubeRenderTarget===!0,ae=W.length>1;if(ae||(G.__webglTexture===void 0&&(G.__webglTexture=i.createTexture()),G.__version=p.version,a.memory.textures++),ie){N.__webglFramebuffer=[];for(let X=0;X<6;X++)if(p.mipmaps&&p.mipmaps.length>0){N.__webglFramebuffer[X]=[];for(let J=0;J<p.mipmaps.length;J++)N.__webglFramebuffer[X][J]=i.createFramebuffer()}else N.__webglFramebuffer[X]=i.createFramebuffer()}else{if(p.mipmaps&&p.mipmaps.length>0){N.__webglFramebuffer=[];for(let X=0;X<p.mipmaps.length;X++)N.__webglFramebuffer[X]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(ae)for(let X=0,J=W.length;X<J;X++){const se=n.get(W[X]);se.__webglTexture===void 0&&(se.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples>0&&je(T)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let X=0;X<W.length;X++){const J=W[X];N.__webglColorRenderbuffer[X]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[X]);const se=s.convert(J.format,J.colorSpace),be=s.convert(J.type),le=M(J.internalFormat,se,be,J.normalized,J.colorSpace,T.isXRRenderTarget===!0),oe=ze(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,le,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+X,i.RENDERBUFFER,N.__webglColorRenderbuffer[X])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),re(N.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,G.__webglTexture),Ke(i.TEXTURE_CUBE_MAP,p);for(let X=0;X<6;X++)if(p.mipmaps&&p.mipmaps.length>0)for(let J=0;J<p.mipmaps.length;J++)fe(N.__webglFramebuffer[X][J],T,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+X,J);else fe(N.__webglFramebuffer[X],T,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);f(p)&&E(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ae){for(let X=0,J=W.length;X<J;X++){const se=W[X],be=n.get(se);let le=i.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(le=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(le,be.__webglTexture),Ke(le,se),fe(N.__webglFramebuffer,T,se,i.COLOR_ATTACHMENT0+X,le,0),f(se)&&E(le)}t.unbindTexture()}else{let X=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(X=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(X,G.__webglTexture),Ke(X,p),p.mipmaps&&p.mipmaps.length>0)for(let J=0;J<p.mipmaps.length;J++)fe(N.__webglFramebuffer[J],T,p,i.COLOR_ATTACHMENT0,X,J);else fe(N.__webglFramebuffer,T,p,i.COLOR_ATTACHMENT0,X,0);f(p)&&E(X),t.unbindTexture()}T.depthBuffer&&xe(T)}function Be(T){const p=T.textures;for(let N=0,G=p.length;N<G;N++){const W=p[N];if(f(W)){const ie=w(T),ae=n.get(W).__webglTexture;t.bindTexture(ie,ae),E(ie),t.unbindTexture()}}}const ye=[],qe=[];function it(T){if(T.samples>0){if(je(T)===!1){const p=T.textures,N=T.width,G=T.height;let W=i.COLOR_BUFFER_BIT;const ie=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=n.get(T),X=p.length>1;if(X)for(let se=0;se<p.length;se++)t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ae.__webglMultisampledFramebuffer);const J=T.texture.mipmaps;J&&J.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ae.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ae.__webglFramebuffer);for(let se=0;se<p.length;se++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(W|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(W|=i.STENCIL_BUFFER_BIT)),X){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ae.__webglColorRenderbuffer[se]);const be=n.get(p[se]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,be,0)}i.blitFramebuffer(0,0,N,G,0,0,N,G,W,i.NEAREST),c===!0&&(ye.length=0,qe.length=0,ye.push(i.COLOR_ATTACHMENT0+se),T.depthBuffer&&T.storeMultisampledDepthBuffer===!1&&(ye.push(ie),qe.push(ie),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,qe)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ye))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),X)for(let se=0;se<p.length;se++){t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,ae.__webglColorRenderbuffer[se]);const be=n.get(p[se]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,be,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ae.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.storeMultisampledDepthBuffer===!1&&c){const p=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[p])}}}function ze(T){return Math.min(r.maxSamples,T.samples)}function je(T){const p=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&p.__useRenderToTexture!==!1}function C(T){const p=a.render.frame;d.get(T)!==p&&(d.set(T,p),T.update())}function ut(T,p){const N=T.colorSpace,G=T.format,W=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||N!==ss&&N!==Wn&&(st.getTransfer(N)===dt?(G!==un||W!==nn)&&We("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):lt("WebGLTextures: Unsupported texture color space:",N)),p}function Ze(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(l.width=T.naturalWidth||T.width,l.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(l.width=T.displayWidth,l.height=T.displayHeight):(l.width=T.width,l.height=T.height),l}this.allocateTextureUnit=q,this.resetTextureUnits=H,this.getTextureUnits=U,this.setTextureUnits=V,this.setTexture2D=ee,this.setTexture2DArray=Y,this.setTexture3D=$,this.setTextureCube=te,this.rebindTextures=Re,this.setupRenderTarget=Ve,this.updateRenderTargetMipmap=Be,this.updateMultisampleRenderTarget=it,this.setupDepthRenderbuffer=xe,this.setupFrameBufferTexture=fe,this.useMultisampledRTT=je,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Hm(i,e){function t(n,r=Wn){let s;const a=st.getTransfer(r);if(n===nn)return i.UNSIGNED_BYTE;if(n===Ya)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Za)return i.UNSIGNED_SHORT_5_5_5_1;if(n===zl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Gl)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ol)return i.BYTE;if(n===Bl)return i.SHORT;if(n===or)return i.UNSIGNED_SHORT;if(n===qa)return i.INT;if(n===Sn)return i.UNSIGNED_INT;if(n===xn)return i.FLOAT;if(n===En)return i.HALF_FLOAT;if(n===Hl)return i.ALPHA;if(n===Vl)return i.RGB;if(n===un)return i.RGBA;if(n===Un)return i.DEPTH_COMPONENT;if(n===ti)return i.DEPTH_STENCIL;if(n===kl)return i.RED;if(n===Ka)return i.RED_INTEGER;if(n===ri)return i.RG;if(n===$a)return i.RG_INTEGER;if(n===Ja)return i.RGBA_INTEGER;if(n===$r||n===Jr||n===Qr||n===jr)if(a===dt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===$r)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Qr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===$r)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Jr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Qr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===jr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ua||n===fa||n===ha||n===da)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ua)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===fa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ha)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===da)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===pa||n===ma||n===ga||n===_a||n===xa||n===is||n===va)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===pa||n===ma)return a===dt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ga)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===_a)return s.COMPRESSED_R11_EAC;if(n===xa)return s.COMPRESSED_SIGNED_R11_EAC;if(n===is)return s.COMPRESSED_RG11_EAC;if(n===va)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Ma||n===Sa||n===Ea||n===ya||n===ba||n===Ta||n===Aa||n===wa||n===Ra||n===Ca||n===Pa||n===La||n===Da||n===Ia)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Ma)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Sa)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ea)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ya)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ba)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ta)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Aa)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wa)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ra)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ca)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pa)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===La)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Da)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ia)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ua||n===Na||n===Fa)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ua)return a===dt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Na)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Fa)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Oa||n===Ba||n===rs||n===za)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Oa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ba)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===rs)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===za)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===lr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Vm=` 4197void main() { 4198 4199 gl_Position = vec4( position, 1.0 ); 4200 4201}`,km=` 4202uniform sampler2DArray depthColor; 4203uniform float depthWidth; 4204uniform float depthHeight; 4205 4206void main() { 4207 4208 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4209 4210 if ( coord.x >= 1.0 ) { 4211 4212 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4213 4214 } else { 4215 4216 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4217 4218 } 4219 4220}`;class Wm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ec(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new rn({vertexShader:Vm,fragmentShader:km,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Wt(new gs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Xm extends ai{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,d=null,g=null,u=null,h=null,x=null;const S=typeof XRWebGLBinding<"u",m=new Wm,f={},E=t.getContextAttributes();let w=null,M=null;const A=[],y=[],R=new $e;let _=null,b=null;const P=new tn;P.viewport=new yt;const I=new tn;I.viewport=new yt;const O=[P,I],H=new Qu;let U=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let j=A[Z];return j===void 0&&(j=new Rs,A[Z]=j),j.getTargetRaySpace()},this.getControllerGrip=function(Z){let j=A[Z];return j===void 0&&(j=new Rs,A[Z]=j),j.getGripSpace()},this.getHand=function(Z){let j=A[Z];return j===void 0&&(j=new Rs,A[Z]=j),j.getHandSpace()};function q(Z){const j=y.indexOf(Z.inputSource);if(j===-1)return;const Se=A[j];Se!==void 0&&(Se.update(Z.inputSource,Z.frame,l||a),Se.dispatchEvent({type:Z.type,data:Z.inputSource}))}function K(){r.removeEventListener("select",q),r.removeEventListener("selectstart",q),r.removeEventListener("selectend",q),r.removeEventListener("squeeze",q),r.removeEventListener("squeezestart",q),r.removeEventListener("squeezeend",q),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",ee);for(let Z=0;Z<A.length;Z++){const j=y[Z];j!==null&&(y[Z]=null,A[Z].disconnect(j))}U=null,V=null,m.reset();for(const Z in f)delete f[Z];if(e.setRenderTarget(w),h=null,u=null,g=null,r=null,M=null,He.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(R.width,R.height,!1),b!==null){const Z=b.camera;Z.fov=b.fov,Z.zoom=b.zoom,Z.updateProjectionMatrix(),b=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){s=Z,n.isPresenting===!0&&We("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,n.isPresenting===!0&&We("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Z){l=Z},this.getBaseLayer=function(){return u!==null?u:h},this.getBinding=function(){return g===null&&S&&(g=new XRWebGLBinding(r,t)),g},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function(Z){if(r=Z,r!==null){if(w=e.getRenderTarget(),r.addEventListener("select",q),r.addEventListener("selectstart",q),r.addEventListener("selectend",q),r.addEventListener("squeeze",q),r.addEventListener("squeezestart",q),r.addEventListener("squeezeend",q),r.addEventListener("end",K),r.addEventListener("inputsourceschange",ee),E.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(R),S&&"createProjectionLayer"in XRWebGLBinding.prototype){let Se=null,Ge=null,fe=null;E.depth&&(fe=E.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Se=E.stencil?ti:Un,Ge=E.stencil?lr:Sn);const re={colorFormat:t.RGBA8,depthFormat:fe,scaleFactor:s};g=this.getBinding(),u=g.createProjectionLayer(re),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new fn(u.textureWidth,u.textureHeight,{format:un,type:nn,depthTexture:new ur(u.textureWidth,u.textureHeight,Ge,void 0,void 0,void 0,void 0,void 0,void 0,Se),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1,storeMultisampledDepthBuffer:u.ignoreDepthValues===!1,storeMultisampledStencilBuffer:u.ignoreDepthValues===!1})}else{const Se={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:s};h=new XRWebGLLayer(r,t,Se),r.updateRenderState({baseLayer:h}),e.setPixelRatio(1),e.setSize(h.framebufferWidth,h.framebufferHeight,!1),M=new fn(h.framebufferWidth,h.framebufferHeight,{format:un,type:nn,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1,storeMultisampledDepthBuffer:h.ignoreDepthValues===!1,storeMultisampledStencilBuffer:h.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),He.setContext(r),He.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function ee(Z){for(let j=0;j<Z.removed.length;j++){const Se=Z.removed[j],Ge=y.indexOf(Se);Ge>=0&&(y[Ge]=null,A[Ge].disconnect(Se))}for(let j=0;j<Z.added.length;j++){const Se=Z.added[j];let Ge=y.indexOf(Se);if(Ge===-1){for(let re=0;re<A.length;re++)if(re>=y.length){y.push(Se),Ge=re;break}else if(y[re]===null){y[re]=Se,Ge=re;break}if(Ge===-1)break}const fe=A[Ge];fe&&fe.connect(Se)}}const Y=new F,$=new F;function te(Z,j,Se){Y.setFromMatrixPosition(j.matrixWorld),$.setFromMatrixPosition(Se.matrixWorld);const Ge=Y.distanceTo($),fe=j.projectionMatrix.elements,re=Se.projectionMatrix.elements,Ne=fe[14]/(fe[10]-1),xe=fe[14]/(fe[10]+1),Re=(fe[9]+1)/fe[5],Ve=(fe[9]-1)/fe[5],Be=(fe[8]-1)/fe[0],ye=(re[8]+1)/re[0],qe=Ne*Be,it=Ne*ye,ze=Ge/(-Be+ye),je=ze*-Be;if(j.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(je),Z.translateZ(ze),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),fe[10]===-1)Z.projectionMatrix.copy(j.projectionMatrix),Z.projectionMatrixInverse.copy(j.projectionMatrixInverse);else{const C=Ne+ze,ut=xe+ze,Ze=qe-je,T=it+(Ge-je),p=Re*xe/ut*C,N=Ve*xe/ut*C;Z.projectionMatrix.makePerspective(Ze,T,p,N,C,ut),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function we(Z,j){j===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(j.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(r===null)return;let j=Z.near,Se=Z.far;m.texture!==null&&(m.depthNear>0&&(j=m.depthNear),m.depthFar>0&&(Se=m.depthFar)),H.near=I.near=P.near=j,H.far=I.far=P.far=Se,(U!==H.near||V!==H.far)&&(r.updateRenderState({depthNear:H.near,depthFar:H.far}),U=H.near,V=H.far),H.layers.mask=Z.layers.mask|6,P.layers.mask=H.layers.mask&-5,I.layers.mask=H.layers.mask&-3;const Ge=Z.parent,fe=H.cameras;we(H,Ge);for(let re=0;re<fe.length;re++)we(fe[re],Ge);fe.length===2?te(H,P,I):H.projectionMatrix.copy(P.projectionMatrix),b===null&&Z.isPerspectiveCamera&&(b={camera:Z,fov:Z.fov,zoom:Z.zoom}),De(Z,H,Ge)};function De(Z,j,Se){Se===null?Z.matrix.copy(j.matrixWorld):(Z.matrix.copy(Se.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(j.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(j.projectionMatrix),Z.projectionMatrixInverse.copy(j.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=cr*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return H},this.getFoveation=function(){if(!(u===null&&h===null))return c},this.setFoveation=function(Z){c=Z,u!==null&&(u.fixedFoveation=Z),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=Z)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(H)},this.getCameraTexture=function(Z){return f[Z]};let nt=null;function Ke(Z,j){if(d=j.getViewerPose(l||a),x=j,d!==null){const Se=d.views;h!==null&&(e.setRenderTargetFramebuffer(M,h.framebuffer),e.setRenderTarget(M));let Ge=!1;Se.length!==H.cameras.length&&(H.cameras.length=0,Ge=!0);for(let xe=0;xe<Se.length;xe++){const Re=Se[xe];let Ve=null;if(h!==null)Ve=h.getViewport(Re);else{const ye=g.getViewSubImage(u,Re);Ve=ye.viewport,xe===0&&(e.setRenderTargetTextures(M,ye.colorTexture,ye.depthStencilTexture),e.setRenderTarget(M))}let Be=O[xe];Be===void 0&&(Be=new tn,Be.layers.enable(xe),Be.viewport=new yt,O[xe]=Be),Be.matrix.fromArray(Re.transform.matrix),Be.matrix.decompose(Be.position,Be.quaternion,Be.scale),Be.projectionMatrix.fromArray(Re.projectionMatrix),Be.projectionMatrixInverse.copy(Be.projectionMatrix).invert(),Be.viewport.set(Ve.x,Ve.y,Ve.width,Ve.height),xe===0&&(H.matrix.copy(Be.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale)),Ge===!0&&H.cameras.push(Be)}const fe=r.enabledFeatures;if(fe&&fe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&S){g=n.getBinding();const xe=g.getDepthInformation(Se[0]);xe&&xe.isValid&&xe.texture&&m.init(xe,r.renderState)}if(fe&&fe.includes("camera-access")&&S){e.state.unbindTexture(),g=n.getBinding();for(let xe=0;xe<Se.length;xe++){const Re=Se[xe].camera;if(Re){let Ve=f[Re];Ve||(Ve=new ec,f[Re]=Ve);const Be=g.getCameraImage(Re);Ve.sourceTexture=Be}}}}for(let Se=0;Se<A.length;Se++){const Ge=y[Se],fe=A[Se];
vendor: 5,308 bytes, line 4220
4220Ge!==null&&fe!==void 0&&fe.update(Ge,j,l||a)}nt&&nt(Z,j),j.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:j}),x=null}const He=new rc;He.setAnimationLoop(Ke),this.setAnimationLoop=function(Z){nt=Z},this.dispose=function(){}}}const qm=new Et,fc=new Ye;fc.set(-1,0,0,0,1,0,0,0,1);function Ym(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,tc(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,E,w,M){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(m,f):f.isMeshLambertMaterial?(s(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(m,f),g(m,f)):f.isMeshPhongMaterial?(s(m,f),d(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(m,f),u(m,f),f.isMeshPhysicalMaterial&&h(m,f,M)):f.isMeshMatcapMaterial?(s(m,f),x(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),S(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?c(m,f,E,w):f.isSpriteMaterial?l(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===qt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===qt&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const E=e.get(f),w=E.envMap,M=E.envMapRotation;w&&(m.envMap.value=w,m.envMapRotation.value.setFromMatrix4(qm.makeRotationFromEuler(M)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(fc),m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function c(m,f,E,w){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*E,m.scale.value=w*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function d(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function g(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function h(m,f,E){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===qt&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.retroreflectivity>0&&(m.retroreflectivity.value=f.retroreflectivity),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.
4220iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function x(m,f){f.matcap&&(m.matcap.value=f.matcap)}function S(m,f){const E=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Zm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,A){const y=A.program;n.uniformBlockBinding(M,y)}function l(M,A){let y=r[M.id];y===void 0&&(m(M),y=d(M),r[M.id]=y,M.addEventListener("dispose",E));const R=A.program;n.updateUBOMapping(M,R);const _=e.render.frame;s[M.id]!==_&&(u(M),s[M.id]=_)}function d(M){const A=g();M.__bindingPointIndex=A;const y=i.createBuffer(),R=M.__size,_=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,R,_),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,A,y),y}function g(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return lt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(M){const A=r[M.id],y=M.uniforms,R=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let _=0,b=y.length;_<b;_++){const P=y[_];if(Array.isArray(P))for(let I=0,O=P.length;I<O;I++)h(P[I],_,I,R);else h(P,_,0,R)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function h(M,A,y,R){if(S(M,A,y,R)===!0){const _=M.__offset,b=M.value;if(Array.isArray(b)){let P=0;for(let I=0;I<b.length;I++){const O=b[I],H=f(O);x(O,M.__data,P),typeof O!="number"&&typeof O!="boolean"&&!O.isMatrix3&&!ArrayBuffer.isView(O)&&(P+=H.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(b,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,_,M.__data)}}function x(M,A,y){typeof M=="number"||typeof M=="boolean"?A[0]=M:M.isMatrix3?(A[0]=M.elements[0],A[1]=M.elements[1],A[2]=M.elements[2],A[3]=0,A[4]=M.elements[3],A[5]=M.elements[4],A[6]=M.elements[5],A[7]=0,A[8]=M.elements[6],A[9]=M.elements[7],A[10]=M.elements[8],A[11]=0):ArrayBuffer.isView(M)?A.set(new M.constructor(M.buffer,M.byteOffset,A.length)):M.toArray(A,y)}function S(M,A,y,R){const _=M.value,b=A+"_"+y;if(R[b]===void 0)return typeof _=="number"||typeof _=="boolean"?R[b]=_:ArrayBuffer.isView(_)?R[b]=_.slice():R[b]=_.clone(),!0;{const P=R[b];if(typeof _=="number"||typeof _=="boolean"){if(P!==_)return R[b]=_,!0}else{if(ArrayBuffer.isView(_))return!0;if(P.equals(_)===!1)return P.copy(_),!0}}return!1}function m(M){const A=M.uniforms;let y=0;const R=16;for(let b=0,P=A.length;b<P;b++){const I=Array.isArray(A[b])?A[b]:[A[b]];for(let O=0,H=I.length;O<H;O++){const U=I[O],V=Array.isArray(U.value)?U.value:[U.value];for(let q=0,K=V.length;q<K;q++){const ee=V[q],Y=f(ee),$=y%R,te=$%Y.boundary,we=$+te;y+=te,we!==0&&R-we<Y.storage&&(y+=R-we),U.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=y,y+=Y.storage}}}const _=y%R;return _>0&&(y+=R-_),M.__size=y,M.__cache={},this}function f(M){const A={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(A.boundary=4,A.storage=4):M.isVector2?(A.boundary=8,A.storage=8):M.isVector3||M.isColor?(A.boundary=16,A.storage=12):M.isVector4?(A.boundary=16,A.storage=16):M.isMatrix3?(A.boundary=48,A.storage=48):M.isMatrix4?(A.boundary=64,A.storage=64):M.isTexture?We("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(A.boundary=16,A.storage=M.byteLength):We("WebGLRenderer: Unsupported uniform value type.",M),A}function E(M){const A=M.target;A.removeEventListener("dispose",E);const y=a.indexOf(A.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function w(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:c,update:l,dispose:w}}const Km=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10
4220751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let mn=null;function $m(){return mn===null&&(mn=new Ou(Km,16,16,ri,En),mn.name="DFG_LUT",mn.minFilter=Bt,mn.magFilter=Bt,mn.wrapS=Pn,mn.wrapT=Pn,mn.generateMipmaps=!1,mn.needsUpdate=!0),mn}class Jm{constructor(e={}){const{canvas:t=$c(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:u=!1,outputBufferType:h=nn}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;const S=h,m=new Set([Ja,$a,Ka]),f=new Set([nn,Sn,or,lr,Ya,Za]),E=new Uint32Array(4),w=new Int32Array(4),M=new F;let A=null,y=null;const R=[],_=[];let b=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Mn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let I=!1,O=null,H=null,U=null,V=null;this._outputColorSpace=Xt;let q=0,K=0,ee=null,Y=-1,$=null;const te=new yt,we=new yt;let De=null;const nt=new Xe(0);let Ke=0,He=t.width,Z=t.height,j=1,Se=null,Ge=null;const fe=new yt(0,0,He,Z),re=new yt(0,0,He,Z);let Ne=!1;const xe=new Ql;let Re=!1,Ve=!1;const Be=new Et,ye=new F,qe=new yt,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ze=!1;function je(){return ee===null?j:1}let C=n;function ut(v,L){return t.getContext(v,L)}let Ze,T,p,N,G,W,ie,ae,X,J,se,be,le,oe,ve,Ie,ke,D,ue,Q,ce,de,ne;try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:d,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Xa}`),t.addEventListener("webglcontextlost",ht,!1),t.addEventListener("webglcontextrestored",at,!1),t.addEventListener("webglcontextcreationerror",Ut,!1),C===null){const L="webgl2";if(C=ut(L,v),C===null)throw ut(L)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Ue()}catch(v){throw t.removeEventListener("webglcontextlost",ht,!1),t.removeEventListener("webglcontextrestored",at,!1),t.removeEventListener("webglcontextcreationerror",Ut,!1),lt("WebGLRenderer: "+v.message),v}function Ue(){Ze=new $d(C),Ze.init(),ce=new Hm(C,Ze),T=new Gd(C,Ze,e,ce),p=new zm(C,Ze),T.reversedDepthBuffer&&u&&p.buffers.depth.setReversed(!0),H=C.createFramebuffer(),U=C.createFramebuffer(),V=C.createFramebuffer(),N=new jd(C),G=new Tm,W=new Gm(C,Ze,p,G,T,ce,N),ie=new Kd(P),ae=new ef(C),de=new Bd(C,ae),X=new Jd(C,ae,N,de),J=new tp(C,X,ae,de,
vendor: 3,003 bytes, line 4220
4220N),D=new ep(C,T,W),ve=new Hd(G),se=new bm(P,ie,Ze,T,de,ve),be=new Ym(P,G),le=new wm,oe=new Im(Ze),ke=new Od(P,ie,p,J,x,c),Ie=new Bm(P,J,T),ne=new Zm(C,N,T,p),ue=new zd(C,Ze,N),Q=new Qd(C,Ze,N),N.programs=se.programs,P.capabilities=T,P.extensions=Ze,P.properties=G,P.renderLists=le,P.shadowMap=Ie,P.state=p,P.info=N}S!==nn&&(b=new ip(S,t.width,t.height,o,r,s));const Ce=new Xm(P,C);this.xr=Ce,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){const v=Ze.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Ze.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(v){v!==void 0&&(j=v,this.setSize(He,Z,!1))},this.getSize=function(v){return v.set(He,Z)},this.setSize=function(v,L,k=!0){if(Ce.isPresenting){We("WebGLRenderer: Can't change size while VR device is presenting.");return}He=v,Z=L,t.width=Math.floor(v*j),t.height=Math.floor(L*j),k===!0&&(t.style.width=v+"px",t.style.height=L+"px"),b!==null&&b.setSize(t.width,t.height),this.setViewport(0,0,v,L)},this.getDrawingBufferSize=function(v){return v.set(He*j,Z*j).floor()},this.setDrawingBufferSize=function(v,L,k){He=v,Z=L,j=k,t.width=Math.floor(v*k),t.height=Math.floor(L*k),this.setViewport(0,0,v,L)},this.setEffects=function(v){if(S===nn){lt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let L=0;L<v.length;L++)if(v[L].isOutputPass===!0){We("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}b.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(te)},this.getViewport=function(v){return v.copy(fe)},this.setViewport=function(v,L,k,z){v.isVector4?fe.set(v.x,v.y,v.z,v.w):fe.set(v,L,k,z),p.viewport(te.copy(fe).multiplyScalar(j).round())},this.getScissor=function(v){return v.copy(re)},this.setScissor=function(v,L,k,z){v.isVector4?re.set(v.x,v.y,v.z,v.w):re.set(v,L,k,z),p.scissor(we.copy(re).multiplyScalar(j).round())},this.getScissorTest=function(){return Ne},this.setScissorTest=function(v){p.setScissorTest(Ne=v)},this.setOpaqueSort=function(v){Se=v},this.setTransparentSort=function(v){Ge=v},this.getClearColor=function(v){return v.copy(ke.getClearColor())},this.setClearColor=function(){ke.setClearColor(...arguments)},this.getClearAlpha=function(){return ke.getClearAlpha()},this.setClearAlpha=function(){ke.setClearAlpha(...arguments)},this.clear=function(v=!0,L=!0,k=!0){let z=0;if(v){let B=!1;if(ee!==null){const Me=ee.texture.format;B=m.has(Me)}if(B){const Me=ee.texture.type,Ae=f.has(Me),_e=ke.getClearColor(),Pe=ke.getClearAlpha(),Fe=_e.r,Je=_e.g,tt=_e.b;Ae?(E[0]=Fe,E[1]=Je,E[2]=tt,E[3]=Pe,C.clearBufferuiv(C.COLOR,0,E)):(w[0]=Fe,w[1]=Je,w[2]=tt,w[3]=Pe,C.clearBufferiv(C.COLOR,0,w))}else z|=C.COLOR_BUFFER_BIT}L&&(z|=C.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),k&&
vendor: 10,661 bytes, line 4220
4220(z|=C.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z!==0&&C.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),O=v},this.dispose=function(){t.removeEventListener("webglcontextlost",ht,!1),t.removeEventListener("webglcontextrestored",at,!1),t.removeEventListener("webglcontextcreationerror",Ut,!1),ke.dispose(),le.dispose(),oe.dispose(),G.dispose(),ie.dispose(),J.dispose(),de.dispose(),ne.dispose(),se.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",qn),Ce.removeEventListener("sessionend",Vi),yn.stop()};function ht(v){v.preventDefault(),cs("WebGLRenderer: Context Lost."),I=!0}function at(){cs("WebGLRenderer: Context Restored."),I=!1;const v=N.autoReset,L=Ie.enabled,k=Ie.autoUpdate,z=Ie.needsUpdate,B=Ie.type;Ue(),N.autoReset=v,Ie.enabled=L,Ie.autoUpdate=k,Ie.needsUpdate=z,Ie.type=B}function Ut(v){lt("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Yt(v){const L=v.target;L.removeEventListener("dispose",Yt),Xn(L)}function Xn(v){pr(v),G.remove(v)}function pr(v){const L=G.get(v).programs;L!==void 0&&(L.forEach(function(k){se.releaseProgram(k)}),v.isShaderMaterial&&se.releaseShaderCache(v))}this.renderBufferDirect=function(v,L,k,z,B,Me){L===null&&(L=it);const Ae=B.isMesh&&B.matrixWorld.determinantAffine()<0,_e=Zt(v,L,k,z,B);p.setMaterial(z,Ae);let Pe=k.index,Fe=1;if(z.wireframe===!0){if(Pe=X.getWireframeAttribute(k),Pe===void 0)return;Fe=2}const Je=k.drawRange,tt=k.attributes.position;let Le=Je.start*Fe,ft=(Je.start+Je.count)*Fe;Me!==null&&(Le=Math.max(Le,Me.start*Fe),ft=Math.min(ft,(Me.start+Me.count)*Fe)),Pe!==null?(Le=Math.max(Le,0),ft=Math.min(ft,Pe.count)):tt!=null&&(Le=Math.max(Le,0),ft=Math.min(ft,tt.count));const Tt=ft-Le;if(Tt<0||Tt===1/0)return;de.setup(B,z,_e,k,Pe);let Mt,_t=ue;if(Pe!==null&&(Mt=ae.get(Pe),_t=Q,_t.setIndex(Mt)),B.isMesh)z.wireframe===!0?(p.setLineWidth(z.wireframeLinewidth*je()),_t.setMode(C.LINES)):_t.setMode(C.TRIANGLES);else if(B.isLine){let Nt=z.linewidth;Nt===void 0&&(Nt=1),p.setLineWidth(Nt*je()),B.isLineSegments?_t.setMode(C.LINES):B.isLineLoop?_t.setMode(C.LINE_LOOP):_t.setMode(C.LINE_STRIP)}else B.isPoints?_t.setMode(C.POINTS):B.isSprite&&_t.setMode(C.TRIANGLES);if(B.isBatchedMesh)if(Ze.get("WEBGL_multi_draw"))_t.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else{const Nt=B._multiDrawStarts,Te=B._multiDrawCounts,Ht=B._multiDrawCount,ot=Pe?ae.get(Pe).bytesPerElement:1,jt=G.get(z).currentProgram.getUniforms();for(let dn=0;dn<Ht;dn++)jt.setValue(C,"_gl_DrawID",dn),_t.render(Nt[dn]/ot,Te[dn])}else if(B.isInstancedMesh)_t.renderInstances(Le,Tt,B.count);else if(k.isInstancedBufferGeometry){const Nt=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,Te=Math.min(k.instanceCount,Nt);_t.renderInstances(Le,Tt,Te)}else _t.render(Le,Tt)};function li(v,L,k,z){O!==null&&v.isNodeMaterial&&O.setObject(z,v),Re===!0&&ve.setState(v,k,!1),v.transparent===!0&&v.side===_n&&v.forceSinglePass===!1?(v.side=qt,v.needsUpdate=!0,Ee(v,L,z),v.side=ni,v.needsUpdate=!0,Ee(v,L,z),v.side=_n):Ee(v,L,z)}this.compile=function(v,L,k=null){k===null&&(k=v),O!==null&&O.renderStart(v,L,k),y=oe.get(k),y.init(L),_.push(y),k.traverseVisible(function(B){B.isLight&&B.layers.test(L.layers)&&(y.pushLight(B),B.castShadow&&y.pushShadow(B))}),v!==k&&v.traverseVisible(function(B){B.isLight&&B.layers.test(L.layers)&&(y.pushLight(B),B.castShadow&&y.pushShadow(B))}),y.setupLights(),O!==null&&O.updateLights(y.state.lightsArray),Ve=this.localClippingEnabled,Re=ve.init(this.clippingPlanes,Ve),Re===!0&&ve.setGlobalState(this.clippingPlanes,L),O!==null&&Ie.render(y.state.shadowsArray,k,L);const z=new Set;return v.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;const Me=B.material;if(Me)if(Array.isArray(Me))for(let Ae=0;Ae<Me.length;Ae++){const _e=Me[Ae];li(_e,k,L,B),z.add(_e)}else li(Me,k,L,B),z.add(Me)}),y=_.pop(),O!==null&&O.renderEnd(),z},this.compileAsync=function(v,L,k=null){const z=this.compile(v,L,k);return new Promise(B=>{function Me(){if(z.forEach(function(Ae){const Pe=G.get(Ae).currentProgram;(Pe===void 0||Pe.isReady())&&z.delete(Ae)}),z.size===0){B(v);return}setTimeout(Me,10)}Ze.get("KHR_parallel_shader_compile")!==null?Me():setTimeout(Me,10)})};let ci=null;function hn(v){ci&&ci(v)}function qn(){yn.stop()}function Vi(){yn.start()}const yn=new rc;yn.setAnimationLoop(hn),typeof self<"u"&&yn.setContext(self),this.setAnimationLoop=function(v){ci=v,Ce.setAnimationLoop(v),v===null?yn.stop():yn.start()},Ce.addEventListener("sessionstart",qn),Ce.addEventListener("sessionend",Vi),this.render=function(v,L){if(L!==void 0&&L.isCamera!==!0){lt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;O!==null&&O.renderStart(v,L);const k=Ce.enabled===!0&&Ce.isPresenting===!0,z=b!==null&&(ee===null||k)&&b.begin(P,ee);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),Ce.enabled===!0&&Ce.isPresenting===!0&&(b===null||b.isCompositing()===!1)&&(Ce.cameraAutoUpdate===!0&&Ce.updateCamera(L),L=Ce.getCamera()),v.isScene===!0&&v.onBeforeRender(P,v,L,ee),y=oe.get(v,_.length),y.init(L),y.state.textureUnits=W.getTextureUnits(),_.push(y),Be.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),xe.setFromProjectionMatrix(Be,vn,L.reversedDepth),Ve=this.localClippingEnabled,Re=ve.init(this.clippingPlanes,Ve),A=le.get(v,R.length),A.init(),R.push(A),Ce.enabled===!0&&Ce.isPresenting===!0){const Ae=P.xr.getDepthSensingMesh();Ae!==null&&Yn(Ae,L,-1/0,P.sortObjects)}Yn(v,L,0,P.sortObjects),A.finish(),O!==null&&O.updateLights(y.state.lightsArray),P.sortObjects===!0&&A.sort(Se,Ge),ze=Ce.enabled===!1||Ce.isPresenting===!1||Ce.hasDepthSensing()===!1,ze&&ke.addToRenderList(A,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Re===!0&&ve.beginShadows();const B=y.state.shadowsArray;if(Ie.render(B,v,L),Re===!0&&ve.endShadows(),(z&&b.hasRenderPass())===!1){const Ae=A.opaque,_e=A.transmissive;if(y.setupLights(),L.isArrayCamera){const Pe=L.cameras;if(_e.length>0)for(let Fe=0,Je=Pe.length;Fe<Je;Fe++){const tt=Pe[Fe];pe(Ae,_e,v,tt)}ze&&ke.render(v);for(let Fe=0,Je=Pe.length;Fe<Je;Fe++){const tt=Pe[Fe];he(A,v,tt,tt.viewport)}}else _e.length>0&&pe(Ae,_e,v,L),ze&&ke.render(v),he(A,v,L)}ee!==null&&K===0&&(W.updateMultisampleRenderTarget(ee),W.updateRenderTargetMipmap(ee)),z&&b.end(P),v.isScene===!0&&v.onAfterRender(P,v,L),de.resetDefaultState(),Y=-1,$=null,_.pop(),_.length>0?(y=_[_.length-1],W.setTextureUnits(y.state.textureUnits),Re===!0&&ve.setGlobalState(P.clippingPlanes,y.state.camera)):y=null,R.pop(),R.length>0?A=R[R.length-1]:A=null,O!==null&&O.renderEnd()};function Yn(v,L,k,z){if(v.visible===!1)return;if(v.layers.test(L.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(L);else if(v.isLightProbeGrid)y.pushLightProbeGrid(v);else if(v.isLight)y.pushLight(v),v.castShadow&&y.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||v.intersectsFrustum(xe)){z&&qe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(Be);const Ae=J.update(v),_e=v.material;_e.visible&&A.push(v,Ae,_e,k,qe.z,null,L)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||v.intersectsFrustum(xe))){const Ae=J.update(v),_e=v.material;if(z&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),qe.copy(v.boundingSphere.center)):(Ae.boundingSphere===null&&Ae.computeBoundingSphere(),qe.copy(Ae.boundingSphere.center)),qe.applyMatrix4(v.matrixWorld).applyMatrix4(Be)),Array.isArray(_e)){const Pe=Ae.groups;for(let Fe=0,Je=Pe.length;Fe<Je;Fe++){const tt=Pe[Fe],Le=_e[tt.materialIndex];Le&&Le.visible&&A.push(v,Ae,Le,k,qe.z,tt,L)}}else _e.visible&&A.push(v,Ae,_e,k,qe.z,null,L)}}const Me=v.children;for(let Ae=0,_e=Me.length;Ae<_e;Ae++)Yn(Me[Ae],L,k,z)}function he(v,L,k,z){const{opaque:B,transmissive:Me,transparent:Ae}=v;y.setupLightsView(k),Re===!0&&ve.setGlobalState(P.clippingPlanes,k),z&&p.viewport(te.copy(z)),B.length>0&&Oe(B,L,k),Me.length>0&&Oe(Me,L,k),Ae.length>0&&Oe(Ae,L,k),p.buffers.depth.setTest(!0),p.buffers.depth.setMask(!0),p.buffers.color.setMask(!0),p.setPolygonOffset(!1)}function pe(v,L,k,z){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(y.state.transmissionRenderTarget[z.id]===void 0){const Le=Ze.has("EXT_color_buffer_half_float")||Ze.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[z.id]=new fn(1,1,{generateMipmaps:!0,type:Le?En:nn,minFilter:ei,samples:Math.max(4,T.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:st.workingColorSpace})}const Me=y.state.transmissionRenderTarget[z.id],Ae=z.viewport||te;Me.setSize(Ae.z*P.transmissionResolutionScale,Ae.w*P.transmissionResolutionScale);const _e=P.getRenderTarget(),Pe=P.getActiveCubeFace(),Fe=P.getActiveMipmapLevel();P.setRenderTarget(Me),P.getClearColor(nt),Ke=P.getClearAlpha(),Ke<1&&P.setClearColor(16777215,.5),P.clear(),ze&&ke.render(k);const Je=P.toneMapping;P.toneMapping=Mn;const tt=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),y.setupLightsView(z),Re===!0&&ve.setGlobalState(P.clippingPlanes,z),Oe(v,k,z),W.updateMultisampleRenderTarget(Me),W.updateRenderTargetMipmap(Me),Ze.has("WEBGL_multisampled_render_to_texture")===!1){let Le=!1;for(let ft=0,Tt=L.length;ft<Tt;ft++){const Mt=L[ft],{object:_t,geometry:Nt,material:Te,group:Ht}=Mt;if(Te.side===_n&&_t.layers.test(z.layers)){const ot=Te.side;Te.side=qt,Te.needsUpdate=!0,me(_t,k,z,Nt,Te,Ht),Te.side=ot,Te.needsUpdate=!0,Le=!0}}Le===!0&&(W.updateMultisampleRenderTarget(Me),W.updateRenderTargetMipmap(Me))}P.setRenderTarget(_e,Pe,Fe),P.setClearColor(nt,Ke),tt!==void 0&&(z.viewport=tt),P.toneMapping=Je}function Oe(v,L,k){const z=L.isScene===!0?L.overrideMaterial:null;for(let B=0,Me=v.length;B<Me;B++){const Ae=v[B],{object:_e,geometry:Pe,group:Fe}=Ae;let Je=Ae.material;Je.allowOverride===!0&&z!==null&&(Je=z),_e.layers.test(k.layers)&&me(_e,L,k,Pe,Je,Fe)}}function me(v,L,k,z,B,Me){O!==null&&B.isNodeMaterial&&O.setObject(v,B),v.onBeforeRender(P,L,k,z,B,Me),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),B.onBeforeRender(P,L,k,z,v,Me),B.transparent===!0&&B.side===_n&&B.forceSinglePass===!1?(B.side=qt,B.needsUpdate=!0,P.renderBufferDirect(k,L,z,B,v,Me),B.side=ni,B.needsUpdate=!0,P.renderBufferDirect(k,L,z,B,v,Me),B.side=_n):P.renderBufferDirect(k,L,z,B,v,Me),v.onAfterRender(P,L,k,z,B,Me)}
4220function Ee(v,L,k){L.isScene!==!0&&(L=it);const z=G.get(v),B=y.state.lights,Me=y.state.shadowsArray,Ae=B.state.version,_e=se.getParameters(v,B.state,Me,L,k,y.state.lightProbeGridArray),Pe=se.getProgramCacheKey(_e);let Fe=z.programs;z.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,z.fog=L.fog;const Je=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;z.envMap=ie.get(v.envMap||z.environment,Je),z.envMapRotation=z.environment!==null&&v.envMap===null?L.environmentRotation:v.envMapRotation,Fe===void 0&&(v.addEventListener("dispose",Yt),Fe=new Map,z.programs=Fe);let tt=Fe.get(Pe);if(tt!==void 0){if(z.currentProgram===tt&&z.lightsStateVersion===Ae)return et(v,_e),tt}else _e.uniforms=se.getUniforms(v),O!==null&&v.isNodeMaterial&&O.build(v,k,_e),v.onBeforeCompile(_e,P),tt=se.acquireProgram(_e,Pe),Fe.set(Pe,tt),z.uniforms=_e.uniforms;const Le=z.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Le.clippingPlanes=ve.uniform),et(v,_e),z.needsLights=ui(v),z.lightsStateVersion=Ae,z.needsLights&&(Le.ambientLightColor.value=B.state.ambient,Le.lightProbe.value=B.state.probe,Le.sunLights.value=B.state.sun,Le.sunLightShadows.value=B.state.sunShadow,Le.directionalLights.value=B.state.directional,Le.directionalLightShadows.value=B.state.directionalShadow,Le.spotLights.value=B.state.spot,Le.spotLightShadows.value=B.state.spotShadow,Le.rectAreaLights.value=B.state.rectArea,Le.ltc_1.value=
vendor: 10,329 bytes, line 4220
4220B.state.rectAreaLTC1,Le.ltc_2.value=B.state.rectAreaLTC2,Le.pointLights.value=B.state.point,Le.pointLightShadows.value=B.state.pointShadow,Le.hemisphereLights.value=B.state.hemi,Le.sunShadowMatrix.value=B.state.sunShadowMatrix,Le.sunShadowCascade.value=B.state.sunShadowCascade,Le.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Le.spotLightMatrix.value=B.state.spotLightMatrix,Le.spotLightMap.value=B.state.spotLightMap,Le.pointShadowMatrix.value=B.state.pointShadowMatrix),z.lightProbeGrid=y.state.lightProbeGridArray.length>0,z.currentProgram=tt,z.uniformsList=null,tt}function ct(v){if(v.uniformsList===null){const L=v.currentProgram.getUniforms();v.uniformsList=ts.seqWithValue(L.seq,v.uniforms)}return v.uniformsList}function et(v,L){const k=G.get(v);k.outputColorSpace=L.outputColorSpace,k.batching=L.batching,k.batchingColor=L.batchingColor,k.instancing=L.instancing,k.instancingColor=L.instancingColor,k.instancingMorph=L.instancingMorph,k.skinning=L.skinning,k.morphTargets=L.morphTargets,k.morphNormals=L.morphNormals,k.morphColors=L.morphColors,k.morphTargetsCount=L.morphTargetsCount,k.numClippingPlanes=L.numClippingPlanes,k.numIntersection=L.numClipIntersection,k.vertexAlphas=L.vertexAlphas,k.vertexTangents=L.vertexTangents,k.toneMapping=L.toneMapping}function St(v,L){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(L.matrixWorld);for(let k=0,z=v.length;k<z;k++){const B=v[k];if(B.texture!==null&&B.boundingBox.containsPoint(M))return B}return null}function Zt(v,L,k,z,B){L.isScene!==!0&&(L=it),W.resetTextureUnits();const Me=L.fog,Ae=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?L.environment:null,_e=ee===null?P.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:st.workingColorSpace,Pe=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap,Fe=ie.get(z.envMap||Ae,Pe),Je=z.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,tt=!!k.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Le=!!k.morphAttributes.position,ft=!!k.morphAttributes.normal,Tt=!!k.morphAttributes.color;let Mt=Mn;z.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(Mt=P.toneMapping);const _t=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Nt=_t!==void 0?_t.length:0,Te=G.get(z),Ht=y.state.lights;if(Re===!0&&(Ve===!0||v!==$)){const xt=v===$&&z.id===Y;ve.setState(z,v,xt)}let ot=!1;z.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==Ht.state.version||Te.outputColorSpace!==_e||B.isBatchedMesh&&Te.batching===!1||!B.isBatchedMesh&&Te.batching===!0||B.isBatchedMesh&&Te.batchingColor===!0&&B._colorsTexture===null||B.isBatchedMesh&&Te.batchingColor===!1&&B._colorsTexture!==null||B.isInstancedMesh&&Te.instancing===!1||!B.isInstancedMesh&&Te.instancing===!0||B.isSkinnedMesh&&Te.skinning===!1||!B.isSkinnedMesh&&Te.skinning===!0||B.isInstancedMesh&&Te.instancingColor===!0&&B.instanceColor===null||B.isInstancedMesh&&Te.instancingColor===!1&&B.instanceColor!==null||B.isInstancedMesh&&Te.instancingMorph===!0&&B.morphTexture===null||B.isInstancedMesh&&Te.instancingMorph===!1&&B.morphTexture!==null||Te.envMap!==Fe||z.fog===!0&&Te.fog!==Me||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==ve.numPlanes||Te.numIntersection!==ve.numIntersection)||Te.vertexAlphas!==Je||Te.vertexTangents!==tt||Te.morphTargets!==Le||Te.morphNormals!==ft||Te.morphColors!==Tt||Te.toneMapping!==Mt||Te.morphTargetsCount!==Nt||!!Te.lightProbeGrid!=y.state.lightProbeGridArray.length>0)&&(ot=!0):(ot=!0,Te.__version=z.version);let jt=Te.currentProgram;ot===!0&&(jt=Ee(z,L,B),O&&z.isNodeMaterial&&O.onUpdateProgram(z,jt,Te));let dn=!1,Nn=!1,fi=!1;const mt=jt.getUniforms(),bt=Te.uniforms;if(p.useProgram(jt.program)&&(dn=!0,Nn=!0,fi=!0),z.id!==Y&&(Y=z.id,Nn=!0),Te.needsLights){const xt=St(y.state.lightProbeGridArray,B);Te.lightProbeGrid!==xt&&(Te.lightProbeGrid=xt,Nn=!0)}if(dn||$!==v){p.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),mt.setValue(C,"projectionMatrix",v.projectionMatrix),mt.setValue(C,"viewMatrix",v.matrixWorldInverse);const On=mt.map.cameraPosition;On!==void 0&&On.setValue(C,ye.setFromMatrixPosition(v.matrixWorld)),T.logarithmicDepthBuffer&&mt.setValue(C,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&mt.setValue(C,"isOrthographic",v.isOrthographicCamera===!0),$!==v&&($=v,Nn=!0,fi=!0)}if(Te.needsLights&&(Ht.state.sunShadowMap.length>0&&mt.setValue(C,"sunShadowMap",Ht.state.sunShadowMap,W),Ht.state.directionalShadowMap.length>0&&mt.setValue(C,"directionalShadowMap",Ht.state.directionalShadowMap,W),Ht.state.spotShadowMap.length>0&&mt.setValue(C,"spotShadowMap",Ht.state.spotShadowMap,W),Ht.state.pointShadowMap.length>0&&mt.setValue(C,"pointShadowMap",Ht.state.pointShadowMap,W)),B.isSkinnedMesh){mt.setOptional(C,B,"bindMatrix"),mt.setOptional(C,B,"bindMatrixInverse");const xt=B.skeleton;xt&&(xt.boneTexture===null&&xt.computeBoneTexture(),mt.setValue(C,"boneTexture",xt.boneTexture,W))}B.isBatchedMesh&&(mt.setOptional(C,B,"batchingTexture"),mt.setValue(C,"batchingTexture",B._matricesTexture,W),mt.setOptional(C,B,"batchingIdTexture"),mt.setValue(C,"batchingIdTexture",B._indirectTexture,W),mt.setOptional(C,B,"batchingColorTexture"),B._colorsTexture!==null&&mt.setValue(C,"batchingColorTexture",B._colorsTexture,W));const Fn=k.morphAttributes;if((Fn.position!==void 0||Fn.normal!==void 0||Fn.color!==void 0)&&D.update(B,k,jt),(Nn||Te.receiveShadow!==B.receiveShadow)&&(Te.receiveShadow=B.receiveShadow,mt.setValue(C,"receiveShadow",B.receiveShadow)),(z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial)&&z.envMap===null&&L.environment!==null&&(bt.envMapIntensity.value=L.environmentIntensity),bt.dfgLUT!==void 0&&(bt.dfgLUT.value=$m()),Nn){if(mt.setValue(C,"toneMappingExposure",P.toneMappingExposure),Te.needsLights&&Kt(bt,fi),Me&&z.fog===!0&&be.refreshFogUniforms(bt,Me),be.refreshMaterialUniforms(bt,z,j,Z,y.state.transmissionRenderTarget[v.id]),Te.needsLights&&Te.lightProbeGrid){const xt=Te.lightProbeGrid;bt.probesSH.value=xt.texture,bt.probesMin.value.copy(xt.boundingBox.min),bt.probesMax.value.copy(xt.boundingBox.max),bt.probesResolution.value.copy(xt.resolution)}ts.upload(C,ct(Te),bt,W)}if(z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(ts.upload(C,ct(Te),bt,W),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&mt.setValue(C,"center",B.center),mt.setValue(C,"modelViewMatrix",B.modelViewMatrix),mt.setValue(C,"normalMatrix",B.normalMatrix),mt.setValue(C,"modelMatrix",B.matrixWorld),z.uniformsGroups!==void 0){const xt=z.uniformsGroups;for(let On=0,hi=xt.length;On<hi;On++){const ho=xt[On];ne.update(ho,jt),ne.bind(ho,jt)}}return jt}function Kt(v,L){v.ambientLightColor.needsUpdate=L,v.lightProbe.needsUpdate=L,v.sunLights.needsUpdate=L,v.sunLightShadows.needsUpdate=L,v.directionalLights.needsUpdate=L,v.directionalLightShadows.needsUpdate=L,v.pointLights.needsUpdate=L,v.pointLightShadows.needsUpdate=L,v.spotLights.needsUpdate=L,v.spotLightShadows.needsUpdate=L,v.rectAreaLights.needsUpdate=L,v.hemisphereLights.needsUpdate=L}function ui(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return ee},this.setRenderTargetTextures=function(v,L,k){const z=G.get(v);z.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),G.get(v.texture).__webglTexture=L,G.get(v.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:k,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,L){const k=G.get(v);k.__webglFramebuffer=L,k.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(v,L=0,k=0){ee=v,q=L,K=k;let z=null,B=!1,Me=!1;if(v){const _e=G.get(v);if(_e.__useDefaultFramebuffer!==void 0){p.bindFramebuffer(C.FRAMEBUFFER,_e.__webglFramebuffer),te.copy(v.viewport),we.copy(v.scissor),De=v.scissorTest,p.viewport(te),p.scissor(we),p.setScissorTest(De),Y=-1;return}else if(_e.__webglFramebuffer===void 0)W.setupRenderTarget(v);else if(_e.__hasExternalTextures)W.rebindTextures(v,G.get(v.texture).__webglTexture,G.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Je=v.depthTexture;if(_e.__boundDepthTexture!==Je){if(Je!==null&&G.has(Je)&&(v.width!==Je.image.width||v.height!==Je.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");W.setupDepthRenderbuffer(v)}}const Pe=v.texture;(Pe.isData3DTexture||Pe.isDataArrayTexture||Pe.isCompressedArrayTexture)&&(Me=!0);const Fe=G.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Fe[L])?z=Fe[L][k]:z=Fe[L],B=!0):v.samples>0&&W.useMultisampledRTT(v)===!1?z=G.get(v).__webglMultisampledFramebuffer:Array.isArray(Fe)?z=Fe[k]:z=Fe,te.copy(v.viewport),we.copy(v.scissor),De=v.scissorTest}else te.copy(fe).multiplyScalar(j).floor(),we.copy(re).multiplyScalar(j).floor(),De=Ne;if(k!==0&&(z=H),p.bindFramebuffer(C.FRAMEBUFFER,z)&&p.drawBuffers(v,z),p.viewport(te),p.scissor(we),p.setScissorTest(De),B){const _e=G.get(v.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+L,_e.__webglTexture,k)}else if(Me){const _e=L;for(let Pe=0;Pe<v.textures.length;Pe++){const Fe=G.get(v.textures[Pe]);C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+Pe,Fe.__webglTexture,k,_e)}}else if(v!==null&&k!==0){const _e=G.get(v.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,_e.__webglTexture,k)}Y=-1};function ki(v){const L=G.get(v);return(L.__readFormat!==v.format||L.__readType!==v.type)&&(L.__readFormat=v.format,L.__readType=v.type,L.__formatReadable=T.textureFormatReadable(v.format),L.__typeReadable=T.textureTypeReadable(v.type)),L}this.readRenderTargetPixels=function(v,L,k,z,B,Me,Ae,_e=0){if(!(v&&v.isWebGLRenderTarget)){lt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Pe=G.get(v).__webglFramebuffer;
vendor: 6,657 bytes, line 4220
4220if(v.isWebGLCubeRenderTarget&&Ae!==void 0&&(Pe=Pe[Ae]),Pe){p.bindFramebuffer(C.FRAMEBUFFER,Pe);try{const Fe=v.textures[_e],Je=Fe.format,tt=Fe.type;v.textures.length>1&&C.readBuffer(C.COLOR_ATTACHMENT0+_e);const Le=ki(Fe);if(Le.__formatReadable===!1){lt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Le.__typeReadable===!1){lt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=v.width-z&&k>=0&&k<=v.height-B&&C.readPixels(L,k,z,B,ce.convert(Je),ce.convert(tt),Me)}finally{const Fe=ee!==null?G.get(ee).__webglFramebuffer:null;p.bindFramebuffer(C.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(v,L,k,z,B,Me,Ae,_e=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Pe=G.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Ae!==void 0&&(Pe=Pe[Ae]),Pe)if(L>=0&&L<=v.width-z&&k>=0&&k<=v.height-B){p.bindFramebuffer(C.FRAMEBUFFER,Pe);const Fe=v.textures[_e],Je=Fe.format,tt=Fe.type;v.textures.length>1&&C.readBuffer(C.COLOR_ATTACHMENT0+_e);const Le=ki(Fe);if(Le.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Le.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ft=C.createBuffer();C.bindBuffer(C.PIXEL_PACK_BUFFER,ft),C.bufferData(C.PIXEL_PACK_BUFFER,Me.byteLength,C.STREAM_READ),C.readPixels(L,k,z,B,ce.convert(Je),ce.convert(tt),0),C.bindBuffer(C.PIXEL_PACK_BUFFER,null);const Tt=ee!==null?G.get(ee).__webglFramebuffer:null;p.bindFramebuffer(C.FRAMEBUFFER,Tt);const Mt=C.fenceSync(C.SYNC_GPU_COMMANDS_COMPLETE,0);return C.flush(),await Jc(C,Mt,4),C.bindBuffer(C.PIXEL_PACK_BUFFER,ft),C.getBufferSubData(C.PIXEL_PACK_BUFFER,0,Me),C.bindBuffer(C.PIXEL_PACK_BUFFER,null),C.deleteBuffer(ft),C.deleteSync(Mt),Me}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,L=null,k=0){const z=Math.pow(2,-k),B=Math.floor(v.image.width*z),Me=Math.floor(v.image.height*z),Ae=L!==null?L.x:0,_e=L!==null?L.y:0;W.setTexture2D(v,0),C.copyTexSubImage2D(C.TEXTURE_2D,k,0,0,Ae,_e,B,Me),p.unbindTexture()},this.copyTextureToTexture=function(v,L,k=null,z=null,B=0,Me=0){let Ae,_e,Pe,Fe,Je,tt,Le,ft,Tt;const Mt=v.isCompressedTexture?v.mipmaps[Me]:v.image;if(k!==null)Ae=k.max.x-k.min.x,_e=k.max.y-k.min.y,Pe=k.isBox3?k.max.z-k.min.z:1,Fe=k.min.x,Je=k.min.y,tt=k.isBox3?k.min.z:0;else{const bt=Math.pow(2,-B);Ae=Math.floor(Mt.width*bt),_e=Math.floor(Mt.height*bt),v.isDataArrayTexture?Pe=Mt.depth:v.isData3DTexture?Pe=Math.floor(Mt.depth*bt):Pe=1,Fe=0,Je=0,tt=0}z!==null?(Le=z.x,ft=z.y,Tt=z.z):(Le=0,ft=0,Tt=0);const _t=ce.convert(L.format),Nt=ce.convert(L.type);let Te;L.isData3DTexture?(W.setTexture3D(L,0),Te=C.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(W.setTexture2DArray(L,0),Te=C.TEXTURE_2D_ARRAY):(W.setTexture2D(L,0),Te=C.TEXTURE_2D),p.activeTexture(C.TEXTURE0),p.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,L.flipY),p.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),p.pixelStorei(C.UNPACK_ALIGNMENT,L.unpackAlignment);const Ht=p.getParameter(C.UNPACK_ROW_LENGTH),ot=p.getParameter(C.UNPACK_IMAGE_HEIGHT),jt=p.getParameter(C.UNPACK_SKIP_PIXELS),dn=p.getParameter(C.UNPACK_SKIP_ROWS),Nn=p.getParameter(C.UNPACK_SKIP_IMAGES);p.pixelStorei(C.UNPACK_ROW_LENGTH,Mt.width),p.pixelStorei(C.UNPACK_IMAGE_HEIGHT,Mt.height),p.pixelStorei(C.UNPACK_SKIP_PIXELS,Fe),p.pixelStorei(C.UNPACK_SKIP_ROWS,Je),p.pixelStorei(C.UNPACK_SKIP_IMAGES,tt);const fi=v.isDataArrayTexture||v.isData3DTexture,mt=L.isDataArrayTexture||L.isData3DTexture;if(v.isDepthTexture){const bt=G.get(v),Fn=G.get(L),xt=G.get(bt.__renderTarget),On=G.get(Fn.__renderTarget);p.bindFramebuffer(C.READ_FRAMEBUFFER,xt.__webglFramebuffer),p.bindFramebuffer(C.DRAW_FRAMEBUFFER,On.__webglFramebuffer);for(let hi=0;hi<Pe;hi++)fi&&(C.framebufferTextureLayer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,G.get(v).__webglTexture,B,tt+hi),C.framebufferTextureLayer(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,G.get(L).__webglTexture,Me,Tt+hi)),C.blitFramebuffer(Fe,Je,Ae,_e,Le,ft,Ae,_e,C.DEPTH_BUFFER_BIT,C.NEAREST);p.bindFramebuffer(C.READ_FRAMEBUFFER,null),p.bindFramebuffer(C.DRAW_FRAMEBUFFER,null)}else if(B!==0||v.isRenderTargetTexture||G.has(v)){const bt=G.get(v),Fn=G.get(L);p.bindFramebuffer(C.READ_FRAMEBUFFER,U),p.bindFramebuffer(C.DRAW_FRAMEBUFFER,V);for(let xt=0;xt<Pe;xt++)fi?C.framebufferTextureLayer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,bt.__webglTexture,B,tt+xt):C.framebufferTexture2D(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,bt.__webglTexture,B),mt?C.framebufferTextureLayer(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,Fn.__webglTexture,Me,Tt+xt):C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,Fn.__webglTexture,Me),B!==0?C.blitFramebuffer(Fe,Je,Ae,_e,Le,ft,Ae,_e,C.COLOR_BUFFER_BIT,C.NEAREST):mt?C.copyTexSubImage3D(Te,Me,Le,ft,Tt+xt,Fe,Je,Ae,_e):C.copyTexSubImage2D(Te,Me,Le,ft,Fe,Je,Ae,_e);p.bindFramebuffer(C.READ_FRAMEBUFFER,null),p.bindFramebuffer(C.DRAW_FRAMEBUFFER,null)}else mt?v.isDataTexture||v.isData3DTexture?C.texSubImage3D(Te,Me,Le,ft,Tt,Ae,_e,Pe,_t,Nt,Mt.data):L.isCompressedArrayTexture?C.compressedTexSubImage3D(Te,Me,Le,ft,Tt,Ae,_e,Pe,_t,Mt.data):C.texSubImage3D(Te,Me,Le,ft,Tt,Ae,_e,Pe,_t,Nt,Mt):v.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,Me,Le,ft,Ae,_e,_t,Nt,Mt.data):v.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,Me,Le,ft,Mt.width,Mt.height,_t,Mt.data):C.texSubImage2D(C.TEXTURE_2D,Me,Le,ft,Ae,_e,_t,Nt,Mt);p.pixelStorei(C.UNPACK_ROW_LENGTH,Ht),p.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ot),p.pixelStorei(C.UNPACK_SKIP_PIXELS,jt),p.pixelStorei(C.UNPACK_SKIP_ROWS,dn),p.pixelStorei(C.UNPACK_SKIP_IMAGES,Nn),Me===0&&L.generateMipmaps&&C.generateMipmap(Te),p.unbindTexture()},this.initRenderTarget=function(v){G.get(v).__webglFramebuffer===void 0&&W.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?W.setTextureCube(v,0):v.isData3DTexture?W.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?W.setTexture2DArray(v,0):W.setTexture2D(v,0),p.unbindTexture()},this.resetState=function(){q=0,K=0,ee=null,p.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}
4220set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=st._getDrawingBufferColorSpace(e),t.unpackColorSpace=st._getUnpackColorSpace()}}const Qm=` 4221 attribute float aSize; 4222 attribute vec3 aColor; 4223 attribute float aAlpha; 4224 4225 uniform float uPixelRatio; 4226 uniform float uProjScale; 4227 uniform float uUnit; 4228 4229 varying vec3 vColor; 4230 varying float vAlpha; 4231 varying float vDepth; 4232 4233 void main() { 4234 vec4 mv = modelViewMatrix * vec4(position, 1.0); 4235 gl_PointSize = aSize * uUnit * uProjScale * uPixelRatio / max(0.1, -mv.z); 4236 vColor = aColor; 4237 vAlpha = aAlpha; 4238 vDepth = -mv.z; 4239 gl_Position = projectionMatrix * mv; 4240 } 4241`,jm=` 4242 uniform float uNear; 4243 uniform float uFar; 4244 uniform float uRing; 4245 4246 varying vec3 vColor; 4247 varying float vAlpha; 4248 varying float vDepth; 4249 4250 void main() { 4251 float d = length(gl_PointCoord - 0.5) * 2.0; 4252 if (d > 1.0) discard; 4253 4254 float depthFade = mix(0.12, 1.0, smoothstep(uFar, uNear, vDepth)); 4255 4256 float glow; 4257 float hot; 4258 if (uRing > 0.5) { 4259 // thin expanding ring for delivery pings 4260 float band = 1.0 - abs(d - 0.82) / 0.18; 4261 glow = clamp(band, 0.0, 1.0); 4262 hot = glow * 0.35; 4263 } else { 4264 float core = 1.0 - d; 4265 glow = pow(core, 2.2); 4266 hot = smoothstep(0.28, 0.0, d); 4267 } 4268 4269 float a = glow * vAlpha * depthFade; 4270 vec3 col = vColor * a + vec3(1.0) * hot * vAlpha * depthFade * 0.85; 4271 gl_FragColor = vec4(col, a); 4272 } 4273`;function js(i=!1){return new rn({vertexShader:Qm,fragmentShader:jm,uniforms:{uPixelRatio:{value:1},uProjScale:{value:1},uUnit:{value:1},uNear:{value:10},uFar:{value:14},uRing:{value:i?1:0}},transparent:!0,depthWrite:!1,blending:ln})}const eg=` 4274 varying vec3 vNormal; 4275 varying vec3 vViewDir; 4276 varying vec3 vWorldPos; 4277 varying float vDepth; 4278 4279 void main() { 4280 vec4 worldPos = modelMatrix * vec4(position, 1.0); 4281 vWorldPos = worldPos.xyz; 4282 vNormal = normalize(normalMatrix * normal); 4283 vec4 mv = viewMatrix * worldPos; 4284 vViewDir = normalize(-mv.xyz); 4285 vDepth = -mv.z; 4286 gl_Position = projectionMatrix * mv; 4287 } 4288`,tg=` 4289 uniform vec3 uColor; 4290 uniform vec3 uColor2; 4291 uniform float uTime; 4292 uniform float uOpacity; 4293 uniform float uScan; 4294 uniform float uNear; 4295 uniform float uFar; 4296 4297 varying vec3 vNormal; 4298 varying vec3 vViewDir; 4299 varying vec3 vWorldPos; 4300 varying float vDepth; 4301 4302 void main() { 4303 float facing = clamp(dot(normalize(vNormal), normalize(vViewDir)), 0.0, 1.0); 4304 float fres = pow(1.0 - facing, 2.4); 4305 4306 float scan = 0.5 + 0.5 * sin(vWorldPos.y * uScan - uTime * 2.2); 4307 scan = mix(0.72, 1.0, scan); 4308 4309 float flicker = 0.95 + 0.05 * sin(uTime * 19.0 + vWorldPos.x * 6.0); 4310 float depthFade = mix(0.2, 1.0, smoothstep(uFar, uNear, vDepth)); 4311 4312 vec3 col = mix(uColor, uColor2, fres); 4313 float a = (0.06 + fres * 0.95) * scan * flicker * uOpacity * depthFade; 4314 gl_FragColor = vec4(col * a, a); 4315 } 4316`;function _l(i,e,t=1){return new rn({vertexShader:eg,fragmentShader:tg,uniforms:{uColor:{value:new Xe(i)},uColor2:{value:new Xe(e)},uTime:{value:0},uOpacity:{value:t},uScan:{value:22},uNear:{value:10},uFar:{value:14}},transparent:!0,depthWrite:!1,side:_n,blending:ln})}function ng(i=128){const e=document.createElement("canvas");e.width=e.height=i;const t=e.getContext("2d"),n=t.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.18,"rgba(255,255,255,0.55)"),n.addColorStop(.5,"rgba(255,255,255,0.12)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,i,i);const r=new Hu(e);return r.colorSpace=Xt,r}var ig=Wa('<div aria-hidden="true"><canvas class="block h-full w-full"></canvas></div>');function rg(i,e){vl(e,!1);let t=Rt(e,"radius",8,.34),n=Rt(e,"nodeCount",8,78),r=Rt(e,"degree",8,3),s=Rt(e,"packetCount",8,22),a=Rt(e,"speed",8,.11),o=Rt(e,"interactive",8,!0),c=Rt(e,"className",8,""),l=Li(),d=Li();xl(()=>{const h=vt(l).getContext("2d",{alpha:!0});if(!h)return;const x=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=[],m=Math.PI*(3-Math.sqrt(5));for(let re=0;re<n();
4316re++){const Ne=1-re/(n()-1)*2,xe=Math.sqrt(Math.max(0,1-Ne*Ne)),Re=re*m;S.push({x:Math.cos(Re)*xe,y:Ne,z:Math.sin(Re)*xe})}const f=new Set;for(let re=0;re<6;re++)f.add(Math.floor(re*n()/6+1)%n());const E=[],w=new Set;for(let re=0;re<S.length;re++){const Ne=S.map((xe,Re)=>({j:Re,d:M(S[re],xe)})).filter(xe=>xe.j!==re).sort((xe,Re)=>xe.d-Re.d).slice(0,r());for(const{j:xe}of Ne){const Re=re<xe?`${re}-${xe}`:`${xe}-${re}`;w.has(Re)||(w.add(Re),E.push([re,xe]))}}function M(re,Ne){const xe=re.x-Ne.x,Re=re.y-Ne.y,Ve=re.z-Ne.z;return xe*xe+Re*Re+Ve*Ve}const A=[[56,189,248],[52,211,153],[167,139,250]],y=[],R=()=>({edge:Math.random()*E.length|0,t:0,speed:.28+Math.random()*.5,dir:Math.random()>.5?1:-1,hue:Math.random()<.14?2:Math.random()<.5?0:1});for(let re=0;re<s();re++){const Ne=R();Ne.t=Math.random(),y.push(Ne)}let _=[];const b=64,P=A.map(([re,Ne,xe])=>{const Re=document.createElement("canvas");Re.width=Re.height=b;const Ve=Re.getContext("2d"),Be=Ve.createRadialGradient(b/2,b/2,0,b/2,b/2,b/2);return Be.addColorStop(0,"rgba(255,255,255,0.95)"),Be.addColorStop(.22,`rgba(${re},${Ne},${xe},0.85)`),Be.addColorStop(.55,`rgba(${re},${Ne},${xe},0.22)`),Be.addColorStop(1,`rgba(${re},${Ne},${xe},0)`),Ve.fillStyle=Be,Ve.fillRect(0,0,b,b),Re});let I=0,O=0,H=1;const U=()=>{const re=vt(d).getBoundingClientRect();H=Math.min(window.devicePixelRatio||1,2),I=Math.max(1,re.width),O=Math.max(1,re.height),mr(l,vt(l).width=Math.round(I*H)),mr(l,vt(l).height=Math.round(O*H)),mr(l,vt(l).style.width=`${I}px`),mr(l,vt(l).style.height=`${O}px`),h.setTransform(H,0,0,H,0,0)},V=new ResizeObserver(U);V.observe(vt(d)),U();let q=-.22,K=0,ee=q,Y=0,$=0;const te=re=>{if(!o())return;const Ne=vt(d).getBoundingClientRect(),xe=(re.clientX-Ne.left)/Ne.width-.5,Re=(re.clientY-Ne.top)/Ne.height-.5;K=xe*.85,q=-.22+Re*.6,$=Math.min(1,Math.abs(xe)*1.6)},we=()=>{K=0,q=-.22,$=0};o()&&(window.addEventListener("pointermove",te,{passive:!0}),vt(d).addEventListener("pointerleave",we));let De=!0;const nt=new IntersectionObserver(([re])=>{De=re.isIntersecting},{threshold:.01});nt.observe(vt(d));let Ke=0,He=0,Z=performance.now();const j=new Array(S.length).fill(null).map(()=>({x:0,y:0,z:0,s:0})),Se=(re,Ne,xe,Re,Ve)=>{const Be=Math.cos(Ke),ye=Math.sin(Ke);let qe=re.x*Be-re.z*ye,it=re.x*ye+re.z*Be,ze=re.y;const je=Math.cos(ee),C=Math.sin(ee),ut=ze*je-it*C,Ze=ze*C+it*je,T=Math.cos(Y),p=Math.sin(Y),N=qe*T-ut*p,G=qe*p+ut*T,W=3.1,ie=W/(W+Ze);Ne.x=Re+N*xe*ie,Ne.y=Ve+G*xe*ie,Ne.z=Ze,Ne.s=ie},Ge=(re,Ne,xe,Re)=>{const Ve={x:0,y:0,z:0,s:0};return Se(re,Ve,Ne,xe,Re),Ve},fe=re=>{const Ne=Math.min(.05,(re-Z)/1e3);if(Z=re,He=requestAnimationFrame(fe),!De)return;ee+=(q-ee)*Math.min(1,Ne*3.5),Y+=(K-Y)*Math.min(1,Ne*3.5),Ke+=Ne*a()*(1+$*.9);const xe=I/2,Re=O/2,Ve=Math.min(I,O)*t();h.clearRect(0,0,I,O);for(let ye=0;ye<S.length;ye++)Se(S[ye],j[ye],Ve,xe,Re);h.lineCap="round";for(const[ye,qe]of E){const it=j[ye],ze=j[qe],C=(1-(it.z+ze.z)/2)/2,ut=.05+C*.3;h.strokeStyle=`rgba(125, 211, 252, ${ut.toFixed(3)})`,h.lineWidth=.35+C*.85,h.beginPath(),h.moveTo(it.x,it.y),h.lineTo(ze.x,ze.y),h.stroke()}const Be=j.map((ye,qe)=>({i:qe,z:ye.z})).sort((ye,qe)=>qe.z-ye.z);for(const{i:ye}of Be){const qe=j[ye],it=(1-qe.z)/2,ze=f.has(ye),je=(ze?2.6:1.35)*(.55+it*1.05),C=.25+it*.75;if(ze){const ut=P[1],Ze=je*9;h.globalAlpha=C*.75,h.drawImage(ut,qe.x-Ze/2,qe.y-Ze/2,Ze,Ze),h.globalAlpha=1}h.beginPath(),h.arc(qe.x,qe.y,je,0,Math.PI*2),h.fillStyle=ze?`rgba(167, 243, 208, ${C})`:`rgba(186, 230, 253, ${C*.85})`,h.fill()}if(!x){for(const ye of y){if(ye.t+=Ne*ye.speed,ye.t>=1){const[J,se]=E[ye.edge];_.push({node:ye.dir===1?se:J,t:0,hue:ye.hue}
4316),Object.assign(ye,R());continue}const[qe,it]=E[ye.edge],ze=ye.dir===1?S[qe]:S[it],je=ye.dir===1?S[it]:S[qe],C=ye.t,ut=ze.x+(je.x-ze.x)*C,Ze=ze.y+(je.y-ze.y)*C,T=ze.z+(je.z-ze.z)*C,p=Math.hypot(ut,Ze,T)||1,N=1+Math.sin(Math.PI*C)*.07,G={x:ut/p*N,y:Ze/p*N,z:T/p*N},W=Ge(G,Ve,xe,Re),ie=(1-W.z)/2,ae=5;for(let J=ae;J>=1;J--){const se=Math.max(0,C-J*.035),be=ze.x+(je.x-ze.x)*se,le=ze.y+(je.y-ze.y)*se,oe=ze.z+(je.z-ze.z)*se,ve=Math.hypot(be,le,oe)||1,Ie=1+Math.sin(Math.PI*se)*.07,ke=Ge({x:be/ve*Ie,y:le/ve*Ie,z:oe/ve*Ie},Ve,xe,Re),[D,ue,Q]=A[ye.hue];h.beginPath(),h.arc(ke.x,ke.y,1.5*(J/ae)*(.5+ie),0,Math.PI*2),h.fillStyle=`rgba(${D},${ue},${Q},${(.06+ie*.14)*(1-J/(ae+1))})`,h.fill()}const X=(7+ie*13)*1.6;h.globalAlpha=.35+ie*.65,h.drawImage(P[ye.hue],W.x-X/2,W.y-X/2,X,X),h.globalAlpha=1,h.beginPath(),h.arc(W.x,W.y,1+ie*1.5,0,Math.PI*2),h.fillStyle=`rgba(255,255,255,${.5+ie*.5})`,h.fill()}_=_.filter(ye=>{if(ye.t+=Ne*1.7,ye.t>=1)return!1;const qe=j[ye.node],it=(1-qe.z)/2;if(it<.35)return!0;const[ze,je,C]=A[ye.hue],ut=1-Math.pow(1-ye.t,3);return h.beginPath(),h.arc(qe.x,qe.y,2+ut*16*it,0,Math.PI*2),h.strokeStyle=`rgba(${ze},${je},${C},${(1-ye.t)*.5*it})`,h.lineWidth=1.1*(1-ye.t)+.2,h.stroke(),!0})}};return x?(Z=performance.now(),fe(Z+16)):He=requestAnimationFrame(fe),()=>{cancelAnimationFrame(He),V.disconnect(),nt.disconnect(),window.removeEventListener("pointermove",te),vt(d).removeEventListener("pointerleave",we)}}),bl();var g=ig(),u=Ml(g);ns(u,h=>jn(l,h),()=>vt(l)),Sl(g),ns(g,h=>jn(d,h),()=>vt(d)),El(()=>Tl(g,1,`absolute inset-0 ${c()??""}`)),ea(i,g),yl()}var sg=Wa('<canvas class="block h-full w-full"></canvas>'),ag=Wa('<div aria-hidden="true"><!></div>');function mg(i,e){vl(e,!1);let t=Rt(e,"anchor",8,null),n=Rt(e,"radiusScale",8,1.5),r=Rt(e,"nodeCount",8,96),s=Rt(e,"degree",8,3),a=Rt(e,"packetCount",8,28),o=Rt(e,"particles",8,700),c=Rt(e,"satellites",8,6),l=Rt(e,"core",8,!1),d=Rt(e,"speed",8,.09),g=Rt(e,"interactive",8,!0),u=Rt(e,"scrollParallax",8,.9),h=Rt(e,"className",8,""),x=Li(),S=Li(),m=Li(!1),f=Li(null);const E=new Xe("#38bdf8"),w=new Xe("#34d399"),M=new Xe("#a78bfa"),A=new Xe("#bae6fd"),y=new Xe("#a7f3d0");xl(()=>{const I=window.matchMedia("(prefers-reduced-motion: reduce)").matches,O=window.matchMedia("(pointer: coarse)").matches;let H;try{H=new Jm({canvas:vt(S),alpha:!0,antialias:!0,powerPreference:"high-performance"})}catch{jn(m,!0);return}const U=Math.min(window.devicePixelRatio||1,O?1.5:2);H.setPixelRatio(U),H.setClearColor(0,0),H.outputColorSpace=Xt;const V=new Ru,q=17,K=28,ee=new tn(K,1,.1,60);ee.position.set(0,0,q),V.fog=new no(0,q-1,q+4);const Y=ng(),$=[],te=Math.PI*(3-Math.sqrt(5));for(let he=0;he<r();he++){const pe=1-he/(r()-1)*2,Oe=Math.sqrt(Math.max(0,1-pe*pe)),me=he*te;$.push({x:Math.cos(me)*Oe,y:pe,z:Math.sin(me)*Oe})}const we=new Set;for(let he=0;he<7;he++)we.add(Math.floor(he*r()/7+3)%r());const De=(he,pe)=>(he.x-pe.x)**2+(he.y-pe.y)**2+(he.z-pe.z)**2,nt=[],Ke=new Set;for(let he=0;he<$.length;he++){const pe=$.map((Oe,me)=>({j:me,d:De($[he],Oe)})).filter(Oe=>Oe.j!==he).sort((Oe,me)=>Oe.d-me.d).slice(0,s());for(const{j:Oe}of pe){const me=he<Oe?`${he}-${Oe}`:`${Oe}-${he}`;Ke.has(me)||(Ke.add(me),nt.push([he,Oe]))}}const He=new Cn;V.add(He);{const he=new Float32Array(nt.length*6),pe=new Float32Array(nt.length*6);nt.forEach(([Ee,ct],et)=>{const St=$[Ee],Zt=$[ct];he.set([St.x,St.y,St.z,Zt.x,Zt.y,Zt.z],et*6);const Kt=we.has(Ee)||we.has(ct)?y:E;pe.set([Kt.r,Kt.g,Kt.b,Kt.r,Kt.g,Kt.b],et*6)});const Oe=new wt;Oe.setAttribute("position",new gt(he,3)),Oe.setAttribute("color",new gt(pe,3));const me=new Ga({vertexColors:!0,transparent:!0,opacity:.32,blending:ln,depthWrite:!1});He.add(new Ho(Oe,me))}const Z=js();{const he=new Float32Array(r()*3),pe=new Float32Array(r()*3),Oe=new Float32Array(r()),me=new Float32Array(r());$.forEach((et,St)=>{he.set([et.x,et.y,et.z],St*3);const Zt=we.has(St)?y:A;pe.set([Zt.r,Zt.g,Zt.b],St*3),Oe[St]=we.has(St)?.11:.05,me[St]=we.has(St)?1:.8});const Ee=new wt;Ee.setAttribute("position",new gt(he,3)),Ee.setAttribute("aColor",new gt(pe,3)),Ee.setAttribute("aSize",new gt(Oe,1)),Ee.setAttribute("aAlpha",new gt(me,1)),He.add(new Hr(Ee,Z));const ct=new es({map:Y,color:w,transparent:!0,opacity:.35,blending:ln,depthWrite:!1});for(const et of we){const St=new Vs(ct);St.position.set($[et].x,$[et].y,$[et].z),St.scale.setScalar(.34),He.add(St)}}const j=[E,w,M],Se=()=>({edge:Math.random()*nt.length|0,t:0,speed:.26+Math.random()*.5,dir:Math.random()>.5?1:-1,hue:Math.random()<.14?j[2]:Math.random()<.5?j[0]:j[1]}),Ge=[];for(let he=0;he<a();he++){const pe=Se();pe.t=Math.random(),Ge.push(pe)}const fe=5,re=new Float32Array(a()*fe*3),Ne=new Float32Array(a()*fe*3),xe=new Float32Array(a()*fe),Re=new Float32Array(a()*fe);for(let he=0;he<a();he++)for(let pe=0;pe<fe;pe++){const Oe=he*fe+pe;xe[Oe]=pe===0?.16:.09*(1-pe/(fe+1)),Re[Oe]=pe===0?1:.35*(1-pe/fe)}const Ve=new wt;Ve.setAttribute("position",new gt(re,3)),Ve.setAttribute("aColor",new gt(Ne,3)),Ve.setAttribute("aSize",new gt(xe,1)),Ve.setAttribute("aAlpha",new gt(Re,1)),He.add(new Hr(Ve,Z));const Be=14,ye=Array.from({length:Be},()=>
4316({node:0,t:1,hue:E,live:!1})),qe=new Float32Array(Be*3),it=new Float32Array(Be*3),ze=new Float32Array(Be),je=new Float32Array(Be),C=new wt;C.setAttribute("position",new gt(qe,3)),C.setAttribute("aColor",new gt(it,3)),C.setAttribute("aSize",new gt(ze,1)),C.setAttribute("aAlpha",new gt(je,1));const ut=js(!0);He.add(new Hr(C,ut));const Ze=(he,pe)=>{const Oe=ye.find(me=>!me.live)??ye[0];Oe.node=he,Oe.t=0,Oe.hue=pe,Oe.live=!0},T=new Cn;{const he=new fs({color:E,transparent:!0,opacity:.22,blending:ln,depthWrite:!1}),pe=he.clone();pe.color=M,pe.opacity=.16;const Oe=new Wt(new Di(1.28,.004,6,160),he);Oe.rotation.x=Math.PI/2-.35;const me=new Wt(new Di(1.46,.003,6,180),pe);me.rotation.x=Math.PI/2+.55,me.rotation.y=.4,T.add(Oe,me),He.add(T)}const p=[],N=(he,pe,Oe,me=1)=>{const Ee=new Cn,ct=_l(pe,Oe,me);p.push(ct),Ee.add(new Wt(he,ct));const et=new Ga({color:Oe,transparent:!0,opacity:.55*me,blending:ln,depthWrite:!1});return Ee.add(new Ho(new ku(he),et)),Ee},G=[],W=[new sr(.075,0),new so(.085,0),new ao(.09,0),new ro(.07,0)],ie=[[E,new Xe("#e0f2fe")],[w,new Xe("#d1fae5")],[M,new Xe("#ede9fe")]];for(let he=0;he<c();he++){const[pe,Oe]=ie[he%ie.length],me=N(W[he%W.length],pe,Oe,.9),Ee=new Vs(new es({map:Y,color:pe,transparent:!0,opacity:.4,blending:ln,depthWrite:!1}));Ee.scale.setScalar(.36),me.add(Ee),He.add(me),G.push({group:me,radius:1.1+he%3*.12+Math.random()*.06,incl:he/c()*Math.PI-Math.PI/2+(Math.random()-.5)*.6,phase:he/c()*Math.PI*2,speed:(.12+Math.random()*.12)*(he%2?1:-1),spin:new F(Math.random()*.8,.4+Math.random()*.8,Math.random()*.5)})}let ae=null,X=null;if(l()){ae=new Cn;const he=N(new sr(.42,1),E,new Xe("#e0f2fe"),1),pe=_l(w,new Xe("#ffffff"),1.4);p.push(pe),X=new Wt(new sr(.2,0),pe);const Oe=new Vs(new es({map:Y,color:new Xe("#7dd3fc"),transparent:!0,opacity:.85,blending:ln,depthWrite:!1}));Oe.scale.setScalar(1.5);const me=new fs({color:w,transparent:!0,opacity:.5,blending:ln,depthWrite:!1}),Ee=new Wt(new Di(.6,.008,8,120),me),ct=new Wt(new Di(.72,.006,8,120),me.clone());ct.material.color=M,Ee.rotation.x=Math.PI/3,ct.rotation.y=Math.PI/3,ae.add(he,X,Oe,Ee,ct),ae.userData={g1:Ee,g2:ct},He.add(ae)}const J=new Cn;V.add(J);const se=js();se.uniforms.uNear.value=q+1,se.uniforms.uFar.value=q+14;let be=null;if(o()>0){const he=new Float32Array(o()*3),pe=new Float32Array(o()*3),Oe=new Float32Array(o()),me=new Float32Array(o());for(let Ee=0;Ee<o();Ee++){he[Ee*3]=(Math.random()-.5)*34,he[Ee*3+1]=(Math.random()-.5)*20,he[Ee*3+2]=-2-Math.random()*12;const ct=Math.random()<.6?A:Math.random()<.5?E:w;pe.set([ct.r,ct.g,ct.b],Ee*3),Oe[Ee]=.02+Math.random()*.035,me[Ee]=.25+Math.random()*.5}be=new wt,be.setAttribute("position",new gt(he,3)),be.setAttribute("aColor",new gt(pe,3)),be.setAttribute("aSize",new gt(Oe,1)),be.setAttribute("aAlpha",new gt(me,1)),J.add(new Hr(be,se))}let le=1,oe=1,ve=1,Ie=0,ke=0;const D=()=>2*q*Math.tan(Wi.degToRad(K/2));jn(f,()=>{const he=vt(x).getBoundingClientRect(),pe=D()/Math.max(1,oe);let Oe=le/2,me=oe/2,Ee=Math.min(le,oe)*.5;if(t()){const et=t().getBoundingClientRect();Oe=et.left+et.width/2-he.left,me=et.top+et.height/2-he.top,Ee=et.width/2}Ie=(Oe-le/2)*pe,ke=(oe/2-me)*pe,ve=Math.max(.2,Ee*n()*pe),He.position.set(Ie,ke,0),He.scale.setScalar(ve),J.position.x=Ie*.35;const ct=oe/(2*Math.tan(Wi.degToRad(K/2)));for(const et of[Z,ut])et.uniforms.uProjScale.value=ct,et.uniforms.uPixelRatio.value=U,et.uniforms.uUnit.value=ve,et.uniforms.uNear.value=q-ve*.9,et.uniforms.uFar.value=q+ve*1.1;se.uniforms.uProjScale.value=ct,se.uniforms.uPixelRatio.value=U,se.uniforms.uUnit.value=1;for(const et of p)et.uniforms.uNear.value=q-ve,et.uniforms.uFar.value=q+ve*1.2,et.uniforms.uScan.value=18/ve;V.fog.near=q-ve*.4,V.fog.far=q+ve*1.35});const ue=()=>{const he=vt(x).getBoundingClientRect();le=Math.max(1,he.width),oe=Math.max(1,he.height),H.setSize(le,oe,!1),ee.aspect=le/oe,ee.updateProjectionMatrix(),vt(f)?.()},Q=new ResizeObserver(ue);Q.observe(vt(x)),t()&&Q.observe(t()),ue();let ce=0,de=0,ne=0,Ue=0;const Ce=he=>{const pe=vt(x).getBoundingClientRect();ne=Wi.clamp((he.clientX-pe.left)/pe.width-.5,-.75,.75),Ue=Wi.clamp((he.clientY-pe.top)/pe.height-.5,-.75,.75)},ht=()=>{ne=0,Ue=0};g()&&!O&&(window.addEventListener("pointermove",Ce,{passive:!0}),document.documentElement.addEventListener("pointerleave",ht));let at=!0,Ut=0;const Yt=new IntersectionObserver(([he])=>at=he.isIntersecting,{threshold:.01});Yt.observe(vt(x));let Xn=0;const pr=()=>{Xn||(Xn=requestAnimationFrame(()=>{Xn=0;const he=vt(x).getBoundingClientRect();Ut=Wi.clamp(-he.top/Math.max(1,window.innerHeight),-1,1)}
4316))};window.addEventListener("scroll",pr,{passive:!0});const li=new F;let ci=0,hn=0,qn=0,Vi=performance.now();const yn=-.28,Yn=he=>{qn=requestAnimationFrame(Yn);const pe=Math.min(.05,(he-Vi)/1e3);if(Vi=he,!at)return;hn+=pe,ce+=(ne-ce)*Math.min(1,pe*3.2),de+=(Ue-de)*Math.min(1,pe*3.2);const Oe=Math.min(1,Math.abs(ce)*1.4);ci+=pe*d()*(1+Oe*.9),He.rotation.set(yn+de*.55+Ut*.5,ci+ce*.7,0),He.position.y=ke+Ut*u()*ve,ee.position.x+=(ce*.9-ee.position.x)*Math.min(1,pe*2.5),ee.position.y+=(-de*.6-ee.position.y)*Math.min(1,pe*2.5),ee.lookAt(Ie*.15,ke*.15,0),T.rotation.z+=pe*.08,T.rotation.x=Math.sin(hn*.2)*.12;for(const me of p)me.uniforms.uTime.value=hn;for(const me of G){const Ee=me.phase+hn*me.speed;li.set(Math.cos(Ee)*me.radius,0,Math.sin(Ee)*me.radius),li.applyAxisAngle(new F(1,0,0),me.incl),me.group.position.copy(li),me.group.rotation.x+=pe*me.spin.x,me.group.rotation.y+=pe*me.spin.y,me.group.rotation.z+=pe*me.spin.z}if(ae&&X){ae.rotation.y=-He.rotation.y+hn*.25,X.rotation.x+=pe*.7,X.rotation.y+=pe*.9;const me=1+Math.sin(hn*2.1)*.06;X.scale.setScalar(me);const{g1:Ee,g2:ct}=ae.userData;Ee.rotation.z+=pe*.5,ct.rotation.x+=pe*.35}if(!I){for(let me=0;me<Ge.length;me++){const Ee=Ge[me];Ee.t+=pe*Ee.speed;const[ct,et]=nt[Ee.edge];Ee.t>=1&&(Ze(Ee.dir===1?et:ct,Ee.hue),Object.assign(Ee,Se()));const St=Ee.dir===1?$[ct]:$[et],Zt=Ee.dir===1?$[et]:$[ct];for(let Kt=0;Kt<fe;Kt++){const ui=Math.max(0,Ee.t-Kt*.03),ki=St.x+(Zt.x-St.x)*ui,v=St.y+(Zt.y-St.y)*ui,L=St.z+(Zt.z-St.z)*ui,k=Math.hypot(ki,v,L)||1,z=(1+Math.sin(Math.PI*ui)*.08)/k,B=(me*fe+Kt)*3;re[B]=ki*z,re[B+1]=v*z,re[B+2]=L*z,Ne[B]=Ee.hue.r,Ne[B+1]=Ee.hue.g,Ne[B+2]=Ee.hue.b}}Ve.attributes.position.needsUpdate=!0,Ve.attributes.aColor.needsUpdate=!0;for(let me=0;me<Be;me++){const Ee=ye[me];Ee.live&&(Ee.t+=pe*1.6,Ee.t>=1&&(Ee.live=!1));const ct=$[Ee.node];qe[me*3]=ct.x,qe[me*3+1]=ct.y,qe[me*3+2]=ct.z,it[me*3]=Ee.hue.r,it[me*3+1]=Ee.hue.g,it[me*3+2]=Ee.hue.b;const et=1-Math.pow(1-Math.min(1,Ee.t),3);ze[me]=Ee.live?.08+et*.5:0,je[me]=Ee.live?(1-Ee.t)*.9:0}C.attributes.position.needsUpdate=!0,C.attributes.aColor.needsUpdate=!0,C.attributes.aSize.needsUpdate=!0,C.attributes.aAlpha.needsUpdate=!0,J.position.y=Math.sin(hn*.15)*.4+Ut*u()*.35,J.rotation.z=Math.sin(hn*.05)*.03}H.render(V,ee)};return I?(Yn(performance.now()+16),cancelAnimationFrame(qn)):qn=requestAnimationFrame(Yn),()=>{cancelAnimationFrame(qn),Xn&&cancelAnimationFrame(Xn),Q.disconnect(),Yt.disconnect(),window.removeEventListener("pointermove",Ce),window.removeEventListener("scroll",pr),document.documentElement.removeEventListener("pointerleave",ht),V.traverse(he=>{const pe=he;pe.geometry?.dispose?.();const Oe=pe.material;Array.isArray(Oe)?Oe.forEach(me=>me.dispose()):Oe?.dispose?.()}),Y.dispose(),H.dispose(),jn(f,null)}}),hc(()=>(dc(t()),vt(f)),()=>{t(),vt(f)?.()}),pc(),bl();var R=ag(),_=Ml(R);{var b=I=>{rg(I,{radius:.3,get nodeCount(){return r()},get packetCount(){return a()}})},P=I=>{var O=sg();ns(O,H=>jn(S,H),()=>vt(S)),ea(I,O)};mc(_,I=>{vt(m)?I(b):I(P,!1)})}Sl(R),ns(R,I=>jn(x,I),()=>vt(x)),El(()=>Tl(R,1,`absolute inset-0 ${h()??""}`)),ea(i,R),yl()}export{mg as default};
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.