1import{F as Jc}from"./FibreBackground-uBo2RFs6.js";import{d as jt,w as jc,o as cs,a as eo,b as Pe,c as ke,e as B,r as $t,_ as fi,n as ta,f as Jl,g as na,F as Zt,h as Jt,i as jl,j as cn,k as Pt,l as yt,t as Qe,m as Lt,u as dt,R as hn,p as dn,q as Oi,s as ia,v as Ot,x as Qc,y as eu,z as tu,A as nu,B as iu,C as ru,D as su,E as au,G as ou,H as lu,I as cu,J as uu}from"./index-25iNi6zz.js";import{B as hu}from"./BrandWaves-CeL4LMUK.js";import{a as ra}from"./aiInitiatives-DxTXx3Z4.js";/** 2 * @license 3 * Copyright 2010-2026 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const to="184",du=0,Fo=1,fu=2,Yr=1,pu=2,tr=3,jn=0,Dt=1,Dn=2,Nn=0,Bi=1,kt=2,Oo=3,Bo=4,mu=5,oi=100,gu=101,_u=102,vu=103,xu=104,Mu=200,Su=201,yu=202,Eu=203,sa=204,aa=205,bu=206,Tu=207,Au=208,wu=209,Ru=210,Cu=211,Pu=212,Lu=213,Du=214,oa=0,la=1,ca=2,Gi=3,ua=4,ha=5,da=6,fa=7,Ql=0,Iu=1,Uu=2,Mn=0,ec=1,tc=2,nc=3,ic=4,rc=5,sc=6,ac=7,oc=300,hi=301,Vi=302,gs=303,_s=304,us=306,pa=1e3,Un=1001,ma=1002,Et=1003,Nu=1004,_r=1005,Bt=1006,vs=1007,ci=1008,Kt=1009,lc=1010,cc=1011,or=1012,no=1013,yn=1014,vn=1015,Bn=1016,io=1017,ro=1018,lr=1020,uc=35902,hc=35899,dc=1021,fc=1022,un=1023,zn=1026,ui=1027,pc=1028,so=1029,di=1030,ao=1031,oo=1033,$r=33776,Kr=33777,Zr=33778,Jr=33779,ga=35840,_a=35841,va=35842,xa=35843,Ma=36196,Sa=37492,ya=37496,Ea=37488,ba=37489,Qr=37490,Ta=37491,Aa=37808,wa=37809,Ra=37810,Ca=37811,Pa=37812,La=37813,Da=37814,Ia=37815,Ua=37816,Na=37817,Fa=37818,Oa=37819,Ba=37820,za=37821,Ga=36492,Va=36494,ka=36495,Ha=36283,Wa=36284,es=36285,Xa=36286,Fu=3200,qa=0,Ou=1,Zn="",Ht="srgb",ts="srgb-linear",ns="linear",tt="srgb",vi=7680,zo=519,Bu=512,zu=513,Gu=514,lo=515,Vu=516,ku=517,co=518,Hu=519,Ya=35044,Go="300 es",xn=2e3,cr=2001;function Wu(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function ur(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Xu(){const i=ur("canvas");return i.style.display="block",i}const Vo={};function is(...i){const e="THREE."+i.shift();console.log(e,...i)}function mc(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 Ce(...i){i=mc(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function $e(...i){i=mc(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function $a(...i){const e=i.join(" ");e in Vo||(Vo[e]=!0,Ce(...i))}function qu(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 Yu={[oa]:la,[ca]:da,[ua]:fa,[Gi]:ha,[la]:oa,[da]:ca,[fa]:ua,[ha]:Gi};class pi{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 Nt=["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 ko=1234567;const ir=Math.PI/180,hr=180/Math.PI;function Fn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Nt[i&255]+Nt[i>>8&255]+Nt[i>>16&255]+Nt[i>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[n&255]+Nt[n>>8&255]+Nt[n>>16&255]+Nt[n>>24&255]).toLowerCase()}function Xe(i,e,t){return Math.max(e,Math.min(t,i))}function uo(i,e){return(i%e+e)%e}function $u(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}
vendor: 4,265 bytes, line 5
5function Ku(i,e,t){return i!==e?(t-i)/(e-i):0}function rr(i,e,t){return(1-t)*i+t*e}function Zu(i,e,t,n){return rr(i,e,1-Math.exp(-t*n))}function Ju(i,e=1){return e-Math.abs(uo(i,e*2)-e)}function ju(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Qu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function eh(i,e){return i+Math.floor(Math.random()*(e-i+1))}function th(i,e){return i+Math.random()*(e-i)}function nh(i){return i*(.5-Math.random())}function ih(i){i!==void 0&&(ko=i);let e=ko+=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 rh(i){return i*ir}function sh(i){return i*hr}function ah(i){return(i&i-1)===0&&i!==0}function oh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function lh(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ch(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),d=a((e+n)/2),m=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*d,l*m,l*u,o*c);break;case"YZY":i.set(l*u,o*d,l*m,o*c);break;case"ZXZ":i.set(l*m,l*u,o*d,o*c);break;case"XZX":i.set(o*d,l*_,l*p,o*c);break;case"YXY":i.set(l*p,o*d,l*_,o*c);break;case"ZYZ":i.set(l*_,l*p,o*d,o*c);break;default:Ce("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ln(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function nt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Tn={DEG2RAD:ir,RAD2DEG:hr,generateUUID:Fn,clamp:Xe,euclideanModulo:uo,mapLinear:$u,inverseLerp:Ku,lerp:rr,damp:Zu,pingpong:Ju,smoothstep:ju,smootherstep:Qu,randInt:eh,randFloat:th,randFloatSpread:nh,seededRandom:ih,degToRad:rh,radToDeg:sh,isPowerOfTwo:ah,ceilPowerOfTwo:oh,floorPowerOfTwo:lh,setQuaternionFromProperEuler:ch,normalize:nt,denormalize:ln},Eo=class Eo{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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){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=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}
vendor: 67,534 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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(Xe(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}};Eo.prototype.isVector2=!0;let Te=Eo;class mi{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 l=n[r+0],c=n[r+1],d=n[r+2],m=n[r+3],u=s[a+0],p=s[a+1],_=s[a+2],y=s[a+3];if(m!==y||l!==u||c!==p||d!==_){let g=l*u+c*p+d*_+m*y;g<0&&(u=-u,p=-p,_=-_,y=-y,g=-g);let f=1-o;if(g<.9995){const S=Math.acos(g),E=Math.sin(S);f=Math.sin(f*S)/E,o=Math.sin(o*S)/E,l=l*f+u*o,c=c*f+p*o,d=d*f+_*o,m=m*f+y*o}else{l=l*f+u*o,c=c*f+p*o,d=d*f+_*o,m=m*f+y*o;const S=1/Math.sqrt(l*l+c*c+d*d+m*m);l*=S,c*=S,d*=S,m*=S}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],d=n[r+3],m=s[a],u=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+d*m+l*p-c*u,e[t+1]=l*_+d*u+c*m-o*p,e[t+2]=c*_+d*p+o*u-l*m,e[t+3]=d*_-o*m-l*u-c*p,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,l=Math.sin,c=o(n/2),d=o(r/2),m=o(s/2),u=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=u*d*m+c*p*_,this._y=c*p*m-u*d*_,this._z=c*d*_+u*p*m,this._w=c*d*m-u*p*_;break;case"YXZ":this._x=u*d*m+c*p*_,this._y=c*p*m-u*d*_,this._z=c*d*_-u*p*m,this._w=c*d*m+u*p*_;break;case"ZXY":this._x=u*d*m-c*p*_,this._y=c*p*m+u*d*_,this._z=c*d*_+u*p*m,this._w=c*d*m-u*p*_;break;case"ZYX":this._x=u*d*m-c*p*_,this._y=c*p*m+u*d*_,this._z=c*d*_-u*p*m,this._w=c*d*m+u*p*_;break;case"YZX":this._x=u*d*m+c*p*_,this._y=c*p*m+u*d*_,this._z=c*d*_-u*p*m,this._w=c*d*m-u*p*_;break;case"XZY":this._x=u*d*m-c*p*_,this._y=c*p*m-u*d*_,this._z=c*d*_+u*p*m,this._w=c*d*m+u*p*_;break;default:Ce("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],l=t[9],c=t[2],d=t[6],m=t[10],u=n+o+m;if(u>0){const p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>m){const p=2*Math.sqrt(1+n-o-m);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>m){const p=2*Math.sqrt(1+o-n-m);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+m-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Xe(this.dot(e),-1,1)))}rotateTowards(e,t){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,l=t._y,c=t._z,d=t._w;return this._x=n*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-n*c,this._z=s*d+a*c+n*l-r*o,this._w=a*d-n*o-r*l-s*c,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 l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+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 bo=class bo{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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ho.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ho.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,l=e.w,c=2*(a*r-o*n),d=2*(o*t-s*r),m=2*(s*n-a*t);return this.x=t+l*c+a*m-o*d,this.y=n+l*d+o*c-s*m,this.z=r+l*m+s*d-a*c,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=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this.z=Xe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this.z=Xe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,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 xs.copy(this).projectOnVector(e),this.sub(xs)}reflect(e){return this.sub(xs.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(Xe(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}};bo.prototype.isVector3=!0;let L=bo;const xs=new L,Ho=new mi,To=class To{constructor(e,t,n,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=n,d[7]=a,d[8]=c,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],l=n[6],c=n[1],d=n[4],m=n[7],u=n[2],p=n[5],_=n[8],y=r[0],g=r[3],f=r[6],S=r[1],E=r[4],b=r[7],w=r[2],T=r[5],P=r[8];return s[0]=a*y+o*S+l*w,s[3]=a*g+o*E+l*T,s[6]=a*f+o*b+l*P,s[1]=c*y+d*S+m*w,s[4]=c*g+d*E+m*T,s[7]=c*f+d*b+m*P,s[2]=u*y+p*S+_*w,s[5]=u*g+p*E+_*T,s[8]=u*f+p*b+_*P,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],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-n*s*d+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],m=d*a-o*c,u=o*l-d*s,p=c*s-a*l,_=t*m+n*u+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/_;return e[0]=m*y,e[1]=(r*c-d*n)*y,e[2]=(o*n-r*a)*y,e[3]=u*y,e[4]=(d*t-r*l)*y,e[5]=(r*s-o*t)*y,e[6]=p*y,e[7]=(n*l-c*t)*y,e[8]=(a*t-n*s)*y,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 l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Ms.makeScale(e,t)),this}rotate(e){return this.premultiply(Ms.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ms.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)}};To.prototype.isMatrix3=!0;let Ue=To;const Ms=new Ue,Wo=new Ue().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Xo=new Ue().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function uh(){const i={enabled:!0,workingColorSpace:ts,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===tt&&(r.r=On(r.r),r.g=On(r.g),r.b=On(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===tt&&(r.r=zi(r.r),r.g=zi(r.g),r.b=zi(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===Zn?ns: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 $a("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return $a("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({[ts]:{primaries:e,whitePoint:n,transfer:ns,toXYZ:Wo,fromXYZ:Xo,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ht},outputColorSpaceConfig:{drawingBufferColorSpace:Ht}},[Ht]:{primaries:e,whitePoint:n,transfer:tt,toXYZ:Wo,fromXYZ:Xo,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ht}}}),i}const qe=uh();function On(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function zi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let xi;class hh{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{xi===void 0&&(xi=ur("canvas")),xi.width=e.width,xi.height=e.height;const r=xi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=xi}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=ur("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]=On(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(On(t[n]/255)*255):t[n]=On(t[n]);return{data:t,width:e.width,height:e.height}}else return Ce("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let dh=0;class ho{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=Fn(),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(Ss(r[a].image)):s.push(Ss(r[a]))}else s=Ss(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ss(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?hh.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Ce("Texture: Unable to serialize Texture."),{})}let fh=0;const ys=new L;class It extends pi{constructor(e=It.DEFAULT_IMAGE,t=It.DEFAULT_MAPPING,n=Un,r=Un,s=Bt,a=ci,o=un,l=Kt,c=It.DEFAULT_ANISOTROPY,d=Zn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fh++}),this.uuid=Fn(),this.name="",this.source=new ho(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ue,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(ys).x}get height(){return this.source.getSize(ys).y}get depth(){return this.source.getSize(ys).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){Ce(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ce(`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!==oc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case pa:e.x=e.x-Math.floor(e.x);break;case Un:e.x=e.x<0?0:1;break;case ma: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 pa:e.y=e.y-Math.floor(e.y);break;case Un:e.y=e.y<0?0:1;break;case ma: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++}}It.DEFAULT_IMAGE=null;It.DEFAULT_MAPPING=oc;It.DEFAULT_ANISOTROPY=1;const Ao=class Ao{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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}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 l=e.elements,c=l[0],d=l[4],m=l[8],u=l[1],p=l[5],_=l[9],y=l[2],g=l[6],f=l[10];if(Math.abs(d-u)<.01&&Math.abs(m-y)<.01&&Math.abs(_-g)<.01){if(Math.abs(d+u)<.1&&Math.abs(m+y)<.1&&Math.abs(_+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,b=(p+1)/2,w=(f+1)/2,T=(d+u)/4,P=(m+y)/4,v=(_+g)/4;return E>b&&E>w?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=T/n,s=P/n):b>w?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=T/r,s=v/r):w<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),n=P/s,r=v/s),this.set(n,r,s,t),this}let S=Math.sqrt((g-_)*(g-_)+(m-y)*(m-y)+(u-d)*(u-d));return Math.abs(S)<.001&&(S=1),this.x=(g-_)/S,this.y=(m-y)/S,this.z=(u-d)/S,this.w=Math.acos((c+p+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=Xe(this.x,e.x,t.x),this.y=Xe(this.y,e.y,t.y),this.z=Xe(this.z,e.z,t.z),this.w=Xe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Xe(this.x,e,t),this.y=Xe(this.y,e,t),this.z=Xe(this.z,e,t),this.w=Xe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Xe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Ao.prototype.isVector4=!0;let pt=Ao;class ph extends pi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Bt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new It(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.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_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=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let 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 ho(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Sn extends ph{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class gc extends It{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=Et,this.minFilter=Et,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class mh extends It{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=Et,this.minFilter=Et,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ls=class ls{constructor(e,t,n,r,s,a,o,l,c,d,m,u,p,_,y,g){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,l,c,d,m,u,p,_,y,g)}set(e,t,n,r,s,a,o,l,c,d,m,u,p,_,y,g){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]=l,f[2]=c,f[6]=d,f[10]=m,f[14]=u,f[3]=p,f[7]=_,f[11]=y,f[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ls().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.determinant()===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.determinant()===0)return this.identity();const t=this.elements,n=e.elements,r=1/Mi.setFromMatrixColumn(e,0).length(),s=1/Mi.setFromMatrixColumn(e,1).length(),a=1/Mi.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),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const u=a*d,p=a*m,_=o*d,y=o*m;t[0]=l*d,t[4]=-l*m,t[8]=c,t[1]=p+_*c,t[5]=u-y*c,t[9]=-o*l,t[2]=y-u*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const u=l*d,p=l*m,_=c*d,y=c*m;t[0]=u+y*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*m,t[5]=a*d,t[9]=-o,t[2]=p*o-_,t[6]=y+u*o,t[10]=a*l}else if(e.order==="ZXY"){const u=l*d,p=l*m,_=c*d,y=c*m;t[0]=u-y*o,t[4]=-a*m,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*d,t[9]=y-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const u=a*d,p=a*m,_=o*d,y=o*m;t[0]=l*d,t[4]=_*c-p,t[8]=u*c+y,t[1]=l*m,t[5]=y*c+u,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const u=a*l,p=a*c,_=o*l,y=o*c;t[0]=l*d,t[4]=y-u*m,t[8]=_*m+p,t[1]=m,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*m+_,t[10]=u-y*m}else if(e.order==="XZY"){const u=a*l,p=a*c,_=o*l,y=o*c;t[0]=l*d,t[4]=-m,t[8]=c*d,t[1]=u*m+y,t[5]=a*d,t[9]=p*m-_,t[2]=_*m-p,t[6]=o*d,t[10]=y*m+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(gh,e,_h)}lookAt(e,t,n){const r=this.elements;return Xt.subVectors(e,t),Xt.lengthSq()===0&&(Xt.z=1),Xt.normalize(),Wn.crossVectors(n,Xt),Wn.lengthSq()===0&&(Math.abs(n.z)===1?Xt.x+=1e-4:Xt.z+=1e-4,Xt.normalize(),Wn.crossVectors(n,Xt)),Wn.normalize(),vr.crossVectors(Xt,Wn),r[0]=Wn.x,r[4]=vr.x,r[8]=Xt.x,r[1]=Wn.y,r[5]=vr.y,r[9]=Xt.y,r[2]=Wn.z,r[6]=vr.z,r[10]=Xt.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],l=n[8],c=n[12],d=n[1],m=n[5],u=n[9],p=n[13],_=n[2],y=n[6],g=n[10],f=n[14],S=n[3],E=n[7],b=n[11],w=n[15],T=r[0],P=r[4],v=r[8],A=r[12],U=r[1],C=r[5],O=r[9],Y=r[13],$=r[2],N=r[6],V=r[10],H=r[14],K=r[3],Z=r[7],he=r[11],re=r[15];return s[0]=a*T+o*U+l*$+c*K,s[4]=a*P+o*C+l*N+c*Z,s[8]=a*v+o*O+l*V+c*he,s[12]=a*A+o*Y+l*H+c*re,s[1]=d*T+m*U+u*$+p*K,s[5]=d*P+m*C+u*N+p*Z,s[9]=d*v+m*O+u*V+p*he,s[13]=d*A+m*Y+u*H+p*re,s[2]=_*T+y*U+g*$+f*K,s[6]=_*P+y*C+g*N+f*Z,s[10]=_*v+y*O+g*V+f*he,s[14]=_*A+y*Y+g*H+f*re,s[3]=S*T+E*U+b*$+w*K,s[7]=S*P+E*C+b*N+w*Z,s[11]=S*v+E*O+b*V+w*he,s[15]=S*A+E*Y+b*H+w*re,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],l=e[9],c=e[13],d=e[2],m=e[6],u=e[10],p=e[14],_=e[3],y=e[7],g=e[11],f=e[15],S=l*p-c*u,E=o*p-c*m,b=o*u-l*m,w=a*p-c*d,T=a*u-l*d,P=a*m-o*d;return t*(y*S-g*E+f*b)-n*(_*S-g*w+f*T)+r*(_*E-y*w+f*P)-s*(_*b-y*T+g*P)}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],l=e[6],c=e[7],d=e[8],m=e[9],u=e[10],p=e[11],_=e[12],y=e[13],g=e[14],f=e[15],S=t*o-n*a,E=t*l-r*a,b=t*c-s*a,w=n*l-r*o,T=n*c-s*o,P=r*c-s*l,v=d*y-m*_,A=d*g-u*_,U=d*f-p*_,C=m*g-u*y,O=m*f-p*y,Y=u*f-p*g,$=S*Y-E*O+b*C+w*U-T*A+P*v;if($===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/$;return e[0]=(o*Y-l*O+c*C)*N,e[1]=(r*O-n*Y-s*C)*N,e[2]=(y*P-g*T+f*w)*N,e[3]=(u*T-m*P-p*w)*N,e[4]=(l*U-a*Y-c*A)*N,e[5]=(t*Y-r*U+s*A)*N,e[6]=(g*b-_*P-f*E)*N,e[7]=(d*P-u*b+p*E)*N,e[8]=(a*O-o*U+c*v)*N,e[9]=(n*U-t*O-s*v)*N,e[10]=(_*T-y*b+f*S)*N,e[11]=(m*b-d*T-p*S)*N,e[12]=(o*A-a*C-l*v)*N,e[13]=(t*C-n*A+r*v)*N,e[14]=(y*E-_*w-g*S)*N,e[15]=(d*w-m*E+u*S)*N,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,l=e.z,c=s*a,d=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+n,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+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,l=t._w,c=s+s,d=a+a,m=o+o,u=s*c,p=s*d,_=s*m,y=a*d,g=a*m,f=o*m,S=l*c,E=l*d,b=l*m,w=n.x,T=n.y,P=n.z;return r[0]=(1-(y+f))*w,r[1]=(p+b)*w,r[2]=(_-E)*w,r[3]=0,r[4]=(p-b)*T,r[5]=(1-(u+f))*T,r[6]=(g+S)*T,r[7]=0,r[8]=(_+E)*P,r[9]=(g-S)*P,r[10]=(1-(u+y))*P,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.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let a=Mi.set(r[0],r[1],r[2]).length();const o=Mi.set(r[4],r[5],r[6]).length(),l=Mi.set(r[8],r[9],r[10]).length();s<0&&(a=-a),sn.copy(this);const c=1/a,d=1/o,m=1/l;return sn.elements[0]*=c,sn.elements[1]*=c,sn.elements[2]*=c,sn.elements[4]*=d,sn.elements[5]*=d,sn.elements[6]*=d,sn.elements[8]*=m,sn.elements[9]*=m,sn.elements[10]*=m,t.setFromRotationMatrix(sn),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,r,s,a,o=xn,l=!1){const c=this.elements,d=2*s/(t-e),m=2*s/(n-r),u=(t+e)/(t-e),p=(n+r)/(n-r);let _,y;if(l)_=s/(a-s),y=a*s/(a-s);else if(o===xn)_=-(a+s)/(a-s),y=-2*a*s/(a-s);else if(o===cr)_=-a/(a-s),y=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=m,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=_,c[14]=y,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=xn,l=!1){const c=this.elements,d=2/(t-e),m=2/(n-r),u=-(t+e)/(t-e),p=-(n+r)/(n-r);let _,y;if(l)_=1/(a-s),y=a/(a-s);else if(o===xn)_=-2/(a-s),y=-(a+s)/(a-s);else if(o===cr)_=-1/(a-s),y=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=u,c[1]=0,c[5]=m,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=_,c[14]=y,c[3]=0,c[7]=0,c[11]=0,c[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}};ls.prototype.isMatrix4=!0;let ut=ls;const Mi=new L,sn=new ut,gh=new L(0,0,0),_h=new L(1,1,1),Wn=new L,vr=new L,Xt=new L,qo=new ut,Yo=new mi;class Qn{constructor(e=0,t=0,n=0,r=Qn.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],l=r[1],c=r[5],d=r[9],m=r[2],u=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Xe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Xe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-m,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Xe(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Xe(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Xe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:Ce("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return qo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(qo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Yo.setFromEuler(this),this.setFromQuaternion(Yo,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}}Qn.DEFAULT_ORDER="XYZ";class _c{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 vh=0;const $o=new L,Si=new mi,An=new ut,xr=new L,Xi=new L,xh=new L,Mh=new mi,Ko=new L(1,0,0),Zo=new L(0,1,0),Jo=new L(0,0,1),jo={type:"added"},Sh={type:"removed"},yi={type:"childadded",child:null},Es={type:"childremoved",child:null};class bt extends pi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:vh++}),this.uuid=Fn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DEFAULT_UP.clone();const e=new L,t=new Qn,n=new mi,r=new L(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 ut},normalMatrix:{value:new Ue}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new _c,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 Si.setFromAxisAngle(e,t),this.quaternion.multiply(Si),this}rotateOnWorldAxis(e,t){return Si.setFromAxisAngle(e,t),this.quaternion.premultiply(Si),this}rotateX(e){return this.rotateOnAxis(Ko,e)}rotateY(e){return this.rotateOnAxis(Zo,e)}rotateZ(e){return this.rotateOnAxis(Jo,e)}translateOnAxis(e,t){return $o.copy(e).applyQuaternion(this.quaternion),this.position.add($o.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ko,e)}translateY(e){return this.translateOnAxis(Zo,e)}translateZ(e){return this.translateOnAxis(Jo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(An.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?An.lookAt(Xi,xr,this.up):An.lookAt(xr,Xi,this.up),this.quaternion.setFromRotationMatrix(An),r&&(An.extractRotation(r.matrixWorld),Si.setFromRotationMatrix(An),this.quaternion.premultiply(Si.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?($e("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(jo),yi.child=e,this.dispatchEvent(yi),yi.child=null):$e("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(Sh),Es.child=e,this.dispatchEvent(Es),Es.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),An.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),An.multiply(e.parent.matrixWorld)),e.applyMatrix4(An),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(jo),yi.child=e,this.dispatchEvent(yi),yi.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,xh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xi,Mh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,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){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}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,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),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.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.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 l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const m=l[c];s(e.shapes,m)}else s(e.shapes,l)}}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 l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));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 l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),m=a(e.shapes),u=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),d.length>0&&(n.images=d),m.length>0&&(n.shapes=m),u.length>0&&(n.skeletons=u),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}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}}bt.DEFAULT_UP=new L(0,1,0);bt.DEFAULT_MATRIX_AUTO_UPDATE=!0;bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class In extends bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yh={type:"move"};class bs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new In,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 In,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new In,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L,this._grip.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,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const y of e.hand.values()){const g=t.getJointPose(y,n),f=this._getHandJoint(c,y);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}const d=c.joints["index-finger-tip"],m=c.joints["thumb-tip"],u=d.position.distanceTo(m.position),p=.02,_=.005;c.inputState.pinching&&u>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.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(yh)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new In;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const vc={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},Xn={h:0,s:0,l:0},Mr={h:0,s:0,l:0};function Ts(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 Ye{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=Ht){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qe.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,qe.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=qe.workingColorSpace){if(e=uo(e,1),t=Xe(t,0,1),n=Xe(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=Ts(a,s,e+1/3),this.g=Ts(a,s,e),this.b=Ts(a,s,e-1/3)}return qe.colorSpaceToWorking(this,r),this}setStyle(e,t=Ht){function n(s){s!==void 0&&parseFloat(s)<1&&Ce("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:Ce("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);Ce("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ht){const n=vc[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ce("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=On(e.r),this.g=On(e.g),this.b=On(e.b),this}copyLinearToSRGB(e){return this.r=zi(e.r),this.g=zi(e.g),this.b=zi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ht){return qe.workingToColorSpace(Ft.copy(this),e),Math.round(Xe(Ft.r*255,0,255))*65536+Math.round(Xe(Ft.g*255,0,255))*256+Math.round(Xe(Ft.b*255,0,255))}getHexString(e=Ht){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qe.workingColorSpace){qe.workingToColorSpace(Ft.copy(this),t);const n=Ft.r,r=Ft.g,s=Ft.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const m=a-o;switch(c=d<=.5?m/(a+o):m/(2-a-o),a){case n:l=(r-s)/m+(r<s?6:0);break;case r:l=(s-n)/m+2;break;case s:l=(n-r)/m+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=qe.workingColorSpace){return qe.workingToColorSpace(Ft.copy(this),t),e.r=Ft.r,e.g=Ft.g,e.b
vendor: 5,268 bytes, line 5
5=Ft.b,e}getStyle(e=Ht){qe.workingToColorSpace(Ft.copy(this),e);const t=Ft.r,n=Ft.g,r=Ft.b;return e!==Ht?`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(Xn),this.setHSL(Xn.h+e,Xn.s+t,Xn.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(Xn),e.getHSL(Mr);const n=rr(Xn.h,Mr.h,t),r=rr(Xn.s,Mr.s,t),s=rr(Xn.l,Mr.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 Ft=new Ye;Ye.NAMES=vc;class Eh extends bt{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 Qn,this.environmentIntensity=1,this.environmentRotation=new Qn,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()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const an=new L,wn=new L,As=new L,Rn=new L,Ei=new L,bi=new L,Qo=new L,ws=new L,Rs=new L,Cs=new L,Ps=new pt,Ls=new pt,Ds=new pt;class nn{constructor(e=new L,t=new L,n=new L){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),wn.subVectors(n,t),As.subVectors(e,t);const a=an.dot(an),o=an.dot(wn),l=an.dot(As),c=wn.dot(wn),d=wn.dot(As),m=a*c-o*o;if(m===0)return s.set(0,0,0),null;const u=1/m,p=(c*l-o*d)*u,_=(a*d-o*l)*u;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Rn)===null?!1:Rn.x>=0&&Rn.y>=0&&Rn.x+Rn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Rn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Rn.x),l.addScaledVector(a,Rn.y),l.addScaledVector(o,Rn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return Ps.setScalar(0),Ls.setScalar(0),Ds.setScalar(0),Ps.fromBufferAttribute(e,t),Ls.fromBufferAttribute(e,n),Ds.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ps,s.x),a.addScaledVector(Ls,s.y),a.addScaledVector(Ds,s.z),a}static isFrontFacing(e,t,n,r){return an.subVectors(n,t),wn.subVectors(e,t),an.cross(wn).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),wn.subVectors(this.a,this.b),an.cross(wn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 6,180 bytes, line 5
5getInterpolation(e,t,n,r,s){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.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;Ei.subVectors(r,n),bi.subVectors(s,n),ws.subVectors(e,n);const l=Ei.dot(ws),c=bi.dot(ws);if(l<=0&&c<=0)return t.copy(n);Rs.subVectors(e,r);const d=Ei.dot(Rs),m=bi.dot(Rs);if(d>=0&&m<=d)return t.copy(r);const u=l*m-d*c;if(u<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(n).addScaledVector(Ei,a);Cs.subVectors(e,s);const p=Ei.dot(Cs),_=bi.dot(Cs);if(_>=0&&p<=_)return t.copy(s);const y=p*c-l*_;if(y<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(bi,o);const g=d*_-p*m;if(g<=0&&m-d>=0&&p-_>=0)return Qo.subVectors(s,r),o=(m-d)/(m-d+(p-_)),t.copy(r).addScaledVector(Qo,o);const f=1/(g+y+u);return a=y*f,o=u*f,t.copy(n).addScaledVector(Ei,a).addScaledVector(bi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class dr{constructor(e=new L(1/0,1/0,1/0),t=new L(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(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(),Sr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Sr.copy(n.boundingBox)),Sr.applyMatrix4(e.matrixWorld),this.union(Sr)}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),yr.subVectors(this.max,qi),Ti.subVectors(e.a,qi),Ai.subVectors(e.b,qi),wi.subVectors(e.c,qi),qn.subVectors(Ai,Ti),Yn.subVectors(wi,Ai),ni.subVectors(Ti,wi);let t=[0,-qn.z,qn.y,0,-Yn.z,Yn.y,0,-ni.z,ni.y,qn.z,0,-qn.x,Yn.z,0,-Yn.x,ni.z,0,-ni.x,-qn.y,qn.x,0,-Yn.y,Yn.x,0,-ni.y,ni.x,0];return!Is(t,Ti,Ai,wi,yr)||(t=[1,0,0,0,1,0,0,0,1],!Is(t,Ti,Ai,wi,yr))?!1:(Er.crossVectors(qn,Yn),t=[Er.x,Er.y,Er.z],Is(t,Ti,Ai,wi,yr))}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:(Cn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cn),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 Cn=[new L,new L,new L,new L,new L,new L,new L,new L],on=new L,Sr=new dr,Ti=new L,Ai=new L,wi=new L,qn=new L,Yn=new L,ni=new L,qi=new L,yr=new L,Er=new L,ii=new L;function Is(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){ii.fromArray(i,s);const o=r.x*Math.abs(ii.x)+r.y*Math.abs(ii.y)+r.z*Math.abs(ii.z),l=e.dot
vendor: 5,131 bytes, line 5
5(ii),c=t.dot(ii),d=n.dot(ii);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Mt=new L,br=new Te;let bh=0;class rn extends pi{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:bh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Ya,this.updateRanges=[],this.gpuType=vn,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++)br.fromBufferAttribute(this,t),br.applyMatrix3(e),this.setXY(t,br.x,br.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix3(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix4(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyNormalMatrix(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.transformDirection(e),this.setXYZ(t,Mt.x,Mt.y,Mt.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=ln(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ln(t,this.array)),t}setX(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ln(t,this.array)),t}setY(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ln(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ln(t,this.array)),t}setW(e,t){return this.normalized&&(t=nt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),r=nt(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=nt(t,this.array),n=nt(n,this.array),r=nt(r,this.array),s=nt(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 this.name!==""&&(e.name=this.name),this.usage!==Ya&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class xc extends rn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Mc extends rn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Tt extends rn{constructor(e,t,n){super(new Float32Array(e),t,n)}}const Th=new dr,Yi=new L,Us=new L;class fr{constructor(e=new L,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Th.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: 18,236 bytes, line 5
5applyMatrix4(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):(Us.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Yi.copy(e.center).add(Us)),this.expandByPoint(Yi.copy(e.center).sub(Us))),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 Ah=0;const en=new ut,Ns=new bt,Ri=new L,qt=new dr,$i=new dr,Rt=new L;class Ct extends pi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ah++}),this.uuid=Fn(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Wu(e)?Mc:xc)(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 Ue().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}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 Ns.lookAt(e),Ns.updateMatrix(),this.applyMatrix4(Ns.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ri).negate(),this.translate(Ri.x,Ri.y,Ri.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 Tt(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&&Ce("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 dr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$e("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];qt.setFromBufferAttribute(s),this.morphTargetsRelative?(Rt.addVectors(this.boundingBox.min,qt.min),this.boundingBox.expandByPoint(Rt),Rt.addVectors(this.boundingBox.max,qt.max),this.boundingBox.expandByPoint(Rt)):(this.boundingBox.expandByPoint(qt.min),this.boundingBox.expandByPoint(qt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&$e('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 fr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$e("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new L,1/0);return}if(e){const n=this.boundingSphere.center;if(qt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];$i.setFromBufferAttribute(o),this.morphTargetsRelative?(Rt.addVectors(qt.min,$i.min),qt.expandByPoint(Rt),Rt.addVectors(qt.max,$i.max),qt.expandByPoint(Rt)):(qt.expandByPoint($i.min),qt.expandByPoint($i.max))}qt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Rt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Rt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)Rt.fromBufferAttribute(o,c),l&&(Ri.fromBufferAttribute(e,c),Rt.add(Ri)),r=Math.max(r,n.distanceToSquared(Rt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&$e('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){$e("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new rn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let v=0;v<n.count;v++)o[v]=new L,l[v]=new L;const c=new L,d=new L,m=new L,u=new Te,p=new Te,_=new Te,y=new L,g=new L;function f(v,A,U){c.fromBufferAttribute(n,v),d.fromBufferAttribute(n,A),m.fromBufferAttribute(n,U),u.fromBufferAttribute(s,v),p.fromBufferAttribute(s,A),_.fromBufferAttribute(s,U),d.sub(c),m.sub(c),p.sub(u),_.sub(u);const C=1/(p.x*_.y-_.x*p.y);isFinite(C)&&(y.copy(d).multiplyScalar(_.y).addScaledVector(m,-p.y).multiplyScalar(C),g.copy(m).multiplyScalar(p.x).addScaledVector(d,-_.x).multiplyScalar(C),o[v].add(y),o[A].add(y),o[U].add(y),l[v].add(g),l[A].add(g),l[U].add(g))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let v=0,A=S.length;v<A;++v){const U=S[v],C=U.start,O=U.count;for(let Y=C,$=C+O;Y<$;Y+=3)f(e.getX(Y+0),e.getX(Y+1),e.getX(Y+2))}const E=new L,b=new L,w=new L,T=new L;function P(v){w.fromBufferAttribute(r,v),T.copy(w);const A=o[v];E.copy(A),E.sub(w.multiplyScalar(w.dot(A))).normalize(),b.crossVectors(T,A);const C=b.dot(l[v])<0?-1:1;a.setXYZW(v,E.x,E.y,E.z,C)}for(let v=0,A=S.length;v<A;++v){const U=S[v],C=U.start,O=U.count;for(let Y=C,$=C+O;Y<$;Y+=3)P(e.getX(Y+0)),P(e.getX(Y+1)),P(e.getX(Y+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new rn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,p=n.count;u<p;u++)n.setXYZ(u,0,0,0);const r=new L,s=new L,a=new L,o=new L,l=new L,c=new L,d=new L,m=new L;if(e)for(let u=0,p=e.count;u<p;u+=3){const _=e.getX(u+0),y=e.getX(u+1),g=e.getX(u+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,y),a.fromBufferAttribute(t,g),d.subVectors(a,s),m.subVectors(r,s),d.cross(m),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,y),c.fromBufferAttribute(n,g),o.add(d),l.add(d),c.add(d),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(y,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let u=0,p=t.count;u<p;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),d.subVectors(a,s),m.subVectors(r,s),d.cross(m),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++)Rt.fromBufferAttribute(e,t),Rt.normalize(),e.setXYZ(t,Rt.x,Rt.y,Rt.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,m=o.normalized,u=new c.constructor(l.length*d);let p=0,_=0;for(let y=0,g=l.length;y<g;y++){o.isInterleavedBufferAttribute?p=l[y]*o.data.stride+o.offset:p=l[y]*d;for(let f=0;f<d;f++)u[_++]=c[p++]}return new rn(u,d,m)}if(this.index===null)return Ce("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ct,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,m=c.length;d<m;d++){const u=c[d],p=e(u,n);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let m=0,u=c.length;m<u;m++){const p=c[m];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=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 c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],m=s[c];for(let u=0,p=m.length;u<p;u++)d.push(m[u].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const m=a[c];this.addGroup(m.start,m.count,m.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class wh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ya,this.updateRanges=[],this.version=0,this.uuid=Fn()}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=Fn()),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){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Gt=new L;class rs{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++)Gt.fromBufferAttribute(this,t),Gt.applyMatrix4(e),this.setXYZ(t,Gt.x,Gt.y,Gt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Gt.fromBufferAttribute(this,t),Gt.applyNormalMatrix(e),this.setXYZ(t,Gt.x,Gt.y,Gt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Gt.fromBufferAttribute(this,t),Gt.transformDirection(e),this.setXYZ(t,Gt.x,Gt.y,Gt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ln(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=nt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ln(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ln(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ln(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ln(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=nt(t,this.array),n=nt(n,this.array),r=nt(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=nt(t,this.array),n=nt(n,this.array),r=nt(r,this.array),s=nt(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){is("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 rn(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 rs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){is("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}}}let Rh=0;class ei extends pi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Rh++}),this.uuid=Fn(),this.name="",this.type="Material",this.blending=Bi,this.side=jn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=sa,this.blendDst=aa,this.blendEquation=oi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=Gi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=zo,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vi,this.stencilZFail=vi,this.stencilZPass=vi,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){Ce(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ce(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):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"}};
vendor: 6,372 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Bi&&(n.blending=this.blending),this.side!==jn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==sa&&(n.blendSrc=this.blendSrc),this.blendDst!==aa&&(n.blendDst=this.blendDst),this.blendEquation!==oi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Gi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==zo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vi&&
vendor: 11,879 bytes, line 5
5(n.stencilFail=this.stencilFail),this.stencilZFail!==vi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}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}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.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.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 Sc extends ei{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(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 Ci;const Ki=new L,Pi=new L,Li=new L,Di=new Te,Zi=new Te,yc=new ut,Tr=new L,Ji=new L,Ar=new L,el=new Te,Fs=new Te,tl=new Te;class Ch extends bt{constructor(e=new Sc){if(super(),this.isSprite=!0,this.type="Sprite",Ci===void 0){Ci=new Ct;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 wh(t,5);Ci.setIndex([0,1,2,0,2,3]),Ci.setAttribute("position",new rs(n,3,0,!1)),Ci.setAttribute("uv",new rs(n,2,3,!1))}this.geometry=Ci,this.material=e,this.center=new Te(.5,.5),this.count=1}raycast(e,t){e.camera===null&&$e('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Pi.setFromMatrixScale(this.matrixWorld),yc.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Li.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Pi.multiplyScalar(-Li.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;wr(Tr.set(-.5,-.5,0),Li,a,Pi,r,s),wr(Ji.set(.5,-.5,0),Li,a,Pi,r,s),wr(Ar.set(.5,.5,0),Li,a,Pi,r,s),el.set(0,0),Fs.set(1,0),tl.set(1,1);let o=e.ray.intersectTriangle(Tr,Ji,Ar,!1,Ki);if(o===null&&(wr(Ji.set(-.5,.5,0),Li,a,Pi,r,s),Fs.set(0,1),o=e.ray.intersectTriangle(Tr,Ar,Ji,!1,Ki),o===null))return;const l=e.ray.origin.distanceTo(Ki);l<e.near||l>e.far||t.push({distance:l,point:Ki.clone(),uv:nn.getInterpolation(Ki,Tr,Ji,Ar,el,Fs,tl,new Te),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 wr(i,e,t,n,r,s){Di.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(Zi.x=s*Di.x-r*Di.y,Zi.y=r*Di.x+s*Di.y):Zi.copy(Di),i.copy(e),i.x+=Zi.x,i.y+=Zi.y,i.applyMatrix4(yc)}const Pn=new L,Os=new L,Rr=new L,$n=new L,Bs=new L,Cr=new L,zs=new L;class fo{constructor(e=new L,t=new L(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Pn)),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=Pn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Pn.copy(this.origin).addScaledVector(this.direction,t),Pn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Os.copy(e).add(t).multiplyScalar(.5),Rr.copy(t).sub(e).normalize(),$n.copy(this.origin).sub(Os);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Rr),o=$n.dot(this.direction),l=-$n.dot(Rr),c=$n.lengthSq(),d=Math.abs(1-a*a);let m,u,p,_;if(d>0)if(m=a*l-o,u=a*o-l,_=s*d,m>=0)if(u>=-_)if(u<=_){const y=1/d;m*=y,u*=y,p=m*(m+a*u+2*o)+u*(a*m+u+2*l)+c}else u=s,m=Math.max(0,-(a*u+o)),p=-m*m+u*(u+2*l)+c;else u=-s,m=Math.max(0,-(a*u+o)),p=-m*m+u*(u+2*l)+c;else u<=-_?(m=Math.max(0,-(-a*s+o)),u=m>0?-s:Math.min(Math.max(-s,-l),s),p=-m*m+u*(u+2*l)+c):u<=_?(m=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(m=Math.max(0,-(a*s+o)),u=m>0?s:Math.min(Math.max(-s,-l),s),p=-m*m+u*(u+2*l)+c);else u=a>0?-s:s,m=Math.max(0,-(a*u+o)),p=-m*m+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,m),r&&r.copy(Os).addScaledVector(Rr,u),p}intersectSphere(e,t){Pn.subVectors(e.center,this.origin);const n=Pn.dot(this.direction),r=Pn.dot(Pn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,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,l;const c=1/this.direction.x,d=1/this.direction.y,m=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),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),m>=0?(o=(e.min.z-u.z)*m,l=(e.max.z-u.z)*m):(o=(e.max.z-u.z)*m,l=(e.min.z-u.z)*m),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Pn)!==null}intersectTriangle(e,t,n,r,s){Bs.subVectors(t,e),Cr.subVectors(n,e),zs.crossVectors(Bs,Cr);let a=this.direction.dot(zs),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;$n.subVectors(this.origin,e);const l=o*this.direction.dot(Cr.crossVectors($n,Cr));if(l<0)return null;const c=o*this.direction.dot(Bs.cross($n));if(c<0||l+c>a)return null;const d=-o*$n.dot(zs);return d<0?null:this.at(d/a,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 tn extends ei{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(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 Qn,this.combine=Ql,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 nl=new ut,ri=new fo,Pr=new fr,il=new L,Lr=new L,Dr=new L,Ir=new L,Gs=new L,Ur=new L,rl=new L,Nr=new L;class St extends bt{constructor(e=new Ct,t=new tn){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){Ur.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],m=s[l];d!==0&&(Gs.fromBufferAttribute(m,e),a?Ur.addScaledVector(Gs,d):Ur.addScaledVector(Gs.sub(t),d))}t.add(Ur)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Pr.copy(n.boundingSphere),Pr.applyM
vendor: 4,293 bytes, line 5
5atrix4(s),ri.copy(e.ray).recast(e.near),!(Pr.containsPoint(ri.origin)===!1&&(ri.intersectSphere(Pr,il)===null||ri.origin.distanceToSquared(il)>(e.far-e.near)**2))&&(nl.copy(s).invert(),ri.copy(e.ray).applyMatrix4(nl),!(n.boundingBox!==null&&ri.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ri)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,m=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,y=u.length;_<y;_++){const g=u[_],f=a[g.materialIndex],S=Math.max(g.start,p.start),E=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let b=S,w=E;b<w;b+=3){const T=o.getX(b),P=o.getX(b+1),v=o.getX(b+2);r=Fr(this,f,e,n,c,d,m,T,P,v),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),y=Math.min(o.count,p.start+p.count);for(let g=_,f=y;g<f;g+=3){const S=o.getX(g),E=o.getX(g+1),b=o.getX(g+2);r=Fr(this,a,e,n,c,d,m,S,E,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,y=u.length;_<y;_++){const g=u[_],f=a[g.materialIndex],S=Math.max(g.start,p.start),E=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let b=S,w=E;b<w;b+=3){const T=b,P=b+1,v=b+2;r=Fr(this,f,e,n,c,d,m,T,P,v),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),y=Math.min(l.count,p.start+p.count);for(let g=_,f=y;g<f;g+=3){const S=g,E=g+1,b=g+2;r=Fr(this,a,e,n,c,d,m,S,E,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function Ph(i,e,t,n,r,s,a,o){let l;if(e.side===Dt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===jn,o),l===null)return null;Nr.copy(o),Nr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Nr);return c<t.near||c>t.far?null:{distance:c,point:Nr.clone(),object:i}}function Fr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Lr),i.getVertexPosition(l,Dr),i.getVertexPosition(c,Ir);const d=Ph(i,e,t,n,Lr,Dr,Ir,rl);if(d){const m=new L;nn.getBarycoord(rl,Lr,Dr,Ir,m),r&&(d.uv=nn.getInterpolatedAttribute(r,o,l,c,m,new Te)),s&&(d.uv1=nn.getInterpolatedAttribute(s,o,l,c,m,new Te)),a&&(d.normal=nn.getInterpolatedAttribute(a,o,l,c,m,new L),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new L,materialIndex:0};nn.getNormal(Lr,Dr,Ir,u.normal),d.face=u,d.barycoord=m}return d}class Lh extends It{constructor(e=null,t=1,n=1,r,s,a,o,l,c=Et,d=Et,m,u){super(null,a,o,l,c,d,r,s,m,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Vs=new L,Dh=new L,Ih=new Ue;class ai{constructor(e=new L(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,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=Vs.subVectors(n,t).cross(Dh.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(Vs),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const 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||Ih.getNormalMatrix(e),r=this.coplanarPoint(Vs).applyMatrix4(e),s=this.normal.applyM
vendor: 16,404 bytes, line 5
5atrix3(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)}}const si=new fr,Uh=new Te(.5,.5),Or=new L;class po{constructor(e=new ai,t=new ai,n=new ai,r=new ai,s=new ai,a=new ai){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=xn,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],m=s[5],u=s[6],p=s[7],_=s[8],y=s[9],g=s[10],f=s[11],S=s[12],E=s[13],b=s[14],w=s[15];if(r[0].setComponents(c-a,p-d,f-_,w-S).normalize(),r[1].setComponents(c+a,p+d,f+_,w+S).normalize(),r[2].setComponents(c+o,p+m,f+y,w+E).normalize(),r[3].setComponents(c-o,p-m,f-y,w-E).normalize(),n)r[4].setComponents(l,u,g,b).normalize(),r[5].setComponents(c-l,p-u,f-g,w-b).normalize();else if(r[4].setComponents(c-l,p-u,f-g,w-b).normalize(),t===xn)r[5].setComponents(c+l,p+u,f+g,w+b).normalize();else if(t===cr)r[5].setComponents(l,u,g,b).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(),si.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),si.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(si)}intersectsSprite(e){si.center.set(0,0,0);const t=Uh.distanceTo(e.center);return si.radius=.7071067811865476+t,si.applyMatrix4(e.matrixWorld),this.intersectsSphere(si)}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(Or.x=r.normal.x>0?e.max.x:e.min.x,Or.y=r.normal.y>0?e.max.y:e.min.y,Or.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Or)<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 Ka extends ei{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(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 ss=new L,as=new L,sl=new ut,ji=new fo,Br=new fr,ks=new L,al=new L;class Ec extends bt{constructor(e=new Ct,t=new Ka){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++)ss.fromBufferAttribute(t,r-1),as.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ss.distanceTo(as);e.setAttribute("lineDistance",new Tt(n,1))}else Ce("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return 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(),Br.copy(n.boundingSphere),Br.applyMatrix4(r),Br.radius+=s,e.ray.intersectsSphere(Br)===!1)return;sl.copy(r).invert(),ji.copy(e.ray).applyMatrix4(sl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=n.index,u=n.attributes.position;if(d!==null){const p=Math.max(0,a.start),_=Math.min(d.count,a.start+a.count);for(let y=p,g=_-1;y<g;y+=c){const f=d.getX(y),S=d.getX(y+1),E=zr(this,e,ji,l,f,S,y);E&&t.push(E)}if(this.isLineLoop){const y=d.getX(_-1),g=d.getX(p),f=zr(this,e,ji,l,y,g,_-1);f&&t.push(f)}}else{const p=Math.max(0,a.start),_=Math.min(u.count,a.start+a.count);for(let y=p,g=_-1;y<g;y+=c){const f=zr(this,e,ji,l,y,y+1,y);f&&t.push(f)}if(this.isLineLoop){const y=zr(this,e,ji,l,_-1,p,_-1);y&&t.push(y)}}}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 zr(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(ss.fromBufferAttribute(o,r),as.fromBufferAttribute(o,s),t.distanceSqToSegment(ss,as,ks,al)>n)return;ks.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(ks);if(!(c<e.near||c>e.far))return{distance:c,point:al.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}class Nh extends Ec{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class bc extends ei{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(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 ol=new ut,Za=new fo,Gr=new fr,Vr=new L;class Fh extends bt{constructor(e=new Ct,t=new bc){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Gr.copy(n.boundingSphere),Gr.applyMatrix4(r),Gr.radius+=s,e.ray.intersectsSphere(Gr)===!1)return;ol.copy(r).invert(),Za.copy(e.ray).applyMatrix4(ol);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,m=n.attributes.position;if(c!==null){const u=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=u,y=p;_<y;_++){const g=c.getX(_);Vr.fromBufferAttribute(m,g),ll(Vr,g,l,r,e,t,this)}}else{const u=Math.max(0,a.start),p=Math.min(m.count,a.start+a.count);for(let _=u,y=p;_<y;_++)Vr.fromBufferAttribute(m,_),ll(Vr,_,l,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 ll(i,e,t,n,r,s,a){const o=Za.distanceSqToPoint(i);if(o<t){const l=new L;Za.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Tc extends It{constructor(e=[],t=hi,n,r,s,a,o,l,c,d){super(e,t,n,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Oh extends It{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ki extends It{constructor(e,t,n=yn,r,s,a,o=Et,l=Et,c,d=zn,m=1){if(d!==zn&&d!==ui)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:m};super(u,r,s,a,o,l,d,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ho(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Bh extends ki{constructor(e,t=yn,n=hi,r,s,a=Et,o=Et,l,c=zn){const d={width:e,height:e,depth:1},m=[d,d,d,d,d,d];super(e,e,t,n,r,s,a,o,l,c),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Ac extends It{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class pr extends Ct{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 l=[],c=[],d=[],m=[];let u=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Tt(c,3)),this.setAttribute("normal",new Tt(d,3)),this.setAttribute("uv",new Tt(m,2));function _(y,g,f,S,E,b,w,T,P,v,A){const U=b/P,C=w/v,O=b/2,Y=w/2,$=T/2,N=P+1,V=v+1;let H=0,K=0;const Z=new L;for(let he=0;he<V;he++){const re=he*C-Y;for(let _e=0;_e<N;_e++){const Oe=_e*U-O;Z[y]=Oe*S,Z[g]=re*E,Z[f]=$,c.push(Z.x,Z.y,Z.z),Z[y]=0,Z[g]=0,Z[f]=T>0?1:-1,d.push(Z.x,Z.y,Z.z),m.push(_e/P),m.push(1-he/v),H+=1}}for(let he=0;he<v;he++)for(let re=0;re<P;re++){const _e=u+re+N*he,Oe=u+re+N*(he+1),Ze=u+(re+1)+N*(he+1),Le=u+(re+1)+N*he;l.push(_e,Oe,Le),l.push(Oe,Ze,Le),K+=6}o.addGroup(p,K,A),p+=K,u+=H}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class mo extends Ct{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const d=[],m=[],u=[],p=[];let _=0;const y=[],g=n/2;let f=0;S(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(d),this.setAttribute("position",new Tt(m,3)),this.setAttribute("normal",new Tt(u,3)),this.setAttribute("uv",new Tt(p,2));function S(){const b=new L,w=new L;let T=0;const P=(t-e)/n;for(let v=0;v<=s;v++){const A=[],U=v/s,C=U*(t-e)+e;for(let O=0;O<=r;O++){const Y=O/r,$=Y*l+o,N=Math.sin($),V=Math.cos($);w.x=C*N,w.y=-U*n+g,w.z=C*V,m.push(w.x,w.y,w.z),b.set(N,P,V).normalize(),u.push(b.x,b.y,b.z),p.push(Y,1-U),A.push(_++)}y.push(A)}for(let v=0;v<r;v++)for(let A=0;A<s;A++){const U=y[A][v],C=y[A+1][v],O=y[A+1][v+1],Y=y[A][v+1];(e>0||A!==0)&&(d.push(U,C,Y),T+=3),(t>0||A!==s-1)&&(d.push(C,O,Y),T+=3)}c.addGroup(f,T,0),f+=T}function E(b){const w=_,T=new Te,P=new L;let v=0;const A=b===!0?e:t,U=b===!0?1:-1;for(let O=1;O<=r;O++)m.push(0,g*U,0),u.push(0,U,0),p.push(.5,.5),_++;const C=_;for(let O=0;O<=r;O++){const $=O/r*l+o,N=Math.cos($),V=Math.sin($);P.x=A*V,P.y=g*U,P.z=A*N,m.push(P.x,P.y,P.z),u.push(0,U,0),T.x=N*.5+.5,T.y=V*.5*U+.5,p.push(T.x,T.y),_++}for(let O=0;O<r;O++){const Y=w+O,$=C+O;b===!0?d.push($,$+1,Y):d.push($+1,$,Y),v+=3}c.addGroup(f,v,b===!0?1:2),f+=v}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class os extends mo{constructor(e=1,t=1,n=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new os(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Gn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ce("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const d=n[r],u=n[r+1]-d,p=(a-d)/u;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new Te:new L);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new L,r=[],s=[],a=[],o=new L,l=new ut;for(let p=0;p<=e;p++){const _=p/e;r[p]=this.getTangentAt(_,new L)}s[0]=new L,a[0]=new L;let c=Number.MAX_VALUE;const d=Math.abs(r[0].x),m=Math.abs(r[0].y),u=Math.abs(r[0].z);d<=c&&(c=d,n.set(1,0,0)),m<=c&&(c=m,n.set(0,1,0)),u<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(Xe(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,_))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(Xe(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(r[_],p*_)),a[_].crossVectors(r[_],s[_])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class wc extends Gn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new Te){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const d=Math.cos(this.aRotation),m=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*d-p*m+this.aX,c=u*m+p*d+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class zh extends wc{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function go(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,d,m){let u=(a-s)/c-(o-s)/(c+d)+(o-a)/d,p=(o-a)/d-(l-a)/(d+m)+(l-o)/m;u*=d,p*=d,r(a,o,u,p)}
vendor: 13,858 bytes, lines 5-9
5,calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const cl=new L,ul=new L,Hs=new go,Ws=new go,Xs=new go;class Rc extends Gn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new L){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=r[(o-1)%s]:(ul.subVectors(r[0],r[1]).add(r[0]),c=ul);const m=r[o%s],u=r[(o+1)%s];if(this.closed||o+2<s?d=r[(o+2)%s]:(cl.subVectors(r[s-1],r[s-2]).add(r[s-1]),d=cl),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let _=Math.pow(c.distanceToSquared(m),p),y=Math.pow(m.distanceToSquared(u),p),g=Math.pow(u.distanceToSquared(d),p);y<1e-4&&(y=1),_<1e-4&&(_=y),g<1e-4&&(g=y),Hs.initNonuniformCatmullRom(c.x,m.x,u.x,d.x,_,y,g),Ws.initNonuniformCatmullRom(c.y,m.y,u.y,d.y,_,y,g),Xs.initNonuniformCatmullRom(c.z,m.z,u.z,d.z,_,y,g)}else this.curveType==="catmullrom"&&(Hs.initCatmullRom(c.x,m.x,u.x,d.x,this.tension),Ws.initCatmullRom(c.y,m.y,u.y,d.y,this.tension),Xs.initCatmullRom(c.z,m.z,u.z,d.z,this.tension));return n.set(Hs.calc(l),Ws.calc(l),Xs.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new L().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function hl(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function Gh(i,e){const t=1-i;return t*t*e}function Vh(i,e){return 2*(1-i)*i*e}function kh(i,e){return i*i*e}function sr(i,e,t,n){return Gh(i,e)+Vh(i,t)+kh(i,n)}function Hh(i,e){const t=1-i;return t*t*t*e}function Wh(i,e){const t=1-i;return 3*t*t*i*e}function Xh(i,e){return 3*(1-i)*i*i*e}function qh(i,e){return i*i*i*e}function ar(i,e,t,n,r){return Hh(i,e)+Wh(i,t)+Xh(i,n)+qh(i,r)}class Yh extends Gn{constructor(e=new Te,t=new Te,n=new Te,r=new Te){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Te){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ar(e,r.x,s.x,a.x,o.x),ar(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class $h extends Gn{constructor(e=new L,t=new L,n=new L,r=new L){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new L){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ar(e,r.x,s.x,a.x,o.x),ar(e,r.y,s.y,a.y,o.y),ar(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Kh extends Gn{constructor(e=new Te,t=new Te){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Te){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Te){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Zh extends Gn{constructor(e=new L,t=new L){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new L){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new L){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Jh extends Gn{constructor(e=new Te,t=new Te,n=new Te){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Te){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(sr(e,r.x,s.x,a.x),sr(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _o extends Gn{constructor(e=new L,t=new L,n=new L){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new L){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(sr(e,r.x,s.x,a.x),sr(e,r.y,s.y,a.y),sr(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class jh extends Gn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Te){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],d=r[a>r.length-2?r.length-1:a+1],m=r[a>r.length-3?r.length-1:a+2];return n.set(hl(o,l.x,c.x,d.x,m.x),hl(o,l.y,c.y,d.y,m.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new Te().fromArray(r))}return this}}var Qh=Object.freeze({__proto__:null,ArcCurve:zh,CatmullRomCurve3:Rc,CubicBezierCurve:Yh,CubicBezierCurve3:$h,EllipseCurve:wc,LineCurve:Kh,LineCurve3:Zh,QuadraticBezierCurve:Jh,QuadraticBezierCurve3:_o,SplineCurve:jh});class hs extends Ct{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),l=Math.floor(r),c=o+1,d=l+1,m=e/o,u=t/l,p=[],_=[],y=[],g=[];for(let f=0;f<d;f++){const S=f*u-a;for(let E=0;E<c;E++){const b=E*m-s;_.push(b,-S,0),y.push(0,0,1),g.push(E/o),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let S=0;S<o;S++){const E=S+c*f,b=S+c*(f+1),w=S+1+c*(f+1),T=S+1+c*f;p.push(E,b,T),p.push(b,w,T)}this.setIndex(p),this.setAttribute("position",new Tt(_,3)),this.setAttribute("normal",new Tt(y,3)),this.setAttribute("uv",new Tt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hs(e.width,e.height,e.widthSegments,e.heightSegments)}}class Ln extends Ct{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const d=[],m=new L,u=new L,p=[],_=[],y=[],g=[];for(let f=0;f<=n;f++){const S=[],E=f/n;let b=0;f===0&&a===0?b=.5/t:f===n&&l===Math.PI&&(b=-.5/t);for(let w=0;w<=t;w++){const T=w/t;m.x=-e*Math.cos(r+T*s)*Math.sin(a+E*o),m.y=e*Math.cos(a+E*o),m.z=e*Math.sin(r+T*s)*Math.sin(a+E*o),_.push(m.x,m.y,m.z),u.copy(m).normalize(),y.push(u.x,u.y,u.z),g.push(T+b,1-E),S.push(c++)}d.push(S)}for(let f=0;f<n;f++)for(let S=0;S<t;S++){const E=d[f][S+1],b=d[f][S],w=d[f+1][S],T=d[f+1][S+1];(f!==0||a>0)&&p.push(E,b,T),(f!==n-1||l<Math.PI)&&p.push(b,w,T)}this.setIndex(p),this.setAttribute("position",new Tt(_,3)),this.setAttribute("normal",new Tt(y,3)),this.setAttribute("uv",new Tt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ln(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class vo extends Ct{constructor(e=new _o(new L(-1,-1,0),new L(-1,1,0),new L(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new L,l=new L,c=new Te;let d=new L;const m=[],u=[],p=[],_=[];y(),this.setIndex(_),this.setAttribute("position",new Tt(m,3)),this.setAttribute("normal",new Tt(u,3)),this.setAttribute("uv",new Tt(p,2));function y(){for(let E=0;E<t;E++)g(E);g(s===!1?t:0),S(),f()}function g(E){d=e.getPointAt(E/t,d);const b=a.normals[E],w=a.binormals[E];for(let T=0;T<=r;T++){const P=T/r*Math.PI*2,v=Math.sin(P),A=-Math.cos(P);l.x=A*b.x+v*w.x,l.y=A*b.y+v*w.y,l.z=A*b.z+v*w.z,l.normalize(),u.push(l.x,l.y,l.z),o.x=d.x+n*l.x,o.y=d.y+n*l.y,o.z=d.z+n*l.z,m.push(o.x,o.y,o.z)}}function f(){for(let E=1;E<=t;E++)for(let b=1;b<=r;b++){const w=(r+1)*(E-1)+(b-1),T=(r+1)*E+(b-1),P=(r+1)*E+b,v=(r+1)*(E-1)+b;_.push(w,T,v),_.push(T,P,v)}}function S(){for(let E=0;E<=t;E++)for(let b=0;b<=r;b++)c.x=E/t,c.y=b/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new vo(new Qh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}function Hi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(dl(r))r.isRenderTargetTexture?(Ce("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(dl(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 Vt(i){const e={};for(let t=0;t<i.length;t++){const n=Hi(i[t]);for(const r in n)e[r]=n[r]}return e}function dl(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function ed(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Cc(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:qe.workingColorSpace}const td={clone:Hi,merge:Vt};var nd=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,id=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class En extends ei{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=nd,this.fragmentShader=id,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=Hi(e.uniforms),this.uniformsGroups=ed(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}}
vendor: 8,027 bytes, line 9
9class rd extends En{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class sd extends ei{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ye(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Qn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ad extends ei{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Fu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class od extends ei{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 qs={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(fl(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!fl(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function fl(i){try{const e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class ld{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){o++,s===!1&&r.onStart!==void 0&&r.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,r.onProgress!==void 0&&r.onProgress(d,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,m){return c.push(d,m),this},this.removeHandler=function(d){const m=c.indexOf(d);return m!==-1&&c.splice(m,2),this},this.getHandler=function(d){for(let m=0,u=c.length;m<u;m+=2){const p=c[m],_=c[m+1];if(p.global&&(p.lastIndex=0),p.test(d))return _}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const cd=new ld;class xo{constructor(e){this.manager=e!==void 0?e:cd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}xo.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ii=new WeakMap;class ud extends xo{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=qs.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let m=Ii.get(a);m===void 0&&(m=[],Ii.set(a,m)),m.push({onLoad:t,onError:r})}return a}const o=ur("img");function l(){d(),t&&t(this);const m=Ii.get(this)||[];for(let u=0;u<m.length;u++){const p=m[u];p.onLoad&&p.onLoad(this)}Ii.delete(this),s.manager.itemEnd(e)}function c(m){d(),r&&r(m),qs.remove(`image:${e}`);const u=Ii.get(this)||[];for(let p=0;p<u.length;p++){const _=u[p];_.onError&&_.onError(m)}Ii.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),qs.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class hd extends xo{constructor(e){super(e)}load(e,t,n,r){const s=new It,a=new ud(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class Mo extends bt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const Ys=new ut,pl=new L,ml=new L;class Pc{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Te(512,512),this.mapType=Kt,this.map=null,this.mapPass=null,this.matrix=new ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new po,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;pl.setFromMatrixPosition(e.matrixWorld),t.position.copy(pl),ml.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ml),t.updateMatrixWorld(),Ys.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ys,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===cr||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ys)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 4,184 bytes, line 9
9ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const kr=new L,Hr=new mi,mn=new L;class Lc extends bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ut,this.projectionMatrix=new ut,this.projectionMatrixInverse=new ut,this.coordinateSystem=xn,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(kr,Hr,mn),mn.x===1&&mn.y===1&&mn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(kr,Hr,mn.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(kr,Hr,mn),mn.x===1&&mn.y===1&&mn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(kr,Hr,mn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Kn=new L,gl=new Te,_l=new Te;class Yt extends Lc{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=hr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ir*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return hr*2*Math.atan(Math.tan(ir*.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){Kn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Kn.x,Kn.y).multiplyScalar(-e/Kn.z),Kn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Kn.x,Kn.y).multiplyScalar(-e/Kn.z)}getViewSize(e,t){return this.getViewBounds(e,gl,_l),t.subVectors(_l,gl)}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(ir*.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 l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}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 dd extends Pc{constructor(){super(new Yt(90,1,.5,500)),this.isPointLightShadow=!0}
vendor: 9,710 bytes, lines 9-13
9}class vl extends Mo{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new dd}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class So extends Lc{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=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,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,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}}class fd extends Pc{constructor(){super(new So(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class pd extends Mo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(bt.DEFAULT_UP),this.updateMatrix(),this.target=new bt,this.shadow=new fd}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class md extends Mo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const Ui=-90,Ni=1;class gd extends bt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Yt(Ui,Ni,e,t);r.layers=this.layers,this.add(r);const s=new Yt(Ui,Ni,e,t);s.layers=this.layers,this.add(s);const a=new Yt(Ui,Ni,e,t);a.layers=this.layers,this.add(a);const o=new Yt(Ui,Ni,e,t);o.layers=this.layers,this.add(o);const l=new Yt(Ui,Ni,e,t);l.layers=this.layers,this.add(l);const c=new Yt(Ui,Ni,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===xn)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),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===cr)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),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.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,l,c,d]=this.children,m=e.getRenderTarget(),u=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(m,u,p),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class _d extends Yt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const wo=class wo{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}};wo.prototype.isMatrix2=!0;let xl=wo;function Ml(i,e,t,n){const r=vd(n);switch(t){case dc:return i*e;case pc:return i*e/r.components*r.byteLength;case so:return i*e/r.components*r.byteLength;case di:return i*e*2/r.components*r.byteLength;case ao:return i*e*2/r.components*r.byteLength;case fc:return i*e*3/r.components*r.byteLength;case un:return i*e*4/r.components*r.byteLength;case oo:return i*e*4/r.components*r.byteLength;case $r:case Kr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Zr:case Jr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _a:case xa:return Math.max(i,16)*Math.max(e,8)/4;case ga:case va:return Math.max(i,8)*Math.max(e,8)/2;case Ma:case Sa:case Ea:case ba:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ya:case Qr:case Ta:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Aa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case wa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Ra:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Ca:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Pa:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case La:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Da:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Ia:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Ua:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Na:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Fa:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Oa:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Ba:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case za:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ga:case Va:case ka:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Ha:case Wa:return Math.ceil(i/4)*Math.ceil(e/4)*8;case es:case Xa:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function vd(i){switch(i){case Kt:case lc:return{byteLength:1,components:1};case or:case cc:case Bn:return{byteLength:2,components:1};case io:case ro:return{byteLength:2,components:4};case yn:case no:case vn:return{byteLength:4,components:1};case uc:case hc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:to}}));typeof window<"u"&&(window.__THREE__?Ce("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=to);/** 10 * @license 11 * Copyright 2010-2026 Three.js Authors 12 * SPDX-License-Identifier: MIT 13 */function Dc(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}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 xd(i){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,m=c.byteLength,u=i.createBuffer();i.bindBuffer(l,u),i.bufferData(l,c,d),o.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:m}}function n(o,l,c){const d=l.array,m=l.updateRanges;if(i.bindBuffer(c,o),m.length===0)i.bufferSubData(c,0,d);else{m.sort((p,_)=>p.start-_.start);let u=0;for(let p=1;p<m.length;p++){const _=m[u],y=m[p];y.start<=_.start+_.count+1?_.count=Math.max(_.count,y.start+y.count-_.start):(++u,m[u]=y)}m.length=u+1;for(let p=0,_=m.length;p<_;p++){const y=m[p];i.bufferSubData(c,y.start*d.BYTES_PER_ELEMENT,d,y.start,y.count)}
vendor: 4,945 bytes, lines 13-126
13l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){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 c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Md=`#ifdef USE_ALPHAHASH 14 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 15#endif`,Sd=`#ifdef USE_ALPHAHASH 16 const float ALPHA_HASH_SCALE = 0.05; 17 float hash2D( vec2 value ) { 18 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 19 } 20 float hash3D( vec3 value ) { 21 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 22 } 23 float getAlphaHashThreshold( vec3 position ) { 24 float maxDeriv = max( 25 length( dFdx( position.xyz ) ), 26 length( dFdy( position.xyz ) ) 27 ); 28 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 29 vec2 pixScales = vec2( 30 exp2( floor( log2( pixScale ) ) ), 31 exp2( ceil( log2( pixScale ) ) ) 32 ); 33 vec2 alpha = vec2( 34 hash3D( floor( pixScales.x * position.xyz ) ), 35 hash3D( floor( pixScales.y * position.xyz ) ) 36 ); 37 float lerpFactor = fract( log2( pixScale ) ); 38 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 39 float a = min( lerpFactor, 1.0 - lerpFactor ); 40 vec3 cases = vec3( 41 x * x / ( 2.0 * a * ( 1.0 - a ) ), 42 ( x - 0.5 * a ) / ( 1.0 - a ), 43 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 44 ); 45 float threshold = ( x < ( 1.0 - a ) ) 46 ? ( ( x < a ) ? cases.x : cases.y ) 47 : cases.z; 48 return clamp( threshold , 1.0e-6, 1.0 ); 49 } 50#endif`,yd=`#ifdef USE_ALPHAMAP 51 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 52#endif`,Ed=`#ifdef USE_ALPHAMAP 53 uniform sampler2D alphaMap; 54#endif`,bd=`#ifdef USE_ALPHATEST 55 #ifdef ALPHA_TO_COVERAGE 56 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 57 if ( diffuseColor.a == 0.0 ) discard; 58 #else 59 if ( diffuseColor.a < alphaTest ) discard; 60 #endif 61#endif`,Td=`#ifdef USE_ALPHATEST 62 uniform float alphaTest; 63#endif`,Ad=`#ifdef USE_AOMAP 64 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 65 reflectedLight.indirectDiffuse *= ambientOcclusion; 66 #if defined( USE_CLEARCOAT ) 67 clearcoatSpecularIndirect *= ambientOcclusion; 68 #endif 69 #if defined( USE_SHEEN ) 70 sheenSpecularIndirect *= ambientOcclusion; 71 #endif 72 #if defined( USE_ENVMAP ) && defined( STANDARD ) 73 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 74 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 75 #endif 76#endif`,wd=`#ifdef USE_AOMAP 77 uniform sampler2D aoMap; 78 uniform float aoMapIntensity; 79#endif`,Rd=`#ifdef USE_BATCHING 80 #if ! defined( GL_ANGLE_multi_draw ) 81 #define gl_DrawID _gl_DrawID 82 uniform int _gl_DrawID; 83 #endif 84 uniform highp sampler2D batchingTexture; 85 uniform highp usampler2D batchingIdTexture; 86 mat4 getBatchingMatrix( const in float i ) { 87 int size = textureSize( batchingTexture, 0 ).x; 88 int j = int( i ) * 4; 89 int x = j % size; 90 int y = j / size; 91 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 92 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 93 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 94 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 95 return mat4( v1, v2, v3, v4 ); 96 } 97 float getIndirectIndex( const in int i ) { 98 int size = textureSize( batchingIdTexture, 0 ).x; 99 int x = i % size; 100 int y = i / size; 101 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 102 } 103#endif 104#ifdef USE_BATCHING_COLOR 105 uniform sampler2D batchingColorTexture; 106 vec4 getBatchingColor( const in float i ) { 107 int size = textureSize( batchingColorTexture, 0 ).x; 108 int j = int( i ); 109 int x = j % size; 110 int y = j / size; 111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 112 } 113#endif`,Cd=`#ifdef USE_BATCHING 114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 115#endif`,Pd=`vec3 transformed = vec3( position ); 116#ifdef USE_ALPHAHASH 117 vPosition = vec3( position ); 118#endif`,Ld=`vec3 objectNormal = vec3( normal ); 119#ifdef USE_TANGENT 120 vec3 objectTangent = vec3( tangent.xyz ); 121#endif`,Dd=`float G_BlinnPhong_Implicit( ) { 122 return 0.25; 123} 124float D_BlinnPhong( const in float shininess, const in float dotNH ) { 125 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 128 vec3 halfDir = normalize( lightDir + viewDir ); 129 float dotNH = saturate( dot( normal, halfDir ) ); 130 float dotVH = saturate( dot( viewDir, halfDir ) ); 131 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 132 float G = G_BlinnPhong_Implicit( ); 133 float D = D_BlinnPhong( shininess, dotNH ); 134 return F * ( G * D ); 135} // validated`,Id=`#ifdef USE_IRIDESCENCE 136 const mat3 XYZ_TO_REC709 = mat3( 137 3.2404542, -0.9692660, 0.0556434, 138 -1.5371385, 1.8760108, -0.2040259, 139 -0.4985314, 0.0415560, 1.0572252 140 ); 141 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 142 vec3 sqrtF0 = sqrt( fresnel0 ); 143 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 144 } 145 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 146 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 147 } 148 float IorToFresnel0( float transmittedIor, float incidentIor ) { 149 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 150 } 151 vec3 evalSensitivity( float OPD, vec3 shift ) { 152 float phase = 2.0 * PI * OPD * 1.0e-9; 153 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 154 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 155 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 156 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 157 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 ) ); 158 xyz /= 1.0685e-7; 159 vec3 rgb = XYZ_TO_REC709 * xyz; 160 return rgb; 161 } 162 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 163 vec3 I; 164 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 165 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 166 float cosTheta2Sq = 1.0 - sinTheta2Sq; 167 if ( cosTheta2Sq < 0.0 ) { 168 return vec3( 1.0 ); 169 } 170 float cosTheta2 = sqrt( cosTheta2Sq ); 171 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 172 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173 float T121 = 1.0 - R12; 174 float phi12 = 0.0; 175 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 176 float phi21 = PI - phi12; 177 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 178 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 179 vec3 phi23 = vec3( 0.0 ); 180 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 181 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 182 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 183 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 184 vec3 phi = vec3( phi21 ) + phi23; 185 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 186 vec3 r123 = sqrt( R123 ); 187 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 188 vec3 C0 = R12 + Rs; 189 I = C0; 190 vec3 Cm = Rs - T121; 191 for ( int m = 1; m <= 2; ++ m ) { 192 Cm *= r123; 193 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 194 I += Cm * Sm; 195 } 196 return max( I, vec3( 0.0 ) ); 197 } 198#endif`,Ud=`#ifdef USE_BUMPMAP 199 uniform sampler2D bumpMap; 200 uniform float bumpScale; 201 vec2 dHdxy_fwd() { 202 vec2 dSTdx = dFdx( vBumpMapUv ); 203 vec2 dSTdy = dFdy( vBumpMapUv ); 204 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 205 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 206 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 207 return vec2( dBx, dBy ); 208 } 209 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 210 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 211 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 212 vec3 vN = surf_norm; 213 vec3 R1 = cross( vSigmaY, vN ); 214 vec3 R2 = cross( vN, vSigmaX ); 215 float fDet = dot( vSigmaX, R1 ) * faceDirection; 216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 217 return normalize( abs( fDet ) * surf_norm - vGrad ); 218 } 219#endif`,Nd=`#if NUM_CLIPPING_PLANES > 0 220 vec4 plane; 221 #ifdef ALPHA_TO_COVERAGE 222 float distanceToPlane, distanceGradient; 223 float clipOpacity = 1.0; 224 #pragma unroll_loop_start 225 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 226 plane = clippingPlanes[ i ]; 227 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 228 distanceGradient = fwidth( distanceToPlane ) / 2.0; 229 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 230 if ( clipOpacity == 0.0 ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 float unionClipOpacity = 1.0; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 239 distanceGradient = fwidth( distanceToPlane ) / 2.0; 240 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 241 } 242 #pragma unroll_loop_end 243 clipOpacity *= 1.0 - unionClipOpacity; 244 #endif 245 diffuseColor.a *= clipOpacity; 246 if ( diffuseColor.a == 0.0 ) discard; 247 #else 248 #pragma unroll_loop_start 249 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 250 plane = clippingPlanes[ i ]; 251 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 252 } 253 #pragma unroll_loop_end 254 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 255 bool clipped = true; 256 #pragma unroll_loop_start 257 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 258 plane = clippingPlanes[ i ]; 259 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 260 } 261 #pragma unroll_loop_end 262 if ( clipped ) discard; 263 #endif 264 #endif 265#endif`,Fd=`#if NUM_CLIPPING_PLANES > 0 266 varying vec3 vClipPosition; 267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 268#endif`,Od=`#if NUM_CLIPPING_PLANES > 0 269 varying vec3 vClipPosition; 270#endif`,Bd=`#if NUM_CLIPPING_PLANES > 0 271 vClipPosition = - mvPosition.xyz; 272#endif`,zd=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 273 diffuseColor *= vColor; 274#endif`,Gd=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 275 varying vec4 vColor; 276#endif`,Vd=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 277 varying vec4 vColor; 278#endif`,kd=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 279 vColor = vec4( 1.0 ); 280#endif 281#ifdef USE_COLOR_ALPHA 282 vColor *= color; 283#elif defined( USE_COLOR ) 284 vColor.rgb *= color; 285#endif 286#ifdef USE_INSTANCING_COLOR 287 vColor.rgb *= instanceColor.rgb; 288#endif 289#ifdef USE_BATCHING_COLOR 290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 291#endif`,Hd=`#define PI 3.141592653589793 292#define PI2 6.283185307179586 293#define PI_HALF 1.5707963267948966 294#define RECIPROCAL_PI 0.3183098861837907 295#define RECIPROCAL_PI2 0.15915494309189535 296#define EPSILON 1e-6 297#ifndef saturate 298#define saturate( a ) clamp( a, 0.0, 1.0 ) 299#endif 300#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 301float pow2( const in float x ) { return x*x; } 302vec3 pow2( const in vec3 x ) { return x*x; } 303float pow3( const in float x ) { return x*x*x; } 304float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 307highp float rand( const in vec2 uv ) { 308 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 309 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 310 return fract( sin( sn ) * c ); 311} 312#ifdef HIGH_PRECISION 313 float precisionSafeLength( vec3 v ) { return length( v ); } 314#else 315 float precisionSafeLength( vec3 v ) { 316 float maxComponent = max3( abs( v ) ); 317 return length( v / maxComponent ) * maxComponent; 318 } 319#endif 320struct IncidentLight { 321 vec3 color; 322 vec3 direction; 323 bool visible; 324}; 325struct ReflectedLight { 326 vec3 directDiffuse; 327 vec3 directSpecular; 328 vec3 indirectDiffuse; 329 vec3 indirectSpecular; 330}; 331#ifdef USE_ALPHAHASH 332 varying vec3 vPosition; 333#endif 334vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 335 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 336} 337vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 338 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 339} 340bool isPerspectiveMatrix( mat4 m ) { 341 return m[ 2 ][ 3 ] == - 1.0; 342} 343vec2 equirectUv( in vec3 dir ) { 344 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 345 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 346 return vec2( u, v ); 347}
348vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 349 return RECIPROCAL_PI * diffuseColor; 350} 351vec3 F_Schlick( const in vec3 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} 355float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 356 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 357 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 358} // validated`,Wd=`#ifdef ENVMAP_TYPE_CUBE_UV 359 #define cubeUV_minMipLevel 4.0 360 #define cubeUV_minTileSize 16.0 361 float getFace( vec3 direction ) { 362 vec3 absDirection = abs( direction ); 363 float face = - 1.0; 364 if ( absDirection.x > absDirection.z ) { 365 if ( absDirection.x > absDirection.y ) 366 face = direction.x > 0.0 ? 0.0 : 3.0; 367 else 368 face = direction.y > 0.0 ? 1.0 : 4.0; 369 } else { 370 if ( absDirection.z > absDirection.y ) 371 face = direction.z > 0.0 ? 2.0 : 5.0; 372 else 373 face = direction.y > 0.0 ? 1.0 : 4.0; 374 } 375 return face; 376 } 377 vec2 getUV( vec3 direction, float face ) { 378 vec2 uv; 379 if ( face == 0.0 ) { 380 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 381 } else if ( face == 1.0 ) { 382 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 383 } else if ( face == 2.0 ) { 384 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 385 } else if ( face == 3.0 ) { 386 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 387 } else if ( face == 4.0 ) { 388 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 389 } else { 390 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 391 } 392 return 0.5 * ( uv + 1.0 ); 393 } 394 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 395 float face = getFace( direction ); 396 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 397 mipInt = max( mipInt, cubeUV_minMipLevel ); 398 float faceSize = exp2( mipInt ); 399 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 400 if ( face > 2.0 ) { 401 uv.y += faceSize; 402 face -= 3.0; 403 } 404 uv.x += face * faceSize; 405 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 406 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 407 uv.x *= CUBEUV_TEXEL_WIDTH; 408 uv.y *= CUBEUV_TEXEL_HEIGHT; 409 #ifdef texture2DGradEXT 410 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 411 #else 412 return texture2D( envMap, uv ).rgb; 413 #endif 414 } 415 #define cubeUV_r0 1.0 416 #define cubeUV_m0 - 2.0 417 #define cubeUV_r1 0.8 418 #define cubeUV_m1 - 1.0 419 #define cubeUV_r4 0.4 420 #define cubeUV_m4 2.0 421 #define cubeUV_r5 0.305 422 #define cubeUV_m5 3.0 423 #define cubeUV_r6 0.21 424 #define cubeUV_m6 4.0 425 float roughnessToMip( float roughness ) { 426 float mip = 0.0; 427 if ( roughness >= cubeUV_r1 ) { 428 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 429 } else if ( roughness >= cubeUV_r4 ) { 430 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 431 } else if ( roughness >= cubeUV_r5 ) { 432 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 433 } else if ( roughness >= cubeUV_r6 ) { 434 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 435 } else { 436 mip = - 2.0 * log2( 1.16 * roughness ); } 437 return mip; 438 } 439 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 440 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 441 float mipF = fract( mip ); 442 float mipInt = floor( mip ); 443 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 444 if ( mipF == 0.0 ) { 445 return vec4( color0, 1.0 ); 446 } else { 447 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 448 return vec4( mix( color0, color1, mipF ), 1.0 ); 449 } 450 } 451#endif`,Xd=`vec3 transformedNormal = objectNormal; 452#ifdef USE_TANGENT 453 vec3 transformedTangent = objectTangent; 454#endif 455#ifdef USE_BATCHING 456 mat3 bm = mat3( batchingMatrix ); 457 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 458 transformedNormal = bm * transformedNormal; 459 #ifdef USE_TANGENT 460 transformedTangent = bm * transformedTangent; 461 #endif 462#endif 463#ifdef USE_INSTANCING 464 mat3 im = mat3( instanceMatrix ); 465 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 466 transformedNormal = im * transformedNormal; 467 #ifdef USE_TANGENT 468 transformedTangent = im * transformedTangent; 469 #endif 470#endif 471transformedNormal = normalMatrix * transformedNormal; 472#ifdef FLIP_SIDED 473 transformedNormal = - transformedNormal; 474#endif 475#ifdef USE_TANGENT 476 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 477 #ifdef FLIP_SIDED 478 transformedTangent = - transformedTangent; 479 #endif 480#endif`,qd=`#ifdef USE_DISPLACEMENTMAP 481 uniform sampler2D displacementMap; 482 uniform float displacementScale; 483 uniform float displacementBias; 484#endif`,Yd=`#ifdef USE_DISPLACEMENTMAP 485 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
485placementBias ); 486#endif`,$d=`#ifdef USE_EMISSIVEMAP 487 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 488 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 489 emissiveColor = sRGBTransferEOTF( emissiveColor ); 490 #endif 491 totalEmissiveRadiance *= emissiveColor.rgb; 492#endif`,Kd=`#ifdef USE_EMISSIVEMAP 493 uniform sampler2D emissiveMap; 494#endif`,Zd="gl_FragColor = linearToOutputTexel( gl_FragColor );",Jd=`vec4 LinearTransferOETF( in vec4 value ) { 495 return value; 496} 497vec4 sRGBTransferEOTF( in vec4 value ) { 498 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 ); 499} 500vec4 sRGBTransferOETF( in vec4 value ) { 501 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 ); 502}`,jd=`#ifdef USE_ENVMAP 503 #ifdef ENV_WORLDPOS 504 vec3 cameraToFrag; 505 if ( isOrthographic ) { 506 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 507 } else { 508 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 509 } 510 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 511 #ifdef ENVMAP_MODE_REFLECTION 512 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 513 #else 514 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 515 #endif 516 #else 517 vec3 reflectVec = vReflect; 518 #endif 519 #ifdef ENVMAP_TYPE_CUBE 520 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); 521 #ifdef ENVMAP_BLENDING_MULTIPLY 522 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 523 #elif defined( ENVMAP_BLENDING_MIX ) 524 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 525 #elif defined( ENVMAP_BLENDING_ADD ) 526 outgoingLight += envColor.xyz * specularStrength * reflectivity; 527 #endif 528 #endif 529#endif`,Qd=`#ifdef USE_ENVMAP 530 uniform float envMapIntensity; 531 uniform mat3 envMapRotation; 532 #ifdef ENVMAP_TYPE_CUBE 533 uniform samplerCube envMap; 534 #else 535 uniform sampler2D envMap; 536 #endif 537#endif`,ef=`#ifdef USE_ENVMAP 538 uniform float reflectivity; 539 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 540 #define ENV_WORLDPOS 541 #endif 542 #ifdef ENV_WORLDPOS 543 varying vec3 vWorldPosition; 544 uniform float refractionRatio; 545 #else 546 varying vec3 vReflect; 547 #endif 548#endif`,tf=`#ifdef USE_ENVMAP 549 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 550 #define ENV_WORLDPOS 551 #endif 552 #ifdef ENV_WORLDPOS 553 554 varying vec3 vWorldPosition; 555 #else 556 varying vec3 vReflect; 557 uniform float refractionRatio; 558 #endif 559#endif`,nf=`#ifdef USE_ENVMAP 560 #ifdef ENV_WORLDPOS 561 vWorldPosition = worldPosition.xyz; 562 #else 563 vec3 cameraToVertex; 564 if ( isOrthographic ) { 565 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 566 } else {
567 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 568 } 569 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 570 #ifdef ENVMAP_MODE_REFLECTION 571 vReflect = reflect( cameraToVertex, worldNormal ); 572 #else 573 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 574 #endif 575 #endif 576#endif`,rf=`#ifdef USE_FOG 577 vFogDepth = - mvPosition.z; 578#endif`,sf=`#ifdef USE_FOG 579 varying float vFogDepth; 580#endif`,af=`#ifdef USE_FOG 581 #ifdef FOG_EXP2 582 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 583 #else 584 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 585 #endif 586 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 587#endif`,of=`#ifdef USE_FOG 588 uniform vec3 fogColor; 589 varying float vFogDepth; 590 #ifdef FOG_EXP2 591 uniform float fogDensity; 592 #else 593 uniform float fogNear; 594 uniform float fogFar; 595 #endif 596#endif`,lf=`#ifdef USE_GRADIENTMAP 597 uniform sampler2D gradientMap; 598#endif 599vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 600 float dotNL = dot( normal, lightDirection ); 601 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 602 #ifdef USE_GRADIENTMAP 603 return vec3( texture2D( gradientMap, coord ).r ); 604 #else 605 vec2 fw = fwidth( coord ) * 0.5; 606 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 607 #endif 608}`,cf=`#ifdef USE_LIGHTMAP 609 uniform sampler2D lightMap; 610 uniform float lightMapIntensity; 611#endif`,uf=`LambertMaterial material; 612material.diffuseColor = diffuseColor.rgb; 613material.specularStrength = specularStrength;`,hf=`varying vec3 vViewPosition; 614struct LambertMaterial { 615 vec3 diffuseColor; 616 float specularStrength; 617}; 618void 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 ) { 619 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 620 vec3 irradiance = dotNL * directLight.color; 621 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 622} 623void 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 ) { 624 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 625} 626#define RE_Direct RE_Direct_Lambert 627#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,df=`uniform bool receiveShadow; 628uniform vec3 ambientLightColor; 629#if defined( USE_LIGHT_PROBES ) 630 uniform vec3 lightProbe[ 9 ]; 631#endif 632vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 633 float x = normal.x, y = normal.y, z = normal.z; 634 vec3 result = shCoefficients[ 0 ] * 0.886227; 635 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 636 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 637 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 638 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 639 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 640 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 641 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 642 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 643 return result; 644} 645vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 646 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 647 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 648 return irradiance; 649} 650vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 651 vec3 irradiance = ambientLightColor; 652 return irradiance; 653} 654float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 655 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 656 if ( cutoffDistance > 0.0 ) { 657 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 658 } 659 return distanceFalloff; 660} 661float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 662 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 663} 664#if NUM_DIR_LIGHTS > 0 665 struct DirectionalLight { 666 vec3 direction; 667 vec3 color; 668 }; 669 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 670 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 671 light.color = directionalLight.color; 672 light.direction = directionalLight.direction; 673 light.visible = true; 674 } 675#endif 676#if NUM_POINT_LIGHTS > 0 677 struct PointLight { 678 vec3 position; 679 vec3 color; 680 float distance; 681 float decay; 682 }; 683 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 684 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 685 vec3 lVector = pointLight.position - geometryPosition; 686 light.direction = normalize( lVector ); 687 float lightDistance = length( lVector ); 688 light.color = pointLight.color; 689 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 690 light.visible = ( light.color != vec3( 0.0 ) ); 691 } 692#endif
693#if NUM_SPOT_LIGHTS > 0 694 struct SpotLight { 695 vec3 position; 696 vec3 direction; 697 vec3 color; 698 float distance; 699 float decay; 700 float coneCos; 701 float penumbraCos; 702 }; 703 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 704 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 705 vec3 lVector = spotLight.position - geometryPosition; 706 light.direction = normalize( lVector ); 707 float angleCos = dot( light.direction, spotLight.direction ); 708 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 709 if ( spotAttenuation > 0.0 ) { 710 float lightDistance = length( lVector ); 711 light.color = spotLight.color * spotAttenuation; 712 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 713 light.visible = ( light.color != vec3( 0.0 ) ); 714 } else { 715 light.color = vec3( 0.0 ); 716 light.visible = false; 717 } 718 } 719#endif 720#if NUM_RECT_AREA_LIGHTS > 0 721 struct RectAreaLight { 722 vec3 color; 723 vec3 position; 724 vec3 halfWidth; 725 vec3 halfHeight; 726 }; 727 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 728 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 729#endif 730#if NUM_HEMI_LIGHTS > 0 731 struct HemisphereLight { 732 vec3 direction; 733 vec3 skyColor; 734 vec3 groundColor; 735 }; 736 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 737 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 738 float dotNL = dot( normal, hemiLight.direction ); 739 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 740 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 741 return irradiance; 742 } 743#endif 744#include <lightprobes_pars_fragment>`,ff=`#ifdef USE_ENVMAP 745 vec3 getIBLIrradiance( const in vec3 normal ) { 746 #ifdef ENVMAP_TYPE_CUBE_UV 747 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 748 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 749 return PI * envMapColor.rgb * envMapIntensity; 750 #else 751 return vec3( 0.0 ); 752 #endif 753 } 754 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 755 #ifdef ENVMAP_TYPE_CUBE_UV 756 vec3 reflectVec = reflect( - viewDir, normal ); 757 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 758 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 759 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 760 return envMapColor.rgb * envMapIntensity; 761 #else 762 return vec3( 0.0 ); 763 #endif 764 } 765 #ifdef USE_ANISOTROPY 766 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 767 #ifdef ENVMAP_TYPE_CUBE_UV 768 vec3 bentNormal = cross( bitangent, viewDir ); 769 bentNormal = normalize( cross( bentNormal, bitangent ) ); 770 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 771 return getIBLRadiance( viewDir, bentNormal, roughness ); 772 #else 773 return vec3( 0.0 ); 774 #endif 775 } 776 #endif 777#endif`,pf=`ToonMaterial material; 778material.diffuseColor = diffuseColor.rgb;`,mf=`varying vec3 vViewPosition; 779struct ToonMaterial { 780 vec3 diffuseColor; 781}; 782void 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 ) { 783 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 784 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 785} 786void 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 ) { 787 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 788} 789#define RE_Direct RE_Direct_Toon 790#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,gf=`BlinnPhongMaterial material; 791material.diffuseColor = diffuseColor.rgb; 792material.specularColor = specular; 793material.specularShininess = shininess; 794material.specularStrength = specularStrength;`,_f=`varying vec3 vViewPosition; 795struct BlinnPhongMaterial { 796 vec3 diffuseColor; 797 vec3 specularColor; 798 float specularShininess; 799 float specularStrength; 800}; 801void 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 ) {
802 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 803 vec3 irradiance = dotNL * directLight.color; 804 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 805 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 806} 807void 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 ) { 808 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 809} 810#define RE_Direct RE_Direct_BlinnPhong 811#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,vf=`PhysicalMaterial material; 812material.diffuseColor = diffuseColor.rgb; 813material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 814material.metalness = metalnessFactor; 815vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 816float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 817material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 818material.roughness = min( material.roughness, 1.0 ); 819#ifdef IOR 820 material.ior = ior; 821 #ifdef USE_SPECULAR 822 float specularIntensityFactor = specularIntensity; 823 vec3 specularColorFactor = specularColor; 824 #ifdef USE_SPECULAR_COLORMAP 825 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 826 #endif 827 #ifdef USE_SPECULAR_INTENSITYMAP 828 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 829 #endif 830 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 831 #else 832 float specularIntensityFactor = 1.0; 833 vec3 specularColorFactor = vec3( 1.0 ); 834 material.specularF90 = 1.0; 835 #endif 836 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 837 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 838#else 839 material.specularColor = vec3( 0.04 ); 840 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 841 material.specularF90 = 1.0; 842#endif 843#ifdef USE_CLEARCOAT 844 material.clearcoat = clearcoat; 845 material.clearcoatRoughness = clearcoatRoughness; 846 material.clearcoatF0 = vec3( 0.04 ); 847 material.clearcoatF90 = 1.0; 848 #ifdef USE_CLEARCOATMAP 849 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 850 #endif 851 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 852 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 853 #endif 854 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 855 material.clearcoatRoughness += geometryRoughness; 856 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 857#endif 858#ifdef USE_DISPERSION 859 material.dispersion = dispersion; 860#endif 861#ifdef USE_IRIDESCENCE 862 material.iridescence = iridescence; 863 material.iridescenceIOR = iridescenceIOR; 864 #ifdef USE_IRIDESCENCEMAP 865 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 866 #endif 867 #ifdef USE_IRIDESCENCE_THICKNESSMAP 868 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 869 #else 870 material.iridescenceThickness = iridescenceThicknessMaximum; 871 #endif 872#endif 873#ifdef USE_SHEEN 874 material.sheenColor = sheenColor; 875 #ifdef USE_SHEEN_COLORMAP 876 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 877 #endif 878 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 879 #ifdef USE_SHEEN_ROUGHNESSMAP 880 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 881 #endif 882#endif 883#ifdef USE_ANISOTROPY 884 #ifdef USE_ANISOTROPYMAP 885 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 886 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 887 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 888 #else 889 vec2 anisotropyV = anisotropyVector; 890 #endif 891 material.anisotropy = length( anisotropyV ); 892 if( material.anisotropy == 0.0 ) { 893 anisotropyV = vec2( 1.0, 0.0 ); 894 } else { 895 anisotropyV /= material.anisotropy; 896 material.anisotropy = saturate( material.anisotropy ); 897 } 898 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
899 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 900 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 901#endif`,xf=`uniform sampler2D dfgLUT; 902struct PhysicalMaterial { 903 vec3 diffuseColor; 904 vec3 diffuseContribution; 905 vec3 specularColor; 906 vec3 specularColorBlended; 907 float roughness; 908 float metalness; 909 float specularF90; 910 float dispersion; 911 #ifdef USE_CLEARCOAT 912 float clearcoat; 913 float clearcoatRoughness; 914 vec3 clearcoatF0; 915 float clearcoatF90; 916 #endif 917 #ifdef USE_IRIDESCENCE 918 float iridescence; 919 float iridescenceIOR; 920 float iridescenceThickness; 921 vec3 iridescenceFresnel; 922 vec3 iridescenceF0; 923 vec3 iridescenceFresnelDielectric; 924 vec3 iridescenceFresnelMetallic; 925 #endif 926 #ifdef USE_SHEEN 927 vec3 sheenColor; 928 float sheenRoughness; 929 #endif 930 #ifdef IOR 931 float ior; 932 #endif 933 #ifdef USE_TRANSMISSION 934 float transmission; 935 float transmissionAlpha; 936 float thickness; 937 float attenuationDistance; 938 vec3 attenuationColor; 939 #endif 940 #ifdef USE_ANISOTROPY 941 float anisotropy; 942 float alphaT; 943 vec3 anisotropyT; 944 vec3 anisotropyB; 945 #endif 946}; 947vec3 clearcoatSpecularDirect = vec3( 0.0 ); 948vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 949vec3 sheenSpecularDirect = vec3( 0.0 ); 950vec3 sheenSpecularIndirect = vec3(0.0 ); 951vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 952 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 953 float x2 = x * x; 954 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 955 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 956} 957float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 958 float a2 = pow2( alpha ); 959 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 960 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 961 return 0.5 / max( gv + gl, EPSILON ); 962} 963float D_GGX( const in float alpha, const in float dotNH ) { 964 float a2 = pow2( alpha ); 965 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 966 return RECIPROCAL_PI * a2 / pow2( denom ); 967} 968#ifdef USE_ANISOTROPY 969 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 ) { 970 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 971 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 972 return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 972-1131
972; 973 } 974 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 975 float a2 = alphaT * alphaB; 976 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 977 highp float v2 = dot( v, v ); 978 float w2 = a2 / v2; 979 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 980 } 981#endif 982#ifdef USE_CLEARCOAT 983 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 984 vec3 f0 = material.clearcoatF0; 985 float f90 = material.clearcoatF90; 986 float roughness = material.clearcoatRoughness; 987 float alpha = pow2( roughness ); 988 vec3 halfDir = normalize( lightDir + viewDir ); 989 float dotNL = saturate( dot( normal, lightDir ) ); 990 float dotNV = saturate( dot( normal, viewDir ) ); 991 float dotNH = saturate( dot( normal, halfDir ) ); 992 float dotVH = saturate( dot( viewDir, halfDir ) ); 993 vec3 F = F_Schlick( f0, f90, dotVH ); 994 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 995 float D = D_GGX( alpha, dotNH ); 996 return F * ( V * D ); 997 } 998#endif 999vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1000 vec3 f0 = material.specularColorBlended; 1001 float f90 = material.specularF90; 1002 float roughness = material.roughness; 1003 float alpha = pow2( roughness ); 1004 vec3 halfDir = normalize( lightDir + viewDir ); 1005 float dotNL = saturate( dot( normal, lightDir ) ); 1006 float dotNV = saturate( dot( normal, viewDir ) ); 1007 float dotNH = saturate( dot( normal, halfDir ) ); 1008 float dotVH = saturate( dot( viewDir, halfDir ) ); 1009 vec3 F = F_Schlick( f0, f90, dotVH ); 1010 #ifdef USE_IRIDESCENCE 1011 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1012 #endif 1013 #ifdef USE_ANISOTROPY 1014 float dotTL = dot( material.anisotropyT, lightDir ); 1015 float dotTV = dot( material.anisotropyT, viewDir ); 1016 float dotTH = dot( material.anisotropyT, halfDir ); 1017 float dotBL = dot( material.anisotropyB, lightDir ); 1018 float dotBV = dot( material.anisotropyB, viewDir ); 1019 float dotBH = dot( material.anisotropyB, halfDir ); 1020 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1021 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1022 #else 1023 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1024 float D = D_GGX( alpha, dotNH ); 1025 #endif 1026 return F * ( V * D ); 1027} 1028vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1029 const float LUT_SIZE = 64.0; 1030 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1031 const float LUT_BIAS = 0.5 / LUT_SIZE; 1032 float dotNV = saturate( dot( N, V ) ); 1033 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1034 uv = uv * LUT_SCALE + LUT_BIAS; 1035 return uv; 1036} 1037float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1038 float l = length( f ); 1039 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1040} 1041vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1042 float x = dot( v1, v2 ); 1043 float y = abs( x ); 1044 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1045 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1046 float v = a / b; 1047 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1048 return cross( v1, v2 ) * theta_sintheta; 1049} 1050vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1051 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1052 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1053 vec3 lightNormal = cross( v1, v2 ); 1054 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1055 vec3 T1, T2; 1056 T1 = normalize( V - N * dot( V, N ) ); 1057 T2 = - cross( N, T1 ); 1058 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1059 vec3 coords[ 4 ]; 1060 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1061 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1062 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1063 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1064 coords[ 0 ] = normalize( coords[ 0 ] ); 1065 coords[ 1 ] = normalize( coords[ 1 ] ); 1066 coords[ 2 ] = normalize( coords[ 2 ] ); 1067 coords[ 3 ] = normalize( coords[ 3 ] ); 1068 vec3 vectorFormFactor = vec3( 0.0 ); 1069 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1070 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1071 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1072 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1073 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1074 return vec3( result ); 1075} 1076#if defined( USE_SHEEN ) 1077float D_Charlie( float roughness, float dotNH ) { 1078 float alpha = pow2( roughness ); 1079 float invAlpha = 1.0 / alpha; 1080 float cos2h = dotNH * dotNH; 1081 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1082 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1083} 1084float V_Neubelt( float dotNV, float dotNL ) { 1085 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1086} 1087vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1088 vec3 halfDir = normalize( lightDir + viewDir ); 1089 float dotNL = saturate( dot( normal, lightDir ) ); 1090 float dotNV = saturate( dot( normal, viewDir ) ); 1091 float dotNH = saturate( dot( normal, halfDir ) ); 1092 float D = D_Charlie( sheenRoughness, dotNH ); 1093 float V = V_Neubelt( dotNV, dotNL ); 1094 return sheenColor * ( D * V ); 1095} 1096#endif 1097float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1098 float dotNV = saturate( dot( normal, viewDir ) ); 1099 float r2 = roughness * roughness; 1100 float rInv = 1.0 / ( roughness + 0.1 ); 1101 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1102 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1103 float DG = exp( a * dotNV + b ); 1104 return saturate( DG ); 1105} 1106vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1107 float dotNV = saturate( dot( normal, viewDir ) ); 1108 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1109 return specularColor * fab.x + specularF90 * fab.y; 1110} 1111#ifdef USE_IRIDESCENCE 1112void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1113#else 1114void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1115#endif 1116 float dotNV = saturate( dot( normal, viewDir ) ); 1117 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1118 #ifdef USE_IRIDESCENCE 1119 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1120 #else 1121 vec3 Fr = specularColor; 1122 #endif 1123 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1124 float Ess = fab.x + fab.y; 1125 float Ems = 1.0 - Ess; 1126 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1127 singleScatter += FssEss; 1128 multiScatter += Fms * Ems; 1129} 1130vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1131 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1132-1261
1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1135 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1136 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1137 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1138 float Ess_V = dfgV.x + dfgV.y; 1139 float Ess_L = dfgL.x + dfgL.y; 1140 float Ems_V = 1.0 - Ess_V; 1141 float Ems_L = 1.0 - Ess_L; 1142 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1143 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1144 float compensationFactor = Ems_V * Ems_L; 1145 vec3 multiScatter = Fms * compensationFactor; 1146 return singleScatter + multiScatter; 1147} 1148#if NUM_RECT_AREA_LIGHTS > 0 1149 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 ) { 1150 vec3 normal = geometryNormal; 1151 vec3 viewDir = geometryViewDir; 1152 vec3 position = geometryPosition; 1153 vec3 lightPos = rectAreaLight.position; 1154 vec3 halfWidth = rectAreaLight.halfWidth; 1155 vec3 halfHeight = rectAreaLight.halfHeight; 1156 vec3 lightColor = rectAreaLight.color; 1157 float roughness = material.roughness; 1158 vec3 rectCoords[ 4 ]; 1159 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1160 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1161 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1162 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1163 vec4 t1 = texture2D( ltc_1, uv ); 1164 vec4 t2 = texture2D( ltc_2, uv ); 1165 mat3 mInv = mat3( 1166 vec3( t1.x, 0, t1.y ), 1167 vec3( 0, 1, 0 ), 1168 vec3( t1.z, 0, t1.w ) 1169 ); 1170 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1171 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1172 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1173 #ifdef USE_CLEARCOAT 1174 vec3 Ncc = geometryClearcoatNormal; 1175 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1176 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1177 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1178 mat3 mInvClearcoat = mat3( 1179 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1180 vec3( 0, 1, 0 ), 1181 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1182 ); 1183 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1184 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1185 #endif 1186 } 1187#endif 1188void 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 ) { 1189 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1190 vec3 irradiance = dotNL * directLight.color; 1191 #ifdef USE_CLEARCOAT 1192 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1193 vec3 ccIrradiance = dotNLcc * directLight.color; 1194 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1195 #endif 1196 #ifdef USE_SHEEN 1197 1198 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1199 1200 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1201 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1202 1203 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1204 1205 irradiance *= sheenEnergyComp; 1206 1207 #endif 1208 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1209 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1210} 1211void 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 ) { 1212 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1213 #ifdef USE_SHEEN 1214 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1215 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1216 diffuse *= sheenEnergyComp; 1217 #endif 1218 reflectedLight.indirectDiffuse += diffuse; 1219} 1220void 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) { 1221 #ifdef USE_CLEARCOAT 1222 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1223 #endif 1224 #ifdef USE_SHEEN 1225 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1226 #endif 1227 vec3 singleScatteringDielectric = vec3( 0.0 ); 1228 vec3 multiScatteringDielectric = vec3( 0.0 ); 1229 vec3 singleScatteringMetallic = vec3( 0.0 ); 1230 vec3 multiScatteringMetallic = vec3( 0.0 ); 1231 #ifdef USE_IRIDESCENCE 1232 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1233 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1234 #else 1235 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1237 #endif 1238 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1239 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1240 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1241 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1242 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1243 vec3 indirectSpecular = radiance * singleScattering; 1244 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1245 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1246 #ifdef USE_SHEEN 1247 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1248 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1249 indirectSpecular *= sheenEnergyComp; 1250 indirectDiffuse *= sheenEnergyComp; 1251 #endif 1252 reflectedLight.indirectSpecular += indirectSpecular; 1253 reflectedLight.indirectDiffuse += indirectDiffuse; 1254} 1255#define RE_Direct RE_Direct_Physical 1256#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1257#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1258#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1259float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1260 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1261}`,
1261Mf=` 1262vec3 geometryPosition = - vViewPosition; 1263vec3 geometryNormal = normal; 1264vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1265vec3 geometryClearcoatNormal = vec3( 0.0 ); 1266#ifdef USE_CLEARCOAT 1267 geometryClearcoatNormal = clearcoatNormal; 1268#endif 1269#ifdef USE_IRIDESCENCE 1270 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1271 if ( material.iridescenceThickness == 0.0 ) { 1272 material.iridescence = 0.0; 1273 } else { 1274 material.iridescence = saturate( material.iridescence ); 1275 } 1276 if ( material.iridescence > 0.0 ) { 1277 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1278 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1279 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1280 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1281 } 1282#endif 1283IncidentLight directLight; 1284#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1285 PointLight pointLight; 1286 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1287 PointLightShadow pointLightShadow; 1288 #endif 1289 #pragma unroll_loop_start 1290 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1291 pointLight = pointLights[ i ]; 1292 getPointLightInfo( pointLight, geometryPosition, directLight ); 1293 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1294 pointLightShadow = pointLightShadows[ i ]; 1295 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1296 #endif 1297 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1298 } 1299 #pragma unroll_loop_end 1300#endif 1301#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1302 SpotLight spotLight; 1303 vec4 spotColor; 1304 vec3 spotLightCoord; 1305 bool inSpotLightMap; 1306 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1307 SpotLightShadow spotLightShadow; 1308 #endif 1309 #pragma unroll_loop_start 1310 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1311 spotLight = spotLights[ i ]; 1312 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1313 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1314 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1315 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1316 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1317 #else 1318 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1319 #endif 1320 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1321 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1322 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1323 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1324 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1325 #endif 1326 #undef SPOT_LIGHT_MAP_INDEX 1327 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1328 spotLightShadow = spotLightShadows[ i ]; 1329 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1330 #endif 1331 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1332 } 1333 #pragma unroll_loop_end 1334#endif 1335#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1336 DirectionalLight directionalLight; 1337 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1338 DirectionalLightShadow directionalLightShadow; 1339 #endif 1340 #pragma unroll_loop_start 1341 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1342 directionalLight = directionalLights[ i ]; 1343 getDirectionalLightInfo( directionalLight, directLight ); 1344 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1345 directionalLightShadow = directionalLightShadows[ i ]; 1346 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1347 #endif 1348 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1349 } 1350 #pragma unroll_loop_end 1351#endif 1352#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1353 RectAreaLight rectAreaLight; 1354 #pragma unroll_loop_start 1355 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1356 rectAreaLight = rectAreaLights[ i ]; 1357 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1358 } 1359 #pragma unroll_loop_end 1360#endif 1361#if defined( RE_IndirectDiffuse ) 1362 vec3 iblIrradiance = vec3( 0.0 ); 1363 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1364 #if defined( USE_LIGHT_PROBES ) 1365 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1366 #endif 1367 #if ( NUM_HEMI_LIGHTS > 0 ) 1368 #pragma unroll_loop_start 1369 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1370 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1371 } 1372 #pragma unroll_loop_end 1373 #endif 1374 #ifdef USE_LIGHT_PROBES_GRID 1375 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 1376 vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix ); 1377 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 1378 #endif 1379#endif 1380#if defined( RE_IndirectSpecular ) 1381 vec3 radiance = vec3( 0.0 ); 1382 vec3 clearcoatRadiance = vec3( 0.0 ); 1383#endif`,Sf=`#if defined( RE_IndirectDiffuse ) 1384 #ifdef USE_LIGHTMAP 1385 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1386 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1387 irradiance += lightMapIrradiance; 1388 #endif 1389 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1390 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1391 iblIrradiance += getIBLIrradiance( geometryNormal ); 1392 #endif 1393 #endif 1394#endif 1395#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1396 #ifdef USE_ANISOTROPY 1397 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1398 #else 1399 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1400 #endif 1401 #ifdef USE_CLEARCOAT 1402 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1403 #endif 1404#endif`,yf=`#if defined( RE_IndirectDiffuse ) 1405 #if defined( LAMBERT ) || defined( PHONG ) 1406 irradiance += iblIrradiance; 1407 #endif 1408 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1409#endif 1410#if defined( RE_IndirectSpecular ) 1411 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1412#endif`,Ef=`#ifdef USE_LIGHT_PROBES_GRID 1413uniform highp sampler3D probesSH; 1414uniform vec3 probesMin; 1415uniform vec3 probesMax; 1416uniform vec3 probesResolution; 1417vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 1418 vec3 res = probesResolution; 1419 vec3 gridRange = probesMax - probesMin; 1420 vec3 resMinusOne = res - 1.0; 1421 vec3 probeSpacing = gridRange / resMinusOne; 1422 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 1423 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 1424 uvw = uvw * resMinusOne / res + 0.5 / res; 1425 float nz = res.z; 1426 float paddedSlices = nz + 2.0; 1427 float atlasDepth = 7.0 * paddedSlices; 1428 float uvZBase = uvw.z * nz + 1.0; 1429 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 1430 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 1431 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 1432 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 1433 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 1434 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 1435 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 1436 vec3 c0 = s0.xyz; 1437 vec3 c1 = vec3( s0.w, s1.xy ); 1438 vec3 c2 = vec3( s1.zw, s2.x ); 1439 vec3 c3 = s2.yzw; 1440 vec3 c4 = s3.xyz; 1441 vec3 c5 = vec3( s3.w, s4.xy ); 1442 vec3 c6 = vec3( s4.zw, s5.x ); 1443 vec3 c7 = s5.yzw; 1444 vec3 c8 = s6.xyz; 1445 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 1446 vec3 result = c0 * 0.886227; 1447 result += c1 * 2.0 * 0.511664 * y; 1448 result += c2 * 2.0 * 0.511664 * z; 1449 result += c3 * 2.0 * 0.511664 * x; 1450 result += c4 * 2.0 * 0.429043 * x * y; 1451 result += c5 * 2.0 * 0.429043 * y * z; 1452 result += c6 * ( 0.743125 * z * z - 0.247708 ); 1453 result += c7 * 2.0 * 0.429043 * x * z; 1454 result += c8 * 0.429043 * ( x * x - y * y ); 1455 return max( result, vec3( 0.0 ) ); 1456} 1457#endif`,bf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1458 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1459#endif`,Tf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1460 uniform float logDepthBufFC; 1461 varying float vFragDepth; 1462 varying float vIsPerspective; 1463#endif`,Af=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1464 varying float vFragDepth; 1465 varying float vIsPerspective; 1466#endif`,wf=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1467 vFragDepth = 1.0 + gl_Position.w; 1468 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1469#endif`,Rf=`#ifdef USE_MAP 1470 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1471 #ifdef DECODE_VIDEO_TEXTURE 1472 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1473 #endif 1474 diffuseColor *= sampledDiffuseColor; 1475#endif`,Cf=`#ifdef USE_MAP 1476 uniform sampler2D map; 1477#endif`,Pf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1478 #if defined( USE_POINTS_UV ) 1479 vec2 uv = vUv; 1480 #else 1481 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1482 #endif 1483#endif 1484#ifdef USE_MAP 1485 diffuseColor *= texture2D( map, uv ); 1486#endif 1487#ifdef USE_ALPHAMAP 1488 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1489#endif`,Lf=`#if defined( USE_POINTS_UV ) 1490 varying vec2 vUv; 1491#else 1492 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1493 uniform mat3 uvTransform; 1494 #endif 1495#endif 1496#ifdef USE_MAP 1497 uniform sampler2D map; 1498#endif 1499#ifdef USE_ALPHAMAP 1500 uniform sampler2D alphaMap; 1501#endif`,Df=`float metalnessFactor = metalness; 1502#ifdef USE_METALNESSMAP 1503 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1504 metalnessFactor *= texelMetalness.b; 1505#endif`,If=`#ifdef USE_METALNESSMAP 1506 uniform sampler2D metalnessMap; 1507#endif`,Uf=`#ifdef USE_INSTANCING_MORPH 1508 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1509 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1510 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1511 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1512 } 1513#endif`,Nf=`#if defined( USE_MORPHCOLORS ) 1514 vColor *= morphTargetBaseInfluence; 1515 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1516 #if defined( USE_COLOR_ALPHA ) 1517 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1518 #elif defined( USE_COLOR ) 1519 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1520 #endif 1521 } 1522#endif`,Ff=`#ifdef USE_MORPHNORMALS 1523 objectNormal *= morphTargetBaseInfluence; 1524 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1525 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1526 } 1527#endif`,Of=`#ifdef USE_MORPHTARGETS 1528 #ifndef USE_INSTANCING_MORPH 1529 uniform float morphTargetBaseInfluence; 1530 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1531 #endif 1532 uniform sampler2DArray morphTargetsTexture; 1533 uniform ivec2 morphTargetsTextureSize; 1534 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1535 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1536 int y = texelIndex / morphTargetsTextureSize.x; 1537 int x = texelIndex - y * morphTargetsTextureSize.x; 1538 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1539 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1540 } 1541#endif`,Bf=`#ifdef USE_MORPHTARGETS 1542 transformed *= morphTargetBaseInfluence; 1543 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1544 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1545 } 1546#endif`,zf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1547#ifdef FLAT_SHADED 1548 vec3 fdx = dFdx( vViewPosition ); 1549 vec3 fdy = dFdy( vViewPosition ); 1550 vec3 normal = normalize( cross( fdx, fdy ) ); 1551#else 1552 vec3 normal = normalize( vNormal ); 1553 #ifdef DOUBLE_SIDED 1554 normal *= faceDirection; 1555 #endif 1556#endif 1557#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1558 #ifdef USE_TANGENT 1559 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1560 #else 1561 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1562 #if defined( USE_NORMALMAP ) 1563 vNormalMapUv 1564 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1565 vClearcoatNormalMapUv 1566 #else 1567 vUv 1568 #endif 1569 ); 1570 #endif 1571 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1572 tbn[0] *= faceDirection; 1573 tbn[1] *= faceDirection; 1574 #endif 1575#endif 1576#ifdef USE_CLEARCOAT_NORMALMAP 1577 #ifdef USE_TANGENT 1578 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1579 #else 1580 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1581 #endif 1582 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1583 tbn2[0] *= faceDirection; 1584 tbn2[1] *= faceDirection; 1585 #endif 1586#endif 1587vec3 nonPerturbedNormal = normal;`,Gf=`#ifdef USE_NORMALMAP_OBJECTSPACE 1588 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1589 #ifdef FLIP_SIDED 1590 normal = - normal; 1591 #endif 1592 #ifdef DOUBLE_SIDED 1593 normal = normal * faceDirection; 1594 #endif 1595 normal = normalize( normalMatrix * normal ); 1596#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1597 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1598 #if defined( USE_PACKED_NORMALMAP ) 1599 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 1600 #endif 1601 mapN.xy *= normalScale; 1602 normal = normalize( tbn * mapN ); 1603#elif defined( USE_BUMPMAP )
1604 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1605#endif`,Vf=`#ifndef FLAT_SHADED 1606 varying vec3 vNormal; 1607 #ifdef USE_TANGENT 1608 varying vec3 vTangent; 1609 varying vec3 vBitangent; 1610 #endif 1611#endif`,kf=`#ifndef FLAT_SHADED 1612 varying vec3 vNormal; 1613 #ifdef USE_TANGENT 1614 varying vec3 vTangent; 1615 varying vec3 vBitangent; 1616 #endif 1617#endif`,Hf=`#ifndef FLAT_SHADED 1618 vNormal = normalize( transformedNormal ); 1619 #ifdef USE_TANGENT 1620 vTangent = normalize( transformedTangent ); 1621 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1622 #endif 1623#endif`,Wf=`#ifdef USE_NORMALMAP 1624 uniform sampler2D normalMap; 1625 uniform vec2 normalScale; 1626#endif 1627#ifdef USE_NORMALMAP_OBJECTSPACE 1628 uniform mat3 normalMatrix; 1629#endif 1630#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1631 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1632 vec3 q0 = dFdx( eye_pos.xyz ); 1633 vec3 q1 = dFdy( eye_pos.xyz ); 1634 vec2 st0 = dFdx( uv.st ); 1635 vec2 st1 = dFdy( uv.st ); 1636 vec3 N = surf_norm; 1637 vec3 q1perp = cross( q1, N ); 1638 vec3 q0perp = cross( N, q0 ); 1639 vec3 T = q1perp * st0.x + q0perp * st1.x; 1640 vec3 B = q1perp * st0.y + q0perp * st1.y; 1641 float det = max( dot( T, T ), dot( B, B ) ); 1642 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1643 return mat3( T * scale, B * scale, N ); 1644 } 1645#endif`,Xf=`#ifdef USE_CLEARCOAT 1646 vec3 clearcoatNormal = nonPerturbedNormal; 1647#endif`,qf=`#ifdef USE_CLEARCOAT_NORMALMAP 1648 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1649 clearcoatMapN.xy *= clearcoatNormalScale; 1650 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1651#endif`,Yf=`#ifdef USE_CLEARCOATMAP 1652 uniform sampler2D clearcoatMap; 1653#endif 1654#ifdef USE_CLEARCOAT_NORMALMAP 1655 uniform sampler2D clearcoatNormalMap; 1656 uniform vec2 clearcoatNormalScale; 1657#endif 1658#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1659 uniform sampler2D clearcoatRoughnessMap; 1660#endif`,$f=`#ifdef USE_IRIDESCENCEMAP 1661 uniform sampler2D iridescenceMap; 1662#endif 1663#ifdef USE_IRIDESCENCE_THICKNESSMAP 1664 uniform sampler2D iridescenceThicknessMap; 1665#endif`,Kf=`#ifdef OPAQUE 1666diffuseColor.a = 1.0; 1667#endif 1668#ifdef USE_TRANSMISSION 1669diffuseColor.a *= material.transmissionAlpha; 1670#endif 1671gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zf=`vec3 packNormalToRGB( const in vec3 normal ) { 1672 return normalize( normal ) * 0.5 + 0.5; 1673} 1674vec3 unpackRGBToNormal( const in vec3 rgb ) { 1675 return 2.0 * rgb.xyz - 1.0; 1676} 1677const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1678const float Inv255 = 1. / 255.; 1679const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1680const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1681const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1682const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1683vec4 packDepthToRGBA( const in float v ) { 1684 if( v <= 0.0 ) 1685 return vec4( 0., 0., 0., 0. ); 1686 if( v >= 1.0 ) 1687 return vec4( 1., 1., 1., 1. ); 1688 float vuf; 1689 float af = modf( v * PackFactors.a, vuf ); 1690 float bf = modf( vuf * ShiftRight8, vuf ); 1691 float gf = modf( vuf * ShiftRight8, vuf ); 1692 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1693} 1694vec3 packDepthToRGB( const in float v ) { 1695 if( v <= 0.0 ) 1696 return vec3( 0., 0., 0. ); 1697 if( v >= 1.0 ) 1698 return vec3( 1., 1., 1. ); 1699 float vuf; 1700 float bf = modf( v * PackFactors.b, vuf ); 1701 float gf = modf( vuf * ShiftRight8, vuf ); 1702 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1703} 1704vec2 packDepthToRG( const in float v ) { 1705 if( v <= 0.0 ) 1706 return vec2( 0., 0. ); 1707 if( v >= 1.0 ) 1708 return vec2( 1., 1. ); 1709 float vuf; 1710 float gf = modf( v * 256., vuf ); 1711 return vec2( vuf * Inv255, gf ); 1712} 1713float unpackRGBAToDepth( const in vec4 v ) { 1714 return dot( v, UnpackFactors4 ); 1715} 1716float unpackRGBToDepth( const in vec3 v ) { 1717 return dot( v, UnpackFactors3 ); 1718} 1719float unpackRGToDepth( const in vec2 v ) { 1720 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1721} 1722vec4 pack2HalfToRGBA( const in vec2 v ) {
1723 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1724 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1725} 1726vec2 unpackRGBATo2Half( const in vec4 v ) { 1727 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1728} 1729float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1730 return ( viewZ + near ) / ( near - far ); 1731} 1732float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1733 #ifdef USE_REVERSED_DEPTH_BUFFER 1734 1735 return depth * ( far - near ) - far; 1736 #else 1737 return depth * ( near - far ) - near; 1738 #endif 1739} 1740float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1741 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1742} 1743float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1744 1745 #ifdef USE_REVERSED_DEPTH_BUFFER 1746 return ( near * far ) / ( ( near - far ) * depth - near ); 1747 #else 1748 return ( near * far ) / ( ( far - near ) * depth - far ); 1749 #endif 1750}`,Jf=`#ifdef PREMULTIPLIED_ALPHA 1751 gl_FragColor.rgb *= gl_FragColor.a; 1752#endif`,jf=`vec4 mvPosition = vec4( transformed, 1.0 ); 1753#ifdef USE_BATCHING 1754 mvPosition = batchingMatrix * mvPosition; 1755#endif 1756#ifdef USE_INSTANCING 1757 mvPosition = instanceMatrix * mvPosition; 1758#endif 1759mvPosition = modelViewMatrix * mvPosition; 1760gl_Position = projectionMatrix * mvPosition;`,Qf=`#ifdef DITHERING 1761 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1762#endif`,ep=`#ifdef DITHERING 1763 vec3 dithering( vec3 color ) { 1764 float grid_position = rand( gl_FragCoord.xy ); 1765 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1766 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1767 return color + dither_shift_RGB; 1768 } 1769#endif`,tp=`float roughnessFactor = roughness; 1770#ifdef USE_ROUGHNESSMAP 1771 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1772 roughnessFactor *= texelRoughness.g; 1773#endif`,np=`#ifdef USE_ROUGHNESSMAP 1774 uniform sampler2D roughnessMap; 1775#endif`,ip=`#if NUM_SPOT_LIGHT_COORDS > 0 1776 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1777#endif 1778#if NUM_SPOT_LIGHT_MAPS > 0 1779 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1780#endif 1781#ifdef USE_SHADOWMAP 1782 #if NUM_DIR_LIGHT_SHADOWS > 0 1783 #if defined( SHADOWMAP_TYPE_PCF ) 1784 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1785 #else 1786 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1787 #endif 1788 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1789 struct DirectionalLightShadow { 1790 float shadowIntensity; 1791 float shadowBias; 1792 float shadowNormalBias; 1793 float shadowRadius; 1794 vec2 shadowMapSize; 1795 }; 1796 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1797 #endif 1798 #if NUM_SPOT_LIGHT_SHADOWS > 0 1799 #if defined( SHADOWMAP_TYPE_PCF ) 1800 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1801 #else 1802 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1803 #endif 1804 struct SpotLightShadow { 1805 float shadowIntensity; 1806 float shadowBias; 1807 float shadowNormalBias; 1808 float shadowRadius; 1809 vec2 shadowMapSize; 1810 }; 1811 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1812 #endif 1813 #if NUM_POINT_LIGHT_SHADOWS > 0 1814 #if defined( SHADOWMAP_TYPE_PCF ) 1815 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1816 #elif defined( SHADOWMAP_TYPE_BASIC ) 1817 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1818 #endif 1819 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1820 struct PointLightShadow { 1821 float shadowIntensity; 1822 float shadowBias; 1823 float shadowNormalBias; 1824 float shadowRadius; 1825 vec2 shadowMapSize; 1826 float shadowCameraNear; 1827 float shadowCameraFar; 1828 }; 1829 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1830 #endif 1831 #if defined( SHADOWMAP_TYPE_PCF ) 1832 float interleavedGradientNoise( vec2 position ) { 1833 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1834 } 1835 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1836 const float goldenAngle = 2.399963229728653; 1837 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1838 float theta = float( sampleIndex ) * goldenAngle + phi; 1839 return vec2( cos( theta ), sin( theta ) ) * r; 1840 } 1841 #endif 1842 #if defined( SHADOWMAP_TYPE_PCF ) 1843 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1844 float shadow = 1.0; 1845 shadowCoord.xyz /= shadowCoord.w; 1846 shadowCoord.z += shadowBias; 1847 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1848 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1849 if ( frustumTest ) { 1850 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1851 float radius = shadowRadius * texelSize.x; 1852 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1853 shadow = ( 1854 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1855 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1856 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1857 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1858 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1859 ) * 0.2; 1860 } 1861 return mix( 1.0, shadow, shadowIntensity ); 1862 } 1863 #elif defined( SHADOWMAP_TYPE_VSM ) 1864 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1865 float shadow = 1.0; 1866 shadowCoord.xyz /= shadowCoord.w; 1867 #ifdef USE_REVERSED_DEPTH_BUFFER 1868 shadowCoord.z -= shadowBias; 1869 #else 1870 shadowCoord.z += shadowBias; 1871 #endif 1872 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1873 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1874 if ( frustumTest ) { 1875 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1876 float mean = distribution.x; 1877 float variance = distribution.y * distribution.y; 1878 #ifdef USE_REVERSED_DEPTH_BUFFER 1879 float hard_shadow = step( mean, shadowCoord.z ); 1880 #else 1881 float hard_shadow = step( shadowCoord.z, mean ); 1882 #endif 1883 1884 if ( hard_shadow == 1.0 ) { 1885 shadow = 1.0; 1886 } else { 1887 variance = max( variance, 0.0000001 ); 1888 float d = shadowCoord.z - mean; 1889 float p_max = variance / ( variance + d * d ); 1890 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1891 shadow = max( hard_shadow, p_max ); 1892 } 1893 } 1894 return mix( 1.0, shadow, shadowIntensity ); 1895 } 1896 #else 1897 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1898 float shadow = 1.0; 1899 shadowCoord.xyz /= shadowCoord.w; 1900 #ifdef USE_REVERSED_DEPTH_BUFFER 1901 shadowCoord.z -= shadowBias; 1902 #else 1903 shadowCoord.z += shadowBias; 1904 #endif 1905 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1906 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1907 if ( frustumTest ) { 1908 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1909 #ifdef USE_REVERSED_DEPTH_BUFFER 1910 shadow = step( depth, shadowCoord.z ); 1911 #else 1912 shadow = step( shadowCoord.z, depth ); 1913 #endif 1914 } 1915 return mix( 1.0, shadow, shadowIntensity ); 1916 } 1917 #endif 1918 #if NUM_POINT_LIGHT_SHADOWS > 0 1919 #if defined( SHADOWMAP_TYPE_PCF ) 1920 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1921 float shadow = 1.0; 1922 vec3 lightToPosition = shadowCoord.xyz; 1923 vec3 bd3D = normalize( lightToPosition ); 1924 vec3 absVec = abs( lightToPosition ); 1925 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1926 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1927 #ifdef USE_REVERSED_DEPTH_BUFFER 1928 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1929 dp -= shadowBias; 1930 #else 1931 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1932 dp += shadowBias; 1933 #endif 1934 float texelSize = shadowRadius / shadowMapSize.x; 1935 vec3 absDir = abs( bd3D ); 1936 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1937 tangent = normalize( cross( bd3D, tangent ) ); 1938 vec3 bitangent = cross( bd3D, tangent ); 1939 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1940 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1941 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1942 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1943 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1944 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1945 shadow = ( 1946 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1947 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1948 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1949 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1950 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1951 ) * 0.2; 1952 } 1953 return mix( 1.0, shadow, shadowIntensity ); 1954 } 1955 #elif defined( SHADOWMAP_TYPE_BASIC ) 1956 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1957 float shadow = 1.0; 1958 vec3 lightToPosition = shadowCoord.xyz; 1959 vec3 absVec = abs( lightToPosition ); 1960 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1961 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1962 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1963 dp += shadowBias; 1964 vec3 bd3D = normalize( lightToPosition ); 1965 float depth = textureCube( shadowMap, bd3D ).r; 1966 #ifdef USE_REVERSED_DEPTH_BUFFER 1967 depth = 1.0 - depth; 1968 #endif 1969 shadow = step( dp, depth ); 1970 } 1971 return mix( 1.0, shadow, shadowIntensity ); 1972 } 1973 #endif 1974 #endif 1975#endif`,rp=`#if NUM_SPOT_LIGHT_COORDS > 0 1976 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1977 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1978#endif 1979#ifdef USE_SHADOWMAP 1980 #if NUM_DIR_LIGHT_SHADOWS > 0 1981 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1982 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1983 struct DirectionalLightShadow { 1984 float shadowIntensity; 1985 float shadowBias; 1986 float shadowNormalBias; 1987 float shadowRadius; 1988 vec2 shadowMapSize; 1989 }; 1990 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1991 #endif 1992 #if NUM_SPOT_LIGHT_SHADOWS > 0 1993 struct SpotLightShadow { 1994 float shadowIntensity; 1995 float shadowBias; 1996 float shadowNormalBias; 1997 float shadowRadius; 1998 vec2 shadowMapSize; 1999 }; 2000 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2001 #endif 2002 #if NUM_POINT_LIGHT_SHADOWS > 0 2003 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2004 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2005 struct PointLightShadow { 2006 float shadowIntensity; 2007 float shadowBias; 2008 float shadowNormalBias; 2009 float shadowRadius; 2010 vec2 shadowMapSize; 2011 float shadowCameraNear; 2012 float shadowCameraFar; 2013 }; 2014 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2015 #endif 2016#endif`,sp=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2017 #ifdef HAS_NORMAL 2018 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 2019 #else 2020 vec3 shadowWorldNormal = vec3( 0.0 ); 2021 #endif 2022 vec4 shadowWorldPosition; 2023#endif 2024#if defined( USE_SHADOWMAP ) 2025 #if NUM_DIR_LIGHT_SHADOWS > 0 2026 #pragma unroll_loop_start 2027 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2028 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2029 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2030 } 2031 #pragma unroll_loop_end 2032 #endif 2033 #if NUM_POINT_LIGHT_SHADOWS > 0 2034 #pragma unroll_loop_start 2035 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2036 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2037 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2038 } 2039 #pragma unroll_loop_end 2040 #endif 2041#endif
2042#if NUM_SPOT_LIGHT_COORDS > 0 2043 #pragma unroll_loop_start 2044 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2045 shadowWorldPosition = worldPosition; 2046 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2047 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2048 #endif 2049 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2050 } 2051 #pragma unroll_loop_end 2052#endif`,ap=`float getShadowMask() { 2053 float shadow = 1.0; 2054 #ifdef USE_SHADOWMAP 2055 #if NUM_DIR_LIGHT_SHADOWS > 0 2056 DirectionalLightShadow directionalLight; 2057 #pragma unroll_loop_start 2058 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2059 directionalLight = directionalLightShadows[ i ]; 2060 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2061 } 2062 #pragma unroll_loop_end 2063 #endif 2064 #if NUM_SPOT_LIGHT_SHADOWS > 0 2065 SpotLightShadow spotLight; 2066 #pragma unroll_loop_start 2067 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2068 spotLight = spotLightShadows[ i ]; 2069 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2070 } 2071 #pragma unroll_loop_end 2072 #endif 2073 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2074 PointLightShadow pointLight; 2075 #pragma unroll_loop_start 2076 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2077 pointLight = pointLightShadows[ i ]; 2078 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2079 } 2080 #pragma unroll_loop_end 2081 #endif 2082 #endif 2083 return shadow; 2084}`,op=`#ifdef USE_SKINNING 2085 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2086 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2087 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2088 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2089#endif`,lp=`#ifdef USE_SKINNING 2090 uniform mat4 bindMatrix; 2091 uniform mat4 bindMatrixInverse; 2092 uniform highp sampler2D boneTexture; 2093 mat4 getBoneMatrix( const in float i ) { 2094 int size = textureSize( boneTexture, 0 ).x; 2095 int j = int( i ) * 4; 2096 int x = j % size; 2097 int y = j / size; 2098 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2099 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2100 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2101 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2102 return mat4( v1, v2, v3, v4 ); 2103 } 2104#endif`,cp=`#ifdef USE_SKINNING 2105 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2106 vec4 skinned = vec4( 0.0 ); 2107 skinned += boneMatX * skinVertex * skinWeight.x; 2108 skinned += boneMatY * skinVertex * skinWeight.y; 2109 skinned += boneMatZ * skinVertex * skinWeight.z; 2110 skinned += boneMatW * skinVertex * skinWeight.w; 2111 transformed = ( bindMatrixInverse * skinned ).xyz; 2112#endif`,up=`#ifdef USE_SKINNING 2113 mat4 skinMatrix = mat4( 0.0 ); 2114 skinMatrix += skinWeight.x * boneMatX; 2115 skinMatrix += skinWeight.y * boneMatY; 2116 skinMatrix += skinWeight.z * boneMatZ; 2117 skinMatrix += skinWeight.w * boneMatW; 2118 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2119 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2120 #ifdef USE_TANGENT 2121 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2122 #endif 2123#endif`,hp=`float specularStrength; 2124#ifdef USE_SPECULARMAP 2125 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2126 specularStrength = texelSpecular.r; 2127#else 2128 specularStrength = 1.0; 2129#endif`,dp=`#ifdef USE_SPECULARMAP 2130 uniform sampler2D specularMap; 2131#endif`,fp=`#if defined( TONE_MAPPING ) 2132 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2133#endif`,pp=`#ifndef saturate 2134#define saturate( a ) clamp( a, 0.0, 1.0 ) 2135#endif 2136uniform float toneMappingExposure; 2137vec3 LinearToneMapping( vec3 color ) { 2138 return saturate( toneMappingExposure * color ); 2139} 2140vec3 ReinhardToneMapping( vec3 color ) { 2141 color *= toneMappingExposure; 2142 return saturate( color / ( vec3( 1.0 ) + color ) ); 2143} 2144vec3 CineonToneMapping( vec3 color ) { 2145 color *= toneMappingExposure; 2146 color = max( vec3( 0.0 ), color - 0.004 ); 2147 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2148} 2149vec3 RRTAndODTFit( vec3 v ) { 2150 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2151 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2152 return a / b; 2153} 2154vec3 ACESFilmicToneMapping( vec3 color ) { 2155 const mat3 ACESInputMat = mat3( 2156 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2157 vec3( 0.04823, 0.01566, 0.83777 ) 2158 ); 2159 const mat3 ACESOutputMat = mat3( 2160 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2161 vec3( -0.07367, -0.00605, 1.07602 ) 2162 ); 2163 color *= toneMappingExposure / 0.6; 2164 color = ACESInputMat * color; 2165 color = RRTAndODTFit( color ); 2166 color = ACESOutputMat * color; 2167 return saturate( color ); 2168} 2169const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2170 vec3( 1.6605, - 0.1246, - 0.0182 ), 2171 vec3( - 0.5876, 1.1329, - 0.1006 ), 2172 vec3( - 0.0728, - 0.0083, 1.1187 ) 2173); 2174const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2175 vec3( 0.6274, 0.0691, 0.0164 ), 2176 vec3( 0.3293, 0.9195, 0.0880 ), 2177 vec3( 0.0433, 0.0113, 0.8956 ) 2178); 2179vec3 agxDefaultContrastApprox( vec3 x ) { 2180 vec3 x2 = x * x; 2181 vec3 x4 = x2 * x2; 2182 return + 15.5 * x4 * x2 2183 - 40.14 * x4 * x 2184 + 31.96 * x4 2185 - 6.868 * x2 * x 2186 + 0.4298 * x2 2187 + 0.1191 * x 2188 - 0.00232; 2189} 2190vec3 AgXToneMapping( vec3 color ) { 2191 const mat3 AgXInsetMatrix = mat3( 2192 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2193 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2194 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2195 );
2196 const mat3 AgXOutsetMatrix = mat3( 2197 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2198 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2199 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2200 ); 2201 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2202 color *= toneMappingExposure; 2203 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2204 color = AgXInsetMatrix * color; 2205 color = max( color, 1e-10 ); color = log2( color ); 2206 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2207 color = clamp( color, 0.0, 1.0 ); 2208 color = agxDefaultContrastApprox( color ); 2209 color = AgXOutsetMatrix * color; 2210 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2211 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2212 color = clamp( color, 0.0, 1.0 ); 2213 return color; 2214} 2215vec3 NeutralToneMapping( vec3 color ) { 2216 const float StartCompression = 0.8 - 0.04; 2217 const float Desaturation = 0.15; 2218 color *= toneMappingExposure; 2219 float x = min( color.r, min( color.g, color.b ) ); 2220 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2221 color -= offset; 2222 float peak = max( color.r, max( color.g, color.b ) ); 2223 if ( peak < StartCompression ) return color; 2224 float d = 1. - StartCompression; 2225 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2226 color *= newPeak / peak; 2227 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2228 return mix( color, vec3( newPeak ), g ); 2229} 2230vec3 CustomToneMapping( vec3 color ) { return color; }`,mp=`#ifdef USE_TRANSMISSION 2231 material.transmission = transmission; 2232 material.transmissionAlpha = 1.0; 2233 material.thickness = thickness; 2234 material.attenuationDistance = attenuationDistance; 2235 material.attenuationColor = attenuationColor; 2236 #ifdef USE_TRANSMISSIONMAP 2237 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2238 #endif 2239 #ifdef USE_THICKNESSMAP 2240 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2241 #endif 2242 vec3 pos = vWorldPosition; 2243 vec3 v = normalize( cameraPosition - pos ); 2244 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2245 vec4 transmitted = getIBLVolumeRefraction( 2246 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2247 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2248 material.attenuationColor, material.attenuationDistance ); 2249 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2250 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2251#endif`,gp=`#ifdef USE_TRANSMISSION 2252 uniform float transmission; 2253 uniform float thickness; 2254 uniform float attenuationDistance; 2255 uniform vec3 attenuationColor; 2256 #ifdef USE_TRANSMISSIONMAP 2257 uniform sampler2D transmissionMap; 2258 #endif 2259 #ifdef USE_THICKNESSMAP 2260 uniform sampler2D thicknessMap; 2261 #endif 2262 uniform vec2 transmissionSamplerSize; 2263 uniform sampler2D transmissionSamplerMap; 2264 uniform mat4 modelMatrix; 2265 uniform mat4 projectionMatrix; 2266 varying vec3 vWorldPosition; 2267 float w0( float a ) { 2268 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2269 } 2270 float w1( float a ) { 2271 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2272 } 2273 float w2( float a ){ 2274 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2275 } 2276 float w3( float a ) { 2277 return ( 1.0 / 6.0 ) * ( a * a * a ); 2278 } 2279 float g0( float a ) { 2280 return w0( a ) + w1( a ); 2281 } 2282 float g1( float a ) { 2283 return w2( a ) + w3( a ); 2284 } 2285 float h0( float a ) { 2286 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2287 } 2288 float h1( float a ) { 2289 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2290 } 2291 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2292 uv = uv * texelSize.zw + 0.5; 2293 vec2 iuv = floor( uv ); 2294 vec2 fuv = fract( uv ); 2295 float g0x = g0( fuv.x ); 2296 float g1x = g1( fuv.x ); 2297 float h0x = h0( fuv.x ); 2298 float h1x = h1( fuv.x ); 2299 float h0y = h0( fuv.y ); 2300 float h1y = h1( fuv.y ); 2301 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2302 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2303 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2304 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2305 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2306 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2307 } 2308 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2309 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2310 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2311 vec2 fLodSizeInv = 1.0 / fLodSize; 2312 vec2 cLodSizeInv = 1.0 / cLodSize; 2313 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2314 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2315 return mix( fSample, cSample, fract( lod ) ); 2316 } 2317 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2318 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2319 vec3 modelScale; 2320 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2321 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2322 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2323 return normalize( refractionVector ) * thickness * modelScale; 2324 } 2325 float applyIorToRoughness( const in float roughness, const in float ior ) { 2326 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2327 } 2328 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2329 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2330 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2331 } 2332 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2333 if ( isinf( attenuationDistance ) ) { 2334 return vec3( 1.0 ); 2335 } else { 2336 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2337 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2338 } 2339 } 2340 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2341 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2342 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2343 const in vec3 attenuationColor, const in float attenuationDistance ) { 2344 vec4 transmittedLight; 2345 vec3 transmittance; 2346 #ifdef USE_DISPERSION 2347 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2348 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2349 for ( int i = 0; i < 3; i ++ ) { 2350 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2351 vec3 refractedRayExit = position + transmissionRay; 2352 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2353 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2354 refractionCoords += 1.0; 2355 refractionCoords /= 2.0; 2356 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2357 transmittedLight[ i ] = transmissionSample[ i ]; 2358 transmittedLight.a += transmissionSample.a; 2359 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2360 } 2361 transmittedLight.a /= 3.0; 2362 #else 2363 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2364 vec3 refractedRayExit = position + transmissionRay; 2365 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2366 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2367 refractionCoords += 1.0; 2368 refractionCoords /= 2.0; 2369 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2370 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2371 #endif 2372 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2373 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2374 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2375 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2376 } 2377#endif`,_p=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2378 varying vec2 vUv; 2379#endif 2380#ifdef USE_MAP 2381 varying vec2 vMapUv; 2382#endif 2383#ifdef USE_ALPHAMAP
2384 varying vec2 vAlphaMapUv; 2385#endif 2386#ifdef USE_LIGHTMAP 2387 varying vec2 vLightMapUv; 2388#endif 2389#ifdef USE_AOMAP 2390 varying vec2 vAoMapUv; 2391#endif 2392#ifdef USE_BUMPMAP 2393 varying vec2 vBumpMapUv; 2394#endif 2395#ifdef USE_NORMALMAP 2396 varying vec2 vNormalMapUv; 2397#endif 2398#ifdef USE_EMISSIVEMAP 2399 varying vec2 vEmissiveMapUv; 2400#endif 2401#ifdef USE_METALNESSMAP 2402 varying vec2 vMetalnessMapUv; 2403#endif 2404#ifdef USE_ROUGHNESSMAP 2405 varying vec2 vRoughnessMapUv; 2406#endif 2407#ifdef USE_ANISOTROPYMAP 2408 varying vec2 vAnisotropyMapUv; 2409#endif 2410#ifdef USE_CLEARCOATMAP 2411 varying vec2 vClearcoatMapUv; 2412#endif 2413#ifdef USE_CLEARCOAT_NORMALMAP 2414 varying vec2 vClearcoatNormalMapUv; 2415#endif 2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2417 varying vec2 vClearcoatRoughnessMapUv; 2418#endif 2419#ifdef USE_IRIDESCENCEMAP 2420 varying vec2 vIridescenceMapUv; 2421#endif 2422#ifdef USE_IRIDESCENCE_THICKNESSMAP 2423 varying vec2 vIridescenceThicknessMapUv; 2424#endif 2425#ifdef USE_SHEEN_COLORMAP 2426 varying vec2 vSheenColorMapUv; 2427#endif 2428#ifdef USE_SHEEN_ROUGHNESSMAP 2429 varying vec2 vSheenRoughnessMapUv; 2430#endif 2431#ifdef USE_SPECULARMAP 2432 varying vec2 vSpecularMapUv; 2433#endif 2434#ifdef USE_SPECULAR_COLORMAP 2435 varying vec2 vSpecularColorMapUv; 2436#endif 2437#ifdef USE_SPECULAR_INTENSITYMAP 2438 varying vec2 vSpecularIntensityMapUv; 2439#endif 2440#ifdef USE_TRANSMISSIONMAP 2441 uniform mat3 transmissionMapTransform; 2442 varying vec2 vTransmissionMapUv; 2443#endif 2444#ifdef USE_THICKNESSMAP 2445 uniform mat3 thicknessMapTransform; 2446 varying vec2 vThicknessMapUv; 2447#endif`,vp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2448 varying vec2 vUv; 2449#endif 2450#ifdef USE_MAP 2451 uniform mat3 mapTransform; 2452 varying vec2 vMapUv; 2453#endif 2454#ifdef USE_ALPHAMAP 2455 uniform mat3 alphaMapTransform; 2456 varying vec2 vAlphaMapUv; 2457#endif 2458#ifdef USE_LIGHTMAP 2459 uniform mat3 lightMapTransform; 2460 varying vec2 vLightMapUv; 2461#endif 2462#ifdef USE_AOMAP 2463 uniform mat3 aoMapTransform; 2464 varying vec2 vAoMapUv; 2465#endif 2466#ifdef USE_BUMPMAP 2467 uniform mat3 bumpMapTransform; 2468 varying vec2 vBumpMapUv; 2469#endif 2470#ifdef USE_NORMALMAP 2471 uniform mat3 normalMapTransform; 2472 varying vec2 vNormalMapUv; 2473#endif 2474#ifdef USE_DISPLACEMENTMAP 2475 uniform mat3 displacementMapTransform; 2476 varying vec2 vDisplacementMapUv; 2477#endif 2478#ifdef USE_EMISSIVEMAP 2479 uniform mat3 emissiveMapTransform; 2480 varying vec2 vEmissiveMapUv; 2481#endif 2482#ifdef USE_METALNESSMAP 2483 uniform mat3 metalnessMapTransform; 2484 varying vec2 vMetalnessMapUv; 2485#endif 2486#ifdef USE_ROUGHNESSMAP 2487 uniform mat3 roughnessMapTransform; 2488 varying vec2 vRoughnessMapUv; 2489#endif 2490#ifdef USE_ANISOTROPYMAP 2491 uniform mat3 anisotropyMapTransform; 2492 varying vec2 vAnisotropyMapUv; 2493#endif 2494#ifdef USE_CLEARCOATMAP 2495 uniform mat3 clearcoatMapTransform; 2496 varying vec2 vClearcoatMapUv; 2497#endif 2498#ifdef USE_CLEARCOAT_NORMALMAP 2499 uniform mat3 clearcoatNormalMapTransform; 2500 varying vec2 vClearcoatNormalMapUv; 2501#endif 2502#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2503 uniform mat3 clearcoatRoughnessMapTransform; 2504 varying vec2 vClearcoatRoughnessMapUv; 2505#endif 2506#ifdef USE_SHEEN_COLORMAP 2507 uniform mat3 sheenColorMapTransform; 2508 varying vec2 vSheenColorMapUv; 2509#endif 2510#ifdef USE_SHEEN_ROUGHNESSMAP 2511 uniform mat3 sheenRoughnessMapTransform; 2512 varying vec2 vSheenRoughnessMapUv; 2513#endif 2514#ifdef USE_IRIDESCENCEMAP 2515 uniform mat3 iridescenceMapTransform; 2516 varying vec2 vIridescenceMapUv; 2517#endif 2518#ifdef USE_IRIDESCENCE_THICKNESSMAP 2519 uniform mat3 iridescenceThicknessMapTransform; 2520 varying vec2 vIridescenceThicknessMapUv; 2521#endif 2522#ifdef USE_SPECULARMAP 2523 uniform mat3 specularMapTransform; 2524 varying vec2 vSpecularMapUv; 2525#endif 2526#ifdef USE_SPECULAR_COLORMAP 2527 uniform mat3 specularColorMapTransform; 2528 varying vec2 vSpecularColorMapUv; 2529#endif 2530#ifdef USE_SPECULAR_INTENSITYMAP 2531 uniform mat3 specularIntensityMapTransform; 2532 varying vec2 vSpecularIntensityMapUv; 2533#endif 2534#ifdef USE_TRANSMISSIONMAP 2535 uniform mat3 transmissionMapTransform; 2536 varying vec2 vTransmissionMapUv; 2537#endif 2538#ifdef USE_THICKNESSMAP 2539 uniform mat3 thicknessMapTransform; 2540 varying vec2 vThicknessMapUv; 2541#endif`,xp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2542 vUv = vec3( uv, 1 ).xy; 2543#endif 2544#ifdef USE_MAP 2545 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2546#endif 2547#ifdef USE_ALPHAMAP 2548 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2549#endif 2550#ifdef USE_LIGHTMAP 2551 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2552#endif 2553#ifdef USE_AOMAP 2554 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2555#endif 2556#ifdef USE_BUMPMAP 2557 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2558#endif 2559#ifdef USE_NORMALMAP 2560 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2561#endif 2562#ifdef USE_DISPLACEMENTMAP 2563 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2564#endif 2565#ifdef USE_EMISSIVEMAP 2566 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2567#endif 2568#ifdef USE_METALNESSMAP 2569 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2570#endif 2571#ifdef USE_ROUGHNESSMAP 2572 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2573#endif 2574#ifdef USE_ANISOTROPYMAP 2575 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2576#endif 2577#ifdef USE_CLEARCOATMAP 2578 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2579#endif 2580#ifdef USE_CLEARCOAT_NORMALMAP 2581 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2582#endif 2583#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2584 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2585#endif
2586#ifdef USE_IRIDESCENCEMAP 2587 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2588#endif 2589#ifdef USE_IRIDESCENCE_THICKNESSMAP 2590 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2591#endif 2592#ifdef USE_SHEEN_COLORMAP 2593 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2594#endif 2595#ifdef USE_SHEEN_ROUGHNESSMAP 2596 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2597#endif 2598#ifdef USE_SPECULARMAP 2599 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2600#endif 2601#ifdef USE_SPECULAR_COLORMAP 2602 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2603#endif 2604#ifdef USE_SPECULAR_INTENSITYMAP 2605 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2606#endif 2607#ifdef USE_TRANSMISSIONMAP 2608 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2609#endif 2610#ifdef USE_THICKNESSMAP 2611 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2612#endif`,Mp=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2613 vec4 worldPosition = vec4( transformed, 1.0 ); 2614 #ifdef USE_BATCHING 2615 worldPosition = batchingMatrix * worldPosition; 2616 #endif 2617 #ifdef USE_INSTANCING 2618 worldPosition = instanceMatrix * worldPosition; 2619 #endif 2620 worldPosition = modelMatrix * worldPosition; 2621#endif`;const Sp=`varying vec2 vUv; 2622uniform mat3 uvTransform; 2623void main() { 2624 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2625 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2626}`,yp=`uniform sampler2D t2D; 2627uniform float backgroundIntensity; 2628varying vec2 vUv; 2629void main() { 2630 vec4 texColor = texture2D( t2D, vUv ); 2631 #ifdef DECODE_VIDEO_TEXTURE 2632 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 ); 2633 #endif 2634 texColor.rgb *= backgroundIntensity; 2635 gl_FragColor = texColor; 2636 #include <tonemapping_fragment> 2637 #include <colorspace_fragment> 2638}`,Ep=`varying vec3 vWorldDirection; 2639#include <common> 2640void main() { 2641 vWorldDirection = transformDirection( position, modelMatrix ); 2642 #include <begin_vertex> 2643 #include <project_vertex> 2644 gl_Position.z = gl_Position.w; 2645}`,bp=`#ifdef ENVMAP_TYPE_CUBE 2646 uniform samplerCube envMap; 2647#elif defined( ENVMAP_TYPE_CUBE_UV ) 2648 uniform sampler2D envMap; 2649#endif 2650uniform float backgroundBlurriness; 2651uniform float backgroundIntensity; 2652uniform mat3 backgroundRotation; 2653varying vec3 vWorldDirection; 2654#include <cube_uv_reflection_fragment> 2655void main() { 2656 #ifdef ENVMAP_TYPE_CUBE 2657 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 2658 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2659 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2660 #else 2661 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2662 #endif 2663 texColor.rgb *= backgroundIntensity; 2664 gl_FragColor = texColor; 2665 #include <tonemapping_fragment> 2666 #include <colorspace_fragment> 2667}`,Tp=`varying vec3 vWorldDirection; 2668#include <common> 2669void main() { 2670 vWorldDirection = transformDirection( position, modelMatrix ); 2671 #include <begin_vertex> 2672 #include <project_vertex> 2673 gl_Position.z = gl_Position.w; 2674}`,Ap=`uniform samplerCube tCube; 2675uniform float tFlip; 2676uniform float opacity; 2677varying vec3 vWorldDirection; 2678void main() { 2679 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2680 gl_FragColor = texColor; 2681 gl_FragColor.a *= opacity; 2682 #include <tonemapping_fragment> 2683 #include <colorspace_fragment> 2684}`,wp=`#include <common> 2685#include <batching_pars_vertex> 2686#include <uv_pars_vertex> 2687#include <displacementmap_pars_vertex> 2688#include <morphtarget_pars_vertex> 2689#include <skinning_pars_vertex> 2690#include <logdepthbuf_pars_vertex> 2691#include <clipping_planes_pars_vertex> 2692varying vec2 vHighPrecisionZW; 2693void main() { 2694 #include <uv_vertex> 2695 #include <batching_vertex> 2696 #include <skinbase_vertex> 2697 #include <morphinstance_vertex> 2698 #ifdef USE_DISPLACEMENTMAP 2699 #include <beginnormal_vertex> 2700 #include <morphnormal_vertex> 2701 #include <skinnormal_vertex> 2702 #endif 2703 #include <begin_vertex> 2704 #include <morphtarget_vertex> 2705 #include <skinning_vertex> 2706 #include <displacementmap_vertex> 2707 #include <project_vertex> 2708 #include <logdepthbuf_vertex> 2709 #include <clipping_planes_vertex> 2710 vHighPrecisionZW = gl_Position.zw; 2711}`,Rp=`#if DEPTH_PACKING == 3200 2712 uniform float opacity; 2713#endif 2714#include <common> 2715#include <packing> 2716#include <uv_pars_fragment> 2717#include <map_pars_fragment> 2718#include <alphamap_pars_fragment> 2719#include <alphatest_pars_fragment> 2720#include <alphahash_pars_fragment> 2721#include <logdepthbuf_pars_fragment> 2722#include <clipping_planes_pars_fragment> 2723varying vec2 vHighPrecisionZW; 2724void main() { 2725 vec4 diffuseColor = vec4( 1.0 ); 2726 #include <clipping_planes_fragment> 2727 #if DEPTH_PACKING == 3200 2728 diffuseColor.a = opacity; 2729 #endif 2730 #include <map_fragment> 2731 #include <alphamap_fragment> 2732 #include <alphatest_fragment> 2733 #include <alphahash_fragment> 2734 #include <logdepthbuf_fragment> 2735 #ifdef USE_REVERSED_DEPTH_BUFFER 2736 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2737 #else 2738 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2739 #endif 2740 #if DEPTH_PACKING == 3200 2741 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2742 #elif DEPTH_PACKING == 3201 2743 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2744 #elif DEPTH_PACKING == 3202 2745 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2746 #elif DEPTH_PACKING == 3203 2747 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2748 #endif 2749}`,Cp=`#define DISTANCE 2750varying vec3 vWorldPosition; 2751#include <common> 2752#include <batching_pars_vertex> 2753#include <uv_pars_vertex> 2754#include <displacementmap_pars_vertex> 2755#include <morphtarget_pars_vertex> 2756#include <skinning_pars_vertex> 2757#include <clipping_planes_pars_vertex> 2758void main() { 2759 #include <uv_vertex> 2760 #include <batching_vertex> 2761 #include <skinbase_vertex> 2762 #include <morphinstance_vertex> 2763 #ifdef USE_DISPLACEMENTMAP 2764 #include <beginnormal_vertex> 2765 #include <morphnormal_vertex> 2766 #include <skinnormal_vertex> 2767 #endif 2768 #include <begin_vertex> 2769 #include <morphtarget_vertex> 2770 #include <skinning_vertex> 2771 #include <displacementmap_vertex> 2772 #include <project_vertex> 2773 #include <worldpos_vertex> 2774 #include <clipping_planes_vertex> 2775 vWorldPosition = worldPosition.xyz; 2776}`,Pp=`#define DISTANCE 2777uniform vec3 referencePosition; 2778uniform float nearDistance; 2779uniform float farDistance; 2780varying vec3 vWorldPosition; 2781#include <common> 2782#include <uv_pars_fragment> 2783#include <map_pars_fragment> 2784#include <alphamap_pars_fragment> 2785#include <alphatest_pars_fragment> 2786#include <alphahash_pars_fragment> 2787#include <clipping_planes_pars_fragment> 2788void main () { 2789 vec4 diffuseColor = vec4( 1.0 ); 2790 #include <clipping_planes_fragment> 2791 #include <map_fragment> 2792 #include <alphamap_fragment> 2793 #include <alphatest_fragment> 2794 #include <alphahash_fragment> 2795 float dist = length( vWorldPosition - referencePosition ); 2796 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2797 dist = saturate( dist ); 2798 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2799}`,Lp=`varying vec3 vWorldDirection; 2800#include <common> 2801void main() { 2802 vWorldDirection = transformDirection( position, modelMatrix ); 2803 #include <begin_vertex> 2804 #include <project_vertex> 2805}`,Dp=`uniform sampler2D tEquirect; 2806varying vec3 vWorldDirection; 2807#include <common> 2808void main() { 2809 vec3 direction = normalize( vWorldDirection ); 2810 vec2 sampleUV = equirectUv( direction ); 2811 gl_FragColor = texture2D( tEquirect, sampleUV ); 2812 #include <tonemapping_fragment> 2813 #include <colorspace_fragment> 2814}`,Ip=`uniform float scale; 2815attribute float lineDistance; 2816varying float vLineDistance; 2817#include <common> 2818#include <uv_pars_vertex> 2819#include <color_pars_vertex> 2820#include <fog_pars_vertex> 2821#include <morphtarget_pars_vertex> 2822#include <logdepthbuf_pars_vertex> 2823#include <clipping_planes_pars_vertex> 2824void main() { 2825 vLineDistance = scale * lineDistance; 2826 #include <uv_vertex> 2827 #include <color_vertex> 2828 #include <morphinstance_vertex> 2829 #include <morphcolor_vertex> 2830 #include <begin_vertex> 2831 #include <morphtarget_vertex> 2832 #include <project_vertex> 2833 #include <logdepthbuf_vertex> 2834 #include <clipping_planes_vertex> 2835 #include <fog_vertex> 2836}`,Up=`uniform vec3 diffuse; 2837uniform float opacity; 2838uniform float dashSize; 2839uniform float totalSize; 2840varying float vLineDistance; 2841#include <common> 2842#include <color_pars_fragment> 2843#include <uv_pars_fragment> 2844#include <map_pars_fragment> 2845#include <fog_pars_fragment> 2846#include <logdepthbuf_pars_fragment> 2847#include <clipping_planes_pars_fragment> 2848void main() { 2849 vec4 diffuseColor = vec4( diffuse, opacity ); 2850 #include <clipping_planes_fragment> 2851 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2852 discard; 2853 } 2854 vec3 outgoingLight = vec3( 0.0 ); 2855 #include <logdepthbuf_fragment> 2856 #include <map_fragment> 2857 #include <color_fragment> 2858 outgoingLight = diffuseColor.rgb; 2859 #include <opaque_fragment> 2860 #include <tonemapping_fragment> 2861 #include <colorspace_fragment> 2862 #include <fog_fragment> 2863 #include <premultiplied_alpha_fragment> 2864}`,Np=`#include <common> 2865#include <batching_pars_vertex> 2866#include <uv_pars_vertex> 2867#include <envmap_pars_vertex> 2868#include <color_pars_vertex> 2869#include <fog_pars_vertex> 2870#include <morphtarget_pars_vertex> 2871#include <skinning_pars_vertex> 2872#include <logdepthbuf_pars_vertex> 2873#include <clipping_planes_pars_vertex> 2874void main() { 2875 #include <uv_vertex> 2876 #include <color_vertex> 2877 #include <morphinstance_vertex> 2878 #include <morphcolor_vertex> 2879 #include <batching_vertex> 2880 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2881 #include <beginnormal_vertex> 2882 #include <morphnormal_vertex> 2883 #include <skinbase_vertex> 2884 #include <skinnormal_vertex> 2885 #include <defaultnormal_vertex> 2886 #endif 2887 #include <begin_vertex> 2888 #include <morphtarget_vertex> 2889 #include <skinning_vertex> 2890 #include <project_vertex> 2891 #include <logdepthbuf_vertex> 2892 #include <clipping_planes_vertex> 2893 #include <worldpos_vertex> 2894 #include <envmap_vertex> 2895 #include <fog_vertex> 2896}`,Fp=`uniform vec3 diffuse; 2897uniform float opacity; 2898#ifndef FLAT_SHADED 2899 varying vec3 vNormal; 2900#endif 2901#include <common> 2902#include <dithering_pars_fragment> 2903#include <color_pars_fragment> 2904#include <uv_pars_fragment> 2905#include <map_pars_fragment> 2906#include <alphamap_pars_fragment> 2907#include <alphatest_pars_fragment> 2908#include <alphahash_pars_fragment> 2909#include <aomap_pars_fragment> 2910#include <lightmap_pars_fragment> 2911#include <envmap_common_pars_fragment> 2912#include <envmap_pars_fragment> 2913#include <fog_pars_fragment> 2914#include <specularmap_pars_fragment> 2915#include <logdepthbuf_pars_fragment> 2916#include <clipping_planes_pars_fragment> 2917void main() { 2918 vec4 diffuseColor = vec4( diffuse, opacity ); 2919 #include <clipping_planes_fragment> 2920 #include <logdepthbuf_fragment> 2921 #include <map_fragment> 2922 #include <color_fragment> 2923 #include <alphamap_fragment> 2924 #include <alphatest_fragment> 2925 #include <alphahash_fragment> 2926 #include <specularmap_fragment> 2927 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2928 #ifdef USE_LIGHTMAP 2929 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2930 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2931 #else 2932 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2933 #endif 2934 #include <aomap_fragment> 2935 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2936 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2937 #include <envmap_fragment> 2938 #include <opaque_fragment> 2939 #include <tonemapping_fragment> 2940 #include <colorspace_fragment> 2941 #include <fog_fragment> 2942 #include <premultiplied_alpha_fragment> 2943 #include <dithering_fragment> 2944}`,Op=`#define LAMBERT 2945varying vec3 vViewPosition; 2946#include <common> 2947#include <batching_pars_vertex> 2948#include <uv_pars_vertex> 2949#include <displacementmap_pars_vertex> 2950#include <envmap_pars_vertex> 2951#include <color_pars_vertex> 2952#include <fog_pars_vertex> 2953#include <normal_pars_vertex> 2954#include <morphtarget_pars_vertex> 2955#include <skinning_pars_vertex> 2956#include <shadowmap_pars_vertex> 2957#include <logdepthbuf_pars_vertex> 2958#include <clipping_planes_pars_vertex> 2959void main() { 2960 #include <uv_vertex> 2961 #include <color_vertex> 2962 #include <morphinstance_vertex> 2963 #include <morphcolor_vertex> 2964 #include <batching_vertex> 2965 #include <beginnormal_vertex> 2966 #include <morphnormal_vertex> 2967 #include <skinbase_vertex> 2968 #include <skinnormal_vertex> 2969 #include <defaultnormal_vertex> 2970 #include <normal_vertex> 2971 #include <begin_vertex> 2972 #include <morphtarget_vertex> 2973 #include <skinning_vertex> 2974 #include <displacementmap_vertex> 2975 #include <project_vertex> 2976 #include <logdepthbuf_vertex> 2977 #include <clipping_planes_vertex> 2978 vViewPosition = - mvPosition.xyz; 2979 #include <worldpos_vertex> 2980 #include <envmap_vertex> 2981 #include <shadowmap_vertex> 2982 #include <fog_vertex> 2983}`,Bp=`#define LAMBERT 2984uniform vec3 diffuse; 2985uniform vec3 emissive; 2986uniform float opacity; 2987#include <common> 2988#include <dithering_pars_fragment> 2989#include <color_pars_fragment> 2990#include <uv_pars_fragment> 2991#include <map_pars_fragment> 2992#include <alphamap_pars_fragment> 2993#include <alphatest_pars_fragment> 2994#include <alphahash_pars_fragment> 2995#include <aomap_pars_fragment> 2996#include <lightmap_pars_fragment> 2997#include <emissivemap_pars_fragment> 2998#include <cube_uv_reflection_fragment> 2999#include <envmap_common_pars_fragment> 3000#include <envmap_pars_fragment> 3001#include <envmap_physical_pars_fragment> 3002#include <fog_pars_fragment> 3003#include <bsdfs> 3004#include <lights_pars_begin> 3005#include <normal_pars_fragment> 3006#include <lights_lambert_pars_fragment> 3007#include <shadowmap_pars_fragment> 3008#include <bumpmap_pars_fragment> 3009#include <normalmap_pars_fragment> 3010#include <specularmap_pars_fragment> 3011#include <logdepthbuf_pars_fragment> 3012#include <clipping_planes_pars_fragment> 3013void main() { 3014 vec4 diffuseColor = vec4( diffuse, opacity ); 3015 #include <clipping_planes_fragment> 3016 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3017 vec3 totalEmissiveRadiance = emissive; 3018 #include <logdepthbuf_fragment> 3019 #include <map_fragment> 3020 #include <color_fragment> 3021 #include <alphamap_fragment> 3022 #include <alphatest_fragment> 3023 #include <alphahash_fragment> 3024 #include <specularmap_fragment> 3025 #include <normal_fragment_begin> 3026 #include <normal_fragment_maps> 3027 #include <emissivemap_fragment> 3028 #include <lights_lambert_fragment> 3029 #include <lights_fragment_begin> 3030 #include <lights_fragment_maps> 3031 #include <lights_fragment_end> 3032 #include <aomap_fragment> 3033 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3034 #include <envmap_fragment> 3035 #include <opaque_fragment> 3036 #include <tonemapping_fragment> 3037 #include <colorspace_fragment> 3038 #include <fog_fragment> 3039 #include <premultiplied_alpha_fragment> 3040 #include <dithering_fragment> 3041}`,zp=`#define MATCAP 3042varying vec3 vViewPosition; 3043#include <common> 3044#include <batching_pars_vertex> 3045#include <uv_pars_vertex> 3046#include <color_pars_vertex> 3047#include <displacementmap_pars_vertex> 3048#include <fog_pars_vertex> 3049#include <normal_pars_vertex> 3050#include <morphtarget_pars_vertex> 3051#include <skinning_pars_vertex> 3052#include <logdepthbuf_pars_vertex> 3053#include <clipping_planes_pars_vertex> 3054void main() { 3055 #include <uv_vertex> 3056 #include <color_vertex> 3057 #include <morphinstance_vertex> 3058 #include <morphcolor_vertex> 3059 #include <batching_vertex> 3060 #include <beginnormal_vertex> 3061 #include <morphnormal_vertex> 3062 #include <skinbase_vertex> 3063 #include <skinnormal_vertex> 3064 #include <defaultnormal_vertex> 3065 #include <normal_vertex> 3066 #include <begin_vertex> 3067 #include <morphtarget_vertex> 3068 #include <skinning_vertex> 3069 #include <displacementmap_vertex> 3070 #include <project_vertex> 3071 #include <logdepthbuf_vertex> 3072 #include <clipping_planes_vertex> 3073 #include <fog_vertex> 3074 vViewPosition = - mvPosition.xyz; 3075}`,Gp=`#define MATCAP 3076uniform vec3 diffuse; 3077uniform float opacity; 3078uniform sampler2D matcap; 3079varying vec3 vViewPosition; 3080#include <common> 3081#include <dithering_pars_fragment> 3082#include <color_pars_fragment> 3083#include <uv_pars_fragment> 3084#include <map_pars_fragment> 3085#include <alphamap_pars_fragment> 3086#include <alphatest_pars_fragment> 3087#include <alphahash_pars_fragment> 3088#include <fog_pars_fragment> 3089#include <normal_pars_fragment> 3090#include <bumpmap_pars_fragment> 3091#include <normalmap_pars_fragme
3091nt> 3092#include <logdepthbuf_pars_fragment> 3093#include <clipping_planes_pars_fragment> 3094void main() { 3095 vec4 diffuseColor = vec4( diffuse, opacity ); 3096 #include <clipping_planes_fragment> 3097 #include <logdepthbuf_fragment> 3098 #include <map_fragment> 3099 #include <color_fragment> 3100 #include <alphamap_fragment> 3101 #include <alphatest_fragment> 3102 #include <alphahash_fragment> 3103 #include <normal_fragment_begin> 3104 #include <normal_fragment_maps> 3105 vec3 viewDir = normalize( vViewPosition ); 3106 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3107 vec3 y = cross( viewDir, x ); 3108 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3109 #ifdef USE_MATCAP 3110 vec4 matcapColor = texture2D( matcap, uv ); 3111 #else 3112 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3113 #endif 3114 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3115 #include <opaque_fragment> 3116 #include <tonemapping_fragment> 3117 #include <colorspace_fragment> 3118 #include <fog_fragment> 3119 #include <premultiplied_alpha_fragment> 3120 #include <dithering_fragment> 3121}`,Vp=`#define NORMAL 3122#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3123 varying vec3 vViewPosition; 3124#endif 3125#include <common> 3126#include <batching_pars_vertex> 3127#include <uv_pars_vertex> 3128#include <displacementmap_pars_vertex> 3129#include <normal_pars_vertex> 3130#include <morphtarget_pars_vertex> 3131#include <skinning_pars_vertex> 3132#include <logdepthbuf_pars_vertex> 3133#include <clipping_planes_pars_vertex> 3134void main() { 3135 #include <uv_vertex> 3136 #include <batching_vertex> 3137 #include <beginnormal_vertex> 3138 #include <morphinstance_vertex> 3139 #include <morphnormal_vertex> 3140 #include <skinbase_vertex> 3141 #include <skinnormal_vertex> 3142 #include <defaultnormal_vertex> 3143 #include <normal_vertex> 3144 #include <begin_vertex> 3145 #include <morphtarget_vertex> 3146 #include <skinning_vertex> 3147 #include <displacementmap_vertex> 3148 #include <project_vertex> 3149 #include <logdepthbuf_vertex> 3150 #include <clipping_planes_vertex> 3151#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3152 vViewPosition = - mvPosition.xyz; 3153#endif 3154}`,kp=`#define NORMAL 3155uniform float opacity; 3156#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3157 varying vec3 vViewPosition; 3158#endif 3159#include <uv_pars_fragment> 3160#include <normal_pars_fragment> 3161#include <bumpmap_pars_fragment> 3162#include <normalmap_pars_fragment> 3163#include <logdepthbuf_pars_fragment> 3164#include <clipping_planes_pars_fragment> 3165void main() { 3166 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3167 #include <clipping_planes_fragment> 3168 #include <logdepthbuf_fragment> 3169 #include <normal_fragment_begin> 3170 #include <normal_fragment_maps> 3171 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3172 #ifdef OPAQUE 3173 gl_FragColor.a = 1.0; 3174 #endif 3175}`,Hp=`#define PHONG 3176varying vec3 vViewPosition; 3177#include <common> 3178#include <batching_pars_vertex> 3179#include <uv_pars_vertex> 3180#include <displacementmap_pars_vertex> 3181#include <envmap_pars_vertex> 3182#include <color_pars_vertex> 3183#include <fog_pars_vertex> 3184#include <normal_pars_vertex> 3185#include <morphtarget_pars_vertex> 3186#include <skinning_pars_vertex> 3187#include <shadowmap_pars_vertex> 3188#include <logdepthbuf_pars_vertex> 3189#include <clipping_planes_pars_vertex> 3190void main() { 3191 #include <uv_vertex> 3192 #include <color_vertex> 3193 #include <morphcolor_vertex> 3194 #include <batching_vertex> 3195 #include <beginnormal_vertex> 3196 #include <morphinstance_vertex> 3197 #include <morphnormal_vertex> 3198 #include <skinbase_vertex> 3199 #include <skinnormal_vertex> 3200 #include <defaultnormal_vertex> 3201 #include <normal_vertex> 3202 #include <begin_vertex> 3203 #include <morphtarget_vertex> 3204 #include <skinning_vertex> 3205 #include <displacementmap_vertex> 3206 #include <project_vertex> 3207 #include <logdepthbuf_vertex> 3208 #include <clipping_planes_vertex> 3209 vViewPosition = - mvPosition.xyz; 3210 #include <worldpos_vertex> 3211 #include <envmap_vertex> 3212 #include <shadowmap_vertex> 3213 #include <fog_vertex> 3214}`,Wp=`#define PHONG 3215uniform vec3 diffuse; 3216uniform vec3 emissive; 3217uniform vec3 specular; 3218uniform float shininess; 3219uniform float opacity; 3220#include <common> 3221#include <dithering_pars_fragment> 3222#include <color_pars_fragment> 3223#include <uv_pars_fragment> 3224#include <map_pars_fragment> 3225#include <alphamap_pars_fragment> 3226#include <alphatest_pars_fragment> 3227#include <alphahash_pars_fragment> 3228#include <aomap_pars_fragment> 3229#include <lightmap_pars_fragment> 3230#include <emissivemap_pars_fragment> 3231#include <cube_uv_reflection_fragment> 3232#include <envmap_common_pars_fragment> 3233#include <envmap_pars_fragment> 3234#include <envmap_physical_pars_fragment> 3235#include <fog_pars_fragment> 3236#include <bsdfs> 3237#include <lights_pars_begin> 3238#include <normal_pars_fragment> 3239#include <lights_phong_pars_fragment> 3240#include <shadowmap_pars_fragment> 3241#include <bumpmap_pars_fragment> 3242#include <normalmap_pars_fragment> 3243#include <specularmap_pars_fragment> 3244#include <logdepthbuf_pars_fragment> 3245#include <clipping_planes_pars_fragment> 3246void main() { 3247 vec4 diffuseColor = vec4( diffuse, opacity ); 3248 #include <clipping_planes_fragment> 3249 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3250 vec3 totalEmissiveRadiance = emissive; 3251 #include <logdepthbuf_fragment> 3252 #include <map_fragment> 3253 #include <color_fragment> 3254 #include <alphamap_fragment> 3255 #include <alphatest_fragment> 3256 #include <alphahash_fragment> 3257 #include <specularmap_fragment> 3258 #include <normal_fragment_begin> 3259 #include <normal_fragment_maps> 3260 #include <emissivemap_fragment> 3261 #include <lights_phong_fragment> 3262 #include <lights_fragment_begin> 3263 #include <lights_fragment_maps> 3264 #include <lights_fragment_end> 3265 #include <aomap_fragment> 3266 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3267 #include <envmap_fragment> 3268 #include <opaque_fragment> 3269 #include <tonemapping_fragment> 3270 #include <colorspace_fragment> 3271 #include <fog_fragment> 3272 #include <premultiplied_alpha_fragment> 3273 #include <dithering_fragment> 3274}`,Xp=`#define STANDARD 3275varying vec3 vViewPosition; 3276#ifdef USE_TRANSMISSION 3277 varying vec3 vWorldPosition; 3278#endif 3279#include <common> 3280#include <batching_pars_vertex> 3281#include <uv_pars_vertex> 3282#include <displacementmap_pars_vertex> 3283#include <color_pars_vertex> 3284#include <fog_pars_vertex> 3285#include <normal_pars_vertex> 3286#include <morphtarget_pars_vertex> 3287#include <skinning_pars_vertex> 3288#include <shadowmap_pars_vertex> 3289#include <logdepthbuf_pars_vertex> 3290#include <clipping_planes_pars_vertex> 3291void main() { 3292 #include <uv_vertex> 3293 #include <color_vertex> 3294 #include <morphinstance_vertex> 3295 #include <morphcolor_vertex> 3296 #include <batching_vertex> 3297 #include <beginnormal_vertex> 3298 #include <morphnormal_vertex> 3299 #include <skinbase_vertex> 3300 #include <skinnormal_vertex> 3301 #include <defaultnormal_vertex> 3302 #include <normal_vertex> 3303 #include <begin_vertex> 3304 #include <morphtarget_vertex> 3305 #include <skinning_vertex> 3306 #include <displacementmap_vertex> 3307 #include <project_vertex> 3308 #include <logdepthbuf_vertex> 3309 #include <clipping_planes_vertex> 3310 vViewPosition = - mvPosition.xyz; 3311 #include <worldpos_vertex> 3312 #include <shadowmap_vertex> 3313 #include <fog_vertex> 3314#ifdef USE_TRANSMISSION 3315 vWorldPosition = worldPosition.xyz; 3316#endif 3317}`,qp=`#define STANDARD 3318#ifdef PHYSICAL 3319 #define IOR 3320 #define USE_SPECULAR 3321#endif 3322uniform vec3 diffuse; 3323uniform vec3 emissive; 3324uniform float roughness; 3325uniform float metalness; 3326uniform float opacity; 3327#ifdef IOR 3328 uniform float ior; 3329#endif 3330#ifdef USE_SPECULAR 3331 uniform float specularIntensity; 3332 uniform vec3 specularColor; 3333 #ifdef USE_SPECULAR_COLORMAP 3334 uniform sampler2D specularColorMap; 3335 #endif 3336 #ifdef USE_SPECULAR_INTENSITYMAP 3337 uniform sampler2D specularIntensityMap; 3338 #endif 3339#endif 3340#ifdef USE_CLEARCOAT 3341 uniform float clearcoat; 3342 uniform float clearcoatRoughness; 3343#endif 3344#ifdef USE_DISPERSION 3345 uniform float dispersion; 3346#endif
3347#ifdef USE_IRIDESCENCE 3348 uniform float iridescence; 3349 uniform float iridescenceIOR; 3350 uniform float iridescenceThicknessMinimum; 3351 uniform float iridescenceThicknessMaximum; 3352#endif 3353#ifdef USE_SHEEN 3354 uniform vec3 sheenColor; 3355 uniform float sheenRoughness; 3356 #ifdef USE_SHEEN_COLORMAP 3357 uniform sampler2D sheenColorMap; 3358 #endif 3359 #ifdef USE_SHEEN_ROUGHNESSMAP 3360 uniform sampler2D sheenRoughnessMap; 3361 #endif 3362#endif 3363#ifdef USE_ANISOTROPY 3364 uniform vec2 anisotropyVector; 3365 #ifdef USE_ANISOTROPYMAP 3366 uniform sampler2D anisotropyMap; 3367 #endif 3368#endif 3369varying vec3 vViewPosition; 3370#include <common> 3371#include <dithering_pars_fragment> 3372#include <color_pars_fragment> 3373#include <uv_pars_fragment> 3374#include <map_pars_fragment> 3375#include <alphamap_pars_fragment> 3376#include <alphatest_pars_fragment> 3377#include <alphahash_pars_fragment> 3378#include <aomap_pars_fragment> 3379#include <lightmap_pars_fragment> 3380#include <emissivemap_pars_fragment> 3381#include <iridescence_fragment> 3382#include <cube_uv_reflection_fragment> 3383#include <envmap_common_pars_fragment> 3384#include <envmap_physical_pars_fragment> 3385#include <fog_pars_fragment> 3386#include <lights_pars_begin> 3387#include <normal_pars_fragment> 3388#include <lights_physical_pars_fragment> 3389#include <transmission_pars_fragment> 3390#include <shadowmap_pars_fragment> 3391#include <bumpmap_pars_fragment> 3392#include <normalmap_pars_fragment> 3393#include <clearcoat_pars_fragment> 3394#include <iridescence_pars_fragment> 3395#include <roughnessmap_pars_fragment> 3396#include <metalnessmap_pars_fragment> 3397#include <logdepthbuf_pars_fragment> 3398#include <clipping_planes_pars_fragment> 3399void main() { 3400 vec4 diffuseColor = vec4( diffuse, opacity ); 3401 #include <clipping_planes_fragment> 3402 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3403 vec3 totalEmissiveRadiance = emissive; 3404 #include <logdepthbuf_fragment> 3405 #include <map_fragment> 3406 #include <color_fragment> 3407 #include <alphamap_fragment> 3408 #include <alphatest_fragment> 3409 #include <alphahash_fragment> 3410 #include <roughnessmap_fragment> 3411 #include <metalnessmap_fragment> 3412 #include <normal_fragment_begin> 3413 #include <normal_fragment_maps> 3414 #include <clearcoat_normal_fragment_begin> 3415 #include <clearcoat_normal_fragment_maps> 3416 #include <emissivemap_fragment> 3417 #include <lights_physical_fragment> 3418 #include <lights_fragment_begin> 3419 #include <lights_fragment_maps> 3420 #include <lights_fragment_end> 3421 #include <aomap_fragment> 3422 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3423 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3424 #include <transmission_fragment> 3425 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3426 #ifdef USE_SHEEN 3427 3428 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3429 3430 #endif 3431 #ifdef USE_CLEARCOAT 3432 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3433 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3434 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3435 #endif 3436 #include <opaque_fragment> 3437 #include <tonemapping_fragment> 3438 #include <colorspace_fragment> 3439 #include <fog_fragment> 3440 #include <premultiplied_alpha_fragment> 3441 #include <dithering_fragment> 3442}`,Yp=`#define TOON 3443varying vec3 vViewPosition; 3444#include <common> 3445#include <batching_pars_vertex> 3446#include <uv_pars_vertex> 3447#include <displacementmap_pars_vertex> 3448#include <color_pars_vertex> 3449#include <fog_pars_vertex> 3450#include <normal_pars_vertex> 3451#include <morphtarget_pars_vertex> 3452#include <skinning_pars_vertex> 3453#include <shadowmap_pars_vertex> 3454#include <logdepthbuf_pars_vertex> 3455#include <clipping_planes_pars_vertex> 3456void main() { 3457 #include <uv_vertex> 3458 #include <color_vertex> 3459 #include <morphinstance_vertex> 3460 #include <morphcolor_vertex> 3461 #include <batching_vertex> 3462 #include <beginnormal_vertex> 3463 #include <morphnormal_vertex> 3464 #include <skinbase_vertex> 3465 #include <skinnormal_vertex> 3466 #include <defaultnormal_vertex> 3467 #include <normal_vertex> 3468 #include <begin_vertex> 3469 #include <morphtarget_vertex> 3470 #include <skinning_vertex> 3471 #include <displacementmap_vertex> 3472 #include <project_vertex> 3473 #include <logdepthbuf_vertex> 3474 #include <clipping_planes_vertex> 3475 vViewPosition = - mvPosition.xyz; 3476 #include <worldpos_vertex> 3477 #include <shadowmap_vertex> 3478 #include <fog_vertex> 3479}`,$p=`#define TOON 3480uniform vec3 diffuse; 3481uniform vec3 emissive; 3482uniform float opacity; 3483#include <common> 3484#include <dithering_pars_fragment> 3485#include <color_pars_fragment> 3486#include <uv_pars_fragment> 3487#include <map_pars_fragment> 3488#include <alphamap_pars_fragment> 3489#include <alphatest_pars_fragment> 3490#include <alphahash_pars_fragment> 3491#include <aomap_pars_fragment> 3492#include <lightmap_pars_fragment> 3493#include <emissivemap_pars_fragment> 3494#include <gradientmap_pars_fragment> 3495#include <fog_pars_fragment> 3496#include <bsdfs> 3497#include <lights_pars_begin> 3498#include <normal_pars_fragment> 3499#include <lights_toon_pars_fragment> 3500#include <shadowmap_pars_fragment> 3501#include <bumpmap_pars_fragment> 3502#include <normalmap_pars_fragment> 3503#include <logdepthbuf_pars_fragment> 3504#include <clipping_planes_pars_fragment> 3505void main() { 3506 vec4 diffuseColor = vec4( diffuse, opacity ); 3507 #include <clipping_planes_fragment> 3508 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3509 vec3 totalEmissiveRadiance = emissive; 3510 #include <logdepthbuf_fragment> 3511 #include <map_fragment> 3512 #include <color_fragment> 3513 #include <alphamap_fragment> 3514 #include <alphatest_fragment> 3515 #include <alphahash_fragment> 3516 #include <normal_fragment_begin> 3517 #include <normal_fragment_maps> 3518 #include <emissivemap_fragment> 3519 #include <lights_toon_fragment> 3520 #include <lights_fragment_begin> 3521 #include <lights_fragment_maps> 3522 #include <lights_fragment_end> 3523 #include <aomap_fragment> 3524 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3525 #include <opaque_fragment> 3526 #include <tonemapping_fragment> 3527 #include <colorspace_fragment> 3528 #include <fog_fragment> 3529 #include <premultiplied_alpha_fragment> 3530 #include <dithering_fragment> 3531}`,Kp=`uniform float size; 3532uniform float scale; 3533#include <common> 3534#include <color_pars_vertex> 3535#include <fog_pars_vertex> 3536#include <morphtarget_pars_vertex> 3537#include <logdepthbuf_pars_vertex> 3538#include <clipping_planes_pars_vertex> 3539#ifdef USE_POINTS_UV 3540 varying vec2 vUv; 3541 uniform mat3 uvTransform; 3542#endif 3543void main() { 3544 #ifdef USE_POINTS_UV 3545 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3546 #endif 3547 #include <color_vertex> 3548 #include <morphinstance_vertex> 3549 #include <morphcolor_vertex> 3550 #include <begin_vertex> 3551 #include <morphtarget_vertex> 3552 #include <project_vertex> 3553 gl_PointSize = size; 3554 #ifdef USE_SIZEATTENUATION 3555 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3556 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3557 #endif 3558 #include <logdepthbuf_vertex> 3559 #include <clipping_planes_vertex> 3560 #include <worldpos_vertex> 3561 #include <fog_vertex> 3562}`,Zp=`uniform vec3 diffuse; 3563uniform float opacity; 3564#include <common> 3565#include <color_pars_fragment> 3566#include <map_particle_pars_fragment> 3567#include <alphatest_pars_fragment> 3568#include <alphahash_pars_fragment> 3569#include <fog_pars_fragment> 3570#include <logdepthbuf_pars_fragment> 3571#include <clipping_planes_pars_fragment> 3572void main() { 3573 vec4 diffuseColor = vec4( diffuse, opacity ); 3574 #include <clipping_planes_fragment> 3575 vec3 outgoingLight = vec3( 0.0 ); 3576 #include <logdepthbuf_fragment> 3577 #include <map_particle_fragment> 3578 #include <color_fragment> 3579 #include <alphatest_fragment> 3580 #include <alphahash_fragment> 3581 outgoingLight = diffuseColor.rgb; 3582 #include <opaque_fragment> 3583 #include <tonemapping_fragment> 3584 #include <colorspace_fragment> 3585 #include <fog_fragment> 3586 #include <premultiplied_alpha_fragment> 3587}`,Jp=`#include <common> 3588#include <batching_pars_vertex> 3589#include <fog_pars_vertex> 3590#include <morphtarget_pars_vertex> 3591#include <skinning_pars_vertex> 3592#include <logdepthbuf_pars_vertex> 3593#include <shadowmap_pars_vertex> 3594void main() { 3595 #include <batching_vertex> 3596 #include <beginnormal_vertex> 3597 #include <morphinstance_vertex> 3598 #include <morphnormal_vertex> 3599 #include <skinbase_vertex> 3600 #include <skinnormal_vertex> 3601 #include <defaultnormal_vertex> 3602 #include <begin_vertex> 3603 #include <morphtarget_vertex> 3604 #include <skinning_vertex> 3605 #include <project_vertex> 3606 #include <logdepthbuf_vertex> 3607 #include <worldpos_vertex> 3608 #include <shadowmap_vertex> 3609 #include <fog_vertex> 3610}`,jp=`uniform vec3 color; 3611uniform float opacity; 3612#include <common> 3613#include <fog_pars_fragment> 3614#include <bsdfs> 3615#include <lights_pars_begin> 3616#include <logdepthbuf_pars_fragment> 3617#include <shadowmap_pars_fragment> 3618#include <shadowmask_pars_fragment> 3619void main() { 3620 #include <logdepthbuf_fragment> 3621 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3622 #include <tonemapping_fragment> 3623 #include <colorspace_fragment> 3624 #include <fog_fragment> 3625 #include <premultiplied_alpha_fragment> 3626}`,Qp=`uniform float rotation; 3627uniform vec2 center; 3628#include <common> 3629#include <uv_pars_vertex> 3630#include <fog_pars_vertex> 3631#include <logdepthbuf_pars_vertex> 3632#include <clipping_planes_pars_vertex> 3633void main() { 3634 #include <uv_vertex> 3635 vec4 mvPosition = modelViewMatrix[ 3 ]; 3636 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3637 #ifndef USE_SIZEATTENUATION 3638 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3639 if ( isPerspective ) scale *= - mvPosition.z; 3640 #endif 3641 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3642 vec2 rotatedPosition; 3643 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3644 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3645 mvPosition.xy += rotatedPosition; 3646 gl_Position = projectionMatrix * mvPosition; 3647 #include <logdepthbuf_vertex> 3648 #include <clipping_planes_vertex> 3649 #include <fog_vertex> 3650}`,em=`uniform vec3 diffuse; 3651uniform float opacity; 3652#include <common> 3653#include <uv_pars_fragment> 3654#include <map_pars_fragment> 3655#include <alphamap_pars_fragment> 3656#include <alphatest_pars_fragment> 3657#include <alphahash_pars_fragment> 3658#include <fog_pars_fragment> 3659#include <logdepthbuf_pars_fragment> 3660#include <clipping_planes_pars_fragment> 3661void main() { 3662 vec4 diffuseColor = vec4( diffuse, opacity ); 3663 #include <clipping_planes_fragment> 3664 vec3 outgoingLight = vec3( 0.0 ); 3665 #include <logdepthbuf_fragment> 3666 #include <map_fragment> 3667 #include <alphamap_fragment> 3668 #include <alphatest_fragment> 3669 #include <alphahash_fragment> 3670 outgoingLight = diffuseColor.rgb; 3671 #include <opaque_fragment> 3672 #include <tonemapping_fragment> 3673 #include <colorspace_fragment> 3674 #include <fog_fragment> 3675}`,Ve={alphahash_fragment:Md,alphahash_pars_fragment:Sd,alphamap_fragment:yd,alphamap_pars_fragment:Ed,alphatest_fragment:bd,alphatest_pars_fragment:Td,aomap_fragment:Ad,aomap_pars_fragment:wd,batching_pars_vertex:Rd,batching_vertex:Cd,begin_vertex:Pd,beginnormal_vertex:Ld,bsdfs:Dd,iridescence_fragment:Id,bumpmap_pars_fragment:Ud,clipping_planes_fragment:Nd,clipping_planes_pars_fragment:Fd,clipping_planes_pars_vertex:Od,clipping_planes_vertex:Bd,color_fragment:zd,color_pars_fragment:Gd,color_pars_vertex:Vd,color_vertex:kd,common:H
vendor: 12,163 bytes, line 3675
3675d,cube_uv_reflection_fragment:Wd,defaultnormal_vertex:Xd,displacementmap_pars_vertex:qd,displacementmap_vertex:Yd,emissivemap_fragment:$d,emissivemap_pars_fragment:Kd,colorspace_fragment:Zd,colorspace_pars_fragment:Jd,envmap_fragment:jd,envmap_common_pars_fragment:Qd,envmap_pars_fragment:ef,envmap_pars_vertex:tf,envmap_physical_pars_fragment:ff,envmap_vertex:nf,fog_vertex:rf,fog_pars_vertex:sf,fog_fragment:af,fog_pars_fragment:of,gradientmap_pars_fragment:lf,lightmap_pars_fragment:cf,lights_lambert_fragment:uf,lights_lambert_pars_fragment:hf,lights_pars_begin:df,lights_toon_fragment:pf,lights_toon_pars_fragment:mf,lights_phong_fragment:gf,lights_phong_pars_fragment:_f,lights_physical_fragment:vf,lights_physical_pars_fragment:xf,lights_fragment_begin:Mf,lights_fragment_maps:Sf,lights_fragment_end:yf,lightprobes_pars_fragment:Ef,logdepthbuf_fragment:bf,logdepthbuf_pars_fragment:Tf,logdepthbuf_pars_vertex:Af,logdepthbuf_vertex:wf,map_fragment:Rf,map_pars_fragment:Cf,map_particle_fragment:Pf,map_particle_pars_fragment:Lf,metalnessmap_fragment:Df,metalnessmap_pars_fragment:If,morphinstance_vertex:Uf,morphcolor_vertex:Nf,morphnormal_vertex:Ff,morphtarget_pars_vertex:Of,morphtarget_vertex:Bf,normal_fragment_begin:zf,normal_fragment_maps:Gf,normal_pars_fragment:Vf,normal_pars_vertex:kf,normal_vertex:Hf,normalmap_pars_fragment:Wf,clearcoat_normal_fragment_begin:Xf,clearcoat_normal_fragment_maps:qf,clearcoat_pars_fragment:Yf,iridescence_pars_fragment:$f,opaque_fragment:Kf,packing:Zf,premultiplied_alpha_fragment:Jf,project_vertex:jf,dithering_fragment:Qf,dithering_pars_fragment:ep,roughnessmap_fragment:tp,roughnessmap_pars_fragment:np,shadowmap_pars_fragment:ip,shadowmap_pars_vertex:rp,shadowmap_vertex:sp,shadowmask_pars_fragment:ap,skinbase_vertex:op,skinning_pars_vertex:lp,skinning_vertex:cp,skinnormal_vertex:up,specularmap_fragment:hp,specularmap_pars_fragment:dp,tonemapping_fragment:fp,tonemapping_pars_fragment:pp,transmission_fragment:mp,transmission_pars_fragment:gp,uv_pars_fragment:_p,uv_pars_vertex:vp,uv_vertex:xp,worldpos_vertex:Mp,background_vert:Sp,background_frag:yp,backgroundCube_vert:Ep,backgroundCube_frag:bp,cube_vert:Tp,cube_frag:Ap,depth_vert:wp,depth_frag:Rp,distance_vert:Cp,distance_frag:Pp,equirect_vert:Lp,equirect_frag:Dp,linedashed_vert:Ip,linedashed_frag:Up,meshbasic_vert:Np,meshbasic_frag:Fp,meshlambert_vert:Op,meshlambert_frag:Bp,meshmatcap_vert:zp,meshmatcap_frag:Gp,meshnormal_vert:Vp,meshnormal_frag:kp,meshphong_vert:Hp,meshphong_frag:Wp,meshphysical_vert:Xp,meshphysical_frag:qp,meshtoon_vert:Yp,meshtoon_frag:$p,points_vert:Kp,points_frag:Zp,shadow_vert:Jp,shadow_frag:jp,sprite_vert:Qp,sprite_frag:em},pe={common:{diffuse:{value:new Ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ue}},envmap:{envMap:{value:null},envMapRotation:{value:new Ue},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ue}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ue}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ue},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ue},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ue},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ue}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ue}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ue}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ye(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 L},probesMax:{value:new L},probesResolution:{value:new L}},points:{diffuse:{value:new Ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0},uvTransform:{value:new Ue}},sprite:{diffuse:{value:new Ye(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}}},_n={basic:{uniforms:Vt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.fog]),vertexShader:Ve.meshbasic_vert,fragmentShader:Ve.meshbasic_frag},lambert:{uniforms:Vt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Ye(0)},envMapIntensity:{value:1}}]),vertexShader:Ve.meshlambert_vert,fragmentShader:Ve.meshlambert_frag},phong:{uniforms:Vt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphong_vert,fragmentShader:Ve.meshphong_frag},standard:{uniforms:Vt([pe.common,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.roughnessmap,pe.metalnessmap,pe.fog,pe.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag},toon:{uniforms:Vt([pe.common,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.gradientmap,pe.fog,pe.lights,{emissive:{value:new Ye(0)}}]),vertexShader:Ve.meshtoon_vert,fragmentShader:Ve.meshtoon_frag},matcap:{uniforms:Vt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,{matcap:{value:null}}]),vertexShader:Ve.meshmatcap_vert,fragmentShader:Ve.meshmatcap_frag},points:{uniforms:Vt([pe.points,pe.fog]),vertexShader:Ve.points_vert,fragmentShader:Ve.points_frag},dashed:{uniforms:Vt([pe.common,pe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ve.linedashed_vert,fragmentShader:Ve.linedashed_frag},depth:{uniforms:Vt([pe.common,pe.displacementmap]),vertexShader:Ve.depth_vert,fragmentShader:Ve.depth_frag},normal:{uniforms:Vt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,{opacity:{value:1}}]),vertexShader:Ve.meshnormal_vert,fragmentShader:Ve.meshnormal_frag},sprite:{uniforms:Vt([pe.sprite,pe.fog]),vertexShader:Ve.sprite_vert,fragmentShader:Ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Ue},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ve.background_vert,fragmentShader:Ve.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ue}},vertexShader:Ve.backgroundCube_vert,fragmentShader:Ve.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ve.cube_vert,fragmentShader:Ve.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ve.equirect_vert,fragmentShader:Ve.equirect_frag},distance:{uniforms:Vt([pe.common,pe.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ve.distance_vert,fragmentShader:Ve.distance_frag},shadow:{uniforms:Vt([pe.lights,pe.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:Ve.shadow_vert,fragmentShader:Ve.shadow_frag}};_n.physical={uniforms:Vt([_n.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ue},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ue},clearcoatNormalScale:{value:new Te(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ue},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ue},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ue},sheen:{value:0},sheenColor:{value:new Ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ue},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ue},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ue},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ue},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ue},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ue},anisotropyVector:{value:new Te},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ue}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag};const Wr={r:0,b:0,g:0},tm=new ut,Ic=new Ue;Ic.set(-1,0,0,0,1,0,0,0,1);function nm(i,e,t,n,r,s){const a=new Ye(0);let o=r===!0?0:1,l,c,d=null,m=0,u=null;function p(S){let E=S.isScene===!0?S.background:null;if(E&&E.isTexture){const b=S.backgroundBlurriness>0;E=e.get(E,b)}return E}function _(S){let E=!1;const b=p(S);b===null?g(a,o):b&&b.isColor&&(g(b,1),E=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,s):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||E)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(S,E){const b=p(E);b&&(b.isCubeTexture||b.mapping===us)?(c===void 0&&(c=new St(new pr(1,1,1),new En({name:"BackgroundCubeMaterial",uniforms:Hi(_n.backgroundCube.uniforms),vertexShader:_n.backgroundCube.vertexShader,fragmentShader:_n.backgroundCube.fragmentShader,side:Dt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(w,T,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(tm.makeRotationFromEuler(E.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Ic),c.material.toneMapped=qe.getTransfer(b.colorSpace)!==tt,(d!==b||m!==b.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,d=b,m=b.version,u=i.toneMapping),c.layers.enableAll(),S.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new St(new hs(2,2),new En({name:"Backgroun
3675dMaterial",uniforms:Hi(_n.background.uniforms),vertexShader:_n.background.vertexShader,fragmentShader:_n.background.fragmentShader,side:jn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=qe.getTransfer(b.colorSpace)!==tt,b.matrixAutoUpdate===!0&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),(d!==b||m!==b.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,d=b,m=b.version,u=i.toneMapping),l.layers.enableAll(),S.unshift(l,l.geometry,l.material,0,0,null))}function g(S,E){S.getRGB(Wr,Cc(i)),t.buffers.color.setClear(Wr.r,Wr.g,Wr.b,E,s)}function f(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(S,E=1){a.set(S),o=E,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(S){o=S,g(a,o)},render:_,addToRenderList:y,dispose:f}}function im(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(C,O,Y,$,N){let V=!1;const H=m(C,$,Y,O);s!==H&&(s=H,c(s.object)),V=p(C,$,Y,N),V&&_(C,$,Y,N),N!==null&&e.update(N,i.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,b(C,O,Y,$),N!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return i.createVertexArray()}function c(C){return i.bindVertexArray(C)}function d(C){return i.deleteVertexArray(C)}function m(C,O,Y,$){const N=$.wireframe===!0;let V=n[O.id];V===void 0&&(V={},n[O.id]=V);const H=C.isInstancedMesh===!0?C.id:0;let K=V[H];K===void 0&&(K={},V[H]=K);let Z=K[Y.id];Z===void 0&&(Z={},K[Y.id]=Z);let he=Z[N];return he===void 0&&(he=u(l()),Z[N]=he),he}function u(C){const O=[],Y=[],$=[];for(let N=0;N<t;N++)O[N]=0,Y[N]=0,$[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:Y,attributeDivisors:$,object:C,attributes:{},index:null}}function p(C,O,Y,$){const N=s.attributes,V=O.attributes;let H=0;const K=Y.getAttributes();for(const Z in K)if(K[Z].location>=0){const re=N[Z];let _e=V[Z];if(_e===void 0&&(Z==="instanceMatrix"&&C.instanceMatrix&&(_e=C.instanceMatrix),Z==="instanceColor"&&C.instanceColor&&(_e=C.instanceColor)),re===void 0||re.attribute!==_e||_e&&re.data!==_e.data)return!0;H++}return s.attributesNum!==H||s.index!==$}function _(C,O,Y,$){const N={},V=O.attributes;let H=0;const K=Y.getAttributes();for(const Z in K)if(K[Z].location>=0){let re=V[Z];re===void 0&&(Z==="instanceMatrix"&&C.instanceMatrix&&(re=C.instanceMatrix),Z==="instanceColor"&&C.instanceColor&&(re=C.instanceColor));const _e={};_e.attribute=re,re&&re.data&&(_e.data=re.data),N[Z]=_e,H++}s.attributes=N,s.attributesNum=H,s.index=$}function y(){const C=s.newAttributes;for(let O=0,Y=C.length;O<Y;O++)C[O]=0}function g(C){f(C,0)}function f(C,O){const Y=s.newAttributes,$=s.enabledAttributes,N=s.attributeDivisors;Y[C]=1,$[C]===0&&(i.enableVertexAttribArray(C),$[C]=1),N[C]!==O&&(i.vertexAttribDivisor(C,O),N[C]=O)}function S(){const C=s.newAttributes,O=s.enabledAttributes;for(let Y=0,$=O.length;Y<$;Y++)O[Y]!==C[Y]&&(i.disableVertexAttribArray(Y),O[Y]=0)}function E(C,O,Y,$,N,V,H){H===!0?i.vertexAttribIPointer(C,O,Y,N,V):i.vertexAttribPointer(C,O,Y,$,N,V)}function b(C,O,Y,$){y();const N=$.attributes,V=Y.getAttributes(),H=O.defaultAttributeValues;for(const K in V){const Z=V[K];if(Z.location>=0){let he=N[K];if(he===void 0&&(K==="instanceMatrix"&&C.instanceMatrix&&(he=C.instanceMatrix),K==="instanceColor"&&C.instanceColor&&(he=C.instanceColor)),he!==void 0){const re=he.normalized,_e=he.itemSize,Oe=e.get(he);if(Oe===void 0)continue;const Ze=Oe.buffer,Le=Oe.type,ee=Oe.bytesPerElement,fe=Le===i.INT||Le===i.UNSIGNED_INT||he.gpuType===no;if(he.isInterleavedBufferAttribute){const oe=he.data,we=oe.stride,De=he.offset;if(oe.isInstancedInterleavedBuffer){for(let Re=0;Re<Z.locationSize;Re++)f(Z.location+Re,oe.meshPerAttribute);C.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Re=0;Re<Z.locationSize;Re++)g(Z.location+Re);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let Re=0;Re<Z.locationSize;Re++)E(Z.location+Re,_e/Z.locationSize,Le,re,we*ee,(De+_e/Z.locationSize*Re)*ee,fe)}else{if(he.isInstancedBufferAttribute){for(let oe=0;oe<Z.locationSize;oe++)f(Z.location+oe,he.meshPerAttribute);C.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let oe=0;oe<Z.locationSize;oe++)g(Z.location+oe);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let oe=0;oe<Z.locationSize;oe++)E(Z.location+oe,_e/Z.locationSize,Le,re,_e*ee,_e/Z.locationSize*oe*ee,fe)}}else if(H!==void 0){const re=H[K];if(re!==void 0)switch(re.length){case 2:i.vertexAttrib2fv(Z.location,re);break;case 3:i.vertexAttrib3fv(Z.location,re);break;case 4:i.vertexAttrib4fv(Z.location,re);break;default:i.vertexAttrib1fv(Z.location,re)}}}}S()}function w(){A();for(const C in n){const O=n[C];for(const Y in O){const $=O[Y];for(const N in $){const V=$[N];for(const H in V)d(V[H].object),delete V[H];delete $[N]}}delete n[C]}}function T(C){if(n[C.id]===void 0)return;const O=n[C.id];for(const Y in O){const $=O[Y];for(const N in $){const V=$[N];for(const H in V)d(V[H].object),delete V[H];delete $[N]}}delete n[C.id]}function P(C){for(const O in n){const Y=n[O];for(const $ in Y){const N=Y[$];if(N[C.id]===void 0)continue;const V=N[C.id];for(const H in V)d(V[H].object),delete V[H];delete N[C.id]}}}function v(C){for(const O in n){const Y=n[O],$=C.isInstancedMesh===!0?C.id:0,N=Y[$];
vendor: 13,850 bytes, lines 3675-3748
3675if(N!==void 0){for(const V in N){const H=N[V];for(const K in H)d(H[K].object),delete H[K];delete N[V]}delete Y[$],Object.keys(Y).length===0&&delete n[O]}}}function A(){U(),a=!0,s!==r&&(s=r,c(s.object))}function U(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:A,resetDefaultState:U,dispose:w,releaseStatesOfGeometry:T,releaseStatesOfObject:v,releaseStatesOfProgram:P,initAttributes:y,enableAttribute:g,disableUnusedAttributes:S}}function rm(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,d){d!==0&&(i.drawArraysInstanced(n,l,c,d),t.update(c,n,d))}function o(l,c,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,d);let u=0;for(let p=0;p<d;p++)u+=c[p];t.update(u,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function sm(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(P){return!(P!==un&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(P){const v=P===Bn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==Kt&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&P!==vn&&!v)}function l(P){if(P==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(Ce("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const m=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Ce("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),S=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),b=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),w=i.getParameter(i.MAX_SAMPLES),T=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:m,reversedDepthBuffer:u,maxTextures:p,maxVertexTextures:_,maxTextureSize:y,maxCubemapSize:g,maxAttributes:f,maxVertexUniforms:S,maxVaryings:E,maxFragmentUniforms:b,maxSamples:w,samples:T}}function am(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new ai,o=new Ue,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(m,u){const p=m.length!==0||u||n!==0||r;return r=u,n=m.length,p},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,u){t=d(m,u,0)},this.setState=function(m,u,p){const _=m.clippingPlanes,y=m.clipIntersection,g=m.clipShadows,f=i.get(m);if(!r||_===null||_.length===0||s&&!g)s?d(null):c();else{const S=s?0:n,E=S*4;let b=f.clippingState||null;l.value=b,b=d(_,u,E,p);for(let w=0;w!==E;++w)b[w]=t[w];f.clippingState=b,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(m,u,p,_){const y=m!==null?m.length:0;let g=null;if(y!==0){if(g=l.value,_!==!0||g===null){const f=p+y*4,S=u.matrixWorldInverse;o.getNormalMatrix(S),(g===null||g.length<f)&&(g=new Float32Array(f));for(let E=0,b=p;E!==y;++E,b+=4)a.copy(m[E]).applyMatrix4(S,o),a.normal.toArray(g,b),g[b+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,g}}const Jn=4,Sl=[.125,.215,.35,.446,.526,.582],li=20,om=256,Qi=new So,yl=new Ye;let $s=null,Ks=0,Zs=0,Js=!1;const lm=new L;class El{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],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=lm}=s;$s=this._renderer.getRenderTarget(),Ks=this._renderer.getActiveCubeFace(),Zs=this._renderer.getActiveMipmapLevel(),Js=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Al(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Tl(),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($s,Ks,Zs),this._renderer.xr.enabled=Js,e.scissorTest=!1,Fi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===hi||e.mapping===Vi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),$s=this._renderer.getRenderTarget(),Ks=this._renderer.getActiveCubeFace(),Zs=this._renderer.getActiveMipmapLevel(),Js=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:Bn,format:un,colorSpace:ts,depthBuffer:!1},r=bl(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=bl(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=cm(s)),this._blurMaterial=hm(s,e,t),this._ggxMaterial=um(s,e,t)}return r}_compileMaterial(e){const t=new St(new Ct,e);this._renderer.compile(t,Qi)}_sceneToCubeUV(e,t,n,r,s){const l=new Yt(90,1,t,n),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],m=this._renderer,u=m.autoClear,p=m.toneMapping;m.getClearColor(yl),m.toneMapping=Mn,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(r),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new St(new pr,new tn({name:"PMREM.Background",side:Dt,depthWrite:!1,depthTest:!1})));const y=this._backgroundBox,g=y.material;let f=!1;const S=e.background;S?S.isColor&&(g.color.copy(S),e.background=null,f=!0):(g.color.copy(yl),f=!0);for(let E=0;E<6;E++){const b=E%3;b===0?(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[E],s.y,s.z)):b===1?(l.up.set(0,0,c[E]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[E],s.z)):(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[E]));const w=this._cubeSize;Fi(r,b*w,E>2?w:0,w,w),m.setRenderTarget(r),f&&m.render(y,l),m.render(e,l)}m.toneMapping=p,m.autoClear=u,e.background=S}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===hi||e.mapping===Vi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Al()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Tl());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Fi(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Qi)}_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 l=a.uniforms,c=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),m=Math.sqrt(c*c-d*d),u=0+c*1.25,p=m*u,{_lodMax:_}=this,y=this._sizeLods[n],g=3*y*(n>_-Jn?n-_+Jn:0),f=4*(this._cubeSize-y);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=_-t,Fi(s,g,f,3*y,2*y),r.setRenderTarget(s),r.render(o,Qi),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=_-n,Fi(e,g,f,3*y,2*y),r.setRenderTarget(e),r.render(o,Qi)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&$e("blur direction must be either latitudinal or longitudinal!");const d=3,m=this._lodMeshes[r];m.material=c;const u=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*li-1),y=s/_,g=isFinite(s)?1+Math.floor(d*y):li;g>li&&Ce(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${li}`);const f=[];let S=0;for(let P=0;P<li;++P){const v=P/y,A=Math.exp(-v*v/2);f.push(A),P===0?S+=A:P<g&&(S+=2*A)}for(let P=0;P<f.length;P++)f[P]=f[P]/S;u.envMap.value=e.texture,u.samples.value=g,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:E}=this;u.dTheta.value=_,u.mipInt.value=E-n;const b=this._sizeLods[r],w=3*b*(r>E-Jn?r-E+Jn:0),T=4*(this._cubeSize-b);Fi(t,w,T,3*b,2*b),l.setRenderTarget(t),l.render(m,Qi)}}function cm(i){const e=[],t=[],n=[];let r=i;const s=i-Jn+1+Sl.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>i-Jn?l=Sl[a-i+Jn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,m=1+c,u=[d,d,m,d,m,m,d,d,m,m,d,m],p=6,_=6,y=3,g=2,f=1,S=new Float32Array(y*_*p),E=new Float32Array(g*_*p),b=new Float32Array(f*_*p);for(let T=0;T<p;T++){const P=T%3*2/3-1,v=T>2?0:-1,A=[P,v,0,P+2/3,v,0,P+2/3,v+1,0,P,v,0,P+2/3,v+1,0,P,v+1,0];S.set(A,y*_*T),E.set(u,g*_*T);const U=[T,T,T,T,T,T];b.set(U,f*_*T)}const w=new Ct;w.setAttribute("position",new rn(S,y)),w.setAttribute("uv",new rn(E,g)),w.setAttribute("faceIndex",new rn(b,f)),n.push(new St(w,null)),r>Jn&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function bl(i,e,t){const n=new Sn(i,e,t);return n.texture.mapping=us,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function um(i,e,t){return new En({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:om,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:ds(),fragmentShader:` 3676 3677 precision highp float; 3678 precision highp int; 3679 3680 varying vec3 vOutputDirection; 3681 3682 uniform sampler2D envMap; 3683 uniform float roughness; 3684 uniform float mipInt; 3685 3686 #define ENVMAP_TYPE_CUBE_UV 3687 #include <cube_uv_reflection_fragment> 3688 3689 #define PI 3.14159265359 3690 3691 // Van der Corput radical inverse 3692 float radicalInverse_VdC(uint bits) { 3693 bits = (bits << 16u) | (bits >> 16u); 3694 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3695 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3696 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3697 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3698 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3699 } 3700 3701 // Hammersley sequence 3702 vec2 hammersley(uint i, uint N) { 3703 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3704 } 3705 3706 // GGX VNDF importance sampling (Eric Heitz 2018) 3707 // "Sampling the GGX Distribution of Visible Normals" 3708 // https://jcgt.org/published/0007/04/01/ 3709 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3710 float alpha = roughness * roughness; 3711 3712 // Section 4.1: Orthonormal basis 3713 vec3 T1 = vec3(1.0, 0.0, 0.0); 3714 vec3 T2 = cross(V, T1); 3715 3716 // Section 4.2: Parameterization of projected area 3717 float r = sqrt(Xi.x); 3718 float phi = 2.0 * PI * Xi.y; 3719 float t1 = r * cos(phi); 3720 float t2 = r * sin(phi); 3721 float s = 0.5 * (1.0 + V.z); 3722 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3723 3724 // Section 4.3: Reprojection onto hemisphere 3725 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3726 3727 // Section 3.4: Transform back to ellipsoid configuration 3728 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3729 } 3730 3731 void main() { 3732 vec3 N = normalize(vOutputDirection); 3733 vec3 V = N; // Assume view direction equals normal for pre-filtering 3734 3735 vec3 prefilteredColor = vec3(0.0); 3736 float totalWeight = 0.0; 3737 3738 // For very low roughness, just sample the environment directly 3739 if (roughness < 0.001) { 3740 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3741 return; 3742 } 3743 3744 // Tangent space basis for VNDF sampling 3745 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3746 vec3 tangent = normalize(cross(up, N)); 3747 vec3 bitangent = cross(N, tangent); 3748
3749 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3750 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3751 3752 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3753 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3754 3755 // Transform H back to world space 3756 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3757 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3758 3759 float NdotL = max(dot(N, L), 0.0); 3760 3761 if(NdotL > 0.0) { 3762 // Sample environment at fixed mip level 3763 // VNDF importance sampling handles the distribution filtering 3764 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3765 3766 // Weight by NdotL for the split-sum approximation 3767 // VNDF PDF naturally accounts for the visible microfacet distribution 3768 prefilteredColor += sampleColor * NdotL; 3769 totalWeight += NdotL; 3770 } 3771 } 3772 3773 if (totalWeight > 0.0) { 3774 prefilteredColor = prefilteredColor / totalWeight; 3775 } 3776 3777 gl_FragColor = vec4(prefilteredColor, 1.0); 3778 } 3779 `,blending:Nn,depthTest:!1,depthWrite:!1})}function hm(i,e,t){const n=new Float32Array(li),r=new L(0,1,0);return new En({name:"SphericalGaussianBlur",defines:{n:li,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ds(),fragmentShader:` 3780 3781 precision mediump float; 3782 precision mediump int; 3783 3784 varying vec3 vOutputDirection; 3785 3786 uniform sampler2D envMap; 3787 uniform int samples; 3788 uniform float weights[ n ]; 3789 uniform bool latitudinal; 3790 uniform float dTheta; 3791 uniform float mipInt; 3792 uniform vec3 poleAxis; 3793 3794 #define ENVMAP_TYPE_CUBE_UV 3795 #include <cube_uv_reflection_fragment> 3796 3797 vec3 getSample( float theta, vec3 axis ) { 3798 3799 float cosTheta = cos( theta ); 3800 // Rodrigues' axis-angle rotation 3801 vec3 sampleDirection = vOutputDirection * cosTheta 3802 + cross( axis, vOutputDirection ) * sin( theta ) 3803 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3804 3805 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3806 3807 } 3808 3809 void main() { 3810 3811 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3812 3813 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3814 3815 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3816 3817 } 3818 3819 axis = normalize( axis ); 3820 3821 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3822 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3823 3824 for ( int i = 1; i < n; i++ ) { 3825 3826 if ( i >= samples ) { 3827 3828 break; 3829 3830 } 3831 3832 float theta = dTheta * float( i ); 3833 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3834 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3835 3836 } 3837 3838 } 3839 `,blending:Nn,depthTest:!1,depthWrite:!1})}function Tl(){return new En({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ds(),fragmentShader:` 3840 3841 precision mediump float; 3842 precision mediump int; 3843 3844 varying vec3 vOutputDirection; 3845 3846 uniform sampler2D envMap; 3847 3848 #include <common> 3849 3850 void main() { 3851 3852 vec3 outputDirection = normalize( vOutputDirection ); 3853 vec2 uv = equirectUv( outputDirection ); 3854 3855 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3856 3857 } 3858 `,blending:Nn,depthTest:!1,depthWrite:!1})}function Al(){return new En({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ds(),fragmentShader:` 3859 3860 precision mediump float; 3861 precision mediump int; 3862 3863 uniform float flipEnvMap; 3864 3865 varying vec3 vOutputDirection; 3866 3867 uniform samplerCube envMap; 3868 3869 void main() { 3870 3871 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3872 3873 } 3874 `,blending:Nn,depthTest:!1,depthWrite:!1})}function ds(){return` 3875 3876 precision mediump float; 3877 precision mediump int; 3878 3879 attribute float faceIndex; 3880 3881 varying vec3 vOutputDirection; 3882 3883 // RH coordinate system; PMREM face-indexing convention 3884 vec3 getDirection( vec2 uv, float face ) { 3885 3886 uv = 2.0 * uv - 1.0; 3887 3888 vec3 direction = vec3( uv, 1.0 ); 3889 3890 if ( face == 0.0 ) { 3891 3892 direction = direction.zyx; // ( 1, v, u ) pos x 3893 3894 } else if ( face == 1.0 ) { 3895 3896 direction = direction.xzy; 3897 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3898 3899 } else if ( face == 2.0 ) { 3900 3901 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3902 3903 } else if ( face == 3.0 ) { 3904 3905 direction = direction.zyx; 3906 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3907 3908 } else if ( face == 4.0 ) { 3909 3910 direction = direction.xzy; 3911 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3912 3913 } else if ( face == 5.0 ) { 3914 3915 direction.z *= -1.0; // ( u, v, -1 ) neg z 3916 3917 } 3918 3919 return direction; 3920 3921 } 3922 3923 void main() { 3924 3925 vOutputDirection = getDirection( uv, faceIndex ); 3926 gl_Position = vec4( position, 1.0 ); 3927 3928 } 3929 `}class Uc extends Sn{constructor(e=1,t={}
vendor: 32,319 bytes, lines 3929-4047
3929){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 Tc(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:` 3930 3931 varying vec3 vWorldDirection; 3932 3933 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3934 3935 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3936 3937 } 3938 3939 void main() { 3940 3941 vWorldDirection = transformDirection( position, modelMatrix ); 3942 3943 #include <begin_vertex> 3944 #include <project_vertex> 3945 3946 } 3947 `,fragmentShader:` 3948 3949 uniform sampler2D tEquirect; 3950 3951 varying vec3 vWorldDirection; 3952 3953 #include <common> 3954 3955 void main() { 3956 3957 vec3 direction = normalize( vWorldDirection ); 3958 3959 vec2 sampleUV = equirectUv( direction ); 3960 3961 gl_FragColor = texture2D( tEquirect, sampleUV ); 3962 3963 } 3964 `},r=new pr(5,5,5),s=new En({name:"CubemapFromEquirect",uniforms:Hi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Dt,blending:Nn});s.uniforms.tEquirect.value=t;const a=new St(r,s),o=t.minFilter;return t.minFilter===ci&&(t.minFilter=Bt),new gd(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 dm(i){let e=new WeakMap,t=new WeakMap,n=null;function r(u,p=!1){return u==null?null:p?a(u):s(u)}function s(u){if(u&&u.isTexture){const p=u.mapping;if(p===gs||p===_s)if(e.has(u)){const _=e.get(u).texture;return o(_,u.mapping)}else{const _=u.image;if(_&&_.height>0){const y=new Uc(_.height);return y.fromEquirectangularTexture(i,u),e.set(u,y),u.addEventListener("dispose",c),o(y.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const p=u.mapping,_=p===gs||p===_s,y=p===hi||p===Vi;if(_||y){let g=t.get(u);const f=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new El(i)),g=_?n.fromEquirectangular(u,g):n.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),g.texture;if(g!==void 0)return g.texture;{const S=u.image;return _&&S&&S.height>0||y&&S&&l(S)?(n===null&&(n=new El(i)),g=_?n.fromEquirectangular(u):n.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),u.addEventListener("dispose",d),g.texture):null}}}return u}function o(u,p){return p===gs?u.mapping=hi:p===_s&&(u.mapping=Vi),u}function l(u){let p=0;const _=6;for(let y=0;y<_;y++)u[y]!==void 0&&p++;return p===_}function c(u){const p=u.target;p.removeEventListener("dispose",c);const _=e.get(p);_!==void 0&&(e.delete(p),_.dispose())}function d(u){const p=u.target;p.removeEventListener("dispose",d);const _=t.get(p);_!==void 0&&(t.delete(p),_.dispose())}function m(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:m}}function fm(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&&$a("WebGLRenderer: "+n+" extension not supported."),r}}}function pm(i,e,t,n){const r={},s=new WeakMap;function a(m){const u=m.target;u.index!==null&&e.remove(u.index);for(const _ in u.attributes)e.remove(u.attributes[_]);u.removeEventListener("dispose",a),delete r[u.id];const p=s.get(u);p&&(e.remove(p),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(m,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function l(m){const u=m.attributes;for(const p in u)e.update(u[p],i.ARRAY_BUFFER)}function c(m){const u=[],p=m.index,_=m.attributes.position;let y=0;if(_===void 0)return;if(p!==null){const S=p.array;y=p.version;for(let E=0,b=S.length;E<b;E+=3){const w=S[E+0],T=S[E+1],P=S[E+2];u.push(w,T,T,P,P,w)}}else{const S=_.array;y=_.version;for(let E=0,b=S.length/3-1;E<b;E+=3){const w=E+0,T=E+1,P=E+2;u.push(w,T,T,P,P,w)}}const g=new(_.count>=65535?Mc:xc)(u,1);g.version=y;const f=s.get(m);f&&e.remove(f),s.set(m,g)}function d(m){const u=s.get(m);if(u){const p=m.index;p!==null&&u.version<p.version&&c(m)}else c(m);return s.get(m)}return{get:o,update:l,getWireframeAttribute:d}}function mm(i,e,t){let n;function r(m){n=m}let s,a;function o(m){s=m.type,a=m.bytesPerElement}function l(m,u){i.drawElements(n,u,s,m*a),t.update(u,n,1)}function c(m,u,p){p!==0&&(i.drawElementsInstanced(n,u,s,m*a,p),t.update(u,n,p))}function d(m,u,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,u,0,s,m,0,p);let y=0;for(let g=0;g<p;g++)y+=u[g];t.update(y,n,1)}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function gm(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:$e("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 _m(i,e,t){const n=new WeakMap,r=new pt;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,m=d!==void 0?d.length:0;let u=n.get(o);if(u===void 0||u.count!==m){let A=function(){P.dispose(),n.delete(o),o.removeEventListener("dispose",A)};u!==void 0&&u.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],S=o.morphAttributes.color||[];let E=0;p===!0&&(E=1),_===!0&&(E=2),y===!0&&(E=3);let b=o.attributes.position.count*E,w=1;b>e.maxTextureSize&&(w=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const T=new Float32Array(b*w*4*m),P=new gc(T,b,w,m);P.type=vn,P.needsUpdate=!0;const v=E*4;for(let U=0;U<m;U++){const C=g[U],O=f[U],Y=S[U],$=b*w*4*U;for(let N=0;N<C.count;N++){const V=N*v;p===!0&&(r.fromBufferAttribute(C,N),T[$+V+0]=r.x,T[$+V+1]=r.y,T[$+V+2]=r.z,T[$+V+3]=0),_===!0&&(r.fromBufferAttribute(O,N),T[$+V+4]=r.x,T[$+V+5]=r.y,T[$+V+6]=r.z,T[$+V+7]=0),y===!0&&(r.fromBufferAttribute(Y,N),T[$+V+8]=r.x,T[$+V+9]=r.y,T[$+V+10]=r.z,T[$+V+11]=Y.itemSize===4?r.w:1)}}u={count:m,texture:P,size:new Te(b,w)},n.set(o,u),o.addEventListener("dispose",A)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let y=0;y<c.length;y++)p+=c[y];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function vm(i,e,t,n,r){let s=new WeakMap;function a(c){const d=r.render.frame,m=c.geometry,u=e.get(c,m);if(s.get(u)!==d&&(e.update(u),s.set(u,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const p=c.skeleton;s.get(p)!==d&&(p.update(),s.set(p,d))}return u}function o(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const xm={[ec]:"LINEAR_TONE_MAPPING",[tc]:"REINHARD_TONE_MAPPING",[nc]:"CINEON_TONE_MAPPING",[ic]:"ACES_FILMIC_TONE_MAPPING",[sc]:"AGX_TONE_MAPPING",[ac]:"NEUTRAL_TONE_MAPPING",[rc]:"CUSTOM_TONE_MAPPING"};function Mm(i,e,t,n,r){const s=new Sn(e,t,{type:i,depthBuffer:n,stencilBuffer:r,depthTexture:n?new ki(e,t):void 0}),a=new Sn(e,t,{type:Bn,depthBuffer:!1,stencilBuffer:!1}),o=new Ct;o.setAttribute("position",new Tt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Tt([0,2,0,0,2,0],2));const l=new rd({uniforms:{tDiffuse:{value:null}},vertexShader:` 3965 precision highp float; 3966 3967 uniform mat4 modelViewMatrix; 3968 uniform mat4 projectionMatrix; 3969 3970 attribute vec3 position; 3971 attribute vec2 uv; 3972 3973 varying vec2 vUv; 3974 3975 void main() { 3976 vUv = uv; 3977 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3978 }`,fragmentShader:` 3979 precision highp float; 3980 3981 uniform sampler2D tDiffuse; 3982 3983 varying vec2 vUv; 3984 3985 #include <tonemapping_pars_fragment> 3986 #include <colorspace_pars_fragment> 3987 3988 void main() { 3989 gl_FragColor = texture2D( tDiffuse, vUv ); 3990 3991 #ifdef LINEAR_TONE_MAPPING 3992 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3993 #elif defined( REINHARD_TONE_MAPPING ) 3994 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3995 #elif defined( CINEON_TONE_MAPPING ) 3996 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3997 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3998 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3999 #elif defined( AGX_TONE_MAPPING ) 4000 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4001 #elif defined( NEUTRAL_TONE_MAPPING ) 4002 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4003 #elif defined( CUSTOM_TONE_MAPPING ) 4004 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4005 #endif 4006 4007 #ifdef SRGB_TRANSFER 4008 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4009 #endif 4010 }`,depthTest:!1,depthWrite:!1}),c=new St(o,l),d=new So(-1,1,1,-1,0,1);let m=null,u=null,p=!1,_,y=null,g=[],f=!1;this.setSize=function(S,E){s.setSize(S,E),a.setSize(S,E);for(let b=0;b<g.length;b++){const w=g[b];w.setSize&&w.setSize(S,E)}},this.setEffects=function(S){g=S,f=g.length>0&&g[0].isRenderPass===!0;const E=s.width,b=s.height;for(let w=0;w<g.length;w++){const T=g[w];T.setSize&&T.setSize(E,b)}},this.begin=function(S,E){if(p||S.toneMapping===Mn&&g.length===0)return!1;if(y=E,E!==null){const b=E.width,w=E.height;(s.width!==b||s.height!==w)&&this.setSize(b,w)}return f===!1&&S.setRenderTarget(s),_=S.toneMapping,S.toneMapping=Mn,!0},this.hasRenderPass=function(){return f},this.end=function(S,E){S.toneMapping=_,p=!0;let b=s,w=a;for(let T=0;T<g.length;T++){const P=g[T];if(P.enabled!==!1&&(P.render(S,w,b,E),P.needsSwap!==!1)){const v=b;b=w,w=v}}if(m!==S.outputColorSpace||u!==S.toneMapping){m=S.outputColorSpace,u=S.toneMapping,l.defines={},qe.getTransfer(m)===tt&&(l.defines.SRGB_TRANSFER="");const T=xm[u];T&&(l.defines[T]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=b.texture,S.setRenderTarget(y),S.render(c,d),y=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){s.depthTexture&&s.depthTexture.dispose(),s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Nc=new It,Ja=new ki(1,1),Fc=new gc,Oc=new mh,Bc=new Tc,wl=[],Rl=[],Cl=new Float32Array(16),Pl=new Float32Array(9),Ll=new Float32Array(4);function Wi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=wl[r];if(s===void 0&&(s=new Float32Array(r),wl[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 At(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 wt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function fs(i,e){let t=Rl[e];t===void 0&&(t=new Int32Array(e),Rl[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Sm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function ym(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(At(t,e))return;i.uniform2fv(this.addr,e),wt(t,e)}}function Em(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(At(t,e))return;i.uniform3fv(this.addr,e),wt(t,e)}}function bm(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(At(t,e))return;i.uniform4fv(this.addr,e),wt(t,e)}}function Tm(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(At(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),wt(t,e)}else{if(At(t,n))return;Ll.set(n),i.uniformMatrix2fv(this.addr,!1,Ll),wt(t,n)}}function Am(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(At(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),wt(t,e)}else{if(At(t,n))return;Pl.set(n),i.uniformMatrix3fv(this.addr,!1,Pl),wt(t,n)}}function wm(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(At(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),wt(t,e)}else{if(At(t,n))return;Cl.set(n),i.uniformMatrix4fv(this.addr,!1,Cl),wt(t,n)}}function Rm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Cm(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(At(t,e))return;i.uniform2iv(this.addr,e),wt(t,e)}}function Pm(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(At(t,e))return;i.uniform3iv(this.addr,e),wt(t,e)}}function Lm(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(At(t,e))return;i.uniform4iv(this.addr,e),wt(t,e)}}function Dm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Im(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(At(t,e))return;i.uniform2uiv(this.addr,e),wt(t,e)}}function Um(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(At(t,e))return;i.uniform3uiv(this.addr,e),wt(t,e)}}function Nm(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(At(t,e))return;i.uniform4uiv(this.addr,e),wt(t,e)}}function Fm(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?(Ja.compareFunction=t.isReversedDepthBuffer()?co:lo,s=Ja):s=Nc,t.setTexture2D(e||s,r)}function Om(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Oc,r)}function Bm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Bc,r)}function zm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Fc,r)}function Gm(i){switch(i){case 5126:return Sm;case 35664:return ym;case 35665:return Em;case 35666:return bm;case 35674:return Tm;case 35675:return Am;case 35676:return wm;case 5124:case 35670:return Rm;case 35667:case 35671:return Cm;case 35668:case 35672:return Pm;case 35669:case 35673:return Lm;case 5125:return Dm;case 36294:return Im;case 36295:return Um;case 36296:return Nm;case 35678:case 36198:case 36298:case 36306:case 35682:return Fm;case 35679:case 36299:case 36307:return Om;case 35680:case 36300:case 36308:case 36293:return Bm;case 36289:case 36303:case 36311:case 36292:return zm}}function Vm(i,e){i.uniform1fv(this.addr,e)}function km(i,e){const t=Wi(e,this.size,2);i.uniform2fv(this.addr,t)}function Hm(i,e){const t=Wi(e,this.size,3);i.uniform3fv(this.addr,t)}function Wm(i,e){const t=Wi(e,this.size,4);i.uniform4fv(this.addr,t)}function Xm(i,e){const t=Wi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function qm(i,e){const t=Wi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Ym(i,e){const t=Wi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function $m(i,e){i.uniform1iv(this.addr,e)}function Km(i,e){i.uniform2iv(this.addr,e)}function Zm(i,e){i.uniform3iv(this.addr,e)}function Jm(i,e){i.uniform4iv(this.addr,e)}function jm(i,e){i.uniform1uiv(this.addr,e)}function Qm(i,e){i.uniform2uiv(this.addr,e)}function eg(i,e){i.uniform3uiv(this.addr,e)}function tg(i,e){i.uniform4uiv(this.addr,e)}function ng(i,e,t){const n=this.cache,r=e.length,s=fs(t,r);At(n,s)||(i.uniform1iv(this.addr,s),wt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=Ja:a=Nc;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function ig(i,e,t){const n=this.cache,r=e.length,s=fs(t,r);At(n,s)||(i.uniform1iv(this.addr,s),wt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Oc,s[a])}function rg(i,e,t){const n=this.cache,r=e.length,s=fs(t,r);At(n,s)||(i.uniform1iv(this.addr,s),wt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Bc,s[a])}function sg(i,e,t){const n=this.cache,r=e.length,s=fs(t,r);At(n,s)||(i.uniform1iv(this.addr,s),wt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Fc,s[a])}function ag(i){switch(i){case 5126:return Vm;case 35664:return km;case 35665:return Hm;case 35666:return Wm;case 35674:return Xm;case 35675:return qm;case 35676:return Ym;case 5124:case 35670:return $m;case 35667:case 35671:return Km;case 35668:case 35672:return Zm;case 35669:case 35673:return Jm;case 5125:return jm;case 36294:return Qm;case 36295:return eg;case 36296:return tg;case 35678:case 36198:case 36298:case 36306:case 35682:return ng;case 35679:case 36299:case 36307:return ig;case 35680:case 36300:case 36308:case 36293:return rg;case 36289:case 36303:case 36311:case 36292:return sg}}class og{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Gm(t.type)}}class lg{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ag(t.type)}}class cg{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 Dl(i,e){i.seq.push(e),i.map[e.id]=e}function ug(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 l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Dl(t,c===void 0?new og(o,i,e):new lg(o,i,e));break}else{let m=t.map[o];m===void 0&&(m=new cg(o),Dl(t,m)),t=m}}}class jr{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),l=e.getUniformLocation(t,o.name);ug(o,l,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],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.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 Il(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const hg=37297;let dg=0;function fg(i,e){const t=i.split(` 4011`),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(` 4012`)}const Ul=new Ue;function pg(i){qe._getMatrix(Ul,qe.workingColorSpace,i);const e=`mat3( ${Ul.elements.map(t=>t.toFixed(4))} )`;switch(qe.getTransfer(i)){case ns:return[e,"LinearTransferOETF"];case tt:return[e,"sRGBTransferOETF"];default:return Ce("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Nl(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()+` 4013 4014`+s+` 4015 4016`+fg(i.getShaderSource(e),o)}else return s}function mg(i,e){const t=pg(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 4017`)}const gg={[ec]:"Linear",[tc]:"Reinhard",[nc]:"Cineon",[ic]:"ACESFilmic",[sc]:"AgX",[ac]:"Neutral",[rc]:"Custom"};function _g(i,e){const t=gg[e];return t===void 0?(Ce("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Xr=new L;function vg(){qe.getLuminanceCoefficients(Xr);const i=Xr.x.toFixed(4),e=Xr.y.toFixed(4),t=Xr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 4018`)}function xg(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(nr).join(` 4019`)}function Mg(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 4020`)}function Sg(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 Fl(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ol(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const yg=/^[ \t]*#include +<([\w\d./]+)>/gm;function ja(i){return i.replace(yg,bg)}const Eg=new Map;function bg(i,e){let t=Ve[e];if(t===void 0){const n=Eg.get(e);if(n!==void 0)t=Ve[n],Ce('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return ja(t)}const Tg=/#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 Bl(i){return i.replace(Tg,Ag)}function Ag(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 zl(i){let e=`precision ${i.precision} float; 4021 precision ${i.precision} int; 4022 precision ${i.precision} sampler2D; 4023 precision ${i.precision} samplerCube; 4024 precision ${i.precision} sampler3D; 4025 precision ${i.precision} sampler2DArray; 4026 precision ${i.precision} sampler2DShadow; 4027 precision ${i.precision} samplerCubeShadow; 4028 precision ${i.precision} sampler2DArrayShadow; 4029 precision ${i.precision} isampler2D; 4030 precision ${i.precision} isampler3D; 4031 precision ${i.precision} isamplerCube; 4032 precision ${i.precision} isampler2DArray; 4033 precision ${i.precision} usampler2D; 4034 precision ${i.precision} usampler3D; 4035 precision ${i.precision} usamplerCube; 4036 precision ${i.precision} usampler2DArray; 4037 `;return i.precision==="highp"?e+=` 4038#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 4039#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 4040#define LOW_PRECISION`),e}const wg={[Yr]:"SHADOWMAP_TYPE_PCF",[tr]:"SHADOWMAP_TYPE_VSM"};function Rg(i){return wg[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Cg={[hi]:"ENVMAP_TYPE_CUBE",[Vi]:"ENVMAP_TYPE_CUBE",[us]:"ENVMAP_TYPE_CUBE_UV"};function Pg(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Cg[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const Lg={[Vi]:"ENVMAP_MODE_REFRACTION"};function Dg(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Lg[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Ig={[Ql]:"ENVMAP_BLENDING_MULTIPLY",[Iu]:"ENVMAP_BLENDING_MIX",[Uu]:"ENVMAP_BLENDING_ADD"};function Ug(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Ig[i.combine]||"ENVMAP_BLENDING_NONE"}function Ng(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 Fg(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Rg(t),c=Pg(t),d=Dg(t),m=Ug(t),u=Ng(t),p=xg(t),_=Mg(s),y=r.createProgram();let g,f,S=t.glslVersion?"#version "+t.glslVersion+` 4041`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(nr).join(` 4042`),g.length>0&&(g+=` 4043`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(nr).join(` 4044`),f.length>0&&(f+=` 4045`)):(g=[zl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+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 "+l:"",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",` 4046`].filter(nr).join(` 4047`),f=[zl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+m:"",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.iridescence?"#define USE_IR
4047IDESCENCE":"",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 "+l:"",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?Ve.tonemapping_pars_fragment:"",t.toneMapping!==Mn?_g("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ve.colorspace_pars_fragment,mg("linearToOutputTexel",t.outputColorSpace),vg(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 4048`].filter(nr).join(` 4049`)),a=ja(a),a=Fl(a,t),a=Ol(a,t),o=ja(o),o=Fl(o,t),o=Ol(o,t),a=Bl(a),o=Bl(o),t.isRawShaderMaterial!==!0&&(S=`#version 300 es 4050`,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` 4051`)+` 4052`+g,f=["#define varying in",t.glslVersion===Go?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Go?"":"#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(` 4053`)+` 4054`+f);const E=S+g+a,b=S+f+o,w=Il(r,r.VERTEX_SHADER,E),T=Il(r,r.FRAGMENT_SHADER,b);r.attachShader(y,w),r.attachShader(y,T),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function P(C){if(i.debug.checkShaderErrors){const O=r.getProgramInfoLog(y)||"",Y=r.getShaderInfoLog(w)||"",$=r.getShaderInfoLog(T)||"",N=O.trim(),V=Y.trim(),H=$.trim();let K=!0,Z=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(K=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,y,w,T);else{const he=Nl(r,w,"vertex"),re=Nl(r,T,"fragment");$e("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+` 4055 4056Material Name: `+C.name+` 4057Material Type: `+C.type+` 4058 4059Program Info Log: `+N+` 4060`+he+` 4061`+re)}else N!==""?Ce("WebGLProgram: Program Info Log:",N):(V===""||H==="")&&(Z=!1);Z&&(C.diagnostics={runnable:K,programLog:N,vertexShader:{log:V,prefix:g},fragmentShader:{log:H,prefix:f}})}r.deleteShader(w),r.deleteShader(T),v=new jr(r,y),A=Sg(r,y)}let v;this.getUniforms=function(){return v===void 0&&P(this),v};let A;this.getAttributes=function(){return A===void 0&&P(this),A};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=r.getProgramParameter(y,hg)),U},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=dg++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=T,this}let Og=0;class Bg{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.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}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return 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 zg(e),t.set(e,n)),n}}class zg{constructor(e){this.id=Og++,this.code=e,this.usedTimes=0}}function Gg(i){return i===di||i===Qr||i===es}
vendor: 15,520 bytes, line 4061
4061function Vg(i,e,t,n,r,s){const a=new _c,o=new Bg,l=new Set,c=[],d=new Map,m=n.logarithmicDepthBuffer;let u=n.precision;const p={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 _(v){return l.add(v),v===0?"uv":`uv${v}`}function y(v,A,U,C,O,Y){const $=C.fog,N=O.geometry,V=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?C.environment:null,H=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,K=e.get(v.envMap||V,H),Z=K&&K.mapping===us?K.image.height:null,he=p[v.type];v.precision!==null&&(u=n.getMaxPrecision(v.precision),u!==v.precision&&Ce("WebGLProgram.getParameters:",v.precision,"not supported, using",u,"instead."));const re=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,_e=re!==void 0?re.length:0;let Oe=0;N.morphAttributes.position!==void 0&&(Oe=1),N.morphAttributes.normal!==void 0&&(Oe=2),N.morphAttributes.color!==void 0&&(Oe=3);let Ze,Le,ee,fe;if(he){const Ne=_n[he];Ze=Ne.vertexShader,Le=Ne.fragmentShader}else Ze=v.vertexShader,Le=v.fragmentShader,o.update(v),ee=o.getVertexShaderID(v),fe=o.getFragmentShaderID(v);const oe=i.getRenderTarget(),we=i.state.buffers.depth.getReversed(),De=O.isInstancedMesh===!0,Re=O.isBatchedMesh===!0,ht=!!v.map,We=!!v.matcap,je=!!K,it=!!v.aoMap,Ge=!!v.lightMap,mt=!!v.bumpMap,ct=!!v.normalMap,zt=!!v.displacementMap,I=!!v.emissiveMap,gt=!!v.metalnessMap,Be=!!v.roughnessMap,et=v.anisotropy>0,z=v.clearcoat>0,se=v.dispersion>0,x=v.iridescence>0,h=v.sheen>0,R=v.transmission>0,X=et&&!!v.anisotropyMap,Q=z&&!!v.clearcoatMap,te=z&&!!v.clearcoatNormalMap,ie=z&&!!v.clearcoatRoughnessMap,q=x&&!!v.iridescenceMap,J=x&&!!v.iridescenceThicknessMap,ue=h&&!!v.sheenColorMap,ve=h&&!!v.sheenRoughnessMap,ae=!!v.specularMap,le=!!v.specularColorMap,Ie=!!v.specularIntensityMap,ze=R&&!!v.transmissionMap,Je=R&&!!v.thicknessMap,D=!!v.gradientMap,ce=!!v.alphaMap,j=v.alphaTest>0,xe=!!v.alphaHash,de=!!v.extensions;let ne=Mn;v.toneMapped&&(oe===null||oe.isXRRenderTarget===!0)&&(ne=i.toneMapping);const Ee={shaderID:he,shaderType:v.type,shaderName:v.name,vertexShader:Ze,fragmentShader:Le,defines:v.defines,customVertexShaderID:ee,customFragmentShaderID:fe,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:u,batching:Re,batchingColor:Re&&O._colorsTexture!==null,instancing:De,instancingColor:De&&O.instanceColor!==null,instancingMorph:De&&O.morphTexture!==null,outputColorSpace:oe===null?i.outputColorSpace:oe.isXRRenderTarget===!0?oe.texture.colorSpace:qe.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:ht,matcap:We,envMap:je,envMapMode:je&&K.mapping,envMapCubeUVHeight:Z,aoMap:it,lightMap:Ge,bumpMap:mt,normalMap:ct,displacementMap:zt,emissiveMap:I,normalMapObjectSpace:ct&&v.normalMapType===Ou,normalMapTangentSpace:ct&&v.normalMapType===qa,packedNormalMap:ct&&v.normalMapType===qa&&Gg(v.normalMap.format),metalnessMap:gt,roughnessMap:Be,anisotropy:et,anisotropyMap:X,clearcoat:z,clearcoatMap:Q,clearcoatNormalMap:te,clearcoatRoughnessMap:ie,dispersion:se,iridescence:x,iridescenceMap:q,iridescenceThicknessMap:J,sheen:h,sheenColorMap:ue,sheenRoughnessMap:ve,specularMap:ae,specularColorMap:le,specularIntensityMap:Ie,transmission:R,transmissionMap:ze,thicknessMap:Je,gradientMap:D,opaque:v.transparent===!1&&v.blending===Bi&&v.alphaToCoverage===!1,alphaMap:ce,alphaTest:j,alphaHash:xe,combine:v.combine,mapUv:ht&&_(v.map.channel),aoMapUv:it&&_(v.aoMap.channel),lightMapUv:Ge&&_(v.lightMap.channel),bumpMapUv:mt&&_(v.bumpMap.channel),normalMapUv:ct&&_(v.normalMap.channel),displacementMapUv:zt&&_(v.displacementMap.channel),emissiveMapUv:I&&_(v.emissiveMap.channel),metalnessMapUv:gt&&_(v.metalnessMap.channel),roughnessMapUv:Be&&_(v.roughnessMap.channel),anisotropyMapUv:X&&_(v.anisotropyMap.channel),clearcoatMapUv:Q&&_(v.clearcoatMap.channel),clearcoatNormalMapUv:te&&_(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&_(v.clearcoatRoughnessMap.channel),iridescenceMapUv:q&&_(v.iridescenceMap.channel),iridescenceThicknessMapUv:J&&_(v.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&_(v.sheenColorMap.channel),sheenRoughnessMapUv:ve&&_(v.sheenRoughnessMap.channel),specularMapUv:ae&&_(v.specularMap.channel),specularColorMapUv:le&&_(v.specularColorMap.channel),specularIntensityMapUv:Ie&&_(v.specularIntensityMap.channel),transmissionMapUv:ze&&_(v.transmissionMap.channel),thicknessMapUv:Je&&_(v.thicknessMap.channel),alphaMapUv:ce&&_(v.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(ct||et),vertexNormals:!!N.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!N.attributes.uv&&(ht||ce),fog:!!$,useFog:v.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||N.attributes.normal===void 0&&ct===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:we,skinning:O.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Oe,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numLightProbeGrids:Y.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:i.shadowMap.enabled&&U.length>0,shadowMapType:i.shadowMap.type,toneMapping:ne,decodeVideoTexture:ht&&v.map.isVideoTexture===!0&&qe.getTransfer(v.map.colorSpace)===tt,decodeVideoTextureEmissive:I&&v.emissiveMap.isVideoTexture===!0&&qe.getTransfer(v.emissiveMap.colorSpace)===tt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Dn,flipSided:v.side===Dt,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:de&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(de&&v.extensions.multiDraw===!0||Re)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Ee.vertexUv1s=l.has(1),Ee.vertexUv2s=l.has(2),Ee.vertexUv3s=l.has(3),l.clear(),Ee}function g(v){const A=[];if(v.shaderID?A.push(v.shaderID):(A.push(v.customVertexShaderID),A.push(v.customFragmentShaderID)),v.defines!==void 0)for(const U in v.defines)A.push(U),A.push(v.defines[U]);return v.isRawShaderMaterial===!1&&(f(A,v),S(A,v),A.push(i.outputColorSpace)),A.push(v.customProgramCacheKey),A.join()}function f(v,A){v.push(A.precision),v.push(A.outputColorSpace),v.push(A.envMapMode),v.push(A.envMapCubeUVHeight),v.push(A.mapUv),v.push(A.alphaMapUv),v.push(A.lightMapUv),v.push(A.aoMapUv),v.push(A.bumpMapUv),v.push(A.normalMapUv),v.push(A.displacementMapUv),v.push(A.emissiveMapUv),v.push(A.metalnessMapUv),v.push(A.roughnessMapUv),v.push(A.anisotropyMapUv),v.push(A.clearcoatMapUv),v.push(A.clearcoatNormalMapUv),v.push(A.clearcoatRoughnessMapUv),v.push(A.iridescenceMapUv),v.push(A.iridescenceThicknessMapUv),v.push(A.sheenColorMapUv),v.push(A.sheenRoughnessMapUv),v.push(A.specularMapUv),v.push(A.specularColorMapUv),v.push(A.specularIntensityMapUv),v.push(A.transmissionMapUv),v.push(A.thicknessMapUv),v.push(A.combine),v.push(A.fogExp2),v.push(A.sizeAttenuation),v.push(A.morphTargetsCount),v.push(A.morphAttributeCount),v.push(A.numDirLights),v.push(A.numPointLights),v.push(A.numSpotLights),v.push(A.numSpotLightMaps),v.push(A.numHemiLights),v.push(A.numRectAreaLights),v.push(A.numDirLightShadows),v.push(A.numPointLightShadows),v.push(A.numSpotLightShadows),v.push(A.numSpotLightShadowsWithMaps),v.push(A.numLightProbes),v.push(A.shadowMapType),v.push(A.toneMapping),v.push(A.numClippingPlanes),v.push(A.numClipIntersection),v.push(A.depthPacking)}function S(v,A){a.disableAll(),A.instancing&&a.enable(0),A.instancingColor&&a.enable(1),A.instancingMorph&&a.enable(2),A.matcap&&a.enable(3),A.envMap&&a.enable(4),A.normalMapObjectSpace&&a.enable(5),A.normalMapTangentSpace&&a.enable(6),A.clearcoat&&a.enable(7),A.iridescence&&a.enable(8),A.alphaTest&&a.enable(9),A.vertexColors&&a.enable(10),A.vertexAlphas&&a.enable(11),A.vertexUv1s&&a.enable(12),A.vertexUv2s&&a.enable(13),A.vertexUv3s&&a.enable(14),A.vertexTangents&&a.enable(15),A.anisotropy&&a.enable(16),A.alphaHash&&a.enable(17),A.batching&&a.enable(18),A.dispersion&&a.enable(19),A.batchingColor&&a.enable(20),A.gradientMap&&a.enable(21),A.packedNormalMap&&a.enable(22),A.vertexNormals&&a.enable(23),v.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.reversedDepthBuffer&&a.enable(4),A.skinning&&a.enable(5),A.morphTargets&&a.enable(6),A.morphNormals&&a.enable(7),A.morphColors&&a.enable(8),A.premultipliedAlpha&&a.enable(9),A.shadowMapEnabled&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.decodeVideoTextureEmissive&&a.enable(20),A.alphaToCoverage&&a.enable(21),A.numLightProbeGrids>0&&a.enable(22),v.push(a.mask)}function E(v){const A=p[v.type];let U;if(A){const C=_n[A];U=td.clone(C.uniforms)}else U=v.uniforms;return U}function b(v,A){let U=d.get(A);return U!==void 0?++U.usedTimes:(U=new Fg(i,A,v,r),c.push(U),d.set(A,U)),U}function w(v){if(--v.usedTimes===0){const A=c.indexOf(v);c[A]=c[c.length-1],c.pop(),d.delete(v.cacheKey),v.destroy()}}function T(v){o.remove(v)}function P(){o.dispose()}return{getParameters:y,getProgramCacheKey:g,getUniforms:E,acquireProgram:b,releaseProgram:w,releaseShaderCache:T,programs:c,dispose:P}}function kg(){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,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Hg(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 Gl(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 Vl(){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 p=0;return u.isInstancedMesh&&(p+=2),u.isSkinnedMesh&&(p+=1),p}function o(u,p,_,y,g,f){let S=i[e];return S===void 0?(S={id:u.id,object:u,geometry:p,material:_,materialVariant:a(u),groupOrder:y,renderOrder:u.renderOrder,z:g,group:f},i[e]=S):(S.id=u.id,S.object=u,S.geometry=p,S.material=_,S.materialVariant=a(u),S.groupOrder=y,S.renderOrder=u.renderOrder,S.z=g,S.group=f),e++,S}function l(u,p,_,y,g,f){const S=o(u,p,_,y,g,f);_.transmission>0?n.push(S):_.transparent===!0?r.push(S):t.push(S)}function c(u,p,_,y,g,f){const S=o(u,p,_,y,g,f);_.transmission>0?n.unshift(S):_.transparent===!0?r.unshift(S):t.unshift(S)}function d(u,p){t.length>1&&t.sort(u||Hg),n.length>1&&n.sort(p||Gl),r.length>1&&r.sort(p||Gl)}function m(){for(let u=e,p=i.length;u<p;u++){const _=i[u];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:m,sort:d}}function Wg(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Vl,i.set(n,[a])):r>=s.length?(a=new Vl,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Xg(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new L,color:new Ye};break;case"SpotLight":t={position:new L,direction:new L,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new L,halfWidth:new L,halfHeight:new L};break}return i[e.id]=t,t}}}function qg(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Yg=0;function $g(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Kg(i){const e=new Xg,t=qg(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new L);const r=new L,s=new ut,a=new ut;function o(c){let d=0,m=0,u=0;for(let A=0;A<9;A++)n.probe[A].set(0,0,0);let p=0,_=0,y=0,g=0,f=0,S=0,E=0,b=0,w=0,T=0,P=0;c.sort($g);for(let A=0,U=c.length;A<U;A++){const C=c[A],O=C.color,Y=C.intensity,$=C.distance;let N=null;if(C.shadow&&C.shadow.map&&(C.shadow.map.texture.format===di?N=C.shadow.map.texture:N=C.shadow.map.depthTexture||C.shadow.map.texture),C.isAmbientLight)d+=O.r*Y,m+=O.g*Y,u+=O.b*Y;else if(C.isLightProbe){for(let V=0;V<9;V++)n.probe[V].addScaledVector(C.sh.coefficients[V],Y);P++}else if(C.isDirectionalLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const H=C.shadow,K=t.get(C);K.shadowIntensity=H.intensity,K.shadowBias=H.bias,K.shadowNormalBias=H.normalBias,K.shadowRadius=H.radius,K.shadowMapSize=H.mapSize,n.directionalShadow[p]=K,n.directionalShadowMap[p]=N,n.directionalShadowMatrix[p]=C.shadow.matrix,S++}n.directional[p]=V,p++}else if(C.isSpotLight){const V=e.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(O).multiplyScalar(Y),V.distance=$,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,n.spot[y]=V;const H=C.shadow;
vendor: 4,218 bytes, lines 4061-4066
4061if(C.map&&(n.spotLightMap[w]=C.map,w++,H.updateMatrices(C),C.castShadow&&T++),n.spotLightMatrix[y]=H.matrix,C.castShadow){const K=t.get(C);K.shadowIntensity=H.intensity,K.shadowBias=H.bias,K.shadowNormalBias=H.normalBias,K.shadowRadius=H.radius,K.shadowMapSize=H.mapSize,n.spotShadow[y]=K,n.spotShadowMap[y]=N,b++}y++}else if(C.isRectAreaLight){const V=e.get(C);V.color.copy(O).multiplyScalar(Y),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),n.rectArea[g]=V,g++}else if(C.isPointLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){const H=C.shadow,K=t.get(C);K.shadowIntensity=H.intensity,K.shadowBias=H.bias,K.shadowNormalBias=H.normalBias,K.shadowRadius=H.radius,K.shadowMapSize=H.mapSize,K.shadowCameraNear=H.camera.near,K.shadowCameraFar=H.camera.far,n.pointShadow[_]=K,n.pointShadowMap[_]=N,n.pointShadowMatrix[_]=C.shadow.matrix,E++}n.point[_]=V,_++}else if(C.isHemisphereLight){const V=e.get(C);V.skyColor.copy(C.color).multiplyScalar(Y),V.groundColor.copy(C.groundColor).multiplyScalar(Y),n.hemi[f]=V,f++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pe.LTC_FLOAT_1,n.rectAreaLTC2=pe.LTC_FLOAT_2):(n.rectAreaLTC1=pe.LTC_HALF_1,n.rectAreaLTC2=pe.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=m,n.ambient[2]=u;const v=n.hash;(v.directionalLength!==p||v.pointLength!==_||v.spotLength!==y||v.rectAreaLength!==g||v.hemiLength!==f||v.numDirectionalShadows!==S||v.numPointShadows!==E||v.numSpotShadows!==b||v.numSpotMaps!==w||v.numLightProbes!==P)&&(n.directional.length=p,n.spot.length=y,n.rectArea.length=g,n.point.length=_,n.hemi.length=f,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=b+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=P,v.directionalLength=p,v.pointLength=_,v.spotLength=y,v.rectAreaLength=g,v.hemiLength=f,v.numDirectionalShadows=S,v.numPointShadows=E,v.numSpotShadows=b,v.numSpotMaps=w,v.numLightProbes=P,n.version=Yg++)}function l(c,d){let m=0,u=0,p=0,_=0,y=0;const g=d.matrixWorldInverse;for(let f=0,S=c.length;f<S;f++){const E=c[f];if(E.isDirectionalLight){const b=n.directional[m];b.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),m++}else if(E.isSpotLight){const b=n.spot[p];b.position.setFromMatrixPosition(E.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),p++}else if(E.isRectAreaLight){const b=n.rectArea[_];b.position.setFromMatrixPosition(E.matrixWorld),b.position.applyMatrix4(g),a.identity(),s.copy(E.matrixWorld),s.premultiply(g),a.extractRotation(s),b.halfWidth.set(E.width*.5,0,0),b.halfHeight.set(0,E.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),_++}else if(E.isPointLight){const b=n.point[u];b.position.setFromMatrixPosition(E.matrixWorld),b.position.applyMatrix4(g),u++}else if(E.isHemisphereLight){const b=n.hemi[y];b.direction.setFromMatrixPosition(E.matrixWorld),b.direction.transformDirection(g),y++}}}return{setup:o,setupView:l,state:n}}function kl(i){const e=new Kg(i),t=[],n=[],r=[];function s(u){m.camera=u,t.length=0,n.length=0,r.length=0}function a(u){t.push(u)}function o(u){n.push(u)}function l(u){r.push(u)}function c(){e.setup(t)}function d(u){e.setupView(t,u)}const m={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:m,setupLights:c,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function Zg(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new kl(i),e.set(r,[o])):s>=a.length?(o=new kl(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Jg=`void main() { 4062 gl_Position = vec4( position, 1.0 ); 4063}`,jg=`uniform sampler2D shadow_pass; 4064uniform vec2 resolution; 4065uniform float radius; 4066void main() {
4067 const float samples = float( VSM_SAMPLES ); 4068 float mean = 0.0; 4069 float squared_mean = 0.0; 4070 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4071 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4072 for ( float i = 0.0; i < samples; i ++ ) { 4073 float uvOffset = uvStart + i * uvStride; 4074 #ifdef HORIZONTAL_PASS 4075 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4076 mean += distribution.x; 4077 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4078 #else 4079 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4080 mean += depth; 4081 squared_mean += depth * depth; 4082 #endif 4083 } 4084 mean = mean / samples; 4085 squared_mean = squared_mean / samples; 4086 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4087 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4088}`,Qg=[new L(1,0,0),new L(-1,0,0),new L(0,1,0),new L(0,-1,0),new L(0,0,1),new L(0,0,-1)],e_=[new L(0,-1,0),new L(0,-1,0),new L(0,0,1),new L(0,0,-1),new L(0,-1,0),new L(0,-1,0)],Hl=new ut,er=new L,Qs=new L;function t_(i,e,t){let n=new po;const r=new Te,s=new Te,a=new pt,o=new ad,l=new od,c={},d=t.maxTextureSize,m={[jn]:Dt,[Dt]:jn,[Dn]:Dn},u=new En({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:Jg,fragmentShader:jg}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const _=new Ct;_.setAttribute("position",new rn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new St(_,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Yr;let f=this.type;this.render=function(T,P,v){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;this.type===pu&&(Ce("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Yr);const A=i.getRenderTarget(),U=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),O=i.state;O.setBlending(Nn),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 Y=f!==this.type;Y&&P.traverse(function($){$.material&&(Array.isArray($.material)?$.material.forEach(N=>N.needsUpdate=!0):$.material.needsUpdate=!0)});for(let $=0,N=T.length;$<N;$++){const V=T[$],H=V.shadow;if(H===void 0){Ce("WebGLShadowMap:",V,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;r.copy(H.mapSize);const K=H.getFrameExtents();r.multiply(K),s.copy(H.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/K.x),r.x=s.x*K.x,H.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/K.y),r.y=s.y*K.y,H.mapSize.y=s.y));const Z=i.state.buffers.depth.getReversed();if(H.camera._reversedDepth=Z,H.map===null||Y===!0){if(H.map!==null&&(H.map.depthTexture!==null&&(H.map.depthTexture.dispose(),H.map.depthTexture=null),H.map.dispose()),this.type===tr){if(V.isPointLight){Ce("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}H.map=new Sn(r.x,r.y,{format:di,type:Bn,minFilter:Bt,magFilter:Bt,generateMipmaps:!1}),H.map.texture.name=V.name+".shadowMap",H.map.depthTexture=new ki(r.x,r.y,vn),H.map.depthTexture.name=V.name+".shadowMapDepth",H.map.depthTexture.format=zn,H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Et,H.map.depthTexture.magFilter=Et}else V.isPointLight?(H.map=new Uc(r.x),H.map.depthTexture=new Bh(r.x,yn)):(H.map=new Sn(r.x,r.y),H.map.depthTexture=new ki(r.x,r.y,yn)),H.map.depthTexture.name=V.name+".shadowMap",H.map.depthTexture.format=zn,this.type===Yr?(H.map.depthTexture.compareFunction=Z?co:lo,H.map.depthTexture.minFilter=Bt,H.map.depthTexture.magFilter=Bt):(H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Et,H.map.depthTexture.magFilter=Et);H.camera.updateProjectionMatrix()}const he=H.map.isWebGLCubeRenderTarget?6:1;for(let re=0;re<he;re++){if(H.map.isWebGLCubeRenderTarget)i.setRenderTarget(H.map,re),i.clear();else{re===0&&(i.setRenderTarget(H.map),i.clear());const _e=H.getViewport(re);a.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),O.viewport(a)}if(V.isPointLight){const _e=H.camera,Oe=H.matrix,Ze=V.distance||_e.far;Ze!==_e.far&&(_e.far=Ze,_e.updateProjectionMatrix()),er.setFromMatrixPosition(V.matrixWorld),_e.position.copy(er),Qs.copy(_e.position),Qs.add(Qg[re]),_e.up.copy(e_[re]),_e.lookAt(Qs),_e.updateMatrixWorld(),Oe.makeTranslation(-er.x,-er.y,-er.z),Hl.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),H._frustum.setFromProjectionMatrix(Hl,_e.coordinateSystem,_e.reversedDepth)}else H.updateMatrices(V);n=H.getFrustum(),b(P,v,H.camera,V,this.type)}H.isPointLightShadow!==!0&&this.type===tr&&S(H,v),H.needsUpdate=!1}f=this.type,g.needsUpdate=!1,i.setRenderTarget(A,U,C)};function S(T,P){const v=e.update(y);u.defines.VSM_SAMPLES!==T.blurSamples&&(u.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Sn(r.x,r.y,{format:di,type:Bn})),u.uniforms.shadow_pass.value=T.map.depthTexture,u.uniforms.resolution.value=T.mapSize,u.uniforms.radius.value=T.radiu
vendor: 8,464 bytes, line 4088
4088s,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(P,null,v,u,y,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(P,null,v,p,y,null)}function E(T,P,v,A){let U=null;const C=v.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(C!==void 0)U=C;else if(U=v.isPointLight===!0?l:o,i.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const O=U.uuid,Y=P.uuid;let $=c[O];$===void 0&&($={},c[O]=$);let N=$[Y];N===void 0&&(N=U.clone(),$[Y]=N,P.addEventListener("dispose",w)),U=N}if(U.visible=P.visible,U.wireframe=P.wireframe,A===tr?U.side=P.shadowSide!==null?P.shadowSide:P.side:U.side=P.shadowSide!==null?P.shadowSide:m[P.side],U.alphaMap=P.alphaMap,U.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,U.map=P.map,U.clipShadows=P.clipShadows,U.clippingPlanes=P.clippingPlanes,U.clipIntersection=P.clipIntersection,U.displacementMap=P.displacementMap,U.displacementScale=P.displacementScale,U.displacementBias=P.displacementBias,U.wireframeLinewidth=P.wireframeLinewidth,U.linewidth=P.linewidth,v.isPointLight===!0&&U.isMeshDistanceMaterial===!0){const O=i.properties.get(U);O.light=v}return U}function b(T,P,v,A,U){if(T.visible===!1)return;if(T.layers.test(P.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&U===tr)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,T.matrixWorld);const Y=e.update(T),$=T.material;if(Array.isArray($)){const N=Y.groups;for(let V=0,H=N.length;V<H;V++){const K=N[V],Z=$[K.materialIndex];if(Z&&Z.visible){const he=E(T,Z,A,U);T.onBeforeShadow(i,T,P,v,Y,he,K),i.renderBufferDirect(v,null,Y,he,T,K),T.onAfterShadow(i,T,P,v,Y,he,K)}}}else if($.visible){const N=E(T,$,A,U);T.onBeforeShadow(i,T,P,v,Y,N,null),i.renderBufferDirect(v,null,Y,N,T,null),T.onAfterShadow(i,T,P,v,Y,N,null)}}const O=T.children;for(let Y=0,$=O.length;Y<$;Y++)b(O[Y],P,v,A,U)}function w(T){T.target.removeEventListener("dispose",w);for(const v in c){const A=c[v],U=T.target.uuid;U in A&&(A[U].dispose(),delete A[U])}}}function n_(i,e){function t(){let D=!1;const ce=new pt;let j=null;const xe=new pt(0,0,0,0);return{setMask:function(de){j!==de&&!D&&(i.colorMask(de,de,de,de),j=de)},setLocked:function(de){D=de},setClear:function(de,ne,Ee,Ne,_t){_t===!0&&(de*=Ne,ne*=Ne,Ee*=Ne),ce.set(de,ne,Ee,Ne),xe.equals(ce)===!1&&(i.clearColor(de,ne,Ee,Ne),xe.copy(ce))},reset:function(){D=!1,j=null,xe.set(-1,0,0,0)}}}function n(){let D=!1,ce=!1,j=null,xe=null,de=null;return{setReversed:function(ne){if(ce!==ne){const Ee=e.get("EXT_clip_control");ne?Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.ZERO_TO_ONE_EXT):Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.NEGATIVE_ONE_TO_ONE_EXT),ce=ne;const Ne=de;de=null,this.setClear(Ne)}},getReversed:function(){return ce},setTest:function(ne){ne?oe(i.DEPTH_TEST):we(i.DEPTH_TEST)},setMask:function(ne){j!==ne&&!D&&(i.depthMask(ne),j=ne)},setFunc:function(ne){if(ce&&(ne=Yu[ne]),xe!==ne){switch(ne){case oa:i.depthFunc(i.NEVER);break;case la:i.depthFunc(i.ALWAYS);break;case ca:i.depthFunc(i.LESS);break;case Gi:i.depthFunc(i.LEQUAL);break;case ua:i.depthFunc(i.EQUAL);break;case ha:i.depthFunc(i.GEQUAL);break;case da:i.depthFunc(i.GREATER);break;case fa:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}xe=ne}},setLocked:function(ne){D=ne},setClear:function(ne){de!==ne&&(de=ne,ce&&(ne=1-ne),i.clearDepth(ne))},reset:function(){D=!1,j=null,xe=null,de=null,ce=!1}}}function r(){let D=!1,ce=null,j=null,xe=null,de=null,ne=null,Ee=null,Ne=null,_t=null;return{setTest:function(rt){D||(rt?oe(i.STENCIL_TEST):we(i.STENCIL_TEST))},setMask:function(rt){ce!==rt&&!D&&(i.stencilMask(rt),ce=rt)},setFunc:function(rt,bn,fn){(j!==rt||xe!==bn||de!==fn)&&(i.stencilFunc(rt,bn,fn),j=rt,xe=bn,de=fn)},setOp:function(rt,bn,fn){(ne!==rt||Ee!==bn||Ne!==fn)&&(i.stencilOp(rt,bn,fn),ne=rt,Ee=bn,Ne=fn)},setLocked:function(rt){D=rt},setClear:function(rt){_t!==rt&&(i.clearStencil(rt),_t=rt)},reset:function(){D=!1,ce=null,j=null,xe=null,de=null,ne=null,Ee=null,Ne=null,_t=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let d={},m={},u={},p=new WeakMap,_=[],y=null,g=!1,f=null,S=null,E=null,b=null,w=null,T=null,P=null,v=new Ye(0,0,0),A=0,U=!1,C=null,O=null,Y=null,$=null,N=null;const V=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,K=0;const Z=i.getParameter(i.VERSION);Z.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(Z)[1]),H=K>=1):Z.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),H=K>=2);let he=null,re={};const _e=i.getParameter(i.SCISSOR_BOX),Oe=i.getParameter(i.VIEWPORT),Ze=new pt().fromArray(_e),Le=new pt().fromArray(Oe);function ee(D,ce,j,xe){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 Ee=0;Ee<j;Ee++)D===i.TEXTURE_3D||D===i.TEXTURE_2D_ARRAY?i.texImage3D(ce,0,i.RGBA,1,1,xe,0,i.RGBA,i.UNSIGNED_BYTE,de):i.texImage2D(ce+Ee,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,de);return ne}const fe={};fe[i.TEXTURE_2D]=ee(i.TEXTURE_2D,i.TEXTURE_2D,1),fe[i.TEXTURE_CUBE_MAP]=ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[i.TEXTURE_2D_ARRAY]=ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),fe[i.TEXTURE_3D]=ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),oe(i.DEPTH_TEST),a.setFunc(Gi),mt(!1),ct(Fo),oe(i.CULL_FACE),it(Nn);function oe(D){d[D]!==!0&&(i.enable(D),d[D]=!0)}function we(D){d[D]!==!1&&(i.disable(D),d[D]=!1)}function De(D,ce){return u[D]!==ce?(i.bindFramebuffer(D,ce),u[D]=ce,D===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ce),D===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ce),!0):!1}function Re(D,ce){let j=_,xe=!1;if(D){j=p.get(ce),j===void 0&&(j=[],p.set(ce,j));const de=D.textures;if(j.length!==de.length||j[0]!==i.COLOR_ATTACHMENT0){for(let ne=0,Ee=de.length;ne<Ee;ne++)j[ne]=i.COLOR_ATTACHMENT0+ne;j.length=de.length,xe=!0}}else j[0]!==i.BACK&&(j[0]=i.BACK,xe=!0);xe&&i.drawBuffers(j)}function ht(D){return y!==D?(i.useProgram(D),y=D,!0):!1}const We={[oi]:i.FUNC_ADD,[gu]:i.FUNC_SUBTRACT,[_u]:i.FUNC_REVERSE_SUBTRACT};We[vu]=i.MIN,We[xu]=i.MAX;const je={[Mu]:i.ZERO,[Su]:i.ONE,[yu]:i.SRC_COLOR,[sa]:i.SRC_ALPHA,[Ru]:i.SRC_ALPHA_SATURATE,[Au]:i.DST_COLOR,[bu]:i.DST_ALPHA,[Eu]:i.ONE_MINUS_SRC_COLOR,[aa]:i.ONE_MINUS_SRC_ALPHA,[wu]:i.ONE_MINUS_DST_COLOR,[Tu]:i.ONE_MINUS_DST_ALPHA,[Cu]:i.CONSTANT_COLOR,[Pu]:i.ONE_MINUS_CONSTANT_COLOR,[Lu]:i.CONSTANT_ALPHA,[Du]:i.ONE_MINUS_CONSTANT_ALPHA};function it(D,ce,j,xe,de,ne,Ee,Ne,_t,rt){if(D===Nn){g===!0&&(we(i.BLEND),g=!1);return}if(g===!1&&(oe(i.BLEND),g=!0),D!==mu){if(D!==f||rt!==U){if((S!==oi||w!==oi)&&(i.blendEquation(i.FUNC_ADD),S=oi,w=oi),rt)switch(D){case Bi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case kt:i.blendFunc(i.ONE,i.ONE);break;case Oo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Bo:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:$e("WebGLState: Invalid blending: ",D);break}else switch(D){case Bi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case kt:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Oo:$e("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Bo:$e("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:$e("WebGLState: Invalid blending: ",D);break}E=null,b=null,T=null,P=null,v.set(0,0,0),A=0,f=D,U=rt}return}de=de||ce,ne=ne||j,Ee=Ee||xe,(ce!==S||de!==w)&&(i.blendEquationSeparate(We[ce],We[de]),S=ce,w=de),(j!==E||xe!==b||ne!==T||Ee!==P)&&(i.blendFuncSeparate(je[j],je[xe],je[ne],je[Ee]),E=j,b=xe,T=ne,P=Ee),(Ne.equals(v)===!1||_t!==A)&&(i.blendColor(Ne.r,Ne.g,Ne.b,_t),v.copy(Ne),A=_t),f=D,U=!1}function Ge(D,ce){D.side===Dn?we(i.CULL_FACE):oe(i.CULL_FACE);let j=D.side===Dt;ce&&(j=!j),mt(j),D.blending===Bi&&D.transparent===!1?it(Nn):it(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 xe=D.stencilWrite;
vendor: 9,602 bytes, line 4088
4088o.setTest(xe),xe&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),I(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?oe(i.SAMPLE_ALPHA_TO_COVERAGE):we(i.SAMPLE_ALPHA_TO_COVERAGE)}function mt(D){C!==D&&(D?i.frontFace(i.CW):i.frontFace(i.CCW),C=D)}function ct(D){D!==du?(oe(i.CULL_FACE),D!==O&&(D===Fo?i.cullFace(i.BACK):D===fu?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):we(i.CULL_FACE),O=D}function zt(D){D!==Y&&(H&&i.lineWidth(D),Y=D)}function I(D,ce,j){D?(oe(i.POLYGON_OFFSET_FILL),($!==ce||N!==j)&&($=ce,N=j,a.getReversed()&&(ce=-ce),i.polygonOffset(ce,j))):we(i.POLYGON_OFFSET_FILL)}function gt(D){D?oe(i.SCISSOR_TEST):we(i.SCISSOR_TEST)}function Be(D){D===void 0&&(D=i.TEXTURE0+V-1),he!==D&&(i.activeTexture(D),he=D)}function et(D,ce,j){j===void 0&&(he===null?j=i.TEXTURE0+V-1:j=he);let xe=re[j];xe===void 0&&(xe={type:void 0,texture:void 0},re[j]=xe),(xe.type!==D||xe.texture!==ce)&&(he!==j&&(i.activeTexture(j),he=j),i.bindTexture(D,ce||fe[D]),xe.type=D,xe.texture=ce)}function z(){const D=re[he];D!==void 0&&D.type!==void 0&&(i.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function se(){try{i.compressedTexImage2D(...arguments)}catch(D){$e("WebGLState:",D)}}function x(){try{i.compressedTexImage3D(...arguments)}catch(D){$e("WebGLState:",D)}}function h(){try{i.texSubImage2D(...arguments)}catch(D){$e("WebGLState:",D)}}function R(){try{i.texSubImage3D(...arguments)}catch(D){$e("WebGLState:",D)}}function X(){try{i.compressedTexSubImage2D(...arguments)}catch(D){$e("WebGLState:",D)}}function Q(){try{i.compressedTexSubImage3D(...arguments)}catch(D){$e("WebGLState:",D)}}function te(){try{i.texStorage2D(...arguments)}catch(D){$e("WebGLState:",D)}}function ie(){try{i.texStorage3D(...arguments)}catch(D){$e("WebGLState:",D)}}function q(){try{i.texImage2D(...arguments)}catch(D){$e("WebGLState:",D)}}function J(){try{i.texImage3D(...arguments)}catch(D){$e("WebGLState:",D)}}function ue(D){return m[D]!==void 0?m[D]:i.getParameter(D)}function ve(D,ce){m[D]!==ce&&(i.pixelStorei(D,ce),m[D]=ce)}function ae(D){Ze.equals(D)===!1&&(i.scissor(D.x,D.y,D.z,D.w),Ze.copy(D))}function le(D){Le.equals(D)===!1&&(i.viewport(D.x,D.y,D.z,D.w),Le.copy(D))}function Ie(D,ce){let j=c.get(ce);j===void 0&&(j=new WeakMap,c.set(ce,j));let xe=j.get(D);xe===void 0&&(xe=i.getUniformBlockIndex(ce,D.name),j.set(D,xe))}function ze(D,ce){const xe=c.get(ce).get(D);l.get(ce)!==xe&&(i.uniformBlockBinding(ce,xe,D.__bindingPointIndex),l.set(ce,xe))}function Je(){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={},m={},he=null,re={},u={},p=new WeakMap,_=[],y=null,g=!1,f=null,S=null,E=null,b=null,w=null,T=null,P=null,v=new Ye(0,0,0),A=0,U=!1,C=null,O=null,Y=null,$=null,N=null,Ze.set(0,0,i.canvas.width,i.canvas.height),Le.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:oe,disable:we,bindFramebuffer:De,drawBuffers:Re,useProgram:ht,setBlending:it,setMaterial:Ge,setFlipSided:mt,setCullFace:ct,setLineWidth:zt,setPolygonOffset:I,setScissorTest:gt,activeTexture:Be,bindTexture:et,unbindTexture:z,compressedTexImage2D:se,compressedTexImage3D:x,texImage2D:q,texImage3D:J,pixelStorei:ve,getParameter:ue,updateUBOMapping:Ie,uniformBlockBinding:ze,texStorage2D:te,texStorage3D:ie,texSubImage2D:h,texSubImage3D:R,compressedTexSubImage2D:X,compressedTexSubImage3D:Q,scissor:ae,viewport:le,reset:Je}}function i_(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Te,d=new WeakMap,m=new Set;let u;const p=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(x,h){return _?new OffscreenCanvas(x,h):ur("canvas")}function g(x,h,R){let X=1;const Q=se(x);if((Q.width>R||Q.height>R)&&(X=R/Math.max(Q.width,Q.height)),X<1)if(typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&x instanceof ImageBitmap||typeof VideoFrame<"u"&&x instanceof VideoFrame){const te=Math.floor(X*Q.width),ie=Math.floor(X*Q.height);u===void 0&&(u=y(te,ie));const q=h?y(te,ie):u;return q.width=te,q.height=ie,q.getContext("2d").drawImage(x,0,0,te,ie),Ce("WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+te+"x"+ie+")."),q}else return"data"in x&&Ce("WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),x;return x}function f(x){return x.generateMipmaps}function S(x){i.generateMipmap(x)}function E(x){return x.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:x.isWebGL3DRenderTarget?i.TEXTURE_3D:x.isWebGLArrayRenderTarget||x.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function b(x,h,R,X,Q,te=!1){if(x!==null){if(i[x]!==void 0)return i[x];Ce("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+x+"'")}let ie;X&&(ie=e.get("EXT_texture_norm16"),ie||Ce("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let q=h;if(h===i.RED&&(R===i.FLOAT&&(q=i.R32F),R===i.HALF_FLOAT&&(q=i.R16F),R===i.UNSIGNED_BYTE&&(q=i.R8),R===i.UNSIGNED_SHORT&&ie&&(q=ie.R16_EXT),R===i.SHORT&&ie&&(q=ie.R16_SNORM_EXT)),h===i.RED_INTEGER&&(R===i.UNSIGNED_BYTE&&(q=i.R8UI),R===i.UNSIGNED_SHORT&&(q=i.R16UI),R===i.UNSIGNED_INT&&(q=i.R32UI),R===i.BYTE&&(q=i.R8I),R===i.SHORT&&(q=i.R16I),R===i.INT&&(q=i.R32I)),h===i.RG&&(R===i.FLOAT&&(q=i.RG32F),R===i.HALF_FLOAT&&(q=i.RG16F),R===i.UNSIGNED_BYTE&&(q=i.RG8),R===i.UNSIGNED_SHORT&&ie&&(q=ie.RG16_EXT),R===i.SHORT&&ie&&(q=ie.RG16_SNORM_EXT)),h===i.RG_INTEGER&&(R===i.UNSIGNED_BYTE&&(q=i.RG8UI),R===i.UNSIGNED_SHORT&&(q=i.RG16UI),R===i.UNSIGNED_INT&&(q=i.RG32UI),R===i.BYTE&&(q=i.RG8I),R===i.SHORT&&(q=i.RG16I),R===i.INT&&(q=i.RG32I)),h===i.RGB_INTEGER&&(R===i.UNSIGNED_BYTE&&(q=i.RGB8UI),R===i.UNSIGNED_SHORT&&(q=i.RGB16UI),R===i.UNSIGNED_INT&&(q=i.RGB32UI),R===i.BYTE&&(q=i.RGB8I),R===i.SHORT&&(q=i.RGB16I),R===i.INT&&(q=i.RGB32I)),h===i.RGBA_INTEGER&&(R===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),R===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),R===i.UNSIGNED_INT&&(q=i.RGBA32UI),R===i.BYTE&&(q=i.RGBA8I),R===i.SHORT&&(q=i.RGBA16I),R===i.INT&&(q=i.RGBA32I)),h===i.RGB&&(R===i.UNSIGNED_SHORT&&ie&&(q=ie.RGB16_EXT),R===i.SHORT&&ie&&(q=ie.RGB16_SNORM_EXT),R===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),R===i.UNSIGNED_INT_10F_11F_11F_REV&&(q=i.R11F_G11F_B10F)),h===i.RGBA){const J=te?ns:qe.getTransfer(Q);R===i.FLOAT&&(q=i.RGBA32F),R===i.HALF_FLOAT&&(q=i.RGBA16F),R===i.UNSIGNED_BYTE&&(q=J===tt?i.SRGB8_ALPHA8:i.RGBA8),R===i.UNSIGNED_SHORT&&ie&&(q=ie.RGBA16_EXT),R===i.SHORT&&ie&&(q=ie.RGBA16_SNORM_EXT),R===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),R===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function w(x,h){let R;return x?h===null||h===yn||h===lr?R=i.DEPTH24_STENCIL8:h===vn?R=i.DEPTH32F_STENCIL8:h===or&&(R=i.DEPTH24_STENCIL8,Ce("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):h===null||h===yn||h===lr?R=i.DEPTH_COMPONENT24:h===vn?R=i.DEPTH_COMPONENT32F:h===or&&(R=i.DEPTH_COMPONENT16),R}function T(x,h){return f(x)===!0||x.isFramebufferTexture&&x.minFilter!==Et&&x.minFilter!==Bt?Math.log2(Math.max(h.width,h.height))+1:x.mipmaps!==void 0&&x.mipmaps.length>0?x.mipmaps.length:x.isCompressedTexture&&Array.isArray(x.image)?h.mipmaps.length:1}function P(x){const h=x.target;h.removeEventListener("dispose",P),A(h),h.isVideoTexture&&d.delete(h),h.isHTMLTexture&&m.delete(h)}function v(x){const h=x.target;h.removeEventListener("dispose",v),C(h)}function A(x){const h=n.get(x);if(h.__webglInit===void 0)return;const R=x.source,X=p.get(R);if(X){const Q=X[h.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&U(x),Object.keys(X).length===0&&p.delete(R)}n.remove(x)}function U(x){const h=n.get(x);i.deleteTexture(h.__webglTexture);const R=x.source,X=p.get(R);delete X[h.__cacheKey],a.memory.textures--}function C(x){const h=n.get(x);if(x.depthTexture&&(x.depthTexture.dispose(),n.remove(x.depthTexture)),x.isWebG
vendor: 6,259 bytes, line 4088
4088LCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(h.__webglFramebuffer[X]))for(let Q=0;Q<h.__webglFramebuffer[X].length;Q++)i.deleteFramebuffer(h.__webglFramebuffer[X][Q]);else i.deleteFramebuffer(h.__webglFramebuffer[X]);h.__webglDepthbuffer&&i.deleteRenderbuffer(h.__webglDepthbuffer[X])}else{if(Array.isArray(h.__webglFramebuffer))for(let X=0;X<h.__webglFramebuffer.length;X++)i.deleteFramebuffer(h.__webglFramebuffer[X]);else i.deleteFramebuffer(h.__webglFramebuffer);if(h.__webglDepthbuffer&&i.deleteRenderbuffer(h.__webglDepthbuffer),h.__webglMultisampledFramebuffer&&i.deleteFramebuffer(h.__webglMultisampledFramebuffer),h.__webglColorRenderbuffer)for(let X=0;X<h.__webglColorRenderbuffer.length;X++)h.__webglColorRenderbuffer[X]&&i.deleteRenderbuffer(h.__webglColorRenderbuffer[X]);h.__webglDepthRenderbuffer&&i.deleteRenderbuffer(h.__webglDepthRenderbuffer)}const R=x.textures;for(let X=0,Q=R.length;X<Q;X++){const te=n.get(R[X]);te.__webglTexture&&(i.deleteTexture(te.__webglTexture),a.memory.textures--),n.remove(R[X])}n.remove(x)}let O=0;function Y(){O=0}function $(){return O}function N(x){O=x}function V(){const x=O;return x>=r.maxTextures&&Ce("WebGLTextures: Trying to use "+x+" texture units while this GPU supports only "+r.maxTextures),O+=1,x}function H(x){const h=[];return h.push(x.wrapS),h.push(x.wrapT),h.push(x.wrapR||0),h.push(x.magFilter),h.push(x.minFilter),h.push(x.anisotropy),h.push(x.internalFormat),h.push(x.format),h.push(x.type),h.push(x.generateMipmaps),h.push(x.premultiplyAlpha),h.push(x.flipY),h.push(x.unpackAlignment),h.push(x.colorSpace),h.join()}function K(x,h){const R=n.get(x);if(x.isVideoTexture&&et(x),x.isRenderTargetTexture===!1&&x.isExternalTexture!==!0&&x.version>0&&R.__version!==x.version){const X=x.image;if(X===null)Ce("WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)Ce("WebGLRenderer: Texture marked for update but image is incomplete");else{we(R,x,h);return}}else x.isExternalTexture&&(R.__webglTexture=x.sourceTexture?x.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,R.__webglTexture,i.TEXTURE0+h)}function Z(x,h){const R=n.get(x);if(x.isRenderTargetTexture===!1&&x.version>0&&R.__version!==x.version){we(R,x,h);return}else x.isExternalTexture&&(R.__webglTexture=x.sourceTexture?x.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,R.__webglTexture,i.TEXTURE0+h)}function he(x,h){const R=n.get(x);if(x.isRenderTargetTexture===!1&&x.version>0&&R.__version!==x.version){we(R,x,h);return}t.bindTexture(i.TEXTURE_3D,R.__webglTexture,i.TEXTURE0+h)}function re(x,h){const R=n.get(x);if(x.isCubeDepthTexture!==!0&&x.version>0&&R.__version!==x.version){De(R,x,h);return}t.bindTexture(i.TEXTURE_CUBE_MAP,R.__webglTexture,i.TEXTURE0+h)}const _e={[pa]:i.REPEAT,[Un]:i.CLAMP_TO_EDGE,[ma]:i.MIRRORED_REPEAT},Oe={[Et]:i.NEAREST,[Nu]:i.NEAREST_MIPMAP_NEAREST,[_r]:i.NEAREST_MIPMAP_LINEAR,[Bt]:i.LINEAR,[vs]:i.LINEAR_MIPMAP_NEAREST,[ci]:i.LINEAR_MIPMAP_LINEAR},Ze={[Bu]:i.NEVER,[Hu]:i.ALWAYS,[zu]:i.LESS,[lo]:i.LEQUAL,[Gu]:i.EQUAL,[co]:i.GEQUAL,[Vu]:i.GREATER,[ku]:i.NOTEQUAL};function Le(x,h){if(h.type===vn&&e.has("OES_texture_float_linear")===!1&&(h.magFilter===Bt||h.magFilter===vs||h.magFilter===_r||h.magFilter===ci||h.minFilter===Bt||h.minFilter===vs||h.minFilter===_r||h.minFilter===ci)&&Ce("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(x,i.TEXTURE_WRAP_S,_e[h.wrapS]),i.texParameteri(x,i.TEXTURE_WRAP_T,_e[h.wrapT]),(x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY)&&i.texParameteri(x,i.TEXTURE_WRAP_R,_e[h.wrapR]),i.texParameteri(x,i.TEXTURE_MAG_FILTER,Oe[h.magFilter]),i.texParameteri(x,i.TEXTURE_MIN_FILTER,Oe[h.minFilter]),h.compareFunction&&(i.texParameteri(x,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(x,i.TEXTURE_COMPARE_FUNC,Ze[h.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(h.magFilter===Et||h.minFilter!==_r&&h.minFilter!==ci||h.type===vn&&e.has("OES_texture_float_linear")===!1)return;if(h.anisotropy>1||n.get(h).__currentAnisotropy){const R=e.get("EXT_texture_filter_anisotropic");i.texParameterf(x,R.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(h.anisotropy,r.getMaxAnisotropy())),n.get(h).__currentAnisotropy=h.anisotropy}}}function ee(x,h){let R=!1;x.__webglInit===void 0&&(x.__webglInit=!0,h.addEventListener("dispose",P));const X=h.source;let Q=p.get(X);Q===void 0&&(Q={},p.set(X,Q));const te=H(h);if(te!==x.__cacheKey){Q[te]===void 0&&(Q[te]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,R=!0),Q[te].usedTimes++;const ie=Q[x.__cacheKey];ie!==void 0&&(Q[x.__cacheKey].usedTimes--,ie.usedTimes===0&&U(h)),x.__cacheKey=te,x.__webglTexture=Q[te].texture}return R}function fe(x,h,R){return Math.floor(Math.floor(x/R)/h)}function oe(x,h,R,X){const te=x.updateRanges;if(te.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,h.width,h.height,R,X,h.data);else{te.sort((ve,ae)=>ve.start-ae.start);let ie=0;for(let ve=1;ve<te.length;ve++){const ae=te[ie],le=te[ve],Ie=ae.start+ae.count,ze=fe(le.start,h.width,4),Je=fe(ae.start,h.width,4);le.start<=Ie+1&&ze===Je&&fe(le.start+le.count-1,h.width,4)===ze?ae.count=Math.max(ae.count,le.start+le.count-ae.start):(++ie,te[ie]=le)}te.length=ie+1;const q=t.getParameter(i.UNPACK_ROW_LENGTH),J=t.getParameter(i.UNPACK_SKIP_PIXELS),ue=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,h.width);for(let ve=0,ae=te.length;ve<ae;ve++){const le=te[ve],Ie=Math.floor(le.start/4),ze=Math.ceil(le.count/4),Je=Ie%h.width,D=Math.floor(Ie/h.width),ce=ze,j=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,D),t.texSubImage2D(i.TEXTURE_2D,0,Je,D,ce,j,R,X,h.data)}x.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,q),t.pixelStorei(i.UNPACK_SKIP_PIXELS,J),t.pixelStorei(i.UNPACK_SKIP_ROWS,ue)}}function we(x,h,R){let X=i.TEXTURE_2D;(h.isDataArrayTexture||h.isCompressedArrayTexture)&&(X=i.TEXTURE_2D_ARRAY),h.isData3DTexture&&(X=i.TEXTURE_3D);const Q=ee(x,h),te=h.source;t.bindTexture(X,x.__webglTexture,i.TEXTURE0+R);const ie=n.get(te);if(te.version!==ie.__version||Q===!0){if(t.activeTexture(i.TEXTURE0+R),(typeof ImageBitmap<"u"&&h.image instanceof ImageBitmap)===!1){const j=qe.getPrimaries(qe.workingColorSpace),xe=h.colorSpace
4088===Zn?null:qe.getPrimaries(h.colorSpace),de=h.colorSpace===Zn||j===xe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,h.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,de)}t.pixelStorei(i.UNPACK_ALIGNMENT,h.unpackAlignment);let J=g(h.image,!1,r.maxTextureSize);J=z(h,J);const ue=s.convert(h.format,h.colorSpace),ve=s.convert(h.type);let ae=b(h.internalFormat,ue,ve,h.normalized,h.colorSpace,h.isVideoTexture);Le(X,h);let le;const Ie=h.mipmaps,ze=h.isVideoTexture!==!0,Je=ie.__version===void 0||Q===!0,D=te.dataReady,ce=T(h,J);if(h.isDepthTexture)ae=w(h.format===ui,h.type),Je&&(ze?t.texStorage2D(i.TEXTURE_2D,1,ae,J.width,J.height):t.texImage2D(i.TEXTURE_2D,0,ae,J.width,J.height,0,ue,ve,null));else if(h.isDataTexture)if(Ie.length>0){ze&&Je&&t.texStorage2D(i.TEXTURE_2D,ce,ae,Ie[0].width,Ie[0].height);for(let j=0,xe=Ie.length;j<xe;j++)le=Ie[j],ze?D&&t.texSubImage2D(i.TEXTURE_2D,j,0,0,le.width,le.height,ue,ve,le.data):t.texImage2D(i.TEXTURE_2D,j,ae,le.width,le.height,0,ue,ve,le.data);h.generateMipmaps=!1}else ze?(Je&&t.texStorage2D(i.TEXTURE_2D,ce,ae,J.width,J.height),D&&oe(h,J,ue,ve)):t.texImage2D(i.TEXTURE_2D,0,ae,J.width,J.height,0,ue,ve,J.data);else if(h.isCompressedTexture)if(h.isCompressedArrayTexture){ze&&Je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ce,ae,Ie[0].width,Ie[0].height,J.depth);for(let j=0,xe=Ie.length;j<xe;j++)if(le=Ie[j],h.format!==un)if(ue!==null)if(ze){if(D)if(h.layerUpdates.size>0){const de=Ml(le.width,le.height,h.format,h.type);for(const ne of h.layerUpdates){const Ee=le.data.subarray(ne*de/le.data.BYTES_PER_ELEMENT,(ne+1)*de/le.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,j,0,0,ne,le.width,le.height,1,ue,Ee)}h.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,j,0,0,0,le.width,le.height,J.depth,ue,le.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,j,ae,le.width,le.height,J.depth,0,le.data,0,0);else Ce("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ze?D&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,j,0,0,0,le.width,le.height,J.depth,ue,ve,le.data):t.texImage3D(i.TEXTURE_2D_ARRAY,j,ae,le.width,le.height,J.depth,0,ue,ve,le.data)}else{ze&&Je&&t.texStorage2D(i.TEXTURE_2D,ce,ae,Ie[0].width,Ie[0].height);for(let j=0,xe=Ie.length;j<xe;j++)le=Ie[j],h.format!==un?ue!==null?ze?D&&t.compressedTexSubImage2D(i.TEXTURE_2D,j,0,0,le.width,le.height,ue,le.data):t.compressedTexImage2D(i.TEXTURE_2D,j,ae,le.width,le.height,0,le.data):Ce("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ze?D&&t.texSubImage2D(i.TEXTURE_2D,j,0,0,le.width,le.height,ue,ve,le.data):t.texImage2D(i.TEXTURE_2D,j,ae,le.width,le.height,0,ue,ve,le.data)}else if(h.isDataArrayTexture)if(ze){if(Je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ce,ae,J.width,J.height,J.depth),D)if(h.layerUpdates.size>0){const j=Ml(J.width,J.height,h.format,h.type);for(const xe of h.layerUpdates){const de=J.data.subarray(xe*j/J.data.BYTES_PER_ELEMENT,(xe+1)*j/J.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,xe,J.width,J.height,1,ue,ve,de)}h.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,ue,ve,J.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ae,J.width,J.height,J.depth,0,ue,ve,J.data);else if(h.isData3DTexture)ze?(Je&&t.texStorage3D(i.TEXTURE_3D,ce,ae,J.width,J.height,J.depth),D&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,ue,ve,J.data)):t.texImage3D(i.TEXTURE_3D,0,ae,J.width,J.height,J.depth,0,ue,ve,J.data);else if(h.isFramebufferTexture){if(Je)if(ze)t.texStorage2D(i.TEXTURE_2D,ce,ae,J.width,J.height);else{let j=J.width,xe=J.height;for(let de=0;de<ce;de++)t.texImage2D(i.TEXTURE_2D,de,ae,j,xe,0,ue,ve,null),j>>=1,xe>>=1}}else if(h.isHTMLTexture){if("texElementImage2D"in i){const j=i.canvas;if(j.hasAttribute("layoutsubtree")||j.setAttribute("layoutsubtree","true"),J.parentNode!==j){j.appendChild(J),m.add(h),j.onpaint=Ne=>{const _t=Ne.changedElements;for(const rt of m)_t.includes(rt.image)&&(rt.needsUpdate=!0)},j.requestPaint();return}const xe=0,de=i.RGBA,ne=i.RGBA,Ee=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,xe,de,ne,Ee,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(Ie.length>0){if(ze&&Je){const j=se(Ie[0]);t.texStorage2D(i.TEXTURE_2D,ce,ae,j.width,j.height)}for(let j=0,xe=Ie.length;j<xe;j++)le=Ie[j],ze?D&&t.texSubImage2D(i.TEXTURE_2D,j,0,0,ue,ve,le):t.texImage2D(i.TEXTURE_2D,j,ae,ue,ve,le);h.generateMipmaps=!1}else if(ze){if(Je){const j=se(J);t.texStorage2D(i.TEXTURE_2D,ce,ae,j.width,j.height)}D&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ue,ve,J)}else t.texImage2D(i.TEXTURE_2D,0,ae,ue,ve,J);f(h)&&S(X),ie.__version=te.version,h.onUpdate&&h.onUpdate(h)}x.__version=h.version}function De(x,h,R){if(h.image.length!==6)return;const X=ee(x,h),Q=h.source;t.bindTexture(i.TEXTURE_CUBE_MAP,x.__webglTexture,i.TEXTURE0+R);const te=n.get(Q);if(Q.version!==te.__version||X===!0){t.activeTexture(i.TEXTURE0+R);
vendor: 28,710 bytes, lines 4088-4112
4088const ie=qe.getPrimaries(qe.workingColorSpace),q=h.colorSpace===Zn?null:qe.getPrimaries(h.colorSpace),J=h.colorSpace===Zn||ie===q?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,h.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,h.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,J);const ue=h.isCompressedTexture||h.image[0].isCompressedTexture,ve=h.image[0]&&h.image[0].isDataTexture,ae=[];for(let ne=0;ne<6;ne++)!ue&&!ve?ae[ne]=g(h.image[ne],!0,r.maxCubemapSize):ae[ne]=ve?h.image[ne].image:h.image[ne],ae[ne]=z(h,ae[ne]);const le=ae[0],Ie=s.convert(h.format,h.colorSpace),ze=s.convert(h.type),Je=b(h.internalFormat,Ie,ze,h.normalized,h.colorSpace),D=h.isVideoTexture!==!0,ce=te.__version===void 0||X===!0,j=Q.dataReady;let xe=T(h,le);Le(i.TEXTURE_CUBE_MAP,h);let de;if(ue){D&&ce&&t.texStorage2D(i.TEXTURE_CUBE_MAP,xe,Je,le.width,le.height);for(let ne=0;ne<6;ne++){de=ae[ne].mipmaps;for(let Ee=0;Ee<de.length;Ee++){const Ne=de[Ee];h.format!==un?Ie!==null?D?j&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee,0,0,Ne.width,Ne.height,Ie,Ne.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee,Je,Ne.width,Ne.height,0,Ne.data):Ce("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?j&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee,0,0,Ne.width,Ne.height,Ie,ze,Ne.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee,Je,Ne.width,Ne.height,0,Ie,ze,Ne.data)}}}else{if(de=h.mipmaps,D&&ce){de.length>0&&xe++;const ne=se(ae[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,xe,Je,ne.width,ne.height)}for(let ne=0;ne<6;ne++)if(ve){D?j&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,ae[ne].width,ae[ne].height,Ie,ze,ae[ne].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,Je,ae[ne].width,ae[ne].height,0,Ie,ze,ae[ne].data);for(let Ee=0;Ee<de.length;Ee++){const _t=de[Ee].image[ne].image;D?j&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee+1,0,0,_t.width,_t.height,Ie,ze,_t.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee+1,Je,_t.width,_t.height,0,Ie,ze,_t.data)}}else{D?j&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,Ie,ze,ae[ne]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,Je,Ie,ze,ae[ne]);for(let Ee=0;Ee<de.length;Ee++){const Ne=de[Ee];D?j&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee+1,0,0,Ie,ze,Ne.image[ne]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Ee+1,Je,Ie,ze,Ne.image[ne])}}}f(h)&&S(i.TEXTURE_CUBE_MAP),te.__version=Q.version,h.onUpdate&&h.onUpdate(h)}x.__version=h.version}function Re(x,h,R,X,Q,te){const ie=s.convert(R.format,R.colorSpace),q=s.convert(R.type),J=b(R.internalFormat,ie,q,R.normalized,R.colorSpace),ue=n.get(h),ve=n.get(R);if(ve.__renderTarget=h,!ue.__hasExternalTextures){const ae=Math.max(1,h.width>>te),le=Math.max(1,h.height>>te);Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY?t.texImage3D(Q,te,J,ae,le,h.depth,0,ie,q,null):t.texImage2D(Q,te,J,ae,le,0,ie,q,null)}t.bindFramebuffer(i.FRAMEBUFFER,x),Be(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,X,Q,ve.__webglTexture,0,gt(h)):(Q===i.TEXTURE_2D||Q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,X,Q,ve.__webglTexture,te),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ht(x,h,R){if(i.bindRenderbuffer(i.RENDERBUFFER,x),h.depthBuffer){const X=h.depthTexture,Q=X&&X.isDepthTexture?X.type:null,te=w(h.stencilBuffer,Q),ie=h.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Be(h)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,gt(h),te,h.width,h.height):R?i.renderbufferStorageMultisample(i.RENDERBUFFER,gt(h),te,h.width,h.height):i.renderbufferStorage(i.RENDERBUFFER,te,h.width,h.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,x)}else{const X=h.textures;for(let Q=0;Q<X.length;Q++){const te=X[Q],ie=s.convert(te.format,te.colorSpace),q=s.convert(te.type),J=b(te.internalFormat,ie,q,te.normalized,te.colorSpace);Be(h)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,gt(h),J,h.width,h.height):R?i.renderbufferStorageMultisample(i.RENDERBUFFER,gt(h),J,h.width,h.height):i.renderbufferStorage(i.RENDERBUFFER,J,h.width,h.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function We(x,h,R){const X=h.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,x),!(h.depthTexture&&h.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Q=n.get(h.depthTexture);if(Q.__renderTarget=h,(!Q.__webglTexture||h.depthTexture.image.width!==h.width||h.depthTexture.image.height!==h.height)&&(h.depthTexture.image.width=h.width,h.depthTexture.image.height=h.height,h.depthTexture.needsUpdate=!0),X){if(Q.__webglInit===void 0&&(Q.__webglInit=!0,h.depthTexture.addEventListener("dispose",P)),Q.__webglTexture===void 0){Q.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Q.__webglTexture),Le(i.TEXTURE_CUBE_MAP,h.depthTexture);const ue=s.convert(h.depthTexture.format),ve=s.convert(h.depthTexture.type);let ae;h.depthTexture.format===zn?ae=i.DEPTH_COMPONENT24:h.depthTexture.format===ui&&(ae=i.DEPTH24_STENCIL8);for(let le=0;le<6;le++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,ae,h.width,h.height,0,ue,ve,null)}}else K(h.depthTexture,0);const te=Q.__webglTexture,ie=gt(h),q=X?i.TEXTURE_CUBE_MAP_POSITIVE_X+R:i.TEXTURE_2D,J=h.depthTexture.format===ui?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(h.depthTexture.format===zn)Be(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,q,te,0,ie):i.framebufferTexture2D(i.FRAMEBUFFER,J,q,te,0);else if(h.depthTexture.format===ui)Be(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,q,te,0,ie):i.framebufferTexture2D(i.FRAMEBUFFER,J,q,te,0);else throw new Error("Unknown depthTexture format")}function je(x){const h=n.get(x),R=x.isWebGLCubeRenderTarget===!0;if(h.__boundDepthTexture!==x.depthTexture){const X=x.depthTexture;if(h.__depthDisposeCallback&&h.__depthDisposeCallback(),X){const Q=()=>{delete h.__boundDepthTexture,delete h.__depthDisposeCallback,X.removeEventListener("dispose",Q)};X.addEventListener("dispose",Q),h.__depthDisposeCallback=Q}h.__boundDepthTexture=X}if(x.depthTexture&&!h.__autoAllocateDepthBuffer)if(R)for(let X=0;X<6;X++)We(h.__webglFramebuffer[X],x,X);else{const X=x.texture.mipmaps;X&&X.length>0?We(h.__webglFramebuffer[0],x,0):We(h.__webglFramebuffer,x,0)}else if(R){h.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer[X]),h.__webglDepthbuffer[X]===void 0)h.__webglDepthbuffer[X]=i.createRenderbuffer(),ht(h.__webglDepthbuffer[X],x,!1);else{const Q=x.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=h.__webglDepthbuffer[X];i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,te)}}else{const X=x.texture.mipmaps;if(X&&X.length>0?t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer),h.__webglDepthbuffer===void 0)h.__webglDepthbuffer=i.createRenderbuffer(),ht(h.__webglDepthbuffer,x,!1);else{const Q=x.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=h.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,te)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function it(x,h,R){const X=n.get(x);h!==void 0&&Re(X.__webglFramebuffer,x,x.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),R!==void 0&&je(x)}function Ge(x){const h=x.texture,R=n.get(x),X=n.get(h);x.addEventListener("dispose",v);const Q=x.textures,te=x.isWebGLCubeRenderTarget===!0,ie=Q.length>1;if(ie||(X.__webglTexture===void 0&&(X.__webglTexture=i.createTexture()),X.__version=h.version,a.memory.textures++),te){R.__webglFramebuffer=[];for(let q=0;q<6;q++)if(h.mipmaps&&h.mipmaps.length>0){R.__webglFramebuffer[q]=[];for(let J=0;J<h.mipmaps.length;J++)R.__webglFramebuffer[q][J]=i.createFramebuffer()}else R.__webglFramebuffer[q]=i.createFramebuffer()}else{if(h.mipmaps&&h.mipmaps.length>0){R.__webglFramebuffer=[];for(let q=0;q<h.mipmaps.length;q++)R.__webglFramebuffer[q]=i.createFramebuffer()}else R.__webglFramebuffer=i.createFramebuffer();if(ie)for(let q=0,J=Q.length;q<J;q++){const ue=n.get(Q[q]);ue.__webglTexture===void 0&&(ue.__webglTexture=i.createTexture(),a.memory.textures++)}if(x.samples>0&&Be(x)===!1){R.__webglMultisampledFramebuffer=i.createFramebuffer(),R.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,R.__webglMultisampledFramebuffer);for(let q=0;q<Q.length;q++){const J=Q[q];R.__webglColorRenderbuffer[q]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,R.__webglColorRenderbuffer[q]);const ue=s.convert(J.format,J.colorSpace),ve=s.convert(J.type),ae=b(J.internalFormat,ue,ve,J.normalized,J.colorSpace,x.isXRRenderTarget===!0),le=gt(x);i.renderbufferStorageMultisample(i.RENDERBUFFER,le,ae,x.width,x.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+q,i.RENDERBUFFER,R.__webglColorRenderbuffer[q])}i.bindRenderbuffer(i.RENDERBUFFER,null),x.depthBuffer&&(R.__webglDepthRenderbuffer=i.createRenderbuffer(),ht(R.__webglDepthRenderbuffer,x,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(te){t.bindTexture(i.TEXTURE_CUBE_MAP,X.__webglTexture),Le(i.TEXTURE_CUBE_MAP,h);for(let q=0;q<6;q++)if(h.mipmaps&&h.mipmaps.length>0)for(let J=0;J<h.mipmaps.length;J++)Re(R.__webglFramebuffer[q][J],x,h,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+q,J);else Re(R.__webglFramebuffer[q],x,h,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+q,0);f(h)&&S(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ie){for(let q=0,J=Q.length;q<J;q++){const ue=Q[q],ve=n.get(ue);let ae=i.TEXTURE_2D;(x.isWebGL3DRenderTarget||x.isWebGLArrayRenderTarget)&&(ae=x.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ae,ve.__webglTexture),Le(ae,ue),Re(R.__webglFramebuffer,x,ue,i.COLOR_ATTACHMENT0+q,ae,0),f(ue)&&S(ae)}t.unbindTexture()}else{let q=i.TEXTURE_2D;if((x.isWebGL3DRenderTarget||x.isWebGLArrayRenderTarget)&&(q=x.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(q,X.__webglTexture),Le(q,h),h.mipmaps&&h.mipmaps.length>0)for(let J=0;J<h.mipmaps.length;J++)Re(R.__webglFramebuffer[J],x,h,i.COLOR_ATTACHMENT0,q,J);else Re(R.__webglFramebuffer,x,h,i.COLOR_ATTACHMENT0,q,0);f(h)&&S(q),t.unbindTexture()}x.depthBuffer&&je(x)}function mt(x){const h=x.textures;for(let R=0,X=h.length;R<X;R++){const Q=h[R];if(f(Q)){const te=E(x),ie=n.get(Q).__webglTexture;t.bindTexture(te,ie),S(te),t.unbindTexture()}}}const ct=[],zt=[];function I(x){if(x.samples>0){if(Be(x)===!1){const h=x.textures,R=x.width,X=x.height;let Q=i.COLOR_BUFFER_BIT;const te=x.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=n.get(x),q=h.length>1;if(q)for(let ue=0;ue<h.length;ue++)t.bindFramebuffer(i.FRAMEBUFFER,ie.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ie.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ie.__webglMultisampledFramebuffer);const J=x.texture.mipmaps;J&&J.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ie.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ie.__webglFramebuffer);for(let ue=0;ue<h.length;ue++){if(x.resolveDepthBuffer&&(x.depthBuffer&&(Q|=i.DEPTH_BUFFER_BIT),x.stencilBuffer&&x.resolveStencilBuffer&&(Q|=i.STENCIL_BUFFER_BIT)),q){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ie.__webglColorRenderbuffer[ue]);const ve=n.get(h[ue]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ve,0)}i.blitFramebuffer(0,0,R,X,0,0,R,X,Q,i.NEAREST),l===!0&&(ct.length=0,zt.length=0,ct.push(i.COLOR_ATTACHMENT0+ue),x.depthBuffer&&x.resolveDepthBuffer===!1&&(ct.push(te),zt.push(te),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,zt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ct))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),q)for(let ue=0;ue<h.length;ue++){t.bindFramebuffer(i.FRAMEBUFFER,ie.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,ie.__webglColorRenderbuffer[ue]);const ve=n.get(h[ue]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ie.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,ve,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ie.__webglMultisampledFramebuffer)}else if(x.depthBuffer&&x.resolveDepthBuffer===!1&&l){const h=x.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[h])}}}function gt(x){return Math.min(r.maxSamples,x.samples)}function Be(x){const h=n.get(x);return x.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&h.__useRenderToTexture!==!1}function et(x){const h=a.render.frame;d.get(x)!==h&&(d.set(x,h),x.update())}function z(x,h){const R=x.colorSpace,X=x.format,Q=x.type;return x.isCompressedTexture===!0||x.isVideoTexture===!0||R!==ts&&R!==Zn&&(qe.getTransfer(R)===tt?(X!==un||Q!==Kt)&&Ce("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$e("WebGLTextures: Unsupported texture color space:",R)),h}function se(x){return typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement?(c.width=x.naturalWidth||x.width,c.height=x.naturalHeight||x.height):typeof VideoFrame<"u"&&x instanceof VideoFrame?(c.width=x.displayWidth,c.height=x.displayHeight):(c.width=x.width,c.height=x.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=Y,this.getTextureUnits=$,this.setTextureUnits=N,this.setTexture2D=K,this.setTexture2DArray=Z,this.setTexture3D=he,this.setTextureCube=re,this.rebindTextures=it,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=mt,this.updateMultisampleRenderTarget=I,this.setupDepthRenderbuffer=je,this.setupFrameBufferTexture=Re,this.useMultisampledRTT=Be,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function r_(i,e){function t(n,r=Zn){let s;const a=qe.getTransfer(r);if(n===Kt)return i.UNSIGNED_BYTE;if(n===io)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ro)return i.UNSIGNED_SHORT_5_5_5_1;if(n===uc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===hc)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===lc)return i.BYTE;if(n===cc)return i.SHORT;if(n===or)return i.UNSIGNED_SHORT;if(n===no)return i.INT;if(n===yn)return i.UNSIGNED_INT;if(n===vn)return i.FLOAT;if(n===Bn)return i.HALF_FLOAT;if(n===dc)return i.ALPHA;if(n===fc)return i.RGB;if(n===un)return i.RGBA;if(n===zn)return i.DEPTH_COMPONENT;if(n===ui)return i.DEPTH_STENCIL;if(n===pc)return i.RED;if(n===so)return i.RED_INTEGER;if(n===di)return i.RG;if(n===ao)return i.RG_INTEGER;if(n===oo)return i.RGBA_INTEGER;if(n===$r||n===Kr||n===Zr||n===Jr)if(a===tt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===$r)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Zr)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===Kr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Zr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Jr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ga||n===_a||n===va||n===xa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ga)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===_a)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===va)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===xa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ma||n===Sa||n===ya||n===Ea||n===ba||n===Qr||n===Ta)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ma||n===Sa)return a===tt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ya)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ea)return s.COMPRESSED_R11_EAC;if(n===ba)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Qr)return s.COMPRESSED_RG11_EAC;if(n===Ta)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Aa||n===wa||n===Ra||n===Ca||n===Pa||n===La||n===Da||n===Ia||n===Ua||n===Na||n===Fa||n===Oa||n===Ba||n===za)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Aa)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===wa)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ra)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ca)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Pa)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===La)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Da)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ia)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ua)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Na)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Fa)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Oa)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ba)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===za)return a===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ga||n===Va||n===ka)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ga)return a===tt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Va)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ka)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ha||n===Wa||n===es||n===Xa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ha)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Wa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===es)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Xa)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 s_=` 4089void main() { 4090 4091 gl_Position = vec4( position, 1.0 ); 4092 4093}`,a_=` 4094uniform sampler2DArray depthColor; 4095uniform float depthWidth; 4096uniform float depthHeight; 4097 4098void main() { 4099 4100 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4101 4102 if ( coord.x >= 1.0 ) { 4103 4104 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4105 4106 } else { 4107 4108 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4109 4110 } 4111 4112}`;class o_{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Ac(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 En({vertexShader:s_,fragmentShader:a_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new St(new hs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class l_ extends pi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,m=null,u=null,p=null,_=null;const y=typeof XRWebGLBinding<"u",g=new o_,f={},S=t.getContextAttributes();let E=null,b=null;const w=[],T=[],P=new Te;let v=null;const A=new Yt;A.viewport=new pt;const U=new Yt;U.viewport=new pt;const C=[A,U],O=new _d;let Y=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let fe=w[ee];return fe===void 0&&(fe=new bs,w[ee]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(ee){let fe=w[ee];return fe===void 0&&(fe=new bs,w[ee]=fe),fe.getGripSpace()},this.getHand=function(ee){let fe=w[ee];return fe===void 0&&(fe=new bs,w[ee]=fe),fe.getHandSpace()};function N(ee){const fe=T.indexOf(ee.inputSource);if(fe===-1)return;const oe=w[fe];oe!==void 0&&(oe.update(ee.inputSource,ee.frame,c||a),oe.dispatchEvent({type:ee.type,data:ee.inputSource}))}function V(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",V),r.removeEventListener("inputsourceschange",H);for(let ee=0;ee<w.length;ee++){const fe=T[ee];fe!==null&&(T[ee]=null,w[ee].disconnect(fe))}Y=null,$=null,g.reset();for(const ee in f)delete f[ee];e.setRenderTarget(E),p=null,u=null,m=null,r=null,b=null,Le.stop(),n.isPresenting=!1,e.setPixelRatio(v),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ee){s=ee,n.isPresenting===!0&&Ce("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ee){o=ee,n.isPresenting===!0&&Ce("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ee){c=ee},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return m===null&&y&&(m=new XRWebGLBinding(r,t)),m},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(ee){if(r=ee,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",V),r.addEventListener("inputsourceschange",H),S.xrCompatible!==!0&&await t.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(P),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let oe=null,we=null,De=null;S.depth&&(De=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=S.stencil?ui:zn,we=S.stencil?lr:yn);const Re={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:s};m=this.getBinding(),u=m.createProjectionLayer(Re),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),b=new Sn(u.textureWidth,u.textureHeight,{format:un,type:Kt,depthTexture:new ki(u.textureWidth,u.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const oe={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,oe),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new Sn(p.framebufferWidth,p.framebufferHeight,{format:un,type:Kt,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Le.setContext(r),Le.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function H(ee){for(let fe=0;fe<ee.removed.length;fe++){const oe=ee.removed[fe],we=T.indexOf(oe);we>=0&&(T[we]=null,w[we].disconnect(oe))}for(let fe=0;fe<ee.added.length;fe++){const oe=ee.added[fe];let we=T.indexOf(oe);if(we===-1){for(let Re=0;Re<w.length;Re++)if(Re>=T.length){T.push(oe),we=Re;break}else if(T[Re]===null){T[Re]=oe,we=Re;break}if(we===-1)break}const De=w[we];De&&De.connect(oe)}}const K=new L,Z=new L;function he(ee,fe,oe){K.setFromMatrixPosition(fe.matrixWorld),Z.setFromMatrixPosition(oe.matrixWorld);const we=K.distanceTo(Z),De=fe.projectionMatrix.elements,Re=oe.projectionMatrix.elements,ht=De[14]/(De[10]-1),We=De[14]/(De[10]+1),je=(De[9]+1)/De[5],it=(De[9]-1)/De[5],Ge=(De[8]-1)/De[0],mt=(Re[8]+1)/Re[0],ct=ht*Ge,zt=ht*mt,I=we/(-Ge+mt),gt=I*-Ge;if(fe.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(gt),ee.translateZ(I),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),De[10]===-1)ee.projectionMatrix.copy(fe.projectionMatrix),ee.projectionMatrixInverse.copy(fe.projectionMatrixInverse);else{const Be=ht+I,et=We+I,z=ct-gt,se=zt+(we-gt),x=je*We/et*Be,h=it*We/et*Be;ee.projectionMatrix.makePerspective(z,se,x,h,Be,et),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function re(ee,fe){fe===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(fe.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(r===null)return;let fe=ee.near,oe=ee.far;g.texture!==null&&(g.depthNear>0&&(fe=g.depthNear),g.depthFar>0&&(oe=g.depthFar)),O.near=U.near=A.near=fe,O.far=U.far=A.far=oe,(Y!==O.near||$!==O.far)&&(r.updateRenderState({depthNear:O.near,depthFar:O.far}),Y=O.near,$=O.far),O.layers.mask=ee.layers.mask|6,A.layers.mask=O.layers.mask&-5,U.layers.mask=O.layers.mask&-3;const we=ee.parent,De=O.cameras;re(O,we);for(let Re=0;Re<De.length;Re++)re(De[Re],we);De.length===2?he(O,A,U):O.projectionMatrix.copy(A.projectionMatrix),_e(ee,O,we)};function _e(ee,fe,oe){oe===null?ee.matrix.copy(fe.matrixWorld):(ee.matrix.copy(oe.matrixWorld),ee.matrix.invert(),ee.matrix.multiply(fe.matrixWorld)),ee.matrix.decompose(ee.position,ee.quaternion,ee.scale),ee.updateMatrixWorld(!0),ee.projectionMatrix.copy(fe.projectionMatrix),ee.projectionMatrixInverse.copy(fe.projectionMatrixInverse),ee.isPerspectiveCamera&&(ee.fov=hr*2*Math.atan(1/ee.projectionMatrix.elements[5]),ee.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(ee){l=ee,u!==null&&(u.fixedFoveation=ee),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ee)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(O)},this.getCameraTexture=function(ee){return f[ee]};let Oe=null;function Ze(ee,fe){if(d=fe.getViewerPose(c||a),_=fe,d!==null){const oe=d.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let we=!1;oe.length!==O.cameras.length&&(O.cameras.length=0,we=!0);for(let We=0;We<oe.length;We++){const je=oe[We];let it=null;if(p!==null)it=p.getViewport(je);else{const mt=m.getViewSubImage(u,je);it=mt.viewport,We===0&&(e.setRenderTargetTextures(b,mt.colorTexture,mt.depthStencilTexture),e.setRenderTarget(b))}let Ge=C[We];Ge===void 0&&(Ge=new Yt,Ge.layers.enable(We),Ge.viewport=new pt,C[We]=Ge),Ge.matrix.fromArray(je.transform.matrix),Ge.matrix.decompose(Ge.position,Ge.quaternion,Ge.scale),Ge.projectionMatrix.fromArray(je.projectionMatrix),Ge.projectionMatrixInverse.copy(Ge.projectionMatrix).invert(),Ge.viewport.set(it.x,it.y,it.width,it.height),We===0&&(O.matrix.copy(Ge.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),we===!0&&O.cameras.push(Ge)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&y){m=n.getBinding();const We=m.getDepthInformation(oe[0]);We&&We.isValid&&We.texture&&g.init(We,r.renderState)}if(De&&De.includes("camera-access")&&y){e.state.unbindTexture(),m=n.getBinding();for(let We=0;We<oe.length;We++){const je=oe[We].camera;if(je){let it=f[je];it||(it=new Ac,f[je]=it);const Ge=m.getCameraImage(je);it.sourceTexture=Ge}}}}for(let oe=0;oe<w.length;oe++){const we=T[oe],De=w[oe];we!==null&&De!==void 0&&De.update(we,fe,c||a)}Oe&&Oe(ee,fe),fe.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:fe}),_=null}const Le=new Dc;Le.setAnimationLoop(Ze),this.setAnimationLoop=function(ee){Oe=ee},this.dispose=function(){}}}const c_=new ut,zc=new Ue;zc.set(-1,0,0,0,1,0,0,0,1);function u_(i,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function n(g,f){f.color.getRGB(g.fogColor.value,Cc(i)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,S,E,b){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(g,f):f.isMeshLambertMaterial?(s(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(g,f),m(g,f)):f.isMeshPhongMaterial?(s(g,f),d(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(g,f),u(g,f),f.isMeshPhysicalMaterial&&p(g,f,b)):f.isMeshMat
vendor: 6,674 bytes, line 4112
4112capMaterial?(s(g,f),_(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),y(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(a(g,f),f.isLineDashedMaterial&&o(g,f)):f.isPointsMaterial?l(g,f,S,E):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===Dt&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===Dt&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);const S=e.get(f),E=S.envMap,b=S.envMapRotation;E&&(g.envMap.value=E,g.envMapRotation.value.setFromMatrix4(c_.makeRotationFromEuler(b)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(zc),g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function a(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function o(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,S,E){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*S,g.scale.value=E*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function d(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function m(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function u(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,S){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Dt&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=S.texture,g.transmissionSamplerSize.value.set(S.width,S.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function _(g,f){f.matcap&&(g.matcap.value=f.matcap)}function y(g,f){const S=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(S.matrixWorld),g.nearDistance.value=S.shadow.camera.near,g.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function h_(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,E){const b=E.program;n.uniformBlockBinding(S,b)}function c(S,E){let b=r[S.id];b===void 0&&(_(S),b=d(S),r[S.id]=b,S.addEventListener("dispose",g));const w=E.program;n.updateUBOMapping(S,w);const T=e.render.frame;s[S.id]!==T&&(u(S),s[S.id]=T)}function d(S){const E=m();S.__bindingPointIndex=E;const b=i.createBuffer(),w=S.__size,T=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,w,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,b),b}function m(){for(let S=0;S<o;
4112S++)if(a.indexOf(S)===-1)return a.push(S),S;return $e("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(S){const E=r[S.id],b=S.uniforms,w=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let T=0,P=b.length;T<P;T++){const v=Array.isArray(b[T])?b[T]:[b[T]];for(let A=0,U=v.length;A<U;A++){const C=v[A];if(p(C,T,A,w)===!0){const O=C.__offset,Y=Array.isArray(C.value)?C.value:[C.value];let $=0;for(let N=0;N<Y.length;N++){const V=Y[N],H=y(V);typeof V=="number"||typeof V=="boolean"?(C.__data[0]=V,i.bufferSubData(i.UNIFORM_BUFFER,O+$,C.__data)):V.isMatrix3?(C.__data[0]=V.elements[0],C.__data[1]=V.elements[1],C.__data[2]=V.elements[2],C.__data[3]=0,C.__data[4]=V.elements[3],C.__data[5]=V.elements[4],C.__data[6]=V.elements[5],C.__data[7]=0,C.__data[8]=V.elements[6],C.__data[9]=V.elements[7],C.__data[10]=V.elements[8],C.__data[11]=0):ArrayBuffer.isView(V)?C.__data.set(new V.constructor(V.buffer,V.byteOffset,C.__data.length)):(V.toArray(C.__data,$),$+=H.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,O,C.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(S,E,b,w){const T=S.value,P=E+"_"+b;if(w[P]===void 0)return typeof T=="number"||typeof T=="boolean"?w[P]=T:ArrayBuffer.isView(T)?w[P]=T.slice():w[P]=T.clone(),!0;{const v=w[P];if(typeof T=="number"||typeof T=="boolean"){if(v!==T)return w[P]=T,!0}else{if(ArrayBuffer.isView(T))return!0;if(v.equals(T)===!1)return v.copy(T),!0}}return!1}function _(S){const E=S.uniforms;let b=0;const w=16;for(let P=0,v=E.length;P<v;P++){const A=Array.isArray(E[P])?E[P]:[E[P]];for(let U=0,C=A.length;U<C;U++){const O=A[U],Y=Array.isArray(O.value)?O.value:[O.value];for(let $=0,N=Y.length;$<N;$++){const V=Y[$],H=y(V),K=b%w,Z=K%H.boundary,he=K+Z;b+=Z,he!==0&&w-he<H.storage&&(b+=w-he),O.__data=new Float32Array(H.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=b,b+=H.storage}}}const T=b%w;return T>0&&(b+=w-T),S.__size=b,S.__cache={},this}function y(S){const E={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(E.boundary=4,E.storage=4):S.isVector2?(E.boundary=8,E.storage=8):S.isVector3||S.isColor?(E.boundary=16,E.storage=12):S.isVector4?(E.boundary=16,E.storage=16):S.isMatrix3?(E.boundary=48,E.storage=48):S.isMatrix4?(E.boundary=64,E.storage=64):S.isTexture?Ce("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(S)?(E.boundary=16,E.storage=S.byteLength):Ce("WebGLRenderer: Unsupported uniform value type.",S),E}function g(S){const E=S.target;E.removeEventListener("dispose",g);const b=a.indexOf(E.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function f(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}const d_=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,10751,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,
vendor: 5,267 bytes, line 4112
411214942,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 gn=null;function f_(){return gn===null&&(gn=new Lh(d_,16,16,di,Bn),gn.name="DFG_LUT",gn.minFilter=Bt,gn.magFilter=Bt,gn.wrapS=Un,gn.wrapT=Un,gn.generateMipmaps=!1,gn.needsUpdate=!0),gn}class p_{constructor(e={}){const{canvas:t=Xu(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:u=!1,outputBufferType:p=Kt}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=a;const y=p,g=new Set([oo,ao,so]),f=new Set([Kt,yn,or,lr,io,ro]),S=new Uint32Array(4),E=new Int32Array(4),b=new L;let w=null,T=null;const P=[],v=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Mn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const U=this;let C=!1,O=null;this._outputColorSpace=Ht;let Y=0,$=0,N=null,V=-1,H=null;const K=new pt,Z=new pt;let he=null;const re=new Ye(0);let _e=0,Oe=t.width,Ze=t.height,Le=1,ee=null,fe=null;const oe=new pt(0,0,Oe,Ze),we=new pt(0,0,Oe,Ze);let De=!1;const Re=new po;let ht=!1,We=!1;const je=new ut,it=new L,Ge=new pt,mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ct=!1;function zt(){return N===null?Le:1}let I=n;function gt(M,F){return t.getContext(M,F)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${to}`),t.addEventListener("webglcontextlost",ne,!1),t.addEventListener("webglcontextrestored",Ee,!1),t.addEventListener("webglcontextcreationerror",Ne,!1),I===null){const F="webgl2";if(I=gt(F,M),I===null)throw gt(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw $e("WebGLRenderer: "+M.message),M}let Be,et,z,se,x,h,R,X,Q,te,ie,q,J,ue,ve,ae,le,Ie,ze,Je,D,ce,j;function xe(){Be=new fm(I),Be.init(),D=new r_(I,Be),et=new sm(I,Be,e,D),z=new n_(I,Be),et.reversedDepthBuffer&&u&&z.buffers.depth.setReversed(!0),se=new gm(I),x=new kg,h=new i_(I,Be,z,x,et,D,se),R=new dm(U),X=new xd(I),ce=new im(I,X),Q=new pm(I,X,se,ce),te=new vm(I,Q,X,ce,se),Ie=new _m(I,et,h),ve=new am(x),ie=new Vg(U,R,Be,et,ce,ve),q=new u_(U,x),J=new Wg,ue=new Zg(Be),le=new nm(U,R,z,te,_,l),ae=new t_(U,te,et),j=new h_(I,se,et,z),ze=new rm(I,Be,se),Je=new mm(I,Be,se),se.programs=ie.programs,U.capabilities=et,U.extensions=Be,U.properties=x,U.renderLists=J,U.shadowMap=ae,U.state=z,U.info=se}xe(),y!==Kt&&(A=new Mm(y,t.width,t.height,r,s));const de=new l_(U,I);this.xr=de,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){const M=Be.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Be.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return Le},this.setPixelRatio=function(M){M!==void 0&&(Le=M,this.setSize(Oe,Ze,!1))}
vendor: 4,307 bytes, line 4112
4112,this.getSize=function(M){return M.set(Oe,Ze)},this.setSize=function(M,F,W=!0){if(de.isPresenting){Ce("WebGLRenderer: Can't change size while VR device is presenting.");return}Oe=M,Ze=F,t.width=Math.floor(M*Le),t.height=Math.floor(F*Le),W===!0&&(t.style.width=M+"px",t.style.height=F+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,M,F)},this.getDrawingBufferSize=function(M){return M.set(Oe*Le,Ze*Le).floor()},this.setDrawingBufferSize=function(M,F,W){Oe=M,Ze=F,Le=W,t.width=Math.floor(M*W),t.height=Math.floor(F*W),this.setViewport(0,0,M,F)},this.setEffects=function(M){if(y===Kt){$e("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let F=0;F<M.length;F++)if(M[F].isOutputPass===!0){Ce("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(K)},this.getViewport=function(M){return M.copy(oe)},this.setViewport=function(M,F,W,G){M.isVector4?oe.set(M.x,M.y,M.z,M.w):oe.set(M,F,W,G),z.viewport(K.copy(oe).multiplyScalar(Le).round())},this.getScissor=function(M){return M.copy(we)},this.setScissor=function(M,F,W,G){M.isVector4?we.set(M.x,M.y,M.z,M.w):we.set(M,F,W,G),z.scissor(Z.copy(we).multiplyScalar(Le).round())},this.getScissorTest=function(){return De},this.setScissorTest=function(M){z.setScissorTest(De=M)},this.setOpaqueSort=function(M){ee=M},this.setTransparentSort=function(M){fe=M},this.getClearColor=function(M){return M.copy(le.getClearColor())},this.setClearColor=function(){le.setClearColor(...arguments)},this.getClearAlpha=function(){return le.getClearAlpha()},this.setClearAlpha=function(){le.setClearAlpha(...arguments)},this.clear=function(M=!0,F=!0,W=!0){let G=0;if(M){let k=!1;if(N!==null){const ge=N.texture.format;k=g.has(ge)}if(k){const ge=N.texture.type,Se=f.has(ge),me=le.getClearColor(),ye=le.getClearAlpha(),be=me.r,Fe=me.g,He=me.b;Se?(S[0]=be,S[1]=Fe,S[2]=He,S[3]=ye,I.clearBufferuiv(I.COLOR,0,S)):(E[0]=be,E[1]=Fe,E[2]=He,E[3]=ye,I.clearBufferiv(I.COLOR,0,E))}else G|=I.COLOR_BUFFER_BIT}F&&(G|=I.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),W&&(G|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),G!==0&&I.clear(G)},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(M){M.setRenderer(this),O=M},this.dispose=function(){t.removeEventListener("webglcontextlost",ne,!1),t.removeEventListener("webglcontextrestored",Ee,!1),t.removeEventListener("webglcontextcreationerror",Ne,!1),le.dispose(),J.dispose(),ue.dispose(),x.dispose(),R.dispose(),te.dispose(),ce.dispose(),j.dispose(),ie.dispose(),de.dispose(),de.removeEventListener("sessionstart",Ro),de.removeEventListener("sessionend",Co),ti.stop()};function ne(M){M.preventDefault(),is("WebGLRenderer: Context Lost."),C=!0}function Ee(){is("WebGLRenderer: Context Restored."),C=!1;const M=se.autoReset,F=ae.enabled,W=ae.autoUpdate,G=ae.needsUpdate,k=ae.type;xe(),se.autoReset=M,ae.enabled=F,ae.autoUpdate=W,ae.needsUpdate=G,ae.type=k}function Ne(M){$e("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function _t(M){const F=M.target;F.removeEventListener("dispose",_t),rt(F)}function rt(M){bn(M),x.remove(M)}function bn(M){const F=x.get(M).programs;F!==void 0&&(F.forEach(function(W){ie.releaseProgram(W)}),M.isShaderMaterial&&ie.releaseShaderCache(M))}this.renderBufferDirect=function(M,F,W,G,k,ge){F===null&&(F=mt);const Se=k.isMesh&&k.matrixWorld.determinant()<0,me=Xc(M,F,W,G,k);z.setMaterial(G,Se);let ye=W.index,be=1;if(G.wireframe===!0){if(ye=Q.getWireframeAttribute(W),ye===void 0)return;be=2}const Fe=W.drawRange,He=W.attributes.position;let Ae=Fe.start*be,st=(Fe.start+Fe.count)*be;ge!==null&&(Ae=Math.max(Ae,ge.start*be),st=Math.min(st,(ge.start+ge.count)*be)),ye!==null?(Ae=Math.max(Ae,0),st=Math.min(st,ye.count)):He!=null&&(Ae=Math.max(Ae,0),st=Math.min(st,He.count));const vt=st-Ae;if(vt<0||vt===1/0)return;ce.setup(k,G,me,W,ye);let ft,at=ze;if(ye!==null&&(ft=X.get(ye),at=Je,at.setIndex(ft)),k.isMesh)G.wireframe===!0?(z.setLineWidth(G.wireframeLinewidth*zt()),at.setMode(I.LINES)):at.
vendor: 9,962 bytes, line 4112
4112setMode(I.TRIANGLES);else if(k.isLine){let Ut=G.linewidth;Ut===void 0&&(Ut=1),z.setLineWidth(Ut*zt()),k.isLineSegments?at.setMode(I.LINES):k.isLineLoop?at.setMode(I.LINE_LOOP):at.setMode(I.LINE_STRIP)}else k.isPoints?at.setMode(I.POINTS):k.isSprite&&at.setMode(I.TRIANGLES);if(k.isBatchedMesh)if(Be.get("WEBGL_multi_draw"))at.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const Ut=k._multiDrawStarts,Me=k._multiDrawCounts,Wt=k._multiDrawCount,Ke=ye?X.get(ye).bytesPerElement:1,Qt=x.get(G).currentProgram.getUniforms();for(let pn=0;pn<Wt;pn++)Qt.setValue(I,"_gl_DrawID",pn),at.render(Ut[pn]/Ke,Me[pn])}else if(k.isInstancedMesh)at.renderInstances(Ae,vt,k.count);else if(W.isInstancedBufferGeometry){const Ut=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Me=Math.min(W.instanceCount,Ut);at.renderInstances(Ae,vt,Me)}else at.render(Ae,vt)};function fn(M,F,W){M.transparent===!0&&M.side===Dn&&M.forceSinglePass===!1?(M.side=Dt,M.needsUpdate=!0,gr(M,F,W),M.side=jn,M.needsUpdate=!0,gr(M,F,W),M.side=Dn):gr(M,F,W)}this.compile=function(M,F,W=null){W===null&&(W=M),T=ue.get(W),T.init(F),v.push(T),W.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(T.pushLight(k),k.castShadow&&T.pushShadow(k))}),M!==W&&M.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(T.pushLight(k),k.castShadow&&T.pushShadow(k))}),T.setupLights();const G=new Set;return M.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const ge=k.material;if(ge)if(Array.isArray(ge))for(let Se=0;Se<ge.length;Se++){const me=ge[Se];fn(me,W,k),G.add(me)}else fn(ge,W,k),G.add(ge)}),T=v.pop(),G},this.compileAsync=function(M,F,W=null){const G=this.compile(M,F,W);return new Promise(k=>{function ge(){if(G.forEach(function(Se){x.get(Se).currentProgram.isReady()&&G.delete(Se)}),G.size===0){k(M);return}setTimeout(ge,10)}Be.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let ps=null;function Hc(M){ps&&ps(M)}function Ro(){ti.stop()}function Co(){ti.start()}const ti=new Dc;ti.setAnimationLoop(Hc),typeof self<"u"&&ti.setContext(self),this.setAnimationLoop=function(M){ps=M,de.setAnimationLoop(M),M===null?ti.stop():ti.start()},de.addEventListener("sessionstart",Ro),de.addEventListener("sessionend",Co),this.render=function(M,F){if(F!==void 0&&F.isCamera!==!0){$e("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;O!==null&&O.renderStart(M,F);const W=de.enabled===!0&&de.isPresenting===!0,G=A!==null&&(N===null||W)&&A.begin(U,N);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),de.enabled===!0&&de.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(de.cameraAutoUpdate===!0&&de.updateCamera(F),F=de.getCamera()),M.isScene===!0&&M.onBeforeRender(U,M,F,N),T=ue.get(M,v.length),T.init(F),T.state.textureUnits=h.getTextureUnits(),v.push(T),je.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Re.setFromProjectionMatrix(je,xn,F.reversedDepth),We=this.localClippingEnabled,ht=ve.init(this.clippingPlanes,We),w=J.get(M,P.length),w.init(),P.push(w),de.enabled===!0&&de.isPresenting===!0){const Se=U.xr.getDepthSensingMesh();Se!==null&&ms(Se,F,-1/0,U.sortObjects)}ms(M,F,0,U.sortObjects),w.finish(),U.sortObjects===!0&&w.sort(ee,fe),ct=de.enabled===!1||de.isPresenting===!1||de.hasDepthSensing()===!1,ct&&le.addToRenderList(w,M),this.info.render.frame++,ht===!0&&ve.beginShadows();const k=T.state.shadowsArray;if(ae.render(k,M,F),ht===!0&&ve.endShadows(),this.info.autoReset===!0&&this.info.reset(),(G&&A.hasRenderPass())===!1){const Se=w.opaque,me=w.transmissive;if(T.setupLights(),F.isArrayCamera){const ye=F.cameras;if(me.length>0)for(let be=0,Fe=ye.length;be<Fe;be++){const He=ye[be];Lo(Se,me,M,He)}ct&&le.render(M);for(let be=0,Fe=ye.length;be<Fe;be++){const He=ye[be];Po(w,M,He,He.viewport)}}else me.length>0&&Lo(Se,me,M,F),ct&&le.render(M),Po(w,M,F)}N!==null&&$===0&&(h.updateMultisampleRenderTarget(N),h.updateRenderTargetMipmap(N)),G&&A.end(U),M.isScene===!0&&M.onAfterRender(U,M,F),ce.resetDefaultState(),V=-1,H=null,v.pop(),v.length>0?(T=v[v.length-1],h.setTextureUnits(T.state.textureUnits),ht===!0&&ve.setGlobalState(U.clippingPlanes,T.state.camera)):T=null,P.pop(),P.length>0?w=P[P.length-1]:w=null,O!==null&&O.renderEnd()};function ms(M,F,W,G){if(M.visible===!1)return;if(M.layers.test(F.layers)){if(M.isGroup)W=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(F);else if(M.isLightProbeGrid)T.pushLightProbeGrid(M);else if(M.isLight)T.pushLight(M),M.castShadow&&T.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Re.intersectsSprite(M)){G&&Ge.setFromMatrixPosition(M.matrixWorld).applyMatrix4(je);const Se=te.update(M),me=M.material;me.visible&&w.push(M,Se,me,W,Ge.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Re.intersectsObject(M))){const Se=te.update(M),me=M.material;if(G&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),Ge.copy(M.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),Ge.copy(Se.boundingSphere.center)),Ge.applyMatrix4(M.matrixWorld).applyMatrix4(je)),Array.isArray(me)){const ye=Se.groups;for(let be=0,Fe=ye.length;be<Fe;be++){const He=ye[be],Ae=me[He.materialIndex];Ae&&Ae.visible&&w.push(M,Se,Ae,W,Ge.z,He)}}else me.visible&&w.push(M,Se,me,W,Ge.z,null)}}const ge=M.children;for(let Se=0,me=ge.length;Se<me;Se++)ms(ge[Se],F,W,G)}function Po(M,F,W,G){const{opaque:k,transmissive:ge,transparent:Se}=M;T.setupLightsView(W),ht===!0&&ve.setGlobalState(U.clippingPlanes,W),G&&z.viewport(K.copy(G)),k.length>0&&mr(k,F,W),ge.length>0&&mr(ge,F,W),Se.length>0&&mr(Se,F,W),z.buffers.depth.setTest(!0),z.buffers.depth.setMask(!0),z.buffers.color.setMask(!0),z.setPolygonOffset(!1)}function Lo(M,F,W,G){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[G.id]===void 0){const Ae=Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[G.id]=new Sn(1,1,{generateMipmaps:!0,type:Ae?Bn:Kt,minFilter:ci,samples:Math.max(4,et.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qe.workingColorSpace})}const ge=T.state.transmissionRenderTarget[G.id],Se=G.viewport||K;ge.setSize(Se.z*U.transmissionResolutionScale,Se.w*U.transmissionResolutionScale);const me=U.getRenderTarget(),ye=U.getActiveCubeFace(),be=U.getActiveMipmapLevel();U.setRenderTarget(ge),U.getClearColor(re),_e=U.getClearAlpha(),_e<1&&U.setClearColor(16777215,.5),U.clear(),ct&&le.render(W);const Fe=U.toneMapping;U.toneMapping=Mn;const He=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),T.setupLightsView(G),ht===!0&&ve.setGlobalState(U.clippingPlanes,G),mr(M,W,G),h.updateMultisampleRenderTarget(ge),h.updateRenderTargetMipmap(ge),Be.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let st=0,vt=F.length;st<vt;st++){const ft=F[st],{object:at,geometry:Ut,material:Me,group:Wt}=ft;if(Me.side===Dn&&at.layers.test(G.layers)){const Ke=Me.side;Me.side=Dt,Me.needsUpdate=!0,Do(at,W,G,Ut,Me,Wt),Me.side=Ke,Me.needsUpdate=!0,Ae=!0}}Ae===!0&&(h.updateMultisampleRenderTarget(ge),h.updateRenderTargetMipmap(ge))}U.setRenderTarget(me,ye,be),U.setClearColor(re,_e),He!==void 0&&(G.viewport=He),U.toneMapping=Fe}function mr(M,F,W){const G=F.isScene===!0?F.overrideMaterial:null;for(let k=0,ge=M.length;k<ge;k++){const Se=M[k],{object:me,geometry:ye,group:be}=Se;let Fe=Se.material;Fe.allowOverride===!0&&G!==null&&(Fe=G),me.layers.test(W.layers)&&Do(me,F,W,ye,Fe,be)}}function Do(M,F,W,G,k,ge){M.onBeforeRender(U,F,W,G,k,ge),M.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),k.onBeforeRender(U,F,W,G,M,ge),k.transparent===!0&&k.side===Dn&&k.forceSinglePass===!1?(k.side=Dt,k.needsUpdate=!0,U.renderBufferDirect(W,F,G,k,M,ge),k.side=jn,k.needsUpdate=!0,U.renderBufferDirect(W,F,G,k,M,ge),k.side=Dn):U.renderBufferDirect(W,F,G,k,M,ge),M.onAfterRender(U,F,W,G,k,ge)}function gr(M,F,W){F.isScene!==!0&&(F=mt);const G=x.get(M),k=T.state.lights,ge=T.state.shadowsArray,Se=k.state.version,me=ie.getParameters(M,k.state,ge,F,W,T.state.lightProbeGridArray),ye=ie.getProgramCacheKey(me);let be=G.programs;G.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?F.environment:null,G.fog=F.fog;const Fe=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;G.envMap=R.get(M.envMap||G.environment,Fe),G.envMapRotation=G.environment!==null&&M.envMap===null?F.environmentRotation:M.envMapRotation,be===void 0&&(M.addEventListener("dispose",_t),be=new Map,G.programs=be);let He=be.get(ye);if(He!==void 0){if(G.currentProgram===He&&G.lightsStateVersion===Se)return Uo(M,me),He}else me.uniforms=ie.getUniforms(M),O!==null&&M.isNodeMaterial&&O.build(M,W,me),M.onBeforeCompile(me,U),He=ie.acquireProgram(me,ye),be.set(ye,He),G.uniforms=me.uniforms;const Ae=G.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ae.clippingPlanes=ve.uniform),Uo(M,me),G.needsLights=Yc(M),G.lightsStateVersion=Se,G.needsLights&&(Ae.ambientLightColor.value=k.state.ambient,Ae.lightProbe.value=k.state.probe,Ae.directionalLights.value=k.state.directional,Ae.directionalLightShadows.value=k.state.directionalShadow,Ae.spotLights.value=k.state.spot,Ae.spotLightShadows.value=k.state.spotShadow,Ae.rectAreaLights.value=k.state.rectArea,Ae.ltc_1.value=k.state.rectAreaLTC1,Ae.ltc_2.value=k.state.rectAreaLTC2,Ae.pointLights.value=k.state.point,Ae.pointLightShadows.value=k.state.pointShadow,Ae.hemisphereLights.value=k.state.hemi,Ae.directionalShadowMatrix.value=k.state.directionalShadowMatrix,Ae.spotLightMatrix.value=k.state.spotLightMatrix,Ae.spotLightMap.value=k.state.spotLightMap,Ae.pointShadowMatrix.value=k.state.pointShadowMatrix),G.lightProbeGrid=T.state.lightProbeGridArray.length>0,G.currentProgram=He,G.uniformsList=null,He}
vendor: 5,296 bytes, line 4112
4112function Io(M){if(M.uniformsList===null){const F=M.currentProgram.getUniforms();M.uniformsList=jr.seqWithValue(F.seq,M.uniforms)}return M.uniformsList}function Uo(M,F){const W=x.get(M);W.outputColorSpace=F.outputColorSpace,W.batching=F.batching,W.batchingColor=F.batchingColor,W.instancing=F.instancing,W.instancingColor=F.instancingColor,W.instancingMorph=F.instancingMorph,W.skinning=F.skinning,W.morphTargets=F.morphTargets,W.morphNormals=F.morphNormals,W.morphColors=F.morphColors,W.morphTargetsCount=F.morphTargetsCount,W.numClippingPlanes=F.numClippingPlanes,W.numIntersection=F.numClipIntersection,W.vertexAlphas=F.vertexAlphas,W.vertexTangents=F.vertexTangents,W.toneMapping=F.toneMapping}function Wc(M,F){if(M.length===0)return null;if(M.length===1)return M[0].texture!==null?M[0]:null;b.setFromMatrixPosition(F.matrixWorld);for(let W=0,G=M.length;W<G;W++){const k=M[W];if(k.texture!==null&&k.boundingBox.containsPoint(b))return k}return null}function Xc(M,F,W,G,k){F.isScene!==!0&&(F=mt),h.resetTextureUnits();const ge=F.fog,Se=G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial?F.environment:null,me=N===null?U.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:qe.workingColorSpace,ye=G.isMeshStandardMaterial||G.isMeshLambertMaterial&&!G.envMap||G.isMeshPhongMaterial&&!G.envMap,be=R.get(G.envMap||Se,ye),Fe=G.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,He=!!W.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Ae=!!W.morphAttributes.position,st=!!W.morphAttributes.normal,vt=!!W.morphAttributes.color;let ft=Mn;G.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(ft=U.toneMapping);const at=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Ut=at!==void 0?at.length:0,Me=x.get(G),Wt=T.state.lights;if(ht===!0&&(We===!0||M!==H)){const lt=M===H&&G.id===V;ve.setState(G,M,lt)}let Ke=!1;G.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==Wt.state.version||Me.outputColorSpace!==me||k.isBatchedMesh&&Me.batching===!1||!k.isBatchedMesh&&Me.batching===!0||k.isBatchedMesh&&Me.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Me.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Me.instancing===!1||!k.isInstancedMesh&&Me.instancing===!0||k.isSkinnedMesh&&Me.skinning===!1||!k.isSkinnedMesh&&Me.skinning===!0||k.isInstancedMesh&&Me.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Me.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Me.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Me.instancingMorph===!1&&k.morphTexture!==null||Me.envMap!==be||G.fog===!0&&Me.fog!==ge||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==ve.numPlanes||Me.numIntersection!==ve.numIntersection)||Me.vertexAlphas!==Fe||Me.vertexTangents!==He||Me.morphTargets!==Ae||Me.morphNormals!==st||Me.morphColors!==vt||Me.toneMapping!==ft||Me.morphTargetsCount!==Ut||!!Me.lightProbeGrid!=T.state.lightProbeGridArray.length>0)&&(Ke=!0):(Ke=!0,Me.__version=G.version);let Qt=Me.currentProgram;Ke===!0&&(Qt=gr(G,F,k),O&&G.isNodeMaterial&&O.onUpdateProgram(G,Qt,Me));let pn=!1,Vn=!1,gi=!1;const ot=Qt.getUniforms(),xt=Me.uniforms;if(z.useProgram(Qt.program)&&(pn=!0,Vn=!0,gi=!0),G.id!==V&&(V=G.id,Vn=!0),Me.needsLights){const lt=Wc(T.state.lightProbeGridArray,k);Me.lightProbeGrid!==lt&&(Me.lightProbeGrid=lt,Vn=!0)}if(pn||H!==M){z.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),ot.setValue(I,"projectionMatrix",M.projectionMatrix),ot.setValue(I,"viewMatrix",M.matrixWorldInverse);const Hn=ot.map.cameraPosition;Hn!==void 0&&Hn.setValue(I,it.setFromMatrixPosition(M.matrixWorld)),et.logarithmicDepthBuffer&&ot.setValue(I,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&ot.setValue(I,"isOrthographic",M.isOrthographicCamera===!0),H!==M&&(H=M,Vn=!0,gi=!0)}if(Me.needsLights&&(Wt.state.directionalShadowMap.length>0&&ot.setValue(I,"directionalShadowMap",Wt.state.directionalShadowMap,h),Wt.state.spotShadowMap.length>0&&ot.setValue(I,"spotShadowMap",Wt.state.spotShadowMap,h),Wt.state.pointShadowMap.length>0&&ot.setValue(I,"pointShadowMap",Wt.state.pointShadowMap,h)),k.isSkinnedMesh){ot.setOptional(I,k,"bindMatrix"),ot.setOptional(I,k,"bindMatrixInverse");const lt=k.skeleton;lt&&(lt.boneTexture===null&<.computeBoneTexture(),ot.setValue(I,"boneTexture",lt.boneTexture,h))}k.isBatchedMesh&&(ot.setOptional(I,k,"batchingTexture"),ot.setValue(I,"batchingTexture",k._matricesTexture,h),ot.setOptional(I,k,"batchingIdTexture"),ot.setValue(I,"batchingIdTexture",k._indirectTexture,h),ot.setOptional(I,k,"batchingColorTexture"),k._colorsTexture!==null&&ot.setValue(I,"batchingColorTexture",k._colorsTexture,h));const kn=W.morphAttributes;if((kn.position!==void 0||kn.normal!==void 0||kn.color!==void 0)&&Ie.update(k,W,Qt),(Vn||Me.receiveShadow!==k.receiveShadow)&&(Me.receiveShadow=k.receiveShadow,ot.setValue(I,"receiveShadow",k.receiveShadow)),(G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial)&&G.envMap===null&&F.environment!==null&&(xt.envMapIntensity.value=F.environmentIntensity),xt.dfgLUT!==void 0&&(xt.dfgLUT.value=f_(
vendor: 10,689 bytes, line 4112
4112)),Vn){if(ot.setValue(I,"toneMappingExposure",U.toneMappingExposure),Me.needsLights&&qc(xt,gi),ge&&G.fog===!0&&q.refreshFogUniforms(xt,ge),q.refreshMaterialUniforms(xt,G,Le,Ze,T.state.transmissionRenderTarget[M.id]),Me.needsLights&&Me.lightProbeGrid){const lt=Me.lightProbeGrid;xt.probesSH.value=lt.texture,xt.probesMin.value.copy(lt.boundingBox.min),xt.probesMax.value.copy(lt.boundingBox.max),xt.probesResolution.value.copy(lt.resolution)}jr.upload(I,Io(Me),xt,h)}if(G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(jr.upload(I,Io(Me),xt,h),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&ot.setValue(I,"center",k.center),ot.setValue(I,"modelViewMatrix",k.modelViewMatrix),ot.setValue(I,"normalMatrix",k.normalMatrix),ot.setValue(I,"modelMatrix",k.matrixWorld),G.uniformsGroups!==void 0){const lt=G.uniformsGroups;for(let Hn=0,_i=lt.length;Hn<_i;Hn++){const No=lt[Hn];j.update(No,Qt),j.bind(No,Qt)}}return Qt}function qc(M,F){M.ambientLightColor.needsUpdate=F,M.lightProbe.needsUpdate=F,M.directionalLights.needsUpdate=F,M.directionalLightShadows.needsUpdate=F,M.pointLights.needsUpdate=F,M.pointLightShadows.needsUpdate=F,M.spotLights.needsUpdate=F,M.spotLightShadows.needsUpdate=F,M.rectAreaLights.needsUpdate=F,M.hemisphereLights.needsUpdate=F}function Yc(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return Y},this.getActiveMipmapLevel=function(){return $},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(M,F,W){const G=x.get(M);G.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),x.get(M.texture).__webglTexture=F,x.get(M.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:W,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,F){const W=x.get(M);W.__webglFramebuffer=F,W.__useDefaultFramebuffer=F===void 0};const $c=I.createFramebuffer();this.setRenderTarget=function(M,F=0,W=0){N=M,Y=F,$=W;let G=null,k=!1,ge=!1;if(M){const me=x.get(M);if(me.__useDefaultFramebuffer!==void 0){z.bindFramebuffer(I.FRAMEBUFFER,me.__webglFramebuffer),K.copy(M.viewport),Z.copy(M.scissor),he=M.scissorTest,z.viewport(K),z.scissor(Z),z.setScissorTest(he),V=-1;return}else if(me.__webglFramebuffer===void 0)h.setupRenderTarget(M);else if(me.__hasExternalTextures)h.rebindTextures(M,x.get(M.texture).__webglTexture,x.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Fe=M.depthTexture;if(me.__boundDepthTexture!==Fe){if(Fe!==null&&x.has(Fe)&&(M.width!==Fe.image.width||M.height!==Fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");h.setupDepthRenderbuffer(M)}}const ye=M.texture;(ye.isData3DTexture||ye.isDataArrayTexture||ye.isCompressedArrayTexture)&&(ge=!0);const be=x.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(be[F])?G=be[F][W]:G=be[F],k=!0):M.samples>0&&h.useMultisampledRTT(M)===!1?G=x.get(M).__webglMultisampledFramebuffer:Array.isArray(be)?G=be[W]:G=be,K.copy(M.viewport),Z.copy(M.scissor),he=M.scissorTest}else K.copy(oe).multiplyScalar(Le).floor(),Z.copy(we).multiplyScalar(Le).floor(),he=De;if(W!==0&&(G=$c),z.bindFramebuffer(I.FRAMEBUFFER,G)&&z.drawBuffers(M,G),z.viewport(K),z.scissor(Z),z.setScissorTest(he),k){const me=x.get(M.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+F,me.__webglTexture,W)}else if(ge){const me=F;for(let ye=0;ye<M.textures.length;ye++){const be=x.get(M.textures[ye]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+ye,be.__webglTexture,W,me)}}else if(M!==null&&W!==0){const me=x.get(M.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,me.__webglTexture,W)}V=-1},this.readRenderTargetPixels=function(M,F,W,G,k,ge,Se,me=0){if(!(M&&M.isWebGLRenderTarget)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ye=x.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Se!==void 0&&(ye=ye[Se]),ye){z.bindFramebuffer(I.FRAMEBUFFER,ye);try{const be=M.textures[me],Fe=be.format,He=be.type;if(M.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+me),!et.textureFormatReadable(Fe)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!et.textureTypeReadable(He)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=M.width-G&&W>=0&&W<=M.height-k&&I.readPixels(F,W,G,k,D.convert(Fe),D.convert(He),ge)}finally{const be=N!==null?x.get(N).__webglFramebuffer:null;z.bindFramebuffer(I.FRAMEBUFFER,be)}}},this.readRenderTargetPixelsAsync=async function(M,F,W,G,k,ge,Se,me=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ye=x.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Se!==void 0&&(ye=ye[Se]),ye)if(F>=0&&F<=M.width-G&&W>=0&&W<=M.height-k){z.bindFramebuffer(I.FRAMEBUFFER,ye);const be=M.textures[me],Fe=be.format,He=be.type;if(M.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+me),!et.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!et.textureTypeReadable(He))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ae=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Ae),I.bufferData(I.PIXEL_PACK_BUFFER,ge.byteLength,I.STREAM_READ),I.readPixels(F,W,G,k,D.convert(Fe),D.convert(He),0);const st=N!==null?x.get(N).__webglFramebuffer:null;z.bindFramebuffer(I.FRAMEBUFFER,st);const vt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await qu(I,vt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Ae),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ge),I.deleteBuffer(Ae),I.deleteSync(vt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,F=null,W=0){const G=Math.pow(2,-W),k=Math.floor(M.image.width*G),ge=Math.floor(M.image.height*G),Se=F!==null?F.x:0,me=F!==null?F.y:0;h.setTexture2D(M,0),I.copyTexSubImage2D(I.TEXTURE_2D,W,0,0,Se,me,k,ge),z.unbindTexture()};const Kc=I.createFramebuffer(),Zc=I.createFramebuffer();this.copyTextureToTexture=function(M,F,W=null,G=null,k=0,ge=0){let Se,me,ye,be,Fe,He,Ae,st,vt;const ft=M.isCompressedTexture?M.mipmaps[ge]:M.image;if(W!==null)Se=W.max.x-W.min.x,me=W.max.y-W.min.y,ye=W.isBox3?W.max.z-W.min.z:1,be=W.min.x,Fe=W.min.y,He=W.isBox3?W.min.z:0;else{const xt=Math.pow(2,-k);Se=Math.floor(ft.width*xt),me=Math.floor(ft.height*xt),M.isDataArrayTexture?ye=ft.depth:M.isData3DTexture?ye=Math.floor(ft.depth*xt):ye=1,be=0,Fe=0,He=0}G!==null?(Ae=G.x,st=G.y,vt=G.z):(Ae=0,st=0,vt=0);const at=D.convert(F.format),Ut=D.convert(F.type);let Me;F.isData3DTexture?(h.setTexture3D(F,0),Me=I.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(h.setTexture2DArray(F,0),Me=I.TEXTURE_2D_ARRAY):(h.setTexture2D(F,0),Me=I.TEXTURE_2D),z.activeTexture(I.TEXTURE0),z.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,F.flipY),z.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),z.pixelStorei(I.UNPACK_ALIGNMENT,F.unpackAlignment);const Wt=z.getParameter(I.UNPACK_ROW_LENGTH),Ke=z.getParameter(I.UNPACK_IMAGE_HEIGHT),Qt=z.getParameter(I.UNPACK_SKIP_PIXELS),pn=z.getParameter(I.UNPACK_SKIP_ROWS),Vn=z.getParameter(I.UNPACK_SKIP_IMAGES);z.pixelStorei(I.UNPACK_ROW_LENGTH,ft.width),z.pixelStorei(I.UNPACK_IMAGE_HEIGHT,ft.height),z.pixelStorei(I.UNPACK_SKIP_PIXELS,be),z.pixelStorei(I.UNPACK_SKIP_ROWS,Fe),z.pixelStorei(I.UNPACK_SKIP_IMAGES,He);const gi=M.isDataArrayTexture||M.isData3DTexture,ot=F.isDataArrayTexture||F.isData3DTexture;if(M.isDepthTexture){const xt=x.get(M),kn=x.get(F),lt=x.get(xt.__renderTarget),Hn=x.get(kn.__renderTarget);z.bindFramebuffer(I.READ_FRAMEBUFFER,lt.__webglFramebuffer),z.bindFramebuffer(I.DRAW_FRAMEBUFFER,Hn.__webglFramebuffer);for(let _i=0;_i<ye;_i++)gi&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,x.get(M).__webglTexture,k,He+_i),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,x.get(F).__webglTexture,ge,vt+_i)),I.blitFramebuffer(be,Fe,Se,me,Ae,st,Se,me,I.DEPTH_BUFFER_BIT,I.NEAREST);z.bindFramebuffer(I.READ_FRAMEBUFFER,null),z.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(k!==0||M.isRenderTargetTexture||x.has(M)){const xt=x.get(M),kn=x.get(F);z.bindFramebuffer(I.READ_FRAMEBUFFER,Kc),z.bindFramebuffer(I.DRAW_FRAMEBUFFER,Zc);for(let lt=0;lt<ye;lt++)gi?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,xt.__webglTexture,k,He+lt):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,xt.__webglTexture,k),ot?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,kn.__webglTexture,ge,vt+lt):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,kn.__webglTexture,ge),k!==0?I.blitFramebuffer(be,Fe,Se,me,Ae,st,Se,me,I.COLOR_BUFFER_BIT,I.NEAREST):ot?I.copyTexSubImage3D(Me,ge,Ae,st,vt+lt,be,Fe,Se,me):I.copyTexSubImage2D(Me,ge,Ae,st,be,Fe,Se,me);z.bindFramebuffer(I.READ_FRAMEBUFFER,null),z.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else ot?M.isDataTexture||M.isData3DTexture?I.texSubImage3D(Me,ge,Ae,st,vt,Se,me,ye,at,Ut,ft.data):F.isCompressedArrayTexture?I.compressedTexSubImage3D(Me,ge,Ae,st,vt,Se,me,ye,at,ft.data):I.texSubImage3D(Me,ge,Ae,st,vt,Se,me,ye,at,Ut,ft):M.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,ge,Ae,st,Se,me,at,Ut,ft.data):M.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,ge,Ae,st,ft.width,ft.height,at,ft.data):I.texSubImage2D(I.TEXTURE_2D,ge,Ae,st,Se,me,at,Ut,ft);z.pixelStorei(I.UNPACK_ROW_LENGTH,Wt),z.pixelStorei(I.UNPACK_IMAGE_HEIGHT,Ke),z.pixelStorei(I.UNPACK_SKIP_PIXELS,Qt),z.pixelStorei(I.UNPACK_SKIP_ROWS,pn),z.pixelStorei(I.UNPACK_SKIP_IMAGES,Vn),ge===0&&F.generateMipmaps&&I.generateMipmap(Me),z.unbindTexture()},this.initRenderTarget=function(M){x.get(M).__webglFramebuffer===void 0&&h.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?h.setTextureCube(M,0):M.isData3DTexture?h.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?h.setTexture2DArray(M,0):h.setTexture2D(M,0),z.unbindTexture()},this.resetState=function(){Y=0,$=0,N=null,z.reset(),ce.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return xn}get outputColorSpace(){return this._outputColorSpace}
4112set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=qe._getDrawingBufferColorSpace(e),t.unpackColorSpace=qe._getUnpackColorSpace()}}const m_={class:"globe-wrap"},g_=jt({__name:"GlobeAnimation",props:{active:{type:Boolean}},setup(i){const e=i,t=$t(null);let n=null,r=null,s=!1;return jc(()=>e.active,a=>{s=!a,a&&n===null&&t.value}),cs(()=>{const a=t.value;if(!a)return;const o=a,l=new Eh,c=new p_({canvas:a,antialias:!0,alpha:!0});c.setPixelRatio(Math.min(window.devicePixelRatio,2)),c.sortObjects=!0;const d=new Yt(40,1,.1,100);d.position.set(0,0,5.6);const m=new In;l.add(m);const p=new hd().load("https://unpkg.com/three-globe/example/img/earth-topology.png");p.colorSpace=Ht,p.minFilter=Et,p.magFilter=Et;const _=new St(new Ln(1.62,96,96),new sd({color:458810,roughness:.88,metalness:.08,transparent:!0,opacity:.96,emissive:new Ye(1310840),emissiveIntensity:.65}));m.add(_);const y=new St(new Ln(1.632,96,96),new tn({map:p,color:6212566,transparent:!0,opacity:.82,blending:kt,depthWrite:!1}));m.add(y);const g=new In,f=new Ka({color:46280,transparent:!0,opacity:.18,blending:kt,depthWrite:!1,depthTest:!0}),S=new Ka({color:10479086,transparent:!0,opacity:.24,blending:kt,depthWrite:!1,depthTest:!0});function E(z,se=1.652){const x=[],h=Tn.degToRad(90-z),R=se*Math.cos(h),X=se*Math.sin(h);for(let te=-180;te<=180;te+=3){const ie=Tn.degToRad(te+180);x.push(new L(-X*Math.cos(ie),R,X*Math.sin(ie)))}const Q=new Nh(new Ct().setFromPoints(x),S.clone());return Q.renderOrder=3,Q}function b(z,se=1.65){const x=[],h=Tn.degToRad(z+180);for(let X=-90;X<=90;X+=3){const Q=Tn.degToRad(90-X);x.push(new L(-se*Math.sin(Q)*Math.cos(h),se*Math.cos(Q),se*Math.sin(Q)*Math.sin(h)))}const R=new Ec(new Ct().setFromPoints(x),f.clone());return R.renderOrder=3,R}for(let z=-75;z<=75;z+=15)g.add(E(z));for(let z=-180;z<180;z+=15)g.add(b(z));m.add(g);const w=new St(new Ln(1.665,96,96),new tn({color:46280,transparent:!0,opacity:.075,side:Dt,blending:kt,depthWrite:!1}));m.add(w);const T=new St(new Ln(1.69,96,96),new tn({color:46280,transparent:!0,opacity:.16,side:Dt,blending:kt,depthWrite:!1}));m.add(T);const P=new St(new Ln(1.72,96,96),new tn({color:683730,transparent:!0,opacity:.035,side:Dt,blending:kt,depthWrite:!1}));m.add(P);const v=new Ct,A=900,U=new Float32Array(A*3);for(let z=0;z<A;z++){const se=Tn.randFloat(5.2,9.2),x=Tn.randFloat(0,Math.PI*2),h=Math.acos(Tn.randFloatSpread(2));U[z*3]=se*Math.sin(h)*Math.cos(x),U[z*3+1]=se*Math.sin(h)*Math.sin(x),U[z*3+2]=se*Math.cos(h)}v.setAttribute("position",new rn(U,3)),l.add(new Fh(v,new bc({color:14279423,size:.012,transparent:!0,opacity:.75})));function C(z,se,x=1.69){const h=(90-z)*Math.PI/180,R=(se+180)*Math.PI/180;return new L(-x*Math.sin(h)*Math.cos(R),x*Math.cos(h),x*Math.sin(h)*Math.sin(R))}const O=new In;m.add(O);const Y=new tn({color:14743546,transparent:!0,opacity:.96,blending:kt,depthWrite:!1}),$=new tn({color:46280,transparent:!0,opacity:.22,blending:kt,depthWrite:!1}),N=[],V=new Set(["Mauritius","India","South Africa","Rwanda","China"]),H=[],K=new In;m.add(K);const Z={Africa:{active:new Set,nextShuffle:0,interval:1.2},Asia:{active:new Set,nextShuffle:0,interval:1.05}},he={eastAfrica:{current:null,nextSwitch:0,interval:2.6},westAfrica:{current:null,nextSwitch:0,interval:2.6},eastAsia:{current:null,nextSwitch:0,interval:2.8},westAsia:{current:null,nextSwitch:0,interval:2.8}};function re(z){return z.name==="Mauritius"?null:z.continent==="Africa"?z.lon>=20?"eastAfrica":"westAfrica":z.continent==="Asia"?z.lon>=90?"eastAsia":"westAsia":null}function _e(z){const se=document.createElement("canvas"),x=se.getContext("2d"),h=Math.min(window.devicePixelRatio||1,2);se.width=256*h,se.height=80*h,x.scale(h,h),x.clearRect(0,0,256,80),x.shadowColor="rgba(0, 180, 200, 0.95)",x.shadowBlur=14,x.fillStyle="#E0F7FA",x.font="700 20px Inter, Arial, sans-serif",x.textAlign="center",x.textBaseline="middle",x.fillText(z,128,40);const R=new Oh(se);return R.colorSpace=Ht,R.needsUpdate=!0,R}function Oe(z,se){const x=_e(z),h=new Sc({map:x,transparent:!0,opacity:.96,depthWrite:!1,depthTest:!1}),R=new Ch(h);return R.scale.set(.42,.13,1),R.position.copy(se).add(new L(0,-.13,0)),R.renderOrder=20,R}function Ze(z){const se=C(z.lat,z.lon,1.71),x=V.has(z.name),h=new St(new Ln(.044,14,14),$.clone()),R=new St(new Ln(.015,12,12),Y.clone());h.position.copy(se),R.position.copy(se),h.material.opacity=z.name==="Mauritius"?.46:0,R.material.opacity=x?1:.28,h.scale.setScalar(z.name==="Mauritius"?1.55:.72),R.scale.setScalar(z.name==="Mauritius"?1.38:x?1.06:.82),x||(h.visible=!1,R.visible=!1),O.add(h,R);let X=null;x&&(X=Oe(z.name,se),O.add(X)),N.push({...z,glow:h,marker:R,position:se,label:X,phase:Math.random()*Math.PI*2,routeRegion:re(z),targetGlow:z.name==="Mauritius"?1:0,currentGlow:z.name==="Mauritius"?1:0,routeBoost:0,persistent:x,permanent:z.name==="Mauritius"})}function Le(z,se=5){const h=[...N.map((R,X)=>({item:R,index:X})).filter(({item:R})=>R.continent===z&&!R.permanent)].sort(()=>Math.random()-.5);Z[z].active=new Set(h.slice(0,Math.min(se,h.length)).map(({index:R})=>R))}function ee(z){const se=N.filter(x=>x.routeRegion===z&&!x.permanent);return se.length?se[Math.floor(Math.random()*se.length)]:null}function fe(z,se,x=12){if(!z||z.length<2)return null;const h=new Rc(z);return new vo(h,Math.max(8,z.length*2),se,x,!1)}
4112function oe(z){z.segmentGroup.children.forEach(se=>{const x=se;x.geometry&&x.geometry.dispose(),x.material&&x.material.dispose()}),z.segmentGroup.clear(),z.lastSegmentSignature=""}function we(z,se,x=1){if(!se||se.length<3)return;const h=14,R=se.length-1,X=`${se.length}-${x.toFixed(2)}`;if(z.lastSegmentSignature!==X){oe(z);for(let Q=0;Q<h;Q++){const te=Math.floor(Q/h*R),ie=Math.max(te+2,Math.floor((Q+1)/h*R)),q=se.slice(te,Math.min(ie+1,se.length));if(q.length<2)continue;const J=(Q+1)/h,ue=Math.pow(J,.72)*x,ve=fe(q,.0075,10),ae=fe(q,.018,14);ae&&z.segmentGroup.add(new St(ae,new tn({color:46280,transparent:!0,opacity:.18*ue,blending:kt,depthWrite:!1}))),ve&&z.segmentGroup.add(new St(ve,new tn({color:10479086,transparent:!0,opacity:.78*ue,blending:kt,depthWrite:!1})))}z.lastSegmentSignature=X}}function De(z,se){if(!z||!se||se.name==="Mauritius"||!se.routeRegion)return;const x=z.position.clone(),h=se.position.clone(),R=x.clone().add(h).multiplyScalar(.5).normalize().multiplyScalar(2.08),X=new _o(x,R,h),Q=X.getPoints(100),te=new In;te.visible=!1;const ie=X.getPoint(.04).clone().sub(X.getPoint(0)).normalize(),q=new mi().setFromUnitVectors(new L(0,1,0),ie),J=new St(new os(.023,.09,18),new tn({color:46280,transparent:!0,opacity:0,blending:kt,depthWrite:!1}));J.quaternion.copy(q),J.position.copy(x).add(ie.clone().multiplyScalar(.045));const ue=new St(new os(.01,.062,14),new tn({color:14743546,transparent:!0,opacity:0,blending:kt,depthWrite:!1}));ue.quaternion.copy(q),ue.position.copy(x).add(ie.clone().multiplyScalar(.031)),te.visible=!1,J.visible=!1,ue.visible=!1,K.add(te,J,ue),H.push({targetMarker:se,regionKey:se.routeRegion,curve:X,sampledPoints:Q,segmentGroup:te,startGlowCap:J,startCoreCap:ue,progress:0,fadeProgress:1,speed:Tn.randFloat(.42,.62),lastSampleCount:0,lastSegmentSignature:""})}function Re(z){Object.entries(he).forEach(([se,x])=>{if(!x.current||z>=x.nextSwitch){const h=ee(se);x.current=h,x.nextSwitch=z+x.interval+Math.random()*1.1,H.filter(R=>R.regionKey===se).forEach(R=>{R.progress=0,R.fadeProgress=1,R.lastSampleCount=0,oe(R),R.segmentGroup.visible=!1,R.startGlowCap.visible=!1,R.startCoreCap.visible=!1})}})}[{name:"Algeria",continent:"Africa",lat:28,lon:1.6},{name:"Angola",continent:"Africa",lat:-11.2,lon:17.9},{name:"Benin",continent:"Africa",lat:9.3,lon:2.3},{name:"Botswana",continent:"Africa",lat:-22.3,lon:24.7},{name:"Burkina Faso",continent:"Africa",lat:12.3,lon:-1.6},{name:"Burundi",continent:"Africa",lat:-3.4,lon:29.9},{name:"Cabo Verde",continent:"Africa",lat:15.1,lon:-23.6},{name:"Cameroon",continent:"Africa",lat:5.7,lon:12.7},{name:"Central African Republic",continent:"Africa",lat:6.6,lon:20.9},{name:"Chad",continent:"Africa",lat:15.4,lon:18.7},{name:"Comoros",continent:"Africa",lat:-11.9,lon:43.3},{name:"Democratic Republic of the Congo",continent:"Africa",lat:-2.9,lon:23.7},{name:"Republic of the Congo",continent:"Africa",lat:-.7,lon:15.8},{name:"Djibouti",continent:"Africa",lat:11.6,lon:43.1},{name:"Egypt",continent:"Africa",lat:26.8,lon:30.8},{name:"Equatorial Guinea",continent:"Africa",lat:1.6,lon:10.5},{name:"Eritrea",continent:"Africa",lat:15.2,lon:39.8},{name:"Eswatini",continent:"Africa",lat:-26.5,lon:31.5},{name:"Ethiopia",continent:"Africa",lat:9.1,lon:40.5},{name:"Gabon",continent:"Africa",lat:-.6,lon:11.8},{name:"Gambia",continent:"Africa",lat:13.5,lon:-15.4},{name:"Ghana",continent:"Africa",lat:7.9,lon:-1.2},{name:"Guinea",continent:"Africa",lat:9.9,lon:-9.7},{name:"Guinea-Bissau",continent:"Africa",lat:11.8,lon:-15.2},{name:"Ivory Coast",continent:"Africa",lat:7.6,lon:-5.5},{name:"Kenya",continent:"Africa",lat:.2,lon:37.9},{name:"Lesotho",continent:"Africa",lat:-29.6,lon:28.2},{name:"Liberia",continent:"Africa",lat:6.4,lon:-9.4},{name:"Libya",continent:"Africa",lat:26.3,lon:17.2},{name:"Madagascar",continent:"Africa",lat:-18.8,lon:46.9},{name:"Malawi",continent:"Africa",lat:-13.2,lon:34.3},{name:"Mali",continent:"Africa",lat:17.3,lon:-3.5},{name:"Mauritania",continent:"Africa",lat:20.3,lon:-10.9},{name:"Mauritius",continent:"Africa",lat:-20.2,lon:57.5},{name:"Morocco",continent:"Africa",lat:31.8,lon:-6},{name:"Mozambique",continent:"Africa",lat:-18.7,lon:35.5},{name:"Namibia",continent:"Africa",lat:-22.1,lon:17.2},{name:"Niger",continent:"Africa",lat:17.6,lon:8.1},{name:"Nigeria",continent:"Africa",lat:9.1,lon:8.7},{name:"Rwanda",continent:"Africa",lat:-1.9,lon:29.9},{name:"Sao Tome and Principe",continent:"Africa",lat:.2,lon:6.6},{name:"Senegal",continent:"Africa",lat:14.5,lon:-14.5},{name:"Seychelles",continent:"Africa",lat:-4.6,lon:55.5},{name:"Sierra Leone",continent:"Africa",lat:8.5,lon:-11.8},{name:"Somalia",continent:"Africa",lat:5.2,lon:46.2},{name:"South Africa",continent:"Africa",lat:-30.6,lon:22.9},{name:"South Sudan",continent:"Africa",lat:7.3,lon:30.3},{name:"Sudan",continent:"Africa",lat:15.6,lon:32.5},{name:"Tanzania",continent:"Africa",lat:-6.2,lon:35.5},{name:"Togo",continent:"Africa",lat:8.6,lon:1},{name:"Tunisia",continent:"Africa",lat:34.1,lon:9.6},{name:"Uganda",continent:"Africa",lat:1.4,lon:32.3},{name:"Zambia",continent:"Africa",lat:-13.1,lon:27.8},{name:"Zimbabwe",continent:"Africa",lat:-19,lon:29.2},{name:"Afghanistan",continent:"Asia",lat:33.9,lon:67.7},{name:"Armenia",continent:"Asia",lat:40.2,lon:44.5},{name:"Azerbaijan",continent:"Asia",lat:40.4,lon:47.7},{name:"Bahrain",continent:"Asia",lat:26.1,lon:50.6},{name:"Bangladesh",continent:"Asia",lat:23.7,lon:90.4},{name:"Bhutan",continent:"Asia",lat:27.5,lon:90.4},{name:"Brunei",continent:"Asia",lat:4.5,lon:114.7},{name:"Cambodia",continent:"Asia",lat:12.6,lon:104.9},{name:"China",continent:"Asia",lat:35.9,lon:104.2},{name:"Cyprus",continent:"Asia",lat:35.1,lon:33.4},{name:"Georgia",continent:"Asia",lat:42.3,lon:43.4},{name:"India",continent:"Asia",lat:22.6,lon:79},{name:"Indonesia",continent:"Asia",lat:-2.5,lon:118},{name:"Iran",continent:"Asia",lat:32.4,lon:53.7},{name:"Iraq",continent:"Asia",lat:33.2,lon:43.7},{name:"Israel",continent:"Asia",lat:31,lon:35},{name:"Japan",continent:"Asia",lat:36.2,lon:138.3},{name:"Jordan",continent:"Asia",lat:31.2,lon:36.4},{name:"Kazakhstan",continent:"Asia",lat:48,lon:67},{name:"Kuwait",continent:"Asia",lat:29.3,lon:47.5},{name:"Kyrgyzstan",continent:"Asia",lat:41.2,lon:74.8},{name:"Laos",continent:"Asia",lat:19.9,lon:102.5},{name:"Lebanon",continent:"Asia",lat:33.9,lon:35.9},{name:"Malaysia",continent:"Asia",lat:4.2,lon:102},{name:"Maldives",continent:"Asia",lat:3.2,lon:73.2},{name:"Mongolia",continent:"Asia",lat:46.9,lon:103.8},{name:"Myanmar",continent:"Asia",lat:21.2,lon:96},{name:"Nepal",continent:"Asia",lat:28.4,lon:84.1},{name:"North Korea",continent:"Asia",lat:40.3,lon:127.5},{name:"Oman",continent:"Asia",lat:21.5,lon:55.9},{name:"Pakistan",continent:"Asia",lat:30.4,lon:69.4},{name:"Palestine",continent:"Asia",lat:31.9,lon:35.2},{name:"Philippines",continent:"Asia",lat:12.9,lon:122.8},{name:"Qatar",continent:"Asia",lat:25.3,lon:51.2},{name:"Saudi Arabia",continent:"Asia",lat:23.9,lon:45.1},{name:"Singapore",continent:"Asia",lat:1.35,lon:103.8},{name:"South Korea",continent:"Asia",lat:36.5,lon:127.9},{name:"Sri Lanka",continent:"Asia",lat:7.9,lon:80.7},{name:"Syria",continent:"Asia",lat:35,lon:38.5},{name:"Taiwan",continent:"Asia",lat:23.7,lon:121},{name:"Tajikistan",continent:"Asia",lat:38.9,lon:71},{name:"Thailand",continent:"Asia",lat:15.8,lon:101},{name:"Timor-Leste",continent:"Asia",lat:-8.9,lon:125.7},{name:"Turkey",continent:"Asia",lat:39,lon:35.2},{name:"Turkmenistan",continent:"Asia",lat:38.9,lon:59.4},{name:"United Arab Emirates",continent:"Asia",lat:24.4,lon:54.4},{name:"Uzbekistan",continent:"Asia",lat:41.4,lon:64.6},{name:"Vietnam",continent:"Asia",lat:14.1,lon:108.3},{name:"Yemen",continent:"Asia",lat:15.6,lon:48.5}
4112].forEach(z=>Ze(z)),Le("Africa",5),Le("Asia",5);const We=N.find(z=>z.name==="Mauritius");N.forEach(z=>{z.name!=="Mauritius"&&z.routeRegion&&De(We,z)}),l.add(new md(11453695,1.2));const je=new pd(16777215,2);je.position.set(-3.2,2.4,4.2),l.add(je);const it=new vl(46280,6,9);it.position.set(2.4,-1.2,3.2),l.add(it);const Ge=new vl(683730,3,10);Ge.position.set(-2.5,1.4,2.8),l.add(Ge);function mt(){const{clientWidth:z,clientHeight:se}=o;(o.width!==z||o.height!==se)&&(c.setSize(z,se,!1),d.aspect=z/se,d.updateProjectionMatrix())}const ct=Tn.degToRad(215),zt=-.04,I=ct;let gt=0,Be=0;function et(z){if(mt(),s){Be=z,n=requestAnimationFrame(et);return}const se=z*.001,x=Be?(z-Be)*.001:0;Be=z,m.rotation.y=I+gt,m.rotation.x=zt,w.material.opacity=.065+Math.sin(se*1.8)*.01,T.material.opacity=.14+Math.sin(se*2.2)*.018,P.material.opacity=.03+Math.sin(se*1.5)*.006,Object.entries(Z).forEach(([h,R])=>{se>=R.nextShuffle&&(Le(h,5),R.nextShuffle=se+R.interval+Math.random()*.9)}),Re(se),N.forEach((h,R)=>{var ve,ae;const X=h.permanent||((ve=Z[h.continent])==null?void 0:ve.active.has(R)),Q=!!h.routeRegion&&((ae=he[h.routeRegion])==null?void 0:ae.current)===h;h.targetGlow=h.permanent||X||Q?1:0,h.routeBoost+=((Q?1:0)-h.routeBoost)*.08,h.currentGlow+=(h.targetGlow-h.currentGlow)*.06;const te=Math.max(h.currentGlow,h.routeBoost),ie=.82+Math.sin(se*(h.permanent?2.1:3.4)+h.phase)*.18,q=h.permanent?1.55+Math.sin(se*2)*.16:.72+te*1.05*ie,J=h.permanent?1.38+Math.sin(se*2)*.07:.82+te*.42*ie,ue=h.persistent||te>.08;h.glow.visible=h.permanent||te>.08,h.marker.visible=ue,h.label&&(h.label.visible=!0),h.glow.scale.setScalar(q),h.marker.scale.setScalar(J),h.glow.material.opacity=h.permanent?.46+Math.sin(se*2)*.08:Math.max(0,(te-.08)/.92)*.34*ie,h.marker.material.opacity=h.persistent?1:Math.max(0,(te-.08)/.92)*.92,h.label&&(h.label.material.opacity=h.persistent?.9+Math.sin(se*1.8+h.phase)*.06:Math.max(0,(te-.08)/.92)*.95)}),H.forEach(h=>{var ie;if(!(((ie=he[h.regionKey])==null?void 0:ie.current)===h.targetMarker)){h.progress=0,h.fadeProgress=1,h.lastSampleCount=0,oe(h),h.segmentGroup.visible=!1,h.startGlowCap.visible=!1,h.startCoreCap.visible=!1,h.startGlowCap.material.opacity=0,h.startCoreCap.material.opacity=0;return}h.progress<1?(h.progress=Math.min(1,h.progress+x*h.speed),h.fadeProgress=1):h.fadeProgress=Math.max(.24,h.fadeProgress-x*.18);const Q=Math.max(3,Math.floor(h.sampledPoints.length*h.progress)),te=h.sampledPoints.slice(0,Q);we(h,te,h.fadeProgress),h.segmentGroup.visible=!0,h.startGlowCap.visible=!0,h.startCoreCap.visible=!0,h.startGlowCap.material.opacity=.16*h.fadeProgress,h.startCoreCap.material.opacity=.82*h.fadeProgress}),c.render(l,d),n=requestAnimationFrame(et)}s=!e.active,n=requestAnimationFrame(et),r=()=>{n!==null&&cancelAnimationFrame(n),n=null,c.dispose(),p.dispose()}}),eo(()=>{r&&r()}),(a,o)=>(Pe(),ke("div",m_,[B("canvas",{ref_key:"canvasRef",ref:t,class:"globe-canvas"},null,512)]))}}),__=fi(g_,[["__scopeId","data-v-e718fda5"]]),v_=["preload"],x_={class:"hero-content"},M_={class:"max-w-7xl mx-auto px-6 w-full grid lg:grid-cols-2 gap-12 items-center"},S_={class:"hero-text-pane"},y_={class:"text-5xl lg:text-6xl font-semibold leading-tight mb-6 drop-shadow-lg"},E_=["innerHTML"],b_=["innerHTML"],T_={class:"flex flex-wrap gap-4"},A_={key:0,class:"hero-metrics mt-8 flex flex-wrap items-center gap-x-7 gap-y-3"},w_={class:"label"},R_={key:0,class:"hero-globe-pane"},C_={key:1,class:"hidden lg:block","aria-hidden":"true"},P_={class:"hero-controls"},L_=["aria-label","onClick"],D_=["aria-label","aria-pressed"],I_=["value"],ea=6e3,U_=jt({__name:"HeroSection",setup(i){const e=K=>`${"/".replace(/\/+$/,"/")}assets/img/homepage/banners/${K}`,t=[{kind:"video",eyebrow:"A New Chapter",eyebrowTone:"blue",title:"Discover our",accent:"new identity",body:"We are writing a new chapter in our history with a renewed, forward-looking identity. More than just a logo, it is a promise we share with you every day. myt, Zordi dime... Viv li!",primary:"About us",primaryTo:"/about/about-us",secondary:"",secondaryTo:"",bg:e("HeroBanner-allmyt-day2.jpg"),bgTone:"default",videoSrc:{src:ia("allmyt-2026-day2.mp4")},hasAudio:!0},{kind:"video",eyebrow:"Event Highlight",eyebrowTone:"blue",title:"Mauritius Telecom connects at",accent:"allmyt Summit 2026",body:"Bringing people, partners and technology together to build a connected, AI-powered Mauritius.",primary:"Read the story",primaryTo:"/news/36/allmyt-summit-2026-mauritius-telecom-accelere-l-avenir-numerique-avec-une-vision",secondary:"About us",secondaryTo:"/about/about-us",bg:e("HeroBanner-allmyt.jpg"),bgTone:"default",videoSrc:{src:ia("allmyt-2026.mp4")}},{kind:"globe",eyebrow:"Strategy Plan 2026-2029",eyebrowTone:"cyan",title:"Bridging",accent:"Africa & Asia",body:"Mauritius at the heart of the Digital Ocean - a trusted, secure and resilient bridge building the connectivity, AI and financial backbone between two of the world's fastest-growing regions.",primary:"Explore the strategy",primaryTo:"/about/africa-asia-bridge",secondary:"About us",secondaryTo:"/about/about-us",bg:"",bgTone:"default"}],n=Ot(()=>t[s.value]),r=Ot(()=>n.value.kind==="globe"),s=$t(0),a=$t(0);let o=null,l=null,c=0,d=!1;const m=$t(!1),u=$t(!1),p=$t(.8),_=Ot(()=>!!n.value.hasAudio),y=Ot(()=>!u.value||p.value===0?"fa-solid fa-volume-xmark":p.value<.5?"fa-solid fa-volume-low":"fa-solid fa-volume-high"),g=new Map;function f(K,Z){K instanceof HTMLVideoElement?g.set(Z,K):g.delete(Z)}function S(){for(const[K,Z]of g)K===s.value?(Z.muted=!(u.value&&_.value),Z.volume=p.value,Z.play().catch(()=>{})):(Z.muted=!0,Z.paused||Z.pause())}function E(K){var Z;(Z=K.target)==null||Z.classList.add("is-playing")}function b(K){var Z;(Z=K.target)==null||Z.classList.remove("is-playing")}function w(K){const Z=K.target;if(Z instanceof HTMLVideoElement){for(const[he,re]of g)if(re===Z){he===s.value&&(Z.muted=!(u.value&&_.value),Z.volume=p.value,Z.play().catch(()=>{}));break}}}function T(K){s.value=(K+t.length)%t.length,U(),C(),ta(S)}function P(){T(s.value+1)}function v(){A(),o=window.setTimeout(P,ea)}function A(){o!==null&&(window.clearTimeout(o),o=null)}function U(){c=Date.now(),a.value=0,l!==null&&window.clearInterval(l),l=window.setInterval(()=>{if(d)return;const K=Date.now()-c;a.value=Math.min(100,K/ea*100)}
4112,60),d||v()}function C(){m.value||u.value&&_.value?d||(d=!0,A()):d&&(d=!1,c=Date.now()-a.value/100*ea,v())}function O(){m.value=!0,C()}function Y(){m.value=!1,C()}function $(){u.value=!u.value,u.value&&p.value===0&&(p.value=.8),V()}function N(K){p.value=K,u.value=K>0,V()}function V(){const K=g.get(s.value);K&&(K.muted=!u.value,K.volume=p.value,u.value&&K.play().catch(()=>{})),C()}cs(()=>{U(),ta(S)}),eo(()=>{A(),l!==null&&window.clearInterval(l)});function H(K){return K==="sky"?"bg-digital/20 border-digital/40 text-aqua-light":K==="blue"?"bg-myt/20 border-myt/40 text-myt-tint":"bg-aqua/15 border-aqua/40 text-aqua-light"}return(K,Z)=>{const he=Jl("hls");return Pe(),ke("header",{class:"hero-slider",onMouseenter:O,onMouseleave:Y},[B("div",{class:"hero-progress",style:na({width:a.value+"%"})},null,4),(Pe(),ke(Zt,null,Jt(t,(re,_e)=>B("div",{key:_e,class:Pt(["hero-slide",[{active:_e===s.value},re.kind==="globe"?"kind-globe":"",re.kind==="video"?"kind-video":"",re.bgTone==="cyan"?"tone-cyan":"",re.bgTone==="sky"?"tone-sky":""]]),style:na(re.bg?{backgroundImage:`url('${re.bg}')`,backgroundSize:"cover",backgroundPosition:"center"}:{})},[re.kind==="video"&&re.videoSrc?jl((Pe(),ke("video",{key:0,ref_for:!0,ref:Oe=>f(Oe,_e),class:"hero-video",autoplay:"",muted:"",loop:"",playsinline:"",preload:_e===s.value?"auto":"none","aria-hidden":"true",onCanplay:w,onPlaying:E,onPause:b},null,40,v_)),[[he,_e===s.value?re.videoSrc:""]]):cn("",!0)],6)),64)),yt(hu,{style:{"z-index":"3"},opacity:.8}),B("div",x_,[B("div",M_,[B("div",S_,[(Pe(),ke(Zt,null,Jt(t,(re,_e)=>B("div",{key:_e,class:Pt(["hero-text",{active:_e===s.value}])},[B("span",{class:Pt(["inline-block px-4 py-1 rounded-full text-sm font-semibold mb-6 backdrop-blur border",H(re.eyebrowTone)])},Qe(re.eyebrow.toUpperCase()),3),B("h1",y_,[Lt(Qe(re.title)+" ",1),Z[1]||(Z[1]=B("br",null,null,-1)),B("span",{class:"gradient-text",innerHTML:re.accent},null,8,E_)]),B("p",{class:"text-xl text-white/85 mb-8 max-w-xl",innerHTML:re.body},null,8,b_),B("div",T_,[yt(dt(hn),{to:re.primaryTo,class:"hero-btn-primary inline-flex items-center text-white font-semibold py-4 px-8 rounded-lg shadow-lg"},{default:dn(()=>[Lt(Qe(re.primary),1)]),_:2},1032,["to"]),re.secondary?(Pe(),Oi(dt(hn),{key:0,to:re.secondaryTo,class:"flex items-center gap-2 border border-white/30 hover:bg-white/10 py-4 px-8 rounded-lg transition backdrop-blur"},{default:dn(()=>[Lt(Qe(re.secondary)+" ",1),Z[2]||(Z[2]=B("i",{class:"fa-solid fa-arrow-right text-sm"},null,-1))]),_:2},1032,["to"])):cn("",!0)]),re.metrics?(Pe(),ke("div",A_,[(Pe(!0),ke(Zt,null,Jt(re.metrics,(Oe,Ze)=>(Pe(),ke("span",{key:Ze,class:"hero-metric"},[Z[3]||(Z[3]=B("i",{class:"fa-solid fa-circle-check text-aqua-light"},null,-1)),B("strong",null,Qe(Oe.value),1),B("span",w_,Qe(Oe.label),1)]))),128))])):cn("",!0)],2)),64))]),r.value?(Pe(),ke("div",R_,[yt(__,{active:r.value},null,8,["active"])])):(Pe(),ke("div",C_))])]),B("div",P_,[(Pe(),ke(Zt,null,Jt(t,(re,_e)=>B("button",{key:_e,class:Pt(["hero-dot",{active:_e===s.value}]),"aria-label":`Slide ${_e+1}`,onClick:Oe=>T(_e)},null,10,L_)),64))]),_.value?(Pe(),ke("div",{key:0,class:Pt(["hero-sound",{"is-on":u.value}])},[B("button",{type:"button",class:"hero-sound-btn","aria-label":u.value?"Mute video":"Unmute video","aria-pressed":u.value,onClick:$},[B("i",{class:Pt(y.value)},null,2)],8,D_),B("input",{type:"range",class:"hero-vol",min:"0",max:"1",step:"0.05",value:u.value?p.value:0,"aria-label":"Volume",onInput:Z[0]||(Z[0]=re=>N(re.target.valueAsNumber))},null,40,I_)],2)):cn("",!0)],32)}}}),N_=fi(U_,[["__scopeId","data-v-c2cbb31b"]]),F_=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O_(i){if(typeof i!="string"||!i)return"";const e=new Date(i);return Number.isNaN(e.getTime())?i:`${String(e.getDate()).padStart(2,"0")} ${F_[e.getMonth()]} ${e.getFullYear()}`}function qr(i){return typeof i=="string"?i.trim():""}function B_(i){return{id:typeof i.id=="string"||typeof i.id=="number"?i.id:String(i.id??""),title:qr(i.caption),excerpt:qr(i.sub_title),date:O_(i.start_date),image:tu("telecom_highlights",i.image),url:qr(i.url),linkLabel:qr(i.link_label)||"Read more"}}function Wl(i){const e=i.start_date;if(typeof e!="string")return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function z_(){const i=Qc(),e=Ot(()=>!!(i.ctx.baseUrl&&i.ctx.token)),t=eu({queryKey:["home","highlights"],queryFn:()=>i.home.listHighlights(),enabled:e});return{items:Ot(()=>[...t.data.value??[]].sort((s,a)=>
4112Wl(a)-Wl(s)).map(B_)),isPending:t.isPending,isFetching:t.isFetching,isError:t.isError,error:t.error,enabled:e}}const G_=/^\/(news\/press-releases|news\/press-communiques|news|about\/awards|sustainability\/environment|sustainability\/social)\/\d+/i;function V_(i){if(!i)return null;let e;try{e=new URL(i).pathname}catch{return null}return e=e.replace(/\/+$/,""),G_.test(e)?e:null}const Xl=i=>(i||"").replace(/<[^>]*>/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"").trim(),ql=i=>(i||"").trim().replace(/\/+$/,"").toLowerCase();function k_(){const{items:i}=nu(),e=Ot(()=>{const r=new Map,s=new Map;for(const a of i.value){const o=Xl(a.title);o&&!r.has(o)&&r.set(o,a.id);const l=ql(a.url);l&&!s.has(l)&&s.set(l,a.id)}return{byTitle:r,byUrl:s}});function t(r){const{byTitle:s,byUrl:a}=e.value,o=ql(r.url||"");if(o&&a.has(o))return a.get(o);const l=Xl(r.title||"");return l&&s.has(l)?s.get(l):null}function n(r){const s=V_(r.url);if(s)return s;const a=t(r);return a!=null?`/news/${a}`:"/news"}return{resolveId:t,resolveRoute:n}}const H_={class:"v2-block"},W_={class:"v2-wrap"},X_={class:"v2-block-head"},q_={class:"v2-carousel-nav"},Y_=["onClick","onKeydown"],$_={class:"v2-cnews-body"}
4112,K_={key:0,class:"v2-cnews-date"},Z_={key:1},J_=jt({__name:"NewsV2",setup(i){const e=iu(),{resolveRoute:t}=k_(),n="/".replace(/\/+$/,"/"),r=f=>`${n}assets/img/news/${f}`,s=[{id:"c1",title:"When technology meets culture and tradition",excerpt:"Humanoid robot Vera and robotic dog Bumble at the Chinese New Year International Gala 2026.",date:"13 Feb 2026",image:r("855ab8ea-bedb-40c6-99ad-ccc09de1f0af.jpg"),url:""},{id:"c2",title:"MT stands by the pilgrims at Ganga Talao",excerpt:"Mauritius Telecom was present at Ganga Talao to support the pilgrims.",date:"09 Feb 2026",image:r("236a64d7-d8ed-4a6b-bd3d-702ba7a97ea0.jpg"),url:""},{id:"c3",title:"Transforming education with AI in Mauritius",excerpt:"Launch of the mytGPT educational project across the island.",date:"26 Jan 2026",image:r("6dfdfd4a-bb12-4de2-80dd-5c4226a44791.jpg"),url:""},{id:"c4",title:"Next-gen subsea fibre deployment reaches a milestone",excerpt:"Strengthening the Africa-Asia bridge with new low-latency routes.",date:"20 Jan 2026",image:r("e74a574b-e870-46ae-9896-8fbe76d3ccc0.jpg"),url:""},{id:"c5",title:"Expanding AI data centres across the network",excerpt:"Hyperscale infrastru
4112cture for sovereign AI workloads.",date:"12 Jan 2026",image:r("90766529-16a6-4e9b-8a9b-5fe5f86b20a9.jpg"),url:""}],{items:a}=z_();function o(f){if(typeof document>"u")return f.replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'");const S=document.createElement("textarea");return S.innerHTML=f,S.value}const l=f=>o((f||"").replace(/<[^>]*>/g," ")).replace(/\s+/g," ").trim(),c=(f,S=120)=>{const E=l(f);return E.length<=S?E:E.slice(0,S).replace(/\s+\S*$/,"")+"..."},d=f=>l(f).toLowerCase().replace(/[^a-z0-9]+/g,""),m=f=>(f.split("?")[0].split("/").pop()||"").toLowerCase(),u=Ot(()=>{const f=[],S=new Set,E=new Set,b=w=>{const T=l(w.title),P=d(T),v=m(w.image);!T||!w.image||!P||S.has(P)||v&&E.has(v)||(S.add(P),v&&E.add(v),f.push({id:w.id,title:T,excerpt:c(w.body||""),date:w.date||"",image:w.image,url:w.url||""}))};return a.value.forEach(w=>b({id:w.id,title:w.title,body:w.excerpt,date:w.date,image:w.image,url:w.url})),f.length>=3?f:s}),p=$t(null);function _(f){const S=p.value;if(!S)return;const E=S.querySelector(".v2-cnews"),b=E?E.offsetWidth+20:S.clientWidth*.8;S.scrollBy({left:f*b,behavior:"smooth"})}function y(f){try{return/(^|\.)telecom\.mu$/i.test(new URL(f).hostname)}catch{return!1}}function g(f){if(f.url&&/^https?:/i.test(f.url)&&!y(f.url)){window.open(f.url,"_blank","noopener");return}e.push(t(f))}return(f,S)=>(Pe(),ke("section",H_,[B("div",W_,[B("div",X_,[S[6]||(S[6]=B("div",null,[B("span",{class:"v2-eyebrow"},"News & Updates"),B("h2",{class:"v2-h2"},"What's happening across the network.")],-1)),B("div",q_,[B("button",{type:"button",class:"v2-arrow","aria-label":"Previous",onClick:S[0]||(S[0]=E=>_(-1))},[...S[3]||(S[3]=[B("i",{class:"fa-solid fa-chevron-left"},null,-1)])]),B("button",{type:"button",class:"v2-arrow","aria-label":"Next",onClick:S[1]||(S[1]=E=>_(1))},[...S[4]||(S[4]=[B("i",{class:"fa-solid fa-chevron-right"},null,-1)])]),B("button",{type:"button",class:"v2-link",onClick:S[2]||(S[2]=E=>dt(e).push("/news"))},[...S[5]||(S[5]=[Lt(" View all ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])])])]),B("div",{ref_key:"track",ref:p,class:"v2-carousel"},[(Pe(!0),ke(Zt,null,Jt(u.value,E=>(Pe(),ke("article",{key:E.id,class:"v2-card v2-cnews",role:"link",tabindex:"0",onClick:b=>g(E),onKeydown:ru(b=>g(E),["enter"])},[B("div",{class:"v2-cnews-img",style:na({backgroundImage:`url('${E.image}')`})},null,4),B("div",$_,[E.date?(Pe(),ke("span",K_,Qe(E.date),1)):cn("",!0),B("h3",null,Qe(E.title),1),E.excerpt?(Pe(),ke("p",Z_,Qe(E.excerpt),1)):cn("",!0),S[7]||(S[7]=B("span",{class:"v2-cnews-more"},[Lt("Read more "),B("i",{class:"fa-solid fa-arrow-right"})],-1))])],40,Y_))),128))],512)])]))}}),j_={id:"education",class:"px-6 py-8 bg-news-light"},Q_={class:"max-w-7xl mx-auto"},e0={class:"edu-section px-8 lg:px-14 py-14 in-view"},t0={class:"edu-inner grid lg:grid-cols-12 gap-10 items-center"},n0={class:"lg:col-span-7"},i0={class:"mt-7 flex flex-wrap gap-3"},r0={class:"lg:col-span-5 grid grid-cols-1 sm:grid-cols-2 gap-3"},s0={class:"feat-icon"},a0=jt({__name:"EducationSection",setup(i){const e=[{icon:"fa-graduation-cap",title:"Adaptive Learning",body:"AI tutors that adjust to each student's pace and level in real time, with trilingual support in English, French and Kreol Morisien."},{icon:"fa-school",title:"Connected Classrooms",body:"High-speed fibre and managed Wi-Fi rolled out to schools across all nine districts, with safe-browsing and content filtering built in."},{icon:"fa-microchip",title:"Teacher AI Toolkit",body:"Lesson planning, grading assistance and class analytics that give teachers back hours each week to focus on students."},{icon:"fa-handshake-angle",title:"Skills for the Future",body:"Coding, robotics and AI-literacy clubs reaching 40+ schools nationwide, opening pathways into the digital economy."}];return(t,n)=>(Pe(),ke("section",j_,[B("div",Q_,[B("div",e0,[n[4]||(n[4]=B("div",{class:"edu-bg","aria-hidden":"true"},null,-1)),n[5]||(n[5]=B("div",{class:"edu-overlay","aria-hidden":"true"},null,-1)),B("div",t0,[B("div",n0,[n[1]||(n[1]=B("span",{class:"edu-eyebrow"},"Education for tomorrow",-1)),n[2]||(n[2]=B("h2",{class:"edu-headline"},[Lt(" Transforming Education "),B("br"),Lt(" with "),B("span",{class:"accent"},"AI in Mauritius.")],-1)),n[3]||(n[3]=B("p",{class:"edu-lead"}
4112," From rural primary schools to tertiary campuses, we're partnering with educators across the island to bring intelligent tools, fast connectivity, and personalised learning into every classroom - preparing the next generation for an AI-driven economy. ",-1)),B("div",i0,[yt(dt(hn),{to:"/news/28",class:"edu-cta-primary"},{default:dn(()=>[...n[0]||(n[0]=[Lt(" Learn more ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])]),_:1})])]),B("div",r0,[(Pe(),ke(Zt,null,Jt(e,(r,s)=>B("div",{key:s,class:"edu-feature"},[B("div",s0,[B("i",{class:Pt(["fa-solid",r.icon])},null,2)]),B("h4",null,Qe(r.title),1),B("p",null,Qe(r.body),1)])),64))])])])])]))}}),o0={id:"ai-showcase",class:"ai-banner-sec px-6 py-8"},l0={class:"max-w-7xl mx-auto"},c0={class:"ai-banner-panel px-8 lg:px-14 py-14"},u0={class:"ai-banner-inner"},h0={class:"ai-banner-copy"},d0={class:"ai-banner-actions"},f0={class:"ai-banner-grid"},p0={class:"ai-banner-icon"},m0={class:"ai-banner-text"},g0=jt({__name:"AiShowcaseBanner",setup(i){return(e,t)=>(Pe(),ke("section",o0,[B("div",l0,[B("div",c0,[B("div",u0,[B("div",h0,[t[1]||(t[1]=B("span",{class:"ai-banner-eyebrow"},"Artificial Intelligence",-1)),t[2]||(t[2]=B("h2",{class:"ai-banner-title"}," Five ways we are building AI for Mauritius. ",-1)),t[3]||(t[3]=B("p",{class:"ai-banner-lead"}," From sovereign generative AI to a national registry of trusted models, our AI initiatives are built and hosted here, on infrastructure we own and operate. ",-1)),B("div",d0,[yt(dt(hn),{to:"/ai-initiatives",class:"ai-banner-cta"},{default:dn(()=>[...t[0]||(t[0]=[Lt(" Discover our AI initiatives ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])]),_:1})])]),B("ul",f0,[(Pe(!0),ke(Zt,null,Jt(dt(ra),n=>(Pe(),ke("li",{key:n.id,class:Pt(["ai-banner-row",{"is-wide":n.id==="ai-registry"}])},[B("span",p0,[B("i",{class:Pt(["fa-solid",n.icon])},null,2)]),B("span",m0,[B("strong",null,Qe(n.name),1),B("small",null,Qe(n.short),1)])],2))),128))])])])])]))}}),_0=fi(g0,[["__scopeId","data-v-d23aedbc"]]),v0={id:"education",class:"px-6 py-8 bg-news-light"},x0={class:"max-w-7xl mx-auto"},M0={class:"edu-section px-8 lg:px-14 py-14 in-view"},S0={class:"edu-inner ai-edu-split"},y0={class:"ai-edu-copy"},E0={class:"mt-7 flex flex-wrap gap-3"},b0={class:"ai-edu-cards"},T0={class:"ai-edu-grid"},A0={class:"feat-icon"},w0={key:0,class:"edu-feature ai-edu-card ai-edu-wide"},R0={class:"feat-icon"},C0={class:"ai-edu-wide-body"},P0=jt({__name:"AiEducationSection",setup(i){const e=ra.find(n=>n.id==="ai-registry"),t=ra.filter(n=>n.id!=="ai-registry");return(n,r)=>(Pe(),ke("section",v0,[B("div",x0,[B("div",M0,[r[4]||(r[4]=B("div",{class:"edu-bg","aria-hidden":"true"},null,-1)),r[5]||(r[5]=B("div",{class:"edu-overlay","aria-hidden":"true"},null,-1)),B("div",S0,[B("div",y0,[r[1]||(r[1]=B("span",{class:"v2-eyebrow on-dark"},"AI at Mauritius Telecom",-1)),r[2]||(r[2]=B("h2",{class:"edu-headline"}," Five initiatives bringing AI to Mauritius. ",-1)),r[3]||(r[3]=B("p",{class:"edu-lead"}," Sovereign generative AI, adaptive learning for every classroom, local GPU capacity, assistants that speak the way Mauritius speaks, and a national registry of trusted models - built and hosted here on our own infrastructure, so organisations across the island can adopt AI with confidence. ",-1)),B("div",E0,[yt(dt(hn),{to:"/ai-initiatives",class:"edu-cta-primary"},{default:dn(()=>[...r[0]||(r[0]=[Lt(" Learn more with our 5 initiatives ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])]),_:1})])]),B("div",b0,[B("ul",T0,[(Pe(!0),ke(Zt,null,Jt(dt(t),s=>(Pe(),ke("li",{key:s.id,class:"edu-feature ai-edu-card"},[B("div",A0,[B("i",{class:Pt(["fa-solid",s.icon])},null,2)]),B("h4",null,Qe(s.name),1),B("p",null,Qe(s.short),1)]))),128)),dt(e)?(Pe(),ke("li",w0,[B("div",R0,[B("i",{class:Pt(["fa-solid",dt(e).icon])},null,2)]),B("div",C0,[B("h4",null,Qe(dt(e).name),1),B("p",null,Qe(dt(e).short),1)])])):cn("",!0)])])])])])]))}}),L0=fi(P0,[["__scopeId","data-v-a85f906c"]]),Qa="cor.aiShowcaseVariant",Yl="2";function $l(i){return i==="current"||i==="1"||i==="2"}function D0(){var e;if(typeof window>"u")return{variant:Yl,opted:!1,fromQuery:!1};const i=(e=new URLSearchParams(window.location.search).get("ai"))==null?void 0:e.toLowerCase();if($l(i)){try{window.localStorage.setItem(Qa,i)}catch{}return{variant:i,opted:!0,fromQuery:!0}}try{const t=window.localStorage.getItem(Qa);if($l(t))return{variant:t,opted:!0,fromQuery:!1}}catch{}return{variant:Yl,opted:!1,fromQuery:!1}}const yo=D0(),Kl=$t(yo.variant),Zl=$t(yo.opted),I0=$t(yo.fromQuery);function Gc(){function i(e){Kl.value=e,Zl.value=!0;try{window.localStorage.setItem(Qa,e)}catch{}}return{variant:Kl,opted:Zl,fromQuery:I0,setVariant:i}}const Vc={1:"ai-showcase",2:"education"};function kc(i){const e=document.getElementById(i);if(!e)return;const t=document.querySelector(".mtm-nav-bar"),n=(t?t.getBoundingClientRect().height:0)+12,r=window.matchMedia("(prefers-reduced-motion: reduce)").matches;window.scrollTo({top:e.getBoundingClientRect().top+window.scrollY-n,behavior:r?"auto":"smooth"})}const U0={key:0,class:"ai-switch",role:"group","aria-label":"Homepage proposal"},N0=["aria-pressed","onClick"],F0=jt({__name:"AiVariantSwitch",setup(i){const{variant:e,opted:t,setVariant:n}=Gc(),r=[{value:"current",label:"Current"},{value:"1",label:"1 · Banner"},{value:"2",label:"2 · Education"}];async function s(a){n(a);const o=Vc[a];o&&(await ta(),kc(o))}return(a,o)=>dt(t)?(Pe(),ke("div",U0,[o[0]||(o[0]=B("span",{class:"ai-switch-label"},"Homepage",-1)),(Pe(),ke(Zt,null,Jt(r,l=>B("button",{key:l.value,type:"button",class:Pt(["ai-switch-btn",{"is-on":dt(e)===l.value}]),"aria-pressed":dt(e)===l.value,onClick:c=>s(l.value)},Qe(l.label),11,N0)),64))])):cn("",!0)}}
4112),O0=fi(F0,[["__scopeId","data-v-42910111"]]),B0={class:"v2-wrap v2-arsec-inner"},z0={class:"v2-ar-top"},G0={class:"v2-eyebrow on-dark"},V0={class:"yr"},k0={class:"v2-ar-btns"},H0=["href","download"],W0={key:0},X0={class:"v2-ar-stats"},q0={class:"v"},Y0={class:"l"},$0={class:"v2-ar-past"},K0={class:"v2-ar-past-head"},Z0={class:"v2-ar-grid"},J0=["href","download"],j0={class:"y"},Q0={class:"m"},ev=jt({__name:"AnnualReportV2",setup(i){const e={src:au("homeBanner-B9ebwk4e.mp4"),fallback:ia("homeBanner-B9ebwk4e.mp4")},t={"--v2-ar-poster":`url('${ou("homeBanner-poster.jpg")}')`},n=$t(!1),r={id:"fb-latest",year:"2025",title:"Mauritius Telecom Annual Report 2025",pdfUrl:"#",pdfFilesizeMb:"",coverImage:""},s=[{id:"fb-2024",year:"2024",title:"",pdfUrl:"#",pdfFilesizeMb:"",coverImage:""},{id:"fb-2023",year:"2023",title:"",pdfUrl:"#",pdfFilesizeMb:"",coverImage:""},{id:"fb-2022",year:"2022",title:"",pdfUrl:"#",pdfFilesizeMb:"",coverImage:""},{id:"fb-2021",year:"2021",title:"",pdfUrl:"#",pdfFilesizeMb:"",coverImage:""}],a=[{icon:"fa-arrow-trend-up",value:"Rs 13.5 bn",label:"Revenue"},{icon:"fa-coins",value:"Rs 1.1 bn",label:"Net Profit"},{icon:"fa-chart-line",value:"Rs 2.7 bn",label:"Capital Expenditure"},{icon:"fa-vault",value:"Rs 27 bn",label:"Total Assets"}],{items:o,latest:l}=su(),c=Ot(()=>l.value??r),d=Ot(()=>{const p=Number(c.value.year);return Number.isFinite(p)&&p>2025?p:2025}),m=Ot(()=>String(d.value)),u=Ot(()=>{const p=o.value.filter(_=>{const y=Number(_.year);return Number.isFinite(y)&&y<d.value});return p.length>0?p.slice(0,4):s});return(p,_)=>{const y=Jl("hls");return Pe(),ke("section",{class:"v2-arsec",style:t},[jl(B("video",{class:Pt(["v2-arsec-bg",{"is-playing":n.value}]),autoplay:"",muted:"",loop:"",playsinline:"",preload:"auto","aria-hidden":"true",onPlaying:_[0]||(_[0]=g=>n.value=!0),onPause:_[1]||(_[1]=g=>n.value=!1)},null,34),[[y,e]]),B("div",B0,[B("div",z0,[B("div",null,[B("span",G0,"Investor relations · FY "+Qe(m.value),1),B("h2",null,[_[2]||(_[2]=Lt("Annual Report ",-1)),B("span",V0,Qe(m.value),1)]),_[6]||(_[6]=B("p",{class:"v2-ar-lead"}," The full year in review - strategy, performance, governance, ESG progress and the outlook on bridging Africa and Asia through trusted digital infrastructure. ",-1)),B("div",k0,[yt(dt(hn),{to:"/investor/annual-reports",class:"v2-ar-btn primary"},{default:dn(()=>[..._[3]||(_[3]=[Lt(" Read the report ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])]),_:1}),B("a",{href:c.value.pdfUrl||"#",download:c.value.pdfUrl&&c.value.pdfUrl!=="#"?"":void 0,class:"v2-ar-btn ghost"},[_[4]||(_[4]=B("i",{class:"fa-solid fa-file-pdf"},null,-1)),_[5]||(_[5]=Lt(" Download PDF",-1)),c.value.pdfFilesizeMb?(Pe(),ke("span",W0," · "+Qe(c.value.pdfFilesizeMb),1)):cn("",!0)],8,H0)])]),B("div",X0,[(Pe(),ke(Zt,null,Jt(a,(g,f)=>B("div",{key:f,class:"v2-ar-stat"},[B("i",{class:Pt(["fa-solid",g.icon])},null,2),B("span",q0,Qe(g.value),1),B("span",Y0,Qe(g.label),1)])),64))])]),B("div",$0,[B("div",K0,[_[8]||(_[8]=B("span",{class:"lbl"},"Past reports",-1)),yt(dt(hn),{to:"/investor/annual-reports"},{default:dn(()=>[..._[7]||(_[7]=[Lt("All reports ",-1),B("i",{class:"fa-solid fa-arrow-right"},null,-1)])]),_:1})]),B("div",Z0,[(Pe(!0),ke(Zt,null,Jt(u.value,g=>(Pe(),ke("a",{key:g.id,href:g.pdfUrl||"#",download:g.pdfUrl&&g.pdfUrl!=="#"?"":void 0,class:"v2-ar-card"},[B("span",j0,Qe(g.year),1),B("span",Q0,[_[9]||(_[9]=B("i",{class:"fa-solid fa-file-pdf"},null,-1)),Lt(" "+Qe(g.pdfFilesizeMb||"Download"),1)])],8,J0))),128))])])])])}}}),tv={class:"v2-block"},nv={class:"v2-wrap"},iv={class:"filings-panel"},rv={class:"filings-inner"},sv={class:"filings-grid"},av={class:"filing-ic"},ov={class:"filing-text"},lv={class:"t"},cv={class:"m"},uv="/investor/corporate-governance",hv=jt({__name:"FilingsV2",setup(i){const e=[{title:"Corporate Governance Report",icon:"fa-scale-balanced",match:s=>/governance report/i.test(s)},{title:"Statement of Compliance",icon:"fa-clipboard-check",match:s=>/statement of compliance/i.test(s)},{title:"Constitution of Mauritius Telecom",icon:"fa-landmark",match:s=>/constitution/i.test(s)},{title:"Code of Conduct",icon:"fa-book",match:s=>/code of conduct/i.test(s)&&!/supplier/i.test(s)}],{items:t}=lu(),n=Ot(()=>t.value.flatMap(s=>s.documents)),r=Ot(()=>e.map(s=>{const a=n.value.find(o=>s.match(o.label));return{title:s.title,icon:s.icon,meta:"PDF",href:a==null?void 0:a.url,downloadName:(a==null?void 0:a.downloadName)||"",to:a?void 0:uv}}));return(s,a)=>(Pe(),ke("section",tv,[B("div",nv,[B("div",iv,[a[4]||(a[4]=B("div",{class:"glow-orb o1","aria-hidden":"true"},null,-1)),a[5]||(a[5]=B("div",{class:"glow-orb o2","aria-hidden":"true"},null,-1)),B("div",rv,[a[1]||(a[1]=B("span",{class:"filings-eyebrow"},"Investor relations",-1)),a[2]||(a[2]=B("h2",{class:"filings-headline"},"Regulatory Filings & Reports",-1)),a[3]||(a[3]=B("p",{class:"filings-lead"}," Complete transparency through centralised archival of our governance and compliance documentation. ",-1)),B("div",sv,[(Pe(!0),ke(Zt,null,Jt(r.value,(o,l)=>(Pe(),Oi(cu(o.href?"a":dt(hn)),{key:l,class:"filing-card",to:o.href?void 0:o.to,href:o.href||void 0,target:o.href?"_blank":void 0,rel:o.href?"noopener":void 0,download:o.href?o.downloadName||"":void 0},{default:dn(()=>[B("span",av,[B("i",{class:Pt(["fa-solid",o.icon])},null,2)]),B("span",ov,[B("span",lv,Qe(o.title),1),B("span",cv,Qe(o.meta),1)]),a[0]||(a[0]=B("i",{class:"filing-arrow fa-solid fa-arrow-right"},null,-1))]),_:2},1032,["to","href","target","rel","download"]))),128))])])])])]))}}
4112),dv=fi(hv,[["__scopeId","data-v-b0e81460"]]),fv={class:"v2-block"},pv={class:"v2-wrap"},mv={class:"green-stage"},gv={class:"green-content"},_v={class:"green-cards"},vv={class:"green-card-ic"},xv=jt({__name:"GreenDataV2",setup(i){const e="/".replace(/\/+$/,"/"),t=`${e}assets/videos/green1.mp4`,n=`${e}assets/videos/green1.webm`,r=$t(null),s=$t(!1);cs(()=>{const o=r.value;if(!o)return;const l=()=>o.play().catch(()=>{});o.readyState>=2?l():o.addEventListener("canplay",l,{once:!0})});const a=[{icon:"fa-leaf",title:"Environmental",body:"Energy-efficient hardware, recyclable packaging, and lifecycle programmes that keep e-waste out of landfills. Every access point we deploy is built to last and easy to repurpose.",to:"/sustainability/environment"},{icon:"fa-people-group",title:"Social",body:"Free guest Wi-Fi for community spaces, digital-skills workshops for underserved schools, and partnerships that bring reliable connectivity to where it matters most.",to:"/sustainability/social"},{icon:"fa-shield-halved",title:"Governance",body:"Transparent data practices, ethical supply chains, and a board-level review of every major procurement decision. We hold ourselves to standards we publish openly.",to:"/investor/corporate-governance"}];return(o,l)=>(Pe(),ke("section",fv,[B("div",pv,[B("div",mv,[B("video",{ref_key:"videoEl",ref:r,class:Pt(["green-bg",{"is-playing":s.value}]),autoplay:"",muted:"",loop:"",playsinline:"",preload:"auto",onPlaying:l[0]||(l[0]=c=>s.value=!0),onPause:l[1]||(l[1]=c=>s.value=!1)},[B("source",{src:n,type:"video/webm"}),B("source",{src:t,type:"video/mp4"})],34),l[4]||(l[4]=B("div",{class:"green-scrim"},null,-1)),B("div",gv,[l[3]||(l[3]=B("div",{class:"green-head"},[B("span",{class:"green-eyebrow"},"Our ESG commitment"),B("h2",{class:"green-h2"},"Connectivity with a conscience."),B("p",{class:"green-sub"}," Building networks that respect the planet, empower communities, and operate with integrity at every step. ")],-1)),B("div",_v,[(Pe(),ke(Zt,null,Jt(a,(c,d)=>yt(dt(hn),{key:d,to:c.to,class:"green-card"},{default:dn(()=>[B("span",vv,[B("i",{class:Pt(["fa-solid",c.icon])},null,2)]),B("h4",null,Qe(c.title),1),B("p",null,Qe(c.body),1),l[2]||(l[2]=B("span",{class:"green-card-more"},[Lt(" Explore "),B("i",{class:"fa-solid fa-arrow-right"})],-1))]),_:2},1032,["to"])),64))])])])])]))}}),Mv=fi(xv,[["__scopeId","data-v-89371672"]]),Sv={class:"v2-block"},yv={class:"v2-wrap"},Ev={class:"v2-careers v2-card"},bv={class:"v2-careers-main"}
4112,Tv={key:0,class:"v2-careers-media-tag"},Av=jt({__name:"CareersV2",setup(i){const{count:e,isSuccess:t}=uu({mode:"live",status:"open"}),n=Ot(()=>t.value&&e.value>0),r=Ot(()=>e.value===1?"1 Role":`${e.value}+ Roles`);return(s,a)=>(Pe(),ke("section",Sv,[B("div",yv,[B("div",Ev,[B("div",bv,[a[2]||(a[2]=B("span",{class:"v2-eyebrow"},"Careers",-1)),a[3]||(a[3]=B("h2",{class:"v2-h2"},"Build what comes next",-1)),a[4]||(a[4]=B("p",{class:"v2-section-sub"}," Mauritius Telecom is where engineers, designers and operators build the digital and AI foundation of the island. Discover our teams, our culture and where your career could grow with us. ",-1)),a[5]||(a[5]=B("p",{class:"v2-careers-line"}," Shape island-scale impact with the teams behind Mauritius' digital future. ",-1)),yt(dt(hn),{to:"/careers",class:"v2-ar-btn primary",style:{"margin-top":"1.4rem"}},{default:dn(()=>[a[0]||(a[0]=B("i",{class:"fa-solid fa-briefcase"},null,-1)),Lt(" "+Qe(n.value?"Open positions":"Visit Careers")+" ",1),a[1]||(a[1]=B("i",{class:"fa-solid fa-arrow-right"},null,-1))]),_:1})]),yt(dt(hn),{to:"/careers",class:"v2-careers-media","aria-label":"Careers at Mauritius Telecom"},{default:dn(()=>[a[6]||(a[6]=B("img",{src:"https://images.unsplash.com/photo-1522071820081-009f0129c71c?auto=format&fit=crop&w=900&q=80",alt:"A team collaborating in a modern office",loading:"lazy"},null,-1)),n.value?(Pe(),ke("span",Tv,Qe(r.value)+" open",1)):cn("",!0)]),_:1})])])]))}}),wv={class:"home-v2"},Rv=jt({__name:"HomeV2",setup(i){const{variant:e,fromQuery:t}=Gc();let n;return cs(()=>{const r=Vc[e.value];!t.value||!r||(n=window.setTimeout(()=>kc(r),350))}),eo(()=>window.clearTimeout(n)),(r,s)=>(Pe(),ke("div",wv,[yt(Jc,{"preserve-aspect-ratio":"none"}),yt(N_),dt(e)==="1"?(Pe(),Oi(_0,{key:0})):cn("",!0),yt(J_),dt(e)==="2"?(Pe(),Oi(L0,{key:1})):(Pe(),Oi(a0,{key:2})),yt(ev),yt(dv),yt(Mv),yt(Av),yt(O0)]))}}),Iv=jt({__name:"HomeView",setup(i){return(e,t)=>(Pe(),Oi(Rv))}});
4112export{Iv 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.