1import{Ea as bo,Fa as Eo,Ja as wo,Ka as To,La as Ao}from"./chunk-IXMKRBWN.js";import{c as Co,d as Ro}from"./chunk-X3PXUVTF.js";import"./chunk-PEPD7EMO.js";import{Bc as Mo,Cc as So,Fb as Se,Pb as pr,Qb as mr,Rb as Yn,_b as $i,hb as _o,kb as Te,lb as fr,mc as xo,nc as vo,qa as ae,wc as oe,yc as yo}from"./chunk-64X4WI3Q.js";import"./chunk-MZKC4XMG.js";import{i as dr}from"./chunk-WFPZTNQC.js";var ja="167",Vn={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Hn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Sl=0,Po=1,bl=2;var Fc=1,Qa=2,nn=3,Mn=0,be=1,De=2,vn=0,pi=1,Io=2,Lo=3,Do=4,El=5,Ln=100,wl=101,Tl=102,Al=103,Cl=104,Rl=200,Pl=201,Il=202,Ll=203,Xr=204,Yr=205,Dl=206,Ul=207,Nl=208,Ol=209,Fl=210,Bl=211,zl=212,kl=213,Vl=214,Hl=0,Gl=1,Wl=2,Cs=3,Xl=4,Yl=5,ql=6,Zl=7,Bc=0,Jl=1,Kl=2,yn=0,$l=1,jl=2,Ql=3,th=4,eh=5,nh=6,ih=7;var Uo=300,xi=301,vi=302,qr=303,Zr=304,sr=306,Jr=1e3,Un=1001,Kr=1002,Ue=1003,sh=1004;var ji=1005;var Ve=1006,gr=1007;var Nn=1008;var an=1009,zc=1010,kc=1011,Hi=1012,to=1013,On=1014,sn=1015,Zi=1016,eo=1017,no=1018,yi=1020,Vc=35902,Hc=1021,Gc=1022,He=1023,Wc=1024,Xc=1025,mi=1026,Mi=1027,Yc=1028,io=1029,qc=1030,so=1031;var ro=1033,bs=33776,Es=33777,ws=33778,Ts=33779,$r=35840,jr=35841,Qr=35842,ta=35843,ea=36196,na=37492,ia=37496,sa=37808,ra=37809,aa=37810,oa=37811,ca=37812,la=37813,ha=37814,ua=37815,da=37816,fa=37817,pa=37818,ma=37819,ga=37820,_a=37821,As=36492,xa=36494,va=36495,Zc=36283,ya=36284,Ma=36285,Sa=36286;var Rs=2300,ba=2301,_r=2302,No=2400,Oo=2401,Fo=2402;var rh=3200,ah=3201;var Jc=0,oh=1,xn="",Xe="srgb",bn="srgb-linear",ao="display-p3",rr="display-p3-linear",Ps="linear",Zt="srgb",Is="rec709",Ls="p3";var qn=7680;var Bo=519,ch=512,lh=513,hh=514,Kc=515,uh=516,dh=517,fh=518,ph=519,zo=35044;var ko="300 es",rn=2e3,Ds=2001,qe=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let s=this._listeners[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let n=this._listeners[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,t);t.target=null}}},ge=["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"],Vo=1234567,Bi=Math.PI/180,Gi=180/Math.PI;function Ai(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ge[i&255]+ge[i>>8&255]+ge[i>>16&255]+ge[i>>24&255]+"-"+ge[t&255]+ge[t>>8&255]+"-"+ge[t>>16&15|64]+ge[t>>24&255]+"-"+ge[e&63|128]+ge[e>>8&255]+"-"+ge[e>>16&255]+ge[e>>24&255]+ge[n&255]+ge[n>>8&255]+ge[n>>16&255]+ge[n>>24&255]).toLowerCase()}function xe(i,t,e){return Math.max(t,Math.min(e,i))}function oo(i,t){return(i%t+t)%t}function mh(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}
vendor: 4,377 bytes, line 1
1function gh(i,t,e){return i!==t?(e-i)/(t-i):0}function zi(i,t,e){return(1-e)*i+e*t}function _h(i,t,e,n){return zi(i,t,1-Math.exp(-e*n))}function xh(i,t=1){return t-Math.abs(oo(i,t*2)-t)}function vh(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function yh(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Mh(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Sh(i,t){return i+Math.random()*(t-i)}function bh(i){return i*(.5-Math.random())}function Eh(i){i!==void 0&&(Vo=i);let t=Vo+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function wh(i){return i*Bi}function Th(i){return i*Gi}function Ah(i){return(i&i-1)===0&&i!==0}function Ch(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Rh(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Ph(i,t,e,n,s){let r=Math.cos,a=Math.sin,o=r(e/2),c=a(e/2),l=r((t+n)/2),h=a((t+n)/2),p=r((t-n)/2),d=a((t-n)/2),m=r((n-t)/2),_=a((n-t)/2);switch(s){case"XYX":i.set(o*h,c*p,c*d,o*l);break;case"YZY":i.set(c*d,o*h,c*p,o*l);break;case"ZXZ":i.set(c*p,c*d,o*h,o*l);break;case"XZX":i.set(o*h,c*_,c*m,o*l);break;case"YXY":i.set(c*m,o*h,c*_,o*l);break;case"ZYZ":i.set(c*_,c*m,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function hi(i,t){switch(t.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 ye(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var $c={DEG2RAD:Bi,RAD2DEG:Gi,generateUUID:Ai,clamp:xe,euclideanModulo:oo,mapLinear:mh,inverseLerp:gh,lerp:zi,damp:_h,pingpong:xh,smoothstep:vh,smootherstep:yh,randInt:Mh,randFloat:Sh,randFloatSpread:bh,seededRandom:Eh,degToRad:wh,radToDeg:Th,isPowerOfTwo:Ah,ceilPowerOfTwo:Ch,floorPowerOfTwo:Rh,setQuaternionFromProperEuler:Ph,normalize:ye,denormalize:hi},Tt=class i{constructor(t=0,e=0){i.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}
vendor: 6,075 bytes, line 1
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(xe(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*s+t.x,this.y=r*s+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ut=class i{constructor(t,e,n,s,r,a,o,c,l){i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,a,o,c,l)}set(t,e,n,s,r,a,o,c,l){let h=this.elements;return h[0]=t,h[1]=s,h[2]=o,h[3]=e,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],p=n[7],d=n[2],m=n[5],_=n[8],v=s[0],f=s[3],u=s[6],w=s[1],S=s[4],T=s[7],N=s[2],R=s[5],A=s[8];return r[0]=a*v+o*w+c*N,r[3]=a*f+o*S+c*R,r[6]=a*u+o*T+c*A,r[1]=l*v+h*w+p*N,r[4]=l*f+h*S+p*R,r[7]=l*u+h*T+p*A,r[2]=d*v+m*w+_*N,r[5]=d*f+m*S+_*R,r[8]=d*u+m*T+_*A,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8];return e*a*h-e*o*l-n*r*h+n*o*c+s*r*l-s*a*c}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],p=h*a-o*l,d=o*c-h*r,m=l*r-a*c,_=e*p+n*d+s*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/_;return t[0]=p*v,t[1]=(s*l-h*n)*v,t[2]=(o*n-s*a)*v,t[3]=d*v,t[4]=(h*e-s*c)*v,t[5]=(s*r-o*e)*v,t[6]=m*v,t[7]=(n*c-l*e)*v,t[8]=(a*e-n*r)*v,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,a,o){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+t,-s*l,s*c,-s*(-l*a+c*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(xr.makeScale(t,e)),this}rotate(t){return this.premultiply(xr.makeRotation(-t)),this}translate(t,e){return this.premultiply(xr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},xr=new Ut;function jc(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Us(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Ih(){let i=Us("canvas");return i.style.display="block",i}var Ho={};function ki(i){i in Ho||(Ho[i]=!0,console.warn(i))}function Lh(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var Go=new Ut().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Wo=new Ut().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Pi={[bn]:{transfer:Ps,primaries:Is,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[Xe]:{transfer:Zt,primaries:Is,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[rr]:{transfer:Ps,primaries:Ls,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(Wo),fromReference:i=>i.applyMatrix3(Go)},[ao]:{transfer:Zt,primaries:Ls,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(Wo),fromReference:i=>i.applyMatrix3(Go).convertLinearToSRGB()}},Dh=new Set([bn,rr]),Yt={enabled:!0,_workingColorSpace:bn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Dh.has(i))throw new Error(`Unsupported working color space, "${i}".`);
1this._workingColorSpace=i},convert:function(i,t,e){if(this.enabled===!1||t===e||!t||!e)return i;let n=Pi[t].toReference,s=Pi[e].fromReference;return s(n(i))},fromWorkingColorSpace:function(i,t){return this.convert(i,this._workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this._workingColorSpace)},getPrimaries:function(i){return Pi[i].primaries},getTransfer:function(i){return i===xn?Ps:Pi[i].transfer},getLuminanceCoefficients:function(i,t=this._workingColorSpace){return i.fromArray(Pi[t].luminanceCoefficients)}};function gi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function vr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Zn,Ea=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Zn===void 0&&(Zn=Us("canvas")),Zn.width=t.width,Zn.height=t.height;let n=Zn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Zn}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Us("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let a=0;a<r.length;a++)r[a]=gi(r[a]/255)*255;return n.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(gi(e[n]/255)*255):e[n]=gi(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Uh=0,Ns=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Uh++}),this.uuid=Ai(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let a=0,o=s.length;a<o;a++)s[a].isDataTexture?r.push(yr(s[a].image)):r.push(yr(s[a]))}else r=yr(s);n.url=r}return e||(t.images[this.uuid]=n),n}};function yr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ea.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Nh=0,Gn=(()=>{class i extends qe{constructor(e=i.DEFAULT_IMAGE,n=i.DEFAULT_MAPPING,s=Un,r=Un,a=Ve,o=Nn,c=He,l=an,h=i.DEFAULT_ANISOTROPY,p=xn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nh++}),this.uuid=Ai(),this.name="",this.source=new Ns(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=s,this.wrapT=r,this.magFilter=a,this.minFilter=o,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=l,this.offset=new Tt(0,0),this.repeat=new Tt(1,1),this.center=new Tt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace
vendor: 4,471 bytes, line 1
1=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let s={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),n||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Uo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jr:e.x=e.x-Math.floor(e.x);break;case Un:e.x=e.x<0?0:1;break;case Kr: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 Jr:e.y=e.y-Math.floor(e.y);break;case Un:e.y=e.y<0?0:1;break;case Kr: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++}}return i.DEFAULT_IMAGE=null,i.DEFAULT_MAPPING=Uo,i.DEFAULT_ANISOTROPY=1,i})(),Jt=class i{constructor(t=0,e=0,n=0,s=1){i.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*s+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r,c=t.elements,l=c[0],h=c[4],p=c[8],d=c[1],m=c[5],_=c[9],v=c[2],f=c[6],u=c[10];if(Math.abs(h-d)<.01&&Math.abs(p-v)<.01&&Math.abs(_-f)<.01){if(Math.abs(h+d)<.1&&Math.abs(p+v)<.1&&Math.abs(_+f)<.1&&Math.abs(l+m+u-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(l+1)/2,T=(m+1)/2,N=(u+1)/2,R=(h+d)/4,A=(p+v)/4,F=(_+f)/4;return S>T&&S>N?S<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(S),s=R/n,r=A/n):T>N?T<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(T),n=R/s,r=F/s):N<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(N),n=A/r,s=F/r),this.set(n,s,r,e),this}let w=Math.sqrt((f-_)*(f-_)+(p-v)*(p-v)+(d-h)*(d-h));return Math.abs(w)<.001&&(w=1),this.x=(f-_)/w,this.y=(p-v)/w,this.z=(d-h
vendor: 4,745 bytes, line 1
1)/w,this.w=Math.acos((l+m+u-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},wa=class extends qe{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Jt(0,0,t,e),this.scissorTest=!1,this.viewport=new Jt(0,0,t,e);let s={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ve,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);let r=new Gn(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];let a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let n=0,s=t.textures.length;n<s;n++)this.textures[n]=t.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Ns(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},on=class extends wa{constructor(t=1,e=1,n={}
vendor: 107,047 bytes, lines 1-99
1){super(t,e,n),this.isWebGLRenderTarget=!0}},Os=class extends Gn{constructor(t=null,e=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=Ue,this.minFilter=Ue,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}};var Ta=class extends Gn{constructor(t=null,e=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=Ue,this.minFilter=Ue,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ge=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,a,o){let c=n[s+0],l=n[s+1],h=n[s+2],p=n[s+3],d=r[a+0],m=r[a+1],_=r[a+2],v=r[a+3];if(o===0){t[e+0]=c,t[e+1]=l,t[e+2]=h,t[e+3]=p;return}if(o===1){t[e+0]=d,t[e+1]=m,t[e+2]=_,t[e+3]=v;return}if(p!==v||c!==d||l!==m||h!==_){let f=1-o,u=c*d+l*m+h*_+p*v,w=u>=0?1:-1,S=1-u*u;if(S>Number.EPSILON){let N=Math.sqrt(S),R=Math.atan2(N,u*w);f=Math.sin(f*R)/N,o=Math.sin(o*R)/N}let T=o*w;if(c=c*f+d*T,l=l*f+m*T,h=h*f+_*T,p=p*f+v*T,f===1-o){let N=1/Math.sqrt(c*c+l*l+h*h+p*p);c*=N,l*=N,h*=N,p*=N}}t[e]=c,t[e+1]=l,t[e+2]=h,t[e+3]=p}static multiplyQuaternionsFlat(t,e,n,s,r,a){let o=n[s],c=n[s+1],l=n[s+2],h=n[s+3],p=r[a],d=r[a+1],m=r[a+2],_=r[a+3];return t[e]=o*_+h*p+c*m-l*d,t[e+1]=c*_+h*d+l*p-o*m,t[e+2]=l*_+h*m+o*d-c*p,t[e+3]=h*_-o*p-c*d-l*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,s=t._y,r=t._z,a=t._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(s/2),p=o(r/2),d=c(n/2),m=c(s/2),_=c(r/2);switch(a){case"XYZ":this._x=d*h*p+l*m*_,this._y=l*m*p-d*h*_,this._z=l*h*_+d*m*p,this._w=l*h*p-d*m*_;break;case"YXZ":this._x=d*h*p+l*m*_,this._y=l*m*p-d*h*_,this._z=l*h*_-d*m*p,this._w=l*h*p+d*m*_;break;case"ZXY":this._x=d*h*p-l*m*_,this._y=l*m*p+d*h*_,this._z=l*h*_+d*m*p,this._w=l*h*p-d*m*_;break;case"ZYX":this._x=d*h*p-l*m*_,this._y=l*m*p+d*h*_,this._z=l*h*_-d*m*p,this._w=l*h*p+d*m*_;break;case"YZX":this._x=d*h*p+l*m*_,this._y=l*m*p+d*h*_,this._z=l*h*_-d*m*p,this._w=l*h*p-d*m*_;break;case"XZY":this._x=d*h*p-l*m*_,this._y=l*m*p-d*h*_,this._z=l*h*_+d*m*p,this._w=l*h*p+d*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],a=e[1],o=e[5],c=e[9],l=e[2],h=e[6],p=e[10],d=n+o+p;if(d>0){let m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(h-c)*m,this._y=(r-l)*m,this._z=(a-s)*m}else if(n>o&&n>p){let m=2*Math.sqrt(1+n-o-p);this._w=(h-c)/m,this._x=.25*m,this._y=(s+a)/m,this._z=(r+l)/m}else if(o>p){let m=2*Math.sqrt(1+o-n-p);this._w=(r-l)/m,this._x=(s+a)/m,this._y=.25*m,this._z=(c+h)/m}else{let m=2*Math.sqrt(1+p-n-o);this._w=(a-s)/m,this._x=(r+l)/m,this._y=(c+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xe(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,s=t._y,r=t._z,a=t._w,o=e._x,c=e._y,l=e._z,h=e._w;return this._x=n*h+a*o+s*l-r*c,this._y=s*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-s*o,this._w=a*h-n*o-s*c-r*l,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let n=this._x,s=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+s*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=s,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let m=1-e;return this._w=m*a+e*this._w,this._x=m*n+e*this._x,this._y=m*s+e*this._y,this._z=m*r+e*this._z,this.normalize(),this}let l=Math.sqrt(c),h=Math.atan2(l,o),p=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=a*p+this._w*d,this._x=n*p+this._x*d,this._y=s*p+this._y*d,this._z=r*p+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},I=class i{constructor(t=0,e=0,n=0){i.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Xo.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Xo.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,a=t.y,o=t.z,c=t.w,l=2*(a*s-o*n),h=2*(o*e-r*s),p=2*(r*n-a*e);return this.x=e+c*l+a*p-o*h,this.y=n+c*h+o*l-r*p,this.z=s+c*p+r*h-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}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(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,s=t.y,r=t.z,a=e.x,o=e.y,c=e.z;return this.x=s*c-r*o,this.y=r*a-n*c,this.z=n*o-s*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Mr.copy(this).projectOnVector(t),this.sub(Mr)}reflect(t){return this.sub(Mr.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(xe(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Mr=new I,Xo=new Ge,Fn=class{constructor(t=new I(1/0,1/0,1/0),e=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Fe.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Fe.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Fe.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,Fe):Fe.fromBufferAttribute(r,a),Fe.applyMatrix4(t.matrixWorld),this.expandByPoint(Fe);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Qi.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Qi.copy(n.boundingBox)),Qi.applyMatrix4(t.matrixWorld),this.union(Qi)}let s=t.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Fe),Fe.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ii),ts.subVectors(this.max,Ii),Jn.subVectors(t.a,Ii),Kn.subVectors(t.b,Ii),$n.subVectors(t.c,Ii),dn.subVectors(Kn,Jn),fn.subVectors($n,Kn),wn.subVectors(Jn,$n);let e=[0,-dn.z,dn.y,0,-fn.z,fn.y,0,-wn.z,wn.y,dn.z,0,-dn.x,fn.z,0,-fn.x,wn.z,0,-wn.x,-dn.y,dn.x,0,-fn.y,fn.x,0,-wn.y,wn.x,0];return!Sr(e,Jn,Kn,$n,ts)||(e=[1,0,0,0,1,0,0,0,1],!Sr(e,Jn,Kn,$n,ts))?!1:(es.crossVectors(dn,fn),e=[es.x,es.y,es.z],Sr(e,Jn,Kn,$n,ts))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Fe).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Fe).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:($e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),$e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),$e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),$e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),$e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),$e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),$e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),$e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints($e),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},$e=[new I,new I,new I,new I,new I,new I,new I,new I],Fe=new I,Qi=new Fn,Jn=new I,Kn=new I,$n=new I,dn=new I,fn=new I,wn=new I,Ii=new I,ts=new I,es=new I,Tn=new I;function Sr(i,t,e,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){Tn.fromArray(i,r);let o=s.x*Math.abs(Tn.x)+s.y*Math.abs(Tn.y)+s.z*Math.abs(Tn.z),c=t.dot(Tn),l=e.dot(Tn),h=n.dot(Tn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var Oh=new Fn,Li=new I,br=new I,Si=class{constructor(t=new I,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Oh.setFromPoints(t).getCenter(n);let s=0;for(let r=0,a=t.length;r<a;r++)s=Math.max(s,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Li.subVectors(t,this.center);let e=Li.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(Li,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(br.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Li.copy(t.center).add(br)),this.expandByPoint(Li.copy(t.center).sub(br))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},je=new I,Er=new I,ns=new I,pn=new I,wr=new I,is=new I,Tr=new I,bi=class{constructor(t=new I,e=new I(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,je)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=je.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(je.copy(this.origin).addScaledVector(this.direction,e),je.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){Er.copy(t).add(e).multiplyScalar(.5),ns.copy(e).sub(t).normalize(),pn.copy(this.origin).sub(Er);let r=t.distanceTo(e)*.5,a=-this.direction.dot(ns),o=pn.dot(this.direction),c=-pn.dot(ns),l=pn.lengthSq(),h=Math.abs(1-a*a),p,d,m,_;if(h>0)if(p=a*c-o,d=a*o-c,_=r*h,p>=0)if(d>=-_)if(d<=_){let v=1/h;p*=v,d*=v,m=p*(p+a*d+2*o)+d*(a*p+d+2*c)+l}else d=r,p=Math.max(0,-(a*d+o)),m=-p*p+d*(d+2*c)+l;else d=-r,p=Math.max(0,-(a*d+o)),m=-p*p+d*(d+2*c)+l;else d<=-_?(p=Math.max(0,-(-a*r+o)),d=p>0?-r:Math.min(Math.max(-r,-c),r),m=-p*p+d*(d+2*c)+l):d<=_?(p=0,d=Math.min(Math.max(-r,-c),r),m=d*(d+2*c)+l):(p=Math.max(0,-(a*r+o)),d=p>0?r:Math.min(Math.max(-r,-c),r),m=-p*p+d*(d+2*c)+l);else d=a>0?-r:r,p=Math.max(0,-(a*d+o)),m=-p*p+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,p),s&&s.copy(Er).addScaledVector(ns,d),m}intersectSphere(t,e){je.subVectors(t.center,this.origin);let n=je.dot(this.direction),s=je.dot(je)-n*n,r=t.radius*t.radius;if(s>r)return null;let a=Math.sqrt(r-s),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,a,o,c,l=1/this.direction.x,h=1/this.direction.y,p=1/this.direction.z,d=this.origin;return l>=0?(n=(t.min.x-d.x)*l,s=(t.max.x-d.x)*l):(n=(t.max.x-d.x)*l,s=(t.min.x-d.x)*l),h>=0?(r=(t.min.y-d.y)*h,a=(t.max.y-d.y)*h):(r=(t.max.y-d.y)*h,a=(t.min.y-d.y)*h),n>a||r>s||((r>n||isNaN(n))&&(n=r),(a<s||isNaN(s))&&(s=a),p>=0?(o=(t.min.z-d.z)*p,c=(t.max.z-d.z)*p):(o=(t.max.z-d.z)*p,c=(t.min.z-d.z)*p),n>c||o>s)||((o>n||n!==n)&&(n=o),(c<s||s!==s)&&(s=c),s<0)?null:this.at(n>=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,je)!==null}intersectTriangle(t,e,n,s,r){wr.subVectors(e,t),is.subVectors(n,t),Tr.crossVectors(wr,is);let a=this.direction.dot(Tr),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;pn.subVectors(this.origin,t);let c=o*this.direction.dot(is.crossVectors(pn,is));if(c<0)return null;let l=o*this.direction.dot(wr.cross(pn));if(l<0||c+l>a)return null;let h=-o*pn.dot(Tr);return h<0?null:this.at(h/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ee=class i{constructor(t,e,n,s,r,a,o,c,l,h,p,d,m,_,v,f){i.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,a,o,c,l,h,p,d,m,_,v,f)}set(t,e,n,s,r,a,o,c,l,h,p,d,m,_,v,f){let u=this.elements;return u[0]=t,u[4]=e,u[8]=n,u[12]=s,u[1]=r,u[5]=a,u[9]=o,u[13]=c,u[2]=l,u[6]=h,u[10]=p,u[14]=d,u[3]=m,u[7]=_,u[11]=v,u[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new i().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,n=t.elements,s=1/jn.setFromMatrixColumn(t,0).length(),r=1/jn.setFromMatrixColumn(t,1).length(),a=1/jn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,s=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(s),l=Math.sin(s),h=Math.cos(r),p=Math.sin(r);if(t.order==="XYZ"){let d=a*h,m=a*p,_=o*h,v=o*p;e[0]=c*h,e[4]=-c*p,e[8]=l,e[1]=m+_*l,e[5]=d-v*l,e[9]=-o*c,e[2]=v-d*l,e[6]=_+m*l,e[10]=a*c}else if(t.order==="YXZ"){let d=c*h,m=c*p,_=l*h,v=l*p;e[0]=d+v*o,e[4]=_*o-m,e[8]=a*l,e[1]=a*p,e[5]=a*h,e[9]=-o,e[2]=m*o-_,e[6]=v+d*o,e[10]=a*c}else if(t.order==="ZXY"){let d=c*h,m=c*p,_=l*h,v=l*p;e[0]=d-v*o,e[4]=-a*p,e[8]=_+m*o,e[1]=m+_*o,e[5]=a*h,e[9]=v-d*o,e[2]=-a*l,e[6]=o,e[10]=a*c}else if(t.order==="ZYX"){let d=a*h,m=a*p,_=o*h,v=o*p;e[0]=c*h,e[4]=_*l-m,e[8]=d*l+v,e[1]=c*p,e[5]=v*l+d,e[9]=m*l-_,e[2]=-l,e[6]=o*c,e[10]=a*c}else if(t.order==="YZX"){let d=a*c,m=a*l,_=o*c,v=o*l;e[0]=c*h,e[4]=v-d*p,e[8]=_*p+m,e[1]=p,e[5]=a*h,e[9]=-o*h,e[2]=-l*h,e[6]=m*p+_,e[10]=d-v*p}else if(t.order==="XZY"){let d=a*c,m=a*l,_=o*c,v=o*l;e[0]=c*h,e[4]=-p,e[8]=l*h,e[1]=d*p+v,e[5]=a*h,e[9]=m*p-_,e[2]=_*p-m,e[6]=o*h,e[10]=v*p+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Fh,t,Bh)}lookAt(t,e,n){let s=this.elements;return Ae.subVectors(t,e),Ae.lengthSq()===0&&(Ae.z=1),Ae.normalize(),mn.crossVectors(n,Ae),mn.lengthSq()===0&&(Math.abs(n.z)===1?Ae.x+=1e-4:Ae.z+=1e-4,Ae.normalize(),mn.crossVectors(n,Ae)),mn.normalize(),ss.crossVectors(Ae,mn),s[0]=mn.x,s[4]=ss.x,s[8]=Ae.x,s[1]=mn.y,s[5]=ss.y,s[9]=Ae.y,s[2]=mn.z,s[6]=ss.z,s[10]=Ae.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],p=n[5],d=n[9],m=n[13],_=n[2],v=n[6],f=n[10],u=n[14],w=n[3],S=n[7],T=n[11],N=n[15],R=s[0],A=s[4],F=s[8],b=s[12],M=s[1],P=s[5],W=s[9],V=s[13],Z=s[2],q=s[6],X=s[10],J=s[14],G=s[3],rt=s[7],lt=s[11],pt=s[15];return r[0]=a*R+o*M+c*Z+l*G,r[4]=a*A+o*P+c*q+l*rt,r[8]=a*F+o*W+c*X+l*lt,r[12]=a*b+o*V+c*J+l*pt,r[1]=h*R+p*M+d*Z+m*G,r[5]=h*A+p*P+d*q+m*rt,r[9]=h*F+p*W+d*X+m*lt,r[13]=h*b+p*V+d*J+m*pt,r[2]=_*R+v*M+f*Z+u*G,r[6]=_*A+v*P+f*q+u*rt,r[10]=_*F+v*W+f*X+u*lt,r[14]=_*b+v*V+f*J+u*pt,r[3]=w*R+S*M+T*Z+N*G,r[7]=w*A+S*P+T*q+N*rt,r[11]=w*F+S*W+T*X+N*lt,r[15]=w*b+S*V+T*J+N*pt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],a=t[1],o=t[5],c=t[9],l=t[13],h=t[2],p=t[6],d=t[10],m=t[14],_=t[3],v=t[7],f=t[11],u=t[15];return _*(+r*c*p-s*l*p-r*o*d+n*l*d+s*o*m-n*c*m)+v*(+e*c*m-e*l*d+r*a*d-s*a*m+s*l*h-r*c*h)+f*(+e*l*p-e*o*m-r*a*p+n*a*m+r*o*h-n*l*h)+u*(-s*o*h-e*c*p+e*o*d+s*a*p-n*a*d+n*c*h)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],p=t[9],d=t[10],m=t[11],_=t[12],v=t[13],f=t[14],u=t[15],w=p*f*l-v*d*l+v*c*m-o*f*m-p*c*u+o*d*u,S=_*d*l-h*f*l-_*c*m+a*f*m+h*c*u-a*d*u,T=h*v*l-_*p*l+_*o*m-a*v*m-h*o*u+a*p*u,N=_*p*c-h*v*c-_*o*d+a*v*d+h*o*f-a*p*f,R=e*w+n*S+s*T+r*N;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/R;return t[0]=w*A,t[1]=(v*d*r-p*f*r-v*s*m+n*f*m+p*s*u-n*d*u)*A,t[2]=(o*f*r-v*c*r+v*s*l-n*f*l-o*s*u+n*c*u)*A,t[3]=(p*c*r-o*d*r-p*s*l+n*d*l+o*s*m-n*c*m)*A,t[4]=S*A,t[5]=(h*f*r-_*d*r+_*s*m-e*f*m-h*s*u+e*d*u)*A,t[6]=(_*c*r-a*f*r-_*s*l+e*f*l+a*s*u-e*c*u)*A,t[7]=(a*d*r-h*c*r+h*s*l-e*d*l-a*s*m+e*c*m)*A,t[8]=T*A,t[9]=(_*p*r-h*v*r-_*n*m+e*v*m+h*n*u-e*p*u)*A,t[10]=(a*v*r-_*o*r+_*n*l-e*v*l-a*n*u+e*o*u)*A,t[11]=(h*o*r-a*p*r-h*n*l+e*p*l+a*n*m-e*o*m)*A,t[12]=N*A,t[13]=(h*v*s-_*p*s+_*n*d-e*v*d-h*n*f+e*p*f)*A,t[14]=(_*o*s-a*v*s-_*n*c+e*v*c+a*n*f-e*o*f)*A,t[15]=(a*p*s-h*o*s+h*n*c-e*p*c-a*n*d+e*o*d)*A,this}scale(t){let e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),s=Math.sin(e),r=1-n,a=t.x,o=t.y,c=t.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-s*c,l*c+s*o,0,l*o+s*c,h*o+n,h*c-s*a,0,l*c-s*o,h*c+s*a,r*c*c+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,s,r,a){return this.set(1,n,r,0,t,1,a,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){let s=this.elements,r=e._x,a=e._y,o=e._z,c=e._w,l=r+r,h=a+a,p=o+o,d=r*l,m=r*h,_=r*p,v=a*h,f=a*p,u=o*p,w=c*l,S=c*h,T=c*p,N=n.x,R=n.y,A=n.z;return s[0]=(1-(v+u))*N,s[1]=(m+T)*N,s[2]=(_-S)*N,s[3]=0,s[4]=(m-T)*R,s[5]=(1-(d+u))*R,s[6]=(f+w)*R,s[7]=0,s[8]=(_+S)*A,s[9]=(f-w)*A,s[10]=(1-(d+v))*A,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){let s=this.elements,r=jn.set(s[0],s[1],s[2]).length(),a=jn.set(s[4],s[5],s[6]).length(),o=jn.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],Be.copy(this);let l=1/r,h=1/a,p=1/o;return Be.elements[0]*=l,Be.elements[1]*=l,Be.elements[2]*=l,Be.elements[4]*=h,Be.elements[5]*=h,Be.elements[6]*=h,Be.elements[8]*=p,Be.elements[9]*=p,Be.elements[10]*=p,e.setFromRotationMatrix(Be),n.x=r,n.y=a,n.z=o,this}makePerspective(t,e,n,s,r,a,o=rn){let c=this.elements,l=2*r/(e-t),h=2*r/(n-s),p=(e+t)/(e-t),d=(n+s)/(n-s),m,_;if(o===rn)m=-(a+r)/(a-r),_=-2*a*r/(a-r);else if(o===Ds)m=-a/(a-r),_=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,n,s,r,a,o=rn){let c=this.elements,l=1/(e-t),h=1/(n-s),p=1/(a-r),d=(e+t)*l,m=(n+s)*h,_,v;if(o===rn)_=(a+r)*p,v=-2*p;else if(o===Ds)_=r*p,v=-1*p;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-m,c[2]=0,c[6]=0,c[10]=v,c[14]=-_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},jn=new I,Be=new ee,Fh=new I(0,0,0),Bh=new I(1,1,1),mn=new I,ss=new I,Ae=new I,Yo=new ee,qo=new Ge,Bn=(()=>{class i{constructor(e=0,n=0,s=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=s,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,n,s,r=this._order){return this._x=e,this._y=n,this._z=s,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,n=this._order,s=!0){let r=e.elements,a=r[0],o=r[4],c=r[8],l=r[1],h=r[5],p=r[9],d=r[2],m=r[6],_=r[10];switch(n){case"XYZ":this._y=Math.asin(xe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,_),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-xe(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(c,_),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-d,a),this._z=0);break;case"ZXY":this._x=Math.asin(xe(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-d,_),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-xe(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(m,_),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(xe(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-p,h),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(c,_));break;case"XZY":this._z=Math.asin(-xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,a)):(this._x=Math.atan2(-p,_),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,s){return Yo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yo,n,s)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return qo.setFromEuler(this),this.setFromQuaternion(qo,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}return i.DEFAULT_ORDER="XYZ",i})(),Fs=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},zh=0,Zo=new I,Qn=new Ge,Qe=new ee,rs=new I,Di=new I,kh=new I,Vh=new Ge,Jo=new I(1,0,0),Ko=new I(0,1,0),$o=new I(0,0,1),jo={type:"added"},Hh={type:"removed"},ti={type:"childadded",child:null},Ar={type:"childremoved",child:null},Ze=(()=>{class i extends qe{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zh++}),this.uuid=Ai(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new I,n=new Bn,s=new Ge,r=new I(1,1,1);function a(){s.setFromEuler(n,!1)}function o(){n.setFromQuaternion(s,void 0,!1)}n._onChange(a),s._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ee},normalMatrix:{value:new Ut}}),this.matrix=new ee,this.matrixWorld=new ee,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Fs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Qn.setFromAxisAngle(e,n),this.quaternion.multiply(Qn),this}rotateOnWorldAxis(e,n){return Qn.setFromAxisAngle(e,n),this.quaternion.premultiply(Qn),this}rotateX(e){return this.rotateOnAxis(Jo,e)}rotateY(e){return this.rotateOnAxis(Ko,e)}rotateZ(e){return this.rotateOnAxis($o,e)}translateOnAxis(e,n){return Zo.copy(e).applyQuaternion(this.quaternion),this.position.add(Zo.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Jo,e)}translateY(e){return this.translateOnAxis(Ko,e)}translateZ(e){return this.translateOnAxis($o,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Qe.copy(this.matrixWorld).invert())}lookAt(e,n,s){e.isVector3?rs.copy(e):rs.set(e,n,s);let r=this.parent;this.updateWorldMatrix(!0,!1),Di.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Qe.lookAt(Di,rs,this.up):Qe.lookAt(rs,Di,this.up),this.quaternion.setFromRotationMatrix(Qe),r&&(Qe.extractRotation(r.matrixWorld),Qn.setFromRotationMatrix(Qe),this.quaternion.premultiply(Qn.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(jo),ti.child=e,this.dispatchEvent(ti),ti.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}let n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Hh),Ar.child=e,this.dispatchEvent(Ar),Ar.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Qe.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Qe.multiply(e.parent.matrixWorld)),e.applyMatrix4(Qe),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(jo),ti.child=e,this.dispatchEvent(ti),ti.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let s=0,r=this.children.length;s<r;s++){let o=this.children[s].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,s=[]){this[e]===n&&s.push(this);let r=this.children;for(let a=0,o=r.length;a<o;a++)r[a].getObjectsByProperty(e,n,s);return s}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Di,e,kh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Di,Vh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].traverseVisible(e)}traverseAncestors(e){let n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].updateMatrixWorld(e)}updateWorldMatrix(e,n){let s=this.parent;if(e===!0&&s!==null&&s.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)),n===!0){let r=this.children;for(let a=0,o=r.length;a<o;a++)r[a].updateWorldMatrix(!1,!0)}}toJSON(e){let n=e===void 0||typeof e=="string",s={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let 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),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.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(c=>({boxInitialized:c.boxInitialized,boxMin:c.box.min.toArray(),boxMax:c.box.max.toArray(),sphereInitialized:c.sphereInitialized,sphereRadius:c.sphere.radius,sphereCenter:c.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function a(c,l){return c[l.uuid]===void 0&&(c[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=a(e.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let l=c.shapes;if(Array.isArray(l))for(let h=0,p=l.length;h<p;h++){let d=l[h];a(e.shapes,d)}else a(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let l=0,h=this.material.length;l<h;l++)c.push(a(e.materials,this.material[l]));r.material=c}else r.material=a(e.materials,this.material);if(this.children.length>0){r.children=[];for(let c=0;c<this.children.length;c++)r.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let c=0;c<this.animations.length;c++){let l=this.animations[c];r.animations.push(a(e.animations,l))}}if(n){let c=o(e.geometries),l=o(e.materials),h=o(e.textures),p=o(e.images),d=o(e.shapes),m=o(e.skeletons),_=o(e.animations),v=o(e.nodes);c.length>0&&(s.geometries=c),l.length>0&&(s.materials=l),h.length>0&&(s.textures=h),p.length>0&&(s.images=p),d.length>0&&(s.shapes=d),m.length>0&&(s.skeletons=m),_.length>0&&(s.animations=_),v.length>0&&(s.nodes=v)}return s.object=r,s;function o(c){let l=[];for(let h in c){let p=c[h];delete p.metadata,l.push(p)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let s=0;s<e.children.length;s++){let r=e.children[s];this.add(r.clone())}return this}}return i.DEFAULT_UP=new I(0,1,0),i.DEFAULT_MATRIX_AUTO_UPDATE=!0,i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,i})(),ze=new I,tn=new I,Cr=new I,en=new I,ei=new I,ni=new I,Qo=new I,Rr=new I,Pr=new I,Ir=new I,ui=class i{constructor(t=new I,e=new I,n=new I){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,s){s.subVectors(n,e),ze.subVectors(t,e),s.cross(ze);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){ze.subVectors(s,e),tn.subVectors(n,e),Cr.subVectors(t,e);let a=ze.dot(ze),o=ze.dot(tn),c=ze.dot(Cr),l=tn.dot(tn),h=tn.dot(Cr),p=a*l-o*o;if(p===0)return r.set(0,0,0),null;let d=1/p,m=(l*c-o*h)*d,_=(a*h-o*c)*d;return r.set(1-m-_,_,m)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,en)===null?!1:en.x>=0&&en.y>=0&&en.x+en.y<=1}static getInterpolation(t,e,n,s,r,a,o,c){return this.getBarycoord(t,e,n,s,en)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,en.x),c.addScaledVector(a,en.y),c.addScaledVector(o,en.z),c)}static isFrontFacing(t,e,n,s){return ze.subVectors(n,e),tn.subVectors(t,e),ze.cross(tn).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ze.subVectors(this.c,this.b),tn.subVectors(this.a,this.b),ze.cross(tn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,a,o;ei.subVectors(s,n),ni.subVectors(r,n),Rr.subVectors(t,n);let c=ei.dot(Rr),l=ni.dot(Rr);if(c<=0&&l<=0)return e.copy(n);Pr.subVectors(t,s);let h=ei.dot(Pr),p=ni.dot(Pr);if(h>=0&&p<=h)return e.copy(s);let d=c*p-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),e.copy(n).addScaledVector(ei,a);Ir.subVectors(t,r);let m=ei.dot(Ir),_=ni.dot(Ir);if(_>=0&&m<=_)return e.copy(r);let v=m*l-c*_;if(v<=0&&l>=0&&_<=0)return o=l/(l-_),e.copy(n).addScaledVector(ni,o);let f=h*_-m*p;if(f<=0&&p-h>=0&&m-_>=0)return Qo.subVectors(r,s),o=(p-h)/(p-h+(m-_)),e.copy(s).addScaledVector(Qo,o);let u=1/(f+v+d);return a=v*u,o=d*u,e.copy(n).addScaledVector(ei,a).addScaledVector(ni,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Qc={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},gn={h:0,s:0,l:0},as={h:0,s:0,l:0};function Lr(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var Ot=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Xe){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Yt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,s=Yt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Yt.toWorkingColorSpace(this,s),this}setHSL(t,e,n,s=Yt.workingColorSpace){if(t=oo(t,1),e=xe(e,0,1),n=xe(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=Lr(a,r,t+1/3),this.g=Lr(a,r,t),this.b=Lr(a,r,t-1/3)}return Yt.toWorkingColorSpace(this,s),this}setStyle(t,e=Xe){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,a=s[1],o=s[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(r,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Xe){let n=Qc[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}copyLinearToSRGB(t){return this.r=vr(t.r),this.g=vr(t.g),this.b=vr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Xe){return Yt.fromWorkingColorSpace(_e.copy(this),t),Math.round(xe(_e.r*255,0,255))*65536+Math.round(xe(_e.g*255,0,255))*256+Math.round(xe(_e.b*255,0,255))}getHexString(t=Xe){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Yt.workingColorSpace){Yt.fromWorkingColorSpace(_e.copy(this),e);let n=_e.r,s=_e.g,r=_e.b,a=Math.max(n,s,r),o=Math.min(n,s,r),c,l,h=(o+a)/2;if(o===a)c=0,l=0;else{let p=a-o;switch(l=h<=.5?p/(a+o):p/(2-a-o),a){case n:c=(s-r)/p+(s<r?6:0);break;case s:c=(r-n)/p+2;break;case r:c=(n-s)/p+4;break}c/=6}return t.h=c,t.s=l,t.l=h,t}getRGB(t,e=Yt.workingColorSpace){return Yt.fromWorkingColorSpace(_e.copy(this),e),t.r=_e.r,t.g=_e.g,t.b=_e.b,t}getStyle(t=Xe){Yt.fromWorkingColorSpace(_e.copy(this),t);let e=_e.r,n=_e.g,s=_e.b;return t!==Xe?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(t,e,n){return this.getHSL(gn),this.setHSL(gn.h+t,gn.s+e,gn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(gn),t.getHSL(as);let n=zi(gn.h,as.h,e),s=zi(gn.s,as.s,e),r=zi(gn.l,as.l,e);return this.setHSL(n,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*s,this.g=r[1]*e+r[4]*n+r[7]*s,this.b=r[2]*e+r[5]*n+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},_e=new Ot;Ot.NAMES=Qc;var Gh=0,Sn=class extends qe{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gh++}),this.uuid=Ai(),this.name="",this.type="Material",this.blending=pi,this.side=Mn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xr,this.blendDst=Yr,this.blendEquation=Ln,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ot(0,0,0),this.blendAlpha=0,this.depthFunc=Cs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Bo,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=qn,this.stencilZFail=qn,this.stencilZPass=qn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==pi&&(n.blending=this.blending),this.side!==Mn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Xr&&(n.blendSrc=this.blendSrc),this.blendDst!==Yr&&(n.blendDst=this.blendDst),this.blendEquation!==Ln&&(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!==Cs&&(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!==Bo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==qn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==qn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==qn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(e){let r=s(t.textures),a=s(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}},Bs=class extends Sn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ot(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 Bn,this.combine=Bc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var ce=new I,os=new Tt,Ne=class{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=zo,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=sn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return ki("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[n+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)os.fromBufferAttribute(this,e),os.applyMatrix3(t),this.setXY(e,os.x,os.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ce.fromBufferAttribute(this,e),ce.applyMatrix3(t),this.setXYZ(e,ce.x,ce.y,ce.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ce.fromBufferAttribute(this,e),ce.applyMatrix4(t),this.setXYZ(e,ce.x,ce.y,ce.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ce.fromBufferAttribute(this,e),ce.applyNormalMatrix(t),this.setXYZ(e,ce.x,ce.y,ce.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ce.fromBufferAttribute(this,e),ce.transformDirection(t),this.setXYZ(e,ce.x,ce.y,ce.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=hi(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ye(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=hi(e,this.array)),e}setX(t,e){return this.normalized&&(e=ye(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=hi(e,this.array)),e}setY(t,e){return this.normalized&&(e=ye(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=hi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ye(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=hi(e,this.array)),e}setW(t,e){return this.normalized&&(e=ye(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ye(e,this.array),n=ye(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=ye(e,this.array),n=ye(n,this.array),s=ye(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=ye(e,this.array),n=ye(n,this.array),s=ye(s,this.array),r=ye(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==zo&&(t.usage=this.usage),t}};var zs=class extends Ne{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var ks=class extends Ne{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var Pe=class extends Ne{constructor(t,e,n){super(new Float32Array(t),e,n)}},Wh=0,Le=new ee,Dr=new Ze,ii=new I,Ce=new Fn,Ui=new Fn,fe=new I,cn=class i extends qe{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Wh++}),this.uuid=Ai(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(jc(t)?ks:zs)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Ut().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Le.makeRotationFromQuaternion(t),this.applyMatrix4(Le),this}rotateX(t){return Le.makeRotationX(t),this.applyMatrix4(Le),this}rotateY(t){return Le.makeRotationY(t),this.applyMatrix4(Le),this}rotateZ(t){return Le.makeRotationZ(t),this.applyMatrix4(Le),this}translate(t,e,n){return Le.makeTranslation(t,e,n),this.applyMatrix4(Le),this}scale(t,e,n){return Le.makeScale(t,e,n),this.applyMatrix4(Le),this}lookAt(t){return Dr.lookAt(t),Dr.updateMatrix(),this.applyMatrix4(Dr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ii).negate(),this.translate(ii.x,ii.y,ii.z),this}setFromPoints(t){let e=[];for(let n=0,s=t.length;n<s;n++){let r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Pe(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let r=e[n];Ce.setFromBufferAttribute(r),this.morphTargetsRelative?(fe.addVectors(this.boundingBox.min,Ce.min),this.boundingBox.expandByPoint(fe),fe.addVectors(this.boundingBox.max,Ce.max),this.boundingBox.expandByPoint(fe)):(this.boundingBox.expandByPoint(Ce.min),this.boundingBox.expandByPoint(Ce.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Si);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(t){let n=this.boundingSphere.center;if(Ce.setFromBufferAttribute(t),e)for(let r=0,a=e.length;r<a;r++){let o=e[r];Ui.setFromBufferAttribute(o),this.morphTargetsRelative?(fe.addVectors(Ce.min,Ui.min),Ce.expandByPoint(fe),fe.addVectors(Ce.max,Ui.max),Ce.expandByPoint(fe)):(Ce.expandByPoint(Ui.min),Ce.expandByPoint(Ui.max))}Ce.getCenter(n);let s=0;for(let r=0,a=t.count;r<a;r++)fe.fromBufferAttribute(t,r),s=Math.max(s,n.distanceToSquared(fe));if(e)for(let r=0,a=e.length;r<a;r++){let o=e[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)fe.fromBufferAttribute(o,l),c&&(ii.fromBufferAttribute(t,l),fe.add(ii)),s=Math.max(s,n.distanceToSquared(fe))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,s=e.normal,r=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ne(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),o=[],c=[];for(let F=0;F<n.count;F++)o[F]=new I,c[F]=new I;let l=new I,h=new I,p=new I,d=new Tt,m=new Tt,_=new Tt,v=new I,f=new I;function u(F,b,M){l.fromBufferAttribute(n,F),h.fromBufferAttribute(n,b),p.fromBufferAttribute(n,M),d.fromBufferAttribute(r,F),m.fromBufferAttribute(r,b),_.fromBufferAttribute(r,M),h.sub(l),p.sub(l),m.sub(d),_.sub(d);let P=1/(m.x*_.y-_.x*m.y);isFinite(P)&&(v.copy(h).multiplyScalar(_.y).addScaledVector(p,-m.y).multiplyScalar(P),f.copy(p).multiplyScalar(m.x).addScaledVector(h,-_.x).multiplyScalar(P),o[F].add(v),o[b].add(v),o[M].add(v),c[F].add(f),c[b].add(f),c[M].add(f))}let w=this.groups;w.length===0&&(w=[{start:0,count:t.count}]);for(let F=0,b=w.length;F<b;++F){let M=w[F],P=M.start,W=M.count;for(let V=P,Z=P+W;V<Z;V+=3)u(t.getX(V+0),t.getX(V+1),t.getX(V+2))}let S=new I,T=new I,N=new I,R=new I;function A(F){N.fromBufferAttribute(s,F),R.copy(N);let b=o[F];S.copy(b),S.sub(N.multiplyScalar(N.dot(b))).normalize(),T.crossVectors(R,b);let P=T.dot(c[F])<0?-1:1;a.setXYZW(F,S.x,S.y,S.z,P)}for(let F=0,b=w.length;F<b;++F){let M=w[F],P=M.start,W=M.count;for(let V=P,Z=P+W;V<Z;V+=3)A(t.getX(V+0)),A(t.getX(V+1)),A(t.getX(V+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ne(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let d=0,m=n.count;d<m;d++)n.setXYZ(d,0,0,0);let s=new I,r=new I,a=new I,o=new I,c=new I,l=new I,h=new I,p=new I;if(t)for(let d=0,m=t.count;d<m;d+=3){let _=t.getX(d+0),v=t.getX(d+1),f=t.getX(d+2);s.fromBufferAttribute(e,_),r.fromBufferAttribute(e,v),a.fromBufferAttribute(e,f),h.subVectors(a,r),p.subVectors(s,r),h.cross(p),o.fromBufferAttribute(n,_),c.fromBufferAttribute(n,v),l.fromBufferAttribute(n,f),o.add(h),c.add(h),l.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(v,c.x,c.y,c.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let d=0,m=e.count;d<m;d+=3)s.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),a.fromBufferAttribute(e,d+2),h.subVectors(a,r),p.subVectors(s,r),h.cross(p),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)fe.fromBufferAttribute(t,e),fe.normalize(),t.setXYZ(e,fe.x,fe.y,fe.z)}toNonIndexed(){function t(o,c){let l=o.array,h=o.itemSize,p=o.normalized,d=new l.constructor(c.length*h),m=0,_=0;for(let v=0,f=c.length;v<f;v++){o.isInterleavedBufferAttribute?m=c[v]*o.data.stride+o.offset:m=c[v]*h;for(let u=0;u<h;u++)d[_++]=l[m++]}return new Ne(d,h,p)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,s=this.attributes;for(let o in s){let c=s[o],l=t(c,n);e.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,p=l.length;h<p;h++){let d=l[h],m=t(d,n);c.push(m)}e.morphAttributes[o]=c}e.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,c=a.length;o<c;o++){let l=a[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(t[l]=c[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let c in n){let l=n[c];t.data.attributes[c]=l.toJSON(t.data)}let s={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let p=0,d=l.length;p<d;p++){let m=l[p];h.push(m.toJSON(t.data))}h.length>0&&(s[c]=h,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone(e));let s=t.attributes;for(let l in s){let h=s[l];this.setAttribute(l,h.clone(e))}let r=t.morphAttributes;for(let l in r){let h=[],p=r[l];for(let d=0,m=p.length;d<m;d++)h.push(p[d].clone(e));this.morphAttributes[l]=h}this.morphTargetsRelative=t.morphTargetsRelative;let a=t.groups;for(let l=0,h=a.length;l<h;l++){let p=a[l];this.addGroup(p.start,p.count,p.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let c=t.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},tc=new ee,An=new bi,cs=new Si,ec=new I,si=new I,ri=new I,ai=new I,Ur=new I,ls=new I,hs=new Tt,us=new Tt,ds=new Tt,nc=new I,ic=new I,sc=new I,fs=new I,ps=new I,Re=class extends Ze{constructor(t=new cn,e=new Bs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){let o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(t,e){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(s,t);let o=this.morphTargetInfluences;if(r&&o){ls.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=o[c],p=r[c];h!==0&&(Ur.fromBufferAttribute(p,t),a?ls.addScaledVector(Ur,h):ls.addScaledVector(Ur.sub(e),h))}e.add(ls)}return e}raycast(t,e){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),cs.copy(n.boundingSphere),cs.applyMatrix4(r),An.copy(t.ray).recast(t.near),!(cs.containsPoint(An.origin)===!1&&(An.intersectSphere(cs,ec)===null||An.origin.distanceToSquared(ec)>(t.far-t.near)**2))&&(tc.copy(r).invert(),An.copy(t.ray).applyMatrix4(tc),!(n.boundingBox!==null&&An.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,An)))}_computeIntersections(t,e,n){let s,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,p=r.attributes.normal,d=r.groups,m=r.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){let f=d[_],u=a[f.materialIndex],w=Math.max(f.start,m.start),S=Math.min(o.count,Math.min(f.start+f.count,m.start+m.count));for(let T=w,N=S;T<N;T+=3){let R=o.getX(T),A=o.getX(T+1),F=o.getX(T+2);s=ms(this,u,t,n,l,h,p,R,A,F),s&&(s.faceIndex=Math.floor(T/3),s.face.materialIndex=f.materialIndex,e.push(s))}}else{let _=Math.max(0,m.start),v=Math.min(o.count,m.start+m.count);for(let f=_,u=v;f<u;f+=3){let w=o.getX(f),S=o.getX(f+1),T=o.getX(f+2);s=ms(this,a,t,n,l,h,p,w,S,T),s&&(s.faceIndex=Math.floor(f/3),e.push(s))}}else if(c!==void 0)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){let f=d[_],u=a[f.materialIndex],w=Math.max(f.start,m.start),S=Math.min(c.count,Math.min(f.start+f.count,m.start+m.count));for(let T=w,N=S;T<N;T+=3){let R=T,A=T+1,F=T+2;s=ms(this,u,t,n,l,h,p,R,A,F),s&&(s.faceIndex=Math.floor(T/3),s.face.materialIndex=f.materialIndex,e.push(s))}}else{let _=Math.max(0,m.start),v=Math.min(c.count,m.start+m.count);for(let f=_,u=v;f<u;f+=3){let w=f,S=f+1,T=f+2;s=ms(this,a,t,n,l,h,p,w,S,T),s&&(s.faceIndex=Math.floor(f/3),e.push(s))}}}};function Xh(i,t,e,n,s,r,a,o){let c;if(t.side===be?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,t.side===Mn,o),c===null)return null;ps.copy(o),ps.applyMatrix4(i.matrixWorld);let l=e.ray.origin.distanceTo(ps);return l<e.near||l>e.far?null:{distance:l,point:ps.clone(),object:i}}function ms(i,t,e,n,s,r,a,o,c,l){i.getVertexPosition(o,si),i.getVertexPosition(c,ri),i.getVertexPosition(l,ai);let h=Xh(i,t,e,n,si,ri,ai,fs);if(h){s&&(hs.fromBufferAttribute(s,o),us.fromBufferAttribute(s,c),ds.fromBufferAttribute(s,l),h.uv=ui.getInterpolation(fs,si,ri,ai,hs,us,ds,new Tt)),r&&(hs.fromBufferAttribute(r,o),us.fromBufferAttribute(r,c),ds.fromBufferAttribute(r,l),h.uv1=ui.getInterpolation(fs,si,ri,ai,hs,us,ds,new Tt)),a&&(nc.fromBufferAttribute(a,o),ic.fromBufferAttribute(a,c),sc.fromBufferAttribute(a,l),h.normal=ui.getInterpolation(fs,si,ri,ai,nc,ic,sc,new I),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let p={a:o,b:c,c:l,normal:new I,materialIndex:0};ui.getNormal(si,ri,ai,p.normal),h.face=p}return h}var Wi=class i extends cn{constructor(t=1,e=1,n=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:a};let o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],h=[],p=[],d=0,m=0;_("z","y","x",-1,-1,n,e,t,a,r,0),_("z","y","x",1,-1,n,e,-t,a,r,1),_("x","z","y",1,1,t,n,e,s,a,2),_("x","z","y",1,-1,t,n,-e,s,a,3),_("x","y","z",1,-1,t,e,n,s,r,4),_("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(h,3)),this.setAttribute("uv",new Pe(p,2));function _(v,f,u,w,S,T,N,R,A,F,b){let M=T/A,P=N/F,W=T/2,V=N/2,Z=R/2,q=A+1,X=F+1,J=0,G=0,rt=new I;for(let lt=0;lt<X;lt++){let pt=lt*P-V;for(let Ft=0;Ft<q;Ft++){let Vt=Ft*M-W;rt[v]=Vt*w,rt[f]=pt*S,rt[u]=Z,l.push(rt.x,rt.y,rt.z),rt[v]=0,rt[f]=0,rt[u]=R>0?1:-1,h.push(rt.x,rt.y,rt.z),p.push(Ft/A),p.push(1-lt/F),J+=1}}for(let lt=0;lt<F;lt++)for(let pt=0;pt<A;pt++){let Ft=d+pt+q*lt,Vt=d+pt+q*(lt+1),Y=d+(pt+1)+q*(lt+1),tt=d+(pt+1)+q*lt;c.push(Ft,Vt,tt),c.push(Vt,Y,tt),G+=6}o.addGroup(m,G,b),m+=G,d+=J}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Ei(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let s=i[e][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=s.clone():Array.isArray(s)?t[e][n]=s.slice():t[e][n]=s}}return t}function Me(i){let t={};for(let e=0;e<i.length;e++){let n=Ei(i[e]);for(let s in n)t[s]=n[s]}return t}function Yh(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function tl(i){let t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Yt.workingColorSpace}var qh={clone:Ei,merge:Me},Zh=`void main() { 2 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3}`,Jh=`void main() { 4 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 5}`,Je=class extends Sn{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Zh,this.fragmentShader=Jh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ei(t.uniforms),this.uniformsGroups=Yh(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let a=this.uniforms[s].value;a&&a.isTexture?e.uniforms[s]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[s]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[s]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[s]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[s]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[s]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[s]={type:"m4",value:a.toArray()}:e.uniforms[s]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}},Vs=class extends Ze{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ee,this.projectionMatrix=new ee,this.projectionMatrixInverse=new ee,this.coordinateSystem=rn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},_n=new I,rc=new Tt,ac=new Tt,ve=class extends Vs{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=Gi*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Bi*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Gi*2*Math.atan(Math.tan(Bi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){_n.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(_n.x,_n.y).multiplyScalar(-t/_n.z),_n.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(_n.x,_n.y).multiplyScalar(-t/_n.z)}getViewSize(t,e){return this.getViewBounds(t,rc,ac),e.subVectors(ac,rc)}setViewOffset(t,e,n,s,r,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Bi*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*s/c,e-=a.offsetY*n/l,s*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},oi=-90,ci=1,Aa=class extends Ze{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new ve(oi,ci,t,e);s.layers=this.layers,this.add(s);let r=new ve(oi,ci,t,e);r.layers=this.layers,this.add(r);let a=new ve(oi,ci,t,e);a.layers=this.layers,this.add(a);let o=new ve(oi,ci,t,e);o.layers=this.layers,this.add(o);let c=new ve(oi,ci,t,e);c.layers=this.layers,this.add(c);let l=new ve(oi,ci,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,s,r,a,o,c]=e;for(let l of e)this.remove(l);if(t===rn)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(t===Ds)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let l of e)this.add(l),l.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,h]=this.children,p=t.getRenderTarget(),d=t.getActiveCubeFace(),m=t.getActiveMipmapLevel(),_=t.xr.enabled;t.xr.enabled=!1;let v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,s),t.render(e,r),t.setRenderTarget(n,1,s),t.render(e,a),t.setRenderTarget(n,2,s),t.render(e,o),t.setRenderTarget(n,3,s),t.render(e,c),t.setRenderTarget(n,4,s),t.render(e,l),n.texture.generateMipmaps=v,t.setRenderTarget(n,5,s),t.render(e,h),t.setRenderTarget(p,d,m),t.xr.enabled=_,n.texture.needsPMREMUpdate=!0}},Hs=class extends Gn{constructor(t,e,n,s,r,a,o,c,l,h){t=t!==void 0?t:[],e=e!==void 0?e:xi,super(t,e,n,s,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Ca=class extends on{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new Hs(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ve}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 6 7 varying vec3 vWorldDirection; 8 9 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 10 11 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 12 13 } 14 15 void main() { 16 17 vWorldDirection = transformDirection( position, modelMatrix ); 18 19 #include <begin_vertex> 20 #include <project_vertex> 21 22 } 23 `,fragmentShader:` 24 25 uniform sampler2D tEquirect; 26 27 varying vec3 vWorldDirection; 28 29 #include <common> 30 31 void main() { 32 33 vec3 direction = normalize( vWorldDirection ); 34 35 vec2 sampleUV = equirectUv( direction ); 36 37 gl_FragColor = texture2D( tEquirect, sampleUV ); 38 39 } 40 `},s=new Wi(5,5,5),r=new Je({name:"CubemapFromEquirect",uniforms:Ei(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:be,blending:vn});r.uniforms.tEquirect.value=e;let a=new Re(s,r),o=e.minFilter;return e.minFilter===Nn&&(e.minFilter=Ve),new Aa(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,s){let r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,s);t.setRenderTarget(r)}},Nr=new I,Kh=new I,$h=new Ut,ke=class{constructor(t=new I(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,s){return this.normal.set(t,e,n),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let s=Nr.subVectors(n,e).cross(Kh.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let n=t.delta(Nr),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||$h.getNormalMatrix(t),s=this.coplanarPoint(Nr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Cn=new Si,gs=new I,Xi=class{constructor(t=new ke,e=new ke,n=new ke,s=new ke,r=new ke,a=new ke){this.planes=[t,e,n,s,r,a]}set(t,e,n,s,r,a){let o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=rn){let n=this.planes,s=t.elements,r=s[0],a=s[1],o=s[2],c=s[3],l=s[4],h=s[5],p=s[6],d=s[7],m=s[8],_=s[9],v=s[10],f=s[11],u=s[12],w=s[13],S=s[14],T=s[15];if(n[0].setComponents(c-r,d-l,f-m,T-u).normalize(),n[1].setComponents(c+r,d+l,f+m,T+u).normalize(),n[2].setComponents(c+a,d+h,f+_,T+w).normalize(),n[3].setComponents(c-a,d-h,f-_,T-w).normalize(),n[4].setComponents(c-o,d-p,f-v,T-S).normalize(),e===rn)n[5].setComponents(c+o,d+p,f+v,T+S).normalize();else if(e===Ds)n[5].setComponents(o,p,v,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Cn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Cn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Cn)}intersectsSprite(t){return Cn.center.set(0,0,0),Cn.radius=.7071067811865476,Cn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Cn)}intersectsSphere(t){let e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let n=0;n<6;n++){let s=e[n];if(gs.x=s.normal.x>0?t.max.x:t.min.x,gs.y=s.normal.y>0?t.max.y:t.min.y,gs.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(gs)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function el(){let i=null,t=!1,e=null,n=null;function s(r,a){e(r,a),n=i.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(s),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){i=r}}}function jh(i){let t=new WeakMap;function e(o,c){let l=o.array,h=o.usage,p=l.byteLength,d=i.createBuffer();i.bindBuffer(c,d),i.bufferData(c,l,h),o.onUploadCallback();let m;if(l instanceof Float32Array)m=i.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)m=i.SHORT;else if(l instanceof Uint32Array)m=i.UNSIGNED_INT;else if(l instanceof Int32Array)m=i.INT;else if(l instanceof Int8Array)m=i.BYTE;else if(l instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:m,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:p}}function n(o,c,l){let h=c.array,p=c._updateRange,d=c.updateRanges;if(i.bindBuffer(l,o),p.count===-1&&d.length===0&&i.bufferSubData(l,0,h),d.length!==0){for(let m=0,_=d.length;m<_;m++){let v=d[m];i.bufferSubData(l,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count)}c.clearUpdateRanges()}p.count!==-1&&(i.bufferSubData(l,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count),p.count=-1),c.onUploadCallback()}function s(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let c=t.get(o);c&&(i.deleteBuffer(c.buffer),t.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=t.get(o);(!h||h.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let l=t.get(o);if(l===void 0)t.set(o,e(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(l.buffer,o,c),l.version=o.version}}return{get:s,remove:r,update:a}}var wi=class i extends cn{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};let r=t/2,a=e/2,o=Math.floor(n),c=Math.floor(s),l=o+1,h=c+1,p=t/o,d=e/c,m=[],_=[],v=[],f=[];for(let u=0;u<h;u++){let w=u*d-a;for(let S=0;S<l;S++){let T=S*p-r;_.push(T,-w,0),v.push(0,0,1),f.push(S/o),f.push(1-u/c)}}for(let u=0;u<c;u++)for(let w=0;w<o;w++){let S=w+l*u,T=w+l*(u+1),N=w+1+l*(u+1),R=w+1+l*u;m.push(S,T,R),m.push(T,N,R)}this.setIndex(m),this.setAttribute("position",new Pe(_,3)),this.setAttribute("normal",new Pe(v,3)),this.setAttribute("uv",new Pe(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}},Qh=`#ifdef USE_ALPHAHASH 41 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 42#endif`,tu=`#ifdef USE_ALPHAHASH 43 const float ALPHA_HASH_SCALE = 0.05; 44 float hash2D( vec2 value ) { 45 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 46 } 47 float hash3D( vec3 value ) { 48 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 49 } 50 float getAlphaHashThreshold( vec3 position ) { 51 float maxDeriv = max( 52 length( dFdx( position.xyz ) ), 53 length( dFdy( position.xyz ) ) 54 ); 55 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 56 vec2 pixScales = vec2( 57 exp2( floor( log2( pixScale ) ) ), 58 exp2( ceil( log2( pixScale ) ) ) 59 ); 60 vec2 alpha = vec2( 61 hash3D( floor( pixScales.x * position.xyz ) ), 62 hash3D( floor( pixScales.y * position.xyz ) ) 63 ); 64 float lerpFactor = fract( log2( pixScale ) ); 65 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 66 float a = min( lerpFactor, 1.0 - lerpFactor ); 67 vec3 cases = vec3( 68 x * x / ( 2.0 * a * ( 1.0 - a ) ), 69 ( x - 0.5 * a ) / ( 1.0 - a ), 70 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 71 ); 72 float threshold = ( x < ( 1.0 - a ) ) 73 ? ( ( x < a ) ? cases.x : cases.y ) 74 : cases.z; 75 return clamp( threshold , 1.0e-6, 1.0 ); 76 } 77#endif`,eu=`#ifdef USE_ALPHAMAP 78 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 79#endif`,nu=`#ifdef USE_ALPHAMAP 80 uniform sampler2D alphaMap; 81#endif`,iu=`#ifdef USE_ALPHATEST 82 #ifdef ALPHA_TO_COVERAGE 83 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 84 if ( diffuseColor.a == 0.0 ) discard; 85 #else 86 if ( diffuseColor.a < alphaTest ) discard; 87 #endif 88#endif`,su=`#ifdef USE_ALPHATEST 89 uniform float alphaTest; 90#endif`,ru=`#ifdef USE_AOMAP 91 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 92 reflectedLight.indirectDiffuse *= ambientOcclusion; 93 #if defined( USE_CLEARCOAT ) 94 clearcoatSpecularIndirect *= ambientOcclusion; 95 #endif 96 #if defined( USE_SHEEN ) 97 sheenSpecularIndirect *= ambientOcclusion; 98 #endif 99 #if defined( USE_ENVMAP ) && defined( STANDARD )
100 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 101 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 102 #endif 103#endif`,au=`#ifdef USE_AOMAP 104 uniform sampler2D aoMap; 105 uniform float aoMapIntensity; 106#endif`,ou=`#ifdef USE_BATCHING 107 #if ! defined( GL_ANGLE_multi_draw ) 108 #define gl_DrawID _gl_DrawID 109 uniform int _gl_DrawID; 110 #endif 111 uniform highp sampler2D batchingTexture; 112 uniform highp usampler2D batchingIdTexture; 113 mat4 getBatchingMatrix( const in float i ) { 114 int size = textureSize( batchingTexture, 0 ).x; 115 int j = int( i ) * 4; 116 int x = j % size; 117 int y = j / size; 118 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 119 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 120 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 121 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 122 return mat4( v1, v2, v3, v4 ); 123 } 124 float getIndirectIndex( const in int i ) { 125 int size = textureSize( batchingIdTexture, 0 ).x; 126 int x = i % size; 127 int y = i / size; 128 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 129 } 130#endif 131#ifdef USE_BATCHING_COLOR 132 uniform sampler2D batchingColorTexture; 133 vec3 getBatchingColor( const in float i ) { 134 int size = textureSize( batchingColorTexture, 0 ).x; 135 int j = int( i ); 136 int x = j % size; 137 int y = j / size; 138 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 139 } 140#endif`,cu=`#ifdef USE_BATCHING 141 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 142#endif`,lu=`vec3 transformed = vec3( position ); 143#ifdef USE_ALPHAHASH 144 vPosition = vec3( position ); 145#endif`,hu=`vec3 objectNormal = vec3( normal ); 146#ifdef USE_TANGENT 147 vec3 objectTangent = vec3( tangent.xyz ); 148#endif`,uu=`float G_BlinnPhong_Implicit( ) { 149 return 0.25; 150} 151float D_BlinnPhong( const in float shininess, const in float dotNH ) { 152 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 153} 154vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 155 vec3 halfDir = normalize( lightDir + viewDir ); 156 float dotNH = saturate( dot( normal, halfDir ) ); 157 float dotVH = saturate( dot( viewDir, halfDir ) ); 158 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 159 float G = G_BlinnPhong_Implicit( ); 160 float D = D_BlinnPhong( shininess, dotNH ); 161 return F * ( G * D ); 162} // validated`,du=`#ifdef USE_IRIDESCENCE 163 const mat3 XYZ_TO_REC709 = mat3( 164 3.2404542, -0.9692660, 0.0556434, 165 -1.5371385, 1.8760108, -0.2040259, 166 -0.4985314, 0.0415560, 1.0572252 167 ); 168 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 169 vec3 sqrtF0 = sqrt( fresnel0 ); 170 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 171 } 172 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 173 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 174 } 175 float IorToFresnel0( float transmittedIor, float incidentIor ) { 176 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 177 } 178 vec3 evalSensitivity( float OPD, vec3 shift ) { 179 float phase = 2.0 * PI * OPD * 1.0e-9; 180 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 181 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 182 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 183 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 184 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 185 xyz /= 1.0685e-7; 186 vec3 rgb = XYZ_TO_REC709 * xyz; 187 return rgb; 188 } 189 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 190 vec3 I; 191 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 192 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 193 float cosTheta2Sq = 1.0 - sinTheta2Sq; 194 if ( cosTheta2Sq < 0.0 ) { 195 return vec3( 1.0 ); 196 } 197 float cosTheta2 = sqrt( cosTheta2Sq ); 198 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
199 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 200 float T121 = 1.0 - R12; 201 float phi12 = 0.0; 202 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 203 float phi21 = PI - phi12; 204 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 205 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 206 vec3 phi23 = vec3( 0.0 ); 207 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 208 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 209 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 210 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 211 vec3 phi = vec3( phi21 ) + phi23; 212 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 213 vec3 r123 = sqrt( R123 ); 214 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 215 vec3 C0 = R12 + Rs; 216 I = C0; 217 vec3 Cm = Rs - T121; 218 for ( int m = 1; m <= 2; ++ m ) { 219 Cm *= r123; 220 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 221 I += Cm * Sm; 222 } 223 return max( I, vec3( 0.0 ) ); 224 } 225#endif`,fu=`#ifdef USE_BUMPMAP 226 uniform sampler2D bumpMap; 227 uniform float bumpScale; 228 vec2 dHdxy_fwd() { 229 vec2 dSTdx = dFdx( vBumpMapUv ); 230 vec2 dSTdy = dFdy( vBumpMapUv ); 231 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 232 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 233 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 234 return vec2( dBx, dBy ); 235 } 236 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 237 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 238 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 239 vec3 vN = surf_norm; 240 vec3 R1 = cross( vSigmaY, vN ); 241 vec3 R2 = cross( vN, vSigmaX ); 242 float fDet = dot( vSigmaX, R1 ) * faceDirection; 243 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 244 return normalize( abs( fDet ) * surf_norm - vGrad ); 245 } 246#endif`,pu=`#if NUM_CLIPPING_PLANES > 0 247 vec4 plane; 248 #ifdef ALPHA_TO_COVERAGE 249 float distanceToPlane, distanceGradient; 250 float clipOpacity = 1.0; 251 #pragma unroll_loop_start 252 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 253 plane = clippingPlanes[ i ]; 254 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 255 distanceGradient = fwidth( distanceToPlane ) / 2.0; 256 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 257 if ( clipOpacity == 0.0 ) discard; 258 } 259 #pragma unroll_loop_end 260 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 261 float unionClipOpacity = 1.0; 262 #pragma unroll_loop_start 263 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 264 plane = clippingPlanes[ i ]; 265 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 266 distanceGradient = fwidth( distanceToPlane ) / 2.0; 267 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 268 } 269 #pragma unroll_loop_end 270 clipOpacity *= 1.0 - unionClipOpacity; 271 #endif 272 diffuseColor.a *= clipOpacity; 273 if ( diffuseColor.a == 0.0 ) discard; 274 #else 275 #pragma unroll_loop_start 276 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 277 plane = clippingPlanes[ i ]; 278 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 279 } 280 #pragma unroll_loop_end 281 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 282 bool clipped = true; 283 #pragma unroll_loop_start 284 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 287 } 288 #pragma unroll_loop_end 289 if ( clipped ) discard; 290 #endif 291 #endif 292#endif`,mu=`#if NUM_CLIPPING_PLANES > 0 293 varying vec3 vClipPosition; 294 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 295#endif`,gu=`#if NUM_CLIPPING_PLANES > 0 296 varying vec3 vClipPosition; 297#endif`,_u=`#if NUM_CLIPPING_PLANES > 0 298 vClipPosition = - mvPosition.xyz; 299#endif`,xu=`#if defined( USE_COLOR_ALPHA ) 300 diffuseColor *= vColor; 301#elif defined( USE_COLOR ) 302 diffuseColor.rgb *= vColor; 303#endif`,vu=`#if defined( USE_COLOR_ALPHA ) 304 varying vec4 vColor; 305#elif defined( USE_COLOR ) 306 varying vec3 vColor; 307#endif`,yu=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 310 varying vec3 vColor; 311#endif`,Mu=`#if defined( USE_COLOR_ALPHA ) 312 vColor = vec4( 1.0 ); 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 vColor = vec3( 1.0 ); 315#endif 316#ifdef USE_COLOR 317 vColor *= color; 318#endif 319#ifdef USE_INSTANCING_COLOR 320 vColor.xyz *= instanceColor.xyz; 321#endif 322#ifdef USE_BATCHING_COLOR 323 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 324 vColor.xyz *= batchingColor.xyz; 325#endif`,Su=`#define PI 3.141592653589793 326#define PI2 6.283185307179586 327#define PI_HALF 1.5707963267948966 328#define RECIPROCAL_PI 0.3183098861837907 329#define RECIPROCAL_PI2 0.15915494309189535 330#define EPSILON 1e-6 331#ifndef saturate 332#define saturate( a ) clamp( a, 0.0, 1.0 ) 333#endif 334#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 335float pow2( const in float x ) { return x*x; } 336vec3 pow2( const in vec3 x ) { return x*x; } 337float pow3( const in float x ) { return x*x*x; } 338float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 339float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 340float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 341highp float rand( const in vec2 uv ) { 342 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 343 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 344 return fract( sin( sn ) * c ); 345} 346#ifdef HIGH_PRECISION 347 float precisionSafeLength( vec3 v ) { return length( v ); } 348#else 349 float precisionSafeLength( vec3 v ) { 350 float maxComponent = max3( abs( v ) ); 351 return length( v / maxComponent ) * maxComponent; 352 } 353#endif 354struct IncidentLight { 355 vec3 color; 356 vec3 direction; 357 bool visible; 358}; 359struct ReflectedLight { 360 vec3 directDiffuse; 361 vec3 directSpecular; 362 vec3 indirectDiffuse; 363 vec3 indirectSpecular; 364}; 365#ifdef USE_ALPHAHASH 366 varying vec3 vPosition; 367#endif 368vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 369 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 370} 371vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 372 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 373} 374mat3 transposeMat3( const in mat3 m ) { 375 mat3 tmp; 376 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 377 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 378 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 379 return tmp; 380} 381bool isPerspectiveMatrix( mat4 m ) { 382 return m[ 2 ][ 3 ] == - 1.0; 383} 384vec2 equirectUv( in vec3 dir ) { 385 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 386 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 387 return vec2( u, v ); 388}
389vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 390 return RECIPROCAL_PI * diffuseColor; 391} 392vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 393 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 394 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 395} 396float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 397 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 398 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 399} // validated`,bu=`#ifdef ENVMAP_TYPE_CUBE_UV 400 #define cubeUV_minMipLevel 4.0 401 #define cubeUV_minTileSize 16.0 402 float getFace( vec3 direction ) { 403 vec3 absDirection = abs( direction ); 404 float face = - 1.0; 405 if ( absDirection.x > absDirection.z ) { 406 if ( absDirection.x > absDirection.y ) 407 face = direction.x > 0.0 ? 0.0 : 3.0; 408 else 409 face = direction.y > 0.0 ? 1.0 : 4.0; 410 } else { 411 if ( absDirection.z > absDirection.y ) 412 face = direction.z > 0.0 ? 2.0 : 5.0; 413 else 414 face = direction.y > 0.0 ? 1.0 : 4.0; 415 } 416 return face; 417 } 418 vec2 getUV( vec3 direction, float face ) { 419 vec2 uv; 420 if ( face == 0.0 ) { 421 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 422 } else if ( face == 1.0 ) { 423 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 424 } else if ( face == 2.0 ) { 425 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 426 } else if ( face == 3.0 ) { 427 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 428 } else if ( face == 4.0 ) { 429 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 430 } else { 431 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 432 } 433 return 0.5 * ( uv + 1.0 ); 434 } 435 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 436 float face = getFace( direction ); 437 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 438 mipInt = max( mipInt, cubeUV_minMipLevel ); 439 float faceSize = exp2( mipInt ); 440 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 441 if ( face > 2.0 ) { 442 uv.y += faceSize; 443 face -= 3.0; 444 } 445 uv.x += face * faceSize; 446 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 447 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 448 uv.x *= CUBEUV_TEXEL_WIDTH; 449 uv.y *= CUBEUV_TEXEL_HEIGHT; 450 #ifdef texture2DGradEXT 451 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 452 #else 453 return texture2D( envMap, uv ).rgb; 454 #endif 455 } 456 #define cubeUV_r0 1.0 457 #define cubeUV_m0 - 2.0 458 #define cubeUV_r1 0.8 459 #define cubeUV_m1 - 1.0 460 #define cubeUV_r4 0.4 461 #define cubeUV_m4 2.0 462 #define cubeUV_r5 0.305 463 #define cubeUV_m5 3.0 464 #define cubeUV_r6 0.21 465 #define cubeUV_m6 4.0 466 float roughnessToMip( float roughness ) { 467 float mip = 0.0; 468 if ( roughness >= cubeUV_r1 ) { 469 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 470 } else if ( roughness >= cubeUV_r4 ) { 471 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 472 } else if ( roughness >= cubeUV_r5 ) { 473 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 474 } else if ( roughness >= cubeUV_r6 ) { 475 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 476 } else { 477 mip = - 2.0 * log2( 1.16 * roughness ); } 478 return mip; 479 } 480 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 481 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 482 float mipF = fract( mip ); 483 float mipInt = floor( mip ); 484 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 485 if ( mipF == 0.0 ) { 486 return vec4( color0, 1.0 ); 487 } else { 488 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 489 return vec4( mix( color0, color1, mipF ), 1.0 ); 490 } 491 } 492#endif`,Eu=`vec3 transformedNormal = objectNormal; 493#ifdef USE_TANGENT 494 vec3 transformedTangent = objectTangent; 495#endif 496#ifdef USE_BATCHING 497 mat3 bm = mat3( batchingMatrix ); 498 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 499 transformedNormal = bm * transformedNormal; 500 #ifdef USE_TANGENT 501 transformedTangent = bm * transformedTangent; 502 #endif 503#endif 504#ifdef USE_INSTANCING 505 mat3 im = mat3( instanceMatrix ); 506 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 507 transformedNormal = im * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = im * transformedTangent; 510 #endif 511#endif 512transformedNormal = normalMatrix * transformedNormal; 513#ifdef FLIP_SIDED 514 transformedNormal = - transformedNormal; 515#endif 516#ifdef USE_TANGENT 517 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 518 #ifdef FLIP_SIDED 519 transformedTangent = - transformedTangent; 520 #endif 521#endif`,wu=`#ifdef USE_DISPLACEMENTMAP 522 uniform sampler2D displacementMap; 523 uniform float displacementScale; 524 uniform float displacementBias; 525#endif`,Tu=`#ifdef USE_DISPLACEMENTMAP 526 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
526placementBias ); 527#endif`,Au=`#ifdef USE_EMISSIVEMAP 528 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 529 totalEmissiveRadiance *= emissiveColor.rgb; 530#endif`,Cu=`#ifdef USE_EMISSIVEMAP 531 uniform sampler2D emissiveMap; 532#endif`,Ru="gl_FragColor = linearToOutputTexel( gl_FragColor );",Pu=` 533const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 534 vec3( 0.8224621, 0.177538, 0.0 ), 535 vec3( 0.0331941, 0.9668058, 0.0 ), 536 vec3( 0.0170827, 0.0723974, 0.9105199 ) 537); 538const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 539 vec3( 1.2249401, - 0.2249404, 0.0 ), 540 vec3( - 0.0420569, 1.0420571, 0.0 ), 541 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 542); 543vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 544 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 545} 546vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 547 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 548} 549vec4 LinearTransferOETF( in vec4 value ) { 550 return value; 551} 552vec4 sRGBTransferOETF( in vec4 value ) { 553 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 ); 554}`,Iu=`#ifdef USE_ENVMAP 555 #ifdef ENV_WORLDPOS 556 vec3 cameraToFrag; 557 if ( isOrthographic ) { 558 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 559 } else { 560 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 561 } 562 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 563 #ifdef ENVMAP_MODE_REFLECTION 564 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 565 #else 566 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 567 #endif 568 #else 569 vec3 reflectVec = vReflect; 570 #endif 571 #ifdef ENVMAP_TYPE_CUBE 572 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 573 #else 574 vec4 envColor = vec4( 0.0 ); 575 #endif 576 #ifdef ENVMAP_BLENDING_MULTIPLY 577 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 578 #elif defined( ENVMAP_BLENDING_MIX ) 579 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 580 #elif defined( ENVMAP_BLENDING_ADD ) 581 outgoingLight += envColor.xyz * specularStrength * reflectivity; 582 #endif 583#endif`,Lu=`#ifdef USE_ENVMAP 584 uniform float envMapIntensity; 585 uniform float flipEnvMap; 586 uniform mat3 envMapRotation; 587 #ifdef ENVMAP_TYPE_CUBE 588 uniform samplerCube envMap; 589 #else 590 uniform sampler2D envMap; 591 #endif 592 593#endif`,Du=`#ifdef USE_ENVMAP 594 uniform float reflectivity; 595 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 596 #define ENV_WORLDPOS 597 #endif 598 #ifdef ENV_WORLDPOS 599 varying vec3 vWorldPosition; 600 uniform float refractionRatio; 601 #else 602 varying vec3 vReflect; 603 #endif 604#endif`,Uu=`#ifdef USE_ENVMAP 605 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 606 #define ENV_WORLDPOS 607 #endif 608 #ifdef ENV_WORLDPOS 609 610 varying vec3 vWorldPosition; 611 #else 612 varying vec3 vReflect; 613 uniform float refractionRatio; 614 #endif 615#endif`,Nu=`#ifdef USE_ENVMAP 616 #ifdef ENV_WORLDPOS 617 vWorldPosition = worldPosition.xyz; 618 #else 619 vec3 cameraToVertex; 620 if ( isOrthographic ) { 621 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 622 } else {
623 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 624 } 625 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 626 #ifdef ENVMAP_MODE_REFLECTION 627 vReflect = reflect( cameraToVertex, worldNormal ); 628 #else 629 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 630 #endif 631 #endif 632#endif`,Ou=`#ifdef USE_FOG 633 vFogDepth = - mvPosition.z; 634#endif`,Fu=`#ifdef USE_FOG 635 varying float vFogDepth; 636#endif`,Bu=`#ifdef USE_FOG 637 #ifdef FOG_EXP2 638 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 639 #else 640 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 641 #endif 642 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 643#endif`,zu=`#ifdef USE_FOG 644 uniform vec3 fogColor; 645 varying float vFogDepth; 646 #ifdef FOG_EXP2 647 uniform float fogDensity; 648 #else 649 uniform float fogNear; 650 uniform float fogFar; 651 #endif 652#endif`,ku=`#ifdef USE_GRADIENTMAP 653 uniform sampler2D gradientMap; 654#endif 655vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 656 float dotNL = dot( normal, lightDirection ); 657 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 658 #ifdef USE_GRADIENTMAP 659 return vec3( texture2D( gradientMap, coord ).r ); 660 #else 661 vec2 fw = fwidth( coord ) * 0.5; 662 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 663 #endif 664}`,Vu=`#ifdef USE_LIGHTMAP 665 uniform sampler2D lightMap; 666 uniform float lightMapIntensity; 667#endif`,Hu=`LambertMaterial material; 668material.diffuseColor = diffuseColor.rgb; 669material.specularStrength = specularStrength;`,Gu=`varying vec3 vViewPosition; 670struct LambertMaterial { 671 vec3 diffuseColor; 672 float specularStrength; 673}; 674void 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 ) { 675 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 676 vec3 irradiance = dotNL * directLight.color; 677 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 678} 679void 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 ) { 680 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 681} 682#define RE_Direct RE_Direct_Lambert 683#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Wu=`uniform bool receiveShadow; 684uniform vec3 ambientLightColor; 685#if defined( USE_LIGHT_PROBES ) 686 uniform vec3 lightProbe[ 9 ]; 687#endif 688vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 689 float x = normal.x, y = normal.y, z = normal.z; 690 vec3 result = shCoefficients[ 0 ] * 0.886227; 691 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 692 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 693 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 694 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 695 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 696 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 697 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 698 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 699 return result; 700} 701vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 702 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 703 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 704 return irradiance; 705} 706vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 707 vec3 irradiance = ambientLightColor; 708 return irradiance; 709} 710float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 711 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 712 if ( cutoffDistance > 0.0 ) { 713 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 714 } 715 return distanceFalloff; 716} 717float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 718 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 719} 720#if NUM_DIR_LIGHTS > 0 721 struct DirectionalLight { 722 vec3 direction; 723 vec3 color; 724 }; 725 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 726 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 727 light.color = directionalLight.color; 728 light.direction = directionalLight.direction; 729 light.visible = true; 730 } 731#endif 732#if NUM_POINT_LIGHTS > 0 733 struct PointLight { 734 vec3 position; 735 vec3 color; 736 float distance; 737 float decay; 738 }; 739 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 740 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 741 vec3 lVector = pointLight.position - geometryPosition; 742 light.direction = normalize( lVector ); 743 float lightDistance = length( lVector ); 744 light.color = pointLight.color; 745 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 746 light.visible = ( light.color != vec3( 0.0 ) ); 747 } 748#endif
749#if NUM_SPOT_LIGHTS > 0 750 struct SpotLight { 751 vec3 position; 752 vec3 direction; 753 vec3 color; 754 float distance; 755 float decay; 756 float coneCos; 757 float penumbraCos; 758 }; 759 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 760 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 761 vec3 lVector = spotLight.position - geometryPosition; 762 light.direction = normalize( lVector ); 763 float angleCos = dot( light.direction, spotLight.direction ); 764 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 765 if ( spotAttenuation > 0.0 ) { 766 float lightDistance = length( lVector ); 767 light.color = spotLight.color * spotAttenuation; 768 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 769 light.visible = ( light.color != vec3( 0.0 ) ); 770 } else { 771 light.color = vec3( 0.0 ); 772 light.visible = false; 773 } 774 } 775#endif 776#if NUM_RECT_AREA_LIGHTS > 0 777 struct RectAreaLight { 778 vec3 color; 779 vec3 position; 780 vec3 halfWidth; 781 vec3 halfHeight; 782 }; 783 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 784 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 785#endif 786#if NUM_HEMI_LIGHTS > 0 787 struct HemisphereLight { 788 vec3 direction; 789 vec3 skyColor; 790 vec3 groundColor; 791 }; 792 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 793 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 794 float dotNL = dot( normal, hemiLight.direction ); 795 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 796 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 797 return irradiance; 798 } 799#endif`,Xu=`#ifdef USE_ENVMAP 800 vec3 getIBLIrradiance( const in vec3 normal ) { 801 #ifdef ENVMAP_TYPE_CUBE_UV 802 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 803 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 804 return PI * envMapColor.rgb * envMapIntensity; 805 #else 806 return vec3( 0.0 ); 807 #endif 808 } 809 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 810 #ifdef ENVMAP_TYPE_CUBE_UV 811 vec3 reflectVec = reflect( - viewDir, normal ); 812 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 813 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 814 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 815 return envMapColor.rgb * envMapIntensity; 816 #else 817 return vec3( 0.0 ); 818 #endif 819 } 820 #ifdef USE_ANISOTROPY 821 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 822 #ifdef ENVMAP_TYPE_CUBE_UV 823 vec3 bentNormal = cross( bitangent, viewDir ); 824 bentNormal = normalize( cross( bentNormal, bitangent ) ); 825 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 826 return getIBLRadiance( viewDir, bentNormal, roughness ); 827 #else 828 return vec3( 0.0 ); 829 #endif 830 } 831 #endif 832#endif`,Yu=`ToonMaterial material; 833material.diffuseColor = diffuseColor.rgb;`,qu=`varying vec3 vViewPosition; 834struct ToonMaterial { 835 vec3 diffuseColor; 836}; 837void 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 ) { 838 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 839 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 840} 841void 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 ) { 842 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 843} 844#define RE_Direct RE_Direct_Toon 845#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Zu=`BlinnPhongMaterial material; 846material.diffuseColor = diffuseColor.rgb; 847material.specularColor = specular; 848material.specularShininess = shininess; 849material.specularStrength = specularStrength;`,Ju=`varying vec3 vViewPosition; 850struct BlinnPhongMaterial { 851 vec3 diffuseColor; 852 vec3 specularColor; 853 float specularShininess; 854 float specularStrength; 855}; 856void 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 ) {
857 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 858 vec3 irradiance = dotNL * directLight.color; 859 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 860 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 861} 862void 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 ) { 863 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 864} 865#define RE_Direct RE_Direct_BlinnPhong 866#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Ku=`PhysicalMaterial material; 867material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 868vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 869float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 870material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 871material.roughness = min( material.roughness, 1.0 ); 872#ifdef IOR 873 material.ior = ior; 874 #ifdef USE_SPECULAR 875 float specularIntensityFactor = specularIntensity; 876 vec3 specularColorFactor = specularColor; 877 #ifdef USE_SPECULAR_COLORMAP 878 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 879 #endif 880 #ifdef USE_SPECULAR_INTENSITYMAP 881 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 882 #endif 883 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 884 #else 885 float specularIntensityFactor = 1.0; 886 vec3 specularColorFactor = vec3( 1.0 ); 887 material.specularF90 = 1.0; 888 #endif 889 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 890#else 891 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 892 material.specularF90 = 1.0; 893#endif 894#ifdef USE_CLEARCOAT 895 material.clearcoat = clearcoat; 896 material.clearcoatRoughness = clearcoatRoughness; 897 material.clearcoatF0 = vec3( 0.04 ); 898 material.clearcoatF90 = 1.0; 899 #ifdef USE_CLEARCOATMAP 900 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 901 #endif 902 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 903 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 904 #endif 905 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 906 material.clearcoatRoughness += geometryRoughness; 907 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 908#endif 909#ifdef USE_DISPERSION 910 material.dispersion = dispersion; 911#endif 912#ifdef USE_IRIDESCENCE 913 material.iridescence = iridescence; 914 material.iridescenceIOR = iridescenceIOR; 915 #ifdef USE_IRIDESCENCEMAP 916 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 917 #endif 918 #ifdef USE_IRIDESCENCE_THICKNESSMAP 919 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 920 #else 921 material.iridescenceThickness = iridescenceThicknessMaximum; 922 #endif 923#endif 924#ifdef USE_SHEEN 925 material.sheenColor = sheenColor; 926 #ifdef USE_SHEEN_COLORMAP 927 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 928 #endif 929 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 930 #ifdef USE_SHEEN_ROUGHNESSMAP 931 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 932 #endif 933#endif 934#ifdef USE_ANISOTROPY 935 #ifdef USE_ANISOTROPYMAP 936 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 937 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 938 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 939 #else 940 vec2 anisotropyV = anisotropyVector; 941 #endif 942 material.anisotropy = length( anisotropyV ); 943 if( material.anisotropy == 0.0 ) { 944 anisotropyV = vec2( 1.0, 0.0 ); 945 } else { 946 anisotropyV /= material.anisotropy; 947 material.anisotropy = saturate( material.anisotropy ); 948 } 949 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
950 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 951 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 952#endif`,$u
vendor: 14,687 bytes, lines 952-1253
952=`struct PhysicalMaterial { 953 vec3 diffuseColor; 954 float roughness; 955 vec3 specularColor; 956 float specularF90; 957 float dispersion; 958 #ifdef USE_CLEARCOAT 959 float clearcoat; 960 float clearcoatRoughness; 961 vec3 clearcoatF0; 962 float clearcoatF90; 963 #endif 964 #ifdef USE_IRIDESCENCE 965 float iridescence; 966 float iridescenceIOR; 967 float iridescenceThickness; 968 vec3 iridescenceFresnel; 969 vec3 iridescenceF0; 970 #endif 971 #ifdef USE_SHEEN 972 vec3 sheenColor; 973 float sheenRoughness; 974 #endif 975 #ifdef IOR 976 float ior; 977 #endif 978 #ifdef USE_TRANSMISSION 979 float transmission; 980 float transmissionAlpha; 981 float thickness; 982 float attenuationDistance; 983 vec3 attenuationColor; 984 #endif 985 #ifdef USE_ANISOTROPY 986 float anisotropy; 987 float alphaT; 988 vec3 anisotropyT; 989 vec3 anisotropyB; 990 #endif 991}; 992vec3 clearcoatSpecularDirect = vec3( 0.0 ); 993vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 994vec3 sheenSpecularDirect = vec3( 0.0 ); 995vec3 sheenSpecularIndirect = vec3(0.0 ); 996vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 997 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 998 float x2 = x * x; 999 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1000 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1001} 1002float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1003 float a2 = pow2( alpha ); 1004 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1005 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1006 return 0.5 / max( gv + gl, EPSILON ); 1007} 1008float D_GGX( const in float alpha, const in float dotNH ) { 1009 float a2 = pow2( alpha ); 1010 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1011 return RECIPROCAL_PI * a2 / pow2( denom ); 1012} 1013#ifdef USE_ANISOTROPY 1014 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 ) { 1015 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1016 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1017 float v = 0.5 / ( gv + gl ); 1018 return saturate(v); 1019 } 1020 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1021 float a2 = alphaT * alphaB; 1022 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1023 highp float v2 = dot( v, v ); 1024 float w2 = a2 / v2; 1025 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1026 } 1027#endif 1028#ifdef USE_CLEARCOAT 1029 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1030 vec3 f0 = material.clearcoatF0; 1031 float f90 = material.clearcoatF90; 1032 float roughness = material.clearcoatRoughness; 1033 float alpha = pow2( roughness ); 1034 vec3 halfDir = normalize( lightDir + viewDir ); 1035 float dotNL = saturate( dot( normal, lightDir ) ); 1036 float dotNV = saturate( dot( normal, viewDir ) ); 1037 float dotNH = saturate( dot( normal, halfDir ) ); 1038 float dotVH = saturate( dot( viewDir, halfDir ) ); 1039 vec3 F = F_Schlick( f0, f90, dotVH ); 1040 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1041 float D = D_GGX( alpha, dotNH ); 1042 return F * ( V * D ); 1043 } 1044#endif 1045vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1046 vec3 f0 = material.specularColor; 1047 float f90 = material.specularF90; 1048 float roughness = material.roughness; 1049 float alpha = pow2( roughness ); 1050 vec3 halfDir = normalize( lightDir + viewDir ); 1051 float dotNL = saturate( dot( normal, lightDir ) ); 1052 float dotNV = saturate( dot( normal, viewDir ) ); 1053 float dotNH = saturate( dot( normal, halfDir ) ); 1054 float dotVH = saturate( dot( viewDir, halfDir ) ); 1055 vec3 F = F_Schlick( f0, f90, dotVH ); 1056 #ifdef USE_IRIDESCENCE 1057 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1058 #endif 1059 #ifdef USE_ANISOTROPY 1060 float dotTL = dot( material.anisotropyT, lightDir ); 1061 float dotTV = dot( material.anisotropyT, viewDir ); 1062 float dotTH = dot( material.anisotropyT, halfDir ); 1063 float dotBL = dot( material.anisotropyB, lightDir ); 1064 float dotBV = dot( material.anisotropyB, viewDir ); 1065 float dotBH = dot( material.anisotropyB, halfDir ); 1066 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1067 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1068 #else 1069 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1070 float D = D_GGX( alpha, dotNH ); 1071 #endif 1072 return F * ( V * D ); 1073} 1074vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1075 const float LUT_SIZE = 64.0; 1076 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1077 const float LUT_BIAS = 0.5 / LUT_SIZE; 1078 float dotNV = saturate( dot( N, V ) ); 1079 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1080 uv = uv * LUT_SCALE + LUT_BIAS; 1081 return uv; 1082} 1083float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1084 float l = length( f ); 1085 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1086} 1087vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1088 float x = dot( v1, v2 ); 1089 float y = abs( x ); 1090 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1091 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1092 float v = a / b; 1093 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1094 return cross( v1, v2 ) * theta_sintheta; 1095} 1096vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1097 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1098 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1099 vec3 lightNormal = cross( v1, v2 ); 1100 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1101 vec3 T1, T2; 1102 T1 = normalize( V - N * dot( V, N ) ); 1103 T2 = - cross( N, T1 ); 1104 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1105 vec3 coords[ 4 ]; 1106 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1107 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1108 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1109 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1110 coords[ 0 ] = normalize( coords[ 0 ] ); 1111 coords[ 1 ] = normalize( coords[ 1 ] ); 1112 coords[ 2 ] = normalize( coords[ 2 ] ); 1113 coords[ 3 ] = normalize( coords[ 3 ] ); 1114 vec3 vectorFormFactor = vec3( 0.0 ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1116 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1117 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1118 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1119 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1120 return vec3( result ); 1121} 1122#if defined( USE_SHEEN ) 1123float D_Charlie( float roughness, float dotNH ) { 1124 float alpha = pow2( roughness ); 1125 float invAlpha = 1.0 / alpha; 1126 float cos2h = dotNH * dotNH; 1127 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1128 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1129} 1130float V_Neubelt( float dotNV, float dotNL ) { 1131 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1132} 1133vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1134 vec3 halfDir = normalize( lightDir + viewDir ); 1135 float dotNL = saturate( dot( normal, lightDir ) ); 1136 float dotNV = saturate( dot( normal, viewDir ) ); 1137 float dotNH = saturate( dot( normal, halfDir ) ); 1138 float D = D_Charlie( sheenRoughness, dotNH ); 1139 float V = V_Neubelt( dotNV, dotNL ); 1140 return sheenColor * ( D * V ); 1141} 1142#endif 1143float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1144 float dotNV = saturate( dot( normal, viewDir ) ); 1145 float r2 = roughness * roughness; 1146 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1147 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1148 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1149 return saturate( DG * RECIPROCAL_PI ); 1150} 1151vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1152 float dotNV = saturate( dot( normal, viewDir ) ); 1153 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1154 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1155 vec4 r = roughness * c0 + c1; 1156 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1157 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1158 return fab; 1159} 1160vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1161 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1162 return specularColor * fab.x + specularF90 * fab.y; 1163} 1164#ifdef USE_IRIDESCENCE 1165void 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 ) { 1166#else 1167void 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 ) { 1168#endif 1169 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1170 #ifdef USE_IRIDESCENCE 1171 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1172 #else 1173 vec3 Fr = specularColor; 1174 #endif 1175 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1176 float Ess = fab.x + fab.y; 1177 float Ems = 1.0 - Ess; 1178 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1179 singleScatter += FssEss; 1180 multiScatter += Fms * Ems; 1181} 1182#if NUM_RECT_AREA_LIGHTS > 0 1183 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 ) { 1184 vec3 normal = geometryNormal; 1185 vec3 viewDir = geometryViewDir; 1186 vec3 position = geometryPosition; 1187 vec3 lightPos = rectAreaLight.position; 1188 vec3 halfWidth = rectAreaLight.halfWidth; 1189 vec3 halfHeight = rectAreaLight.halfHeight; 1190 vec3 lightColor = rectAreaLight.color; 1191 float roughness = material.roughness; 1192 vec3 rectCoords[ 4 ]; 1193 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1194 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1195 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1196 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1197 vec4 t1 = texture2D( ltc_1, uv ); 1198 vec4 t2 = texture2D( ltc_2, uv ); 1199 mat3 mInv = mat3( 1200 vec3( t1.x, 0, t1.y ), 1201 vec3( 0, 1, 0 ), 1202 vec3( t1.z, 0, t1.w ) 1203 ); 1204 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1205 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1206 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1207 } 1208#endif 1209void 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 ) { 1210 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1211 vec3 irradiance = dotNL * directLight.color; 1212 #ifdef USE_CLEARCOAT 1213 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1214 vec3 ccIrradiance = dotNLcc * directLight.color; 1215 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1216 #endif 1217 #ifdef USE_SHEEN 1218 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1219 #endif 1220 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1221 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1222} 1223void 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 ) { 1224 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1225} 1226void 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) { 1227 #ifdef USE_CLEARCOAT 1228 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1229 #endif 1230 #ifdef USE_SHEEN 1231 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1232 #endif 1233 vec3 singleScattering = vec3( 0.0 ); 1234 vec3 multiScattering = vec3( 0.0 ); 1235 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1236 #ifdef USE_IRIDESCENCE 1237 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1238 #else 1239 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1240 #endif 1241 vec3 totalScattering = singleScattering + multiScattering; 1242 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1243 reflectedLight.indirectSpecular += radiance * singleScattering; 1244 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1245 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1246} 1247#define RE_Direct RE_Direct_Physical 1248#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1249#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1250#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1251float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1252 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1253}`,
1253ju=` 1254vec3 geometryPosition = - vViewPosition; 1255vec3 geometryNormal = normal; 1256vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1257vec3 geometryClearcoatNormal = vec3( 0.0 ); 1258#ifdef USE_CLEARCOAT 1259 geometryClearcoatNormal = clearcoatNormal; 1260#endif 1261#ifdef USE_IRIDESCENCE 1262 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1263 if ( material.iridescenceThickness == 0.0 ) { 1264 material.iridescence = 0.0; 1265 } else { 1266 material.iridescence = saturate( material.iridescence ); 1267 } 1268 if ( material.iridescence > 0.0 ) { 1269 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1270 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1271 } 1272#endif 1273IncidentLight directLight; 1274#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1275 PointLight pointLight; 1276 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1277 PointLightShadow pointLightShadow; 1278 #endif 1279 #pragma unroll_loop_start 1280 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1281 pointLight = pointLights[ i ]; 1282 getPointLightInfo( pointLight, geometryPosition, directLight ); 1283 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1284 pointLightShadow = pointLightShadows[ i ]; 1285 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1286 #endif 1287 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1288 } 1289 #pragma unroll_loop_end 1290#endif 1291#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1292 SpotLight spotLight; 1293 vec4 spotColor; 1294 vec3 spotLightCoord; 1295 bool inSpotLightMap; 1296 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1297 SpotLightShadow spotLightShadow; 1298 #endif 1299 #pragma unroll_loop_start 1300 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1301 spotLight = spotLights[ i ]; 1302 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1303 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1304 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1305 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1306 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1307 #else 1308 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1309 #endif 1310 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1311 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1312 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1313 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1314 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1315 #endif 1316 #undef SPOT_LIGHT_MAP_INDEX 1317 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1318 spotLightShadow = spotLightShadows[ i ]; 1319 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1320 #endif 1321 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1322 } 1323 #pragma unroll_loop_end 1324#endif 1325#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1326 DirectionalLight directionalLight; 1327 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1328 DirectionalLightShadow directionalLightShadow; 1329 #endif 1330 #pragma unroll_loop_start 1331 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1332 directionalLight = directionalLights[ i ]; 1333 getDirectionalLightInfo( directionalLight, directLight ); 1334 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1335 directionalLightShadow = directionalLightShadows[ i ]; 1336 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1337 #endif 1338 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1339 } 1340 #pragma unroll_loop_end 1341#endif 1342#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1343 RectAreaLight rectAreaLight; 1344 #pragma unroll_loop_start 1345 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1346 rectAreaLight = rectAreaLights[ i ]; 1347 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1348 } 1349 #pragma unroll_loop_end 1350#endif 1351#if defined( RE_IndirectDiffuse ) 1352 vec3 iblIrradiance = vec3( 0.0 ); 1353 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1354 #if defined( USE_LIGHT_PROBES ) 1355 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1356 #endif 1357 #if ( NUM_HEMI_LIGHTS > 0 ) 1358 #pragma unroll_loop_start 1359 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1360 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1361 } 1362 #pragma unroll_loop_end 1363 #endif 1364#endif 1365#if defined( RE_IndirectSpecular ) 1366 vec3 radiance = vec3( 0.0 ); 1367 vec3 clearcoatRadiance = vec3( 0.0 ); 1368#endif`,Qu=`#if defined( RE_IndirectDiffuse ) 1369 #ifdef USE_LIGHTMAP 1370 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1371 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1372 irradiance += lightMapIrradiance; 1373 #endif 1374 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1375 iblIrradiance += getIBLIrradiance( geometryNormal ); 1376 #endif 1377#endif 1378#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1379 #ifdef USE_ANISOTROPY 1380 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1381 #else 1382 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1383 #endif 1384 #ifdef USE_CLEARCOAT 1385 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1386 #endif 1387#endif`,td=`#if defined( RE_IndirectDiffuse ) 1388 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1389#endif 1390#if defined( RE_IndirectSpecular ) 1391 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1392#endif`,ed=`#if defined( USE_LOGDEPTHBUF ) 1393 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1394#endif`,nd=`#if defined( USE_LOGDEPTHBUF ) 1395 uniform float logDepthBufFC; 1396 varying float vFragDepth; 1397 varying float vIsPerspective; 1398#endif`,id=`#ifdef USE_LOGDEPTHBUF 1399 varying float vFragDepth; 1400 varying float vIsPerspective; 1401#endif`,sd=`#ifdef USE_LOGDEPTHBUF 1402 vFragDepth = 1.0 + gl_Position.w; 1403 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1404#endif`,rd=`#ifdef USE_MAP 1405 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1406 #ifdef DECODE_VIDEO_TEXTURE 1407 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1408 1409 #endif 1410 diffuseColor *= sampledDiffuseColor; 1411#endif`,ad=`#ifdef USE_MAP 1412 uniform sampler2D map; 1413#endif`,od=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1414 #if defined( USE_POINTS_UV ) 1415 vec2 uv = vUv; 1416 #else 1417 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1418 #endif 1419#endif 1420#ifdef USE_MAP 1421 diffuseColor *= texture2D( map, uv ); 1422#endif 1423#ifdef USE_ALPHAMAP 1424 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1425#endif`,cd=`#if defined( USE_POINTS_UV ) 1426 varying vec2 vUv; 1427#else 1428 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1429 uniform mat3 uvTransform; 1430 #endif 1431#endif 1432#ifdef USE_MAP 1433 uniform sampler2D map; 1434#endif 1435#ifdef USE_ALPHAMAP 1436 uniform sampler2D alphaMap; 1437#endif`,ld=`float metalnessFactor = metalness; 1438#ifdef USE_METALNESSMAP 1439 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1440 metalnessFactor *= texelMetalness.b; 1441#endif`,hd=`#ifdef USE_METALNESSMAP 1442 uniform sampler2D metalnessMap; 1443#endif`,ud=`#ifdef USE_INSTANCING_MORPH 1444 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1445 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1446 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1447 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1448 } 1449#endif`,dd=`#if defined( USE_MORPHCOLORS ) 1450 vColor *= morphTargetBaseInfluence; 1451 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1452 #if defined( USE_COLOR_ALPHA ) 1453 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1454 #elif defined( USE_COLOR ) 1455 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1456 #endif 1457 } 1458#endif`,fd=`#ifdef USE_MORPHNORMALS 1459 objectNormal *= morphTargetBaseInfluence; 1460 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1461 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1462 } 1463#endif`,pd=`#ifdef USE_MORPHTARGETS 1464 #ifndef USE_INSTANCING_MORPH 1465 uniform float morphTargetBaseInfluence; 1466 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1467 #endif 1468 uniform sampler2DArray morphTargetsTexture; 1469 uniform ivec2 morphTargetsTextureSize; 1470 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1471 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1472 int y = texelIndex / morphTargetsTextureSize.x; 1473 int x = texelIndex - y * morphTargetsTextureSize.x; 1474 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1475 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1476 } 1477#endif`,md=`#ifdef USE_MORPHTARGETS 1478 transformed *= morphTargetBaseInfluence; 1479 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1480 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1481 } 1482#endif`,gd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1483#ifdef FLAT_SHADED 1484 vec3 fdx = dFdx( vViewPosition ); 1485 vec3 fdy = dFdy( vViewPosition ); 1486 vec3 normal = normalize( cross( fdx, fdy ) ); 1487#else 1488 vec3 normal = normalize( vNormal ); 1489 #ifdef DOUBLE_SIDED 1490 normal *= faceDirection; 1491 #endif 1492#endif 1493#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1494 #ifdef USE_TANGENT 1495 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1496 #else 1497 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1498 #if defined( USE_NORMALMAP ) 1499 vNormalMapUv 1500 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1501 vClearcoatNormalMapUv 1502 #else 1503 vUv 1504 #endif 1505 ); 1506 #endif 1507 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1508 tbn[0] *= faceDirection; 1509 tbn[1] *= faceDirection; 1510 #endif 1511#endif 1512#ifdef USE_CLEARCOAT_NORMALMAP 1513 #ifdef USE_TANGENT 1514 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1515 #else 1516 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1517 #endif 1518 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1519 tbn2[0] *= faceDirection; 1520 tbn2[1] *= faceDirection; 1521 #endif 1522#endif 1523vec3 nonPerturbedNormal = normal;`,_d=`#ifdef USE_NORMALMAP_OBJECTSPACE 1524 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1525 #ifdef FLIP_SIDED 1526 normal = - normal; 1527 #endif 1528 #ifdef DOUBLE_SIDED 1529 normal = normal * faceDirection; 1530 #endif 1531 normal = normalize( normalMatrix * normal ); 1532#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1533 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1534 mapN.xy *= normalScale; 1535 normal = normalize( tbn * mapN ); 1536#elif defined( USE_BUMPMAP )
1537 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1538#endif`,xd=`#ifndef FLAT_SHADED 1539 varying vec3 vNormal; 1540 #ifdef USE_TANGENT 1541 varying vec3 vTangent; 1542 varying vec3 vBitangent; 1543 #endif 1544#endif`,vd=`#ifndef FLAT_SHADED 1545 varying vec3 vNormal; 1546 #ifdef USE_TANGENT 1547 varying vec3 vTangent; 1548 varying vec3 vBitangent; 1549 #endif 1550#endif`,yd=`#ifndef FLAT_SHADED 1551 vNormal = normalize( transformedNormal ); 1552 #ifdef USE_TANGENT 1553 vTangent = normalize( transformedTangent ); 1554 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1555 #endif 1556#endif`,Md=`#ifdef USE_NORMALMAP 1557 uniform sampler2D normalMap; 1558 uniform vec2 normalScale; 1559#endif 1560#ifdef USE_NORMALMAP_OBJECTSPACE 1561 uniform mat3 normalMatrix; 1562#endif 1563#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1564 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1565 vec3 q0 = dFdx( eye_pos.xyz ); 1566 vec3 q1 = dFdy( eye_pos.xyz ); 1567 vec2 st0 = dFdx( uv.st ); 1568 vec2 st1 = dFdy( uv.st ); 1569 vec3 N = surf_norm; 1570 vec3 q1perp = cross( q1, N ); 1571 vec3 q0perp = cross( N, q0 ); 1572 vec3 T = q1perp * st0.x + q0perp * st1.x; 1573 vec3 B = q1perp * st0.y + q0perp * st1.y; 1574 float det = max( dot( T, T ), dot( B, B ) ); 1575 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1576 return mat3( T * scale, B * scale, N ); 1577 } 1578#endif`,Sd=`#ifdef USE_CLEARCOAT 1579 vec3 clearcoatNormal = nonPerturbedNormal; 1580#endif`,bd=`#ifdef USE_CLEARCOAT_NORMALMAP 1581 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1582 clearcoatMapN.xy *= clearcoatNormalScale; 1583 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1584#endif`,Ed=`#ifdef USE_CLEARCOATMAP 1585 uniform sampler2D clearcoatMap; 1586#endif 1587#ifdef USE_CLEARCOAT_NORMALMAP 1588 uniform sampler2D clearcoatNormalMap; 1589 uniform vec2 clearcoatNormalScale; 1590#endif 1591#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1592 uniform sampler2D clearcoatRoughnessMap; 1593#endif`,wd=`#ifdef USE_IRIDESCENCEMAP 1594 uniform sampler2D iridescenceMap; 1595#endif 1596#ifdef USE_IRIDESCENCE_THICKNESSMAP 1597 uniform sampler2D iridescenceThicknessMap; 1598#endif`,Td=`#ifdef OPAQUE 1599diffuseColor.a = 1.0; 1600#endif 1601#ifdef USE_TRANSMISSION 1602diffuseColor.a *= material.transmissionAlpha; 1603#endif 1604gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Ad=`vec3 packNormalToRGB( const in vec3 normal ) { 1605 return normalize( normal ) * 0.5 + 0.5; 1606} 1607vec3 unpackRGBToNormal( const in vec3 rgb ) { 1608 return 2.0 * rgb.xyz - 1.0; 1609} 1610const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1611const float Inv255 = 1. / 255.; 1612const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1613const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1614const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1615const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1616vec4 packDepthToRGBA( const in float v ) { 1617 if( v <= 0.0 ) 1618 return vec4( 0., 0., 0., 0. ); 1619 if( v >= 1.0 ) 1620 return vec4( 1., 1., 1., 1. ); 1621 float vuf; 1622 float af = modf( v * PackFactors.a, vuf ); 1623 float bf = modf( vuf * ShiftRight8, vuf ); 1624 float gf = modf( vuf * ShiftRight8, vuf ); 1625 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1626} 1627vec3 packDepthToRGB( const in float v ) { 1628 if( v <= 0.0 ) 1629 return vec3( 0., 0., 0. ); 1630 if( v >= 1.0 ) 1631 return vec3( 1., 1., 1. ); 1632 float vuf; 1633 float bf = modf( v * PackFactors.b, vuf ); 1634 float gf = modf( vuf * ShiftRight8, vuf ); 1635 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1636} 1637vec2 packDepthToRG( const in float v ) { 1638 if( v <= 0.0 ) 1639 return vec2( 0., 0. ); 1640 if( v >= 1.0 ) 1641 return vec2( 1., 1. ); 1642 float vuf; 1643 float gf = modf( v * 256., vuf ); 1644 return vec2( vuf * Inv255, gf ); 1645} 1646float unpackRGBAToDepth( const in vec4 v ) { 1647 return dot( v, UnpackFactors4 ); 1648} 1649float unpackRGBToDepth( const in vec3 v ) { 1650 return dot( v, UnpackFactors3 ); 1651} 1652float unpackRGToDepth( const in vec2 v ) { 1653 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1654} 1655vec4 pack2HalfToRGBA( const in vec2 v ) {
1656 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1657 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1658} 1659vec2 unpackRGBATo2Half( const in vec4 v ) { 1660 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1661} 1662float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1663 return ( viewZ + near ) / ( near - far ); 1664} 1665float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1666 return depth * ( near - far ) - near; 1667} 1668float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1669 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1670} 1671float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1672 return ( near * far ) / ( ( far - near ) * depth - far ); 1673}`,Cd=`#ifdef PREMULTIPLIED_ALPHA 1674 gl_FragColor.rgb *= gl_FragColor.a; 1675#endif`,Rd=`vec4 mvPosition = vec4( transformed, 1.0 ); 1676#ifdef USE_BATCHING 1677 mvPosition = batchingMatrix * mvPosition; 1678#endif 1679#ifdef USE_INSTANCING 1680 mvPosition = instanceMatrix * mvPosition; 1681#endif 1682mvPosition = modelViewMatrix * mvPosition; 1683gl_Position = projectionMatrix * mvPosition;`,Pd=`#ifdef DITHERING 1684 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1685#endif`,Id=`#ifdef DITHERING 1686 vec3 dithering( vec3 color ) { 1687 float grid_position = rand( gl_FragCoord.xy ); 1688 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1689 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1690 return color + dither_shift_RGB; 1691 } 1692#endif`,Ld=`float roughnessFactor = roughness; 1693#ifdef USE_ROUGHNESSMAP 1694 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1695 roughnessFactor *= texelRoughness.g; 1696#endif`,Dd=`#ifdef USE_ROUGHNESSMAP 1697 uniform sampler2D roughnessMap; 1698#endif`,Ud=
vendor: 8,887 bytes, lines 1698-1884
1698`#if NUM_SPOT_LIGHT_COORDS > 0 1699 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1700#endif 1701#if NUM_SPOT_LIGHT_MAPS > 0 1702 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1703#endif 1704#ifdef USE_SHADOWMAP 1705 #if NUM_DIR_LIGHT_SHADOWS > 0 1706 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1707 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1708 struct DirectionalLightShadow { 1709 float shadowIntensity; 1710 float shadowBias; 1711 float shadowNormalBias; 1712 float shadowRadius; 1713 vec2 shadowMapSize; 1714 }; 1715 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1716 #endif 1717 #if NUM_SPOT_LIGHT_SHADOWS > 0 1718 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1719 struct SpotLightShadow { 1720 float shadowIntensity; 1721 float shadowBias; 1722 float shadowNormalBias; 1723 float shadowRadius; 1724 vec2 shadowMapSize; 1725 }; 1726 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1727 #endif 1728 #if NUM_POINT_LIGHT_SHADOWS > 0 1729 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1730 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1731 struct PointLightShadow { 1732 float shadowIntensity; 1733 float shadowBias; 1734 float shadowNormalBias; 1735 float shadowRadius; 1736 vec2 shadowMapSize; 1737 float shadowCameraNear; 1738 float shadowCameraFar; 1739 }; 1740 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1741 #endif 1742 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1743 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1744 } 1745 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1746 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1747 } 1748 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1749 float occlusion = 1.0; 1750 vec2 distribution = texture2DDistribution( shadow, uv ); 1751 float hard_shadow = step( compare , distribution.x ); 1752 if (hard_shadow != 1.0 ) { 1753 float distance = compare - distribution.x ; 1754 float variance = max( 0.00000, distribution.y * distribution.y ); 1755 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1756 } 1757 return occlusion; 1758 } 1759 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1760 float shadow = 1.0; 1761 shadowCoord.xyz /= shadowCoord.w; 1762 shadowCoord.z += shadowBias; 1763 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1764 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1765 if ( frustumTest ) { 1766 #if defined( SHADOWMAP_TYPE_PCF ) 1767 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1768 float dx0 = - texelSize.x * shadowRadius; 1769 float dy0 = - texelSize.y * shadowRadius; 1770 float dx1 = + texelSize.x * shadowRadius; 1771 float dy1 = + texelSize.y * shadowRadius; 1772 float dx2 = dx0 / 2.0; 1773 float dy2 = dy0 / 2.0; 1774 float dx3 = dx1 / 2.0; 1775 float dy3 = dy1 / 2.0; 1776 shadow = ( 1777 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1791 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1792 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1793 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1794 ) * ( 1.0 / 17.0 ); 1795 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1796 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1797 float dx = texelSize.x; 1798 float dy = texelSize.y; 1799 vec2 uv = shadowCoord.xy; 1800 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1801 uv -= f * texelSize; 1802 shadow = ( 1803 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1804 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1805 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1806 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1807 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1808 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1809 f.x ) + 1810 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1811 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1812 f.x ) + 1813 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1814 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1815 f.y ) + 1816 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1817 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1818 f.y ) + 1819 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1820 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1821 f.x ), 1822 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1823 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1824 f.x ), 1825 f.y ) 1826 ) * ( 1.0 / 9.0 ); 1827 #elif defined( SHADOWMAP_TYPE_VSM ) 1828 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1829 #else 1830 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1831 #endif 1832 } 1833 return mix( 1.0, shadow, shadowIntensity ); 1834 } 1835 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1836 vec3 absV = abs( v ); 1837 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1838 absV *= scaleToCube; 1839 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1840 vec2 planar = v.xy; 1841 float almostATexel = 1.5 * texelSizeY; 1842 float almostOne = 1.0 - almostATexel; 1843 if ( absV.z >= almostOne ) { 1844 if ( v.z > 0.0 ) 1845 planar.x = 4.0 - v.x; 1846 } else if ( absV.x >= almostOne ) { 1847 float signX = sign( v.x ); 1848 planar.x = v.z * signX + 2.0 * signX; 1849 } else if ( absV.y >= almostOne ) { 1850 float signY = sign( v.y ); 1851 planar.x = v.x + 2.0 * signY + 2.0; 1852 planar.y = v.z * signY - 2.0; 1853 } 1854 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1855 } 1856 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1857 float shadow = 1.0; 1858 vec3 lightToPosition = shadowCoord.xyz; 1859 1860 float lightToPositionLength = length( lightToPosition ); 1861 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1862 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1863 vec3 bd3D = normalize( lightToPosition ); 1864 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1865 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1866 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1867 shadow = ( 1868 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1869 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1870 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1871 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1872 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1874 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1875 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1876 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1877 ) * ( 1.0 / 9.0 ); 1878 #else 1879 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1880 #endif 1881 } 1882 return mix( 1.0, shadow, shadowIntensity ); 1883 } 1884#endif`,
1884Nd=`#if NUM_SPOT_LIGHT_COORDS > 0 1885 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1886 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1887#endif 1888#ifdef USE_SHADOWMAP 1889 #if NUM_DIR_LIGHT_SHADOWS > 0 1890 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1891 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1892 struct DirectionalLightShadow { 1893 float shadowIntensity; 1894 float shadowBias; 1895 float shadowNormalBias; 1896 float shadowRadius; 1897 vec2 shadowMapSize; 1898 }; 1899 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1900 #endif 1901 #if NUM_SPOT_LIGHT_SHADOWS > 0 1902 struct SpotLightShadow { 1903 float shadowIntensity; 1904 float shadowBias; 1905 float shadowNormalBias; 1906 float shadowRadius; 1907 vec2 shadowMapSize; 1908 }; 1909 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1910 #endif 1911 #if NUM_POINT_LIGHT_SHADOWS > 0 1912 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1913 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1914 struct PointLightShadow { 1915 float shadowIntensity; 1916 float shadowBias; 1917 float shadowNormalBias; 1918 float shadowRadius; 1919 vec2 shadowMapSize; 1920 float shadowCameraNear; 1921 float shadowCameraFar; 1922 }; 1923 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1924 #endif 1925#endif`,Od=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1926 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1927 vec4 shadowWorldPosition; 1928#endif 1929#if defined( USE_SHADOWMAP ) 1930 #if NUM_DIR_LIGHT_SHADOWS > 0 1931 #pragma unroll_loop_start 1932 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1933 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1934 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1935 } 1936 #pragma unroll_loop_end 1937 #endif 1938 #if NUM_POINT_LIGHT_SHADOWS > 0 1939 #pragma unroll_loop_start 1940 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1941 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1942 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1943 } 1944 #pragma unroll_loop_end 1945 #endif 1946#endif 1947#if NUM_SPOT_LIGHT_COORDS > 0 1948 #pragma unroll_loop_start 1949 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1950 shadowWorldPosition = worldPosition; 1951 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1952 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1953 #endif 1954 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1955 } 1956 #pragma unroll_loop_end 1957#endif`,Fd=`float getShadowMask() { 1958 float shadow = 1.0; 1959 #ifdef USE_SHADOWMAP 1960 #if NUM_DIR_LIGHT_SHADOWS > 0 1961 DirectionalLightShadow directionalLight; 1962 #pragma unroll_loop_start 1963 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1964 directionalLight = directionalLightShadows[ i ]; 1965 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1966 } 1967 #pragma unroll_loop_end 1968 #endif 1969 #if NUM_SPOT_LIGHT_SHADOWS > 0 1970 SpotLightShadow spotLight; 1971 #pragma unroll_loop_start 1972 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1973 spotLight = spotLightShadows[ i ]; 1974 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1975 } 1976 #pragma unroll_loop_end 1977 #endif 1978 #if NUM_POINT_LIGHT_SHADOWS > 0 1979 PointLightShadow pointLight; 1980 #pragma unroll_loop_start 1981 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1982 pointLight = pointLightShadows[ i ]; 1983 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1984 } 1985 #pragma unroll_loop_end 1986 #endif 1987 #endif 1988 return shadow; 1989}`,Bd=`#ifdef USE_SKINNING 1990 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1991 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1992 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1993 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1994#endif`,zd=`#ifdef USE_SKINNING 1995 uniform mat4 bindMatrix; 1996 uniform mat4 bindMatrixInverse; 1997 uniform highp sampler2D boneTexture; 1998 mat4 getBoneMatrix( const in float i ) { 1999 int size = textureSize( boneTexture, 0 ).x; 2000 int j = int( i ) * 4; 2001 int x = j % size; 2002 int y = j / size; 2003 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2004 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2005 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2006 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2007 return mat4( v1, v2, v3, v4 ); 2008 } 2009#endif`,kd=`#ifdef USE_SKINNING 2010 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2011 vec4 skinned = vec4( 0.0 ); 2012 skinned += boneMatX * skinVertex * skinWeight.x; 2013 skinned += boneMatY * skinVertex * skinWeight.y; 2014 skinned += boneMatZ * skinVertex * skinWeight.z; 2015 skinned += boneMatW * skinVertex * skinWeight.w; 2016 transformed = ( bindMatrixInverse * skinned ).xyz; 2017#endif`,Vd=`#ifdef USE_SKINNING 2018 mat4 skinMatrix = mat4( 0.0 ); 2019 skinMatrix += skinWeight.x * boneMatX; 2020 skinMatrix += skinWeight.y * boneMatY; 2021 skinMatrix += skinWeight.z * boneMatZ; 2022 skinMatrix += skinWeight.w * boneMatW; 2023 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2024 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2025 #ifdef USE_TANGENT 2026 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2027 #endif 2028#endif`,Hd=`float specularStrength; 2029#ifdef USE_SPECULARMAP 2030 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2031 specularStrength = texelSpecular.r; 2032#else 2033 specularStrength = 1.0; 2034#endif`,Gd=`#ifdef USE_SPECULARMAP 2035 uniform sampler2D specularMap; 2036#endif`,Wd=`#if defined( TONE_MAPPING ) 2037 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2038#endif`,Xd=`#ifndef saturate 2039#define saturate( a ) clamp( a, 0.0, 1.0 ) 2040#endif 2041uniform float toneMappingExposure; 2042vec3 LinearToneMapping( vec3 color ) { 2043 return saturate( toneMappingExposure * color ); 2044} 2045vec3 ReinhardToneMapping( vec3 color ) { 2046 color *= toneMappingExposure; 2047 return saturate( color / ( vec3( 1.0 ) + color ) ); 2048} 2049vec3 OptimizedCineonToneMapping( vec3 color ) { 2050 color *= toneMappingExposure; 2051 color = max( vec3( 0.0 ), color - 0.004 ); 2052 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2053} 2054vec3 RRTAndODTFit( vec3 v ) { 2055 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2056 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2057 return a / b; 2058} 2059vec3 ACESFilmicToneMapping( vec3 color ) { 2060 const mat3 ACESInputMat = mat3( 2061 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2062 vec3( 0.04823, 0.01566, 0.83777 ) 2063 ); 2064 const mat3 ACESOutputMat = mat3( 2065 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2066 vec3( -0.07367, -0.00605, 1.07602 ) 2067 ); 2068 color *= toneMappingExposure / 0.6; 2069 color = ACESInputMat * color; 2070 color = RRTAndODTFit( color ); 2071 color = ACESOutputMat * color; 2072 return saturate( color ); 2073} 2074const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2075 vec3( 1.6605, - 0.1246, - 0.0182 ), 2076 vec3( - 0.5876, 1.1329, - 0.1006 ), 2077 vec3( - 0.0728, - 0.0083, 1.1187 ) 2078); 2079const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2080 vec3( 0.6274, 0.0691, 0.0164 ), 2081 vec3( 0.3293, 0.9195, 0.0880 ), 2082 vec3( 0.0433, 0.0113, 0.8956 ) 2083); 2084vec3 agxDefaultContrastApprox( vec3 x ) { 2085 vec3 x2 = x * x; 2086 vec3 x4 = x2 * x2; 2087 return + 15.5 * x4 * x2 2088 - 40.14 * x4 * x 2089 + 31.96 * x4 2090 - 6.868 * x2 * x 2091 + 0.4298 * x2 2092 + 0.1191 * x 2093 - 0.00232; 2094} 2095vec3 AgXToneMapping( vec3 color ) { 2096 const mat3 AgXInsetMatrix = mat3( 2097 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2098 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2099 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2100 );
2101 const mat3 AgXOutsetMatrix = mat3( 2102 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2103 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2104 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2105 ); 2106 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2107 color *= toneMappingExposure; 2108 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2109 color = AgXInsetMatrix * color; 2110 color = max( color, 1e-10 ); color = log2( color ); 2111 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2112 color = clamp( color, 0.0, 1.0 ); 2113 color = agxDefaultContrastApprox( color ); 2114 color = AgXOutsetMatrix * color; 2115 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2116 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2117 color = clamp( color, 0.0, 1.0 ); 2118 return color; 2119} 2120vec3 NeutralToneMapping( vec3 color ) { 2121 const float StartCompression = 0.8 - 0.04; 2122 const float Desaturation = 0.15; 2123 color *= toneMappingExposure; 2124 float x = min( color.r, min( color.g, color.b ) ); 2125 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2126 color -= offset; 2127 float peak = max( color.r, max( color.g, color.b ) ); 2128 if ( peak < StartCompression ) return color; 2129 float d = 1. - StartCompression; 2130 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2131 color *= newPeak / peak; 2132 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2133 return mix( color, vec3( newPeak ), g ); 2134} 2135vec3 CustomToneMapping( vec3 color ) { return color; }`,Yd=`#ifdef USE_TRANSMISSION 2136 material.transmission = transmission; 2137 material.transmissionAlpha = 1.0; 2138 material.thickness = thickness; 2139 material.attenuationDistance = attenuationDistance; 2140 material.attenuationColor = attenuationColor; 2141 #ifdef USE_TRANSMISSIONMAP 2142 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2143 #endif 2144 #ifdef USE_THICKNESSMAP 2145 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2146 #endif 2147 vec3 pos = vWorldPosition; 2148 vec3 v = normalize( cameraPosition - pos ); 2149 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2150 vec4 transmitted = getIBLVolumeRefraction( 2151 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2152 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2153 material.attenuationColor, material.attenuationDistance ); 2154 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2155 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2156#endif`,qd=`#ifdef USE_TRANSMISSION 2157 uniform float transmission; 2158 uniform float thickness; 2159 uniform float attenuationDistance; 2160 uniform vec3 attenuationColor; 2161 #ifdef USE_TRANSMISSIONMAP 2162 uniform sampler2D transmissionMap; 2163 #endif 2164 #ifdef USE_THICKNESSMAP 2165 uniform sampler2D thicknessMap; 2166 #endif 2167 uniform vec2 transmissionSamplerSize; 2168 uniform sampler2D transmissionSamplerMap; 2169 uniform mat4 modelMatrix; 2170 uniform mat4 projectionMatrix; 2171 varying vec3 vWorldPosition; 2172 float w0( float a ) { 2173 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2174 } 2175 float w1( float a ) { 2176 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2177 } 2178 float w2( float a ){ 2179 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2180 } 2181 float w3( float a ) { 2182 return ( 1.0 / 6.0 ) * ( a * a * a ); 2183 } 2184 float g0( float a ) { 2185 return w0( a ) + w1( a ); 2186 } 2187 float g1( float a ) { 2188 return w2( a ) + w3( a ); 2189 } 2190 float h0( float a ) { 2191 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2192 } 2193 float h1( float a ) { 2194 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2195 } 2196 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2197 uv = uv * texelSize.zw + 0.5; 2198 vec2 iuv = floor( uv ); 2199 vec2 fuv = fract( uv ); 2200 float g0x = g0( fuv.x ); 2201 float g1x = g1( fuv.x ); 2202 float h0x = h0( fuv.x ); 2203 float h1x = h1( fuv.x ); 2204 float h0y = h0( fuv.y ); 2205 float h1y = h1( fuv.y ); 2206 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2207 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2208 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2209 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2210 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2211 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2212 } 2213 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2214 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2215 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2216 vec2 fLodSizeInv = 1.0 / fLodSize; 2217 vec2 cLodSizeInv = 1.0 / cLodSize; 2218 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2219 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2220 return mix( fSample, cSample, fract( lod ) ); 2221 } 2222 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2223 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2224 vec3 modelScale; 2225 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2226 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2227 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2228 return normalize( refractionVector ) * thickness * modelScale; 2229 } 2230 float applyIorToRoughness( const in float roughness, const in float ior ) { 2231 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2232 } 2233 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2234 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2235 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2236 } 2237 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2238 if ( isinf( attenuationDistance ) ) { 2239 return vec3( 1.0 ); 2240 } else { 2241 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2242 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2243 } 2244 } 2245 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2246 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2247 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2248 const in vec3 attenuationColor, const in float attenuationDistance ) { 2249 vec4 transmittedLight; 2250 vec3 transmittance; 2251 #ifdef USE_DISPERSION 2252 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2253 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2254 for ( int i = 0; i < 3; i ++ ) { 2255 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2256 vec3 refractedRayExit = position + transmissionRay; 2257 2258 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2259 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2260 refractionCoords += 1.0; 2261 refractionCoords /= 2.0; 2262 2263 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2264 transmittedLight[ i ] = transmissionSample[ i ]; 2265 transmittedLight.a += transmissionSample.a; 2266 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2267 } 2268 transmittedLight.a /= 3.0; 2269 2270 #else 2271 2272 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2273 vec3 refractedRayExit = position + transmissionRay; 2274 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2275 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2276 refractionCoords += 1.0; 2277 refractionCoords /= 2.0; 2278 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2279 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2280 2281 #endif 2282 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2283 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2284 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2285 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2286 } 2287#endif`,Zd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2288 varying vec2 vUv; 2289#endif 2290#ifdef USE_MAP 2291 varying vec2 vMapUv; 2292#endif 2293#ifdef USE_ALPHAMAP
2294 varying vec2 vAlphaMapUv; 2295#endif 2296#ifdef USE_LIGHTMAP 2297 varying vec2 vLightMapUv; 2298#endif 2299#ifdef USE_AOMAP 2300 varying vec2 vAoMapUv; 2301#endif 2302#ifdef USE_BUMPMAP 2303 varying vec2 vBumpMapUv; 2304#endif 2305#ifdef USE_NORMALMAP 2306 varying vec2 vNormalMapUv; 2307#endif 2308#ifdef USE_EMISSIVEMAP 2309 varying vec2 vEmissiveMapUv; 2310#endif 2311#ifdef USE_METALNESSMAP 2312 varying vec2 vMetalnessMapUv; 2313#endif 2314#ifdef USE_ROUGHNESSMAP 2315 varying vec2 vRoughnessMapUv; 2316#endif 2317#ifdef USE_ANISOTROPYMAP 2318 varying vec2 vAnisotropyMapUv; 2319#endif 2320#ifdef USE_CLEARCOATMAP 2321 varying vec2 vClearcoatMapUv; 2322#endif 2323#ifdef USE_CLEARCOAT_NORMALMAP 2324 varying vec2 vClearcoatNormalMapUv; 2325#endif 2326#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2327 varying vec2 vClearcoatRoughnessMapUv; 2328#endif 2329#ifdef USE_IRIDESCENCEMAP 2330 varying vec2 vIridescenceMapUv; 2331#endif 2332#ifdef USE_IRIDESCENCE_THICKNESSMAP 2333 varying vec2 vIridescenceThicknessMapUv; 2334#endif 2335#ifdef USE_SHEEN_COLORMAP 2336 varying vec2 vSheenColorMapUv; 2337#endif 2338#ifdef USE_SHEEN_ROUGHNESSMAP 2339 varying vec2 vSheenRoughnessMapUv; 2340#endif 2341#ifdef USE_SPECULARMAP 2342 varying vec2 vSpecularMapUv; 2343#endif 2344#ifdef USE_SPECULAR_COLORMAP 2345 varying vec2 vSpecularColorMapUv; 2346#endif 2347#ifdef USE_SPECULAR_INTENSITYMAP 2348 varying vec2 vSpecularIntensityMapUv; 2349#endif 2350#ifdef USE_TRANSMISSIONMAP 2351 uniform mat3 transmissionMapTransform; 2352 varying vec2 vTransmissionMapUv; 2353#endif 2354#ifdef USE_THICKNESSMAP 2355 uniform mat3 thicknessMapTransform; 2356 varying vec2 vThicknessMapUv; 2357#endif`,Jd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2358 varying vec2 vUv; 2359#endif 2360#ifdef USE_MAP 2361 uniform mat3 mapTransform; 2362 varying vec2 vMapUv; 2363#endif 2364#ifdef USE_ALPHAMAP 2365 uniform mat3 alphaMapTransform; 2366 varying vec2 vAlphaMapUv; 2367#endif 2368#ifdef USE_LIGHTMAP 2369 uniform mat3 lightMapTransform; 2370 varying vec2 vLightMapUv; 2371#endif 2372#ifdef USE_AOMAP 2373 uniform mat3 aoMapTransform; 2374 varying vec2 vAoMapUv; 2375#endif 2376#ifdef USE_BUMPMAP 2377 uniform mat3 bumpMapTransform; 2378 varying vec2 vBumpMapUv; 2379#endif 2380#ifdef USE_NORMALMAP 2381 uniform mat3 normalMapTransform; 2382 varying vec2 vNormalMapUv; 2383#endif 2384#ifdef USE_DISPLACEMENTMAP 2385 uniform mat3 displacementMapTransform; 2386 varying vec2 vDisplacementMapUv; 2387#endif 2388#ifdef USE_EMISSIVEMAP 2389 uniform mat3 emissiveMapTransform; 2390 varying vec2 vEmissiveMapUv; 2391#endif 2392#ifdef USE_METALNESSMAP 2393 uniform mat3 metalnessMapTransform; 2394 varying vec2 vMetalnessMapUv; 2395#endif 2396#ifdef USE_ROUGHNESSMAP 2397 uniform mat3 roughnessMapTransform; 2398 varying vec2 vRoughnessMapUv; 2399#endif 2400#ifdef USE_ANISOTROPYMAP 2401 uniform mat3 anisotropyMapTransform; 2402 varying vec2 vAnisotropyMapUv; 2403#endif 2404#ifdef USE_CLEARCOATMAP 2405 uniform mat3 clearcoatMapTransform; 2406 varying vec2 vClearcoatMapUv; 2407#endif 2408#ifdef USE_CLEARCOAT_NORMALMAP 2409 uniform mat3 clearcoatNormalMapTransform; 2410 varying vec2 vClearcoatNormalMapUv; 2411#endif 2412#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2413 uniform mat3 clearcoatRoughnessMapTransform; 2414 varying vec2 vClearcoatRoughnessMapUv; 2415#endif 2416#ifdef USE_SHEEN_COLORMAP 2417 uniform mat3 sheenColorMapTransform; 2418 varying vec2 vSheenColorMapUv; 2419#endif 2420#ifdef USE_SHEEN_ROUGHNESSMAP 2421 uniform mat3 sheenRoughnessMapTransform; 2422 varying vec2 vSheenRoughnessMapUv; 2423#endif 2424#ifdef USE_IRIDESCENCEMAP 2425 uniform mat3 iridescenceMapTransform; 2426 varying vec2 vIridescenceMapUv; 2427#endif 2428#ifdef USE_IRIDESCENCE_THICKNESSMAP 2429 uniform mat3 iridescenceThicknessMapTransform; 2430 varying vec2 vIridescenceThicknessMapUv; 2431#endif 2432#ifdef USE_SPECULARMAP 2433 uniform mat3 specularMapTransform; 2434 varying vec2 vSpecularMapUv; 2435#endif 2436#ifdef USE_SPECULAR_COLORMAP 2437 uniform mat3 specularColorMapTransform; 2438 varying vec2 vSpecularColorMapUv; 2439#endif 2440#ifdef USE_SPECULAR_INTENSITYMAP 2441 uniform mat3 specularIntensityMapTransform; 2442 varying vec2 vSpecularIntensityMapUv; 2443#endif 2444#ifdef USE_TRANSMISSIONMAP 2445 uniform mat3 transmissionMapTransform; 2446 varying vec2 vTransmissionMapUv; 2447#endif 2448#ifdef USE_THICKNESSMAP 2449 uniform mat3 thicknessMapTransform; 2450 varying vec2 vThicknessMapUv; 2451#endif`,Kd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2452 vUv = vec3( uv, 1 ).xy; 2453#endif 2454#ifdef USE_MAP 2455 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2456#endif 2457#ifdef USE_ALPHAMAP 2458 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2459#endif 2460#ifdef USE_LIGHTMAP 2461 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2462#endif 2463#ifdef USE_AOMAP 2464 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2465#endif 2466#ifdef USE_BUMPMAP 2467 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2468#endif 2469#ifdef USE_NORMALMAP 2470 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2471#endif 2472#ifdef USE_DISPLACEMENTMAP 2473 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2474#endif 2475#ifdef USE_EMISSIVEMAP 2476 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2477#endif 2478#ifdef USE_METALNESSMAP 2479 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2480#endif 2481#ifdef USE_ROUGHNESSMAP 2482 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2483#endif 2484#ifdef USE_ANISOTROPYMAP 2485 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2486#endif 2487#ifdef USE_CLEARCOATMAP 2488 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2489#endif 2490#ifdef USE_CLEARCOAT_NORMALMAP 2491 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2492#endif 2493#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2494 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2495#endif
2496#ifdef USE_IRIDESCENCEMAP 2497 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2498#endif 2499#ifdef USE_IRIDESCENCE_THICKNESSMAP 2500 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2501#endif 2502#ifdef USE_SHEEN_COLORMAP 2503 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2504#endif 2505#ifdef USE_SHEEN_ROUGHNESSMAP 2506 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2507#endif 2508#ifdef USE_SPECULARMAP 2509 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2510#endif 2511#ifdef USE_SPECULAR_COLORMAP 2512 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2513#endif 2514#ifdef USE_SPECULAR_INTENSITYMAP 2515 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2516#endif 2517#ifdef USE_TRANSMISSIONMAP 2518 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2519#endif 2520#ifdef USE_THICKNESSMAP 2521 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2522#endif`,$d=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2523 vec4 worldPosition = vec4( transformed, 1.0 ); 2524 #ifdef USE_BATCHING 2525 worldPosition = batchingMatrix * worldPosition; 2526 #endif 2527 #ifdef USE_INSTANCING 2528 worldPosition = instanceMatrix * worldPosition; 2529 #endif 2530 worldPosition = modelMatrix * worldPosition; 2531#endif`,jd=`varying vec2 vUv; 2532uniform mat3 uvTransform; 2533void main() { 2534 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2535 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2536}`,Qd=`uniform sampler2D t2D; 2537uniform float backgroundIntensity; 2538varying vec2 vUv; 2539void main() { 2540 vec4 texColor = texture2D( t2D, vUv ); 2541 #ifdef DECODE_VIDEO_TEXTURE 2542 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 ); 2543 #endif 2544 texColor.rgb *= backgroundIntensity; 2545 gl_FragColor = texColor; 2546 #include <tonemapping_fragment> 2547 #include <colorspace_fragment> 2548}`,tf=`varying vec3 vWorldDirection; 2549#include <common> 2550void main() { 2551 vWorldDirection = transformDirection( position, modelMatrix ); 2552 #include <begin_vertex> 2553 #include <project_vertex> 2554 gl_Position.z = gl_Position.w; 2555}`,ef=`#ifdef ENVMAP_TYPE_CUBE 2556 uniform samplerCube envMap; 2557#elif defined( ENVMAP_TYPE_CUBE_UV ) 2558 uniform sampler2D envMap; 2559#endif 2560uniform float flipEnvMap; 2561uniform float backgroundBlurriness; 2562uniform float backgroundIntensity; 2563uniform mat3 backgroundRotation; 2564varying vec3 vWorldDirection; 2565#include <cube_uv_reflection_fragment> 2566void main() { 2567 #ifdef ENVMAP_TYPE_CUBE 2568 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2569 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2570 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2571 #else 2572 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2573 #endif 2574 texColor.rgb *= backgroundIntensity; 2575 gl_FragColor = texColor; 2576 #include <tonemapping_fragment> 2577 #include <colorspace_fragment> 2578}`,nf=`varying vec3 vWorldDirection; 2579#include <common> 2580void main() { 2581 vWorldDirection = transformDirection( position, modelMatrix ); 2582 #include <begin_vertex> 2583 #include <project_vertex> 2584 gl_Position.z = gl_Position.w; 2585}`,sf=`uniform samplerCube tCube; 2586uniform float tFlip; 2587uniform float opacity; 2588varying vec3 vWorldDirection; 2589void main() { 2590 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2591 gl_FragColor = texColor; 2592 gl_FragColor.a *= opacity; 2593 #include <tonemapping_fragment> 2594 #include <colorspace_fragment> 2595}`,rf=`#include <common> 2596#include <batching_pars_vertex> 2597#include <uv_pars_vertex> 2598#include <displacementmap_pars_vertex> 2599#include <morphtarget_pars_vertex> 2600#include <skinning_pars_vertex> 2601#include <logdepthbuf_pars_vertex> 2602#include <clipping_planes_pars_vertex> 2603varying vec2 vHighPrecisionZW; 2604void main() { 2605 #include <uv_vertex> 2606 #include <batching_vertex> 2607 #include <skinbase_vertex> 2608 #include <morphinstance_vertex> 2609 #ifdef USE_DISPLACEMENTMAP 2610 #include <beginnormal_vertex> 2611 #include <morphnormal_vertex> 2612 #include <skinnormal_vertex> 2613 #endif 2614 #include <begin_vertex> 2615 #include <morphtarget_vertex> 2616 #include <skinning_vertex> 2617 #include <displacementmap_vertex> 2618 #include <project_vertex> 2619 #include <logdepthbuf_vertex> 2620 #include <clipping_planes_vertex> 2621 vHighPrecisionZW = gl_Position.zw; 2622}`,af=`#if DEPTH_PACKING == 3200 2623 uniform float opacity; 2624#endif 2625#include <common> 2626#include <packing> 2627#include <uv_pars_fragment> 2628#include <map_pars_fragment> 2629#include <alphamap_pars_fragment> 2630#include <alphatest_pars_fragment> 2631#include <alphahash_pars_fragment> 2632#include <logdepthbuf_pars_fragment> 2633#include <clipping_planes_pars_fragment> 2634varying vec2 vHighPrecisionZW; 2635void main() { 2636 vec4 diffuseColor = vec4( 1.0 ); 2637 #include <clipping_planes_fragment> 2638 #if DEPTH_PACKING == 3200 2639 diffuseColor.a = opacity; 2640 #endif 2641 #include <map_fragment> 2642 #include <alphamap_fragment> 2643 #include <alphatest_fragment> 2644 #include <alphahash_fragment> 2645 #include <logdepthbuf_fragment> 2646 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2647 #if DEPTH_PACKING == 3200 2648 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2649 #elif DEPTH_PACKING == 3201 2650 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2651 #elif DEPTH_PACKING == 3202 2652 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2653 #elif DEPTH_PACKING == 3203 2654 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2655 #endif 2656}`,of=`#define DISTANCE 2657varying vec3 vWorldPosition; 2658#include <common> 2659#include <batching_pars_vertex> 2660#include <uv_pars_vertex> 2661#include <displacementmap_pars_vertex> 2662#include <morphtarget_pars_vertex> 2663#include <skinning_pars_vertex> 2664#include <clipping_planes_pars_vertex> 2665void main() { 2666 #include <uv_vertex> 2667 #include <batching_vertex> 2668 #include <skinbase_vertex> 2669 #include <morphinstance_vertex> 2670 #ifdef USE_DISPLACEMENTMAP 2671 #include <beginnormal_vertex> 2672 #include <morphnormal_vertex> 2673 #include <skinnormal_vertex> 2674 #endif 2675 #include <begin_vertex> 2676 #include <morphtarget_vertex> 2677 #include <skinning_vertex> 2678 #include <displacementmap_vertex> 2679 #include <project_vertex> 2680 #include <worldpos_vertex> 2681 #include <clipping_planes_vertex> 2682 vWorldPosition = worldPosition.xyz; 2683}`,cf=`#define DISTANCE 2684uniform vec3 referencePosition; 2685uniform float nearDistance; 2686uniform float farDistance; 2687varying vec3 vWorldPosition; 2688#include <common> 2689#include <packing> 2690#include <uv_pars_fragment> 2691#include <map_pars_fragment> 2692#include <alphamap_pars_fragment> 2693#include <alphatest_pars_fragment> 2694#include <alphahash_pars_fragment> 2695#include <clipping_planes_pars_fragment> 2696void main () { 2697 vec4 diffuseColor = vec4( 1.0 ); 2698 #include <clipping_planes_fragment> 2699 #include <map_fragment> 2700 #include <alphamap_fragment> 2701 #include <alphatest_fragment> 2702 #include <alphahash_fragment> 2703 float dist = length( vWorldPosition - referencePosition ); 2704 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2705 dist = saturate( dist ); 2706 gl_FragColor = packDepthToRGBA( dist ); 2707}`,lf=`varying vec3 vWorldDirection; 2708#include <common> 2709void main() { 2710 vWorldDirection = transformDirection( position, modelMatrix ); 2711 #include <begin_vertex> 2712 #include <project_vertex> 2713}`,hf=`uniform sampler2D tEquirect; 2714varying vec3 vWorldDirection; 2715#include <common> 2716void main() { 2717 vec3 direction = normalize( vWorldDirection ); 2718 vec2 sampleUV = equirectUv( direction ); 2719 gl_FragColor = texture2D( tEquirect, sampleUV ); 2720 #include <tonemapping_fragment> 2721 #include <colorspace_fragment> 2722}`,uf=`uniform float scale; 2723attribute float lineDistance; 2724varying float vLineDistance; 2725#include <common> 2726#include <uv_pars_vertex> 2727#include <color_pars_vertex> 2728#include <fog_pars_vertex> 2729#include <morphtarget_pars_vertex> 2730#include <logdepthbuf_pars_vertex> 2731#include <clipping_planes_pars_vertex> 2732void main() { 2733 vLineDistance = scale * lineDistance; 2734 #include <uv_vertex> 2735 #include <color_vertex> 2736 #include <morphinstance_vertex> 2737 #include <morphcolor_vertex> 2738 #include <begin_vertex> 2739 #include <morphtarget_vertex> 2740 #include <project_vertex> 2741 #include <logdepthbuf_vertex> 2742 #include <clipping_planes_vertex> 2743 #include <fog_vertex> 2744}`,df=`uniform vec3 diffuse; 2745uniform float opacity; 2746uniform float dashSize; 2747uniform float totalSize; 2748varying float vLineDistance; 2749#include <common> 2750#include <color_pars_fragment> 2751#include <uv_pars_fragment> 2752#include <map_pars_fragment> 2753#include <fog_pars_fragment> 2754#include <logdepthbuf_pars_fragment> 2755#include <clipping_planes_pars_fragment> 2756void main() { 2757 vec4 diffuseColor = vec4( diffuse, opacity ); 2758 #include <clipping_planes_fragment> 2759 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2760 discard; 2761 } 2762 vec3 outgoingLight = vec3( 0.0 ); 2763 #include <logdepthbuf_fragment> 2764 #include <map_fragment> 2765 #include <color_fragment> 2766 outgoingLight = diffuseColor.rgb; 2767 #include <opaque_fragment> 2768 #include <tonemapping_fragment> 2769 #include <colorspace_fragment> 2770 #include <fog_fragment> 2771 #include <premultiplied_alpha_fragment> 2772}`,ff=`#include <common> 2773#include <batching_pars_vertex> 2774#include <uv_pars_vertex> 2775#include <envmap_pars_vertex> 2776#include <color_pars_vertex> 2777#include <fog_pars_vertex> 2778#include <morphtarget_pars_vertex> 2779#include <skinning_pars_vertex> 2780#include <logdepthbuf_pars_vertex> 2781#include <clipping_planes_pars_vertex> 2782void main() { 2783 #include <uv_vertex> 2784 #include <color_vertex> 2785 #include <morphinstance_vertex> 2786 #include <morphcolor_vertex> 2787 #include <batching_vertex> 2788 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2789 #include <beginnormal_vertex> 2790 #include <morphnormal_vertex> 2791 #include <skinbase_vertex> 2792 #include <skinnormal_vertex> 2793 #include <defaultnormal_vertex> 2794 #endif 2795 #include <begin_vertex> 2796 #include <morphtarget_vertex> 2797 #include <skinning_vertex> 2798 #include <project_vertex> 2799 #include <logdepthbuf_vertex> 2800 #include <clipping_planes_vertex> 2801 #include <worldpos_vertex> 2802 #include <envmap_vertex> 2803 #include <fog_vertex> 2804}`,pf=`uniform vec3 diffuse; 2805uniform float opacity; 2806#ifndef FLAT_SHADED 2807 varying vec3 vNormal; 2808#endif 2809#include <common> 2810#include <dithering_pars_fragment> 2811#include <color_pars_fragment> 2812#include <uv_pars_fragment> 2813#include <map_pars_fragment> 2814#include <alphamap_pars_fragment> 2815#include <alphatest_pars_fragment> 2816#include <alphahash_pars_fragment> 2817#include <aomap_pars_fragment> 2818#include <lightmap_pars_fragment> 2819#include <envmap_common_pars_fragment> 2820#include <envmap_pars_fragment> 2821#include <fog_pars_fragment> 2822#include <specularmap_pars_fragment> 2823#include <logdepthbuf_pars_fragment> 2824#include <clipping_planes_pars_fragment> 2825void main() { 2826 vec4 diffuseColor = vec4( diffuse, opacity ); 2827 #include <clipping_planes_fragment> 2828 #include <logdepthbuf_fragment> 2829 #include <map_fragment> 2830 #include <color_fragment> 2831 #include <alphamap_fragment> 2832 #include <alphatest_fragment> 2833 #include <alphahash_fragment> 2834 #include <specularmap_fragment> 2835 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2836 #ifdef USE_LIGHTMAP 2837 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2838 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2839 #else 2840 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2841 #endif 2842 #include <aomap_fragment> 2843 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2844 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2845 #include <envmap_fragment> 2846 #include <opaque_fragment> 2847 #include <tonemapping_fragment> 2848 #include <colorspace_fragment> 2849 #include <fog_fragment> 2850 #include <premultiplied_alpha_fragment> 2851 #include <dithering_fragment> 2852}`,mf=`#define LAMBERT 2853varying vec3 vViewPosition; 2854#include <common> 2855#include <batching_pars_vertex> 2856#include <uv_pars_vertex> 2857#include <displacementmap_pars_vertex> 2858#include <envmap_pars_vertex> 2859#include <color_pars_vertex> 2860#include <fog_pars_vertex> 2861#include <normal_pars_vertex> 2862#include <morphtarget_pars_vertex> 2863#include <skinning_pars_vertex> 2864#include <shadowmap_pars_vertex> 2865#include <logdepthbuf_pars_vertex> 2866#include <clipping_planes_pars_vertex> 2867void main() { 2868 #include <uv_vertex> 2869 #include <color_vertex> 2870 #include <morphinstance_vertex> 2871 #include <morphcolor_vertex> 2872 #include <batching_vertex> 2873 #include <beginnormal_vertex> 2874 #include <morphnormal_vertex> 2875 #include <skinbase_vertex> 2876 #include <skinnormal_vertex> 2877 #include <defaultnormal_vertex> 2878 #include <normal_vertex> 2879 #include <begin_vertex> 2880 #include <morphtarget_vertex> 2881 #include <skinning_vertex> 2882 #include <displacementmap_vertex> 2883 #include <project_vertex> 2884 #include <logdepthbuf_vertex> 2885 #include <clipping_planes_vertex> 2886 vViewPosition = - mvPosition.xyz; 2887 #include <worldpos_vertex> 2888 #include <envmap_vertex> 2889 #include <shadowmap_vertex> 2890 #include <fog_vertex> 2891}`,gf=`#define LAMBERT 2892uniform vec3 diffuse; 2893uniform vec3 emissive; 2894uniform float opacity; 2895#include <common> 2896#include <packing> 2897#include <dithering_pars_fragment> 2898#include <color_pars_fragment> 2899#include <uv_pars_fragment> 2900#include <map_pars_fragment> 2901#include <alphamap_pars_fragment> 2902#include <alphatest_pars_fragment> 2903#include <alphahash_pars_fragment> 2904#include <aomap_pars_fragment> 2905#include <lightmap_pars_fragment> 2906#include <emissivemap_pars_fragment> 2907#include <envmap_common_pars_fragment> 2908#include <envmap_pars_fragment> 2909#include <fog_pars_fragment> 2910#include <bsdfs> 2911#include <lights_pars_begin> 2912#include <normal_pars_fragment> 2913#include <lights_lambert_pars_fragment> 2914#include <shadowmap_pars_fragment> 2915#include <bumpmap_pars_fragment> 2916#include <normalmap_pars_fragment> 2917#include <specularmap_pars_fragment> 2918#include <logdepthbuf_pars_fragment> 2919#include <clipping_planes_pars_fragment> 2920void main() { 2921 vec4 diffuseColor = vec4( diffuse, opacity ); 2922 #include <clipping_planes_fragment> 2923 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2924 vec3 totalEmissiveRadiance = emissive; 2925 #include <logdepthbuf_fragment> 2926 #include <map_fragment> 2927 #include <color_fragment> 2928 #include <alphamap_fragment> 2929 #include <alphatest_fragment> 2930 #include <alphahash_fragment> 2931 #include <specularmap_fragment> 2932 #include <normal_fragment_begin> 2933 #include <normal_fragment_maps> 2934 #include <emissivemap_fragment> 2935 #include <lights_lambert_fragment> 2936 #include <lights_fragment_begin> 2937 #include <lights_fragment_maps> 2938 #include <lights_fragment_end> 2939 #include <aomap_fragment> 2940 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2941 #include <envmap_fragment> 2942 #include <opaque_fragment> 2943 #include <tonemapping_fragment> 2944 #include <colorspace_fragment> 2945 #include <fog_fragment> 2946 #include <premultiplied_alpha_fragment> 2947 #include <dithering_fragment> 2948}`,_f=`#define MATCAP 2949varying vec3 vViewPosition; 2950#include <common> 2951#include <batching_pars_vertex> 2952#include <uv_pars_vertex> 2953#include <color_pars_vertex> 2954#include <displacementmap_pars_vertex> 2955#include <fog_pars_vertex> 2956#include <normal_pars_vertex> 2957#include <morphtarget_pars_vertex> 2958#include <skinning_pars_vertex> 2959#include <logdepthbuf_pars_vertex> 2960#include <clipping_planes_pars_vertex> 2961void main() { 2962 #include <uv_vertex> 2963 #include <color_vertex> 2964 #include <morphinstance_vertex> 2965 #include <morphcolor_vertex> 2966 #include <batching_vertex> 2967 #include <beginnormal_vertex> 2968 #include <morphnormal_vertex> 2969 #include <skinbase_vertex> 2970 #include <skinnormal_vertex> 2971 #include <defaultnormal_vertex> 2972 #include <normal_vertex> 2973 #include <begin_vertex> 2974 #include <morphtarget_vertex> 2975 #include <skinning_vertex> 2976 #include <displacementmap_vertex> 2977 #include <project_vertex> 2978 #include <logdepthbuf_vertex> 2979 #include <clipping_planes_vertex> 2980 #include <fog_vertex> 2981 vViewPosition = - mvPosition.xyz; 2982}`,xf=`#define MATCAP 2983uniform vec3 diffuse; 2984uniform float opacity; 2985uniform sampler2D matcap; 2986varying vec3 vViewPosition; 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 <fog_pars_fragment> 2996#include <normal_pars_fragment> 2997#include <bumpmap_pars_fragment> 2998#include <normalmap_pars_fragment> 2999#include <logdepthbuf_pars_fragment> 3000#include <clipping_planes_pars_fragment> 3001void main() { 3002 vec4 dif
3002fuseColor = vec4( diffuse, opacity ); 3003 #include <clipping_planes_fragment> 3004 #include <logdepthbuf_fragment> 3005 #include <map_fragment> 3006 #include <color_fragment> 3007 #include <alphamap_fragment> 3008 #include <alphatest_fragment> 3009 #include <alphahash_fragment> 3010 #include <normal_fragment_begin> 3011 #include <normal_fragment_maps> 3012 vec3 viewDir = normalize( vViewPosition ); 3013 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3014 vec3 y = cross( viewDir, x ); 3015 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3016 #ifdef USE_MATCAP 3017 vec4 matcapColor = texture2D( matcap, uv ); 3018 #else 3019 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3020 #endif 3021 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3022 #include <opaque_fragment> 3023 #include <tonemapping_fragment> 3024 #include <colorspace_fragment> 3025 #include <fog_fragment> 3026 #include <premultiplied_alpha_fragment> 3027 #include <dithering_fragment> 3028}`,vf=`#define NORMAL 3029#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3030 varying vec3 vViewPosition; 3031#endif 3032#include <common> 3033#include <batching_pars_vertex> 3034#include <uv_pars_vertex> 3035#include <displacementmap_pars_vertex> 3036#include <normal_pars_vertex> 3037#include <morphtarget_pars_vertex> 3038#include <skinning_pars_vertex> 3039#include <logdepthbuf_pars_vertex> 3040#include <clipping_planes_pars_vertex> 3041void main() { 3042 #include <uv_vertex> 3043 #include <batching_vertex> 3044 #include <beginnormal_vertex> 3045 #include <morphinstance_vertex> 3046 #include <morphnormal_vertex> 3047 #include <skinbase_vertex> 3048 #include <skinnormal_vertex> 3049 #include <defaultnormal_vertex> 3050 #include <normal_vertex> 3051 #include <begin_vertex> 3052 #include <morphtarget_vertex> 3053 #include <skinning_vertex> 3054 #include <displacementmap_vertex> 3055 #include <project_vertex> 3056 #include <logdepthbuf_vertex> 3057 #include <clipping_planes_vertex> 3058#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3059 vViewPosition = - mvPosition.xyz; 3060#endif 3061}`,yf=`#define NORMAL 3062uniform float opacity; 3063#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3064 varying vec3 vViewPosition; 3065#endif 3066#include <packing> 3067#include <uv_pars_fragment> 3068#include <normal_pars_fragment> 3069#include <bumpmap_pars_fragment> 3070#include <normalmap_pars_fragment> 3071#include <logdepthbuf_pars_fragment> 3072#include <clipping_planes_pars_fragment> 3073void main() { 3074 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3075 #include <clipping_planes_fragment> 3076 #include <logdepthbuf_fragment> 3077 #include <normal_fragment_begin> 3078 #include <normal_fragment_maps> 3079 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3080 #ifdef OPAQUE 3081 gl_FragColor.a = 1.0; 3082 #endif 3083}`,Mf=`#define PHONG 3084varying vec3 vViewPosition; 3085#include <common> 3086#include <batching_pars_vertex> 3087#include <uv_pars_vertex> 3088#include <displacementmap_pars_vertex> 3089#include <envmap_pars_vertex> 3090#include <color_pars_vertex> 3091#include <fog_pars_vertex> 3092#include <normal_pars_vertex> 3093#include <morphtarget_pars_vertex> 3094#include <skinning_pars_vertex> 3095#include <shadowmap_pars_vertex> 3096#include <logdepthbuf_pars_vertex> 3097#include <clipping_planes_pars_vertex> 3098void main() { 3099 #include <uv_vertex> 3100 #include <color_vertex> 3101 #include <morphcolor_vertex> 3102 #include <batching_vertex> 3103 #include <beginnormal_vertex> 3104 #include <morphinstance_vertex> 3105 #include <morphnormal_vertex> 3106 #include <skinbase_vertex> 3107 #include <skinnormal_vertex> 3108 #include <defaultnormal_vertex> 3109 #include <normal_vertex> 3110 #include <begin_vertex> 3111 #include <morphtarget_vertex> 3112 #include <skinning_vertex> 3113 #include <displacementmap_vertex> 3114 #include <project_vertex> 3115 #include <logdepthbuf_vertex> 3116 #include <clipping_planes_vertex> 3117 vViewPosition = - mvPosition.xyz; 3118 #include <worldpos_vertex> 3119 #include <envmap_vertex> 3120 #include <shadowmap_vertex> 3121 #include <fog_vertex> 3122}`,Sf=`#define PHONG 3123uniform vec3 diffuse; 3124uniform vec3 emissive; 3125uniform vec3 specular; 3126uniform float shininess; 3127uniform float opacity; 3128#include <common> 3129#include <packing> 3130#include <dithering_pars_fragment> 3131#include <color_pars_fragment> 3132#include <uv_pars_fragment> 3133#include <map_pars_fragment> 3134#include <alphamap_pars_fragment> 3135#include <alphatest_pars_fragment> 3136#include <alphahash_pars_fragment> 3137#include <aomap_pars_fragment> 3138#include <lightmap_pars_fragment> 3139#include <emissivemap_pars_fragment> 3140#include <envmap_common_pars_fragment> 3141#include <envmap_pars_fragment> 3142#include <fog_pars_fragment> 3143#include <bsdfs> 3144#include <lights_pars_begin> 3145#include <normal_pars_fragment> 3146#include <lights_phong_pars_fragment> 3147#include <shadowmap_pars_fragment> 3148#include <bumpmap_pars_fragment> 3149#include <normalmap_pars_fragment> 3150#include <specularmap_pars_fragment> 3151#include <logdepthbuf_pars_fragment> 3152#include <clipping_planes_pars_fragment> 3153void main() { 3154 vec4 diffuseColor = vec4( diffuse, opacity ); 3155 #include <clipping_planes_fragment> 3156 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3157 vec3 totalEmissiveRadiance = emissive; 3158 #include <logdepthbuf_fragment> 3159 #include <map_fragment> 3160 #include <color_fragment> 3161 #include <alphamap_fragment> 3162 #include <alphatest_fragment> 3163 #include <alphahash_fragment> 3164 #include <specularmap_fragment> 3165 #include <normal_fragment_begin> 3166 #include <normal_fragment_maps> 3167 #include <emissivemap_fragment> 3168 #include <lights_phong_fragment> 3169 #include <lights_fragment_begin> 3170 #include <lights_fragment_maps> 3171 #include <lights_fragment_end> 3172 #include <aomap_fragment> 3173 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3174 #include <envmap_fragment> 3175 #include <opaque_fragment> 3176 #include <tonemapping_fragment> 3177 #include <colorspace_fragment> 3178 #include <fog_fragment> 3179 #include <premultiplied_alpha_fragment> 3180 #include <dithering_fragment> 3181}`,bf=`#define STANDARD 3182varying vec3 vViewPosition; 3183#ifdef USE_TRANSMISSION 3184 varying vec3 vWorldPosition; 3185#endif 3186#include <common> 3187#include <batching_pars_vertex> 3188#include <uv_pars_vertex> 3189#include <displacementmap_pars_vertex> 3190#include <color_pars_vertex> 3191#include <fog_pars_vertex> 3192#include <normal_pars_vertex> 3193#include <morphtarget_pars_vertex> 3194#include <skinning_pars_vertex> 3195#include <shadowmap_pars_vertex> 3196#include <logdepthbuf_pars_vertex> 3197#include <clipping_planes_pars_vertex> 3198void main() { 3199 #include <uv_vertex> 3200 #include <color_vertex> 3201 #include <morphinstance_vertex> 3202 #include <morphcolor_vertex> 3203 #include <batching_vertex> 3204 #include <beginnormal_vertex> 3205 #include <morphnormal_vertex> 3206 #include <skinbase_vertex> 3207 #include <skinnormal_vertex> 3208 #include <defaultnormal_vertex> 3209 #include <normal_vertex> 3210 #include <begin_vertex> 3211 #include <morphtarget_vertex> 3212 #include <skinning_vertex> 3213 #include <displacementmap_vertex> 3214 #include <project_vertex> 3215 #include <logdepthbuf_vertex> 3216 #include <clipping_planes_vertex> 3217 vViewPosition = - mvPosition.xyz; 3218 #include <worldpos_vertex> 3219 #include <shadowmap_vertex> 3220 #include <fog_vertex> 3221#ifdef USE_TRANSMISSION 3222 vWorldPosition = worldPosition.xyz; 3223#endif 3224}`,Ef=`#define STANDARD 3225#ifdef PHYSICAL 3226 #define IOR 3227 #define USE_SPECULAR 3228#endif 3229uniform vec3 diffuse; 3230uniform vec3 emissive; 3231uniform float roughness; 3232uniform float metalness; 3233uniform float opacity; 3234#ifdef IOR 3235 uniform float ior; 3236#endif 3237#ifdef USE_SPECULAR 3238 uniform float specularIntensity; 3239 uniform vec3 specularColor; 3240 #ifdef USE_SPECULAR_COLORMAP 3241 uniform sampler2D specularColorMap; 3242 #endif 3243 #ifdef USE_SPECULAR_INTENSITYMAP 3244 uniform sampler2D specularIntensityMap; 3245 #endif 3246#endif 3247#ifdef USE_CLEARCOAT 3248 uniform float clearcoat; 3249 uniform float clearcoatRoughness; 3250#endif 3251#ifdef USE_DISPERSION 3252 uniform float dispersion; 3253#endif
3254#ifdef USE_IRIDESCENCE 3255 uniform float iridescence; 3256 uniform float iridescenceIOR; 3257 uniform float iridescenceThicknessMinimum; 3258 uniform float iridescenceThicknessMaximum; 3259#endif 3260#ifdef USE_SHEEN 3261 uniform vec3 sheenColor; 3262 uniform float sheenRoughness; 3263 #ifdef USE_SHEEN_COLORMAP 3264 uniform sampler2D sheenColorMap; 3265 #endif 3266 #ifdef USE_SHEEN_ROUGHNESSMAP 3267 uniform sampler2D sheenRoughnessMap; 3268 #endif 3269#endif 3270#ifdef USE_ANISOTROPY 3271 uniform vec2 anisotropyVector; 3272 #ifdef USE_ANISOTROPYMAP 3273 uniform sampler2D anisotropyMap; 3274 #endif 3275#endif 3276varying vec3 vViewPosition; 3277#include <common> 3278#include <packing> 3279#include <dithering_pars_fragment> 3280#include <color_pars_fragment> 3281#include <uv_pars_fragment> 3282#include <map_pars_fragment> 3283#include <alphamap_pars_fragment> 3284#include <alphatest_pars_fragment> 3285#include <alphahash_pars_fragment> 3286#include <aomap_pars_fragment> 3287#include <lightmap_pars_fragment> 3288#include <emissivemap_pars_fragment> 3289#include <iridescence_fragment> 3290#include <cube_uv_reflection_fragment> 3291#include <envmap_common_pars_fragment> 3292#include <envmap_physical_pars_fragment> 3293#include <fog_pars_fragment> 3294#include <lights_pars_begin> 3295#include <normal_pars_fragment> 3296#include <lights_physical_pars_fragment> 3297#include <transmission_pars_fragment> 3298#include <shadowmap_pars_fragment> 3299#include <bumpmap_pars_fragment> 3300#include <normalmap_pars_fragment> 3301#include <clearcoat_pars_fragment> 3302#include <iridescence_pars_fragment> 3303#include <roughnessmap_pars_fragment> 3304#include <metalnessmap_pars_fragment> 3305#include <logdepthbuf_pars_fragment> 3306#include <clipping_planes_pars_fragment> 3307void main() { 3308 vec4 diffuseColor = vec4( diffuse, opacity ); 3309 #include <clipping_planes_fragment> 3310 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3311 vec3 totalEmissiveRadiance = emissive; 3312 #include <logdepthbuf_fragment> 3313 #include <map_fragment> 3314 #include <color_fragment> 3315 #include <alphamap_fragment> 3316 #include <alphatest_fragment> 3317 #include <alphahash_fragment> 3318 #include <roughnessmap_fragment> 3319 #include <metalnessmap_fragment> 3320 #include <normal_fragment_begin> 3321 #include <normal_fragment_maps> 3322 #include <clearcoat_normal_fragment_begin> 3323 #include <clearcoat_normal_fragment_maps> 3324 #include <emissivemap_fragment> 3325 #include <lights_physical_fragment> 3326 #include <lights_fragment_begin> 3327 #include <lights_fragment_maps> 3328 #include <lights_fragment_end> 3329 #include <aomap_fragment> 3330 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3331 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3332 #include <transmission_fragment> 3333 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3334 #ifdef USE_SHEEN 3335 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3336 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3337 #endif 3338 #ifdef USE_CLEARCOAT 3339 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3340 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3341 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3342 #endif 3343 #include <opaque_fragment> 3344 #include <tonemapping_fragment> 3345 #include <colorspace_fragment> 3346 #include <fog_fragment> 3347 #include <premultiplied_alpha_fragment> 3348 #include <dithering_fragment> 3349}`,wf=`#define TOON 3350varying vec3 vViewPosition; 3351#include <common> 3352#include <batching_pars_vertex> 3353#include <uv_pars_vertex> 3354#include <displacementmap_pars_vertex> 3355#include <color_pars_vertex> 3356#include <fog_pars_vertex> 3357#include <normal_pars_vertex> 3358#include <morphtarget_pars_vertex> 3359#include <skinning_pars_vertex> 3360#include <shadowmap_pars_vertex> 3361#include <logdepthbuf_pars_vertex> 3362#include <clipping_planes_pars_vertex> 3363void main() { 3364 #include <uv_vertex> 3365 #include <color_vertex> 3366 #include <morphinstance_vertex> 3367 #include <morphcolor_vertex> 3368 #include <batching_vertex> 3369 #include <beginnormal_vertex> 3370 #include <morphnormal_vertex> 3371 #include <skinbase_vertex> 3372 #include <skinnormal_vertex> 3373 #include <defaultnormal_vertex> 3374 #include <normal_vertex> 3375 #include <begin_vertex> 3376 #include <morphtarget_vertex> 3377 #include <skinning_vertex> 3378 #include <displacementmap_vertex> 3379 #include <project_vertex> 3380 #include <logdepthbuf_vertex> 3381 #include <clipping_planes_vertex> 3382 vViewPosition = - mvPosition.xyz; 3383 #include <worldpos_vertex> 3384 #include <shadowmap_vertex> 3385 #include <fog_vertex> 3386}`,Tf=`#define TOON 3387uniform vec3 diffuse; 3388uniform vec3 emissive; 3389uniform float opacity; 3390#include <common> 3391#include <packing> 3392#include <dithering_pars_fragment> 3393#include <color_pars_fragment> 3394#include <uv_pars_fragment> 3395#include <map_pars_fragment> 3396#include <alphamap_pars_fragment> 3397#include <alphatest_pars_fragment> 3398#include <alphahash_pars_fragment> 3399#include <aomap_pars_fragment> 3400#include <lightmap_pars_fragment> 3401#include <emissivemap_pars_fragment> 3402#include <gradientmap_pars_fragment> 3403#include <fog_pars_fragment> 3404#include <bsdfs> 3405#include <lights_pars_begin> 3406#include <normal_pars_fragment> 3407#include <lights_toon_pars_fragment> 3408#include <shadowmap_pars_fragment> 3409#include <bumpmap_pars_fragment> 3410#include <normalmap_pars_fragment> 3411#include <logdepthbuf_pars_fragment> 3412#include <clipping_planes_pars_fragment> 3413void main() { 3414 vec4 diffuseColor = vec4( diffuse, opacity ); 3415 #include <clipping_planes_fragment> 3416 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3417 vec3 totalEmissiveRadiance = emissive; 3418 #include <logdepthbuf_fragment> 3419 #include <map_fragment> 3420 #include <color_fragment> 3421 #include <alphamap_fragment> 3422 #include <alphatest_fragment> 3423 #include <alphahash_fragment> 3424 #include <normal_fragment_begin> 3425 #include <normal_fragment_maps> 3426 #include <emissivemap_fragment> 3427 #include <lights_toon_fragment> 3428 #include <lights_fragment_begin> 3429 #include <lights_fragment_maps> 3430 #include <lights_fragment_end> 3431 #include <aomap_fragment> 3432 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3433 #include <opaque_fragment> 3434 #include <tonemapping_fragment> 3435 #include <colorspace_fragment> 3436 #include <fog_fragment> 3437 #include <premultiplied_alpha_fragment> 3438 #include <dithering_fragment> 3439}`,Af=`uniform float size; 3440uniform float scale; 3441#include <common> 3442#include <color_pars_vertex> 3443#include <fog_pars_vertex> 3444#include <morphtarget_pars_vertex> 3445#include <logdepthbuf_pars_vertex> 3446#include <clipping_planes_pars_vertex> 3447#ifdef USE_POINTS_UV 3448 varying vec2 vUv; 3449 uniform mat3 uvTransform; 3450#endif 3451void main() { 3452 #ifdef USE_POINTS_UV 3453 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3454 #endif 3455 #include <color_vertex> 3456 #include <morphinstance_vertex> 3457 #include <morphcolor_vertex> 3458 #include <begin_vertex> 3459 #include <morphtarget_vertex> 3460 #include <project_vertex> 3461 gl_PointSize = size; 3462 #ifdef USE_SIZEATTENUATION 3463 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3464 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3465 #endif 3466 #include <logdepthbuf_vertex> 3467 #include <clipping_planes_vertex> 3468 #include <worldpos_vertex> 3469 #include <fog_vertex> 3470}`,Cf=`uniform vec3 diffuse; 3471uniform float opacity; 3472#include <common> 3473#include <color_pars_fragment> 3474#include <map_particle_pars_fragment> 3475#include <alphatest_pars_fragment> 3476#include <alphahash_pars_fragment> 3477#include <fog_pars_fragment> 3478#include <logdepthbuf_pars_fragment> 3479#include <clipping_planes_pars_fragment> 3480void main() { 3481 vec4 diffuseColor = vec4( diffuse, opacity ); 3482 #include <clipping_planes_fragment> 3483 vec3 outgoingLight = vec3( 0.0 ); 3484 #include <logdepthbuf_fragment> 3485 #include <map_particle_fragment> 3486 #include <color_fragment> 3487 #include <alphatest_fragment> 3488 #include <alphahash_fragment> 3489 outgoingLight = diffuseColor.rgb; 3490 #include <opaque_fragment> 3491 #include <tonemapping_fragment> 3492 #include <colorspace_fragment> 3493 #include <fog_fragment> 3494 #include <premultiplied_alpha_fragment> 3495}`,Rf=`#include <common> 3496#include <batching_pars_vertex> 3497#include <fog_pars_vertex> 3498#include <morphtarget_pars_vertex> 3499#include <skinning_pars_vertex> 3500#include <logdepthbuf_pars_vertex> 3501#include <shadowmap_pars_vertex> 3502void main() { 3503 #include <batching_vertex> 3504 #include <beginnormal_vertex> 3505 #include <morphinstance_vertex> 3506 #include <morphnormal_vertex> 3507 #include <skinbase_vertex> 3508 #include <skinnormal_vertex> 3509 #include <defaultnormal_vertex> 3510 #include <begin_vertex> 3511 #include <morphtarget_vertex> 3512 #include <skinning_vertex> 3513 #include <project_vertex> 3514 #include <logdepthbuf_vertex> 3515 #include <worldpos_vertex> 3516 #include <shadowmap_vertex> 3517 #include <fog_vertex> 3518}
3518`,Pf=`uniform vec3 color; 3519uniform float opacity; 3520#include <common> 3521#include <packing> 3522#include <fog_pars_fragment> 3523#include <bsdfs> 3524#include <lights_pars_begin> 3525#include <logdepthbuf_pars_fragment> 3526#include <shadowmap_pars_fragment> 3527#include <shadowmask_pars_fragment> 3528void main() { 3529 #include <logdepthbuf_fragment> 3530 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3531 #include <tonemapping_fragment> 3532 #include <colorspace_fragment> 3533 #include <fog_fragment> 3534}`,If=`uniform float rotation; 3535uniform vec2 center; 3536#include <common> 3537#include <uv_pars_vertex> 3538#include <fog_pars_vertex> 3539#include <logdepthbuf_pars_vertex> 3540#include <clipping_planes_pars_vertex> 3541void main() { 3542 #include <uv_vertex> 3543 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3544 vec2 scale; 3545 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3546 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3547 #ifndef USE_SIZEATTENUATION 3548 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3549 if ( isPerspective ) scale *= - mvPosition.z; 3550 #endif 3551 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3552 vec2 rotatedPosition; 3553 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3554 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3555 mvPosition.xy += rotatedPosition; 3556 gl_Position = projectionMatrix * mvPosition; 3557 #include <logdepthbuf_vertex> 3558 #include <clipping_planes_vertex> 3559 #include <fog_vertex> 3560}`,Lf=`uniform vec3 diffuse; 3561uniform float opacity; 3562#include <common> 3563#include <uv_pars_fragment> 3564#include <map_pars_fragment> 3565#include <alphamap_pars_fragment> 3566#include <alphatest_pars_fragment> 3567#include <alphahash_pars_fragment> 3568#include <fog_pars_fragment> 3569#include <logdepthbuf_pars_fragment> 3570#include <clipping_planes_pars_fragment> 3571void main() { 3572 vec4 diffuseColor = vec4( diffuse, opacity ); 3573 #include <clipping_planes_fragment> 3574 vec3 outgoingLight = vec3( 0.0 ); 3575 #include <logdepthbuf_fragment> 3576 #include <map_fragment> 3577 #include <alphamap_fragment> 3578 #include <alphatest_fragment> 3579 #include <alphahash_fragment> 3580 outgoingLight = diffuseColor.rgb; 3581 #include <opaque_fragment> 3582 #include <tonemapping_fragment> 3583 #include <colorspace_fragment> 3584 #include <fog_fragment> 3585}
3585`,Dt={alphahash_fragment:Qh,alphahash_pars_fragment:tu,alphamap_fragment:eu,alphamap_pars_fragment:nu,alphatest_fragment:iu,alphatest_pars_fragment:su,aomap_fragment:ru,aomap_pars_fragment:au,batching_pars_vertex:ou,batching_vertex:cu,begin_vertex:lu,beginnormal_vertex:hu,bsdfs:uu,iridescence_fragment:du,bumpmap_pars_fragment:fu,clipping_planes_fragment:pu,clipping_planes_pars_fragment:mu,clipping_planes_pars_vertex:gu,clipping_planes_vertex:_u,color_fragment:xu,color_pars_fragment:vu,color_pars_vertex:yu,color_vertex:Mu,common:Su,cube_uv_reflection_fragment:bu,defaultnormal_vertex:Eu,displacementmap_pars_vertex:wu,displacementmap_vertex:Tu,emissivemap_fragment:Au,emissivemap_pars_fragment:Cu,colorspace_fragment:Ru,colorspace_pars_fragment:Pu,envmap_fragment:Iu,envmap_common_pars_fragment:Lu,envmap_pars_fragment:Du,envmap_pars_vertex:Uu,envmap_physical_pars_fragment:Xu,envmap_vertex:Nu,fog_vertex:Ou,fog_pars_vertex:Fu,fog_fragment:Bu,fog_pars_fragment:zu,gradientmap_pars_fragment:ku,lightmap_pars_fragment:Vu,lights_lambert_fragment:Hu,lights_lambert_pars_fragment:Gu,lights_pars_begin:Wu,lights_toon_fragment:Yu,lights_toon_pars_fragment:qu,lights_phong_fragment:Zu,lights_phong_pars_fragment:Ju,lights_physical_fragment:Ku,lights_physical_pars_fragment:$u,lights_fragment_begin:ju,lights_fragment_maps:Qu,lights_fragment_end:td,logdepthbuf_fragment:ed,logdepthbuf_pars_fragment:nd,logdepthbuf_pars_vertex:id,logdepthbuf_vertex:sd,map_fragment:rd,map_pars_fragment:ad,map_particle_fragment:od,map_particle_pars_fragment:cd,metalnessmap_fragment:ld,metalnessmap_pars_fragment:hd,morphinstance_vertex:ud,morphcolor_vertex:dd,morphnormal_vertex:fd,morphtarget_pars_vertex:pd,morphtarget_vertex:md,normal_fragment_begin:gd,normal_fragment_maps:_d,normal_pars_fragment:xd,normal_pars_vertex:vd,normal_vertex:yd,normalmap_pars_fragment:Md,clearcoat_normal_fragment_begin:Sd,clearcoat_normal_fragment_maps:bd,clearcoat_pars_fragment:Ed,iridescence_pars_fragment:wd,opaque_fragment:Td,packing:Ad,premultiplied_alpha_fragment:Cd,project_vertex:Rd,dithering_fragment:Pd,dithering_pars_fragment:Id,roughnessmap_fragment:Ld,roughnessmap_pars_fragment:Dd,shadowmap_pars_fragment:Ud,shadowmap_pars_vertex:Nd,shadowmap_vertex:Od,shadowmask_pars_fragment:Fd,skinbase_vertex:Bd,skinning_pars_vertex:zd,skinning_vertex:kd,skinnormal_vertex:Vd,specularmap_fragment:Hd,specularmap_pars_fragment:Gd,tonemapping_fragment:Wd,tonemapping_pars_fragment:Xd,transmission_fragment:Yd,transmission_pars_fragment:qd,uv_pars_fragment:Zd,uv_pars_vertex:Jd,uv_vertex:Kd,worldpos_vertex:$d,background_vert:jd,background_frag:Qd,backgroundCube_vert:tf,backgroundCube_frag:ef,cube_vert:nf,cube_frag:sf,depth_vert:rf,depth_frag:af,distanceRGBA_vert:of,distanceRGBA_frag:cf,equirect_vert:lf,equirect_frag:hf,linedashed_vert:uf,linedashed_frag:df,meshbasic_vert:ff,meshbasic_frag:pf,meshlambert_vert:mf,meshlambert_frag:gf,meshmatcap_vert:_f,meshmatcap_frag:xf,meshnormal_vert:vf,meshnormal_frag:yf,meshphong_vert:Mf,meshphong_frag:Sf,meshphysical_vert:bf,meshphysical_frag:Ef,meshtoon_vert:wf,meshtoon_frag:Tf,points_vert:Af,points_frag:Cf,shadow_vert:Rf,shadow_frag:Pf,sprite_vert:If,sprite_frag:Lf},st={common:{diffuse:{value:new Ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ut},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ut}},envmap:{envMap:{value:null},envMapRotation:{value:new Ut},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ut},normalScale:{value:new Tt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0},uvTransform:{value:new Ut}},sprite:{diffuse:{value:new Ot(16777215)},opacity:{value:1},center:{value:new Tt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ut},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0}}},Ye={basic:{uniforms:Me([st.common,st.specularmap,st.envmap,st.aomap,st.lightmap,st.fog]),vertexShader:Dt.meshbasic_vert,fragmentShader:Dt.meshbasic_frag},lambert:{uniforms:Me([st.common,st.specularmap,st.envmap,st.aomap,st.lightmap,st.emissivemap,st.bumpmap,st.normalmap,st.displacementmap,st.fog,st.lights,{emissive:{value:new Ot(0)}}]),vertexShader:Dt.meshlambert_vert,fragmentShader:Dt.meshlambert_frag},phong:{uniforms:Me([st.common,st.specularmap,st.envmap,st.aomap,st.lightmap,st.emissivemap,st.bumpmap,st.normalmap,st.displacementmap,st.fog,st.lights,{emissive:{value:new Ot(0)},specular:{value:new Ot(1118481)},shininess:{value:30}}]),vertexShader:Dt.meshphong_vert,fragmentShader:Dt.meshphong_frag},standard:{uniforms:Me([st.common,st.envmap,st.aomap,st.lightmap,st.emissivemap,st.bumpmap,st.normalmap,st.displacementmap,st.roughnessmap,st.metalnessmap,st.fog,st.lights,{emissive:{value:new Ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag},toon:{uniforms:Me([st.common,st.aomap,st.lightmap,st.emissivemap,st.bumpmap,st.normalmap,st.displacementmap,st.gradientmap,st.fog,st.lights,{emissive:{value:new Ot(0)}}]),vertexShader:Dt.meshtoon_vert,fragmentShader:Dt.meshtoon_frag},matcap:{uniforms:Me([st.common,st.bumpmap,st.normalmap,st.displacementmap,st.fog,{matc
vendor: 5,245 bytes, line 3585
3585ap:{value:null}}]),vertexShader:Dt.meshmatcap_vert,fragmentShader:Dt.meshmatcap_frag},points:{uniforms:Me([st.points,st.fog]),vertexShader:Dt.points_vert,fragmentShader:Dt.points_frag},dashed:{uniforms:Me([st.common,st.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Dt.linedashed_vert,fragmentShader:Dt.linedashed_frag},depth:{uniforms:Me([st.common,st.displacementmap]),vertexShader:Dt.depth_vert,fragmentShader:Dt.depth_frag},normal:{uniforms:Me([st.common,st.bumpmap,st.normalmap,st.displacementmap,{opacity:{value:1}}]),vertexShader:Dt.meshnormal_vert,fragmentShader:Dt.meshnormal_frag},sprite:{uniforms:Me([st.sprite,st.fog]),vertexShader:Dt.sprite_vert,fragmentShader:Dt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Dt.background_vert,fragmentShader:Dt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ut}},vertexShader:Dt.backgroundCube_vert,fragmentShader:Dt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Dt.cube_vert,fragmentShader:Dt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Dt.equirect_vert,fragmentShader:Dt.equirect_frag},distanceRGBA:{uniforms:Me([st.common,st.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Dt.distanceRGBA_vert,fragmentShader:Dt.distanceRGBA_frag},shadow:{uniforms:Me([st.lights,st.fog,{color:{value:new Ot(0)},opacity:{value:1}}]),vertexShader:Dt.shadow_vert,fragmentShader:Dt.shadow_frag}};Ye.physical={uniforms:Me([Ye.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ut},clearcoatNormalScale:{value:new Tt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ut},sheen:{value:0},sheenColor:{value:new Ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ut},transmissionSamplerSize:{value:new Tt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ut},attenuationDistance:{value:0},attenuationColor:{value:new Ot(0)},specularColor:{value:new Ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ut},anisotropyVector:{value:new Tt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ut}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag};var _s={r:0,b:0,g:0},Rn=new Bn,Df=new ee;function Uf(i,t,e,n,s,r,a){let o=new Ot(0),c=r===!0?0:1,l,h,p=null,d=0,m=null;function _(w){let S=w.isScene===!0?w.background:null;return S&&S.isTexture&&(S=(w.backgroundBlurriness>0?e:t).get(S)),S}function v(w){let S=!1,T=_(w);T===null?u(o,c):T&&T.isColor&&(u(T,1),S=!0);let N=i.xr.getEnvironmentBlendMode();N==="additive"?n.buffers.color.setClear(0,0,0,1,a):N==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||S)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function f(w,S){let T=_(S);T&&(T.isCubeTexture||T.mapping===sr)?(h===void 0&&(h=new Re(new Wi(1,1,1),new Je({name:"BackgroundCubeMaterial",uniforms:Ei(Ye.backgroundCube.uniforms),vertexShader:Ye.backgroundCube.vertexShader,fragmentShader:Ye.backgroundCube.fragmentShader,side:be,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(N,R,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),Rn.copy(S.backgroundRotation),Rn.x*=-1,Rn.y*=-1,Rn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Rn.y*=-1,Rn.z*=-1),h.material.uniforms.envMap.value=T,h.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Df.makeRotationFromEuler(Rn)),h.material.toneMapped=Yt.getTransfer(T.colorSpace)!==Zt,(p!==T||d!==T.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,p=T,d=T.version,m=i.toneMapping),h.layers.enableAll(),w.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(l===void 0&&(l=new Re(new wi(2,2),new Je({name:"Backgroun
3585dMaterial",uniforms:Ei(Ye.background.uniforms),vertexShader:Ye.background.vertexShader,fragmentShader:Ye.background.fragmentShader,side:Mn,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=T,l.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,l.material.toneMapped=Yt.getTransfer(T.colorSpace)!==Zt,T.matrixAutoUpdate===!0&&T.updateMatrix(),l.material.uniforms.uvTransform.value.copy(T.matrix),(p!==T||d!==T.version||m!==i.toneMapping)&&(l.material.needsUpdate=!0,p=T,d=T.version,m=i.toneMapping),l.layers.enableAll(),w.unshift(l,l.geometry,l.material,0,0,null))}function u(w,S){w.getRGB(_s,tl(i)),n.buffers.color.setClear(_s.r,_s.g,_s.b,S,a)}return{getClearColor:function(){return o},setClearColor:function(w,S=1){o.set(w),c=S,u(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(w){c=w,u(o,c)},render:v,addToRenderList:f}}function Nf(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=d(null),r=s,a=!1;function o(M,P,W,V,Z){let q=!1,X=p(V,W,P);r!==X&&(r=X,l(r.object)),q=m(M,V,W,Z),q&&_(M,V,W,Z),Z!==null&&t.update(Z,i.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,T(M,P,W,V),Z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(Z).buffer))}function c(){return i.createVertexArray()}function l(M){return i.bindVertexArray(M)}function h(M){return i.deleteVertexArray(M)}function p(M,P,W){let V=W.wireframe===!0,Z=n[M.id];Z===void 0&&(Z={},n[M.id]=Z);let q=Z[P.id];q===void 0&&(q={},Z[P.id]=q);let X=q[V];return X===void 0&&(X=d(c()),q[V]=X),X}function d(M){let P=[],W=[],V=[];for(let Z=0;Z<e;Z++)P[Z]=0,W[Z]=0,V[Z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:W,attributeDivisors:V,object:M,attributes:{},index:null}}function m(M,P,W,V){let Z=r.attributes,q=P.attributes,X=0,J=W.getAttributes();for(let G in J)if(J[G].location>=0){let lt=Z[G],pt=q[G];if(pt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(pt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(pt=M.instanceColor)),lt===void 0||lt.attribute!==pt||pt&<.data!==pt.data)return!0;X++}return r.attributesNum!==X||r.index!==V}function _(M,P,W,V){let Z={},q=P.attributes,X=0,J=W.getAttributes();for(let G in J)if(J[G].location>=0){let lt=q[G];lt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(lt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(lt=M.instanceColor));let pt={};pt.attribute=lt,lt&<.data&&(pt.data=lt.data),Z[G]=pt,X++}r.attributes=Z,r.attributesNum=X,r.index=V}function v(){let M=r.newAttributes;for(let P=0,W=M.length;P<W;P++)M[P]=0}function f(M){u(M,0)}function u(M,P){let W=r.newAttributes,V=r.enabledAttributes,Z=r.attributeDivisors;W[M]=1,V[M]===0&&(i.enableVertexAttribArray(M),V[M]=1),Z[M]!==P&&(i.vertexAttribDivisor(M,P),Z[M]=P)}function w(){let M=r.newAttributes,P=r.enabledAttributes;for(let W=0,V=P.length;W<V;W++)P[W]!==M[W]&&(i.disableVertexAttribArray(W),P[W]=0)}function S(M,P,W,V,Z,q,X){X===!0?i.vertexAttribIPointer(M,P,W,Z,q):i.vertexAttribPointer(M,P,W,V,Z,q)}function T(M,P,W,V){v();let Z=V.attributes,q=W.getAttributes(),X=P.defaultAttributeValues;for(let J in q){let G=q[J];if(G.location>=0){let rt=Z[J];if(rt===void 0&&(J==="instanceMatrix"&&M.instanceMatrix&&(rt=M.instanceMatrix),J==="instanceColor"&&M.instanceColor&&(rt=M.instanceColor)),rt!==void 0){let lt=rt.normalized,pt=rt.itemSize,Ft=t.get(rt);if(Ft===void 0)continue;let Vt=Ft.buffer,Y=Ft.type,tt=Ft.bytesPerElement,dt=Y===i.INT||Y===i.UNSIGNED_INT||rt.gpuType===to;if(rt.isInterleavedBufferAttribute){let ht=rt.data,Pt=ht.stride,Lt=rt.offset;if(ht.isInstancedInterleavedBuffer){for(let Nt=0;Nt<G.locationSize;Nt++)u(G.location+Nt,ht.meshPerAttribute);M.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=ht.meshPerAttribute*ht.count)}else for(let Nt=0;Nt<G.locationSize;Nt++)f(G.location+Nt);i.bindBuffer(i.ARRAY_BUFFER,Vt);for(let Nt=0;Nt<G.locationSize;Nt++)S(G.location+Nt,pt/G.locationSize,Y,lt,Pt*tt,(Lt+pt/G.locationSize*Nt)*tt,dt)}else{if(rt.isInstancedBufferAttribute){for(let ht=0;ht<G.locationSize;ht++)u(G.location+ht,rt.meshPerAttribute);M.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=rt.meshPerAttribute*rt.count)}else for(let ht=0;ht<G.locationSize;ht++)f(G.location+ht);i.bindBuffer(i.ARRAY_BUFFER,Vt);for(let ht=0;ht<G.locationSize;ht++)S(G.location+ht,pt/G.locationSize,Y,lt,pt*tt,pt/G.locationSize*ht*tt,dt)}}else if(X!==void 0){let lt=X[J];if(lt!==void 0)switch(lt.length){case 2:i.vertexAttrib2fv(G.location,lt);break;case 3:i.vertexAttrib3fv(G.location,lt);break;case 4:i.vertexAttrib4fv(G.location,lt);break;default:i.vertexAttrib1fv(G.location,lt)}}}}w()}function N(){F();for(let M in n){let P=n[M];for(let W in P){let V=P[W];for(let Z in V)h(V[Z].object),delete V[Z];delete P[W]}delete n[M]}}function R(M){if(n[M.id]===void 0)return;let P=n[M.id];for(let W in P){let V=P[W];for(let Z in V)h(V[Z].object),delete V[Z];delete P[W]}delete n[M.id]}function A(M){for(let P in n){let W=n[P];if(W[M.id]===void 0)continue;let V=W[M.id];for(let Z in V)h(V[Z].object),delete V[Z];delete W[M.id]}}function F(){b(),a=!0,r!==s&&(r=s,l(r.object))}
vendor: 4,545 bytes, line 3585
3585function b(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:F,resetDefaultState:b,dispose:N,releaseStatesOfGeometry:R,releaseStatesOfProgram:A,initAttributes:v,enableAttribute:f,disableUnusedAttributes:w}}function Of(i,t,e){let n;function s(l){n=l}function r(l,h){i.drawArrays(n,l,h),e.update(h,n,1)}function a(l,h,p){p!==0&&(i.drawArraysInstanced(n,l,h,p),e.update(h,n,p))}function o(l,h,p){if(p===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,p);let m=0;for(let _=0;_<p;_++)m+=h[_];e.update(m,n,1)}function c(l,h,p,d){if(p===0)return;let m=t.get("WEBGL_multi_draw");if(m===null)for(let _=0;_<l.length;_++)a(l[_],h[_],d[_]);else{m.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,p);let _=0;for(let v=0;v<p;v++)_+=h[v];for(let v=0;v<d.length;v++)e.update(_,n,d[v])}}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function Ff(i,t,e,n){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let R=t.get("EXT_texture_filter_anisotropic");s=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(R){return!(R!==He&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){let A=R===Zi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(R!==an&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==sn&&!A)}function c(R){if(R==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=e.precision!==void 0?e.precision:"highp",h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let p=e.logarithmicDepthBuffer===!0,d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),v=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),u=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),T=m>0,N=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:p,maxTextures:d,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:v,maxAttributes:f,maxVertexUniforms:u,maxVaryings:w,maxFragmentUniforms:S,vertexTextures:T,maxSamples:N}}function Bf(i){let t=this,e=null,n=0,s=!1,r=!1,a=new ke,o=new Ut,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(p,d){let m=p.length!==0||d||n!==0||s;return s=d,n=p.length,m},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(p,d){e=h(p,d,0)},this.setState=function(p,d,m){let _=p.clippingPlanes,v=p.clipIntersection,f=p.clipShadows,u=i.get(p);if(!s||_===null||_.length===0||r&&!f)r?h(null):l();else{let w=r?0:n,S=w*4,T=u.clippingState||null;c.value=T,T=h(_,d,S,m);for(let N=0;N!==S;++N)T[N]=e[N];u.clippingState=T,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=w}};function l(){c.value!==e&&(c.value=e,c.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(p,d,m,_){let v=p!==null?p.length:0,f=null;if(v!==0){if(f=c.value,_!==!0||f===null){let u=m+v*4,w=d.matrixWorldInverse;o.getNormalMatrix(w),(f===null||f.length<u)&&(f=new Float32Array(u));for(let S=0,T=m;S!==v;++S,T+=4)a.copy(p[S]).applyMatrix4(w,o),a.normal.toArray(f,T),f[T+3]=a.constant}c.value=f,c.needsUpdate=!0}return t.numPlanes=v,t.numIntersection=0,f}}function zf(i){let t=new WeakMap;function e(a,o){return o===qr?a.mapping=xi:o===Zr&&(a.mapping=vi),a}function n(a){if(a&&a.isTexture){let o=a.mapping;if(o===qr||o===Zr)if(t.has(a)){let c=t.get(a).texture;return e(c,a.mapping)}else{let c=a.image;if(c&&c.height>0){let l=new Ca(c.height);return l.fromEquirectangularTexture(i,a),t.set(a,l),a.addEventListener("dispose",s),e(l.texture,a.mapping)}else return null}}return a}function s(a){let o=a.target;o.removeEventListener("dispose",s);let c=t.get(o);c!==void 0&&(t.delete(o),c.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}var Gs=class extends Vs{constructor(t=-1,e=1,n=1,s=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
3585phicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,s,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,a=n+t,o=s+e,c=s-e;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},di=4,oc=[.125,.215,.35,.446,.526,.582],Dn=20,Or=new Gs,cc=new Ot,Fr=null,Br=0,zr=0,kr=!1,In=(1+Math.sqrt(5))/2,li=1/In,lc=[new I(-In,li,0),new I(In,li,0),new I(-li,0,In),new I(li,0,In),new I(0,In,-li),new I(0,In,li),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)],Ws=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,s=100){Fr=this._renderer.getRenderTarget(),Br=this._renderer.getActiveCubeFace(),zr=this._renderer.getActiveMipmapLevel(),kr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,s,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Fr,Br,zr),this._renderer.xr.enabled=kr,t.scissorTest=!1,xs(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===xi||t.mapping===vi?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Fr=this._renderer.getRenderTarget(),Br=this._renderer.getActiveCubeFace(),zr=this._renderer.getActiveMipmapLevel(),kr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Ve,minFilter:Ve,generateMipmaps:!1,type:Zi,format:He,colorSpace:bn,depthBuffer:!1},s=hc(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=hc(t,e,n);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=kf(r)),this._blurMaterial=Vf(r,t,e)}return s}_compileMaterial(t){let e=new Re(this._lodPlanes[0],t);this._renderer.compile(e,Or)}_sceneToCubeUV(t,e,n,s){let o=new ve(90,1,e,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,p=h.autoClear,d=h.toneMapping;h.getClearColor(cc),h.toneMapping=yn,h.autoClear=!1;
vendor: 5,347 bytes, lines 3585-3660
3585let m=new Bs({name:"PMREM.Background",side:be,depthWrite:!1,depthTest:!1}),_=new Re(new Wi,m),v=!1,f=t.background;f?f.isColor&&(m.color.copy(f),t.background=null,v=!0):(m.color.copy(cc),v=!0);for(let u=0;u<6;u++){let w=u%3;w===0?(o.up.set(0,c[u],0),o.lookAt(l[u],0,0)):w===1?(o.up.set(0,0,c[u]),o.lookAt(0,l[u],0)):(o.up.set(0,c[u],0),o.lookAt(0,0,l[u]));let S=this._cubeSize;xs(s,w*S,u>2?S:0,S,S),h.setRenderTarget(s),v&&h.render(_,o),h.render(t,o)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=d,h.autoClear=p,t.background=f}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===xi||t.mapping===vi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=dc()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uc());let r=s?this._cubemapMaterial:this._equirectMaterial,a=new Re(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=t;let c=this._cubeSize;xs(e,0,0,3*c,2*c),n.setRenderTarget(e),n.render(a,Or)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodPlanes.length;for(let r=1;r<s;r++){let a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=lc[(s-r-1)%lc.length];this._blur(t,r-1,r,a,o)}e.autoClear=n}_blur(t,e,n,s,r){let a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,s,"latitudinal",r),this._halfBlur(a,t,n,n,s,"longitudinal",r)}_halfBlur(t,e,n,s,r,a,o){let c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let h=3,p=new Re(this._lodPlanes[s],l),d=l.uniforms,m=this._sizeLods[n]-1,_=isFinite(r)?Math.PI/(2*m):2*Math.PI/(2*Dn-1),v=r/_,f=isFinite(r)?1+Math.floor(h*v):Dn;f>Dn&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${Dn}`);let u=[],w=0;for(let A=0;A<Dn;++A){let F=A/v,b=Math.exp(-F*F/2);u.push(b),A===0?w+=b:A<f&&(w+=2*b)}for(let A=0;A<u.length;A++)u[A]=u[A]/w;d.envMap.value=t.texture,d.samples.value=f,d.weights.value=u,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);let{_lodMax:S}=this;d.dTheta.value=_,d.mipInt.value=S-n;let T=this._sizeLods[s],N=3*T*(s>S-di?s-S+di:0),R=4*(this._cubeSize-T);xs(e,N,R,3*T,2*T),c.setRenderTarget(e),c.render(p,Or)}};function kf(i){let t=[],e=[],n=[],s=i,r=i-di+1+oc.length;for(let a=0;a<r;a++){let o=Math.pow(2,s);e.push(o);let c=1/o;a>i-di?c=oc[a-i+di-1]:a===0&&(c=0),n.push(c);let l=1/(o-2),h=-l,p=1+l,d=[h,h,p,h,p,p,h,h,p,p,h,p],m=6,_=6,v=3,f=2,u=1,w=new Float32Array(v*_*m),S=new Float32Array(f*_*m),T=new Float32Array(u*_*m);for(let R=0;R<m;R++){let A=R%3*2/3-1,F=R>2?0:-1,b=[A,F,0,A+2/3,F,0,A+2/3,F+1,0,A,F,0,A+2/3,F+1,0,A,F+1,0];w.set(b,v*_*R),S.set(d,f*_*R);let M=[R,R,R,R,R,R];T.set(M,u*_*R)}let N=new cn;N.setAttribute("position",new Ne(w,v)),N.setAttribute("uv",new Ne(S,f)),N.setAttribute("faceIndex",new Ne(T,u)),t.push(N),s>di&&s--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function hc(i,t,e){let n=new on(i,t,e);return n.texture.mapping=sr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function xs(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function Vf(i,t,e){let n=new Float32Array(Dn),s=new I(0,1,0);return new Je({name:"SphericalGaussianBlur",defines:{n:Dn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:co(),fragmentShader:` 3586 3587 precision mediump float; 3588 precision mediump int; 3589 3590 varying vec3 vOutputDirection; 3591 3592 uniform sampler2D envMap; 3593 uniform int samples; 3594 uniform float weights[ n ]; 3595 uniform bool latitudinal; 3596 uniform float dTheta; 3597 uniform float mipInt; 3598 uniform vec3 poleAxis; 3599 3600 #define ENVMAP_TYPE_CUBE_UV 3601 #include <cube_uv_reflection_fragment> 3602 3603 vec3 getSample( float theta, vec3 axis ) { 3604 3605 float cosTheta = cos( theta ); 3606 // Rodrigues' axis-angle rotation 3607 vec3 sampleDirection = vOutputDirection * cosTheta 3608 + cross( axis, vOutputDirection ) * sin( theta ) 3609 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3610 3611 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3612 3613 } 3614 3615 void main() { 3616 3617 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3618 3619 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3620 3621 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3622 3623 } 3624 3625 axis = normalize( axis ); 3626 3627 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3628 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3629 3630 for ( int i = 1; i < n; i++ ) { 3631 3632 if ( i >= samples ) { 3633 3634 break; 3635 3636 } 3637 3638 float theta = dTheta * float( i ); 3639 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3640 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3641 3642 } 3643 3644 } 3645 `,blending:vn,depthTest:!1,depthWrite:!1})}function uc(){return new Je({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:co(),fragmentShader:` 3646 3647 precision mediump float; 3648 precision mediump int; 3649 3650 varying vec3 vOutputDirection; 3651 3652 uniform sampler2D envMap; 3653 3654 #include <common> 3655 3656 void main() { 3657 3658 vec3 outputDirection = normalize( vOutputDirection ); 3659 vec2 uv = equirectUv( outputDirection ); 3660
3661 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3662 3663 } 3664 `,blending:vn,depthTest:!1,depthWrite:!1})}function dc(){return new Je({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:co(),fragmentShader:` 3665 3666 precision mediump float; 3667 precision mediump int; 3668 3669 uniform float flipEnvMap; 3670 3671 varying vec3 vOutputDirection; 3672 3673 uniform samplerCube envMap; 3674 3675 void main() { 3676 3677 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3678 3679 } 3680 `,blending:vn,depthTest:!1,depthWrite:!1})}function co(){return` 3681 3682 precision mediump float; 3683 precision mediump int; 3684 3685 attribute float faceIndex; 3686 3687 varying vec3 vOutputDirection; 3688 3689 // RH coordinate system; PMREM face-indexing convention 3690 vec3 getDirection( vec2 uv, float face ) { 3691 3692 uv = 2.0 * uv - 1.0; 3693 3694 vec3 direction = vec3( uv, 1.0 ); 3695 3696 if ( face == 0.0 ) { 3697 3698 direction = direction.zyx; // ( 1, v, u ) pos x 3699 3700 } else if ( face == 1.0 ) { 3701 3702 direction = direction.xzy; 3703 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3704 3705 } else if ( face == 2.0 ) { 3706 3707 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3708 3709 } else if ( face == 3.0 ) { 3710 3711 direction = direction.zyx; 3712 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3713 3714 } else if ( face == 4.0 ) { 3715 3716 direction = direction.xzy; 3717 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3718 3719 } else if ( face == 5.0 ) { 3720 3721 direction.z *= -1.0; // ( u, v, -1 ) neg z 3722 3723 } 3724 3725 return direction; 3726 3727 } 3728 3729 void main() { 3730 3731 vOutputDirection = getDirection( uv, faceIndex ); 3732 gl_Position = vec4( position, 1.0 ); 3733 3734 } 3735 `}function Hf(i){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){let c=o.mapping,l=c===qr||c===Zr,h=c===xi||c===vi;if(l||h){let p=t.get(o),d=p!==void 0?p.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return e===null&&(e=new Ws(i)),p=l?e.fromEquirectangular(o,p):e.fromCubemap(o,p),p.texture.pmremVersion=o.pmremVersion,t.set(o,p),p.texture;if(p!==void 0)return p.texture;{let m=o.image;return l&&m&&m.height>0||h&&m&&s(m)?(e===null&&(e=new Ws(i)),p=l?e.fromEquirectangular(o):e.fromCubemap(o),p.texture.pmremVersion=o.pmremVersion,t.set(o,p),o.addEventListener("dispose",r),p.texture):null}}}return o}function s(o){let c=0,l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){let c=o.target;c.removeEventListener("dispose",r);let l=t.get(c);l!==void 0&&(t.delete(c),l.dispose())}function a(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:a}}function Gf(i){let t={};function e(n){if(t[n]!==void 0)return t[n];let s;switch(n){case"WEBGL_depth_texture":s=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=i.getExtension(n)}return t[n]=s,s}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){let s=e(n);return s===null&&ki("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function Wf(i,t,e,n){let s={},r=new WeakMap;function a(p){let d=p.target;d.index!==null&&t.remove(d.index);for(let _ in d.attributes)t.remove(d.attributes[_]);for(let _ in d.morphAttributes){let v=d.morphAttributes[_];for(let f=0,u=v.length;f<u;f++)t.remove(v[f])}d.removeEventListener("dispose",a),delete s[d.id];let m=r.get(d);m&&(t.remove(m),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function o(p,d){return s[d.id]===!0||(d.addEventListener("dispose",a),s[d.id]=!0,e.memory.geometries++),d}function c(p){let d=p.attributes;for(let _ in d)t.update(d[_],i.ARRAY_BUFFER);let m=p.morphAttributes;for(let _ in m){let v=m[_];for(let f=0,u=v.length;f<u;f++)t.update(v[f],i.ARRAY_BUFFER)}}function l(p){let d=[],m=p.index,_=p.attributes.position,v=0;if(m!==null){let w=m.array;v=m.version;for(let S=0,T=w.length;S<T;S+=3){let N=w[S+0],R=w[S+1],A=w[S+2];d.push(N,R,R,A,A,N)}}else if(_!==void 0){let w=_.array;v=_.version;for(let S=0,T=w.length/3-1;S<T;S+=3){let N=S+0,R=S+1,A=S+2;d.push(N,R,R,A,A,N)}}else return;let f=new(jc(d)?ks:zs)(d,1);f.version=v;let u=r.get(p);u&&t.remove(u),r.set(p,f)}function h(p){let d=r.get(p);if(d){let m=p.index;m!==null&&d.version<m.version&&l(p)}else l(p);return r.get(p)}return{get:o,update:c,getWireframeAttribute:h}}function Xf(i,t,e){let n;function s(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function c(d,m){i.drawElements(n,m,r,d*a),e.update(m,n,1)}function l(d,m,_){_!==0&&(i.drawElementsInstanced(n,m,r,d*a,_),e.update(m,n,_))}function h(d,m,_){if(_===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,r,d,0,_);let f=0;for(let u=0;u<_;u++)f+=m[u];e.update(f,n,1)}function p(d,m,_,v){if(_===0)return;let f=t.get("WEBGL_multi_draw");if(f===null)for(let u=0;u<d.length;u++)l(d[u]/a,m[u],v[u]);
vendor: 17,910 bytes, lines 3735-3769
3735else{f.multiDrawElementsInstancedWEBGL(n,m,0,r,d,0,v,0,_);let u=0;for(let w=0;w<_;w++)u+=m[w];for(let w=0;w<v.length;w++)e.update(u,n,v[w])}}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=p}function Yf(i){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(e.calls++,a){case i.TRIANGLES:e.triangles+=o*(r/3);break;case i.LINES:e.lines+=o*(r/2);break;case i.LINE_STRIP:e.lines+=o*(r-1);break;case i.LINE_LOOP:e.lines+=o*r;break;case i.POINTS:e.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:n}}function qf(i,t,e){let n=new WeakMap,s=new Jt;function r(a,o,c){let l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,p=h!==void 0?h.length:0,d=n.get(o);if(d===void 0||d.count!==p){let M=function(){F.dispose(),n.delete(o),o.removeEventListener("dispose",M)};var m=M;d!==void 0&&d.texture.dispose();let _=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,f=o.morphAttributes.color!==void 0,u=o.morphAttributes.position||[],w=o.morphAttributes.normal||[],S=o.morphAttributes.color||[],T=0;_===!0&&(T=1),v===!0&&(T=2),f===!0&&(T=3);let N=o.attributes.position.count*T,R=1;N>t.maxTextureSize&&(R=Math.ceil(N/t.maxTextureSize),N=t.maxTextureSize);let A=new Float32Array(N*R*4*p),F=new Os(A,N,R,p);F.type=sn,F.needsUpdate=!0;let b=T*4;for(let P=0;P<p;P++){let W=u[P],V=w[P],Z=S[P],q=N*R*4*P;for(let X=0;X<W.count;X++){let J=X*b;_===!0&&(s.fromBufferAttribute(W,X),A[q+J+0]=s.x,A[q+J+1]=s.y,A[q+J+2]=s.z,A[q+J+3]=0),v===!0&&(s.fromBufferAttribute(V,X),A[q+J+4]=s.x,A[q+J+5]=s.y,A[q+J+6]=s.z,A[q+J+7]=0),f===!0&&(s.fromBufferAttribute(Z,X),A[q+J+8]=s.x,A[q+J+9]=s.y,A[q+J+10]=s.z,A[q+J+11]=Z.itemSize===4?s.w:1)}}d={count:p,texture:F,size:new Tt(N,R)},n.set(o,d),o.addEventListener("dispose",M)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,e);else{let _=0;for(let f=0;f<l.length;f++)_+=l[f];let v=o.morphTargetsRelative?1:1-_;c.getUniforms().setValue(i,"morphTargetBaseInfluence",v),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",d.texture,e),c.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:r}}function Zf(i,t,e,n){let s=new WeakMap;function r(c){let l=n.render.frame,h=c.geometry,p=t.get(c,h);if(s.get(p)!==l&&(t.update(p),s.set(p,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),s.get(c)!==l&&(e.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&e.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,l))),c.isSkinnedMesh){let d=c.skeleton;s.get(d)!==l&&(d.update(),s.set(d,l))}return p}function a(){s=new WeakMap}function o(c){let l=c.target;l.removeEventListener("dispose",o),e.remove(l.instanceMatrix),l.instanceColor!==null&&e.remove(l.instanceColor)}return{update:r,dispose:a}}var Xs=class extends Gn{constructor(t,e,n,s,r,a,o,c,l,h=mi){if(h!==mi&&h!==Mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===mi&&(n=On),n===void 0&&h===Mi&&(n=yi),super(null,s,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=o!==void 0?o:Ue,this.minFilter=c!==void 0?c:Ue,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},nl=new Gn,fc=new Xs(1,1),il=new Os,sl=new Ta,rl=new Hs,pc=[],mc=[],gc=new Float32Array(16),_c=new Float32Array(9),xc=new Float32Array(4);function Ci(i,t,e){let n=i[0];if(n<=0||n>0)return i;let s=t*e,r=pc[s];if(r===void 0&&(r=new Float32Array(s),pc[s]=r),t!==0){n.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(r,o)}return r}function ue(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function de(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function ar(i,t){let e=mc[t];e===void 0&&(e=new Int32Array(t),mc[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function Jf(i,t){let e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function Kf(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ue(e,t))return;i.uniform2fv(this.addr,t),de(e,t)}}function $f(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(ue(e,t))return;i.uniform3fv(this.addr,t),de(e,t)}}function jf(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ue(e,t))return;i.uniform4fv(this.addr,t),de(e,t)}}function Qf(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(ue(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),de(e,t)}else{if(ue(e,n))return;xc.set(n),i.uniformMatrix2fv(this.addr,!1,xc),de(e,n)}}function tp(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(ue(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),de(e,t)}else{if(ue(e,n))return;_c.set(n),i.uniformMatrix3fv(this.addr,!1,_c),de(e,n)}}function ep(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(ue(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),de(e,t)}else{if(ue(e,n))return;gc.set(n),i.uniformMatrix4fv(this.addr,!1,gc),de(e,n)}}function np(i,t){let e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function ip(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ue(e,t))return;i.uniform2iv(this.addr,t),de(e,t)}}function sp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ue(e,t))return;i.uniform3iv(this.addr,t),de(e,t)}}function rp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ue(e,t))return;i.uniform4iv(this.addr,t),de(e,t)}}function ap(i,t){let e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function op(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ue(e,t))return;i.uniform2uiv(this.addr,t),de(e,t)}}function cp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ue(e,t))return;i.uniform3uiv(this.addr,t),de(e,t)}}function lp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ue(e,t))return;i.uniform4uiv(this.addr,t),de(e,t)}}function hp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(fc.compareFunction=Kc,r=fc):r=nl,e.setTexture2D(t||r,s)}function up(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture3D(t||sl,s)}function dp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTextureCube(t||rl,s)}function fp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture2DArray(t||il,s)}function pp(i){switch(i){case 5126:return Jf;case 35664:return Kf;case 35665:return $f;case 35666:return jf;case 35674:return Qf;case 35675:return tp;case 35676:return ep;case 5124:case 35670:return np;case 35667:case 35671:return ip;case 35668:case 35672:return sp;case 35669:case 35673:return rp;case 5125:return ap;case 36294:return op;case 36295:return cp;case 36296:return lp;case 35678:case 36198:case 36298:case 36306:case 35682:return hp;case 35679:case 36299:case 36307:return up;case 35680:case 36300:case 36308:case 36293:return dp;case 36289:case 36303:case 36311:case 36292:return fp}}function mp(i,t){i.uniform1fv(this.addr,t)}function gp(i,t){let e=Ci(t,this.size,2);i.uniform2fv(this.addr,e)}function _p(i,t){let e=Ci(t,this.size,3);i.uniform3fv(this.addr,e)}function xp(i,t){let e=Ci(t,this.size,4);i.uniform4fv(this.addr,e)}function vp(i,t){let e=Ci(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function yp(i,t){let e=Ci(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function Mp(i,t){let e=Ci(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Sp(i,t){i.uniform1iv(this.addr,t)}function bp(i,t){i.uniform2iv(this.addr,t)}function Ep(i,t){i.uniform3iv(this.addr,t)}function wp(i,t){i.uniform4iv(this.addr,t)}function Tp(i,t){i.uniform1uiv(this.addr,t)}function Ap(i,t){i.uniform2uiv(this.addr,t)}function Cp(i,t){i.uniform3uiv(this.addr,t)}function Rp(i,t){i.uniform4uiv(this.addr,t)}function Pp(i,t,e){let n=this.cache,s=t.length,r=ar(e,s);ue(n,r)||(i.uniform1iv(this.addr,r),de(n,r));for(let a=0;a!==s;++a)e.setTexture2D(t[a]||nl,r[a])}function Ip(i,t,e){let n=this.cache,s=t.length,r=ar(e,s);ue(n,r)||(i.uniform1iv(this.addr,r),de(n,r));for(let a=0;a!==s;++a)e.setTexture3D(t[a]||sl,r[a])}function Lp(i,t,e){let n=this.cache,s=t.length,r=ar(e,s);ue(n,r)||(i.uniform1iv(this.addr,r),de(n,r));for(let a=0;a!==s;++a)e.setTextureCube(t[a]||rl,r[a])}function Dp(i,t,e){let n=this.cache,s=t.length,r=ar(e,s);ue(n,r)||(i.uniform1iv(this.addr,r),de(n,r));for(let a=0;a!==s;++a)e.setTexture2DArray(t[a]||il,r[a])}function Up(i){switch(i){case 5126:return mp;case 35664:return gp;case 35665:return _p;case 35666:return xp;case 35674:return vp;case 35675:return yp;case 35676:return Mp;case 5124:case 35670:return Sp;case 35667:case 35671:return bp;case 35668:case 35672:return Ep;case 35669:case 35673:return wp;case 5125:return Tp;case 36294:return Ap;case 36295:return Cp;case 36296:return Rp;case 35678:case 36198:case 36298:case 36306:case 35682:return Pp;case 35679:case 36299:case 36307:return Ip;case 35680:case 36300:case 36308:case 36293:return Lp;case 36289:case 36303:case 36311:case 36292:return Dp}}var Ra=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=pp(e.type)}},Pa=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=Up(e.type)}},Ia=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){let s=this.seq;for(let r=0,a=s.length;r!==a;++r){let o=s[r];o.setValue(t,e[o.id],n)}}},Vr=/(\w+)(\])?(\[|\.)?/g;function vc(i,t){i.seq.push(t),i.map[t.id]=t}function Np(i,t,e){let n=i.name,s=n.length;for(Vr.lastIndex=0;;){let r=Vr.exec(n),a=Vr.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){vc(e,l===void 0?new Ra(o,i,t):new Pa(o,i,t));break}else{let p=e.map[o];p===void 0&&(p=new Ia(o),vc(e,p)),e=p}}}var _i=class{constructor(t,e){this.seq=[],this.map={};let n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let r=t.getActiveUniform(e,s),a=t.getUniformLocation(e,r.name);Np(r,a,this)}}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,a=e.length;r!==a;++r){let o=e[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(t,c.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let a=t[s];a.id in e&&n.push(a)}return n}};function yc(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var Op=37297,Fp=0;function Bp(i,t){let e=i.split(` 3736`),n=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let a=s;a<r;a++){let o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(` 3737`)}function zp(i){let t=Yt.getPrimaries(Yt.workingColorSpace),e=Yt.getPrimaries(i),n;switch(t===e?n="":t===Ls&&e===Is?n="LinearDisplayP3ToLinearSRGB":t===Is&&e===Ls&&(n="LinearSRGBToLinearDisplayP3"),i){case bn:case rr:return[n,"LinearTransferOETF"];case Xe:case ao:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Mc(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),s=i.getShaderInfoLog(t).trim();if(n&&s==="")return"";let r=/ERROR: 0:(\d+)/.exec(s);if(r){let a=parseInt(r[1]);return e.toUpperCase()+` 3738 3739`+s+` 3740 3741`+Bp(i.getShaderSource(t),a)}else return s}function kp(i,t){let e=zp(t);return`vec4 ${i}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function Vp(i,t){let e;switch(t){case $l:e="Linear";break;case jl:e="Reinhard";break;case Ql:e="OptimizedCineon";break;case th:e="ACESFilmic";break;case nh:e="AgX";break;case ih:e="Neutral";break;case eh:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var vs=new I;function Hp(){Yt.getLuminanceCoefficients(vs);let i=vs.x.toFixed(4),t=vs.y.toFixed(4),e=vs.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` 3742`)}function Gp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fi).join(` 3743`)}function Wp(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` 3744`)}function Xp(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(t,s),a=r.name,o=1;r.type===i.FLOAT_MAT2&&(o=2),r.type===i.FLOAT_MAT3&&(o=3),r.type===i.FLOAT_MAT4&&(o=4),e[a]={type:r.type,location:i.getAttribLocation(t,a),locationSize:o}}return e}function Fi(i){return i!==""}function Sc(i,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function bc(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Yp=/^[ \t]*#include +<([\w\d./]+)>/gm;function La(i){return i.replace(Yp,Zp)}var qp=new Map;function Zp(i,t){let e=Dt[t];if(e===void 0){let n=qp.get(t);if(n!==void 0)e=Dt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return La(e)}var Jp=/#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 Ec(i){return i.replace(Jp,Kp)}function Kp(i,t,e,n){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function wc(i){let t=`precision ${i.precision} float; 3745 precision ${i.precision} int; 3746 precision ${i.precision} sampler2D; 3747 precision ${i.precision} samplerCube; 3748 precision ${i.precision} sampler3D; 3749 precision ${i.precision} sampler2DArray; 3750 precision ${i.precision} sampler2DShadow; 3751 precision ${i.precision} samplerCubeShadow; 3752 precision ${i.precision} sampler2DArrayShadow; 3753 precision ${i.precision} isampler2D; 3754 precision ${i.precision} isampler3D; 3755 precision ${i.precision} isamplerCube; 3756 precision ${i.precision} isampler2DArray; 3757 precision ${i.precision} usampler2D; 3758 precision ${i.precision} usampler3D; 3759 precision ${i.precision} usamplerCube; 3760 precision ${i.precision} usampler2DArray; 3761 `;return i.precision==="highp"?t+=` 3762#define HIGH_PRECISION`:i.precision==="mediump"?t+=` 3763#define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=` 3764#define LOW_PRECISION`),t}function $p(i){let t="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Fc?t="SHADOWMAP_TYPE_PCF":i.shadowMapType===Qa?t="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===nn&&(t="SHADOWMAP_TYPE_VSM"),t}function jp(i){let t="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case xi:case vi:t="ENVMAP_TYPE_CUBE";break;case sr:t="ENVMAP_TYPE_CUBE_UV";break}return t}function Qp(i){let t="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case vi:t="ENVMAP_MODE_REFRACTION";break}return t}function tm(i){let t="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Bc:t="ENVMAP_BLENDING_MULTIPLY";break;case Jl:t="ENVMAP_BLENDING_MIX";break;case Kl:t="ENVMAP_BLENDING_ADD";break}return t}function em(i){let t=i.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function nm(i,t,e,n){let s=i.getContext(),r=e.defines,a=e.vertexShader,o=e.fragmentShader,c=$p(e),l=jp(e),h=Qp(e),p=tm(e),d=em(e),m=Gp(e),_=Wp(r),v=s.createProgram(),f,u,w=e.glslVersion?"#version "+e.glslVersion+` 3765`:"";e.isRawShaderMaterial?(f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,_].filter(Fi).join(` 3766`),f.length>0&&(f+=` 3767`),u=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,_].filter(Fi).join(` 3768`),u.length>0&&(u+=` 3769`)):(f=[wc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,_,e.extensionCl
vendor: 6,400 bytes, lines 3769-3771
3769ipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+c:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",` 3770`].filter(Fi).join(` 3771`),u=[wc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,_,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+l:"",e.envMap?"#define "+h:"",e.envMap?"#define "+p:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IR
3771IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+c:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==yn?"#define TONE_MAPPING":"",e.toneMapping!==yn?Dt.tonemapping_pars_fragment:"",e.toneMapping!==yn?Vp("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Dt.colorspace_pars_fragment,kp("linearToOutputTexel",e.outputColorSpace),Hp(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` 3772`].filter(Fi).join(` 3773`)),a=La(a),a=Sc(a,e),a=bc(a,e),o=La(o),o=Sc(o,e),o=bc(o,e),a=Ec(a),o=Ec(o),e.isRawShaderMaterial!==!0&&(w=`#version 300 es 3774`,f=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3775`)+` 3776`+f,u=["#define varying in",e.glslVersion===ko?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===ko?"":"#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(` 3777`)+` 3778`+u);let S=w+f+a,T=w+u+o,N=yc(s,s.VERTEX_SHADER,S),R=yc(s,s.FRAGMENT_SHADER,T);s.attachShader(v,N),s.attachShader(v,R),e.index0AttributeName!==void 0?s.bindAttribLocation(v,0,e.index0AttributeName):e.morphTargets===!0&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v);function A(P){if(i.debug.checkShaderErrors){let W=s.getProgramInfoLog(v).trim(),V=s.getShaderInfoLog(N).trim(),Z=s.getShaderInfoLog(R).trim(),q=!0,X=!0;if(s.getProgramParameter(v,s.LINK_STATUS)===!1)if(q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,v,N,R);else{let J=Mc(s,N,"vertex"),G=Mc(s,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(v,s.VALIDATE_STATUS)+` 3779 3780Material Name: `+P.name+` 3781Material Type: `+P.type+` 3782 3783Program Info Log: `+W+` 3784`+J+` 3785`+G)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(V===""||Z==="")&&(X=!1);X&&(P.diagnostics={runnable:q,programLog:W,vertexShader:{log:V,prefix:f},fragmentShader:{log:Z,prefix:u}})}s.deleteShader(N),s.deleteShader(R),F=new _i(s,v),b=Xp(s,v)}let F;this.getUniforms=function(){return F===void 0&&A(this),F};let b;this.getAttributes=function(){return b===void 0&&A(this),b};let M=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=s.getProgramParameter(v,Op)),M},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(v),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Fp++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=N,this.fragmentShader=R,this}var im=0,Da=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,n=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Ua(t),e.set(t,n)),n}},Ua=class{constructor(t){this.id=im++,this.code=t,this.usedTimes=0}};function sm(i,t,e,n,s,r,a){let o=new Fs,c=new Da,l=new Set,h=[],p=s.logarithmicDepthBuffer,d=s.vertexTextures,m=s.precision,_={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(b){return l.add(b),b===0?"uv":`uv${b}`}function f(b,M,P,W,V){let Z=W.fog,q=V.geometry,X=b.isMeshStandardMaterial?W.environment:null,J=(b.isMeshStandardMaterial?e:t).get(b.envMap||X),G=J&&J.mapping===sr?J.image.height:null,rt=_[b.type];b.precision!==null&&(m=s.getMaxPrecision(b.precision),m!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",m,"instead."));let lt=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,pt=lt!==void 0?lt.length:0,Ft=0;q.morphAttributes.position!==void 0&&(Ft=1),q.morphAttributes.normal!==void 0&&(Ft=2),q.morphAttributes.color!==void 0&&(Ft=3);let Vt,Y,tt,dt;if(rt){let zt=Ye[rt];Vt=zt.vertexShader,Y=zt.fragmentShader}else Vt=b.vertexShader,Y=b.fragmentShader,c.update(b),tt=c.getVertexShaderID(b),dt=c.getFragmentShaderID(b);let ht=i.getRenderTarget(),Pt=V.isInstancedMesh===!0,Lt=V.isBatchedMesh===!0,Nt=!!b.map,qt=!!b.matcap,C=!!J,$t=!!b.aoMap,kt=!!b.lightMap,Ht=!!b.bumpMap,gt
vendor: 18,010 bytes, lines 3785-3791
3785=!!b.normalMap,jt=!!b.displacementMap,At=!!b.emissiveMap,Rt=!!b.metalnessMap,E=!!b.roughnessMap,x=b.anisotropy>0,k=b.clearcoat>0,$=b.dispersion>0,Q=b.iridescence>0,K=b.sheen>0,vt=b.transmission>0,it=x&&!!b.anisotropyMap,ot=k&&!!b.clearcoatMap,It=k&&!!b.clearcoatNormalMap,et=k&&!!b.clearcoatRoughnessMap,ct=Q&&!!b.iridescenceMap,Bt=Q&&!!b.iridescenceThicknessMap,Mt=K&&!!b.sheenColorMap,ut=K&&!!b.sheenRoughnessMap,bt=!!b.specularMap,Ct=!!b.specularColorMap,Kt=!!b.specularIntensityMap,g=vt&&!!b.transmissionMap,U=vt&&!!b.thicknessMap,O=!!b.gradientMap,H=!!b.alphaMap,j=b.alphaTest>0,_t=!!b.alphaHash,Et=!!b.extensions,ne=yn;b.toneMapped&&(ht===null||ht.isXRRenderTarget===!0)&&(ne=i.toneMapping);let le={shaderID:rt,shaderType:b.type,shaderName:b.name,vertexShader:Vt,fragmentShader:Y,defines:b.defines,customVertexShaderID:tt,customFragmentShaderID:dt,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:m,batching:Lt,batchingColor:Lt&&V._colorsTexture!==null,instancing:Pt,instancingColor:Pt&&V.instanceColor!==null,instancingMorph:Pt&&V.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ht===null?i.outputColorSpace:ht.isXRRenderTarget===!0?ht.texture.colorSpace:bn,alphaToCoverage:!!b.alphaToCoverage,map:Nt,matcap:qt,envMap:C,envMapMode:C&&J.mapping,envMapCubeUVHeight:G,aoMap:$t,lightMap:kt,bumpMap:Ht,normalMap:gt,displacementMap:d&&jt,emissiveMap:At,normalMapObjectSpace:gt&&b.normalMapType===oh,normalMapTangentSpace:gt&&b.normalMapType===Jc,metalnessMap:Rt,roughnessMap:E,anisotropy:x,anisotropyMap:it,clearcoat:k,clearcoatMap:ot,clearcoatNormalMap:It,clearcoatRoughnessMap:et,dispersion:$,iridescence:Q,iridescenceMap:ct,iridescenceThicknessMap:Bt,sheen:K,sheenColorMap:Mt,sheenRoughnessMap:ut,specularMap:bt,specularColorMap:Ct,specularIntensityMap:Kt,transmission:vt,transmissionMap:g,thicknessMap:U,gradientMap:O,opaque:b.transparent===!1&&b.blending===pi&&b.alphaToCoverage===!1,alphaMap:H,alphaTest:j,alphaHash:_t,combine:b.combine,mapUv:Nt&&v(b.map.channel),aoMapUv:$t&&v(b.aoMap.channel),lightMapUv:kt&&v(b.lightMap.channel),bumpMapUv:Ht&&v(b.bumpMap.channel),normalMapUv:gt&&v(b.normalMap.channel),displacementMapUv:jt&&v(b.displacementMap.channel),emissiveMapUv:At&&v(b.emissiveMap.channel),metalnessMapUv:Rt&&v(b.metalnessMap.channel),roughnessMapUv:E&&v(b.roughnessMap.channel),anisotropyMapUv:it&&v(b.anisotropyMap.channel),clearcoatMapUv:ot&&v(b.clearcoatMap.channel),clearcoatNormalMapUv:It&&v(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&v(b.clearcoatRoughnessMap.channel),iridescenceMapUv:ct&&v(b.iridescenceMap.channel),iridescenceThicknessMapUv:Bt&&v(b.iridescenceThicknessMap.channel),sheenColorMapUv:Mt&&v(b.sheenColorMap.channel),sheenRoughnessMapUv:ut&&v(b.sheenRoughnessMap.channel),specularMapUv:bt&&v(b.specularMap.channel),specularColorMapUv:Ct&&v(b.specularColorMap.channel),specularIntensityMapUv:Kt&&v(b.specularIntensityMap.channel),transmissionMapUv:g&&v(b.transmissionMap.channel),thicknessMapUv:U&&v(b.thicknessMap.channel),alphaMapUv:H&&v(b.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(gt||x),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!q.attributes.uv&&(Nt||H),fog:!!Z,useFog:b.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:V.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:pt,morphTextureStride:Ft,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:i.shadowMap.enabled&&P.length>0,shadowMapType:i.shadowMap.type,toneMapping:ne,decodeVideoTexture:Nt&&b.map.isVideoTexture===!0&&Yt.getTransfer(b.map.colorSpace)===Zt,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===De,flipSided:b.side===be,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Et&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Et&&b.extensions.multiDraw===!0||Lt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return le.vertexUv1s=l.has(1),le.vertexUv2s=l.has(2),le.vertexUv3s=l.has(3),l.clear(),le}function u(b){let M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(let P in b.defines)M.push(P),M.push(b.defines[P]);return b.isRawShaderMaterial===!1&&(w(M,b),S(M,b),M.push(i.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function w(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function S(b,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),b.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.doubleSided&&o.enable(10),M.flipSided&&o.enable(11),M.useDepthPacking&&o.enable(12),M.dithering&&o.enable(13),M.transmission&&o.enable(14),M.sheen&&o.enable(15),M.opaque&&o.enable(16),M.pointsUvs&&o.enable(17),M.decodeVideoTexture&&o.enable(18),M.alphaToCoverage&&o.enable(19),b.push(o.mask)}function T(b){let M=_[b.type],P;if(M){let W=Ye[M];P=qh.clone(W.uniforms)}else P=b.uniforms;return P}function N(b,M){let P;for(let W=0,V=h.length;W<V;W++){let Z=h[W];if(Z.cacheKey===M){P=Z,++P.usedTimes;break}}return P===void 0&&(P=new nm(i,M,b,r),h.push(P)),P}function R(b){if(--b.usedTimes===0){let M=h.indexOf(b);h[M]=h[h.length-1],h.pop(),b.destroy()}}function A(b){c.remove(b)}function F(){c.dispose()}return{getParameters:f,getProgramCacheKey:u,getUniforms:T,acquireProgram:N,releaseProgram:R,releaseShaderCache:A,programs:h,dispose:F}}function rm(){let i=new WeakMap;function t(r){let a=i.get(r);return a===void 0&&(a={},i.set(r,a)),a}function e(r){i.delete(r)}function n(r,a,o){i.get(r)[a]=o}function s(){i=new WeakMap}return{get:t,remove:e,update:n,dispose:s}}function am(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.z!==t.z?i.z-t.z:i.id-t.id}function Tc(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function Ac(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function a(p,d,m,_,v,f){let u=i[t];return u===void 0?(u={id:p.id,object:p,geometry:d,material:m,groupOrder:_,renderOrder:p.renderOrder,z:v,group:f},i[t]=u):(u.id=p.id,u.object=p,u.geometry=d,u.material=m,u.groupOrder=_,u.renderOrder=p.renderOrder,u.z=v,u.group=f),t++,u}function o(p,d,m,_,v,f){let u=a(p,d,m,_,v,f);m.transmission>0?n.push(u):m.transparent===!0?s.push(u):e.push(u)}function c(p,d,m,_,v,f){let u=a(p,d,m,_,v,f);m.transmission>0?n.unshift(u):m.transparent===!0?s.unshift(u):e.unshift(u)}function l(p,d){e.length>1&&e.sort(p||am),n.length>1&&n.sort(d||Tc),s.length>1&&s.sort(d||Tc)}function h(){for(let p=t,d=i.length;p<d;p++){let m=i[p];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:e,transmissive:n,transparent:s,init:r,push:o,unshift:c,finish:h,sort:l}}function om(){let i=new WeakMap;function t(n,s){let r=i.get(n),a;return r===void 0?(a=new Ac,i.set(n,[a])):s>=r.length?(a=new Ac,r.push(a)):a=r[s],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function cm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new I,color:new Ot};break;case"SpotLight":e={position:new I,direction:new I,color:new Ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new I,color:new Ot,distance:0,decay:0};break;case"HemisphereLight":e={direction:new I,skyColor:new Ot,groundColor:new Ot};break;case"RectAreaLight":e={color:new Ot,position:new I,halfWidth:new I,halfHeight:new I};break}return i[t.id]=e,e}}}function lm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var hm=0;function um(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function dm(i){let t=new cm,e=lm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new I);let s=new I,r=new ee,a=new ee;function o(l){let h=0,p=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let m=0,_=0,v=0,f=0,u=0,w=0,S=0,T=0,N=0,R=0,A=0;l.sort(um);for(let b=0,M=l.length;b<M;b++){let P=l[b],W=P.color,V=P.intensity,Z=P.distance,q=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)h+=W.r*V,p+=W.g*V,d+=W.b*V;else if(P.isLightProbe){for(let X=0;X<9;X++)n.probe[X].addScaledVector(P.sh.coefficients[X],V);A++}else if(P.isDirectionalLight){let X=t.get(P);if(X.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){let J=P.shadow,G=e.get(P);G.shadowIntensity=J.intensity,G.shadowBias=J.bias,G.shadowNormalBias=J.normalBias,G.shadowRadius=J.radius,G.shadowMapSize=J.mapSize,n.directionalShadow[m]=G,n.directionalShadowMap[m]=q,n.directionalShadowMatrix[m]=P.shadow.matrix,w++}n.directional[m]=X,m++}else if(P.isSpotLight){let X=t.get(P);X.position.setFromMatrixPosition(P.matrixWorld),X.color.copy(W).multiplyScalar(V),X.distance=Z,X.coneCos=Math.cos(P.angle),X.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),X.decay=P.decay,n.spot[v]=X;let J=P.shadow;if(P.map&&(n.spotLightMap[N]=P.map,N++,J.updateMatrices(P),P.castShadow&&R++),n.spotLightMatrix[v]=J.matrix,P.castShadow){let G=e.get(P);G.shadowIntensity=J.intensity,G.shadowBias=J.bias,G.shadowNormalBias=J.normalBias,G.shadowRadius=J.radius,G.shadowMapSize=J.mapSize,n.spotShadow[v]=G,n.spotShadowMap[v]=q,T++}v++}else if(P.isRectAreaLight){let X=t.get(P);X.color.copy(W).multiplyScalar(V),X.halfWidth.set(P.width*.5,0,0),X.halfHeight.set(0,P.height*.5,0),n.rectArea[f]=X,f++}else if(P.isPointLight){let X=t.get(P);if(X.color.copy(P.color).multiplyScalar(P.intensity),X.distance=P.distance,X.decay=P.decay,P.castShadow){let J=P.shadow,G=e.get(P);G.shadowIntensity=J.intensity,G.shadowBias=J.bias,G.shadowNormalBias=J.normalBias,G.shadowRadius=J.radius,G.shadowMapSize=J.mapSize,G.shadowCameraNear=J.camera.near,G.shadowCameraFar=J.camera.far,n.pointShadow[_]=G,n.pointShadowMap[_]=q,n.pointShadowMatrix[_]=P.shadow.matrix,S++}n.point[_]=X,_++}else if(P.isHemisphereLight){let X=t.get(P);X.skyColor.copy(P.color).multiplyScalar(V),X.groundColor.copy(P.groundColor).multiplyScalar(V),n.hemi[u]=X,u++}}f>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=st.LTC_FLOAT_1,n.rectAreaLTC2=st.LTC_FLOAT_2):(n.rectAreaLTC1=st.LTC_HALF_1,n.rectAreaLTC2=st.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=d;let F=n.hash;(F.directionalLength!==m||F.pointLength!==_||F.spotLength!==v||F.rectAreaLength!==f||F.hemiLength!==u||F.numDirectionalShadows!==w||F.numPointShadows!==S||F.numSpotShadows!==T||F.numSpotMaps!==N||F.numLightProbes!==A)&&(n.directional.length=m,n.spot.length=v,n.rectArea.length=f,n.point.length=_,n.hemi.length=u,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=T+N-R,n.spotLightMap.length=N,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=A,F.directionalLength=m,F.pointLength=_,F.spotLength=v,F.rectAreaLength=f,F.hemiLength=u,F.numDirectionalShadows=w,F.numPointShadows=S,F.numSpotShadows=T,F.numSpotMaps=N,F.numLightProbes=A,n.version=hm++)}function c(l,h){let p=0,d=0,m=0,_=0,v=0,f=h.matrixWorldInverse;for(let u=0,w=l.length;u<w;u++){let S=l[u];if(S.isDirectionalLight){let T=n.directional[p];T.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(f),p++}else if(S.isSpotLight){let T=n.spot[m];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(f),T.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(f),m++}else if(S.isRectAreaLight){let T=n.rectArea[_];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(f),a.identity(),r.copy(S.matrixWorld),r.premultiply(f),a.extractRotation(r),T.halfWidth.set(S.width*.5,0,0),T.halfHeight.set(0,S.height*.5,0),T.halfWidth.applyMatrix4(a),T.halfHeight.applyMatrix4(a),_++}else if(S.isPointLight){let T=n.point[d];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(f),d++}else if(S.isHemisphereLight){let T=n.hemi[v];T.direction.setFromMatrixPosition(S.matrixWorld),T.direction.transformDirection(f),v++}}}return{setup:o,setupView:c,state:n}}function Cc(i){let t=new dm(i),e=[],n=[];function s(h){l.camera=h,e.length=0,n.length=0}function r(h){e.push(h)}function a(h){n.push(h)}function o(){t.setup(e)}function c(h){t.setupView(e,h)}let l={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:s,state:l,setupLights:o,setupLightsView:c,pushLight:r,pushShadow:a}}function fm(i){let t=new WeakMap;function e(s,r=0){let a=t.get(s),o;return a===void 0?(o=new Cc(i),t.set(s,[o])):r>=a.length?(o=new Cc(i),a.push(o)):o=a[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}var Na=class extends Sn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=rh,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Oa=class extends Sn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},pm=`void main() { 3786 gl_Position = vec4( position, 1.0 ); 3787}`,mm=`uniform sampler2D shadow_pass; 3788uniform vec2 resolution; 3789uniform float radius; 3790#include <packing> 3791void main() {
3792 const float samples = float( VSM_SAMPLES ); 3793 float mean = 0.0; 3794 float squared_mean = 0.0; 3795 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3796 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3797 for ( float i = 0.0; i < samples; i ++ ) { 3798 float uvOffset = uvStart + i * uvStride; 3799 #ifdef HORIZONTAL_PASS 3800 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3801 mean += distribution.x; 3802 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3803 #else 3804 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3805 mean += depth; 3806 squared_mean += depth * depth; 3807 #endif 3808 } 3809 mean = mean / samples; 3810 squared_mean = squared_mean / samples; 3811 float std_dev = sqrt( squared_mean - mean * mean ); 3812 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3813}`;function gm(i,t,e){let n=new Xi,s=new Tt,r=new Tt,a=new Jt,o=new Na({depthPacking:ah}),c=new Oa,l={},h=e.maxTextureSize,p={[Mn]:be,[be]:Mn,[De]:De},d=new Je({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Tt},radius:{value:4}},vertexShader:pm,fragmentShader:mm}),m=d.clone();m.defines.HORIZONTAL_PASS=1;let _=new cn;_.setAttribute("position",new Ne(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new Re(_,d),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Fc;let u=this.type;this.render=function(R,A,F){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||R.length===0)return;let b=i.getRenderTarget(),M=i.getActiveCubeFace(),P=i.getActiveMipmapLevel(),W=i.state;W.setBlending(vn),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);let V=u!==nn&&this.type===nn,Z=u===nn&&this.type!==nn;for(let q=0,X=R.length;q<X;q++){let J=R[q],G=J.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);let rt=G.getFrameExtents();if(s.multiply(rt),r.copy(G.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/rt.x),s.x=r.x*rt.x,G.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/rt.y),s.y=r.y*rt.y,G.mapSize.y=r.y)),G.map===null||V===!0||Z===!0){let pt=this.type!==nn?{minFilter:Ue,magFilter:Ue}:{};G.map!==null&&G.map.dispose(),G.map=new on(s.x,s.y,pt),G.map.texture.name=J.name+".shadowMap",G.camera.updateProjectionMatrix()}i.setRenderTarget(G.map),i.clear();let lt=G.getViewportCount();for(let pt=0;pt<lt;pt++){let Ft=G.getViewport(pt);a.set(r.x*Ft.x,r.y*Ft.y,r.x*Ft.z,r.y*Ft.w),W.viewport(a),G.updateMatrices(J,pt),n=G.getFrustum(),T(A,F,G.camera,J,this.type)}G.isPointLightShadow!==!0&&this.type===nn&&w(G,F),G.needsUpdate=!1}
vendor: 7,777 bytes, line 3813
3813u=this.type,f.needsUpdate=!1,i.setRenderTarget(b,M,P)};function w(R,A){let F=t.update(v);d.defines.VSM_SAMPLES!==R.blurSamples&&(d.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,d.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new on(s.x,s.y)),d.uniforms.shadow_pass.value=R.map.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,i.setRenderTarget(R.mapPass),i.clear(),i.renderBufferDirect(A,null,F,d,v,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,i.setRenderTarget(R.map),i.clear(),i.renderBufferDirect(A,null,F,m,v,null)}function S(R,A,F,b){let M=null,P=F.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(P!==void 0)M=P;else if(M=F.isPointLight===!0?c:o,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){let W=M.uuid,V=A.uuid,Z=l[W];Z===void 0&&(Z={},l[W]=Z);let q=Z[V];q===void 0&&(q=M.clone(),Z[V]=q,A.addEventListener("dispose",N)),M=q}if(M.visible=A.visible,M.wireframe=A.wireframe,b===nn?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:p[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,F.isPointLight===!0&&M.isMeshDistanceMaterial===!0){let W=i.properties.get(M);W.light=F}return M}function T(R,A,F,b,M){if(R.visible===!1)return;if(R.layers.test(A.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&M===nn)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,R.matrixWorld);let V=t.update(R),Z=R.material;if(Array.isArray(Z)){let q=V.groups;for(let X=0,J=q.length;X<J;X++){let G=q[X],rt=Z[G.materialIndex];if(rt&&rt.visible){let lt=S(R,rt,b,M);R.onBeforeShadow(i,R,A,F,V,lt,G),i.renderBufferDirect(F,null,V,lt,R,G),R.onAfterShadow(i,R,A,F,V,lt,G)}}}else if(Z.visible){let q=S(R,Z,b,M);R.onBeforeShadow(i,R,A,F,V,q,null),i.renderBufferDirect(F,null,V,q,R,null),R.onAfterShadow(i,R,A,F,V,q,null)}}let W=R.children;for(let V=0,Z=W.length;V<Z;V++)T(W[V],A,F,b,M)}function N(R){R.target.removeEventListener("dispose",N);for(let F in l){let b=l[F],M=R.target.uuid;M in b&&(b[M].dispose(),delete b[M])}}}function _m(i){function t(){let g=!1,U=new Jt,O=null,H=new Jt(0,0,0,0);return{setMask:function(j){O!==j&&!g&&(i.colorMask(j,j,j,j),O=j)},setLocked:function(j){g=j},setClear:function(j,_t,Et,ne,le){le===!0&&(j*=ne,_t*=ne,Et*=ne),U.set(j,_t,Et,ne),H.equals(U)===!1&&(i.clearColor(j,_t,Et,ne),H.copy(U))},reset:function(){g=!1,O=null,H.set(-1,0,0,0)}}}function e(){let g=!1,U=null,O=null,H=null;return{setTest:function(j){j?dt(i.DEPTH_TEST):ht(i.DEPTH_TEST)},setMask:function(j){U!==j&&!g&&(i.depthMask(j),U=j)},setFunc:function(j){if(O!==j){switch(j){case Hl:i.depthFunc(i.NEVER);break;case Gl:i.depthFunc(i.ALWAYS);break;case Wl:i.depthFunc(i.LESS);break;case Cs:i.depthFunc(i.LEQUAL);break;case Xl:i.depthFunc(i.EQUAL);break;case Yl:i.depthFunc(i.GEQUAL);break;case ql:i.depthFunc(i.GREATER);break;case Zl:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}O=j}},setLocked:function(j){g=j},setClear:function(j){H!==j&&(i.clearDepth(j),H=j)},reset:function(){g=!1,U=null,O=null,H=null}}}function n(){let g=!1,U=null,O=null,H=null,j=null,_t=null,Et=null,ne=null,le=null;return{setTest:function(zt){g||(zt?dt(i.STENCIL_TEST):ht(i.STENCIL_TEST))},setMask:function(zt){U!==zt&&!g&&(i.stencilMask(zt),U=zt)},setFunc:function(zt,he,se){(O!==zt||H!==he||j!==se)&&(i.stencilFunc(zt,he,se),O=zt,H=he,j=se)},setOp:function(zt,he,se){(_t!==zt||Et!==he||ne!==se)&&(i.stencilOp(zt,he,se),_t=zt,Et=he,ne=se)},setLocked:function(zt){g=zt},setClear:function(zt){le!==zt&&(i.clearStencil(zt),le=zt)},reset:function(){g=!1,U=null,O=null,H=null,j=null,_t=null,Et=null,ne=null,le=null}}}let s=new t,r=new e,a=new n,o=new WeakMap,c=new WeakMap,l={},h={},p=new WeakMap,d=[],m=null,_=!1,v=null,f=null,u=null,w=null,S=null,T=null,N=null,R=new Ot(0,0,0),A=0,F=!1,b=null,M=null,P=null,W=null,V=null,Z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),q=!1,X=0,J=i.getParameter(i.VERSION);J.indexOf("WebGL")!==-1?(X=parseFloat(/^WebGL (\d)/.exec(J)[1]),q=X>=1):J.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),q=X>=2);let G=null,rt={},lt=i.getParameter(i.SCISSOR_BOX),pt=i.getParameter(i.VIEWPORT),Ft=new Jt().fromArray(lt),Vt=new Jt().fromArray(pt);function Y(g,U,O,H){let j=new Uint8Array(4),_t=i.createTexture();i.bindTexture(g,_t),i.texParameteri(g,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(g,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Et=0;Et<O;Et++)g===i.TEXTURE_3D||g===i.TEXTURE_2D_ARRAY?i.texImage3D(U,0,i.RGBA,1,1,H,0,i.RGBA,i.UNSIGNED_BYTE,j):i.texImage2D(U+Et,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,j);return _t}let tt={};tt[i.TEXTURE_2D]=Y(i.TEXTURE_2D,i.TEXTURE_2D,1),tt[i.TEXTURE_CUBE_MAP]=Y(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),tt[i.TEXTURE_2D_ARRAY]=Y(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),tt[i.TEXTURE_3D]=Y(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),r.setClear(1),a.setClear(0),dt(i.DEPTH_TEST),r.setFunc(Cs),Ht(!1),gt(Po),dt(i.CULL_FACE),$t(vn);function dt(g){l[g]!==!0&&(i.enable(g),l[g]=!0)}function ht(g){l[g]!==!1&&(i.disable(g),l[g]=!1)}function Pt(g,U){return h[g]!==U?(i.bindFramebuffer(g,U),h[g]=U,g===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=U),g===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=U),!0):!1}function Lt(g,U){let O=d,H=!1;if(g){O=p.get(U),O===void 0&&(O=[],p.set(U,O));let j=g.textures;if(O.length!==j.length||O[0]!==i.COLOR_ATTACHMENT0){for(let _t=0,Et=j.length;_t<Et;_t++)O[_t]=i.COLOR_ATTACHMENT0+_t;O.length=j.length,H=!0}}else O[0]!==i.BACK&&(O[0]=i.BACK,H=!0);H&&i.drawBuffers(O)}function Nt(g){return m!==g?(i.useProgram(g),m=g,!0):!1}let qt={[Ln]:i.FUNC_ADD,[wl]:i.FUNC_SUBTRACT,[Tl]:i.FUNC_REVERSE_SUBTRACT};qt[Al]=i.MIN,qt[Cl]=i.MAX;let C={[Rl]:i.ZERO,[Pl]:i.ONE,[Il]:i.SRC_COLOR,[Xr]:i.SRC_ALPHA,[Fl]:i.SRC_ALPHA_SATURATE,[Nl]:i.DST_COLOR,[Dl]:i.DST_ALPHA,[Ll]:i.ONE_MINUS_SRC_COLOR,[Yr]:i.ONE_MINUS_SRC_ALPHA,[Ol]:i.ONE_MINUS_DST_COLOR,[Ul]:i.ONE_MINUS_DST_ALPHA,[Bl]:i.CONSTANT_COLOR,[zl]:i.ONE_MINUS_CONSTANT_COLOR,[kl]:i.CONSTANT_ALPHA,[Vl]:i.ONE_MINUS_CONSTANT_ALPHA};function $t(g,U,O,H,j,_t,Et,ne,le,zt){if(g===vn){_===!0&&(ht(i.BLEND),_=!1);return}if(_===!1&&(dt(i.BLEND),_=!0),g!==El){if(g!==v||zt!==F){if((f!==Ln||S!==Ln)&&(i.blendEquation(i.FUNC_ADD),f=Ln,S=Ln),zt)switch(g){case pi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Io:i.blendFunc(i.ONE,i.ONE);break;case Lo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Do:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}else switch(g){case pi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Io:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Lo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Do:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}u=null,w=null,T=null,N=null,R.set(0,0,0),A=0,v=g,F=zt}return}j=j||U,_t=_t||O,Et=Et||H,(U!==f||j!==S)&&(i.blendEquationSeparate(qt[U],qt[j]),f=U,S=j),(O!==u||H!==w||_t!==T||Et!==N)&&(i.blendFuncSeparate(C[O],C[H],C[_t],C[Et]),u=O,w=H,T=_t,N=Et),(ne.equals(R)===!1||le!==A)&&(i.blendColor
vendor: 1,071 bytes, line 3813
3813(ne.r,ne.g,ne.b,le),R.copy(ne),A=le),v=g,F=!1}function kt(g,U){g.side===De?ht(i.CULL_FACE):dt(i.CULL_FACE);let O=g.side===be;U&&(O=!O),Ht(O),g.blending===pi&&g.transparent===!1?$t(vn):$t(g.blending,g.blendEquation,g.blendSrc,g.blendDst,g.blendEquationAlpha,g.blendSrcAlpha,g.blendDstAlpha,g.blendColor,g.blendAlpha,g.premultipliedAlpha),r.setFunc(g.depthFunc),r.setTest(g.depthTest),r.setMask(g.depthWrite),s.setMask(g.colorWrite);let H=g.stencilWrite;a.setTest(H),H&&(a.setMask(g.stencilWriteMask),a.setFunc(g.stencilFunc,g.stencilRef,g.stencilFuncMask),a.setOp(g.stencilFail,g.stencilZFail,g.stencilZPass)),At(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits),g.alphaToCoverage===!0?dt(i.SAMPLE_ALPHA_TO_COVERAGE):ht(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ht(g){b!==g&&(g?i.frontFace(i.CW):i.frontFace(i.CCW),b=g)}function gt(g){g!==Sl?(dt(i.CULL_FACE),g!==M&&(g===Po?i.cullFace(i.BACK):g===bl?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ht(i.CULL_FACE),M=g}function jt(g){g!==P&&(q&&i.lineWidth(g),P=g)}function At(g,U,O){g?(dt(i.POLYGON_OFFSET_FILL),(W
vendor: 23,013 bytes, line 3813
3813!==U||V!==O)&&(i.polygonOffset(U,O),W=U,V=O)):ht(i.POLYGON_OFFSET_FILL)}function Rt(g){g?dt(i.SCISSOR_TEST):ht(i.SCISSOR_TEST)}function E(g){g===void 0&&(g=i.TEXTURE0+Z-1),G!==g&&(i.activeTexture(g),G=g)}function x(g,U,O){O===void 0&&(G===null?O=i.TEXTURE0+Z-1:O=G);let H=rt[O];H===void 0&&(H={type:void 0,texture:void 0},rt[O]=H),(H.type!==g||H.texture!==U)&&(G!==O&&(i.activeTexture(O),G=O),i.bindTexture(g,U||tt[g]),H.type=g,H.texture=U)}function k(){let g=rt[G];g!==void 0&&g.type!==void 0&&(i.bindTexture(g.type,null),g.type=void 0,g.texture=void 0)}function $(){try{i.compressedTexImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Q(){try{i.compressedTexImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function K(){try{i.texSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function vt(){try{i.texSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function it(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ot(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function It(){try{i.texStorage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function et(){try{i.texStorage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ct(){try{i.texImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Bt(){try{i.texImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Mt(g){Ft.equals(g)===!1&&(i.scissor(g.x,g.y,g.z,g.w),Ft.copy(g))}function ut(g){Vt.equals(g)===!1&&(i.viewport(g.x,g.y,g.z,g.w),Vt.copy(g))}function bt(g,U){let O=c.get(U);O===void 0&&(O=new WeakMap,c.set(U,O));let H=O.get(g);H===void 0&&(H=i.getUniformBlockIndex(U,g.name),O.set(g,H))}function Ct(g,U){let H=c.get(U).get(g);o.get(U)!==H&&(i.uniformBlockBinding(U,H,g.__bindingPointIndex),o.set(U,H))}function Kt(){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),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),l={},G=null,rt={},h={},p=new WeakMap,d=[],m=null,_=!1,v=null,f=null,u=null,w=null,S=null,T=null,N=null,R=new Ot(0,0,0),A=0,F=!1,b=null,M=null,P=null,W=null,V=null,Ft.set(0,0,i.canvas.width,i.canvas.height),Vt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),r.reset(),a.reset()}return{buffers:{color:s,depth:r,stencil:a},enable:dt,disable:ht,bindFramebuffer:Pt,drawBuffers:Lt,useProgram:Nt,setBlending:$t,setMaterial:kt,setFlipSided:Ht,setCullFace:gt,setLineWidth:jt,setPolygonOffset:At,setScissorTest:Rt,activeTexture:E,bindTexture:x,unbindTexture:k,compressedTexImage2D:$,compressedTexImage3D:Q,texImage2D:ct,texImage3D:Bt,updateUBOMapping:bt,uniformBlockBinding:Ct,texStorage2D:It,texStorage3D:et,texSubImage2D:K,texSubImage3D:vt,compressedTexSubImage2D:it,compressedTexSubImage3D:ot,scissor:Mt,viewport:ut,reset:Kt}}function Rc(i,t,e,n){let s=xm(n);switch(e){case Hc:return i*t;case Wc:return i*t;case Xc:return i*t*2;case Yc:return i*t/s.components*s.byteLength;case io:return i*t/s.components*s.byteLength;case qc:return i*t*2/s.components*s.byteLength;case so:return i*t*2/s.components*s.byteLength;case Gc:return i*t*3/s.components*s.byteLength;case He:return i*t*4/s.components*s.byteLength;case ro:return i*t*4/s.components*s.byteLength;case bs:case Es:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case ws:case Ts:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case jr:case ta:return Math.max(i,16)*Math.max(t,8)/4;case $r:case Qr:return Math.max(i,8)*Math.max(t,8)/2;case ea:case na:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case ia:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case sa:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case ra:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case aa:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case oa:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case ca:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case la:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case ha:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case ua:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case da:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case fa:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case pa:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case ma:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case ga:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case _a:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case As:case xa:case va:return Math.ceil(i/4)*Math.ceil(t/4)*16;case Zc:case ya:return Math.ceil(i/4)*Math.ceil(t/4)*8;case Ma:case Sa:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function xm(i){switch(i){case an:case zc:return{byteLength:1,components:1};case Hi:case kc:case Zi:return{byteLength:2,components:1};case eo:case no:return{byteLength:2,components:4};case On:case to:case sn:return{byteLength:4,components:1};case Vc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function vm(i,t,e,n,s,r,a){let o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Tt,h=new WeakMap,p,d=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(E,x){return m?new OffscreenCanvas(E,x):Us("canvas")}function v(E,x,k){let $=1,Q=Rt(E);if((Q.width>k||Q.height>k)&&($=k/Math.max(Q.width,Q.height)),$<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){let K=Math.floor($*Q.width),vt=Math.floor($*Q.height);p===void 0&&(p=_(K,vt));let it=x?_(K,vt):p;return it.width=K,it.height=vt,it.getContext("2d").drawImage(E,0,0,K,vt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+K+"x"+vt+")."),it}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),E;return E}function f(E){return E.generateMipmaps&&E.minFilter!==Ue&&E.minFilter!==Ve}function u(E){i.generateMipmap(E)}function w(E,x,k,$,Q=!1){if(E!==null){if(i[E]!==void 0)return i[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let K=x;if(x===i.RED&&(k===i.FLOAT&&(K=i.R32F),k===i.HALF_FLOAT&&(K=i.R16F),k===i.UNSIGNED_BYTE&&(K=i.R8)),x===i.RED_INTEGER&&(k===i.UNSIGNED_BYTE&&(K=i.R8UI),k===i.UNSIGNED_SHORT&&(K=i.R16UI),k===i.UNSIGNED_INT&&(K=i.R32UI),k===i.BYTE&&(K=i.R8I),k===i.SHORT&&(K=i.R16I),k===i.INT&&(K=i.R32I)),x===i.RG&&(k===i.FLOAT&&(K=i.RG32F),k===i.HALF_FLOAT&&(K=i.RG16F),k===i.UNSIGNED_BYTE&&(K=i.RG8)),x===i.RG_INTEGER&&(k===i.UNSIGNED_BYTE&&(K=i.RG8UI),k===i.UNSIGNED_SHORT&&(K=i.RG16UI),k===i.UNSIGNED_INT&&(K=i.RG32UI),k===i.BYTE&&(K=i.RG8I),k===i.SHORT&&(K=i.RG16I),k===i.INT&&(K=i.RG32I)),x===i.RGB&&k===i.UNSIGNED_INT_5_9_9_9_REV&&(K=i.RGB9_E5),x===i.RGBA){let vt=Q?Ps:Yt.getTransfer($);k===i.FLOAT&&(K=i.RGBA32F),k===i.HALF_FLOAT&&(K=i.RGBA16F),k===i.UNSIGNED_BYTE&&(K=vt===Zt?i.SRGB8_ALPHA8:i.RGBA8),k===i.UNSIGNED_SHORT_4_4_4_4&&(K=i.RGBA4),k===i.UNSIGNED_SHORT_5_5_5_1&&(K=i.RGB5_A1)}return(K===i.R16F||K===i.R32F||K===i.RG16F||K===i.RG32F||K===i.RGBA16F||K===i.RGBA32F)&&t.get("EXT_color_buffer_float"),K}function S(E,x){let k;return E?x===null||x===On||x===yi?k=i.DEPTH24_STENCIL8:x===sn?k=i.DEPTH32F_STENCIL8:x===Hi&&(k=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===On||x===yi?k=i.DEPTH_COMPONENT24:x===sn?k=i.DEPTH_COMPONENT32F:x===Hi&&(k=i.DEPTH_COMPONENT16),k}function T(E,x){return f(E)===!0||E.isFramebufferTexture&&E.minFilter!==Ue&&E.minFilter!==Ve?Math.log2(Math.max(x.width,x.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?x.mipmaps.length:1}function N(E){let x=E.target;x.removeEventListener("dispose",N),A(x),x.isVideoTexture&&h.delete(x)}function R(E){let x=E.target;x.removeEventListener("dispose",R),b(x)}function A(E){let x=n.get(E);if(x.__webglInit===void 0)return;let k=E.source,$=d.get(k);if($){let Q=$[x.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&F(E),Object.keys($).length===0&&d.delete(k)}n.remove(E)}function F(E){let x=n.get(E);i.deleteTexture(x.__webglTexture);let k=E.source,$=d.get(k);delete $[x.__cacheKey],a.memory.textures--}function b(E){let x=n.get(E);if(E.depthTexture&&E.depthTexture.dispose(),E.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(x.__webglFramebuffer[$]))for(let Q=0;Q<x.__webglFramebuffer[$].length;Q++)i.deleteFramebuffer(x.__webglFramebuffer[$][Q]);else i.deleteFramebuffer(x.__webglFramebuffer[$]);x.__webglDepthbuffer&&i.deleteRenderbuffer(x.__webglDepthbuffer[$])}else{if(Array.isArray(x.__webglFramebuffer))for(let $=0;$<x.__webglFramebuffer.length;$++)i.deleteFramebuffer(x.__webglFramebuffer[$]);else i.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&i.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&i.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let $=0;$<x.__webglColorRenderbuffer.length;$++)x.__webglColorRenderbuffer[$]&&i.deleteRenderbuffer(x.__webglColorRenderbuffer[$]);x.__webglDepthRenderbuffer&&i.deleteRenderbuffer(x.__webglDepthRenderbuffer)}let k=E.textures;for(let $=0,Q=k.length;$<Q;$++){let K=n.get(k[$]);K.__webglTexture&&(i.deleteTexture(K.__webglTexture),a.memory.textures--),n.remove(k[$])}n.remove(E)}let M=0;function P(){M=0}function W(){let E=M;return E>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+s.maxTextures),M+=1,E}function V(E){let x=[];return x.push(E.wrapS),x.push(E.wrapT),x.push(E.wrapR||0),x.push(E.magFilter),x.push(E.minFilter),x.push(E.anisotropy),x.push(E.internalFormat),x.push(E.format),x.push(E.type),x.push(E.generateMipmaps),x.push(E.premultiplyAlpha),x.push(E.flipY),x.push(E.unpackAlignment),x.push(E.colorSpace),x.join()}function Z(E,x){let k=n.get(E);if(E.isVideoTexture&&jt(E),E.isRenderTargetTexture===!1&&E.version>0&&k.__version!==E.version){let $=E.image;if($===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Vt(k,E,x);return}}e.bindTexture(i.TEXTURE_2D,k.__webglTexture,i.TEXTURE0+x)}function q(E,x){let k=n.get(E);if(E.version>0&&k.__version!==E.version){Vt(k,E,x);return}e.bindTexture(i.TEXTURE_2D_ARRAY,k.__webglTexture,i.TEXTURE0+x)}function X(E,x){let k=n.get(E);if(E.version>0&&k.__version!==E.version){Vt(k,E,x);return}e.bindTexture(i.TEXTURE_3D,k.__webglTexture,i.TEXTURE0+x)}function J(E,x){let k=n.get(E);if(E.version>0&&k.__version!==E.version){Y(k,E,x);return}e.bindTexture(i.TEXTURE_CUBE_MAP,k.__webglTexture,i.TEXTURE0+x)}let G={[Jr]:i.REPEAT,[Un]:i.CLAMP_TO_EDGE,[Kr]:i.MIRRORED_REPEAT},rt={[Ue]:i.NEAREST,[sh]:i.NEAREST_MIPMAP_NEAREST,[ji]:i.NEAREST_MIPMAP_LINEAR,[Ve]:i.LINEAR,[gr]:i.LINEAR_MIPMAP_NEAREST,[Nn]:i.LINEAR_MIPMAP_LINEAR},lt={[ch]:i.NEVER,[ph]:i.ALWAYS,[lh]:i.LESS,[Kc]:i.LEQUAL,[hh]:i.EQUAL,[fh]:i.GEQUAL,[uh]:i.GREATER,[dh]:i.NOTEQUAL};function pt(E,x){if(x.type===sn&&t.has("OES_texture_float_linear")===!1&&(x.magFilter===Ve||x.magFilter===gr||x.magFilter===ji||x.magFilter===Nn||x.minFilter===Ve||x.minFilter===gr||x.minFilter===ji||x.minFilter===Nn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(E,i.TEXTURE_WRAP_S,G[x.wrapS]),i.texParameteri(E,i.TEXTURE_WRAP_T,G[x.wrapT]),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,G[x.wrapR]),i.texParameteri(E,i.TEXTURE_MAG_FILTER,rt[x.magFilter]),i.texParameteri(E,i.TEXTURE_MIN_FILTER,rt[x.minFilter]),x.compareFunction&&(i.texParameteri(E,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(E,i.TEXTURE_COMPARE_FUNC,lt[x.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===Ue||x.minFilter!==ji&&x.minFilter!==Nn||x.type===sn&&t.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||n.get(x).__currentAnisotropy){let k=t.get("EXT_texture_filter_anisotropic");i.texParameterf(E,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,s.getMaxAnisotropy())),n.get(x).__currentAnisotropy=x.anisotropy}}}function Ft(E,x){let k=!1;E.__webglInit===void 0&&(E.__webglInit=!0,x.addEventListener("dispose",N));let $=x.source,Q=d.get($);Q===void 0&&(Q={},d.set($,Q));let K=V(x);if(K!==E.__cacheKey){Q[K]===void 0&&(Q[K]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,k=!0),Q[K].usedTimes++;let vt=Q[E.__cacheKey];vt!==void 0&&(Q[E.__cacheKey].usedTimes--,vt.usedTimes===0&&F(x)),E.__cacheKey=K,E.__webglTexture=Q[K].texture}return k}function Vt(E,x,k){let $=i.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&($=i.TEXTURE_2D_ARRAY),x.isData3DTexture&&($=i.TEXTURE_3D);let Q=Ft(E,x),K=x.source;e.bindTexture($,E.__webglTexture,i.TEXTURE0+k);let vt=n.get(K);if(K.version!==vt.__version||Q===!0){e.activeTexture(i.TEXTURE0+k);let it=Yt.getPrimaries(Yt.workingColorSpace),ot=x.colorSpace===xn?null:Yt.getPrimaries(x.colorSpace),It=x.colorSpace===xn||it===ot?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,x.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,x.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,It);let et=v(x.image,!1,s.maxTextureSize);et=At(x,et);let ct=r.convert(x.format,x.colorSpace),Bt=r.convert(x.type),Mt=w(x.internalFormat,ct,Bt,x.colorSpace,x.isVideoTexture);pt($,x);let ut,bt=x.mipmaps,Ct=x.isVideoTexture!==!0,Kt=vt.__version===void 0||Q===!0,g=K.dataReady,U=T(x,et);if(x.isDepthTexture)Mt=S(x.format===Mi,x.type),Kt&&(Ct?e.texStorage2D(i.TEXTURE_2D,1,Mt,et.width,et.height):e.texImage2D(i.TEXTURE_2D,0,Mt,et.width,et.height,0,ct,Bt,null));else if(x.isDataTexture)if(bt.length>0){Ct&&Kt&&e.texStorage2D(i.TEXTURE_2D,U,Mt,bt[0].width,bt[0].height);for(let O=0,H=bt.length;O<H;O++)ut=bt[O],Ct?g&&e.texSubImage2D(i.TEXTURE_2D,O,0,0,ut.width,ut.height,ct,Bt,ut.data):e.texImage2D(i.TEXTURE_2D,O,Mt,ut.width,ut.height,0,ct,Bt,ut.data);x.generateMipmaps=!1}else Ct?(Kt&&e.texStorage2D(i.TEXTURE_2D,U,Mt,et.width,et.height),g&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,et.width,et.height,ct,Bt,et.data)):e.texImage2D(i.TEXTURE_2D,0,Mt,et.width,et.height,0,ct,Bt,et.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){Ct&&Kt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,U,Mt,bt[0].width,bt[0].height,et.depth);for(let O=0,H=bt.length;O<H;O++)if(ut=bt[O],x.format!==He)if(ct!==null)if(Ct){if(g)if(x.layerUpdates.size>0){let j=Rc(ut.width,ut.height,x.format,x.type);for(let _t of x.layerUpdates){let Et=ut.data.subarray(_t*j/ut.data.BYTES_PER_ELEMENT,(_t+1)*j/ut.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,_t,ut.width,ut.height,1,ct,Et,0,0)}x.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ut.width,ut.height,et.depth,ct,ut.data,0,0)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,O,Mt,ut.width,ut.height,et.depth,0,ut.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ct?g&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ut.width,ut.height,et.depth,ct,Bt,ut.data):e.texImage3D(i.TEXTURE_2D_ARRAY,O,Mt,ut.width,ut.height,et.depth,0,ct,Bt,ut.data)}else{Ct&&Kt&&e.texStorage2D(i.TEXTURE_2D,U,Mt,bt[0].width,bt[0].height);for(let O=0,H=bt.length;O<H;O++)ut=bt[O],x.format!==He?ct!==null?Ct?g&&e.compressedTexSubImage2D(i.TEXTURE_2D,O,0,0,ut.width,ut.height,ct,ut.data):e.compressedTexImage2D(i.TEXTURE_2D,O,Mt,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ct?g&&e.texSubImage2D(i.TEXTURE_2D,O,0,0,ut.width,ut.height,ct,Bt,ut.data):e.texImage2D(i.TEXTURE_2D,O,Mt,ut.width,ut.height,0,ct,Bt,ut.data)}else if(x.isDataArrayTexture)if(Ct){if(Kt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,U,Mt,et.width,et.height,et.depth),g)if(x.layerUpdates.size>0){let O=Rc(et.width,et.height,x.format,x.type);for(let H of x.layerUpdates){let j=et.data.subarray(H*O/et.data.BYTES_PER_ELEMENT,(H+1)*O/et.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,H,et.width,et.height,1,ct,Bt,j)}x.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,et.width,et.height,et.depth,ct,Bt,et.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,Mt,et.width,et.height,et.depth,0,ct,Bt,et.data);else if(x.isData3DTexture)Ct?(Kt&&e.texStorage3D(i.TEXTURE_3D,U,Mt,et.width,et.height,et.depth),g&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,et.width,et.height,et.depth,ct,Bt,et.data)):e.texImage3D(i.TEXTURE_3D,0,Mt,et.width,et.height,et.depth,0,ct,Bt,et.data);else if(x.isFramebufferTexture){if(Kt)if(Ct)e.texStorage2D(i.TEXTURE_2D,U,Mt,et.width,et.height);else{let O=et.width,H=et.height;for(let j=0;j<U;j++)e.texImage2D(i.TEXTURE_2D,j,Mt,O,H,0,ct,Bt,null),O>>=1,H>>=1}}else if(bt.length>0){if(Ct&&Kt){let O=Rt(bt[0]);e.texStorage2D(i.TEXTURE_2D,U,Mt,O.width,O.height)}for(let O=0,H=bt.length;O<H;O++)ut=bt[O],Ct?g&&e.texSubImage2D(i.TEXTURE_2D,O,0,0,ct,Bt,ut):e.texImage2D(i.TEXTURE_2D,O,Mt,ct,Bt,ut);x.generateMipmaps=!1}else if(Ct){if(Kt){let O=Rt(et);e.texStorage2D(i.TEXTURE_2D,U,Mt,O.width,O.height)}g&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,ct,Bt,et)}else e.texImage2D(i.TEXTURE_2D,0,Mt,ct,Bt,et);f(x)&&u($),vt.__version=K.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function Y(E,x,k){if(x.image.length!==6)return;let $=Ft(E,x),Q=x.source;e.bindTexture(i.TEXTURE_CUBE_MAP,E.__webglTexture,i.TEXTURE0+k);let K=n.get(Q);if(Q.version!==K.__version||$===!0){e.activeTexture(i.TEXTURE0+k);let vt=Yt.getPrimaries(Yt.workingColorSpace),it=x.colorSpace===xn?null:Yt.getPrimaries(x.colorSpace),ot=x.colorSpace===xn||vt===it?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,x.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,x.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ot);let It=x.isCompressedTexture||x.image[0].isCompressedTexture,et=x.image[0]&&x.image[0].isDataTexture,ct=[];for(let H=0;H<6;H++)!It&&!et?ct[H]=v(x.image[H],!0,s.maxCubemapSize):ct[H]=et?x.image[H].image:x.image[H],ct[H]=At(x,ct[H]);let Bt=ct[0],Mt=r.convert(x.format,x.colorSpace),ut=r.convert(x.type),bt=w(x.internalFormat,Mt,ut,x.colorSpace),Ct=x.isVideoTexture!==!0,Kt=K.__version===void 0||$===!0,g=Q.dataReady,U=T(x,Bt);pt(i.TEXTURE_CUBE_MAP,x);let O;if(It){Ct&&Kt&&e.texStorage2D(i.TEXTURE_CUBE_MAP,U,bt,Bt.width,Bt.height);for(let H=0;H<6;H++){O=ct[H].mipmaps;for(let j=0;j<O.length;j++){let _t=O[j];x.format!==He?Mt!==null?Ct?g&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j,0,0,_t.width,_t.height,Mt,_t.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j,bt,_t.width,_t.height,0,_t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ct?g&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j,0,0,_t.width,_t.height,Mt,ut,_t.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j,bt,_t.width,_t.height,0,Mt,ut,_t.data)}}}else{if(O=x.mipmaps,Ct&&Kt){O.length>0&&U++;let H=Rt(ct[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,U,bt,H.width,H.height)}for(let H=0;H<6;H++)if(et){Ct?g&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,0,0,ct[H].width,ct[H].height,Mt,ut,ct[H].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,bt,ct[H].width,ct[H].height,0,Mt,ut,ct[H].data);for(let j=0;j<O.length;j++){let Et=O[j].image[H].image;Ct?g&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j+1,0,0,Et.width,Et.height,Mt,ut,Et.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j+1,bt,Et.width,Et.height,0,Mt,ut,Et.data)}}else{Ct?g&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,0,0,Mt,ut,ct[H]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,bt,Mt,ut,ct[H]);for(let j=0;j<O.length;j++){let _t=O[j];Ct?g&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j+1,0,0,Mt,ut,_t.image[H]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+H,j+1,bt,Mt,ut,_t.image[H])}}}f(x)&&u(i.TEXTURE_CUBE_MAP),K.__version=Q.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function tt(E,x,k,$,Q,K){let vt=r.convert(k.format,k.colorSpace),it=r.convert(k.type),ot=w(k.internalFormat,vt,it,k.colorSpace);if(!n.get(x).__hasExternalTextures){let et=Math.max(1,x.width>>K),ct=Math.max(1,x.height>>K);Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY?e.texImage3D(Q,K,ot,et,ct,x.depth,0,vt,it,null):e.texImage2D(Q,K,ot,et,ct,0,vt,it,null)}e.bindFramebuffer(i.FRAMEBUFFER,E),gt(x)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$,Q,n.get(k).__webglTexture,0,Ht(x)):(Q===i.TEXTURE_2D||Q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,$,Q,n.get(k).__webglTexture,K),e.bindFramebuffer(i.FRAMEBUFFER,null)}function dt(E,x,k){if(i.bindRenderbuffer(i.RENDERBUFFER,E),x.depthBuffer){let $=x.depthTexture,Q=$&&$.isDepthTexture?$.type:null,K=S(x.stencilBuffer,Q),vt=x.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,it=Ht(x);gt(x)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,it,K,x.width,x.height):k?i.renderbufferStorageMultisample(i.RENDERBUFFER,it,K,x.width,x.height):i.renderbufferStorage(i.RENDERBUFFER,K,x.width,x.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,vt,i.RENDERBUFFER,E)}else{let $=x.textures;for(let Q=0;Q<$.length;Q++){let K=$[Q],vt=r.convert(K.format,K.colorSpace),it=r.convert(K.type),ot=w(K.internalFormat,vt,it,K.colorSpace),It=Ht(x);k&>(x)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,It,ot,x.width,x.height):gt(x)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,It,ot,x.width,x.height):i.renderbufferStorage(i.RENDERBUFFER,ot,x.width,x.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}
vendor: 4,177 bytes, line 3813
3813function ht(E,x){if(x&&x.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(i.FRAMEBUFFER,E),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(x.depthTexture).__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),Z(x.depthTexture,0);let $=n.get(x.depthTexture).__webglTexture,Q=Ht(x);if(x.depthTexture.format===mi)gt(x)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0,Q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0);else if(x.depthTexture.format===Mi)gt(x)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0,Q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function Pt(E){let x=n.get(E),k=E.isWebGLCubeRenderTarget===!0;if(E.depthTexture&&!x.__autoAllocateDepthBuffer){if(k)throw new Error("target.depthTexture not supported in Cube render targets");ht(x.__webglFramebuffer,E)}else if(k){x.__webglDepthbuffer=[];for(let $=0;$<6;$++)e.bindFramebuffer(i.FRAMEBUFFER,x.__webglFramebuffer[$]),x.__webglDepthbuffer[$]=i.createRenderbuffer(),dt(x.__webglDepthbuffer[$],E,!1)}else e.bindFramebuffer(i.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer=i.createRenderbuffer(),dt(x.__webglDepthbuffer,E,!1);e.bindFramebuffer(i.FRAMEBUFFER,null)}function Lt(E,x,k){let $=n.get(E);x!==void 0&&tt($.__webglFramebuffer,E,E.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),k!==void 0&&Pt(E)}function Nt(E){let x=E.texture,k=n.get(E),$=n.get(x);E.addEventListener("dispose",R);let Q=E.textures,K=E.isWebGLCubeRenderTarget===!0,vt=Q.length>1;if(vt||($.__webglTexture===void 0&&($.__webglTexture=i.createTexture()),$.__version=x.version,a.memory.textures++),K){k.__webglFramebuffer=[];for(let it=0;it<6;it++)if(x.mipmaps&&x.mipmaps.length>0){k.__webglFramebuffer[it]=[];for(let ot=0;ot<x.mipmaps.length;ot++)k.__webglFramebuffer[it][ot]=i.createFramebuffer()}else k.__webglFramebuffer[it]=i.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){k.__webglFramebuffer=[];for(let it=0;it<x.mipmaps.length;it++)k.__webglFramebuffer[it]=i.createFramebuffer()}else k.__webglFramebuffer=i.createFramebuffer();if(vt)for(let it=0,ot=Q.length;it<ot;it++){let It=n.get(Q[it]);It.__webglTexture===void 0&&(It.__webglTexture=i.createTexture(),a.memory.textures++)}if(E.samples>0&>(E)===!1){k.__webglMultisampledFramebuffer=i.createFramebuffer(),k.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,k.__webglMultisampledFramebuffer);for(let it=0;it<Q.length;it++){let ot=Q[it];k.__webglColorRenderbuffer[it]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,k.__webglColorRenderbuffer[it]);let It=r.convert(ot.format,ot.colorSpace),et=r.convert(ot.type),ct=w(ot.internalFormat,It,et,ot.colorSpace,E.isXRRenderTarget===!0),Bt=Ht(E);i.renderbufferStorageMultisample(i.RENDERBUFFER,Bt,ct,E.width,E.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+it,i.RENDERBUFFER,k.__webglColorRenderbuffer[it])}i.bindRenderbuffer(i.RENDERBUFFER,null),E.depthBuffer&&(k.__webglDepthRenderbuffer=i.createRenderbuffer(),dt(k.__webglDepthRenderbuffer,E,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(K){e.bindTexture(i.TEXTURE_CUBE_MAP,$.__webglTexture),pt(i.TEXTURE_CUBE_MAP,x);for(let it=0;it<6;it++)if(x.mipmaps&&x.mipmaps.length>0)for(let ot=0;ot<x.mipmaps.length;ot++)tt(k.__webglFramebuffer[it][ot],E,x,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+it,ot);else tt(k.__webglFramebuffer[it],E,x,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+it,0);f(x)&&u(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(vt){for(let it=0,ot=Q.length;it<ot;it++){let It=Q[it],et=n.get(It);e.bindTexture(i.TEXTURE_2D,et.__webglTexture),pt(i.TEXTURE_2D,It),tt(k.__webglFramebuffer,E,It,i.COLOR_ATTACHMENT0+it,i.TEXTURE_2D,0),f(It)&&u(i.TEXTURE_2D)}e.unbindTexture()}else{let it=i.TEXTURE_2D;
vendor: 1,137 bytes, line 3813
3813if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(it=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(it,$.__webglTexture),pt(it,x),x.mipmaps&&x.mipmaps.length>0)for(let ot=0;ot<x.mipmaps.length;ot++)tt(k.__webglFramebuffer[ot],E,x,i.COLOR_ATTACHMENT0,it,ot);else tt(k.__webglFramebuffer,E,x,i.COLOR_ATTACHMENT0,it,0);f(x)&&u(it),e.unbindTexture()}E.depthBuffer&&Pt(E)}function qt(E){let x=E.textures;for(let k=0,$=x.length;k<$;k++){let Q=x[k];if(f(Q)){let K=E.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,vt=n.get(Q).__webglTexture;e.bindTexture(K,vt),u(K),e.unbindTexture()}}}let C=[],$t=[];function kt(E){if(E.samples>0){if(gt(E)===!1){let x=E.textures,k=E.width,$=E.height,Q=i.COLOR_BUFFER_BIT,K=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=n.get(E),it=x.length>1;if(it)for(let ot=0;ot<x.length;ot++)e.bindFramebuffer(i.FRAMEBUFFER,vt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,vt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,
vendor: 1,072 bytes, line 3813
3813i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,vt.__webglMultisampledFramebuffer),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,vt.__webglFramebuffer);for(let ot=0;ot<x.length;ot++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(Q|=i.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(Q|=i.STENCIL_BUFFER_BIT)),it){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,vt.__webglColorRenderbuffer[ot]);let It=n.get(x[ot]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,It,0)}i.blitFramebuffer(0,0,k,$,0,0,k,$,Q,i.NEAREST),c===!0&&(C.length=0,$t.length=0,C.push(i.COLOR_ATTACHMENT0+ot),E.depthBuffer&&E.resolveDepthBuffer===!1&&(C.push(K),$t.push(K),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,$t)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,C))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),it)for(let ot=0;ot<x.length;ot++){e.bindFramebuffer(i.FRAMEBUFFER,vt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,
vendor: 12,448 bytes, lines 3813-3837
3813i.RENDERBUFFER,vt.__webglColorRenderbuffer[ot]);let It=n.get(x[ot]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,vt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.TEXTURE_2D,It,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,vt.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&c){let x=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[x])}}}function Ht(E){return Math.min(s.maxSamples,E.samples)}function gt(E){let x=n.get(E);return E.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function jt(E){let x=a.render.frame;h.get(E)!==x&&(h.set(E,x),E.update())}function At(E,x){let k=E.colorSpace,$=E.format,Q=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||k!==bn&&k!==xn&&(Yt.getTransfer(k)===Zt?($!==He||Q!==an)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",k)),x}function Rt(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(l.width=E.naturalWidth||E.width,l.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(l.width=E.displayWidth,l.height=E.displayHeight):(l.width=E.width,l.height=E.height),l}this.allocateTextureUnit=W,this.resetTextureUnits=P,this.setTexture2D=Z,this.setTexture2DArray=q,this.setTexture3D=X,this.setTextureCube=J,this.rebindTextures=Lt,this.setupRenderTarget=Nt,this.updateRenderTargetMipmap=qt,this.updateMultisampleRenderTarget=kt,this.setupDepthRenderbuffer=Pt,this.setupFrameBufferTexture=tt,this.useMultisampledRTT=gt}function ym(i,t){function e(n,s=xn){let r,a=Yt.getTransfer(s);if(n===an)return i.UNSIGNED_BYTE;if(n===eo)return i.UNSIGNED_SHORT_4_4_4_4;if(n===no)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Vc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===zc)return i.BYTE;if(n===kc)return i.SHORT;if(n===Hi)return i.UNSIGNED_SHORT;if(n===to)return i.INT;if(n===On)return i.UNSIGNED_INT;if(n===sn)return i.FLOAT;if(n===Zi)return i.HALF_FLOAT;if(n===Hc)return i.ALPHA;if(n===Gc)return i.RGB;if(n===He)return i.RGBA;if(n===Wc)return i.LUMINANCE;if(n===Xc)return i.LUMINANCE_ALPHA;if(n===mi)return i.DEPTH_COMPONENT;if(n===Mi)return i.DEPTH_STENCIL;if(n===Yc)return i.RED;if(n===io)return i.RED_INTEGER;if(n===qc)return i.RG;if(n===so)return i.RG_INTEGER;if(n===ro)return i.RGBA_INTEGER;if(n===bs||n===Es||n===ws||n===Ts)if(a===Zt)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===bs)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Es)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ws)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ts)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===bs)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Es)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ws)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ts)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===$r||n===jr||n===Qr||n===ta)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===$r)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===jr)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qr)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ta)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ea||n===na||n===ia)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ea||n===na)return a===Zt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ia)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===sa||n===ra||n===aa||n===oa||n===ca||n===la||n===ha||n===ua||n===da||n===fa||n===pa||n===ma||n===ga||n===_a)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===sa)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ra)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===aa)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===oa)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ca)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===la)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ha)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ua)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===da)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===fa)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pa)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ma)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ga)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===_a)return a===Zt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===As||n===xa||n===va)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===As)return a===Zt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===xa)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===va)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Zc||n===ya||n===Ma||n===Sa)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===As)return r.COMPRESSED_RED_RGTC1_EXT;if(n===ya)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ma)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Sa)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===yi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var Fa=class extends ve{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},fi=class extends Ze{constructor(){super(),this.isGroup=!0,this.type="Group"}},Mm={type:"move"},Vi=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fi,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 fi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let s=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(l&&t.hand){a=!0;for(let v of t.hand.values()){let f=e.getJointPose(v,n),u=this._getHandJoint(l,v);f!==null&&(u.matrix.fromArray(f.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=f.radius),u.visible=f!==null}let h=l.joints["index-finger-tip"],p=l.joints["thumb-tip"],d=h.position.distanceTo(p.position),m=.02,_=.005;l.inputState.pinching&&d>m+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&d<=m-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Mm)))}return o!==null&&(o.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new fi;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},Sm=` 3814void main() { 3815 3816 gl_Position = vec4( position, 1.0 ); 3817 3818}`,bm=` 3819uniform sampler2DArray depthColor; 3820uniform float depthWidth; 3821uniform float depthHeight; 3822 3823void main() { 3824 3825 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3826 3827 if ( coord.x >= 1.0 ) { 3828 3829 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3830 3831 } else { 3832 3833 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3834 3835 } 3836 3837}`,Ba=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){let s=new Gn,r=t.properties.get(s);r.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new Je({vertexShader:Sm,fragmentShader:bm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Re(new wi(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},za=class extends qe{constructor(t,e){super();let n=this,s=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,p=null,d=null,m=null,_=null,v=new Ba,f=e.getContextAttributes(),u=null,w=null,S=[],T=[],N=new Tt,R=null,A=new ve;A.layers.enable(1),A.viewport=new Jt;let F=new ve;F.layers.enable(2),F.viewport=new Jt;let b=[A,F],M=new Fa;M.layers.enable(1),M.layers.enable(2);let P=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let tt=S[Y];return tt===void 0&&(tt=new Vi,S[Y]=tt),tt.getTargetRaySpace()},this.getControllerGrip=function(Y){let tt=S[Y];return tt===void 0&&(tt=new Vi,S[Y]=tt),tt.getGripSpace()},this.getHand=function(Y){let tt=S[Y];return tt===void 0&&(tt=new Vi,S[Y]=tt),tt.getHandSpace()};function V(Y){let tt=T.indexOf(Y.inputSource);if(tt===-1)return;let dt=S[tt];dt!==void 0&&(dt.update(Y.inputSource,Y.frame,l||a),dt.dispatchEvent({type:Y.type,data:Y.inputSource}))}function Z(){s.removeEventListener("select",V),s.removeEventListener("selectstart",V),s.removeEventListener("selectend",V),s.removeEventListener("squeeze",V),s.removeEventListener("squeezestart",V),s.removeEventListener("squeezeend",V),s.removeEventListener("end",Z),s.removeEventListener("inputsourceschange",q);for(let Y=0;Y<S.length;Y++){let tt=T[Y];tt!==null&&(T[Y]=null,S[Y].disconnect(tt))}P=null,W=null,v.reset(),t.setRenderTarget(u),m=null,d=null,p=null,s=null,w=null,Vt.stop(),n.isPresenting=!1,t.setPixelRatio(R),t.setSize(N.width,N.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:m},this.getBinding=function(){return p},this.getFrame=function(){return _}
3837,this.getSession=function(){return s},this.setSession=function(Y){return dr(this,null,function*(){if(s=Y,s!==null){if(u=t.getRenderTarget(),s.addEventListener("select",V),s.addEventListener("selectstart",V),s.addEventListener("selectend",V),s.addEventListener("squeeze",V),s.addEventListener("squeezestart",V),s.addEventListener("squeezeend",V),s.addEventListener("end",Z),s.addEventListener("inputsourceschange",q),f.xrCompatible!==!0&&(yield e.makeXRCompatible()),R=t.getPixelRatio(),t.getSize(N),s.renderState.layers===void 0){let tt={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};m=new XRWebGLLayer(s,e,tt),s.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),w=new on(m.framebufferWidth,m.framebufferHeight,{format:He,type:an,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let tt=null,dt=null,ht=null;f.depth&&(ht=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,tt=f.stencil?Mi:mi,dt=f.stencil?yi:On);let Pt={colorFormat:e.RGBA8,depthFormat:ht,scaleFactor:r};p=new XRWebGLBinding(s,e),d=p.createProjectionLayer(Pt),s.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),w=new on(d.textureWidth,d.textureHeight,{format:He,type:an,depthTexture:new Xs(d.textureWidth,d.textureHeight,dt,void 0,void 0,void 0,void 0,void 0,void 0,tt),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=yield s.requestReferenceSpace(o),Vt.setContext(s),Vt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function q(Y){for(let tt=0;tt<Y.removed.length;tt++){let dt=Y.removed[tt],ht=T.indexOf(dt);ht>=0&&(T[ht]=null,S[ht].disconnect(dt))}for(let tt=0;tt<Y.added.length;tt++){let dt=Y.added[tt],ht=T.indexOf(dt);if(ht===-1){for(let Lt=0;Lt<S.length;Lt++)if(Lt>=T.length){T.push(dt),ht=Lt;break}else if(T[Lt]===null){T[Lt]=dt,ht=Lt;break}if(ht===-1)break}let Pt=S[ht];Pt&&Pt.connect(dt)}}let X=new I,J=new I;function G(Y,tt,dt){X.setFromMatrixPosition(tt.matrixWorld),J.setFromMatrixPosition(dt.matrixWorld);let ht=X.distanceTo(J),Pt=tt.projectionMatrix.elements,Lt=dt.projectionMatrix.elements,Nt=Pt[14]/(Pt[10]-1),qt=Pt[14]/(Pt[10]+1),C=(Pt[9]+1)/Pt[5],$t=(Pt[9]-1)/Pt[5],kt=(Pt[8]-1)/Pt[0],Ht=(Lt[8]+1)/Lt[0],gt=Nt*kt,jt=Nt*Ht,At=ht/(-kt+Ht),Rt=At*-kt;tt.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Rt),Y.translateZ(At),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();let E=Nt+At,x=qt+At,k=gt-Rt,$=jt+(ht-Rt),Q=C*qt/x*E,K=$t*qt/x*E;Y.projectionMatrix.makePerspective(k,$,Q,K,E,x),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}function rt(Y,tt){tt===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(tt.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(s===null)return;v.texture!==null&&(Y.near=v.depthNear,Y.far=v.depthFar),M.near=F.near=A.near=Y.near,M.far=F.far=A.far=Y.far,(P!==M.near||W!==M.far)&&(s.updateRenderState({depthNear:M.near,depthFar:M.far}),P=M.near,W=M.far,A.near=P,A.far=W,F.near=P,F.far=W,A.updateProjectionMatrix(),F.updateProjectionMatrix(),Y.updateProjectionMatrix());let tt=Y.parent,dt=M.cameras;rt(M,tt);for(let ht=0;ht<dt.length;ht++)rt(dt[ht],tt);dt.length===2?G(M,A,F):M.projectionMatrix.copy(A.projectionMatrix),lt(Y,M,tt)};function lt(Y,tt,dt){dt===null?Y.matrix.copy(tt.matrixWorld):(Y.matrix.copy(dt.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(tt.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(tt.projectionMatrix),Y.projectionMatrixInverse.copy(tt.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Gi*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&m===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=Y)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(M)};let pt=null;function Ft(Y,tt){if(h=tt.getViewerPose(l||a),_=tt,h!==null){let dt=h.views;m!==null&&(t.setRenderTargetFramebuffer(w,m.framebuffer),t.setRenderTarget(w));let ht=!1;dt.length!==M.cameras.length&&(M.cameras.length=0,ht=!0);for(let Lt=0;Lt<dt.length;Lt++){let Nt=dt[Lt],qt=null;if(m!==null)qt=m.getViewport(Nt);else{let $t=p.getViewSubImage(d,Nt);qt=$t.viewport,Lt===0&&(t.setRenderTargetTextures(w,$t.colorTexture,d.ignoreDepthValues?void 0:$t.depthStencilTexture),t.setRenderTarget(w))}let C=b[Lt];C===void 0&&(C=new ve,C.layers.enable(Lt),C.viewport=new Jt,b[Lt]=C),C.matrix.fromArray(Nt.transform.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale),C.projectionMatrix.fromArray(Nt.projectionMatrix),C.projectionMatrixInverse.copy(C.projectionMatrix).invert(),C.viewport.set(qt.x,qt.y,qt.width,qt.height),Lt===0&&(M.matrix.copy(C.matrix
vendor: 31,094 bytes, line 3837
3837),M.matrix.decompose(M.position,M.quaternion,M.scale)),ht===!0&&M.cameras.push(C)}let Pt=s.enabledFeatures;if(Pt&&Pt.includes("depth-sensing")){let Lt=p.getDepthInformation(dt[0]);Lt&&Lt.isValid&&Lt.texture&&v.init(t,Lt,s.renderState)}}for(let dt=0;dt<S.length;dt++){let ht=T[dt],Pt=S[dt];ht!==null&&Pt!==void 0&&Pt.update(ht,tt,l||a)}pt&&pt(Y,tt),tt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:tt}),_=null}let Vt=new el;Vt.setAnimationLoop(Ft),this.setAnimationLoop=function(Y){pt=Y},this.dispose=function(){}}},Pn=new Bn,Em=new ee;function wm(i,t){function e(f,u){f.matrixAutoUpdate===!0&&f.updateMatrix(),u.value.copy(f.matrix)}function n(f,u){u.color.getRGB(f.fogColor.value,tl(i)),u.isFog?(f.fogNear.value=u.near,f.fogFar.value=u.far):u.isFogExp2&&(f.fogDensity.value=u.density)}function s(f,u,w,S,T){u.isMeshBasicMaterial||u.isMeshLambertMaterial?r(f,u):u.isMeshToonMaterial?(r(f,u),p(f,u)):u.isMeshPhongMaterial?(r(f,u),h(f,u)):u.isMeshStandardMaterial?(r(f,u),d(f,u),u.isMeshPhysicalMaterial&&m(f,u,T)):u.isMeshMatcapMaterial?(r(f,u),_(f,u)):u.isMeshDepthMaterial?r(f,u):u.isMeshDistanceMaterial?(r(f,u),v(f,u)):u.isMeshNormalMaterial?r(f,u):u.isLineBasicMaterial?(a(f,u),u.isLineDashedMaterial&&o(f,u)):u.isPointsMaterial?c(f,u,w,S):u.isSpriteMaterial?l(f,u):u.isShadowMaterial?(f.color.value.copy(u.color),f.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function r(f,u){f.opacity.value=u.opacity,u.color&&f.diffuse.value.copy(u.color),u.emissive&&f.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(f.map.value=u.map,e(u.map,f.mapTransform)),u.alphaMap&&(f.alphaMap.value=u.alphaMap,e(u.alphaMap,f.alphaMapTransform)),u.bumpMap&&(f.bumpMap.value=u.bumpMap,e(u.bumpMap,f.bumpMapTransform),f.bumpScale.value=u.bumpScale,u.side===be&&(f.bumpScale.value*=-1)),u.normalMap&&(f.normalMap.value=u.normalMap,e(u.normalMap,f.normalMapTransform),f.normalScale.value.copy(u.normalScale),u.side===be&&f.normalScale.value.negate()),u.displacementMap&&(f.displacementMap.value=u.displacementMap,e(u.displacementMap,f.displacementMapTransform),f.displacementScale.value=u.displacementScale,f.displacementBias.value=u.displacementBias),u.emissiveMap&&(f.emissiveMap.value=u.emissiveMap,e(u.emissiveMap,f.emissiveMapTransform)),u.specularMap&&(f.specularMap.value=u.specularMap,e(u.specularMap,f.specularMapTransform)),u.alphaTest>0&&(f.alphaTest.value=u.alphaTest);let w=t.get(u),S=w.envMap,T=w.envMapRotation;S&&(f.envMap.value=S,Pn.copy(T),Pn.x*=-1,Pn.y*=-1,Pn.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Pn.y*=-1,Pn.z*=-1),f.envMapRotation.value.setFromMatrix4(Em.makeRotationFromEuler(Pn)),f.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=u.reflectivity,f.ior.value=u.ior,f.refractionRatio.value=u.refractionRatio),u.lightMap&&(f.lightMap.value=u.lightMap,f.lightMapIntensity.value=u.lightMapIntensity,e(u.lightMap,f.lightMapTransform)),u.aoMap&&(f.aoMap.value=u.aoMap,f.aoMapIntensity.value=u.aoMapIntensity,e(u.aoMap,f.aoMapTransform))}function a(f,u){f.diffuse.value.copy(u.color),f.opacity.value=u.opacity,u.map&&(f.map.value=u.map,e(u.map,f.mapTransform))}function o(f,u){f.dashSize.value=u.dashSize,f.totalSize.value=u.dashSize+u.gapSize,f.scale.value=u.scale}function c(f,u,w,S){f.diffuse.value.copy(u.color),f.opacity.value=u.opacity,f.size.value=u.size*w,f.scale.value=S*.5,u.map&&(f.map.value=u.map,e(u.map,f.uvTransform)),u.alphaMap&&(f.alphaMap.value=u.alphaMap,e(u.alphaMap,f.alphaMapTransform)),u.alphaTest>0&&(f.alphaTest.value=u.alphaTest)}function l(f,u){f.diffuse.value.copy(u.color),f.opacity.value=u.opacity,f.rotation.value=u.rotation,u.map&&(f.map.value=u.map,e(u.map,f.mapTransform)),u.alphaMap&&(f.alphaMap.value=u.alphaMap,e(u.alphaMap,f.alphaMapTransform)),u.alphaTest>0&&(f.alphaTest.value=u.alphaTest)}function h(f,u){f.specular.value.copy(u.specular),f.shininess.value=Math.max(u.shininess,1e-4)}function p(f,u){u.gradientMap&&(f.gradientMap.value=u.gradientMap)}function d(f,u){f.metalness.value=u.metalness,u.metalnessMap&&(f.metalnessMap.value=u.metalnessMap,e(u.metalnessMap,f.metalnessMapTransform)),f.roughness.value=u.roughness,u.roughnessMap&&(f.roughnessMap.value=u.roughnessMap,e(u.roughnessMap,f.roughnessMapTransform)),u.envMap&&(f.envMapIntensity.value=u.envMapIntensity)}function m(f,u,w){f.ior.value=u.ior,u.sheen>0&&(f.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),f.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(f.sheenColorMap.value=u.sheenColorMap,e(u.sheenColorMap,f.sheenColorMapTransform)),u.sheenRoughnessMap&&(f.sheenRoughnessMap.value=u.sheenRoughnessMap,e(u.sheenRoughnessMap,f.sheenRoughnessMapTransform))),u.clearcoat>0&&(f.clearcoat.value=u.clearcoat,f.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(f.clearcoatMap.value=u.clearcoatMap,e(u.clearcoatMap,f.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,e(u.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(f.clearcoatNormalMap.value=u.clearcoatNormalMap,e(u.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===be&&f.clearcoatNormalScale.value.negate())),u.dispersion>0&&(f.dispersion.value=u.dispersion),u.iridescence>0&&(f.iridescence.value=u.iridescence,f.iridescenceIOR.value=u.iridescenceIOR,f.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(f.iridescenceMap.value=u.iridescenceMap,e(u.iridescenceMap,f.iridescenceMapTransform)),u.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=u.iridescenceThicknessMap,e(u.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),u.transmission>0&&(f.transmission.value=u.transmission,f.transmissionSamplerMap.value=w.texture,f.transmissionSamplerSize.value.set(w.width,w.height),u.transmissionMap&&(f.transmissionMap.value=u.transmissionMap,e(u.transmissionMap,f.transmissionMapTransform)),f.thickness.value=u.thickness,u.thicknessMap&&(f.thicknessMap.value=u.thicknessMap,e(u.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=u.attenuationDistance,f.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(f.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(f.anisotropyMap.value=u.anisotropyMap,e(u.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=u.specularIntensity,f.specularColor.value.copy(u.specularColor),u.specularColorMap&&(f.specularColorMap.value=u.specularColorMap,e(u.specularColorMap,f.specularColorMapTransform)),u.specularIntensityMap&&(f.specularIntensityMap.value=u.specularIntensityMap,e(u.specularIntensityMap,f.specularIntensityMapTransform))}function _(f,u){u.matcap&&(f.matcap.value=u.matcap)}function v(f,u){let w=t.get(u).light;f.referencePosition.value.setFromMatrixPosition(w.matrixWorld),f.nearDistance.value=w.shadow.camera.near,f.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function Tm(i,t,e,n){let s={},r={},a=[],o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(w,S){let T=S.program;n.uniformBlockBinding(w,T)}function l(w,S){let T=s[w.id];T===void 0&&(_(w),T=h(w),s[w.id]=T,w.addEventListener("dispose",f));let N=S.program;n.updateUBOMapping(w,N);let R=t.render.frame;r[w.id]!==R&&(d(w),r[w.id]=R)}function h(w){let S=p();w.__bindingPointIndex=S;let T=i.createBuffer(),N=w.__size,R=w.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,N,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,S,T),T}function p(){for(let w=0;w<o;w++)if(a.indexOf(w)===-1)return a.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(w){let S=s[w.id],T=w.uniforms,N=w.__cache;i.bindBuffer(i.UNIFORM_BUFFER,S);for(let R=0,A=T.length;R<A;R++){let F=Array.isArray(T[R])?T[R]:[T[R]];for(let b=0,M=F.length;b<M;b++){let P=F[b];if(m(P,R,b,N)===!0){let W=P.__offset,V=Array.isArray(P.value)?P.value:[P.value],Z=0;for(let q=0;q<V.length;q++){let X=V[q],J=v(X);typeof X=="number"||typeof X=="boolean"?(P.__data[0]=X,i.bufferSubData(i.UNIFORM_BUFFER,W+Z,P.__data)):X.isMatrix3?(P.__data[0]=X.elements[0],P.__data[1]=X.elements[1],P.__data[2]=X.elements[2],P.__data[3]=0,P.__data[4]=X.elements[3],P.__data[5]=X.elements[4],P.__data[6]=X.elements[5],P.__data[7]=0,P.__data[8]=X.elements[6],P.__data[9]=X.elements[7],P.__data[10]=X.elements[8],P.__data[11]=0):(X.toArray(P.__data,Z),Z+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,W,P.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(w,S,T,N){let R=w.value,A=S+"_"+T;if(N[A]===void 0)return typeof R=="number"||typeof R=="boolean"?N[A]=R:N[A]=R.clone(),!0;{let F=N[A];if(typeof R=="number"||typeof R=="boolean"){if(F!==R)return N[A]=R,!0}else if(F.equals(R)===!1)return F.copy(R),!0}return!1}function _(w){let S=w.uniforms,T=0,N=16;for(let A=0,F=S.length;A<F;A++){let b=Array.isArray(S[A])?S[A]:[S[A]];for(let M=0,P=b.length;M<P;M++){let W=b[M],V=Array.isArray(W.value)?W.value:[W.value];for(let Z=0,q=V.length;Z<q;Z++){let X=V[Z],J=v(X),G=T%N,rt=G%J.boundary,lt=G+rt;T+=rt,lt!==0&&N-lt<J.storage&&(T+=N-lt),W.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=T,T+=J.storage}}}let R=T%N;return R>0&&(T+=N-R),w.__size=T,w.__cache={},this}function v(w){let S={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function f(w){let S=w.target;S.removeEventListener("dispose",f);let T=a.indexOf(S.__bindingPointIndex);a.splice(T,1),i.deleteBuffer(s[S.id]),delete s[S.id],delete r[S.id]}function u(){for(let w in s)i.deleteBuffer(s[w]);a=[],s={},r={}}return{bind:c,update:l,dispose:u}}var Ys=class{constructor(t={}){let{canvas:e=Ih(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:p=!1}=t;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;let m=new Uint32Array(4),_=new Int32Array(4),v=null,f=null,u=[],w=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Xe,this.toneMapping=yn,this.toneMappingExposure=1;let S=this,T=!1,N=0,R=0,A=null,F=-1,b=null,M=new Jt,P=new Jt,W=null,V=new Ot(0),Z=0,q=e.width,X=e.height,J=1,G=null,rt=null,lt=new Jt(0,0,q,X),pt=new Jt(0,0,q,X),Ft=!1,Vt=new Xi,Y=!1,tt=!1,dt=new ee,ht=new I,Pt=new Jt,Lt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Nt=!1;function qt(){return A===null?J:1}let C=n;function $t(y,L){return e.getContext(y,L)}try{let y={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:p};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ja}`),e.addEventListener("webglcontextlost",O,!1),e.addEventListener("webglcontextrestored",H,!1),e.addEventListener("webglcontextcreationerror",j,!1),C===null){let L="webgl2";if(C=$t(L,y),C===null)throw $t(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let kt,Ht,gt,jt,At,Rt,E,x,k,$,Q,K,vt,it,ot,It,et,ct,Bt,Mt,ut,bt,Ct,Kt;function g(){kt=new Gf(C),kt.init(),bt=new ym(C,kt),Ht=new Ff(C,kt,t,bt),gt=new _m(C),jt=new Yf(C),At=new rm,Rt=new vm(C,kt,gt,At,Ht,bt,jt),E=new zf(S),x=new Hf(S),k=new jh(C),Ct=new Nf(C,k),$=new Wf(C,k,jt,Ct),Q=new Zf(C,$,k,jt),Bt=new qf(C,Ht,Rt),It=new Bf(At),K=new sm(S,E,x,kt,Ht,Ct,It),vt=new wm(S,At),it=new om,ot=new fm(kt),ct=new Uf(S,E,x,gt,Q,d,c),et=new gm(S,Q,Ht),Kt=new Tm(C,jt,Ht,gt),Mt=new Of(C,kt,jt),ut=new Xf(C,kt,jt),jt.programs=K.programs,S.capabilities=Ht,S.extensions=kt,S.properties=At,S.renderLists=it,S.shadowMap=et,S.state=gt,S.info=jt}g();let U=new za(S,C);this.xr=U,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){let y=kt.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){let y=kt.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(y){y!==void 0&&(J=y,this.setSize(q,X,!1))},this.getSize=function(y){return y.set(q,X)},this.setSize=function(y,L,B=!0){if(U.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=y,X=L,e.width=Math.floor(y*J),e.height=Math.floor(L*J),B===!0&&(e.style.width=y+"px",e.style.height=L+"px"),this.setViewport(0,0,y,L)},this.getDrawingBufferSize=function(y){return y.set(q*J,X*J).floor()},this.setDrawingBufferSize=function(y,L,B){q=y,X=L,J=B,e.width=Math.floor(y*B),e.height=Math.floor(L*B),this.setViewport(0,0,y,L)},this.getCurrentViewport=function(y){return y.copy(M)},this.getViewport=function(y){return y.copy(lt)},this.setViewport=function(y,L,B,z){y.isVector4?lt.set(y.x,y.y,y.z,y.w):lt.set(y,L,B,z),gt.viewport(M.copy(lt).multiplyScalar(J).round())},this.getScissor=function(y){return y.copy(pt)},this.setScissor=function(y,L,B,z){y.isVector4?pt.set(y.x,y.y,y.z,y.w):pt.set(y,L,B,z),gt.scissor(P.copy(pt).multiplyScalar(J).round())},this.getScissorTest=function(){return Ft},this.setScissorTest=function(y){gt.setScissorTest(Ft=y)},this.setOpaqueSort=function(y){G=y},this.setTransparentSort=function(y){rt=y},this.getClearColor=function(y){return y.copy(ct.getClearColor())},this.setClearColor=function(){ct.setClearColor.apply(ct,arguments)},this.getClearAlpha=function(){return ct.getClearAlpha()},this.setClearAlpha=function(){ct.setClearAlpha.apply(ct,arguments)},this.clear=function(y=!0,L=!0,B=!0){let z=0;if(y){let D=!1;if(A!==null){let nt=A.texture.format;D=nt===ro||nt===so||nt===io}if(D){let nt=A.texture.type,at=nt===an||nt===On||nt===Hi||nt===yi||nt===eo||nt===no,ft=ct.getClearColor(),mt=ct.getClearAlpha(),St=ft.r,wt=ft.g,yt=ft.b;at?(m[0]=St,m[1]=wt,m[2]=yt,m[3]=mt,C.clearBufferuiv(C.COLOR,0,m)):(_[0]=St,_[1]=wt,_[2]=yt,_[3]=mt,C.clearBufferiv(C.COLOR,0,_))}else z|=C.COLOR_BUFFER_BIT}L&&(z|=C.DEPTH_BUFFER_BIT),B&&(z|=C.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),C.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",O,!1),e.removeEventListener("webglcontextrestored",H,!1),e.removeEventListener("webglcontextcreationerror",j,!1),it.dispose(),ot.dispose(),At.dispose(),E.dispose(),x.dispose(),Q.dispose(),Ct.dispose(),Kt.dispose(),K.dispose(),U.dispose(),U.removeEventListener("sessionstart",se),U.removeEventListener("sessionend",hn),pe.stop()};function O(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function H(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;let y=jt.autoReset,L=et.enabled,B=et.autoUpdate,z=et.needsUpdate,D=et.type;g(),jt.autoReset=y,et.enabled=L,et.autoUpdate=B,et.needsUpdate=z,et.type=D}function j(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function _t(y){let L=y.target;L.removeEventListener("dispose",_t),Et(L)}function Et(y){ne(y),At.remove(y)}function ne(y){let L=At.get(y).programs;L!==void 0&&(L.forEach(function(B){K.releaseProgram(B)}),y.isShaderMaterial&&K.releaseShaderCache(y))}this.renderBufferDirect=function(y,L,B,z,D,nt){L===null&&(L=Lt);let at=D.isMesh&&D.matrixWorld.determinant()<0,ft=xl(y,L,B,z,D);gt.setMaterial(z,at);let mt=B.index,St=1;if(z.wireframe===!0){if(mt=$.getWireframeAttribute(B),mt===void 0)return;St=2}let wt=B.drawRange,yt=B.attributes.position,Gt=wt.start*St,Qt=(wt.start+wt.count)*St;nt!==null&&(Gt=Math.max(Gt,nt.start*St),Qt=Math.min(Qt,(nt.start+nt.count)*St)),mt!==null?(Gt=Math.max(Gt,0),Qt=Math.min(Qt,mt.count)):yt!=null&&(Gt=Math.max(Gt,0),Qt=Math.min(Qt,yt.count));let te=Qt-Gt;if(te<0||te===1/0)return;Ct.setup(D,z,ft,B,mt);let Ee,Wt=Mt;if(mt!==null&&(Ee=k.get(mt),Wt=ut,Wt.setIndex(Ee)),D.isMesh)z.wireframe===!0?(gt.setLineWidth(z.wireframeLinewidth*qt()),Wt.setMode(C.LINES)):Wt.setMode(C.TRIANGLES);else if(D.isLine){let xt=z.linewidth;xt===void 0&&(xt=1),gt.setLineWidth(xt*qt()),D.isLineSegments?Wt.setMode(C.LINES):D.isLineLoop?Wt.setMode(C.LINE_LOOP):Wt.setMode(C.LINE_STRIP)}else D.isPoints?Wt.setMode(C.POINTS):D.isSprite&&Wt.setMode(C.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)Wt.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(kt.get("WEBGL_multi_draw"))Wt.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{let xt=D._multiDrawStarts,me=D._multiDrawCounts,Xt=D._multiDrawCount,Oe=mt?k.get(mt).bytesPerElement:1,Xn=At.get(z).currentProgram.getUniforms();for(let we=0;we<Xt;we++)Xn.setValue(C,"_gl_DrawID",we),Wt.render(xt[we]/Oe,me[we])}else if(D.isInstancedMesh)Wt.renderInstances(Gt,te,D.count);else if(B.isInstancedBufferGeometry){let xt=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,me=Math.min(B.instanceCount,xt);Wt.renderInstances(Gt,te,me)}else Wt.render(Gt,te)};function le(y,L,B){y.transparent===!0&&y.side===De&&y.forceSinglePass===!1?(y.side=be,y.needsUpdate=!0,Ki(y,L,B),y.side=Mn,y.needsUpdate=!0,Ki(y,L,B),y.side=De):Ki(y,L,B)}this.compile=function(y,L,B=null){B===null&&(B=y),f=ot.get(B),f.init(L),w.push(f),B.traverseVisible(function(D){D.isLight&&D.layers.test(L.layers)&&(f.pushLight(D),D.castShadow&&f.pushShadow(D))}),y!==B&&y.traverseVisible(function(D){D.isLight&&D.layers.test(L.layers)&&(f.pushLight(D),D.castShadow&&f.pushShadow(D))}),f.setupLights();let z=new Set;return y.traverse(function(D){let nt=D.material;if(nt)if(Array.isArray(nt))for(let at=0;at<nt.length;at++){let ft=nt[at];le(ft,B,D),z.add(ft)}else le(nt,B,D),z.add(nt)}),w.pop(),f=null,z},this.compileAsync=function(y,L,B=null){let z=this.compile(y,L,B);return new Promise(D=>{function nt(){if(z.forEach(function(at){At.get(at).currentProgram.isReady()&&z.delete(at)}),z.size===0){D(y);return}setTimeout(nt,10)}kt.get("KHR_parallel_shader_compile")!==null?nt():setTimeout(nt,10)})};let zt=null;function he(y){zt&&zt(y)}function se(){pe.stop()}function hn(){pe.start()}let pe=new el;pe.setAnimationLoop(he),typeof self<"u"&&pe.setContext(self),this.setAnimationLoop=function(y){zt=y,U.setAnimationLoop(y),y===null?pe.stop():pe.start()},U.addEventListener("sessionstart",se),U.addEventListener("sessionend",hn),this.render=function(y,L){if(L!==void 0&&L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),U.enabled===!0&&U.isPresenting===!0&&(U.cameraAutoUpdate===!0&&U.updateCamera(L),L=U.getCamera()),y.isScene===!0&&y.onBeforeRender(S,y,L,A),f=ot.get(y,w.length),f.init(L),w.push(f),dt.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),Vt.setFromProjectionMatrix(dt),tt=this.localClippingEnabled,Y=It.init(this.clippingPlanes,tt),v=it.get(y,u.length),v.init(),u.push(v),U.enabled===!0&&U.isPresenting===!0){let nt=S.xr.getDepthSensingMesh();nt!==null&&Ke(nt,L,-1/0,S.sortObjects)}Ke(y,L,0,S.sortObjects),v.finish(),S.sortObjects===!0&&v.sort(G,rt),Nt=U.enabled===!1||U.isPresenting===!1||U.hasDepthSensing()===!1,Nt&&ct.addToRenderList(v,y),this.info.render.frame++,Y===!0&&It.beginShadows();let B=f.state.shadowsArray;et.render(B,y,L),Y===!0&&It.endShadows(),this.info.autoReset===!0&&this.info.reset();let z=v.opaque,D=v.transmissive;if(f.setupLights(),L.isArrayCamera){let nt=L.cameras;if(D.length>0)for(let at=0,ft=nt.length;at<ft;at++){let mt=nt[at];Ri(z,D,y,mt)}Nt&&ct.render(y);for(let at=0,ft=nt.length;at<ft;at++){let mt=nt[at];En(v,y,mt,mt.viewport)}}else D.length>0&&Ri(z,D,y,L),Nt&&ct.render(y),En(v,y,L);A!==null&&(Rt.updateMultisampleRenderTarget(A),Rt.updateRenderTargetMipmap(A)),y.isScene===!0&&y.onAfterRender(S,y,L),Ct.resetDefaultState(),F=-1,b=null,w.pop(),w.length>0?(f=w[w.length-1],Y===!0&&It.setGlobalState(S.clippingPlanes,f.state.camera)):f=null,u.pop(),u.length>0?v=u[u.length-1]:v=null};function Ke(y,L,B,z){if(y.visible===!1)return;if(y.layers.test(L.layers)){if(y.isGroup)B=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(L);else if(y.isLight)f.pushLight(y),y.castShadow&&f.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||Vt.intersectsSprite(y)){z&&Pt.setFromMatrixPosition(y.matrixWorld).applyMatrix4(dt);let at=Q.update(y),ft=y.material;ft.visible&&v.push(y,at,ft,B,Pt.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||Vt.intersectsObject(y))){let at=Q.update(y),ft=y.material;if(z&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),Pt.copy(y.boundingSphere.center)):(at.boundingSphere===null&&at.computeBoundingSphere(),Pt.copy(at.boundingSphere.center)),Pt.applyMatrix4(y.matrixWorld).applyMatrix4(dt)),Array.isArray(ft)){let mt=at.groups;for(let St=0,wt=mt.length;St<wt;St++){let yt=mt[St],Gt=ft[yt.materialIndex];Gt&&Gt.visible&&v.push(y,at,Gt,B,Pt.z,yt)}}else ft.visible&&v.push(y,at,ft,B,Pt.z,null)}}let nt=y.children;for(let at=0,ft=nt.length;at<ft;at++)Ke(nt[at],L,B,z)}function En(y,L,B,z){let D=y.opaque,nt=y.transmissive,at=y.transparent;f.setupLightsView(B),Y===!0&&It.setGlobalState(S.clippingPlanes,B),z&>.viewport(M.copy(z)),D.length>0&&Ji(D,L,B),nt.length>0&&Ji(nt,L,B),at.length>0&&Ji(at,L,B),gt.buffers.depth.setTest(!0),gt.buffers.depth.setMask(!0),gt.buffers.color.setMask(!0),gt.setPolygonOffset(!1)}function Ri(y,L,B,z){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[z.id]===void 0&&(f.state.transmissionRenderTarget[z.id]=new on(1,1,{generateMipmaps:!0,type:kt.has("EXT_color_buffer_half_float")||kt.has("EXT_color_buffer_float")?Zi:an,minFilter:Nn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Yt.workingColorSpace}));let nt=f.state.transmissionRenderTarget[z.id],at=z.viewport||M;nt.setSize(at.z,at.w);let ft=S.getRenderTarget();S.setRenderTarget(nt),S.getClearColor(V),Z=S.getClearAlpha(),Z<1&&S.setClearColor(16777215,.5),S.clear(),Nt&&ct.render(B);let mt=S.toneMapping;S.toneMapping=yn;let St=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),f.setupLightsView(z),Y===!0&&It.setGlobalState(S.clippingPlanes,z),Ji(y,B,z),Rt.updateMultisampleRenderTarget(nt),Rt.updateRenderTargetMipmap(nt),kt.has("WEBGL_multisampled_render_to_texture")===!1){let wt=!1;for(let yt=0,Gt=L.length;yt<Gt;yt++){let Qt=L[yt],te=Qt.object,Ee=Qt.geometry,Wt=Qt.material,xt=Qt.group;if(Wt.side===De&&te.layers.test(z.layers)){let me=Wt.side;Wt.side=be,Wt.needsUpdate=!0,fo(te,B,z,Ee,Wt,xt),Wt.side=me,Wt.needsUpdate=!0,wt=!0}}wt===!0&&(Rt.updateMultisampleRenderTarget(nt),Rt.updateRenderTargetMipmap(nt))}S.setRenderTarget(ft),S.setClearColor(V,Z),St!==void 0&&(z.viewport=St),S.toneMapping=mt}function Ji(y,L,B){let z=L.isScene===!0?L.overrideMaterial:null;for(let D=0,nt=y.length;D<nt;D++){let at=y[D],ft=at.object,mt=at.geometry,St=z===null?at.material:z,wt=at.group;ft.layers.test(B.layers)&&fo(ft,L,B,mt,St,wt)}}function fo(y,L,B,z,D,nt){y.onBeforeRender(S,L,B,z,D,nt),y.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),D.transparent===!0&&D.side===De&&D.forceSinglePass===!1?(D.side=be,D.needsUpdate=!0,S.renderBufferDirect(B,L,z,D,y,nt),D.side=Mn,D.needsUpdate=!0,S.renderBufferDirect(B,L,z,D,y,nt),D.side=De):S.renderBufferDirect(B,L,z,D,y,nt),y.onAfterRender(S,L,B,z,D,nt)}function Ki(y,L,B){L.isScene!==!0&&(L=Lt);let z=At.get(y),D=f.state.lights,nt=f.state.shadowsArray,at=D.state.version,ft=K.getParameters(y,D.state,nt,L,B),mt=K.getProgramCacheKey(ft),St=z.programs;z.environment=y.isMeshStandardMaterial?L.environment:null,z.fog=L.fog,z.envMap=(y.isMeshStandardMaterial?x:E).get(y.envMap||z.environment),z.envMapRotation=z.environment!==null&&y.envMap===null?L.environmentRotation:y.envMapRotation,St===void 0&&(y.addEventListener("dispose",_t),St=new Map,z.programs=St);let wt=St.get(mt);if(wt!==void 0){if(z.currentProgram===wt&&z.lightsStateVersion===at)return mo(y,ft),wt}else ft.uniforms=K.getUniforms(y),y.onBeforeCompile(ft,S),wt=K.acquireProgram(ft,mt),St.set(mt,wt),z.uniforms=ft.uniforms;let yt=z.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(yt.clippingPlanes=It.uniform),mo(y,ft),z.needsLights=yl(y),z.lightsStateVersion=at,z.needsLights&&(yt.ambientLightColor.value=D.state.ambient,yt.lightProbe.value=D.state.probe,yt.directionalLights.value=D.state.directional,yt.directionalLightShadows.value=D.state.directionalShadow,yt.spotLights.value=D.state.spot,yt.spotLightShadows.value=D.state.spotShadow,yt.rectAreaLights.value=D.state.rectArea,yt.ltc_1.value=D.state.rectAreaLTC1,yt.ltc_2.value=D.state.rectAreaLTC2,yt.pointLights.value=D.state.point,yt.pointLightShadows.value=D.state.pointShadow,yt.hemisphereLights.value=D.state.hemi,yt.directionalShadowMap.value=D.state.directionalShadowMap,yt.directionalShadowMatrix.value=D.state.directionalShadowMatrix,yt.spotShadowMap.value=D.state.spotShadowMap,yt.spotLightMatrix.value=D.state.spotLightMatrix,yt.spotLightMap.value=D.state.spotLightMap,yt.pointShadowMap.value=D.state.pointShadowMap,yt.pointShadowMatrix.value=D.state.pointShadowMatrix),z.currentProgram=wt,z.uniformsList=null,wt}function po(y){if(y.uniformsList===null){let L=y.currentProgram.getUniforms();y.uniformsList=_i.seqWithValue(L.seq,y.uniforms)}return y.uniformsList}function mo(y,L){let B=At.get(y);B.outputColorSpace=L.outputColorSpace,B.batching=L.batching,B.batchingColor=L.batchingColor,B.instancing=L.instancing,B.instancingColor=L.instancingColor,B.instancingMorph=L.instancingMorph,B.skinning=L.skinning,B.morphTargets=L.morphTargets,B.morphNormals=L.morphNormals,B.morphColors=L.morphColors,B.morphTargetsCount=L.morphTargetsCount,B.numClippingPlanes=L.numClippingPlanes,B.numIntersection=L.numClipIntersection,B.vertexAlphas=L.vertexAlphas,B.vertexTangents=L.vertexTangents,B.toneMapping=L.toneMapping}function xl(y,L,B,z,D){L.isScene!==!0&&(L=Lt),Rt.resetTextureUnits();let nt=L.fog,at=z.isMeshStandardMaterial?L.environment:null,ft=A===null?S.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:bn,mt=(z.isMeshStandardMaterial?x:E).get(z.envMap||at),St=z.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,wt=!!B.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),yt=!!B.morphAttributes.position,Gt=!!B.morphAttributes.normal,Qt=!!B.morphAttributes.color,te=yn;z.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(te=S.toneMapping);let Ee=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,Wt=Ee!==void 0?Ee.length:0,xt=At.get(z),me=f.state.lights;if(Y===!0&&(tt===!0||y!==b)){let Ie=y===b&&z.id===F;It.setState(z,y,Ie)}let Xt=!1;z.version===xt.__version?(xt.needsLights&&xt.lightsStateVersion!==me.state.version||xt.outputColorSpace!==ft||D.isBatchedMesh&&xt.batching===!1||!D.isBatchedMesh&&xt.batching===!0||D.isBatchedMesh&&xt.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&xt.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&xt.instancing===!1||!D.isInstancedMesh&&xt.instancing===!0||D.isSkinnedMesh&&xt.skinning===!1||!D.isSkinnedMesh&&xt.skinning===!0||D.isInstancedMesh&&xt.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&xt.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&xt.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&xt.instancingMorph===!1&&D.morphTexture!==null||xt.envMap!==mt||z.fog===!0&&xt.fog!==nt||xt.numClippingPlanes!==void 0&&(xt.numClippingPlanes!==It.numPlanes||xt.numIntersection!==It.numIntersection)||xt.vertexAlphas!==St||xt.vertexTangents!==wt||xt.morphTargets!==yt||xt.morphNormals!==Gt||xt.morphColors!==Qt||xt.toneMapping!==te||xt.morphTargetsCount!==Wt)&&(Xt=!0):(Xt=!0,xt.__version=z.version);let Oe=xt.currentProgram;Xt===!0&&(Oe=Ki(z,L,D));let Xn=!1,we=!1,lr=!1,re=Oe.getUniforms(),un=xt.uniforms;if(gt.useProgram(Oe.program)&&(Xn=!0,we=!0,lr=!0),z.id!==F&&(F=z.id,we=!0),Xn||b!==y){re.setValue(C,"projectionMatrix",y.projectionMatrix),re.setValue(C,"viewMatrix",y.matrixWorldInverse);let Ie=re.map.cameraPosition;Ie!==void 0&&Ie.setValue(C,ht.setFromMatrixPosition(y.matrixWorld)),Ht.logarithmicDepthBuffer&&re.setValue(C,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&re.setValue(C,"isOrthographic",y.isOrthographicCamera===!0),b!==y&&(b=y,we=!0,lr=!0)}if(D.isSkinnedMesh){re.setOptional(C,D,"bindMatrix"),re.setOptional(C,D,"bindMatrixInverse");let Ie=D.skeleton;Ie&&(Ie.boneTexture===null&&Ie.computeBoneTexture(),re.setValue(C,"boneTexture",Ie.boneTexture,Rt))}D.isBatchedMesh&&(re.setOptional(C,D,"batchingTexture"),re.setValue(C,"batchingTexture",D._matricesTexture,Rt),re.setOptional(C,D,"batchingIdTexture"),re.setValue(C,"batchingIdTexture",D._indirectTexture,Rt),re.setOptional(C,D,"batchingColorTexture"),D._colorsTexture!==null&&re.setValue(C,"batchingColorTexture",D._colorsTexture,Rt));let hr=B.morphAttributes;if((hr.position!==void 0||hr.normal!==void 0||hr.color!==void 0)&&Bt.update(D,B,Oe),(we||xt.receiveShadow!==D.receiveShadow)&&(xt.receiveShadow=D.receiveShadow,re.setValue(C,"receiveShadow",D.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(un.envMap.value=mt,un.flipEnvMap.value=mt.isCubeTexture&&mt.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&L.environment!==null&&(un.envMapIntensity.value=L.environmentIntensity),we&&(re.setValue(C,"toneMappingExposure",S.toneMappingExposure),xt.needsLights&&vl(un,lr),nt&&z.fog===!0&&vt.refreshFogUniforms(un,nt),vt.refreshMaterialUniforms(un,z,J,X,f.state.transmissionRenderTarget[y.id]),_i.upload(C,po(xt),un,Rt)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(_i.upload(C,po(xt),un,Rt),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&re.setValue(C,"center",D.center),re.
3837setValue(C,"modelViewMatrix",D.modelViewMatrix),re.setValue(C,"normalMatrix",D.normalMatrix),re.setValue(C,"modelMatrix",D.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){let Ie=z.uniformsGroups;for(let ur=0,Ml=Ie.length;ur<Ml;ur++){let go=Ie[ur];Kt.update(go,Oe),Kt.bind(go,Oe)}}return Oe}function vl(y,L){y.ambientLightColor.needsUpdate=L,y.lightProbe.needsUpdate=L,y.directionalLights.needsUpdate=L,y.directionalLightShadows.needsUpdate=L,y.pointLights.needsUpdate=L,y.pointLightShadows.needsUpdate=L,y.spotLights.needsUpdate=L,y.spotLightShadows.needsUpdate=L,y.rectAreaLights.needsUpdate=L,y.hemisphereLights.needsUpdate=L}function yl(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(y,L,B){At.get(y.texture).__webglTexture=L,At.get(y.depthTexture).__webglTexture=B;let z=At.get(y);z.__hasExternalTextures=!0,z.__autoAllocateDepthBuffer=B===void 0,z.__autoAllocateDepthBuffer||kt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(y,L){let B=At.get(y);B.__webglFramebuffer=L,B.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(y,L=0,B=0){A=y,N=L,R=B;let z=!0,D=null,nt=!1,at=!1;if(y){let mt=At.get(y);mt.__useDefaultFramebuffer!==void 0?(gt.bindFramebuffer(C.FRAMEBUFFER,null),z=!1):mt.__webglFramebuffer===void 0?Rt.setupRenderTarget(y):mt.__hasExternalTextures&&Rt.rebindTextures(y,At.get(y.texture).__webglTexture,At.get(y.depthTexture).__webglTexture);let St=y.texture;(St.isData3DTexture||St.isDataArrayTexture||St.isCompressedArrayTexture)&&(at=!0);let wt=At.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(wt[L])?D=wt[L][B]:D=wt[L],nt=!0):y.samples>0&&Rt.useMultisampledRTT(y)===!1?D=At.get(y).__webglMultisampledFramebuffer:Array.isArray(wt)?D=wt[B]:D=wt,M.copy(y.viewport),P.copy(y.scissor),W=y.scissorTest}else M.copy(lt).multiplyScalar(J).floor(),P.copy(pt).multiplyScalar(J).floor(),W=Ft;if(gt.bindFramebuffer(C.FRAMEBUFFER,D)&&z&>.drawBuffers(y,D),gt.viewport(M),gt.scissor(P),gt.setScissorTest(W),nt){let mt=At.get(y.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+L,mt.__webglTexture,B)}else if(at){let mt=At.get(y.texture),St=L||0;C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,mt.__webglTexture,B||0,St)}F=-1},this.readRenderTargetPixels=function(y,L,B,z,D,nt,at){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ft=At.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&at!==void 0&&(ft=ft[at]),ft){gt.bindFramebuffer(C.FRAMEBUFFER,ft);try{let mt=y.texture,St=mt.format,wt=mt.type;if(!Ht.textureFormatReadable(St)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ht.textureTypeReadable(wt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=y.width-z&&B>=0&&B<=y.height-D&&C.readPixels(L,B,z,D,bt.convert(St),bt.convert(wt),nt)}finally{let mt=A!==null?At.get(A).__webglFramebuffer:null;gt.bindFramebuffer(C.FRAMEBUFFER,mt)}}},this.readRenderTargetPixelsAsync=function(y,L,B,z,D,nt,at){return dr(this,null,function*(){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ft=At.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&at!==void 0&&(ft=ft[at]),ft){gt.bindFramebuffer(C.FRAMEBUFFER,ft);try{let mt=y.texture,St=mt.format,wt=mt.type;if(!Ht.textureFormatReadable(St))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ht.textureTypeReadable(wt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(L>=0&&L<=y.width-z&&B>=0&&B<=y.height-D){let yt=C.createBuffer();C.bindBuffer(C.PIXEL_PACK_BUFFER,yt),C.bufferData(C.PIXEL_PACK_BUFFER,nt.byteLength,C.STREAM_READ),C.readPixels(L,B,z,D,bt.convert(St),bt.convert(wt),0),C.flush();let Gt=C.fenceSync(C.SYNC_GPU_COMMANDS_COMPLETE,0);yield Lh(C,Gt,4);try{C.bindBuffer(C.PIXEL_PACK_BUFFER,yt),C.getBufferSubData(C.PIXEL_PACK_BUFFER,0,nt)}finally{C.deleteBuffer(yt),C.deleteSync(Gt)}return nt}}finally{let mt=A!==null?At.get(A).__webglFramebuffer:null;gt.bindFramebuffer(C.FRAMEBUFFER,mt)}}})},this.copyFramebufferToTexture=function(y,L=null,B=0){y.isTexture!==!0&&(ki("WebGLRenderer: copyFramebufferToTexture function signature has changed."),L=arguments[0]||null,y=arguments[1]);let z=Math.pow(2,-B),D=Math.floor(y.image.width*z),nt=Math.floor(y.image.height*z),at=L!==null?L.x:0,ft=L!==null?L.y:0;Rt.setTexture2D(y,0),C.copyTexSubImage2D(C.TEXTURE_2D,B,0,0,at,ft,D,nt),gt.unbindTexture()},this.copyTextureToTexture=function(y,L,B=null,z=null,D=0){y.isTexture!==!0&&(ki("WebGLRenderer: copyTextureToTexture function signature has changed."),z=arguments[0]||null,y=arguments[1],L=arguments[2],D=arguments[3]||0,B=null);let nt,at,ft,mt,St,wt;
3837B!==null?(nt=B.max.x-B.min.x,at=B.max.y-B.min.y,ft=B.min.x,mt=B.min.y):(nt=y.image.width,at=y.image.height,ft=0,mt=0),z!==null?(St=z.x,wt=z.y):(St=0,wt=0);let yt=bt.convert(L.format),Gt=bt.convert(L.type);Rt.setTexture2D(L,0),C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,L.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,L.unpackAlignment);let Qt=C.getParameter(C.UNPACK_ROW_LENGTH),te=C.getParameter(C.UNPACK_IMAGE_HEIGHT),Ee=C.getParameter(C.UNPACK_SKIP_PIXELS),Wt=C.getParameter(C.UNPACK_SKIP_ROWS),xt=C.getParameter(C.UNPACK_SKIP_IMAGES),me=y.isCompressedTexture?y.mipmaps[D]:y.image;C.pixelStorei(C.UNPACK_ROW_LENGTH,me.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,me.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,ft),C.pixelStorei(C.UNPACK_SKIP_ROWS,mt),y.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,D,St,wt,nt,at,yt,Gt,me.data):y.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,D,St,wt,me.width,me.height,yt,me.data):C.texSubImage2D(C.TEXTURE_2D,D,St,wt,nt,at,yt,Gt,me),C.pixelStorei(C.UNPACK_ROW_LENGTH,Qt),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,te),C.pixelStorei(C.UNPACK_SKIP_PIXELS,Ee),C.pixelStorei(C.UNPACK_SKIP_ROWS,Wt),C.pixelStorei(C.UNPACK_SKIP_IMAGES,xt),D===0&&L.generateMipmaps&&C.generateMipmap(C.TEXTURE_2D),gt.unbindTexture()},this.copyTextureToTexture3D=function(y,L,B=null,z=null,D=0){y.isTexture!==!0&&(ki("WebGLRenderer: copyTextureToTexture3D function signature has changed."),B=arguments[0]||null,z=arguments[1]||null,y=arguments[2],L=arguments[3],D=arguments[4]||0);let nt,at,ft,mt,St,wt,yt,Gt,Qt,te=y.isCompressedTexture?y.mipmaps[D]:y.image;B!==null?(nt=B.max.x-B.min.x,at=B.max.y-B.min.y,ft=B.max.z-B.min.z,mt=B.min.x,St=B.min.y,wt=B.min.z):(nt=te.width,at=te.height,ft=te.depth,mt=0,St=0,wt=0),z!==null?(yt=z.x,Gt=z.y,Qt=z.z):(yt=0,Gt=0,Qt=0);let Ee=bt.convert(L.format),Wt=bt.convert(L.type),xt;if(L.isData3DTexture)Rt.setTexture3D(L,0),xt=C.TEXTURE_3D;else if(L.isDataArrayTexture||L.isCompressedArrayTexture)Rt.setTexture2DArray(L,0),xt=C.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,L.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,L.unpackAlignment);let me=C.getParameter(C.UNPACK_ROW_LENGTH),Xt=C.getParameter(C.UNPACK_IMAGE_HEIGHT),Oe=C.getParameter(C.UNPACK_SKIP_PIXELS),Xn=C.getParameter(C.UNPACK_SKIP_ROWS),we=C.getParameter(C.UNPACK_SKIP_IMAGES);C.pixelStorei(C.UNPACK_ROW_LENGTH,te.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,te.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,mt),C.pixelStorei(C.UNPACK_SKIP_ROWS,St),C.pixelStorei(C.UNPACK_SKIP_IMAGES,wt),y.isDataTexture||y.isData3DTexture?C.texSubImage3D(xt,D,yt,Gt,Qt,nt,at,ft,Ee,Wt,te.data):L.isCompressedArrayTexture?C.compressedTexSubImage3D(xt,D,yt,Gt,Qt,nt,at,ft,Ee,te.data):C.texSubImage3D(xt,D,yt,Gt,Qt,nt,at,ft,Ee,Wt,te),C.pixelStorei(C.UNPACK_ROW_LENGTH,me),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,Xt),C.pixelStorei(C.UNPACK_SKIP_PIXELS,Oe),C.pixelStorei(C.UNPACK_SKIP_ROWS,Xn),C.pixelStorei(C.UNPACK_SKIP_IMAGES,we),D===0&&L.generateMipmaps&&C.generateMipmap(xt),gt.unbindTexture()},this.initRenderTarget=function(y){At.get(y).__webglFramebuffer===void 0&&Rt.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?Rt.setTextureCube(y,0):y.isData3DTexture?Rt.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?Rt.setTexture2DArray(y,0):Rt.setTexture2D(y,0),gt.unbindTexture()},this.resetState=function(){N=0,R=0,A=null,gt.reset(),Ct.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return rn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===ao?"display-p3":"srgb",e.unpackColorSpace=Yt.workingColorSpace===rr?"display-p3":"srgb"}};var qs=class extends Ze{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 Bn,this.environmentIntensity=1,this.environmentRotation=new Bn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}};var Zs=class extends Sn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ot(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},Js=new I,Ks=new I,Pc=new ee,Ni=new bi,ys=new Si,Hr=new I,Ic=new I,ka=class extends Ze{constructor(t=new cn,e=new Zs){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let s=1,r=e.count;s<r;s++)Js.fromBufferAttribute(e,s-1),Ks.fromBufferAttribute(e,s),n[s]=n[s-1],n[s]+=Js.distanceTo(Ks);t.setAttribute("lineDistance",new Pe(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ys.copy(n.boundingSphere),ys.applyMatrix4(s),ys.radius+=r,t.ray.intersectsSphere(ys)===!1)return;Pc.copy(s).invert(),Ni.copy(t.ray).applyMatrix4(Pc);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){let m=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let v=m,f=_-1;v<f;v+=l){let u=h.getX(v),w=h.getX(v+1),S=Ms(this,t,Ni,c,u,w);S&&e.push(S)}if(this.isLineLoop){let v=h.getX(_-1),f=h.getX(m),u=Ms(this,t,Ni,c,v,f);u&&e.push(u)}}else{let m=Math.max(0,a.start),_=Math.min(d.count,a.start+a.count);for(let v=m,f=_-1;v<f;v+=l){let u=Ms(this,t,Ni,c,v,v+1);u&&e.push(u)}if(this.isLineLoop){let v=Ms(this,t,Ni,c,_-1,m);v&&e.push(v)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){let o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function Ms(i,t,e,n,s,r){let a=i.geometry.attributes.position;if(Js.fromBufferAttribute(a,s),Ks.fromBufferAttribute(a,r),e.distanceSqToSegment(Js,Ks,Hr,Ic)>n)return;Hr.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(Hr);if(!(c<t.near||c>
vendor: 17,982 bytes, line 3837
3837t.far))return{distance:c,point:Ic.clone().applyMatrix4(i.matrixWorld),index:s,face:null,faceIndex:null,object:i}}var Lc=new I,Dc=new I,Va=class extends ka{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let s=0,r=e.count;s<r;s+=2)Lc.fromBufferAttribute(e,s),Dc.fromBufferAttribute(e,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+Lc.distanceTo(Dc);t.setAttribute("lineDistance",new Pe(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var $s=class extends Sn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ot(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 Ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jc,this.normalScale=new Tt(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 Bn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}};function Ss(i,t,e){return!i||!e&&i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function Am(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}var Ti=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];n:{t:{let a;e:{i:if(!(t<s)){for(let o=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=s,s=e[++n],t<s)break t}a=e.length;break e}if(!(t>=r)){let o=e[1];t<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(s=r,r=e[--n-1],t>=r)break t}a=n,n=0;break e}break n}for(;n<a;){let o=n+a>>>1;t<e[o]?a=o:n=o+1}if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let a=0;a!==s;++a)e[a]=n[r+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ha=class extends Ti{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:No,endingEnd:No}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,a=t+1,o=s[r],c=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case Oo:r=t,o=2*e-n;break;case Fo:r=s.length-2,o=e+s[r]-s[r+1];break;default:r=t,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Oo:a=t,c=2*n-e;break;case Fo:a=1,c=n+s[1]-s[0];break;default:a=t-1,c=e}let l=(n-e)*.5,h=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,l=c-o,h=this._offsetPrev,p=this._offsetNext,d=this._weightPrev,m=this._weightNext,_=(n-e)/(s-e),v=_*_,f=v*_,u=-d*f+2*d*v-d*_,w=(1+d)*f+(-1.5-2*d)*v+(-.5+d)*_+1,S=(-1-m)*f+(1.5+m)*v+.5*_,T=m*f-m*v;for(let N=0;N!==o;++N)r[N]=u*a[h+N]+w*a[l+N]+S*a[c+N]+T*a[p+N];return r}},Ga=class extends Ti{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,l=c-o,h=(n-e)/(s-e),p=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*p+a[c+d]*h;return r}},Wa=class extends Ti{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},We=class{constructor(t,e,n,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ss(e,this.TimeBufferType),this.values=Ss(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Ss(t.times,Array),values:Ss(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Wa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ga(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ha(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Rs:e=this.InterpolantFactoryMethodDiscrete;break;case ba:e=this.InterpolantFactoryMethodLinear;break;case _r:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rs;case this.InterpolantFactoryMethodLinear:return ba;case this.InterpolantFactoryMethodSmooth:return _r}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t}return this}trim(t,e){let n=this.times,s=n.length,r=0,a=s-1;for(;r!==s&&n[r]<t;)++r;for(;a!==-1&&n[a]>e;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),t=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),t=!1;break}a=c}if(s!==void 0&&Am(s))for(let o=0,c=s.length;o!==c;++o){let l=s[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===_r,r=t.length-1,a=1;for(let o=1;o<r;++o){let c=!1,l=t[o],h=t[o+1];if(l!==h&&(o!==1||l!==t[0]))if(s)c=!0;else{let p=o*n,d=p-n,m=p+n;for(let _=0;_!==n;++_){let v=e[p+_];if(v!==e[d+_]||v!==e[m+_]){c=!0;break}}}if(c){if(o!==a){t[a]=t[o];let p=o*n,d=a*n;for(let m=0;m!==n;++m)e[d+m]=e[p+m]}++a}}if(r>0){t[a]=t[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)e[c+l]=e[o+l];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};We.prototype.TimeBufferType=Float32Array;We.prototype.ValueBufferType=Float32Array;We.prototype.DefaultInterpolation=ba;var zn=class extends We{constructor(t,e,n){super(t,e,n)}};zn.prototype.ValueTypeName="bool";zn.prototype.ValueBufferType=Array;zn.prototype.DefaultInterpolation=Rs;zn.prototype.InterpolantFactoryMethodLinear=void 0;zn.prototype.InterpolantFactoryMethodSmooth=void 0;var Xa=class extends We{};Xa.prototype.ValueTypeName="color";var Ya=class extends We{};Ya.prototype.ValueTypeName="number";var qa=class extends Ti{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-e)/(s-e),l=t*o;for(let h=l+o;l!==h;l+=4)Ge.slerpFlat(r,0,a,l-o,a,l,c);return r}},js=class extends We{InterpolantFactoryMethodLinear(t){return new qa(this.times,this.values,this.getValueSize(),t)}};js.prototype.ValueTypeName="quaternion";js.prototype.InterpolantFactoryMethodSmooth=void 0;var kn=class extends We{constructor(t,e,n){super(t,e,n)}};kn.prototype.ValueTypeName="string";kn.prototype.ValueBufferType=Array;kn.prototype.DefaultInterpolation=Rs;kn.prototype.InterpolantFactoryMethodLinear=void 0;kn.prototype.InterpolantFactoryMethodSmooth=void 0;var Za=class extends We{};Za.prototype.ValueTypeName="vector";var Yi=class extends Ze{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Ot(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}};var Gr=new ee,Uc=new I,Nc=new I,Qs=class{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Tt(512,512),this.map=null,this.mapPass=null,this.matrix=new ee,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xi,this._frameExtents=new Tt(1,1),this._viewportCount=1,this._viewports=[new Jt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,n=this.matrix;Uc.setFromMatrixPosition(t.matrixWorld),e.position.copy(Uc),Nc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Nc),e.updateMatrixWorld(),Gr.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Gr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Gr)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}};var Oc=new ee,Oi=new I,Wr=new I,Ja=class extends Qs{constructor(){super(new ve(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Tt(4,2),this._viewportCount=6,this._viewports=[new Jt(2,1,1,1),new Jt(0,1,1,1),new Jt(3,1,1,1),new Jt(1,1,1,1),new Jt(3,0,1,1),new Jt(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(t,e=0){let n=this.camera,s=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Oi.setFromMatrixPosition(t.matrixWorld),n.position.copy(Oi),Wr.copy(n.position),Wr.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Wr),n.updateMatrixWorld(),s.makeTranslation(-Oi.x,-Oi.y,-Oi.z),Oc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Oc)}},tr=class extends Yi{constructor(t,e,n=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new Ja}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}},Ka=class extends Qs{constructor(){super(new Gs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},er=class extends Yi{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ze.DEFAULT_UP),this.updateMatrix(),this.target=new Ze,this.shadow=new Ka}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}},nr=class extends Yi{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}};var lo="\\[\\]\\.:\\/",Cm=new RegExp("["+lo+"]","g"),ho="[^"+lo+"]",Rm="[^"+lo.replace("\\.","")+"]",Pm=/((?:WC+[\/:])*)/.source.replace("WC",ho),Im=/(WCOD+)?/.source.replace("WCOD",Rm),Lm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ho),Dm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ho),Um=new RegExp("^"+Pm+Im+Lm+Dm+"$"),Nm=["material","materials","bones","map"],$a=class{constructor(t,e,n){let s=n||ie.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},ie=(()=>{class i{constructor(e,n,s){this.path=n,this.parsedPath=s||i.parseTrackName(n),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,s){return e&&e.isAnimationObjectGroup?new i.Composite(e,n,s):new i(e,n,s)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Cm,"")}static parseTrackName(e){let n=Um.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let s={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=s.nodeName&&s.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let a=s.nodeName.substring(r+1);Nm.indexOf(a)!==-1&&(s.nodeName=s.nodeName.substring(0,r),s.objectName=a)}if(s.propertyName===null||s.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return s}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){let s=e.skeleton.getBoneByName(n);if(s!==void 0)return s}if(e.children){let s=function(a){for(let o=0;o<a.length;o++){let c=a[o];if(c.name===n||c.uuid===n)return c;let l=s(c.children);if(l)return l}return null},r=s(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){let s=this.resolvedProperty;for(let r=0,a=s.length;r!==a;++r)e[n++]=s[r]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){let s=this.resolvedProperty;for(let r=0,a=s.length;r!==a;++r)s[r]=e[n++]}_setValue_array_setNeedsUpdate(e,n){let s=this.resolvedProperty;for(let r=0,a=s.length;r!==a;++r)s[r]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){let s=this.resolvedProperty;for(let r=0,a=s.length;r!==a;++r)s[r]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}
3837_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node,n=this.parsedPath,s=n.objectName,r=n.propertyName,a=n.propertyIndex;if(e||(e=i.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(s){let h=n.objectIndex;switch(s){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let p=0;p<e.length;p++)if(e[p].name===h){h=p;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[s]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[s]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}let o=e[r];if(o===void 0){let h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(a!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[a]!==void 0&&(a=e.morphTargetDictionary[a])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}return i.Composite=$a,i})();ie.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ie.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ie.prototype.GetterByBindingType=[ie.prototype._getValue_direct,ie.prototype._getValue_array,ie.prototype._getValue_arrayElement,ie.prototype._getValue_toArray];ie.prototype.SetterByBindingTypeAndVersioning=[[ie.prototype._setValue_direct,ie.prototype._setValue_direct_setNeedsUpdate,ie.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ie.prototype._setValue_array,ie.prototype._setValue_array_setNeedsUpdate,ie.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ie.prototype._setValue_arrayElement,ie.prototype._setValue_arrayElement_setNeedsUpdate,ie.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ie.prototype._setValue_fromArray,ie.prototype._setValue_fromArray_setNeedsUpdate,ie.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var km=new Float32Array(1);var qi=class{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(xe(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ir=class extends Va{constructor(t=10,e=10,n=4473924,s=8947848){n=new Ot(n),s=new Ot(s);let r=e/2,a=t/e,o=t/2,c=[],l=[];for(let d=0,m=0,_=-o;d<=e;d++,_+=a){c.push(-o,0,_,o,0,_),c.push(_,0,-o,_,0,o);let v=d===r?n:s;v.toArray(l,m),m+=3,v.toArray(l,m),m+=3,v.toArray(l,m),m+=3,v.toArray(l,m),m+=3}let h=new cn;h.setAttribute("position",new Pe(c,3)),h.setAttribute("color",new Pe(l,3));let p=new Zs({vertexColors:!0,toneMapped:!1});super(h,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ja}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ja);var al=(()=>{class i{constructor(){}ngOnInit(){this.addToScene()}addToScene(){let e=new nr(this.color,this.intensity);this.scene.add(e)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-ambient-light"]],inputs:{intensity:"intensity",color:"color",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var ol=(()=>{class i{constructor(){}ngOnInit(){this.addToScene()}addToScene(){this.scene.background=new Ot(this.color)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-color"]],inputs:{color:"color",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var cl=(()=>{class i{constructor(){}ngOnInit(){this.addToScene()}addToScene(){let e=new er(this.color,this.intensity);e.position.set(this.position.x,this.position.y,this.position.z),this.scene.add(e)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-directional-light"]],inputs:{intensity:"intensity",color:"color",position:"position",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var ll=(()=>{class i{constructor(){}ngOnInit(){this.addToScene()}addToScene(){let e=new ir(...this.args);this.scene.add(e)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-grid-helper"]],inputs:{args:"args",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();
3837var hl=(()=>{class i{constructor(){}ngOnInit(){this.addToScene()}addToScene(){let e=new tr(this.color,this.intensity);e.position.set(this.position.x,this.position.y,this.position.z),this.scene.add(e)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-point-light"]],inputs:{intensity:"intensity",color:"color",position:"position",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var ul={type:"change"},uo={type:"start"},dl={type:"end"},or=new bi,fl=new ke,Om=Math.cos(70*$c.DEG2RAD),cr=class extends qe{constructor(t,e){super(),this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new I,this.cursor=new I,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Vn.ROTATE,MIDDLE:Vn.DOLLY,RIGHT:Vn.PAN},this.touches={ONE:Hn.ROTATE,TWO:Hn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(g){g.addEventListener("keydown",ot),this._domElementKeyEvents=g},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ot),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(ul),n.update(),r=s.NONE},this.update=function(){let g=new I,U=new Ge().setFromUnitVectors(t.up,new I(0,1,0)),O=U.clone().invert(),H=new I,j=new Ge,_t=new I,Et=2*Math.PI;return function(le=null){let zt=n.object.position;g.copy(zt).sub(n.target),g.applyQuaternion(U),o.setFromVector3(g),n.autoRotate&&r===s.NONE&&W(M(le)),n.enableDamping?(o.theta+=c.theta*n.dampingFactor,o.phi+=c.phi*n.dampingFactor):(o.theta+=c.theta,o.phi+=c.phi);let he=n.minAzimuthAngle,se=n.maxAzimuthAngle;isFinite(he)&&isFinite(se)&&(he<-Math.PI?he+=Et:he>Math.PI&&(he-=Et),se<-Math.PI?se+=Et:se>Math.PI&&(se-=Et),he<=se?o.theta=Math.max(he,Math.min(se,o.theta)):o.theta=o.theta>(he+se)/2?Math.max(he,o.theta):Math.min(se,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let hn=!1;if(n.zoomToCursor&&R||n.object.isOrthographicCamera)o.radius=lt(o.radius);else{let pe=o.radius;o.radius=lt(o.radius*l),hn=pe!=o.radius}if(g.setFromSpherical(o),g.applyQuaternion(O),zt.copy(n.target).add(g),n.object.lookAt(n.target),n.enableDamping===!0?(c.theta*=1-n.dampingFactor,c.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(c.set(0,0,0),h.set(0,0,0)),n.zoomToCursor&&R){let pe=null;if(n.object.isPerspectiveCamera){let Ke=g.length();pe=lt(Ke*l);let En=Ke-pe;n.object.position.addScaledVector(T,En),n.object.updateMatrixWorld(),hn=!!En}else if(n.object.isOrthographicCamera){let Ke=new I(N.x,N.y,0);Ke.unproject(n.object);let En=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),hn=En!==n.object.zoom;let Ri=new I(N.x,N.y,0);Ri.unproject(n.object),n.object.position.sub(Ri).add(Ke),n.object.updateMatrixWorld(),pe=g.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;pe!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(pe).add(n.object.position):(or.origin.copy(n.object.position),or.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(or.direction))<Om?t.lookAt(n.target):(fl.setFromNormalAndCoplanarPoint(n.object.up,n.target),or.intersectPlane(fl,n.target))))}else if(n.object.isOrthographicCamera){let pe=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),pe!==n.object.zoom&&(n.object.updateProjectionMatrix(),hn=!0)}return l=1,R=!1,hn||H.distanceToSquared(n.object.position)>a||8*(1-j.dot(n.object.quaternion))>a||_t.distanceToSquared(n.target)>a?(n.dispatchEvent(ul),H.copy(n.object.position),j.copy(n.object.quaternion),_t.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ct),n.domElement.removeEventListener("pointerdown",Rt),n.domElement.removeEventListener("pointercancel",x),n.domElement.removeEventListener("wheel",Q),n.domElement.removeEventListener("pointermove",E),n.domElement.removeEventListener("pointerup",x),n.domElement.getRootNode().removeEventListener("keydown",vt,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",ot),n._domElementKeyEvents=null)};let n=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},r=s.NONE,a=1e-6,o=new qi,c=new qi,l=1,h=new I,p=new Tt,d=new Tt,m=ne
3837w Tt,_=new Tt,v=new Tt,f=new Tt,u=new Tt,w=new Tt,S=new Tt,T=new I,N=new Tt,R=!1,A=[],F={},b=!1;function M(g){return g!==null?2*Math.PI/60*n.autoRotateSpeed*g:2*Math.PI/60/60*n.autoRotateSpeed}function P(g){let U=Math.abs(g*.01);return Math.pow(.95,n.zoomSpeed*U)}function W(g){c.theta-=g}function V(g){c.phi-=g}let Z=function(){let g=new I;return function(O,H){g.setFromMatrixColumn(H,0),g.multiplyScalar(-O),h.add(g)}}(),q=function(){let g=new I;return function(O,H){n.screenSpacePanning===!0?g.setFromMatrixColumn(H,1):(g.setFromMatrixColumn(H,0),g.crossVectors(n.object.up,g)),g.multiplyScalar(O),h.add(g)}}(),X=function(){let g=new I;return function(O,H){let j=n.domElement;if(n.object.isPerspectiveCamera){let _t=n.object.position;g.copy(_t).sub(n.target);let Et=g.length();Et*=Math.tan(n.object.fov/2*Math.PI/180),Z(2*O*Et/j.clientHeight,n.object.matrix),q(2*H*Et/j.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Z(O*(n.object.right-n.object.left)/n.object.zoom/j.clientWidth,n.object.matrix),q(H*(n.object.top-n.object.bottom)/n.object.zoom/j.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function J(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function G(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function rt(g,U){if(!n.zoomToCursor)return;R=!0;let O=n.domElement.getBoundingClientRect(),H=g-O.left,j=U-O.top,_t=O.width,Et=O.height;N.x=H/_t*2-1,N.y=-(j/Et)*2+1,T.set(N.x,N.y,1).unproject(n.object).sub(n.object.position).normalize()}function lt(g){return Math.max(n.minDistance,Math.min(n.maxDistance,g))}function pt(g){p.set(g.clientX,g.clientY)}function Ft(g){rt(g.clientX,g.clientX),u.set(g.clientX,g.clientY)}function Vt(g){_.set(g.clientX,g.clientY)}function Y(g){d.set(g.clientX,g.clientY),m.subVectors(d,p).multiplyScalar(n.rotateSpeed);let U=n.domElement;W(2*Math.PI*m.x/U.clientHeight),V(2*Math.PI*m.y/U.clientHeight),p.copy(d),n.update()}function tt(g){w.set(g.clientX,g.clientY),S.subVectors(w,u),S.y>0?J(P(S.y)):S.y<0&&G(P(S.y)),u.copy(w),n.update()}function dt(g){v.set(g.clientX,g.clientY),f.subVectors(v,_).multiplyScalar(n.panSpeed),X(f.x,f.y),_.copy(v),n.update()}function ht(g){rt(g.clientX,g.clientY),g.deltaY<0?G(P(g.deltaY)):g.deltaY>0&&J(P(g.deltaY)),n.update()}function Pt(g){let U=!1;switch(g.code){case n.keys.UP:g.ctrlKey||g.metaKey||g.shiftKey?V(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):X(0,n.keyPanSpeed),U=!0;break;case n.keys.BOTTOM:g.ctrlKey||g.metaKey||g.shiftKey?V(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):X(0,-n.keyPanSpeed),U=!0;break;case n.keys.LEFT:g.ctrlKey||g.metaKey||g.shiftKey?W(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):X(n.keyPanSpeed,0),U=!0;break;case n.keys.RIGHT:g.ctrlKey||g.metaKey||g.shiftKey?W(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):X(-n.keyPanSpeed,0),U=!0;break}U&&(g.preventDefault(),n.update())}function Lt(g){if(A.length===1)p.set(g.pageX,g.pageY);else{let U=Ct(g),O=.5*(g.pageX+U.x),H=.5*(g.pageY+U.y);p.set(O,H)}}function Nt(g){if(A.length===1)_.set(g.pageX,g.pageY);else{let U=Ct(g),O=.5*(g.pageX+U.x),H=.5*(g.pageY+U.y);_.set(O,H)}}function qt(g){let U=Ct(g),O=g.pageX-U.x,H=g.pageY-U.y,j=Math.sqrt(O*O+H*H);u.set(0,j)}function C(g){n.enableZoom&&qt(g),n.enablePan&&Nt(g)}function $t(g){n.enableZoom&&qt(g),n.enableRotate&&Lt(g)}function kt(g){if(A.length==1)d.set(g.pageX,g.pageY);else{let O=Ct(g),H=.5*(g.pageX+O.x),j=.5*(g.pageY+O.y);d.set(H,j)}m.subVectors(d,p).multiplyScalar(n.rotateSpeed);let U=n.domElement;W(2*Math.PI*m.x/U.clientHeight),V(2*Math.PI*m.y/U.clientHeight),p.copy(d)}function Ht(g){if(A.length===1)v.set(g.pageX,g.pageY);else{let U=Ct(g),O=.5*(g.pageX+U.x),H=.5*(g.pageY+U.y);v.set(O,H)}f.subVectors(v,_).multiplyScalar(n.panSpeed),X(f.x,f.y),_.copy(v)}function gt(g){let U=Ct(g),O=g.pageX-U.x,H=g.pageY-U.y,j=Math.sqrt(O*O+H*H);w.set(0,j),S.set(0,Math.pow(w.y/u.y,n.zoomSpeed)),J(S.y),u.copy(w);let _t=(g.pageX+U.x)*.5,Et=(g.pageY+U.y)*.5;rt(_t,Et)}function jt(g){n.enableZoom&>(g),n.enablePan&&Ht(g)}function At(g){n.enableZoom&>(g),n.enableRotate&&kt(g)}function Rt(g){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(g.pointerId),n.domElement.addEventListener("pointermove",E),n.domElement.addEventListener("pointerup",x)),!ut(g)&&(Bt(g),g.pointerType==="touch"?It(g):k(g)))}function E(g){n.enabled!==!1&&(g.pointerType==="touch"?et(g):$(g))}function x(g){switch(Mt(g),A.length){case 0:n.domElement.releasePointerCapture(g.pointerId),n.domElement.removeEventListener("pointermove",E),n.domElement.removeEventListener("pointerup",x),n.dispatchEvent(dl),r=s.NONE;break;case 1:let U=A[0],O=F[U];It({pointerId:U,pageX:O.x,pageY:O.y});break}}function k(g){let U;switch(g.button){case 0:U=n.mouseButtons.LEFT;break;case 1:U=n.mouseButtons.MIDDLE;break;case 2:U=n.mouseButtons.RIGHT;break;default:U=-1}switch(U){case Vn.DOLLY:if(n.enableZoom===!1)return;Ft(g),r=s.DOLLY;break;case Vn.ROTATE:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enablePan===!1)return;Vt(g),r=s.PAN}else{if(n.enableRotate===!1)return;pt(g),r=s.ROTATE}break;case Vn.PAN:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enableRotate===!1)return;pt(g),r=s.ROTATE}else{if(n.enablePan===!1)return;Vt(g),r=s.PAN}break;default:r=s.NONE}r!==s.NONE&&n.dispatchEvent(uo)}function $(g){switch(r){case s.ROTATE:if(n.enableRotate===!1)return;Y(g);break;case s.DOLLY:if(n.enableZoom===!1)return;tt(g);break;case s.PAN:if(n.enablePan===!1)return;dt(g);break}}function Q(g){n.enabled===!1||n.enableZoom===!1||r!==s.NONE||(g.preventDefault(),n.dispatchEvent(uo),ht(K(g)),n.dispatchEvent(dl))}function K(g){let U=g.deltaMode,O={clientX:g.clientX,clientY:g.clientY,deltaY:g.deltaY};switch(U){case 1:O.deltaY*=16;break;case 2:O.deltaY*=100;break}return g.ctrlKey&&!b&&(O.deltaY*=10),O}function vt(g){g.key==="Control"&&(b=!0,n.domElement.getRootNode().addEventListener("keyup",it,{passive:!0,capture:!0}))}function it(g){g.key==="Control"&&(b=!1,n.domElement.getRootNode().removeEventListener("keyup",it,{passive:!0,capture:!0}))}function ot(g){n.enabled===!1||n.enablePan===!1||Pt(g)}
3837function It(g){switch(bt(g),A.length){case 1:switch(n.touches.ONE){case Hn.ROTATE:if(n.enableRotate===!1)return;Lt(g),r=s.TOUCH_ROTATE;break;case Hn.PAN:if(n.enablePan===!1)return;Nt(g),r=s.TOUCH_PAN;break;default:r=s.NONE}break;case 2:switch(n.touches.TWO){case Hn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;C(g),r=s.TOUCH_DOLLY_PAN;break;case Hn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;$t(g),r=s.TOUCH_DOLLY_ROTATE;break;default:r=s.NONE}break;default:r=s.NONE}r!==s.NONE&&n.dispatchEvent(uo)}function et(g){switch(bt(g),r){case s.TOUCH_ROTATE:if(n.enableRotate===!1)return;kt(g),n.update();break;case s.TOUCH_PAN:if(n.enablePan===!1)return;Ht(g),n.update();break;case s.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;jt(g),n.update();break;case s.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;At(g),n.update();break;default:r=s.NONE}}function ct(g){n.enabled!==!1&&g.preventDefault()}function Bt(g){A.push(g.pointerId)}function Mt(g){delete F[g.pointerId];for(let U=0;U<A.length;U++)if(A[U]==g.pointerId){A.splice(U,1);return}}function ut(g){for(let U=0;U<A.length;U++)if(A[U]==g.pointerId)return!0;return!1}function bt(g){let U=F[g.pointerId];U===void 0&&(U=new Tt,F[g.pointerId]=U),U.set(g.pageX,g.pageY)}function Ct(g){let U=g.pointerId===A[0]?A[1]:A[0];return F[U]}n.domElement.addEventListener("contextmenu",ct),n.domElement.addEventListener("pointerdown",Rt),n.domElement.addEventListener("pointercancel",x),n.domElement.addEventListener("wheel",Q,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",vt,{passive:!0,capture:!0}),this.update()}};var pl=(()=>{class i{constructor(){}ngOnInit(){this.controls=new cr(this.camera,this.renderer.domElement)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-orbit-controls"]],inputs:{camera:"camera",renderer:"renderer"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var ml=(()=>{class i{constructor(){}ngOnInit(){let e=new wi(this.lidarData.height,this.lidarData.width,this.lidarData.height-1,this.lidarData.width-1),n=e.attributes.position.array,s=Math.min(...this.lidarData.heightMap);for(let o=0;o<n.length;o+=3){let c=this.lidarData.heightMap[o/3];n[o+2]=c-s}e.computeVertexNormals();let r=new $s({color:13092807,wireframe:!1,roughness:.7,metalness:.1,side:De,shadowSide:De,flatShading:!1}),a=new Re(e,r);a.rotation.x=-Math.PI/2,a.rotation.z=Math.PI/2,a.receiveShadow=!0,a.castShadow=!0,this.scene.add(a)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-terrain"]],inputs:{lidarData:"lidarData",scene:"scene"},standalone:!0,features:[oe],decls:0,vars:0,template:function(n,s){},encapsulation:2})}}return i})();var Fm=()=>[200,40],gl=(()=>{class i{constructor(){this.topLightPosition=new I(200,200,200),this.secondaryTopLightPosition=new I(0,300,0),this.bottomLightPosition=new I(-100,-200,-100),this.pointLightPosition=new I(0,200,400),this.animationFrameId=null,this.animateLoop=()=>{this.animationFrameId=requestAnimationFrame(this.animateLoop),this.renderer.render(this.scene,this.camera)}}ngOnInit(){this.initThreeJS(),this.animateLoop()}ngOnDestroy(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.renderer?.dispose()}initThreeJS(){this.scene=new qs,this.camera=new ve(75,window.innerWidth/window.innerHeight,.1,1e3),this.camera.position.set(0,100,200),this.renderer=new Ys,this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=Qa,document.getElementById("threejs-container")?.appendChild(this.renderer.domElement)}onWindowResize(e){this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(window.innerWidth,window.innerHeight)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-ngt-canvas"]],hostBindings:function(n,s){n&1&&$i("resize",function(a){return s.onWindowResize(a)},!1,_o)},inputs:{lidarData:"lidarData"},standalone:!0,features:[oe],decls:10,vars:22,consts:[["id","threejs-container"],["color","#bfd1e5",3,"sce
3837ne"],[3,"args","scene"],["color","#ffffff",3,"intensity","scene"],["color","#4b371c",3,"position","intensity","scene"],["color","#ffffff",3,"position","intensity","scene"],["color","#ffffcc",3,"position","intensity","scene"],[3,"lidarData","scene"],[3,"camera","renderer"]],template:function(n,s){n&1&&Yn(0,"div",0)(1,"app-ngt-color",1)(2,"app-ngt-grid-helper",2)(3,"app-ngt-ambient-light",3)(4,"app-ngt-point-light",4)(5,"app-ngt-directional-light",5)(6,"app-ngt-directional-light",6)(7,"app-ngt-directional-light",5)(8,"app-terrain",7)(9,"app-ngt-orbit-controls",8),n&2&&(Te(),Se("scene",s.scene),Te(),Se("args",yo(21,Fm))("scene",s.scene),Te(),Se("intensity",.3)("scene",s.scene),Te(),Se("position",s.pointLightPosition)("intensity",1)("scene",s.scene),Te(),Se("position",s.topLightPosition)("intensity",.8)("scene",s.scene),Te(),Se("position",s.secondaryTopLightPosition)("intensity",.4)("scene",s.scene),Te(),Se("position",s.bottomLightPosition)("intensity",.6)("scene",s.scene),Te(),Se("lidarData",s.lidarData)("scene",s.scene),Te(),Se("camera",s.camera)("renderer",s.renderer))},dependencies:[al,ol,cl,ll,hl,pl,ml],styles:["body[_ngcontent-%COMP%]{margin:0}canvas[_ngcontent-%COMP%]{display:block}"]})}}return i})();var _l=(()=>{class i{constructor(){}ngOnInit(){}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=ae({type:i,selectors:[["app-terrain-canvas"]],inputs:{lidarData:"lidarData",scene:"scene"},standalone:!0,features:[oe],decls:1,vars:1,consts:[[3,"lidarData"]],template:function(n,s){n&1&&Yn(0,"app-ngt-canvas",0),n&2&&Se("lidarData",s.lidarData)},dependencies:[gl]})}}return i})();var fg=(()=>{class i{constructor(e,n){this.dialogRef=e,this.data=n,this.lidarData=n}ngOnInit(){}closeModal(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)(fr(bo),fr(Eo,8))}}static{this.\u0275cmp=ae({type:i,selectors:[["app-lidar-modal"]],standalone:!0,features:[oe],decls:7,vars:4,consts:[["id","modal-content-wrapper"],[3,"lidarData"],["id","modal-close-button",1,"btn","btn-outline-dark",3,"click"]],template:function(n,s){n&1&&(pr(0,"div",0)(1,"mat-dialog-content"),Yn(2,"app-terrain-canvas",1),mr(),pr(3,"mat-dialog-actions")(4,"button",2),$i("click",function(){return s.closeModal()}),xo(5),Mo(6,"translate"),mr()()()),n&2&&(Te(2),Se("lidarData",s.lidarData),Te(3),vo(So(6,2,"Close")))},dependencies:[Ao,To,wo,Ro,Co,_l],styles:["#modal-content-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column}mat-dialog-content[_ngcontent-%COMP%]{flex:1;display:flex;justify-content:center;align-items:center;overflow:hidden}app-terrain-canvas[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center}canvas[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain}.btn[_ngcontent-%COMP%]:focus-visible{color:#000;background-color:#fff;box-shadow:none}.btn[_ngcontent-%COMP%]{display:block;width:100%}"]})}}return i})();export{fg as LidarModalComponent};
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.