vendor: 8,783 bytes, lines 1-5
1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Ns="170",jo=0,na=1,Jo=2,fo=1,Qo=2,jt=3,vn=0,xt=1,Jt=2,nn=0,$n=1,or=2,ia=3,ra=4,el=5,wn=100,tl=101,nl=102,il=103,rl=104,sl=200,al=201,ol=202,ll=203,Yr=204,Kr=205,cl=206,ul=207,hl=208,fl=209,dl=210,pl=211,ml=212,gl=213,_l=214,Zr=0,$r=1,jr=2,Qn=3,Jr=4,Qr=5,es=6,ts=7,po=0,vl=1,xl=2,_n=0,Ml=1,Sl=2,El=3,yl=4,Tl=5,bl=6,Al=7,mo=300,ei=301,ti=302,ns=303,is=304,ur=306,rs=1e3,Cn=1001,ss=1002,yt=1003,wl=1004,Li=1005,Ht=1006,_r=1007,Pn=1008,an=1009,go=1010,_o=1011,Ei=1012,Fs=1013,Dn=1014,en=1015,Vt=1016,Os=1017,Bs=1018,ni=1020,vo=35902,xo=1021,Mo=1022,Nt=1023,So=1024,Eo=1025,jn=1026,ii=1027,yo=1028,zs=1029,To=1030,Hs=1031,Vs=1033,tr=33776,nr=33777,ir=33778,rr=33779,as=35840,os=35841,ls=35842,cs=35843,us=36196,hs=37492,fs=37496,ds=37808,ps=37809,ms=37810,gs=37811,_s=37812,vs=37813,xs=37814,Ms=37815,Ss=37816,Es=37817,ys=37818,Ts=37819,bs=37820,As=37821,sr=36492,ws=36494,Rs=36495,bo=36283,Cs=36284,Ps=36285,Ds=36286,Rl=3200,Cl=3201,Ao=0,Pl=1,gn="",wt="srgb",ai="srgb-linear",hr="linear",Ke="srgb",Un=7680,sa=519,Dl=512,Ll=513,Ul=514,wo=515,Il=516,Nl=517,Fl=518,Ol=519,aa=35044,oa="300 es",tn=2e3,lr=2001;class oi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const ut=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let la=1234567;const Mi=Math.PI/180,ri=180/Math.PI;function li(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ut[i&255]+ut[i>>8&255]+ut[i>>16&255]+ut[i>>24&255]+"-"+ut[e&255]+ut[e>>8&255]+"-"+ut[e>>16&15|64]+ut[e>>24&255]+"-"+ut[t&63|128]+ut[t>>8&255]+"-"+ut[t>>16&255]+ut[t>>24&255]+ut[n&255]+ut[n>>8&255]+ut[n>>16&255]+ut[n>>24&255]).toLowerCase()}function ft(i,e,t){return Math.max(e,Math.min(t,i))}function Gs(i,e){return(i%e+e)%e}function Bl(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function zl(i,e,t){return i!==e?(t-i)/(e-i):0}function Si(i,e,t){return(1-t)*i+t*e}function Hl(i,e,t,n){return Si(i,e,1-Math.exp(-t*n))}function Vl(i,e=1){return e-Math.abs(Gs(i,e*2)-e)}function Gl(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function kl(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Wl(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Xl(i,e){return i+Math.random()*(e-i)}function ql(i){return i*(.5-Math.random())}function Yl(i){i!==void 0&&(la=i);let e=la+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Kl(i){return i*Mi}function Zl(i){return i*ri}function $l(i){return(i&i-1)===0&&i!==0}function jl(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Jl(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Ql(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),f=s((e-n)/2),d=a((e-n)/2),m=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*f,l*d,o*c);break;case"YZY":i.set(l*d,o*h,l*f,o*c);break;case"ZXZ":i.set(l*f,l*d,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*m,o*c);break;case"YXY":i.set(l*m,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*m,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Yn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function mt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const ec={DEG2RAD:Mi,RAD2DEG:ri,generateUUID:li,clamp:ft,euclideanModulo:Gs,mapLinear:Bl,inverseLerp:zl,lerp:Si,damp:Hl,pingpong:Vl,smoothstep:Gl,smootherstep:kl,randInt:Wl,randFloat:Xl,randFloatSpread:ql,seededRandom:Yl,degToRad:Kl,radToDeg:Zl,isPowerOfTwo:$l,ceilPowerOfTwo:jl,floorPowerOfTwo:Jl,setQuaternionFromProperEuler:Ql,normalize:mt,denormalize:Yn};class we{constructor(e=0,t=0){we.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}
vendor: 11,233 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pe{constructor(e,t,n,r,s,a,o,l,c){Pe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],f=n[7],d=n[2],m=n[5],_=n[8],M=r[0],p=r[3],u=r[6],b=r[1],T=r[4],S=r[7],F=r[2],R=r[5],w=r[8];return s[0]=a*M+o*b+l*F,s[3]=a*p+o*T+l*R,s[6]=a*u+o*S+l*w,s[1]=c*M+h*b+f*F,s[4]=c*p+h*T+f*R,s[7]=c*u+h*S+f*w,s[2]=d*M+m*b+_*F,s[5]=d*p+m*T+_*R,s[8]=d*u+m*S+_*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],f=h*a-o*c,d=o*l-h*s,m=c*s-a*l,_=t*f+n*d+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/_;return e[0]=f*M,e[1]=(r*c-h*n)*M,e[2]=(o*n-r*a)*M,e[3]=d*M,e[4]=(h*t-r*l)*M,e[5]=(r*s-o*t)*M,e[6]=m*M,e[7]=(n*l-c*t)*M,e[8]=(a*t-n*s)*M,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(vr.makeScale(e,t)),this}rotate(e){return this.premultiply(vr.makeRotation(-e)),this}translate(e,t){return this.premultiply(vr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const vr=new Pe;function Ro(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function cr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function tc(){const i=cr("canvas");return i.style.display="block",i}const ca={};function vi(i){i in ca||(ca[i]=!0,console.warn(i))}function nc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function ic(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function rc(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ve={enabled:!0,workingColorSpace:ai,spaces:{},convert:function(i,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===Ke&&(i.r=rn(i.r),i.g=rn(i.g),i.b=rn(i.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(i.applyMatrix3(this.spaces[e].toXYZ),i.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===Ke&&(i.r=Jn(i.r),i.g=Jn(i.g),i.b=Jn(i.b))),i},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===gn?hr:this.spaces[i].transfer},getLuminanceCoefficients:function(i,e=this.workingColorSpace){return i.fromArray(this.spaces[e].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,e,t){return i.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}};function rn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Jn(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const ua=[.64,.33,.3,.6,.15,.06],ha=[.2126,.7152,.0722],fa=[.3127,.329],da=new Pe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),pa=new Pe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ve.define({[ai]:{primaries:ua,whitePoint:fa,transfer:hr,toXYZ:da,fromXYZ:pa,luminanceCoefficients:ha,workingColorSpaceConfig:{unpackColorSpace:wt},outputColorSpaceConfig:{drawingBufferColorSpace:wt}},[wt]:{primaries:ua,whitePoint:fa,transfer:Ke,toXYZ:da,fromXYZ:pa,luminanceCoefficients:ha,outputColorSpaceConfig:{drawingBufferColorSpace:wt}}});let In;class sc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{In===void 0&&(In=cr("canvas")),In.width=e.width,In.height=e.height;const n=In.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=In}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=rn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(rn(t[n]/255)*255):t[n]=rn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let ac=0;class Co{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ac++}),this.uuid=li(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(xr(r[a].image)):s.push(xr(r[a]))}else s=xr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function xr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?sc.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."),{})}let oc=0;class pt extends oi{constructor(e=pt.DEFAULT_IMAGE,t=pt.DEFAULT_MAPPING,n=Cn,r=Cn,s=Ht,a=Pn,o=Nt,l=an,c=pt.DEFAULT_ANISOTROPY,h=gn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oc++}),this.uuid=li(),this.name="",this.source=new Co(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new we(0,0),this.repeat=new we(1,1),this.center=new we(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,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: 9,301 bytes, line 5
5=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==mo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case rs:e.x=e.x-Math.floor(e.x);break;case Cn:e.x=e.x<0?0:1;break;case ss: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 rs:e.y=e.y-Math.floor(e.y);break;case Cn:e.y=e.y<0?0:1;break;case ss: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++}}pt.DEFAULT_IMAGE=null;pt.DEFAULT_MAPPING=mo;pt.DEFAULT_ANISOTROPY=1;class qe{constructor(e=0,t=0,n=0,r=1){qe.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],f=l[8],d=l[1],m=l[5],_=l[9],M=l[2],p=l[6],u=l[10];if(Math.abs(h-d)<.01&&Math.abs(f-M)<.01&&Math.abs(_-p)<.01){if(Math.abs(h+d)<.1&&Math.abs(f+M)<.1&&Math.abs(_+p)<.1&&Math.abs(c+m+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,S=(m+1)/2,F=(u+1)/2,R=(h+d)/4,w=(f+M)/4,I=(_+p)/4;return T>S&&T>F?T<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(T),r=R/n,s=w/n):S>F?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=R/r,s=I/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=w/s,r=I/s),this.set(n,r,s,t),this}let b=Math.sqrt((p-_)*(p-_)+(f-M)*(f-M)+(d-h)*(d-h));return Math.abs(b)<.001&&(b=1),this.x=(p-_)/b,this.y=(f-M)/b,this.z=(d-h)/b,this.w=Math.acos((c+m+u-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class lc extends oi{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new qe(0,0,e,t),this.scissorTest=!1,this.viewport=new qe(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ht,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new pt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.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(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Co(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Rt extends lc{constructor(e=1,t=1,n={}
vendor: 4,150 bytes, line 5
5){super(e,t,n),this.isWebGLRenderTarget=!0}}class Po extends pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yt,this.minFilter=yt,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class cc extends pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yt,this.minFilter=yt,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class bi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],f=n[r+3];const d=s[a+0],m=s[a+1],_=s[a+2],M=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f;return}if(o===1){e[t+0]=d,e[t+1]=m,e[t+2]=_,e[t+3]=M;return}if(f!==M||l!==d||c!==m||h!==_){let p=1-o;const u=l*d+c*m+h*_+f*M,b=u>=0?1:-1,T=1-u*u;if(T>Number.EPSILON){const F=Math.sqrt(T),R=Math.atan2(F,u*b);p=Math.sin(p*R)/F,o=Math.sin(o*R)/F}const S=o*b;if(l=l*p+d*S,c=c*p+m*S,h=h*p+_*S,f=f*p+M*S,p===1-o){const F=1/Math.sqrt(l*l+c*c+h*h+f*f);l*=F,c*=F,h*=F,f*=F}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],f=s[a],d=s[a+1],m=s[a+2],_=s[a+3];return e[t]=o*_+h*f+l*m-c*d,e[t+1]=l*_+h*d+c*f-o*m,e[t+2]=c*_+h*m+o*d-l*f,e[t+3]=h*_-o*f-l*d-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),f=o(s/2),d=l(n/2),m=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=d*h*f+c*m*_,this._y=c*m*f-d*h*_,this._z=c*h*_+d*m*f,this._w=c*h*f-d*m*_;break;case"YXZ":this._x=d*h*f+c*m*_,this._y=c*m*f-d*h*_,this._z=c*h*_-d*m*f,this._w=c*h*f+d*m*_;break;case"ZXY":this._x=d*h*f-c*m*_,this._y=c*m*f+d*h*_,this._z=c*h*_+d*m*f,this._w=c*h*f-d*m*_;break;case"ZYX":this._x=d*h*f-c*m*_,this._y=c*m*f+d*h*_,this._z=c*h*_-d*m*f,this._w=c*h*f+d*m*_;break;case"YZX":this._x=d*h*f+c*m*_,this._y=c*m*f+d*h*_,this._z=c*h*_-d*m*f,this._w=c*h*f-d*m*_;break;case"XZY":this._x=d*h*f-c*m*_,this._y=c*m*f-d*h*_,this._z=c*h*_+d*m*f,this._w=c*h*f+d*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],f=t[10],d=n+o+f;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>f){const m=2*Math.sqrt(1+n-o-f);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>f){const m=2*Math.sqrt(1+o-n-f);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+f-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ft(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
vendor: 31,377 bytes, line 5
5conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),f=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*f+this._w*d,this._x=n*f+this._x*d,this._y=r*f+this._y*d,this._z=s*f+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ma.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ma.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),f=2*(s*n-a*t);return this.x=t+l*c+a*f-o*h,this.y=n+l*h+o*c-s*f,this.z=r+l*f+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Mr.copy(this).projectOnVector(e),this.sub(Mr)}reflect(e){return this.sub(Mr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Mr=new U,ma=new bi;class Ai{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Dt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Dt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Dt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Dt):Dt.fromBufferAttribute(s,a),Dt.applyMatrix4(e.matrixWorld),this.expandByPoint(Dt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ui.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ui.copy(n.boundingBox)),Ui.applyMatrix4(e.matrixWorld),this.union(Ui)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Dt),Dt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(di),Ii.subVectors(this.max,di),Nn.subVectors(e.a,di),Fn.subVectors(e.b,di),On.subVectors(e.c,di),cn.subVectors(Fn,Nn),un.subVectors(On,Fn),Mn.subVectors(Nn,On);let t=[0,-cn.z,cn.y,0,-un.z,un.y,0,-Mn.z,Mn.y,cn.z,0,-cn.x,un.z,0,-un.x,Mn.z,0,-Mn.x,-cn.y,cn.x,0,-un.y,un.x,0,-Mn.y,Mn.x,0];return!Sr(t,Nn,Fn,On,Ii)||(t=[1,0,0,0,1,0,0,0,1],!Sr(t,Nn,Fn,On,Ii))?!1:(Ni.crossVectors(cn,un),t=[Ni.x,Ni.y,Ni.z],Sr(t,Nn,Fn,On,Ii))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Dt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const qt=[new U,new U,new U,new U,new U,new U,new U,new U],Dt=new U,Ui=new Ai,Nn=new U,Fn=new U,On=new U,cn=new U,un=new U,Mn=new U,di=new U,Ii=new U,Ni=new U,Sn=new U;function Sr(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Sn.fromArray(i,s);const o=r.x*Math.abs(Sn.x)+r.y*Math.abs(Sn.y)+r.z*Math.abs(Sn.z),l=e.dot(Sn),c=t.dot(Sn),h=n.dot(Sn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const uc=new Ai,pi=new U,Er=new U;class fr{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):uc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pi.subVectors(e,this.center);const t=pi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(pi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Er.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pi.copy(e.center).add(Er)),this.expandByPoint(pi.copy(e.center).sub(Er))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Yt=new U,yr=new U,Fi=new U,hn=new U,Tr=new U,Oi=new U,br=new U;class ks{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yt.copy(this.origin).addScaledVector(this.direction,t),Yt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){yr.copy(e).add(t).multiplyScalar(.5),Fi.copy(t).sub(e).normalize(),hn.copy(this.origin).sub(yr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Fi),o=hn.dot(this.direction),l=-hn.dot(Fi),c=hn.lengthSq(),h=Math.abs(1-a*a);let f,d,m,_;if(h>0)if(f=a*l-o,d=a*o-l,_=s*h,f>=0)if(d>=-_)if(d<=_){const M=1/h;f*=M,d*=M,m=f*(f+a*d+2*o)+d*(a*f+d+2*l)+c}else d=s,f=Math.max(0,-(a*d+o)),m=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(a*d+o)),m=-f*f+d*(d+2*l)+c;else d<=-_?(f=Math.max(0,-(-a*s+o)),d=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+d*(d+2*l)+c):d<=_?(f=0,d=Math.min(Math.max(-s,-l),s),m=d*(d+2*l)+c):(f=Math.max(0,-(a*s+o)),d=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+d*(d+2*l)+c);else d=a>0?-s:s,f=Math.max(0,-(a*d+o)),m=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(yr).addScaledVector(Fi,d),m}intersectSphere(e,t){Yt.subVectors(e.center,this.origin);const n=Yt.dot(this.direction),r=Yt.dot(Yt)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(o=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Yt)!==null}intersectTriangle(e,t,n,r,s){Tr.subVectors(t,e),Oi.subVectors(n,e),br.crossVectors(Tr,Oi);let a=this.direction.dot(br),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;hn.subVectors(this.origin,e);const l=o*this.direction.dot(Oi.crossVectors(hn,Oi));if(l<0)return null;const c=o*this.direction.dot(Tr.cross(hn));if(c<0||l+c>a)return null;const h=-o*hn.dot(br);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ze{constructor(e,t,n,r,s,a,o,l,c,h,f,d,m,_,M,p){Ze.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,f,d,m,_,M,p)}set(e,t,n,r,s,a,o,l,c,h,f,d,m,_,M,p){const u=this.elements;return u[0]=e,u[4]=t,u[8]=n,u[12]=r,u[1]=s,u[5]=a,u[9]=o,u[13]=l,u[2]=c,u[6]=h,u[10]=f,u[14]=d,u[3]=m,u[7]=_,u[11]=M,u[15]=p,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 Ze().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/Bn.setFromMatrixColumn(e,0).length(),s=1/Bn.setFromMatrixColumn(e,1).length(),a=1/Bn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const d=a*h,m=a*f,_=o*h,M=o*f;t[0]=l*h,t[4]=-l*f,t[8]=c,t[1]=m+_*c,t[5]=d-M*c,t[9]=-o*l,t[2]=M-d*c,t[6]=_+m*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,m=l*f,_=c*h,M=c*f;t[0]=d+M*o,t[4]=_*o-m,t[8]=a*c,t[1]=a*f,t[5]=a*h,t[9]=-o,t[2]=m*o-_,t[6]=M+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,m=l*f,_=c*h,M=c*f;t[0]=d-M*o,t[4]=-a*f,t[8]=_+m*o,t[1]=m+_*o,t[5]=a*h,t[9]=M-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,m=a*f,_=o*h,M=o*f;t[0]=l*h,t[4]=_*c-m,t[8]=d*c+M,t[1]=l*f,t[5]=M*c+d,t[9]=m*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,m=a*c,_=o*l,M=o*c;t[0]=l*h,t[4]=M-d*f,t[8]=_*f+m,t[1]=f,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=m*f+_,t[10]=d-M*f}else if(e.order==="XZY"){const d=a*l,m=a*c,_=o*l,M=o*c;t[0]=l*h,t[4]=-f,t[8]=c*h,t[1]=d*f+M,t[5]=a*h,t[9]=m*f-_,t[2]=_*f-m,t[6]=o*h,t[10]=M*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(hc,e,fc)}lookAt(e,t,n){const r=this.elements;return St.subVectors(e,t),St.lengthSq()===0&&(St.z=1),St.normalize(),fn.crossVectors(n,St),fn.lengthSq()===0&&(Math.abs(n.z)===1?St.x+=1e-4:St.z+=1e-4,St.normalize(),fn.crossVectors(n,St)),fn.normalize(),Bi.crossVectors(St,fn),r[0]=fn.x,r[4]=Bi.x,r[8]=St.x,r[1]=fn.y,r[5]=Bi.y,r[9]=St.y,r[2]=fn.z,r[6]=Bi.z,r[10]=St.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],f=n[5],d=n[9],m=n[13],_=n[2],M=n[6],p=n[10],u=n[14],b=n[3],T=n[7],S=n[11],F=n[15],R=r[0],w=r[4],I=r[8],E=r[12],x=r[1],A=r[5],W=r[9],z=r[13],G=r[2],Z=r[6],k=r[10],J=r[14],H=r[3],te=r[7],ce=r[11],xe=r[15];return s[0]=a*R+o*x+l*G+c*H,s[4]=a*w+o*A+l*Z+c*te,s[8]=a*I+o*W+l*k+c*ce,s[12]=a*E+o*z+l*J+c*xe,s[1]=h*R+f*x+d*G+m*H,s[5]=h*w+f*A+d*Z+m*te,s[9]=h*I+f*W+d*k+m*ce,s[13]=h*E+f*z+d*J+m*xe,s[2]=_*R+M*x+p*G+u*H,s[6]=_*w+M*A+p*Z+u*te,s[10]=_*I+M*W+p*k+u*ce,s[14]=_*E+M*z+p*J+u*xe,s[3]=b*R+T*x+S*G+F*H,s[7]=b*w+T*A+S*Z+F*te,s[11]=b*I+T*W+S*k+F*ce,s[15]=b*E+T*z+S*J+F*xe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],f=e[6],d=e[10],m=e[14],_=e[3],M=e[7],p=e[11],u=e[15];return _*(+s*l*f-r*c*f-s*o*d+n*c*d+r*o*m-n*l*m)+M*(+t*l*m-t*c*d+s*a*d-r*a*m+r*c*h-s*l*h)+p*(+t*c*f-t*o*m-s*a*f+n*a*m+s*o*h-n*c*h)+u*(-r*o*h-t*l*f+t*o*d+r*a*f-n*a*d+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],f=e[9],d=e[10],m=e[11],_=e[12],M=e[13],p=e[14],u=e[15],b=f*p*c-M*d*c+M*l*m-o*p*m-f*l*u+o*d*u,T=_*d*c-h*p*c-_*l*m+a*p*m+h*l*u-a*d*u,S=h*M*c-_*f*c+_*o*m-a*M*m-h*o*u+a*f*u,F=_*f*l-h*M*l-_*o*d+a*M*d+h*o*p-a*f*p,R=t*b+n*T+r*S+s*F;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/R;return e[0]=b*w,e[1]=(M*d*s-f*p*s-M*r*m+n*p*m+f*r*u-n*d*u)*w,e[2]=(o*p*s-M*l*s+M*r*c-n*p*c-o*r*u+n*l*u)*w,e[3]=(f*l*s-o*d*s-f*r*c+n*d*c+o*r*m-n*l*m)*w,e[4]=T*w,e[5]=(h*p*s-_*d*s+_*r*m-t*p*m-h*r*u+t*d*u)*w,e[6]=(_*l*s-a*p*s-_*r*c+t*p*c+a*r*u-t*l*u)*w,e[7]=(a*d*s-h*l*s+h*r*c-t*d*c-a*r*m+t*l*m)*w,e[8]=S*w,e[9]=(_*f*s-h*M*s-_*n*m+t*M*m+h*n*u-t*f*u)*w,e[10]=(a*M*s-_*o*s+_*n*c-t*M*c-a*n*u+t*o*u)*w,e[11]=(h*o*s-a*f*s-h*n*c+t*f*c+a*n*m-t*o*m)*w,e[12]=F*w,e[13]=(h*M*r-_*f*r+_*n*d-t*M*d-h*n*p+t*f*p)*w,e[14]=(_*o*r-a*M*r-_*n*l+t*M*l+a*n*p-t*o*p)*w,e[15]=(a*f*r-h*o*r+h*n*l-t*f*l-a*n*d+t*o*d)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,f=o+o,d=s*c,m=s*h,_=s*f,M=a*h,p=a*f,u=o*f,b=l*c,T=l*h,S=l*f,F=n.x,R=n.y,w=n.z;return r[0]=(1-(M+u))*F,r[1]=(m+S)*F,r[2]=(_-T)*F,r[3]=0,r[4]=(m-S)*R,r[5]=(1-(d+u))*R,r[6]=(p+b)*R,r[7]=0,r[8]=(_+T)*w,r[9]=(p-b)*w,r[10]=(1-(d+M))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=Bn.set(r[0],r[1],r[2]).length();const a=Bn.set(r[4],r[5],r[6]).length(),o=Bn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Lt.copy(this);const c=1/s,h=1/a,f=1/o;return Lt.elements[0]*=c,Lt.elements[1]*=c,Lt.elements[2]*=c,Lt.elements[4]*=h,Lt.elements[5]*=h,Lt.elements[6]*=h,Lt.elements[8]*=f,Lt.elements[9]*=f,Lt.elements[10]*=f,t.setFromRotationMatrix(Lt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=tn){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),f=(t+e)/(t-e),d=(n+r)/(n-r);let m,_;if(o===tn)m=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===lr)m=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=tn){const l=this.elements,c=1/(t-e),h=1/(n-r),f=1/(a-s),d=(t+e)*c,m=(n+r)*h;let _,M;if(o===tn)_=(a+s)*f,M=-2*f;else if(o===lr)_=s*f,M=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=M,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Bn=new U,Lt=new Ze,hc=new U(0,0,0),fc=new U(1,1,1),fn=new U,Bi=new U,St=new U,ga=new Ze,_a=new bi;class Gt{constructor(e=0,t=0,n=0,r=Gt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],f=r[2],d=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(ft(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ft(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(ft(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ft(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ft(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-ft(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ga.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ga,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _a.setFromEuler(this),this.setFromQuaternion(_a,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Gt.DEFAULT_ORDER="XYZ";class Ws{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}
vendor: 5,575 bytes, line 5
5isEnabled(e){return(this.mask&(1<<e|0))!==0}}let dc=0;const va=new U,zn=new bi,Kt=new Ze,zi=new U,mi=new U,pc=new U,mc=new bi,xa=new U(1,0,0),Ma=new U(0,1,0),Sa=new U(0,0,1),Ea={type:"added"},gc={type:"removed"},Hn={type:"childadded",child:null},Ar={type:"childremoved",child:null};class lt extends oi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:dc++}),this.uuid=li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lt.DEFAULT_UP.clone();const e=new U,t=new Gt,n=new bi,r=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ze},normalMatrix:{value:new Pe}}),this.matrix=new Ze,this.matrixWorld=new Ze,this.matrixAutoUpdate=lt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ws,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return zn.setFromAxisAngle(e,t),this.quaternion.multiply(zn),this}rotateOnWorldAxis(e,t){return zn.setFromAxisAngle(e,t),this.quaternion.premultiply(zn),this}rotateX(e){return this.rotateOnAxis(xa,e)}rotateY(e){return this.rotateOnAxis(Ma,e)}rotateZ(e){return this.rotateOnAxis(Sa,e)}translateOnAxis(e,t){return va.copy(e).applyQuaternion(this.quaternion),this.position.add(va.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xa,e)}translateY(e){return this.translateOnAxis(Ma,e)}translateZ(e){return this.translateOnAxis(Sa,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Kt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?zi.copy(e):zi.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Kt.lookAt(mi,zi,this.up):Kt.lookAt(zi,mi,this.up),this.quaternion.setFromRotationMatrix(Kt),r&&(Kt.extractRotation(r.matrixWorld),zn.setFromRotationMatrix(Kt),this.quaternion.premultiply(zn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ea),Hn.child=e,this.dispatchEvent(Hn),Hn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(gc),Ar.child=e,this.dispatchEvent(Ar),Ar.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Kt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Kt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Kt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ea),Hn.child=e,this.dispatchEvent(Hn),Hn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,e,pc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,mc,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,212 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.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 s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),f=a(e.shapes),d=a(e.skeletons),m=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),m.length>0&&(n.animations=m),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}lt.DEFAULT_UP=new U(0,1,0);lt.DEFAULT_MATRIX_AUTO_UPDATE=!0;lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;
vendor: 6,056 bytes, line 5
5const Ut=new U,Zt=new U,wr=new U,$t=new U,Vn=new U,Gn=new U,ya=new U,Rr=new U,Cr=new U,Pr=new U,Dr=new qe,Lr=new qe,Ur=new qe;class It{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ut.subVectors(e,t),r.cross(Ut);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Ut.subVectors(r,t),Zt.subVectors(n,t),wr.subVectors(e,t);const a=Ut.dot(Ut),o=Ut.dot(Zt),l=Ut.dot(wr),c=Zt.dot(Zt),h=Zt.dot(wr),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const d=1/f,m=(c*l-o*h)*d,_=(a*h-o*l)*d;return s.set(1-m-_,_,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,$t)===null?!1:$t.x>=0&&$t.y>=0&&$t.x+$t.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,$t)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,$t.x),l.addScaledVector(a,$t.y),l.addScaledVector(o,$t.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return Dr.setScalar(0),Lr.setScalar(0),Ur.setScalar(0),Dr.fromBufferAttribute(e,t),Lr.fromBufferAttribute(e,n),Ur.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Dr,s.x),a.addScaledVector(Lr,s.y),a.addScaledVector(Ur,s.z),a}static isFrontFacing(e,t,n,r){return Ut.subVectors(n,t),Zt.subVectors(e,t),Ut.cross(Zt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ut.subVectors(this.c,this.b),Zt.subVectors(this.a,this.b),Ut.cross(Zt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return It.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return It.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return It.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return It.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return It.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Vn.subVectors(r,n),Gn.subVectors(s,n),Rr.subVectors(e,n);const l=Vn.dot(Rr),c=Gn.dot(Rr);if(l<=0&&c<=0)return t.copy(n);Cr.subVectors(e,r);const h=Vn.dot(Cr),f=Gn.dot(Cr);if(h>=0&&f<=h)return t.copy(r);const d=l*f-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Vn,a);Pr.subVectors(e,s);const m=Vn.dot(Pr),_=Gn.dot(Pr);if(_>=0&&m<=_)return t.copy(s);const M=m*c-l*_;if(M<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(Gn,o);const p=h*_-m*f;if(p<=0&&f-h>=0&&m-_>=0)return ya.subVectors(s,r),o=(f-h)/(f-h+(m-_)),t.copy(r).addScaledVector(ya,o);const u=1/(p+M+d);return a=M*u,o=d*u,t.copy(n).addScaledVector(Vn,a).addScaledVector(Gn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Do={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},dn={h:0,s:0,l:0},Hi={h:0,s:0,l:0};function Ir(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}
vendor: 4,133 bytes, line 5
5class Ue{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=wt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ve.workingColorSpace){if(e=Gs(e,1),t=ft(t,0,1),n=ft(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ir(a,s,e+1/3),this.g=Ir(a,s,e),this.b=Ir(a,s,e-1/3)}return Ve.toWorkingColorSpace(this,r),this}setStyle(e,t=wt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=wt){const n=Do[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rn(e.r),this.g=rn(e.g),this.b=rn(e.b),this}copyLinearToSRGB(e){return this.r=Jn(e.r),this.g=Jn(e.g),this.b=Jn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wt){return Ve.fromWorkingColorSpace(ht.copy(this),e),Math.round(ft(ht.r*255,0,255))*65536+Math.round(ft(ht.g*255,0,255))*256+Math.round(ft(ht.b*255,0,255))}getHexString(e=wt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.fromWorkingColorSpace(ht.copy(this),t);const n=ht.r,r=ht.g,s=ht.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=h<=.5?f/(a+o):f/(2-a-o),a){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Ve.workingColorSpace){return Ve.fromWorkingColorSpace(ht.copy(this),t),e.r=ht.r,e.g=ht.g,e.b=ht.b,e}getStyle(e=wt){Ve.fromWorkingColorSpace(ht.copy(this),e);const t=ht.r,n=ht.g,r=ht.b;return e!==wt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(dn),this.setHSL(dn.h+e,dn.s+t,dn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 2,700 bytes, line 5
5lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(dn),e.getHSL(Hi);const n=Si(dn.h,Hi.h,t),r=Si(dn.s,Hi.s,t),s=Si(dn.l,Hi.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ht=new Ue;Ue.NAMES=Do;let _c=0;class ci extends oi{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_c++}),this.uuid=li(),this.name="",this.blending=$n,this.side=vn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Yr,this.blendDst=Kr,this.blendEquation=wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ue(0,0,0),this.blendAlpha=0,this.depthFunc=Qn,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=sa,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Un,this.stencilZFail=Un,this.stencilZPass=Un,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 8,832 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==$n&&(n.blending=this.blending),this.side!==vn&&(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!==Yr&&(n.blendSrc=this.blendSrc),this.blendDst!==Kr&&(n.blendDst=this.blendDst),this.blendEquation!==wn&&(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!==Qn&&(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!==sa&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Un&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Un&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Un&&(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 r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 13,456 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Xs extends ci{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Ue(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 Gt,this.combine=po,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Qt=vc();function vc(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function xc(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=ft(i,-65504,65504),Qt.floatView[0]=i;const e=Qt.uint32View[0],t=e>>23&511;return Qt.baseTable[t]+((e&8388607)>>Qt.shiftTable[t])}function Mc(i){const e=i>>10;return Qt.uint32View[0]=Qt.mantissaTable[Qt.offsetTable[e]+(i&1023)]+Qt.exponentTable[e],Qt.floatView[0]}const Lp={toHalfFloat:xc,fromHalfFloat:Mc},rt=new U,Vi=new we;class Ot{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=aa,this.updateRanges=[],this.gpuType=en,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Vi.fromBufferAttribute(this,t),Vi.applyMatrix3(e),this.setXY(t,Vi.x,Vi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix3(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix4(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyNormalMatrix(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.transformDirection(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Yn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=mt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Yn(t,this.array)),t}setX(e,t){return this.normalized&&(t=mt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Yn(t,this.array)),t}setY(e,t){return this.normalized&&(t=mt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Yn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=mt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Yn(t,this.array)),t}setW(e,t){return this.normalized&&(t=mt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=mt(t,this.array),n=mt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=mt(t,this.array),n=mt(n,this.array),r=mt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=mt(t,this.array),n=mt(n,this.array),r=mt(r,this.array),s=mt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==aa&&(e.usage=this.usage),e}}class Lo extends Ot{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Uo extends Ot{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class sn extends Ot{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Sc=0;const At=new Ze,Nr=new lt,kn=new U,Et=new Ai,gi=new Ai,ot=new U;class kt extends oi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Sc++}),this.uuid=li(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ro(e)?Uo:Lo)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Pe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return At.makeRotationFromQuaternion(e),this.applyMatrix4(At),this}rotateX(e){return At.makeRotationX(e),this.applyMatrix4(At),this}rotateY(e){return At.makeRotationY(e),this.applyMatrix4(At),this}rotateZ(e){return At.makeRotationZ(e),this.applyMatrix4(At),this}translate(e,t,n){return At.makeTranslation(e,t,n),this.applyMatrix4(At),this}scale(e,t,n){return At.makeScale(e,t,n),this.applyMatrix4(At),this}lookAt(e){return Nr.lookAt(e),Nr.updateMatrix(),this.applyMatrix4(Nr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(kn).negate(),this.translate(kn.x,kn.y,kn.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new sn(n,3))}else{for(let n=0,r=t.count;n<r;n++){const s=e[n];t.setXYZ(n,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Et.setFromBufferAttribute(s),this.morphTargetsRelative?(ot.addVectors(this.boundingBox.min,Et.min),this.boundingBox.expandByPoint(ot),ot.addVectors(this.boundingBox.max,Et.max),this.boundingBox.expandByPoint(ot)):(this.boundingBox.expandByPoint(Et.min),this.boundingBox.expandByPoint(Et.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 fr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(Et.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gi.setFromBufferAttribute(o),this.morphTargetsRelative?(ot.addVectors(Et.min,gi.min),Et.expandByPoint(ot),ot.addVectors(Et.max,gi.max),Et.expandByPoint(ot)):(Et.expandByPoint(gi.min),Et.expandByPoint(gi.max))}Et.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ot.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ot));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ot.fromBufferAttribute(o,c),l&&(kn.fromBufferAttribute(e,c),ot.add(kn)),r=Math.max(r,n.distanceToSquared(ot))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ot(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let I=0;I<n.count;I++)o[I]=new U,l[I]=new U;const c=new U,h=new U,f=new U,d=new we,m=new we,_=new we,M=new U,p=new U;function u(I,E,x){c.fromBufferAttribute(n,I),h.fromBufferAttribute(n,E),f.fromBufferAttribute(n,x),d.fromBufferAttribute(s,I),m.fromBufferAttribute(s,E),_.fromBufferAttribute(s,x),h.sub(c),f.sub(c),m.sub(d),_.sub(d);const A=1/(m.x*_.y-_.x*m.y);isFinite(A)&&(M.copy(h).multiplyScalar(_.y).addScaledVector(f,-m.y).multiplyScalar(A),p.copy(f).multiplyScalar(m.x).addScaledVector(h,-_.x).multiplyScalar(A),o[I].add(M),o[E].add(M),o[x].add(M),l[I].add(p),l[E].add(p),l[x].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let I=0,E=b.length;I<E;++I){const x=b[I],A=x.start,W=x.count;for(let z=A,G=A+W;z<G;z+=3)u(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const T=new U,S=new U,F=new U,R=new U;function w(I){F.fromBufferAttribute(r,I),R.copy(F);const E=o[I];T.copy(E),T.sub(F.multiplyScalar(F.dot(E))).normalize(),S.crossVectors(R,E);const A=S.dot(l[I])<0?-1:1;a.setXYZW(I,T.x,T.y,T.z,A)}for(let I=0,E=b.length;I<E;++I){const x=b[I],A=x.start,W=x.count;for(let z=A,G=A+W;z<G;z+=3)w(e.getX(z+0)),w(e.getX(z+1)),w(e.getX(z+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ot(new Float32Array(t.count*3),3),this.setAttribute("normal",n
vendor: 6,291 bytes, line 5
5);else for(let d=0,m=n.count;d<m;d++)n.setXYZ(d,0,0,0);const r=new U,s=new U,a=new U,o=new U,l=new U,c=new U,h=new U,f=new U;if(e)for(let d=0,m=e.count;d<m;d+=3){const _=e.getX(d+0),M=e.getX(d+1),p=e.getX(d+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,M),a.fromBufferAttribute(t,p),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,M),c.fromBufferAttribute(n,p),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(M,l.x,l.y,l.z),n.setXYZ(p,c.x,c.y,c.z)}else for(let d=0,m=t.count;d<m;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),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(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ot.fromBufferAttribute(e,t),ot.normalize(),e.setXYZ(t,ot.x,ot.y,ot.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,f=o.normalized,d=new c.constructor(l.length*h);let m=0,_=0;for(let M=0,p=l.length;M<p;M++){o.isInterleavedBufferAttribute?m=l[M]*o.data.stride+o.offset:m=l[M]*h;for(let u=0;u<h;u++)d[_++]=c[m++]}return new Ot(d,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new kt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,f=c.length;h<f;h++){const d=c[h],m=e(d,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let f=0,d=c.length;f<d;f++){const m=c[f];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],f=s[c];for(let d=0,m=f.length;d<m;d++)h.push(f[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ta=new Ze,En=new ks,Gi=new fr,ba=new U,ki=new U,Wi=new U,Xi=new U,Fr=new U,qi=new U,Aa=new U,Yi=new U;class Ft extends lt{constructor(e=new kt,t=new Xs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){qi.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],f=s[l];h!==0&&(Fr.fromBufferAttribute(f,e),a?qi.addScaledVector(Fr,h):qi.addScaledVector(Fr.sub(t),h))}t.add(qi)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Gi.copy(n.boundingSphere),Gi.applyMatrix4(s),En.copy(e.ray).recast(e.near),!(Gi.containsPoint(En.origin)===!1&&(En.intersectSphere(Gi,ba)===null||En.origin.distanceToSquared(ba)>(e.far-e.near)**2))&&(Ta.copy(s).invert(),En.copy(e.ray).applyMatrix4(Ta),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,En)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,d=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,M=d.length;_<M;_++){const p=d[_],u=a[p.materialIndex],b=Math.max(p.start,m.start),T=Math.min(o.count,Math.min(p.start+p.count,m.start+m.count));for(let S=b,F=T;S<F;S+=3){const R=o.getX(S),w=o.getX(S+1),I=o.getX(S+2);r=Ki(this,u,e,n,c,h,f,R,w,I),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const _=Math.max(0,m.start),M=Math.min(o.count,m.start+m.count);for(let p=_,u=M;p<u;p+=3){const b=o.getX(p),T=o.getX(p+1),S=o.getX(p+2);r=Ki(this,a,e,n,c,h,f,b,T,S),r&&(r.faceIndex=Math.floor(p/3),t.pu
vendor: 7,043 bytes, lines 5-9
5sh(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,M=d.length;_<M;_++){const p=d[_],u=a[p.materialIndex],b=Math.max(p.start,m.start),T=Math.min(l.count,Math.min(p.start+p.count,m.start+m.count));for(let S=b,F=T;S<F;S+=3){const R=S,w=S+1,I=S+2;r=Ki(this,u,e,n,c,h,f,R,w,I),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const _=Math.max(0,m.start),M=Math.min(l.count,m.start+m.count);for(let p=_,u=M;p<u;p+=3){const b=p,T=p+1,S=p+2;r=Ki(this,a,e,n,c,h,f,b,T,S),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}}}function Ec(i,e,t,n,r,s,a,o){let l;if(e.side===xt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===vn,o),l===null)return null;Yi.copy(o),Yi.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Yi);return c<t.near||c>t.far?null:{distance:c,point:Yi.clone(),object:i}}function Ki(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ki),i.getVertexPosition(l,Wi),i.getVertexPosition(c,Xi);const h=Ec(i,e,t,n,ki,Wi,Xi,Aa);if(h){const f=new U;It.getBarycoord(Aa,ki,Wi,Xi,f),r&&(h.uv=It.getInterpolatedAttribute(r,o,l,c,f,new we)),s&&(h.uv1=It.getInterpolatedAttribute(s,o,l,c,f,new we)),a&&(h.normal=It.getInterpolatedAttribute(a,o,l,c,f,new U),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new U,materialIndex:0};It.getNormal(ki,Wi,Xi,d.normal),h.face=d,h.barycoord=f}return h}class wi extends kt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],f=[];let d=0,m=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new sn(c,3)),this.setAttribute("normal",new sn(h,3)),this.setAttribute("uv",new sn(f,2));function _(M,p,u,b,T,S,F,R,w,I,E){const x=S/w,A=F/I,W=S/2,z=F/2,G=R/2,Z=w+1,k=I+1;let J=0,H=0;const te=new U;for(let ce=0;ce<k;ce++){const xe=ce*A-z;for(let Ie=0;Ie<Z;Ie++){const ke=Ie*x-W;te[M]=ke*b,te[p]=xe*T,te[u]=G,c.push(te.x,te.y,te.z),te[M]=0,te[p]=0,te[u]=R>0?1:-1,h.push(te.x,te.y,te.z),f.push(Ie/w),f.push(1-ce/I),J+=1}}for(let ce=0;ce<I;ce++)for(let xe=0;xe<w;xe++){const Ie=d+xe+Z*ce,ke=d+xe+Z*(ce+1),q=d+(xe+1)+Z*(ce+1),ee=d+(xe+1)+Z*ce;l.push(Ie,ke,ee),l.push(ke,q,ee),H+=6}o.addGroup(m,H,E),m+=H,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function si(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function gt(i){const e={};for(let t=0;t<i.length;t++){const n=si(i[t]);for(const r in n)e[r]=n[r]}return e}function yc(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Io(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}const yi={clone:si,merge:gt};var Tc=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,bc=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class dt extends ci{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Tc,this.fragmentShader=bc,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=si(e.uniforms),this.uniformsGroups=yc(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class No extends lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ze,this.projectionMatrix=new Ze,this.projectionMatrixInverse=new Ze,this.coordinateSystem=tn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const pn=new U,wa=new we,Ra=new we;class vt extends No{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ri*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Mi*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,387 bytes, line 9
9getEffectiveFOV(){return ri*2*Math.atan(Math.tan(Mi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){pn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(pn.x,pn.y).multiplyScalar(-e/pn.z),pn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(pn.x,pn.y).multiplyScalar(-e/pn.z)}getViewSize(e,t){return this.getViewBounds(e,wa,Ra),t.subVectors(Ra,wa)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Mi*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Wn=-90,Xn=1;class Ac extends lt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new vt(Wn,Xn,e,t);r.layers=this.layers,this.add(r);const s=new vt(Wn,Xn,e,t);s.layers=this.layers,this.add(s);const a=new vt(Wn,Xn,e,t);a.layers=this.layers,this.add(a);const o=new vt(Wn,Xn,e,t);o.layers=this.layers,this.add(o);const l=new vt(Wn,Xn,e,t);l.layers=this.layers,this.add(l);const c=new vt(Wn,Xn,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===tn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(f,d,m),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Fo extends pt{constructor(e,t,n,r,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:ei,super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class wc extends Rt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Fo(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ht}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 10,258 bytes, lines 9-103
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new wi(5,5,5),s=new dt({name:"CubemapFromEquirect",uniforms:si(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:xt,blending:nn});s.uniforms.tEquirect.value=t;const a=new Ft(r,s),o=t.minFilter;return t.minFilter===Pn&&(t.minFilter=Ht),new Ac(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const Or=new U,Rc=new U,Cc=new Pe;class mn{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=Or.subVectors(n,t).cross(Rc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Or),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Cc.getNormalMatrix(e),r=this.coplanarPoint(Or).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const yn=new fr,Zi=new U;class qs{constructor(e=new mn,t=new mn,n=new mn,r=new mn,s=new mn,a=new mn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=tn){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],f=r[6],d=r[7],m=r[8],_=r[9],M=r[10],p=r[11],u=r[12],b=r[13],T=r[14],S=r[15];if(n[0].setComponents(l-s,d-c,p-m,S-u).normalize(),n[1].setComponents(l+s,d+c,p+m,S+u).normalize(),n[2].setComponents(l+a,d+h,p+_,S+b).normalize(),n[3].setComponents(l-a,d-h,p-_,S-b).normalize(),n[4].setComponents(l-o,d-f,p-M,S-T).normalize(),t===tn)n[5].setComponents(l+o,d+f,p+M,S+T).normalize();else if(t===lr)n[5].setComponents(o,f,M,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),yn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),yn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(yn)}intersectsSprite(e){return yn.center.set(0,0,0),yn.radius=.7071067811865476,yn.applyMatrix4(e.matrixWorld),this.intersectsSphere(yn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Zi.x=r.normal.x>0?e.max.x:e.min.x,Zi.y=r.normal.y>0?e.max.y:e.min.y,Zi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Zi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Oo(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Pc(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function n(o,l,c){const h=l.array,f=l.updateRanges;if(i.bindBuffer(c,o),f.length===0)i.bufferSubData(c,0,h);else{f.sort((m,_)=>m.start-_.start);let d=0;for(let m=1;m<f.length;m++){const _=f[d],M=f[m];M.start<=_.start+_.count+1?_.count=Math.max(_.count,M.start+M.count-_.start):(++d,f[d]=M)}f.length=d+1;for(let m=0,_=f.length;m<_;m++){const M=f[m];i.bufferSubData(c,M.start*h.BYTES_PER_ELEMENT,h,M.start,M.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class Ri extends kt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,f=e/o,d=t/l,m=[],_=[],M=[],p=[];for(let u=0;u<h;u++){const b=u*d-a;for(let T=0;T<c;T++){const S=T*f-s;_.push(S,-b,0),M.push(0,0,1),p.push(T/o),p.push(1-u/l)}}for(let u=0;u<l;u++)for(let b=0;b<o;b++){const T=b+c*u,S=b+c*(u+1),F=b+1+c*(u+1),R=b+1+c*u;m.push(T,S,R),m.push(S,F,R)}this.setIndex(m),this.setAttribute("position",new sn(_,3)),this.setAttribute("normal",new sn(M,3)),this.setAttribute("uv",new sn(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ri(e.width,e.height,e.widthSegments,e.heightSegments)}}var Dc=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,Lc=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,Uc=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,Ic=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,Nc=`#ifdef USE_ALPHATEST 86 #ifdef ALPHA_TO_COVERAGE 87 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 88 if ( diffuseColor.a == 0.0 ) discard; 89 #else 90 if ( diffuseColor.a < alphaTest ) discard; 91 #endif 92#endif`,Fc=`#ifdef USE_ALPHATEST 93 uniform float alphaTest; 94#endif`,Oc=`#ifdef USE_AOMAP 95 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 96 reflectedLight.indirectDiffuse *= ambientOcclusion; 97 #if defined( USE_CLEARCOAT ) 98 clearcoatSpecularIndirect *= ambientOcclusion; 99 #endif 100 #if defined( USE_SHEEN ) 101 sheenSpecularIndirect *= ambientOcclusion; 102 #endif 103 #if defined( USE_ENVMAP ) && defined( STANDARD )
104 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 105 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 106 #endif 107#endif`,Bc=`#ifdef USE_AOMAP 108 uniform sampler2D aoMap; 109 uniform float aoMapIntensity; 110#endif`,zc=`#ifdef USE_BATCHING 111 #if ! defined( GL_ANGLE_multi_draw ) 112 #define gl_DrawID _gl_DrawID 113 uniform int _gl_DrawID; 114 #endif 115 uniform highp sampler2D batchingTexture; 116 uniform highp usampler2D batchingIdTexture; 117 mat4 getBatchingMatrix( const in float i ) { 118 int size = textureSize( batchingTexture, 0 ).x; 119 int j = int( i ) * 4; 120 int x = j % size; 121 int y = j / size; 122 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 123 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 124 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 125 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 126 return mat4( v1, v2, v3, v4 ); 127 } 128 float getIndirectIndex( const in int i ) { 129 int size = textureSize( batchingIdTexture, 0 ).x; 130 int x = i % size; 131 int y = i / size; 132 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 133 } 134#endif 135#ifdef USE_BATCHING_COLOR 136 uniform sampler2D batchingColorTexture; 137 vec3 getBatchingColor( const in float i ) { 138 int size = textureSize( batchingColorTexture, 0 ).x; 139 int j = int( i ); 140 int x = j % size; 141 int y = j / size; 142 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 143 } 144#endif`,Hc=`#ifdef USE_BATCHING 145 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 146#endif`,Vc=`vec3 transformed = vec3( position ); 147#ifdef USE_ALPHAHASH 148 vPosition = vec3( position ); 149#endif`,Gc=`vec3 objectNormal = vec3( normal ); 150#ifdef USE_TANGENT 151 vec3 objectTangent = vec3( tangent.xyz ); 152#endif`,kc=`float G_BlinnPhong_Implicit( ) { 153 return 0.25; 154} 155float D_BlinnPhong( const in float shininess, const in float dotNH ) { 156 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 157} 158vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 159 vec3 halfDir = normalize( lightDir + viewDir ); 160 float dotNH = saturate( dot( normal, halfDir ) ); 161 float dotVH = saturate( dot( viewDir, halfDir ) ); 162 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 163 float G = G_BlinnPhong_Implicit( ); 164 float D = D_BlinnPhong( shininess, dotNH ); 165 return F * ( G * D ); 166} // validated`,Wc=`#ifdef USE_IRIDESCENCE 167 const mat3 XYZ_TO_REC709 = mat3( 168 3.2404542, -0.9692660, 0.0556434, 169 -1.5371385, 1.8760108, -0.2040259, 170 -0.4985314, 0.0415560, 1.0572252 171 ); 172 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 173 vec3 sqrtF0 = sqrt( fresnel0 ); 174 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 175 } 176 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 177 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 178 } 179 float IorToFresnel0( float transmittedIor, float incidentIor ) { 180 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 181 } 182 vec3 evalSensitivity( float OPD, vec3 shift ) { 183 float phase = 2.0 * PI * OPD * 1.0e-9; 184 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 185 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 186 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 187 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 188 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 ) ); 189 xyz /= 1.0685e-7; 190 vec3 rgb = XYZ_TO_REC709 * xyz; 191 return rgb; 192 } 193 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 194 vec3 I; 195 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 196 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 197 float cosTheta2Sq = 1.0 - sinTheta2Sq; 198 if ( cosTheta2Sq < 0.0 ) { 199 return vec3( 1.0 ); 200 } 201 float cosTheta2 = sqrt( cosTheta2Sq ); 202 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
203 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 204 float T121 = 1.0 - R12; 205 float phi12 = 0.0; 206 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 207 float phi21 = PI - phi12; 208 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 209 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 210 vec3 phi23 = vec3( 0.0 ); 211 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 212 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 213 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 214 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 215 vec3 phi = vec3( phi21 ) + phi23; 216 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 217 vec3 r123 = sqrt( R123 ); 218 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 219 vec3 C0 = R12 + Rs; 220 I = C0; 221 vec3 Cm = Rs - T121; 222 for ( int m = 1; m <= 2; ++ m ) { 223 Cm *= r123; 224 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 225 I += Cm * Sm; 226 } 227 return max( I, vec3( 0.0 ) ); 228 } 229#endif`,Xc=`#ifdef USE_BUMPMAP 230 uniform sampler2D bumpMap; 231 uniform float bumpScale; 232 vec2 dHdxy_fwd() { 233 vec2 dSTdx = dFdx( vBumpMapUv ); 234 vec2 dSTdy = dFdy( vBumpMapUv ); 235 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 236 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 237 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 238 return vec2( dBx, dBy ); 239 } 240 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 241 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 242 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 243 vec3 vN = surf_norm; 244 vec3 R1 = cross( vSigmaY, vN ); 245 vec3 R2 = cross( vN, vSigmaX ); 246 float fDet = dot( vSigmaX, R1 ) * faceDirection; 247 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 248 return normalize( abs( fDet ) * surf_norm - vGrad ); 249 } 250#endif`,qc=`#if NUM_CLIPPING_PLANES > 0 251 vec4 plane; 252 #ifdef ALPHA_TO_COVERAGE 253 float distanceToPlane, distanceGradient; 254 float clipOpacity = 1.0; 255 #pragma unroll_loop_start 256 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 257 plane = clippingPlanes[ i ]; 258 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 259 distanceGradient = fwidth( distanceToPlane ) / 2.0; 260 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 261 if ( clipOpacity == 0.0 ) discard; 262 } 263 #pragma unroll_loop_end 264 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 265 float unionClipOpacity = 1.0; 266 #pragma unroll_loop_start 267 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 268 plane = clippingPlanes[ i ]; 269 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 270 distanceGradient = fwidth( distanceToPlane ) / 2.0; 271 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 272 } 273 #pragma unroll_loop_end 274 clipOpacity *= 1.0 - unionClipOpacity; 275 #endif 276 diffuseColor.a *= clipOpacity; 277 if ( diffuseColor.a == 0.0 ) discard; 278 #else 279 #pragma unroll_loop_start 280 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 281 plane = clippingPlanes[ i ]; 282 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 283 } 284 #pragma unroll_loop_end 285 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 286 bool clipped = true; 287 #pragma unroll_loop_start 288 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 289 plane = clippingPlanes[ i ]; 290 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 291 } 292 #pragma unroll_loop_end 293 if ( clipped ) discard; 294 #endif 295 #endif 296#endif`,Yc=`#if NUM_CLIPPING_PLANES > 0 297 varying vec3 vClipPosition; 298 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 299#endif`,Kc=`#if NUM_CLIPPING_PLANES > 0 300 varying vec3 vClipPosition; 301#endif`,Zc=`#if NUM_CLIPPING_PLANES > 0 302 vClipPosition = - mvPosition.xyz; 303#endif`,$c=`#if defined( USE_COLOR_ALPHA ) 304 diffuseColor *= vColor; 305#elif defined( USE_COLOR ) 306 diffuseColor.rgb *= vColor; 307#endif`,jc=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) 310 varying vec3 vColor; 311#endif`,Jc=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 varying vec3 vColor; 315#endif`,Qc=`#if defined( USE_COLOR_ALPHA ) 316 vColor = vec4( 1.0 ); 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 vColor = vec3( 1.0 ); 319#endif 320#ifdef USE_COLOR 321 vColor *= color; 322#endif 323#ifdef USE_INSTANCING_COLOR 324 vColor.xyz *= instanceColor.xyz; 325#endif 326#ifdef USE_BATCHING_COLOR 327 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 328 vColor.xyz *= batchingColor.xyz; 329#endif`,eu=`#define PI 3.141592653589793 330#define PI2 6.283185307179586 331#define PI_HALF 1.5707963267948966 332#define RECIPROCAL_PI 0.3183098861837907 333#define RECIPROCAL_PI2 0.15915494309189535 334#define EPSILON 1e-6 335#ifndef saturate 336#define saturate( a ) clamp( a, 0.0, 1.0 ) 337#endif 338#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 339float pow2( const in float x ) { return x*x; } 340vec3 pow2( const in vec3 x ) { return x*x; } 341float pow3( const in float x ) { return x*x*x; } 342float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 343float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 344float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 345highp float rand( const in vec2 uv ) { 346 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 347 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 348 return fract( sin( sn ) * c ); 349} 350#ifdef HIGH_PRECISION 351 float precisionSafeLength( vec3 v ) { return length( v ); } 352#else 353 float precisionSafeLength( vec3 v ) { 354 float maxComponent = max3( abs( v ) ); 355 return length( v / maxComponent ) * maxComponent; 356 } 357#endif 358struct IncidentLight { 359 vec3 color; 360 vec3 direction; 361 bool visible; 362}; 363struct ReflectedLight { 364 vec3 directDiffuse; 365 vec3 directSpecular; 366 vec3 indirectDiffuse; 367 vec3 indirectSpecular; 368}; 369#ifdef USE_ALPHAHASH 370 varying vec3 vPosition; 371#endif 372vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 373 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 374} 375vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 376 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 377} 378mat3 transposeMat3( const in mat3 m ) { 379 mat3 tmp; 380 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 381 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 382 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 383 return tmp; 384} 385bool isPerspectiveMatrix( mat4 m ) { 386 return m[ 2 ][ 3 ] == - 1.0; 387} 388vec2 equirectUv( in vec3 dir ) { 389 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 390 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 391 return vec2( u, v ); 392}
393vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 394 return RECIPROCAL_PI * diffuseColor; 395} 396vec3 F_Schlick( const in vec3 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} 400float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} // validated`,tu=`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt ); 444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_m0 - 2.0 462 #define cubeUV_r1 0.8 463 #define cubeUV_m1 - 1.0 464 #define cubeUV_r4 0.4 465 #define cubeUV_m4 2.0 466 #define cubeUV_r5 0.305 467 #define cubeUV_m5 3.0 468 #define cubeUV_r6 0.21 469 #define cubeUV_m6 4.0 470 float roughnessToMip( float roughness ) { 471 float mip = 0.0; 472 if ( roughness >= cubeUV_r1 ) { 473 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 474 } else if ( roughness >= cubeUV_r4 ) { 475 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 476 } else if ( roughness >= cubeUV_r5 ) { 477 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 478 } else if ( roughness >= cubeUV_r6 ) { 479 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 480 } else { 481 mip = - 2.0 * log2( 1.16 * roughness ); } 482 return mip; 483 } 484 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 485 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 486 float mipF = fract( mip ); 487 float mipInt = floor( mip ); 488 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 489 if ( mipF == 0.0 ) { 490 return vec4( color0, 1.0 ); 491 } else { 492 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 493 return vec4( mix( color0, color1, mipF ), 1.0 ); 494 } 495 } 496#endif`,nu=`vec3 transformedNormal = objectNormal; 497#ifdef USE_TANGENT 498 vec3 transformedTangent = objectTangent; 499#endif 500#ifdef USE_BATCHING 501 mat3 bm = mat3( batchingMatrix ); 502 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 503 transformedNormal = bm * transformedNormal; 504 #ifdef USE_TANGENT 505 transformedTangent = bm * transformedTangent; 506 #endif 507#endif 508#ifdef USE_INSTANCING 509 mat3 im = mat3( instanceMatrix ); 510 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 511 transformedNormal = im * transformedNormal; 512 #ifdef USE_TANGENT 513 transformedTangent = im * transformedTangent; 514 #endif 515#endif 516transformedNormal = normalMatrix * transformedNormal; 517#ifdef FLIP_SIDED 518 transformedNormal = - transformedNormal; 519#endif 520#ifdef USE_TANGENT 521 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 522 #ifdef FLIP_SIDED 523 transformedTangent = - transformedTangent; 524 #endif 525#endif`,iu=`#ifdef USE_DISPLACEMENTMAP 526 uniform sampler2D displacementMap; 527 uniform float displacementScale; 528 uniform float displacementBias; 529#endif`,ru=`#ifdef USE_DISPLACEMENTMAP 530 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
530placementBias ); 531#endif`,su=`#ifdef USE_EMISSIVEMAP 532 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 533 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 534 emissiveColor = sRGBTransferEOTF( emissiveColor ); 535 #endif 536 totalEmissiveRadiance *= emissiveColor.rgb; 537#endif`,au=`#ifdef USE_EMISSIVEMAP 538 uniform sampler2D emissiveMap; 539#endif`,ou="gl_FragColor = linearToOutputTexel( gl_FragColor );",lu=`vec4 LinearTransferOETF( in vec4 value ) { 540 return value; 541} 542vec4 sRGBTransferEOTF( in vec4 value ) { 543 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 544} 545vec4 sRGBTransferOETF( in vec4 value ) { 546 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 ); 547}`,cu=`#ifdef USE_ENVMAP 548 #ifdef ENV_WORLDPOS 549 vec3 cameraToFrag; 550 if ( isOrthographic ) { 551 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 552 } else { 553 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 554 } 555 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 556 #ifdef ENVMAP_MODE_REFLECTION 557 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 558 #else 559 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 560 #endif 561 #else 562 vec3 reflectVec = vReflect; 563 #endif 564 #ifdef ENVMAP_TYPE_CUBE 565 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 566 #else 567 vec4 envColor = vec4( 0.0 ); 568 #endif 569 #ifdef ENVMAP_BLENDING_MULTIPLY 570 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 571 #elif defined( ENVMAP_BLENDING_MIX ) 572 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 573 #elif defined( ENVMAP_BLENDING_ADD ) 574 outgoingLight += envColor.xyz * specularStrength * reflectivity; 575 #endif 576#endif`,uu=`#ifdef USE_ENVMAP 577 uniform float envMapIntensity; 578 uniform float flipEnvMap; 579 uniform mat3 envMapRotation; 580 #ifdef ENVMAP_TYPE_CUBE 581 uniform samplerCube envMap; 582 #else 583 uniform sampler2D envMap; 584 #endif 585 586#endif`,hu=`#ifdef USE_ENVMAP 587 uniform float reflectivity; 588 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 589 #define ENV_WORLDPOS 590 #endif 591 #ifdef ENV_WORLDPOS 592 varying vec3 vWorldPosition; 593 uniform float refractionRatio; 594 #else 595 varying vec3 vReflect; 596 #endif 597#endif`,fu=`#ifdef USE_ENVMAP 598 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 599 #define ENV_WORLDPOS 600 #endif 601 #ifdef ENV_WORLDPOS 602 603 varying vec3 vWorldPosition; 604 #else 605 varying vec3 vReflect; 606 uniform float refractionRatio; 607 #endif 608#endif`,du=`#ifdef USE_ENVMAP 609 #ifdef ENV_WORLDPOS 610 vWorldPosition = worldPosition.xyz; 611 #else 612 vec3 cameraToVertex; 613 if ( isOrthographic ) { 614 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 615 } else {
616 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 617 } 618 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 619 #ifdef ENVMAP_MODE_REFLECTION 620 vReflect = reflect( cameraToVertex, worldNormal ); 621 #else 622 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 623 #endif 624 #endif 625#endif`,pu=`#ifdef USE_FOG 626 vFogDepth = - mvPosition.z; 627#endif`,mu=`#ifdef USE_FOG 628 varying float vFogDepth; 629#endif`,gu=`#ifdef USE_FOG 630 #ifdef FOG_EXP2 631 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 632 #else 633 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 634 #endif 635 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 636#endif`,_u=`#ifdef USE_FOG 637 uniform vec3 fogColor; 638 varying float vFogDepth; 639 #ifdef FOG_EXP2 640 uniform float fogDensity; 641 #else 642 uniform float fogNear; 643 uniform float fogFar; 644 #endif 645#endif`,vu=`#ifdef USE_GRADIENTMAP 646 uniform sampler2D gradientMap; 647#endif 648vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 649 float dotNL = dot( normal, lightDirection ); 650 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 651 #ifdef USE_GRADIENTMAP 652 return vec3( texture2D( gradientMap, coord ).r ); 653 #else 654 vec2 fw = fwidth( coord ) * 0.5; 655 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 656 #endif 657}`,xu=`#ifdef USE_LIGHTMAP 658 uniform sampler2D lightMap; 659 uniform float lightMapIntensity; 660#endif`,Mu=`LambertMaterial material; 661material.diffuseColor = diffuseColor.rgb; 662material.specularStrength = specularStrength;`,Su=`varying vec3 vViewPosition; 663struct LambertMaterial { 664 vec3 diffuseColor; 665 float specularStrength; 666}; 667void 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 ) { 668 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 669 vec3 irradiance = dotNL * directLight.color; 670 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 671} 672void 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 ) { 673 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 674} 675#define RE_Direct RE_Direct_Lambert 676#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Eu=`uniform bool receiveShadow; 677uniform vec3 ambientLightColor; 678#if defined( USE_LIGHT_PROBES ) 679 uniform vec3 lightProbe[ 9 ]; 680#endif 681vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 682 float x = normal.x, y = normal.y, z = normal.z; 683 vec3 result = shCoefficients[ 0 ] * 0.886227; 684 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 685 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 686 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 687 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 688 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 689 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 690 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 691 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 692 return result; 693} 694vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 695 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 696 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 697 return irradiance; 698} 699vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 700 vec3 irradiance = ambientLightColor; 701 return irradiance; 702} 703float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 704 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 705 if ( cutoffDistance > 0.0 ) { 706 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 707 } 708 return distanceFalloff; 709} 710float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 711 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 712} 713#if NUM_DIR_LIGHTS > 0 714 struct DirectionalLight { 715 vec3 direction; 716 vec3 color; 717 }; 718 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 719 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 720 light.color = directionalLight.color; 721 light.direction = directionalLight.direction; 722 light.visible = true; 723 } 724#endif 725#if NUM_POINT_LIGHTS > 0 726 struct PointLight { 727 vec3 position; 728 vec3 color; 729 float distance; 730 float decay; 731 }; 732 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 733 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 734 vec3 lVector = pointLight.position - geometryPosition; 735 light.direction = normalize( lVector ); 736 float lightDistance = length( lVector ); 737 light.color = pointLight.color; 738 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 739 light.visible = ( light.color != vec3( 0.0 ) ); 740 } 741#endif
742#if NUM_SPOT_LIGHTS > 0 743 struct SpotLight { 744 vec3 position; 745 vec3 direction; 746 vec3 color; 747 float distance; 748 float decay; 749 float coneCos; 750 float penumbraCos; 751 }; 752 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 753 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 754 vec3 lVector = spotLight.position - geometryPosition; 755 light.direction = normalize( lVector ); 756 float angleCos = dot( light.direction, spotLight.direction ); 757 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 758 if ( spotAttenuation > 0.0 ) { 759 float lightDistance = length( lVector ); 760 light.color = spotLight.color * spotAttenuation; 761 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 762 light.visible = ( light.color != vec3( 0.0 ) ); 763 } else { 764 light.color = vec3( 0.0 ); 765 light.visible = false; 766 } 767 } 768#endif 769#if NUM_RECT_AREA_LIGHTS > 0 770 struct RectAreaLight { 771 vec3 color; 772 vec3 position; 773 vec3 halfWidth; 774 vec3 halfHeight; 775 }; 776 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 777 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 778#endif 779#if NUM_HEMI_LIGHTS > 0 780 struct HemisphereLight { 781 vec3 direction; 782 vec3 skyColor; 783 vec3 groundColor; 784 }; 785 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 786 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 787 float dotNL = dot( normal, hemiLight.direction ); 788 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 789 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 790 return irradiance; 791 } 792#endif`,yu=`#ifdef USE_ENVMAP 793 vec3 getIBLIrradiance( const in vec3 normal ) { 794 #ifdef ENVMAP_TYPE_CUBE_UV 795 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 796 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 797 return PI * envMapColor.rgb * envMapIntensity; 798 #else 799 return vec3( 0.0 ); 800 #endif 801 } 802 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 803 #ifdef ENVMAP_TYPE_CUBE_UV 804 vec3 reflectVec = reflect( - viewDir, normal ); 805 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 806 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 807 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 808 return envMapColor.rgb * envMapIntensity; 809 #else 810 return vec3( 0.0 ); 811 #endif 812 } 813 #ifdef USE_ANISOTROPY 814 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 815 #ifdef ENVMAP_TYPE_CUBE_UV 816 vec3 bentNormal = cross( bitangent, viewDir ); 817 bentNormal = normalize( cross( bentNormal, bitangent ) ); 818 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 819 return getIBLRadiance( viewDir, bentNormal, roughness ); 820 #else 821 return vec3( 0.0 ); 822 #endif 823 } 824 #endif 825#endif`,Tu=`ToonMaterial material; 826material.diffuseColor = diffuseColor.rgb;`,bu=`varying vec3 vViewPosition; 827struct ToonMaterial { 828 vec3 diffuseColor; 829}; 830void 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 ) { 831 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 832 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 833} 834void 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 ) { 835 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 836} 837#define RE_Direct RE_Direct_Toon 838#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Au=`BlinnPhongMaterial material; 839material.diffuseColor = diffuseColor.rgb; 840material.specularColor = specular; 841material.specularShininess = shininess; 842material.specularStrength = specularStrength;`,wu=`varying vec3 vViewPosition; 843struct BlinnPhongMaterial { 844 vec3 diffuseColor; 845 vec3 specularColor; 846 float specularShininess; 847 float specularStrength; 848}; 849void 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 ) {
850 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 851 vec3 irradiance = dotNL * directLight.color; 852 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 853 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 854} 855void 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 ) { 856 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857} 858#define RE_Direct RE_Direct_BlinnPhong 859#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Ru=`PhysicalMaterial material; 860material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 861vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 862float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 863material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 864material.roughness = min( material.roughness, 1.0 ); 865#ifdef IOR 866 material.ior = ior; 867 #ifdef USE_SPECULAR 868 float specularIntensityFactor = specularIntensity; 869 vec3 specularColorFactor = specularColor; 870 #ifdef USE_SPECULAR_COLORMAP 871 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 872 #endif 873 #ifdef USE_SPECULAR_INTENSITYMAP 874 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 875 #endif 876 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 877 #else 878 float specularIntensityFactor = 1.0; 879 vec3 specularColorFactor = vec3( 1.0 ); 880 material.specularF90 = 1.0; 881 #endif 882 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 883#else 884 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 885 material.specularF90 = 1.0; 886#endif 887#ifdef USE_CLEARCOAT 888 material.clearcoat = clearcoat; 889 material.clearcoatRoughness = clearcoatRoughness; 890 material.clearcoatF0 = vec3( 0.04 ); 891 material.clearcoatF90 = 1.0; 892 #ifdef USE_CLEARCOATMAP 893 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 894 #endif 895 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 896 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 897 #endif 898 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 899 material.clearcoatRoughness += geometryRoughness; 900 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 901#endif 902#ifdef USE_DISPERSION 903 material.dispersion = dispersion; 904#endif 905#ifdef USE_IRIDESCENCE 906 material.iridescence = iridescence; 907 material.iridescenceIOR = iridescenceIOR; 908 #ifdef USE_IRIDESCENCEMAP 909 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 910 #endif 911 #ifdef USE_IRIDESCENCE_THICKNESSMAP 912 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 913 #else 914 material.iridescenceThickness = iridescenceThicknessMaximum; 915 #endif 916#endif 917#ifdef USE_SHEEN 918 material.sheenColor = sheenColor; 919 #ifdef USE_SHEEN_COLORMAP 920 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 921 #endif 922 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 923 #ifdef USE_SHEEN_ROUGHNESSMAP 924 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 925 #endif 926#endif 927#ifdef USE_ANISOTROPY 928 #ifdef USE_ANISOTROPYMAP 929 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 930 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 931 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 932 #else 933 vec2 anisotropyV = anisotropyVector; 934 #endif 935 material.anisotropy = length( anisotropyV ); 936 if( material.anisotropy == 0.0 ) { 937 anisotropyV = vec2( 1.0, 0.0 ); 938 } else { 939 anisotropyV /= material.anisotropy; 940 material.anisotropy = saturate( material.anisotropy ); 941 } 942 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
943 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 944 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 945#endif`,Cu
vendor: 14,687 bytes, lines 945-1246
945=`struct PhysicalMaterial { 946 vec3 diffuseColor; 947 float roughness; 948 vec3 specularColor; 949 float specularF90; 950 float dispersion; 951 #ifdef USE_CLEARCOAT 952 float clearcoat; 953 float clearcoatRoughness; 954 vec3 clearcoatF0; 955 float clearcoatF90; 956 #endif 957 #ifdef USE_IRIDESCENCE 958 float iridescence; 959 float iridescenceIOR; 960 float iridescenceThickness; 961 vec3 iridescenceFresnel; 962 vec3 iridescenceF0; 963 #endif 964 #ifdef USE_SHEEN 965 vec3 sheenColor; 966 float sheenRoughness; 967 #endif 968 #ifdef IOR 969 float ior; 970 #endif 971 #ifdef USE_TRANSMISSION 972 float transmission; 973 float transmissionAlpha; 974 float thickness; 975 float attenuationDistance; 976 vec3 attenuationColor; 977 #endif 978 #ifdef USE_ANISOTROPY 979 float anisotropy; 980 float alphaT; 981 vec3 anisotropyT; 982 vec3 anisotropyB; 983 #endif 984}; 985vec3 clearcoatSpecularDirect = vec3( 0.0 ); 986vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 987vec3 sheenSpecularDirect = vec3( 0.0 ); 988vec3 sheenSpecularIndirect = vec3(0.0 ); 989vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 990 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 991 float x2 = x * x; 992 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 993 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 994} 995float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 996 float a2 = pow2( alpha ); 997 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 998 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 999 return 0.5 / max( gv + gl, EPSILON ); 1000} 1001float D_GGX( const in float alpha, const in float dotNH ) { 1002 float a2 = pow2( alpha ); 1003 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1004 return RECIPROCAL_PI * a2 / pow2( denom ); 1005} 1006#ifdef USE_ANISOTROPY 1007 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 ) { 1008 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1009 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1010 float v = 0.5 / ( gv + gl ); 1011 return saturate(v); 1012 } 1013 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1014 float a2 = alphaT * alphaB; 1015 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1016 highp float v2 = dot( v, v ); 1017 float w2 = a2 / v2; 1018 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1019 } 1020#endif 1021#ifdef USE_CLEARCOAT 1022 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1023 vec3 f0 = material.clearcoatF0; 1024 float f90 = material.clearcoatF90; 1025 float roughness = material.clearcoatRoughness; 1026 float alpha = pow2( roughness ); 1027 vec3 halfDir = normalize( lightDir + viewDir ); 1028 float dotNL = saturate( dot( normal, lightDir ) ); 1029 float dotNV = saturate( dot( normal, viewDir ) ); 1030 float dotNH = saturate( dot( normal, halfDir ) ); 1031 float dotVH = saturate( dot( viewDir, halfDir ) ); 1032 vec3 F = F_Schlick( f0, f90, dotVH ); 1033 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1034 float D = D_GGX( alpha, dotNH ); 1035 return F * ( V * D ); 1036 } 1037#endif 1038vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1039 vec3 f0 = material.specularColor; 1040 float f90 = material.specularF90; 1041 float roughness = material.roughness; 1042 float alpha = pow2( roughness ); 1043 vec3 halfDir = normalize( lightDir + viewDir ); 1044 float dotNL = saturate( dot( normal, lightDir ) ); 1045 float dotNV = saturate( dot( normal, viewDir ) ); 1046 float dotNH = saturate( dot( normal, halfDir ) ); 1047 float dotVH = saturate( dot( viewDir, halfDir ) ); 1048 vec3 F = F_Schlick( f0, f90, dotVH ); 1049 #ifdef USE_IRIDESCENCE 1050 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1051 #endif 1052 #ifdef USE_ANISOTROPY 1053 float dotTL = dot( material.anisotropyT, lightDir ); 1054 float dotTV = dot( material.anisotropyT, viewDir ); 1055 float dotTH = dot( material.anisotropyT, halfDir ); 1056 float dotBL = dot( material.anisotropyB, lightDir ); 1057 float dotBV = dot( material.anisotropyB, viewDir ); 1058 float dotBH = dot( material.anisotropyB, halfDir ); 1059 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1060 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1061 #else 1062 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1063 float D = D_GGX( alpha, dotNH ); 1064 #endif 1065 return F * ( V * D ); 1066} 1067vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1068 const float LUT_SIZE = 64.0; 1069 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1070 const float LUT_BIAS = 0.5 / LUT_SIZE; 1071 float dotNV = saturate( dot( N, V ) ); 1072 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1073 uv = uv * LUT_SCALE + LUT_BIAS; 1074 return uv; 1075} 1076float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1077 float l = length( f ); 1078 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1079} 1080vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1081 float x = dot( v1, v2 ); 1082 float y = abs( x ); 1083 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1084 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1085 float v = a / b; 1086 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1087 return cross( v1, v2 ) * theta_sintheta; 1088} 1089vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1090 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1091 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1092 vec3 lightNormal = cross( v1, v2 ); 1093 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1094 vec3 T1, T2; 1095 T1 = normalize( V - N * dot( V, N ) ); 1096 T2 = - cross( N, T1 ); 1097 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1098 vec3 coords[ 4 ]; 1099 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1100 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1101 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1102 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1103 coords[ 0 ] = normalize( coords[ 0 ] ); 1104 coords[ 1 ] = normalize( coords[ 1 ] ); 1105 coords[ 2 ] = normalize( coords[ 2 ] ); 1106 coords[ 3 ] = normalize( coords[ 3 ] ); 1107 vec3 vectorFormFactor = vec3( 0.0 ); 1108 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1109 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1110 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1111 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1112 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1113 return vec3( result ); 1114} 1115#if defined( USE_SHEEN ) 1116float D_Charlie( float roughness, float dotNH ) { 1117 float alpha = pow2( roughness ); 1118 float invAlpha = 1.0 / alpha; 1119 float cos2h = dotNH * dotNH; 1120 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1121 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1122} 1123float V_Neubelt( float dotNV, float dotNL ) { 1124 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1125} 1126vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1127 vec3 halfDir = normalize( lightDir + viewDir ); 1128 float dotNL = saturate( dot( normal, lightDir ) ); 1129 float dotNV = saturate( dot( normal, viewDir ) ); 1130 float dotNH = saturate( dot( normal, halfDir ) ); 1131 float D = D_Charlie( sheenRoughness, dotNH ); 1132 float V = V_Neubelt( dotNV, dotNL ); 1133 return sheenColor * ( D * V ); 1134} 1135#endif 1136float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1137 float dotNV = saturate( dot( normal, viewDir ) ); 1138 float r2 = roughness * roughness; 1139 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1140 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1141 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1142 return saturate( DG * RECIPROCAL_PI ); 1143} 1144vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1145 float dotNV = saturate( dot( normal, viewDir ) ); 1146 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1147 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1148 vec4 r = roughness * c0 + c1; 1149 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1150 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1151 return fab; 1152} 1153vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1154 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1155 return specularColor * fab.x + specularF90 * fab.y; 1156} 1157#ifdef USE_IRIDESCENCE 1158void 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 ) { 1159#else 1160void 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 ) { 1161#endif 1162 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1163 #ifdef USE_IRIDESCENCE 1164 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1165 #else 1166 vec3 Fr = specularColor; 1167 #endif 1168 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1169 float Ess = fab.x + fab.y; 1170 float Ems = 1.0 - Ess; 1171 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1172 singleScatter += FssEss; 1173 multiScatter += Fms * Ems; 1174} 1175#if NUM_RECT_AREA_LIGHTS > 0 1176 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 ) { 1177 vec3 normal = geometryNormal; 1178 vec3 viewDir = geometryViewDir; 1179 vec3 position = geometryPosition; 1180 vec3 lightPos = rectAreaLight.position; 1181 vec3 halfWidth = rectAreaLight.halfWidth; 1182 vec3 halfHeight = rectAreaLight.halfHeight; 1183 vec3 lightColor = rectAreaLight.color; 1184 float roughness = material.roughness; 1185 vec3 rectCoords[ 4 ]; 1186 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1187 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1188 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1189 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1190 vec4 t1 = texture2D( ltc_1, uv ); 1191 vec4 t2 = texture2D( ltc_2, uv ); 1192 mat3 mInv = mat3( 1193 vec3( t1.x, 0, t1.y ), 1194 vec3( 0, 1, 0 ), 1195 vec3( t1.z, 0, t1.w ) 1196 ); 1197 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1198 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1199 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1200 } 1201#endif 1202void 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 ) { 1203 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1204 vec3 irradiance = dotNL * directLight.color; 1205 #ifdef USE_CLEARCOAT 1206 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1207 vec3 ccIrradiance = dotNLcc * directLight.color; 1208 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1209 #endif 1210 #ifdef USE_SHEEN 1211 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1212 #endif 1213 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1214 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1215} 1216void 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 ) { 1217 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1218} 1219void 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) { 1220 #ifdef USE_CLEARCOAT 1221 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1222 #endif 1223 #ifdef USE_SHEEN 1224 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1225 #endif 1226 vec3 singleScattering = vec3( 0.0 ); 1227 vec3 multiScattering = vec3( 0.0 ); 1228 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1229 #ifdef USE_IRIDESCENCE 1230 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1231 #else 1232 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1233 #endif 1234 vec3 totalScattering = singleScattering + multiScattering; 1235 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1236 reflectedLight.indirectSpecular += radiance * singleScattering; 1237 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1238 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1239} 1240#define RE_Direct RE_Direct_Physical 1241#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1242#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1243#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1244float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1245 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1246}`,
1246Pu=` 1247vec3 geometryPosition = - vViewPosition; 1248vec3 geometryNormal = normal; 1249vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1250vec3 geometryClearcoatNormal = vec3( 0.0 ); 1251#ifdef USE_CLEARCOAT 1252 geometryClearcoatNormal = clearcoatNormal; 1253#endif 1254#ifdef USE_IRIDESCENCE 1255 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1256 if ( material.iridescenceThickness == 0.0 ) { 1257 material.iridescence = 0.0; 1258 } else { 1259 material.iridescence = saturate( material.iridescence ); 1260 } 1261 if ( material.iridescence > 0.0 ) { 1262 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1263 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1264 } 1265#endif 1266IncidentLight directLight; 1267#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1268 PointLight pointLight; 1269 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1270 PointLightShadow pointLightShadow; 1271 #endif 1272 #pragma unroll_loop_start 1273 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1274 pointLight = pointLights[ i ]; 1275 getPointLightInfo( pointLight, geometryPosition, directLight ); 1276 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1277 pointLightShadow = pointLightShadows[ i ]; 1278 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1279 #endif 1280 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1281 } 1282 #pragma unroll_loop_end 1283#endif 1284#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1285 SpotLight spotLight; 1286 vec4 spotColor; 1287 vec3 spotLightCoord; 1288 bool inSpotLightMap; 1289 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1290 SpotLightShadow spotLightShadow; 1291 #endif 1292 #pragma unroll_loop_start 1293 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1294 spotLight = spotLights[ i ]; 1295 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1296 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1297 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1298 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1299 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1300 #else 1301 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1302 #endif 1303 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1304 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1305 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1306 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1307 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1308 #endif 1309 #undef SPOT_LIGHT_MAP_INDEX 1310 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1311 spotLightShadow = spotLightShadows[ i ]; 1312 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1313 #endif 1314 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1315 } 1316 #pragma unroll_loop_end 1317#endif 1318#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1319 DirectionalLight directionalLight; 1320 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1321 DirectionalLightShadow directionalLightShadow; 1322 #endif 1323 #pragma unroll_loop_start 1324 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1325 directionalLight = directionalLights[ i ]; 1326 getDirectionalLightInfo( directionalLight, directLight ); 1327 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1328 directionalLightShadow = directionalLightShadows[ i ]; 1329 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1330 #endif 1331 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1332 } 1333 #pragma unroll_loop_end 1334#endif 1335#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1336 RectAreaLight rectAreaLight; 1337 #pragma unroll_loop_start 1338 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1339 rectAreaLight = rectAreaLights[ i ]; 1340 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1341 } 1342 #pragma unroll_loop_end 1343#endif 1344#if defined( RE_IndirectDiffuse ) 1345 vec3 iblIrradiance = vec3( 0.0 ); 1346 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1347 #if defined( USE_LIGHT_PROBES ) 1348 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1349 #endif 1350 #if ( NUM_HEMI_LIGHTS > 0 ) 1351 #pragma unroll_loop_start 1352 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1353 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1354 } 1355 #pragma unroll_loop_end 1356 #endif 1357#endif 1358#if defined( RE_IndirectSpecular ) 1359 vec3 radiance = vec3( 0.0 ); 1360 vec3 clearcoatRadiance = vec3( 0.0 ); 1361#endif`,Du=`#if defined( RE_IndirectDiffuse ) 1362 #ifdef USE_LIGHTMAP 1363 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1364 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1365 irradiance += lightMapIrradiance; 1366 #endif 1367 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1368 iblIrradiance += getIBLIrradiance( geometryNormal ); 1369 #endif 1370#endif 1371#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1372 #ifdef USE_ANISOTROPY 1373 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1374 #else 1375 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1376 #endif 1377 #ifdef USE_CLEARCOAT 1378 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1379 #endif 1380#endif`,Lu=`#if defined( RE_IndirectDiffuse ) 1381 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1382#endif 1383#if defined( RE_IndirectSpecular ) 1384 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1385#endif`,Uu=`#if defined( USE_LOGDEPTHBUF ) 1386 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1387#endif`,Iu=`#if defined( USE_LOGDEPTHBUF ) 1388 uniform float logDepthBufFC; 1389 varying float vFragDepth; 1390 varying float vIsPerspective; 1391#endif`,Nu=`#ifdef USE_LOGDEPTHBUF 1392 varying float vFragDepth; 1393 varying float vIsPerspective; 1394#endif`,Fu=`#ifdef USE_LOGDEPTHBUF 1395 vFragDepth = 1.0 + gl_Position.w; 1396 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1397#endif`,Ou=`#ifdef USE_MAP 1398 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1399 #ifdef DECODE_VIDEO_TEXTURE 1400 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1401 #endif 1402 diffuseColor *= sampledDiffuseColor; 1403#endif`,Bu=`#ifdef USE_MAP 1404 uniform sampler2D map; 1405#endif`,zu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1406 #if defined( USE_POINTS_UV ) 1407 vec2 uv = vUv; 1408 #else 1409 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1410 #endif 1411#endif 1412#ifdef USE_MAP 1413 diffuseColor *= texture2D( map, uv ); 1414#endif 1415#ifdef USE_ALPHAMAP 1416 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1417#endif`,Hu=`#if defined( USE_POINTS_UV ) 1418 varying vec2 vUv; 1419#else 1420 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1421 uniform mat3 uvTransform; 1422 #endif 1423#endif 1424#ifdef USE_MAP 1425 uniform sampler2D map; 1426#endif 1427#ifdef USE_ALPHAMAP 1428 uniform sampler2D alphaMap; 1429#endif`,Vu=`float metalnessFactor = metalness; 1430#ifdef USE_METALNESSMAP 1431 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1432 metalnessFactor *= texelMetalness.b; 1433#endif`,Gu=`#ifdef USE_METALNESSMAP 1434 uniform sampler2D metalnessMap; 1435#endif`,ku=`#ifdef USE_INSTANCING_MORPH 1436 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1437 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1438 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1439 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1440 } 1441#endif`,Wu=`#if defined( USE_MORPHCOLORS ) 1442 vColor *= morphTargetBaseInfluence; 1443 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1444 #if defined( USE_COLOR_ALPHA ) 1445 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1446 #elif defined( USE_COLOR ) 1447 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1448 #endif 1449 } 1450#endif`,Xu=`#ifdef USE_MORPHNORMALS 1451 objectNormal *= morphTargetBaseInfluence; 1452 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1453 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1454 } 1455#endif`,qu=`#ifdef USE_MORPHTARGETS 1456 #ifndef USE_INSTANCING_MORPH 1457 uniform float morphTargetBaseInfluence; 1458 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1459 #endif 1460 uniform sampler2DArray morphTargetsTexture; 1461 uniform ivec2 morphTargetsTextureSize; 1462 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1463 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1464 int y = texelIndex / morphTargetsTextureSize.x; 1465 int x = texelIndex - y * morphTargetsTextureSize.x; 1466 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1467 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1468 } 1469#endif`,Yu=`#ifdef USE_MORPHTARGETS 1470 transformed *= morphTargetBaseInfluence; 1471 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1472 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1473 } 1474#endif`,Ku=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1475#ifdef FLAT_SHADED 1476 vec3 fdx = dFdx( vViewPosition ); 1477 vec3 fdy = dFdy( vViewPosition ); 1478 vec3 normal = normalize( cross( fdx, fdy ) ); 1479#else 1480 vec3 normal = normalize( vNormal ); 1481 #ifdef DOUBLE_SIDED 1482 normal *= faceDirection; 1483 #endif 1484#endif 1485#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1486 #ifdef USE_TANGENT 1487 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1488 #else 1489 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1490 #if defined( USE_NORMALMAP ) 1491 vNormalMapUv 1492 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1493 vClearcoatNormalMapUv 1494 #else 1495 vUv 1496 #endif 1497 ); 1498 #endif 1499 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1500 tbn[0] *= faceDirection; 1501 tbn[1] *= faceDirection; 1502 #endif 1503#endif 1504#ifdef USE_CLEARCOAT_NORMALMAP 1505 #ifdef USE_TANGENT 1506 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1507 #else 1508 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1509 #endif 1510 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1511 tbn2[0] *= faceDirection; 1512 tbn2[1] *= faceDirection; 1513 #endif 1514#endif 1515vec3 nonPerturbedNormal = normal;`,Zu=`#ifdef USE_NORMALMAP_OBJECTSPACE 1516 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1517 #ifdef FLIP_SIDED 1518 normal = - normal; 1519 #endif 1520 #ifdef DOUBLE_SIDED 1521 normal = normal * faceDirection; 1522 #endif 1523 normal = normalize( normalMatrix * normal ); 1524#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1525 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1526 mapN.xy *= normalScale; 1527 normal = normalize( tbn * mapN ); 1528#elif defined( USE_BUMPMAP )
1529 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1530#endif`,$u=`#ifndef FLAT_SHADED 1531 varying vec3 vNormal; 1532 #ifdef USE_TANGENT 1533 varying vec3 vTangent; 1534 varying vec3 vBitangent; 1535 #endif 1536#endif`,ju=`#ifndef FLAT_SHADED 1537 varying vec3 vNormal; 1538 #ifdef USE_TANGENT 1539 varying vec3 vTangent; 1540 varying vec3 vBitangent; 1541 #endif 1542#endif`,Ju=`#ifndef FLAT_SHADED 1543 vNormal = normalize( transformedNormal ); 1544 #ifdef USE_TANGENT 1545 vTangent = normalize( transformedTangent ); 1546 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1547 #endif 1548#endif`,Qu=`#ifdef USE_NORMALMAP 1549 uniform sampler2D normalMap; 1550 uniform vec2 normalScale; 1551#endif 1552#ifdef USE_NORMALMAP_OBJECTSPACE 1553 uniform mat3 normalMatrix; 1554#endif 1555#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1556 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1557 vec3 q0 = dFdx( eye_pos.xyz ); 1558 vec3 q1 = dFdy( eye_pos.xyz ); 1559 vec2 st0 = dFdx( uv.st ); 1560 vec2 st1 = dFdy( uv.st ); 1561 vec3 N = surf_norm; 1562 vec3 q1perp = cross( q1, N ); 1563 vec3 q0perp = cross( N, q0 ); 1564 vec3 T = q1perp * st0.x + q0perp * st1.x; 1565 vec3 B = q1perp * st0.y + q0perp * st1.y; 1566 float det = max( dot( T, T ), dot( B, B ) ); 1567 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1568 return mat3( T * scale, B * scale, N ); 1569 } 1570#endif`,eh=`#ifdef USE_CLEARCOAT 1571 vec3 clearcoatNormal = nonPerturbedNormal; 1572#endif`,th=`#ifdef USE_CLEARCOAT_NORMALMAP 1573 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1574 clearcoatMapN.xy *= clearcoatNormalScale; 1575 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1576#endif`,nh=`#ifdef USE_CLEARCOATMAP 1577 uniform sampler2D clearcoatMap; 1578#endif 1579#ifdef USE_CLEARCOAT_NORMALMAP 1580 uniform sampler2D clearcoatNormalMap; 1581 uniform vec2 clearcoatNormalScale; 1582#endif 1583#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1584 uniform sampler2D clearcoatRoughnessMap; 1585#endif`,ih=`#ifdef USE_IRIDESCENCEMAP 1586 uniform sampler2D iridescenceMap; 1587#endif 1588#ifdef USE_IRIDESCENCE_THICKNESSMAP 1589 uniform sampler2D iridescenceThicknessMap; 1590#endif`,rh=`#ifdef OPAQUE 1591diffuseColor.a = 1.0; 1592#endif 1593#ifdef USE_TRANSMISSION 1594diffuseColor.a *= material.transmissionAlpha; 1595#endif 1596gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,sh=`vec3 packNormalToRGB( const in vec3 normal ) { 1597 return normalize( normal ) * 0.5 + 0.5; 1598} 1599vec3 unpackRGBToNormal( const in vec3 rgb ) { 1600 return 2.0 * rgb.xyz - 1.0; 1601} 1602const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1603const float Inv255 = 1. / 255.; 1604const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1605const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1606const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1607const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1608vec4 packDepthToRGBA( const in float v ) { 1609 if( v <= 0.0 ) 1610 return vec4( 0., 0., 0., 0. ); 1611 if( v >= 1.0 ) 1612 return vec4( 1., 1., 1., 1. ); 1613 float vuf; 1614 float af = modf( v * PackFactors.a, vuf ); 1615 float bf = modf( vuf * ShiftRight8, vuf ); 1616 float gf = modf( vuf * ShiftRight8, vuf ); 1617 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1618} 1619vec3 packDepthToRGB( const in float v ) { 1620 if( v <= 0.0 ) 1621 return vec3( 0., 0., 0. ); 1622 if( v >= 1.0 ) 1623 return vec3( 1., 1., 1. ); 1624 float vuf; 1625 float bf = modf( v * PackFactors.b, vuf ); 1626 float gf = modf( vuf * ShiftRight8, vuf ); 1627 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1628} 1629vec2 packDepthToRG( const in float v ) { 1630 if( v <= 0.0 ) 1631 return vec2( 0., 0. ); 1632 if( v >= 1.0 ) 1633 return vec2( 1., 1. ); 1634 float vuf; 1635 float gf = modf( v * 256., vuf ); 1636 return vec2( vuf * Inv255, gf ); 1637} 1638float unpackRGBAToDepth( const in vec4 v ) { 1639 return dot( v, UnpackFactors4 ); 1640} 1641float unpackRGBToDepth( const in vec3 v ) { 1642 return dot( v, UnpackFactors3 ); 1643} 1644float unpackRGToDepth( const in vec2 v ) { 1645 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1646} 1647vec4 pack2HalfToRGBA( const in vec2 v ) {
1648 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1649 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1650} 1651vec2 unpackRGBATo2Half( const in vec4 v ) { 1652 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1653} 1654float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1655 return ( viewZ + near ) / ( near - far ); 1656} 1657float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1658 return depth * ( near - far ) - near; 1659} 1660float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1661 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1662} 1663float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1664 return ( near * far ) / ( ( far - near ) * depth - far ); 1665}`,ah=`#ifdef PREMULTIPLIED_ALPHA 1666 gl_FragColor.rgb *= gl_FragColor.a; 1667#endif`,oh=`vec4 mvPosition = vec4( transformed, 1.0 ); 1668#ifdef USE_BATCHING 1669 mvPosition = batchingMatrix * mvPosition; 1670#endif 1671#ifdef USE_INSTANCING 1672 mvPosition = instanceMatrix * mvPosition; 1673#endif 1674mvPosition = modelViewMatrix * mvPosition; 1675gl_Position = projectionMatrix * mvPosition;`,lh=`#ifdef DITHERING 1676 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1677#endif`,ch=`#ifdef DITHERING 1678 vec3 dithering( vec3 color ) { 1679 float grid_position = rand( gl_FragCoord.xy ); 1680 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1681 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1682 return color + dither_shift_RGB; 1683 } 1684#endif`,uh=`float roughnessFactor = roughness; 1685#ifdef USE_ROUGHNESSMAP 1686 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1687 roughnessFactor *= texelRoughness.g; 1688#endif`,hh=`#ifdef USE_ROUGHNESSMAP 1689 uniform sampler2D roughnessMap; 1690#endif`,fh=
vendor: 8,887 bytes, lines 1690-1876
1690`#if NUM_SPOT_LIGHT_COORDS > 0 1691 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1692#endif 1693#if NUM_SPOT_LIGHT_MAPS > 0 1694 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1695#endif 1696#ifdef USE_SHADOWMAP 1697 #if NUM_DIR_LIGHT_SHADOWS > 0 1698 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1699 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1700 struct DirectionalLightShadow { 1701 float shadowIntensity; 1702 float shadowBias; 1703 float shadowNormalBias; 1704 float shadowRadius; 1705 vec2 shadowMapSize; 1706 }; 1707 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1708 #endif 1709 #if NUM_SPOT_LIGHT_SHADOWS > 0 1710 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1711 struct SpotLightShadow { 1712 float shadowIntensity; 1713 float shadowBias; 1714 float shadowNormalBias; 1715 float shadowRadius; 1716 vec2 shadowMapSize; 1717 }; 1718 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1719 #endif 1720 #if NUM_POINT_LIGHT_SHADOWS > 0 1721 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1722 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1723 struct PointLightShadow { 1724 float shadowIntensity; 1725 float shadowBias; 1726 float shadowNormalBias; 1727 float shadowRadius; 1728 vec2 shadowMapSize; 1729 float shadowCameraNear; 1730 float shadowCameraFar; 1731 }; 1732 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1733 #endif 1734 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1735 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1736 } 1737 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1738 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1739 } 1740 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1741 float occlusion = 1.0; 1742 vec2 distribution = texture2DDistribution( shadow, uv ); 1743 float hard_shadow = step( compare , distribution.x ); 1744 if (hard_shadow != 1.0 ) { 1745 float distance = compare - distribution.x ; 1746 float variance = max( 0.00000, distribution.y * distribution.y ); 1747 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 ); 1748 } 1749 return occlusion; 1750 } 1751 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1752 float shadow = 1.0; 1753 shadowCoord.xyz /= shadowCoord.w; 1754 shadowCoord.z += shadowBias; 1755 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1756 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1757 if ( frustumTest ) { 1758 #if defined( SHADOWMAP_TYPE_PCF ) 1759 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1760 float dx0 = - texelSize.x * shadowRadius; 1761 float dy0 = - texelSize.y * shadowRadius; 1762 float dx1 = + texelSize.x * shadowRadius; 1763 float dy1 = + texelSize.y * shadowRadius; 1764 float dx2 = dx0 / 2.0; 1765 float dy2 = dy0 / 2.0; 1766 float dx3 = dx1 / 2.0; 1767 float dy3 = dy1 / 2.0; 1768 shadow = ( 1769 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1770 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1771 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1772 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1773 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1786 ) * ( 1.0 / 17.0 ); 1787 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1788 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1789 float dx = texelSize.x; 1790 float dy = texelSize.y; 1791 vec2 uv = shadowCoord.xy; 1792 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1793 uv -= f * texelSize; 1794 shadow = ( 1795 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1796 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1798 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1799 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1800 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1801 f.x ) + 1802 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1803 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1804 f.x ) + 1805 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1806 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1807 f.y ) + 1808 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1809 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1810 f.y ) + 1811 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1812 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1813 f.x ), 1814 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1815 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1816 f.x ), 1817 f.y ) 1818 ) * ( 1.0 / 9.0 ); 1819 #elif defined( SHADOWMAP_TYPE_VSM ) 1820 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1821 #else 1822 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1823 #endif 1824 } 1825 return mix( 1.0, shadow, shadowIntensity ); 1826 } 1827 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1828 vec3 absV = abs( v ); 1829 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1830 absV *= scaleToCube; 1831 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1832 vec2 planar = v.xy; 1833 float almostATexel = 1.5 * texelSizeY; 1834 float almostOne = 1.0 - almostATexel; 1835 if ( absV.z >= almostOne ) { 1836 if ( v.z > 0.0 ) 1837 planar.x = 4.0 - v.x; 1838 } else if ( absV.x >= almostOne ) { 1839 float signX = sign( v.x ); 1840 planar.x = v.z * signX + 2.0 * signX; 1841 } else if ( absV.y >= almostOne ) { 1842 float signY = sign( v.y ); 1843 planar.x = v.x + 2.0 * signY + 2.0; 1844 planar.y = v.z * signY - 2.0; 1845 } 1846 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1847 } 1848 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1849 float shadow = 1.0; 1850 vec3 lightToPosition = shadowCoord.xyz; 1851 1852 float lightToPositionLength = length( lightToPosition ); 1853 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1854 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1855 vec3 bd3D = normalize( lightToPosition ); 1856 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1857 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1858 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1859 shadow = ( 1860 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1861 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1862 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1863 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1864 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1869 ) * ( 1.0 / 9.0 ); 1870 #else 1871 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1872 #endif 1873 } 1874 return mix( 1.0, shadow, shadowIntensity ); 1875 } 1876#endif`,
1876dh=`#if NUM_SPOT_LIGHT_COORDS > 0 1877 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1878 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1879#endif 1880#ifdef USE_SHADOWMAP 1881 #if NUM_DIR_LIGHT_SHADOWS > 0 1882 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1883 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1884 struct DirectionalLightShadow { 1885 float shadowIntensity; 1886 float shadowBias; 1887 float shadowNormalBias; 1888 float shadowRadius; 1889 vec2 shadowMapSize; 1890 }; 1891 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1892 #endif 1893 #if NUM_SPOT_LIGHT_SHADOWS > 0 1894 struct SpotLightShadow { 1895 float shadowIntensity; 1896 float shadowBias; 1897 float shadowNormalBias; 1898 float shadowRadius; 1899 vec2 shadowMapSize; 1900 }; 1901 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1902 #endif 1903 #if NUM_POINT_LIGHT_SHADOWS > 0 1904 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1905 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1906 struct PointLightShadow { 1907 float shadowIntensity; 1908 float shadowBias; 1909 float shadowNormalBias; 1910 float shadowRadius; 1911 vec2 shadowMapSize; 1912 float shadowCameraNear; 1913 float shadowCameraFar; 1914 }; 1915 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1916 #endif 1917#endif`,ph=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1918 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1919 vec4 shadowWorldPosition; 1920#endif 1921#if defined( USE_SHADOWMAP ) 1922 #if NUM_DIR_LIGHT_SHADOWS > 0 1923 #pragma unroll_loop_start 1924 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1925 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1926 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1927 } 1928 #pragma unroll_loop_end 1929 #endif 1930 #if NUM_POINT_LIGHT_SHADOWS > 0 1931 #pragma unroll_loop_start 1932 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1933 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1934 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1935 } 1936 #pragma unroll_loop_end 1937 #endif 1938#endif 1939#if NUM_SPOT_LIGHT_COORDS > 0 1940 #pragma unroll_loop_start 1941 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1942 shadowWorldPosition = worldPosition; 1943 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1944 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1945 #endif 1946 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1947 } 1948 #pragma unroll_loop_end 1949#endif`,mh=`float getShadowMask() { 1950 float shadow = 1.0; 1951 #ifdef USE_SHADOWMAP 1952 #if NUM_DIR_LIGHT_SHADOWS > 0 1953 DirectionalLightShadow directionalLight; 1954 #pragma unroll_loop_start 1955 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1956 directionalLight = directionalLightShadows[ i ]; 1957 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1958 } 1959 #pragma unroll_loop_end 1960 #endif 1961 #if NUM_SPOT_LIGHT_SHADOWS > 0 1962 SpotLightShadow spotLight; 1963 #pragma unroll_loop_start 1964 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1965 spotLight = spotLightShadows[ i ]; 1966 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1967 } 1968 #pragma unroll_loop_end 1969 #endif 1970 #if NUM_POINT_LIGHT_SHADOWS > 0 1971 PointLightShadow pointLight; 1972 #pragma unroll_loop_start 1973 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1974 pointLight = pointLightShadows[ i ]; 1975 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1976 } 1977 #pragma unroll_loop_end 1978 #endif 1979 #endif 1980 return shadow; 1981}`,gh=`#ifdef USE_SKINNING 1982 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1983 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1984 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1985 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1986#endif`,_h=`#ifdef USE_SKINNING 1987 uniform mat4 bindMatrix; 1988 uniform mat4 bindMatrixInverse; 1989 uniform highp sampler2D boneTexture; 1990 mat4 getBoneMatrix( const in float i ) { 1991 int size = textureSize( boneTexture, 0 ).x; 1992 int j = int( i ) * 4; 1993 int x = j % size; 1994 int y = j / size; 1995 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 1996 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 1997 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 1998 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 1999 return mat4( v1, v2, v3, v4 ); 2000 } 2001#endif`,vh=`#ifdef USE_SKINNING 2002 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2003 vec4 skinned = vec4( 0.0 ); 2004 skinned += boneMatX * skinVertex * skinWeight.x; 2005 skinned += boneMatY * skinVertex * skinWeight.y; 2006 skinned += boneMatZ * skinVertex * skinWeight.z; 2007 skinned += boneMatW * skinVertex * skinWeight.w; 2008 transformed = ( bindMatrixInverse * skinned ).xyz; 2009#endif`,xh=`#ifdef USE_SKINNING 2010 mat4 skinMatrix = mat4( 0.0 ); 2011 skinMatrix += skinWeight.x * boneMatX; 2012 skinMatrix += skinWeight.y * boneMatY; 2013 skinMatrix += skinWeight.z * boneMatZ; 2014 skinMatrix += skinWeight.w * boneMatW; 2015 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2016 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2017 #ifdef USE_TANGENT 2018 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2019 #endif 2020#endif`,Mh=`float specularStrength; 2021#ifdef USE_SPECULARMAP 2022 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2023 specularStrength = texelSpecular.r; 2024#else 2025 specularStrength = 1.0; 2026#endif`,Sh=`#ifdef USE_SPECULARMAP 2027 uniform sampler2D specularMap; 2028#endif`,Eh=`#if defined( TONE_MAPPING ) 2029 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2030#endif`,yh=`#ifndef saturate 2031#define saturate( a ) clamp( a, 0.0, 1.0 ) 2032#endif 2033uniform float toneMappingExposure; 2034vec3 LinearToneMapping( vec3 color ) { 2035 return saturate( toneMappingExposure * color ); 2036} 2037vec3 ReinhardToneMapping( vec3 color ) { 2038 color *= toneMappingExposure; 2039 return saturate( color / ( vec3( 1.0 ) + color ) ); 2040} 2041vec3 CineonToneMapping( vec3 color ) { 2042 color *= toneMappingExposure; 2043 color = max( vec3( 0.0 ), color - 0.004 ); 2044 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2045} 2046vec3 RRTAndODTFit( vec3 v ) { 2047 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2048 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2049 return a / b; 2050} 2051vec3 ACESFilmicToneMapping( vec3 color ) { 2052 const mat3 ACESInputMat = mat3( 2053 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2054 vec3( 0.04823, 0.01566, 0.83777 ) 2055 ); 2056 const mat3 ACESOutputMat = mat3( 2057 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2058 vec3( -0.07367, -0.00605, 1.07602 ) 2059 ); 2060 color *= toneMappingExposure / 0.6; 2061 color = ACESInputMat * color; 2062 color = RRTAndODTFit( color ); 2063 color = ACESOutputMat * color; 2064 return saturate( color ); 2065} 2066const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2067 vec3( 1.6605, - 0.1246, - 0.0182 ), 2068 vec3( - 0.5876, 1.1329, - 0.1006 ), 2069 vec3( - 0.0728, - 0.0083, 1.1187 ) 2070); 2071const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2072 vec3( 0.6274, 0.0691, 0.0164 ), 2073 vec3( 0.3293, 0.9195, 0.0880 ), 2074 vec3( 0.0433, 0.0113, 0.8956 ) 2075); 2076vec3 agxDefaultContrastApprox( vec3 x ) { 2077 vec3 x2 = x * x; 2078 vec3 x4 = x2 * x2; 2079 return + 15.5 * x4 * x2 2080 - 40.14 * x4 * x 2081 + 31.96 * x4 2082 - 6.868 * x2 * x 2083 + 0.4298 * x2 2084 + 0.1191 * x 2085 - 0.00232; 2086} 2087vec3 AgXToneMapping( vec3 color ) { 2088 const mat3 AgXInsetMatrix = mat3( 2089 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2090 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2091 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2092 );
2093 const mat3 AgXOutsetMatrix = mat3( 2094 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2095 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2096 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2097 ); 2098 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2099 color *= toneMappingExposure; 2100 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2101 color = AgXInsetMatrix * color; 2102 color = max( color, 1e-10 ); color = log2( color ); 2103 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2104 color = clamp( color, 0.0, 1.0 ); 2105 color = agxDefaultContrastApprox( color ); 2106 color = AgXOutsetMatrix * color; 2107 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2108 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2109 color = clamp( color, 0.0, 1.0 ); 2110 return color; 2111} 2112vec3 NeutralToneMapping( vec3 color ) { 2113 const float StartCompression = 0.8 - 0.04; 2114 const float Desaturation = 0.15; 2115 color *= toneMappingExposure; 2116 float x = min( color.r, min( color.g, color.b ) ); 2117 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2118 color -= offset; 2119 float peak = max( color.r, max( color.g, color.b ) ); 2120 if ( peak < StartCompression ) return color; 2121 float d = 1. - StartCompression; 2122 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2123 color *= newPeak / peak; 2124 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2125 return mix( color, vec3( newPeak ), g ); 2126} 2127vec3 CustomToneMapping( vec3 color ) { return color; }`,Th=`#ifdef USE_TRANSMISSION 2128 material.transmission = transmission; 2129 material.transmissionAlpha = 1.0; 2130 material.thickness = thickness; 2131 material.attenuationDistance = attenuationDistance; 2132 material.attenuationColor = attenuationColor; 2133 #ifdef USE_TRANSMISSIONMAP 2134 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2135 #endif 2136 #ifdef USE_THICKNESSMAP 2137 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2138 #endif 2139 vec3 pos = vWorldPosition; 2140 vec3 v = normalize( cameraPosition - pos ); 2141 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2142 vec4 transmitted = getIBLVolumeRefraction( 2143 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2144 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2145 material.attenuationColor, material.attenuationDistance ); 2146 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2147 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2148#endif`,bh=`#ifdef USE_TRANSMISSION 2149 uniform float transmission; 2150 uniform float thickness; 2151 uniform float attenuationDistance; 2152 uniform vec3 attenuationColor; 2153 #ifdef USE_TRANSMISSIONMAP 2154 uniform sampler2D transmissionMap; 2155 #endif 2156 #ifdef USE_THICKNESSMAP 2157 uniform sampler2D thicknessMap; 2158 #endif 2159 uniform vec2 transmissionSamplerSize; 2160 uniform sampler2D transmissionSamplerMap; 2161 uniform mat4 modelMatrix; 2162 uniform mat4 projectionMatrix; 2163 varying vec3 vWorldPosition; 2164 float w0( float a ) { 2165 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2166 } 2167 float w1( float a ) { 2168 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2169 } 2170 float w2( float a ){ 2171 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2172 } 2173 float w3( float a ) { 2174 return ( 1.0 / 6.0 ) * ( a * a * a ); 2175 } 2176 float g0( float a ) { 2177 return w0( a ) + w1( a ); 2178 } 2179 float g1( float a ) { 2180 return w2( a ) + w3( a ); 2181 } 2182 float h0( float a ) { 2183 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2184 } 2185 float h1( float a ) { 2186 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2187 } 2188 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2189 uv = uv * texelSize.zw + 0.5; 2190 vec2 iuv = floor( uv ); 2191 vec2 fuv = fract( uv ); 2192 float g0x = g0( fuv.x ); 2193 float g1x = g1( fuv.x ); 2194 float h0x = h0( fuv.x ); 2195 float h1x = h1( fuv.x ); 2196 float h0y = h0( fuv.y ); 2197 float h1y = h1( fuv.y ); 2198 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2199 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2200 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2201 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2202 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2203 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2204 } 2205 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2206 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2207 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2208 vec2 fLodSizeInv = 1.0 / fLodSize; 2209 vec2 cLodSizeInv = 1.0 / cLodSize; 2210 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2211 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2212 return mix( fSample, cSample, fract( lod ) ); 2213 } 2214 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2215 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2216 vec3 modelScale; 2217 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2218 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2219 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2220 return normalize( refractionVector ) * thickness * modelScale; 2221 } 2222 float applyIorToRoughness( const in float roughness, const in float ior ) { 2223 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2224 } 2225 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2226 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2227 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2228 } 2229 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2230 if ( isinf( attenuationDistance ) ) { 2231 return vec3( 1.0 ); 2232 } else { 2233 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2234 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2235 } 2236 } 2237 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2238 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2239 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2240 const in vec3 attenuationColor, const in float attenuationDistance ) { 2241 vec4 transmittedLight; 2242 vec3 transmittance; 2243 #ifdef USE_DISPERSION 2244 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2245 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2246 for ( int i = 0; i < 3; i ++ ) { 2247 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2248 vec3 refractedRayExit = position + transmissionRay; 2249 2250 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2251 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2252 refractionCoords += 1.0; 2253 refractionCoords /= 2.0; 2254 2255 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2256 transmittedLight[ i ] = transmissionSample[ i ]; 2257 transmittedLight.a += transmissionSample.a; 2258 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2259 } 2260 transmittedLight.a /= 3.0; 2261 2262 #else 2263 2264 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2265 vec3 refractedRayExit = position + transmissionRay; 2266 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2267 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2268 refractionCoords += 1.0; 2269 refractionCoords /= 2.0; 2270 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2271 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2272 2273 #endif 2274 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2275 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2276 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2277 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2278 } 2279#endif`,Ah=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2280 varying vec2 vUv; 2281#endif 2282#ifdef USE_MAP 2283 varying vec2 vMapUv; 2284#endif 2285#ifdef USE_ALPHAMAP
2286 varying vec2 vAlphaMapUv; 2287#endif 2288#ifdef USE_LIGHTMAP 2289 varying vec2 vLightMapUv; 2290#endif 2291#ifdef USE_AOMAP 2292 varying vec2 vAoMapUv; 2293#endif 2294#ifdef USE_BUMPMAP 2295 varying vec2 vBumpMapUv; 2296#endif 2297#ifdef USE_NORMALMAP 2298 varying vec2 vNormalMapUv; 2299#endif 2300#ifdef USE_EMISSIVEMAP 2301 varying vec2 vEmissiveMapUv; 2302#endif 2303#ifdef USE_METALNESSMAP 2304 varying vec2 vMetalnessMapUv; 2305#endif 2306#ifdef USE_ROUGHNESSMAP 2307 varying vec2 vRoughnessMapUv; 2308#endif 2309#ifdef USE_ANISOTROPYMAP 2310 varying vec2 vAnisotropyMapUv; 2311#endif 2312#ifdef USE_CLEARCOATMAP 2313 varying vec2 vClearcoatMapUv; 2314#endif 2315#ifdef USE_CLEARCOAT_NORMALMAP 2316 varying vec2 vClearcoatNormalMapUv; 2317#endif 2318#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2319 varying vec2 vClearcoatRoughnessMapUv; 2320#endif 2321#ifdef USE_IRIDESCENCEMAP 2322 varying vec2 vIridescenceMapUv; 2323#endif 2324#ifdef USE_IRIDESCENCE_THICKNESSMAP 2325 varying vec2 vIridescenceThicknessMapUv; 2326#endif 2327#ifdef USE_SHEEN_COLORMAP 2328 varying vec2 vSheenColorMapUv; 2329#endif 2330#ifdef USE_SHEEN_ROUGHNESSMAP 2331 varying vec2 vSheenRoughnessMapUv; 2332#endif 2333#ifdef USE_SPECULARMAP 2334 varying vec2 vSpecularMapUv; 2335#endif 2336#ifdef USE_SPECULAR_COLORMAP 2337 varying vec2 vSpecularColorMapUv; 2338#endif 2339#ifdef USE_SPECULAR_INTENSITYMAP 2340 varying vec2 vSpecularIntensityMapUv; 2341#endif 2342#ifdef USE_TRANSMISSIONMAP 2343 uniform mat3 transmissionMapTransform; 2344 varying vec2 vTransmissionMapUv; 2345#endif 2346#ifdef USE_THICKNESSMAP 2347 uniform mat3 thicknessMapTransform; 2348 varying vec2 vThicknessMapUv; 2349#endif`,wh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2350 varying vec2 vUv; 2351#endif 2352#ifdef USE_MAP 2353 uniform mat3 mapTransform; 2354 varying vec2 vMapUv; 2355#endif 2356#ifdef USE_ALPHAMAP 2357 uniform mat3 alphaMapTransform; 2358 varying vec2 vAlphaMapUv; 2359#endif 2360#ifdef USE_LIGHTMAP 2361 uniform mat3 lightMapTransform; 2362 varying vec2 vLightMapUv; 2363#endif 2364#ifdef USE_AOMAP 2365 uniform mat3 aoMapTransform; 2366 varying vec2 vAoMapUv; 2367#endif 2368#ifdef USE_BUMPMAP 2369 uniform mat3 bumpMapTransform; 2370 varying vec2 vBumpMapUv; 2371#endif 2372#ifdef USE_NORMALMAP 2373 uniform mat3 normalMapTransform; 2374 varying vec2 vNormalMapUv; 2375#endif 2376#ifdef USE_DISPLACEMENTMAP 2377 uniform mat3 displacementMapTransform; 2378 varying vec2 vDisplacementMapUv; 2379#endif 2380#ifdef USE_EMISSIVEMAP 2381 uniform mat3 emissiveMapTransform; 2382 varying vec2 vEmissiveMapUv; 2383#endif 2384#ifdef USE_METALNESSMAP 2385 uniform mat3 metalnessMapTransform; 2386 varying vec2 vMetalnessMapUv; 2387#endif 2388#ifdef USE_ROUGHNESSMAP 2389 uniform mat3 roughnessMapTransform; 2390 varying vec2 vRoughnessMapUv; 2391#endif 2392#ifdef USE_ANISOTROPYMAP 2393 uniform mat3 anisotropyMapTransform; 2394 varying vec2 vAnisotropyMapUv; 2395#endif 2396#ifdef USE_CLEARCOATMAP 2397 uniform mat3 clearcoatMapTransform; 2398 varying vec2 vClearcoatMapUv; 2399#endif 2400#ifdef USE_CLEARCOAT_NORMALMAP 2401 uniform mat3 clearcoatNormalMapTransform; 2402 varying vec2 vClearcoatNormalMapUv; 2403#endif 2404#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2405 uniform mat3 clearcoatRoughnessMapTransform; 2406 varying vec2 vClearcoatRoughnessMapUv; 2407#endif 2408#ifdef USE_SHEEN_COLORMAP 2409 uniform mat3 sheenColorMapTransform; 2410 varying vec2 vSheenColorMapUv; 2411#endif 2412#ifdef USE_SHEEN_ROUGHNESSMAP 2413 uniform mat3 sheenRoughnessMapTransform; 2414 varying vec2 vSheenRoughnessMapUv; 2415#endif 2416#ifdef USE_IRIDESCENCEMAP 2417 uniform mat3 iridescenceMapTransform; 2418 varying vec2 vIridescenceMapUv; 2419#endif 2420#ifdef USE_IRIDESCENCE_THICKNESSMAP 2421 uniform mat3 iridescenceThicknessMapTransform; 2422 varying vec2 vIridescenceThicknessMapUv; 2423#endif 2424#ifdef USE_SPECULARMAP 2425 uniform mat3 specularMapTransform; 2426 varying vec2 vSpecularMapUv; 2427#endif 2428#ifdef USE_SPECULAR_COLORMAP 2429 uniform mat3 specularColorMapTransform; 2430 varying vec2 vSpecularColorMapUv; 2431#endif 2432#ifdef USE_SPECULAR_INTENSITYMAP 2433 uniform mat3 specularIntensityMapTransform; 2434 varying vec2 vSpecularIntensityMapUv; 2435#endif 2436#ifdef USE_TRANSMISSIONMAP 2437 uniform mat3 transmissionMapTransform; 2438 varying vec2 vTransmissionMapUv; 2439#endif 2440#ifdef USE_THICKNESSMAP 2441 uniform mat3 thicknessMapTransform; 2442 varying vec2 vThicknessMapUv; 2443#endif`,Rh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2444 vUv = vec3( uv, 1 ).xy; 2445#endif 2446#ifdef USE_MAP 2447 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2448#endif 2449#ifdef USE_ALPHAMAP 2450 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2451#endif 2452#ifdef USE_LIGHTMAP 2453 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2454#endif 2455#ifdef USE_AOMAP 2456 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2457#endif 2458#ifdef USE_BUMPMAP 2459 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2460#endif 2461#ifdef USE_NORMALMAP 2462 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2463#endif 2464#ifdef USE_DISPLACEMENTMAP 2465 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2466#endif 2467#ifdef USE_EMISSIVEMAP 2468 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2469#endif 2470#ifdef USE_METALNESSMAP 2471 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2472#endif 2473#ifdef USE_ROUGHNESSMAP 2474 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2475#endif 2476#ifdef USE_ANISOTROPYMAP 2477 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2478#endif 2479#ifdef USE_CLEARCOATMAP 2480 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2481#endif 2482#ifdef USE_CLEARCOAT_NORMALMAP 2483 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2484#endif 2485#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2486 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2487#endif
2488#ifdef USE_IRIDESCENCEMAP 2489 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_IRIDESCENCE_THICKNESSMAP 2492 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_SHEEN_COLORMAP 2495 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_SHEEN_ROUGHNESSMAP 2498 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2499#endif 2500#ifdef USE_SPECULARMAP 2501 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_SPECULAR_COLORMAP 2504 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_SPECULAR_INTENSITYMAP 2507 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_TRANSMISSIONMAP 2510 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_THICKNESSMAP 2513 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2514#endif`,Ch=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2515 vec4 worldPosition = vec4( transformed, 1.0 ); 2516 #ifdef USE_BATCHING 2517 worldPosition = batchingMatrix * worldPosition; 2518 #endif 2519 #ifdef USE_INSTANCING 2520 worldPosition = instanceMatrix * worldPosition; 2521 #endif 2522 worldPosition = modelMatrix * worldPosition; 2523#endif`;const Ph=`varying vec2 vUv; 2524uniform mat3 uvTransform; 2525void main() { 2526 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2527 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2528}`,Dh=`uniform sampler2D t2D; 2529uniform float backgroundIntensity; 2530varying vec2 vUv; 2531void main() { 2532 vec4 texColor = texture2D( t2D, vUv ); 2533 #ifdef DECODE_VIDEO_TEXTURE 2534 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2535 #endif 2536 texColor.rgb *= backgroundIntensity; 2537 gl_FragColor = texColor; 2538 #include <tonemapping_fragment> 2539 #include <colorspace_fragment> 2540}`,Lh=`varying vec3 vWorldDirection; 2541#include <common> 2542void main() { 2543 vWorldDirection = transformDirection( position, modelMatrix ); 2544 #include <begin_vertex> 2545 #include <project_vertex> 2546 gl_Position.z = gl_Position.w; 2547}`,Uh=`#ifdef ENVMAP_TYPE_CUBE 2548 uniform samplerCube envMap; 2549#elif defined( ENVMAP_TYPE_CUBE_UV ) 2550 uniform sampler2D envMap; 2551#endif 2552uniform float flipEnvMap; 2553uniform float backgroundBlurriness; 2554uniform float backgroundIntensity; 2555uniform mat3 backgroundRotation; 2556varying vec3 vWorldDirection; 2557#include <cube_uv_reflection_fragment> 2558void main() { 2559 #ifdef ENVMAP_TYPE_CUBE 2560 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2561 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2562 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2563 #else 2564 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2565 #endif 2566 texColor.rgb *= backgroundIntensity; 2567 gl_FragColor = texColor; 2568 #include <tonemapping_fragment> 2569 #include <colorspace_fragment> 2570}`,Ih=`varying vec3 vWorldDirection; 2571#include <common> 2572void main() { 2573 vWorldDirection = transformDirection( position, modelMatrix ); 2574 #include <begin_vertex> 2575 #include <project_vertex> 2576 gl_Position.z = gl_Position.w; 2577}`,Nh=`uniform samplerCube tCube; 2578uniform float tFlip; 2579uniform float opacity; 2580varying vec3 vWorldDirection; 2581void main() { 2582 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2583 gl_FragColor = texColor; 2584 gl_FragColor.a *= opacity; 2585 #include <tonemapping_fragment> 2586 #include <colorspace_fragment> 2587}`,Fh=`#include <common> 2588#include <batching_pars_vertex> 2589#include <uv_pars_vertex> 2590#include <displacementmap_pars_vertex> 2591#include <morphtarget_pars_vertex> 2592#include <skinning_pars_vertex> 2593#include <logdepthbuf_pars_vertex> 2594#include <clipping_planes_pars_vertex> 2595varying vec2 vHighPrecisionZW; 2596void main() { 2597 #include <uv_vertex> 2598 #include <batching_vertex> 2599 #include <skinbase_vertex> 2600 #include <morphinstance_vertex> 2601 #ifdef USE_DISPLACEMENTMAP 2602 #include <beginnormal_vertex> 2603 #include <morphnormal_vertex> 2604 #include <skinnormal_vertex> 2605 #endif 2606 #include <begin_vertex> 2607 #include <morphtarget_vertex> 2608 #include <skinning_vertex> 2609 #include <displacementmap_vertex> 2610 #include <project_vertex> 2611 #include <logdepthbuf_vertex> 2612 #include <clipping_planes_vertex> 2613 vHighPrecisionZW = gl_Position.zw; 2614}`,Oh=`#if DEPTH_PACKING == 3200 2615 uniform float opacity; 2616#endif 2617#include <common> 2618#include <packing> 2619#include <uv_pars_fragment> 2620#include <map_pars_fragment> 2621#include <alphamap_pars_fragment> 2622#include <alphatest_pars_fragment> 2623#include <alphahash_pars_fragment> 2624#include <logdepthbuf_pars_fragment> 2625#include <clipping_planes_pars_fragment> 2626varying vec2 vHighPrecisionZW; 2627void main() { 2628 vec4 diffuseColor = vec4( 1.0 ); 2629 #include <clipping_planes_fragment> 2630 #if DEPTH_PACKING == 3200 2631 diffuseColor.a = opacity; 2632 #endif 2633 #include <map_fragment> 2634 #include <alphamap_fragment> 2635 #include <alphatest_fragment> 2636 #include <alphahash_fragment> 2637 #include <logdepthbuf_fragment> 2638 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2639 #if DEPTH_PACKING == 3200 2640 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2641 #elif DEPTH_PACKING == 3201 2642 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2643 #elif DEPTH_PACKING == 3202 2644 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2645 #elif DEPTH_PACKING == 3203 2646 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2647 #endif 2648}`,Bh=`#define DISTANCE 2649varying vec3 vWorldPosition; 2650#include <common> 2651#include <batching_pars_vertex> 2652#include <uv_pars_vertex> 2653#include <displacementmap_pars_vertex> 2654#include <morphtarget_pars_vertex> 2655#include <skinning_pars_vertex> 2656#include <clipping_planes_pars_vertex> 2657void main() { 2658 #include <uv_vertex> 2659 #include <batching_vertex> 2660 #include <skinbase_vertex> 2661 #include <morphinstance_vertex> 2662 #ifdef USE_DISPLACEMENTMAP 2663 #include <beginnormal_vertex> 2664 #include <morphnormal_vertex> 2665 #include <skinnormal_vertex> 2666 #endif 2667 #include <begin_vertex> 2668 #include <morphtarget_vertex> 2669 #include <skinning_vertex> 2670 #include <displacementmap_vertex> 2671 #include <project_vertex> 2672 #include <worldpos_vertex> 2673 #include <clipping_planes_vertex> 2674 vWorldPosition = worldPosition.xyz; 2675}`,zh=`#define DISTANCE 2676uniform vec3 referencePosition; 2677uniform float nearDistance; 2678uniform float farDistance; 2679varying vec3 vWorldPosition; 2680#include <common> 2681#include <packing> 2682#include <uv_pars_fragment> 2683#include <map_pars_fragment> 2684#include <alphamap_pars_fragment> 2685#include <alphatest_pars_fragment> 2686#include <alphahash_pars_fragment> 2687#include <clipping_planes_pars_fragment> 2688void main () { 2689 vec4 diffuseColor = vec4( 1.0 ); 2690 #include <clipping_planes_fragment> 2691 #include <map_fragment> 2692 #include <alphamap_fragment> 2693 #include <alphatest_fragment> 2694 #include <alphahash_fragment> 2695 float dist = length( vWorldPosition - referencePosition ); 2696 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2697 dist = saturate( dist ); 2698 gl_FragColor = packDepthToRGBA( dist ); 2699}`,Hh=`varying vec3 vWorldDirection; 2700#include <common> 2701void main() { 2702 vWorldDirection = transformDirection( position, modelMatrix ); 2703 #include <begin_vertex> 2704 #include <project_vertex> 2705}`,Vh=`uniform sampler2D tEquirect; 2706varying vec3 vWorldDirection; 2707#include <common> 2708void main() { 2709 vec3 direction = normalize( vWorldDirection ); 2710 vec2 sampleUV = equirectUv( direction ); 2711 gl_FragColor = texture2D( tEquirect, sampleUV ); 2712 #include <tonemapping_fragment> 2713 #include <colorspace_fragment> 2714}`,Gh=`uniform float scale; 2715attribute float lineDistance; 2716varying float vLineDistance; 2717#include <common> 2718#include <uv_pars_vertex> 2719#include <color_pars_vertex> 2720#include <fog_pars_vertex> 2721#include <morphtarget_pars_vertex> 2722#include <logdepthbuf_pars_vertex> 2723#include <clipping_planes_pars_vertex> 2724void main() { 2725 vLineDistance = scale * lineDistance; 2726 #include <uv_vertex> 2727 #include <color_vertex> 2728 #include <morphinstance_vertex> 2729 #include <morphcolor_vertex> 2730 #include <begin_vertex> 2731 #include <morphtarget_vertex> 2732 #include <project_vertex> 2733 #include <logdepthbuf_vertex> 2734 #include <clipping_planes_vertex> 2735 #include <fog_vertex> 2736}`,kh=`uniform vec3 diffuse; 2737uniform float opacity; 2738uniform float dashSize; 2739uniform float totalSize; 2740varying float vLineDistance; 2741#include <common> 2742#include <color_pars_fragment> 2743#include <uv_pars_fragment> 2744#include <map_pars_fragment> 2745#include <fog_pars_fragment> 2746#include <logdepthbuf_pars_fragment> 2747#include <clipping_planes_pars_fragment> 2748void main() { 2749 vec4 diffuseColor = vec4( diffuse, opacity ); 2750 #include <clipping_planes_fragment> 2751 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2752 discard; 2753 } 2754 vec3 outgoingLight = vec3( 0.0 ); 2755 #include <logdepthbuf_fragment> 2756 #include <map_fragment> 2757 #include <color_fragment> 2758 outgoingLight = diffuseColor.rgb; 2759 #include <opaque_fragment> 2760 #include <tonemapping_fragment> 2761 #include <colorspace_fragment> 2762 #include <fog_fragment> 2763 #include <premultiplied_alpha_fragment> 2764}`,Wh=`#include <common> 2765#include <batching_pars_vertex> 2766#include <uv_pars_vertex> 2767#include <envmap_pars_vertex> 2768#include <color_pars_vertex> 2769#include <fog_pars_vertex> 2770#include <morphtarget_pars_vertex> 2771#include <skinning_pars_vertex> 2772#include <logdepthbuf_pars_vertex> 2773#include <clipping_planes_pars_vertex> 2774void main() { 2775 #include <uv_vertex> 2776 #include <color_vertex> 2777 #include <morphinstance_vertex> 2778 #include <morphcolor_vertex> 2779 #include <batching_vertex> 2780 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2781 #include <beginnormal_vertex> 2782 #include <morphnormal_vertex> 2783 #include <skinbase_vertex> 2784 #include <skinnormal_vertex> 2785 #include <defaultnormal_vertex> 2786 #endif 2787 #include <begin_vertex> 2788 #include <morphtarget_vertex> 2789 #include <skinning_vertex> 2790 #include <project_vertex> 2791 #include <logdepthbuf_vertex> 2792 #include <clipping_planes_vertex> 2793 #include <worldpos_vertex> 2794 #include <envmap_vertex> 2795 #include <fog_vertex> 2796}`,Xh=`uniform vec3 diffuse; 2797uniform float opacity; 2798#ifndef FLAT_SHADED 2799 varying vec3 vNormal; 2800#endif 2801#include <common> 2802#include <dithering_pars_fragment> 2803#include <color_pars_fragment> 2804#include <uv_pars_fragment> 2805#include <map_pars_fragment> 2806#include <alphamap_pars_fragment> 2807#include <alphatest_pars_fragment> 2808#include <alphahash_pars_fragment> 2809#include <aomap_pars_fragment> 2810#include <lightmap_pars_fragment> 2811#include <envmap_common_pars_fragment> 2812#include <envmap_pars_fragment> 2813#include <fog_pars_fragment> 2814#include <specularmap_pars_fragment> 2815#include <logdepthbuf_pars_fragment> 2816#include <clipping_planes_pars_fragment> 2817void main() { 2818 vec4 diffuseColor = vec4( diffuse, opacity ); 2819 #include <clipping_planes_fragment> 2820 #include <logdepthbuf_fragment> 2821 #include <map_fragment> 2822 #include <color_fragment> 2823 #include <alphamap_fragment> 2824 #include <alphatest_fragment> 2825 #include <alphahash_fragment> 2826 #include <specularmap_fragment> 2827 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2828 #ifdef USE_LIGHTMAP 2829 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2830 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2831 #else 2832 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2833 #endif 2834 #include <aomap_fragment> 2835 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2836 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2837 #include <envmap_fragment> 2838 #include <opaque_fragment> 2839 #include <tonemapping_fragment> 2840 #include <colorspace_fragment> 2841 #include <fog_fragment> 2842 #include <premultiplied_alpha_fragment> 2843 #include <dithering_fragment> 2844}`,qh=`#define LAMBERT 2845varying vec3 vViewPosition; 2846#include <common> 2847#include <batching_pars_vertex> 2848#include <uv_pars_vertex> 2849#include <displacementmap_pars_vertex> 2850#include <envmap_pars_vertex> 2851#include <color_pars_vertex> 2852#include <fog_pars_vertex> 2853#include <normal_pars_vertex> 2854#include <morphtarget_pars_vertex> 2855#include <skinning_pars_vertex> 2856#include <shadowmap_pars_vertex> 2857#include <logdepthbuf_pars_vertex> 2858#include <clipping_planes_pars_vertex> 2859void main() { 2860 #include <uv_vertex> 2861 #include <color_vertex> 2862 #include <morphinstance_vertex> 2863 #include <morphcolor_vertex> 2864 #include <batching_vertex> 2865 #include <beginnormal_vertex> 2866 #include <morphnormal_vertex> 2867 #include <skinbase_vertex> 2868 #include <skinnormal_vertex> 2869 #include <defaultnormal_vertex> 2870 #include <normal_vertex> 2871 #include <begin_vertex> 2872 #include <morphtarget_vertex> 2873 #include <skinning_vertex> 2874 #include <displacementmap_vertex> 2875 #include <project_vertex> 2876 #include <logdepthbuf_vertex> 2877 #include <clipping_planes_vertex> 2878 vViewPosition = - mvPosition.xyz; 2879 #include <worldpos_vertex> 2880 #include <envmap_vertex> 2881 #include <shadowmap_vertex> 2882 #include <fog_vertex> 2883}`,Yh=`#define LAMBERT 2884uniform vec3 diffuse; 2885uniform vec3 emissive; 2886uniform float opacity; 2887#include <common> 2888#include <packing> 2889#include <dithering_pars_fragment> 2890#include <color_pars_fragment> 2891#include <uv_pars_fragment> 2892#include <map_pars_fragment> 2893#include <alphamap_pars_fragment> 2894#include <alphatest_pars_fragment> 2895#include <alphahash_pars_fragment> 2896#include <aomap_pars_fragment> 2897#include <lightmap_pars_fragment> 2898#include <emissivemap_pars_fragment> 2899#include <envmap_common_pars_fragment> 2900#include <envmap_pars_fragment> 2901#include <fog_pars_fragment> 2902#include <bsdfs> 2903#include <lights_pars_begin> 2904#include <normal_pars_fragment> 2905#include <lights_lambert_pars_fragment> 2906#include <shadowmap_pars_fragment> 2907#include <bumpmap_pars_fragment> 2908#include <normalmap_pars_fragment> 2909#include <specularmap_pars_fragment> 2910#include <logdepthbuf_pars_fragment> 2911#include <clipping_planes_pars_fragment> 2912void main() { 2913 vec4 diffuseColor = vec4( diffuse, opacity ); 2914 #include <clipping_planes_fragment> 2915 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2916 vec3 totalEmissiveRadiance = emissive; 2917 #include <logdepthbuf_fragment> 2918 #include <map_fragment> 2919 #include <color_fragment> 2920 #include <alphamap_fragment> 2921 #include <alphatest_fragment> 2922 #include <alphahash_fragment> 2923 #include <specularmap_fragment> 2924 #include <normal_fragment_begin> 2925 #include <normal_fragment_maps> 2926 #include <emissivemap_fragment> 2927 #include <lights_lambert_fragment> 2928 #include <lights_fragment_begin> 2929 #include <lights_fragment_maps> 2930 #include <lights_fragment_end> 2931 #include <aomap_fragment> 2932 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2933 #include <envmap_fragment> 2934 #include <opaque_fragment> 2935 #include <tonemapping_fragment> 2936 #include <colorspace_fragment> 2937 #include <fog_fragment> 2938 #include <premultiplied_alpha_fragment> 2939 #include <dithering_fragment> 2940}`,Kh=`#define MATCAP 2941varying vec3 vViewPosition; 2942#include <common> 2943#include <batching_pars_vertex> 2944#include <uv_pars_vertex> 2945#include <color_pars_vertex> 2946#include <displacementmap_pars_vertex> 2947#include <fog_pars_vertex> 2948#include <normal_pars_vertex> 2949#include <morphtarget_pars_vertex> 2950#include <skinning_pars_vertex> 2951#include <logdepthbuf_pars_vertex> 2952#include <clipping_planes_pars_vertex> 2953void main() { 2954 #include <uv_vertex> 2955 #include <color_vertex> 2956 #include <morphinstance_vertex> 2957 #include <morphcolor_vertex> 2958 #include <batching_vertex> 2959 #include <beginnormal_vertex> 2960 #include <morphnormal_vertex> 2961 #include <skinbase_vertex> 2962 #include <skinnormal_vertex> 2963 #include <defaultnormal_vertex> 2964 #include <normal_vertex> 2965 #include <begin_vertex> 2966 #include <morphtarget_vertex> 2967 #include <skinning_vertex> 2968 #include <displacementmap_vertex> 2969 #include <project_vertex> 2970 #include <logdepthbuf_vertex> 2971 #include <clipping_planes_vertex> 2972 #include <fog_vertex> 2973 vViewPosition = - mvPosition.xyz; 2974}`,Zh=`#define MATCAP 2975uniform vec3 diffuse; 2976uniform float opacity; 2977uniform sampler2D matcap; 2978varying vec3 vViewPosition; 2979#include <common> 2980#include <dithering_pars_fragment> 2981#include <color_pars_fragment> 2982#include <uv_pars_fragment> 2983#include <map_pars_fragment> 2984#include <alphamap_pars_fragment> 2985#include <alphatest_pars_fragment> 2986#include <alphahash_pars_fragment> 2987#include <fog_pars_fragment> 2988#include <normal_pars_fragment> 2989#include <bumpmap_pars_fragment> 2990#include <normalmap_pars_fragment> 2991#include <logdepthbuf_pars_fragment> 2992#include <clipping_planes_pars_fragment> 2993void main() { 2994 ve
2994c4 diffuseColor = vec4( diffuse, opacity ); 2995 #include <clipping_planes_fragment> 2996 #include <logdepthbuf_fragment> 2997 #include <map_fragment> 2998 #include <color_fragment> 2999 #include <alphamap_fragment> 3000 #include <alphatest_fragment> 3001 #include <alphahash_fragment> 3002 #include <normal_fragment_begin> 3003 #include <normal_fragment_maps> 3004 vec3 viewDir = normalize( vViewPosition ); 3005 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3006 vec3 y = cross( viewDir, x ); 3007 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3008 #ifdef USE_MATCAP 3009 vec4 matcapColor = texture2D( matcap, uv ); 3010 #else 3011 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3012 #endif 3013 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3014 #include <opaque_fragment> 3015 #include <tonemapping_fragment> 3016 #include <colorspace_fragment> 3017 #include <fog_fragment> 3018 #include <premultiplied_alpha_fragment> 3019 #include <dithering_fragment> 3020}`,$h=`#define NORMAL 3021#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3022 varying vec3 vViewPosition; 3023#endif 3024#include <common> 3025#include <batching_pars_vertex> 3026#include <uv_pars_vertex> 3027#include <displacementmap_pars_vertex> 3028#include <normal_pars_vertex> 3029#include <morphtarget_pars_vertex> 3030#include <skinning_pars_vertex> 3031#include <logdepthbuf_pars_vertex> 3032#include <clipping_planes_pars_vertex> 3033void main() { 3034 #include <uv_vertex> 3035 #include <batching_vertex> 3036 #include <beginnormal_vertex> 3037 #include <morphinstance_vertex> 3038 #include <morphnormal_vertex> 3039 #include <skinbase_vertex> 3040 #include <skinnormal_vertex> 3041 #include <defaultnormal_vertex> 3042 #include <normal_vertex> 3043 #include <begin_vertex> 3044 #include <morphtarget_vertex> 3045 #include <skinning_vertex> 3046 #include <displacementmap_vertex> 3047 #include <project_vertex> 3048 #include <logdepthbuf_vertex> 3049 #include <clipping_planes_vertex> 3050#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3051 vViewPosition = - mvPosition.xyz; 3052#endif 3053}`,jh=`#define NORMAL 3054uniform float opacity; 3055#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3056 varying vec3 vViewPosition; 3057#endif 3058#include <packing> 3059#include <uv_pars_fragment> 3060#include <normal_pars_fragment> 3061#include <bumpmap_pars_fragment> 3062#include <normalmap_pars_fragment> 3063#include <logdepthbuf_pars_fragment> 3064#include <clipping_planes_pars_fragment> 3065void main() { 3066 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3067 #include <clipping_planes_fragment> 3068 #include <logdepthbuf_fragment> 3069 #include <normal_fragment_begin> 3070 #include <normal_fragment_maps> 3071 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3072 #ifdef OPAQUE 3073 gl_FragColor.a = 1.0; 3074 #endif 3075}`,Jh=`#define PHONG 3076varying vec3 vViewPosition; 3077#include <common> 3078#include <batching_pars_vertex> 3079#include <uv_pars_vertex> 3080#include <displacementmap_pars_vertex> 3081#include <envmap_pars_vertex> 3082#include <color_pars_vertex> 3083#include <fog_pars_vertex> 3084#include <normal_pars_vertex> 3085#include <morphtarget_pars_vertex> 3086#include <skinning_pars_vertex> 3087#include <shadowmap_pars_vertex> 3088#include <logdepthbuf_pars_vertex> 3089#include <clipping_planes_pars_vertex> 3090void main() { 3091 #include <uv_vertex> 3092 #include <color_vertex> 3093 #include <morphcolor_vertex> 3094 #include <batching_vertex> 3095 #include <beginnormal_vertex> 3096 #include <morphinstance_vertex> 3097 #include <morphnormal_vertex> 3098 #include <skinbase_vertex> 3099 #include <skinnormal_vertex> 3100 #include <defaultnormal_vertex> 3101 #include <normal_vertex> 3102 #include <begin_vertex> 3103 #include <morphtarget_vertex> 3104 #include <skinning_vertex> 3105 #include <displacementmap_vertex> 3106 #include <project_vertex> 3107 #include <logdepthbuf_vertex> 3108 #include <clipping_planes_vertex> 3109 vViewPosition = - mvPosition.xyz; 3110 #include <worldpos_vertex> 3111 #include <envmap_vertex> 3112 #include <shadowmap_vertex> 3113 #include <fog_vertex> 3114}`,Qh=`#define PHONG 3115uniform vec3 diffuse; 3116uniform vec3 emissive; 3117uniform vec3 specular; 3118uniform float shininess; 3119uniform float opacity; 3120#include <common> 3121#include <packing> 3122#include <dithering_pars_fragment> 3123#include <color_pars_fragment> 3124#include <uv_pars_fragment> 3125#include <map_pars_fragment> 3126#include <alphamap_pars_fragment> 3127#include <alphatest_pars_fragment> 3128#include <alphahash_pars_fragment> 3129#include <aomap_pars_fragment> 3130#include <lightmap_pars_fragment> 3131#include <emissivemap_pars_fragment> 3132#include <envmap_common_pars_fragment> 3133#include <envmap_pars_fragment> 3134#include <fog_pars_fragment> 3135#include <bsdfs> 3136#include <lights_pars_begin> 3137#include <normal_pars_fragment> 3138#include <lights_phong_pars_fragment> 3139#include <shadowmap_pars_fragment> 3140#include <bumpmap_pars_fragment> 3141#include <normalmap_pars_fragment> 3142#include <specularmap_pars_fragment> 3143#include <logdepthbuf_pars_fragment> 3144#include <clipping_planes_pars_fragment> 3145void main() { 3146 vec4 diffuseColor = vec4( diffuse, opacity ); 3147 #include <clipping_planes_fragment> 3148 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3149 vec3 totalEmissiveRadiance = emissive; 3150 #include <logdepthbuf_fragment> 3151 #include <map_fragment> 3152 #include <color_fragment> 3153 #include <alphamap_fragment> 3154 #include <alphatest_fragment> 3155 #include <alphahash_fragment> 3156 #include <specularmap_fragment> 3157 #include <normal_fragment_begin> 3158 #include <normal_fragment_maps> 3159 #include <emissivemap_fragment> 3160 #include <lights_phong_fragment> 3161 #include <lights_fragment_begin> 3162 #include <lights_fragment_maps> 3163 #include <lights_fragment_end> 3164 #include <aomap_fragment> 3165 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3166 #include <envmap_fragment> 3167 #include <opaque_fragment> 3168 #include <tonemapping_fragment> 3169 #include <colorspace_fragment> 3170 #include <fog_fragment> 3171 #include <premultiplied_alpha_fragment> 3172 #include <dithering_fragment> 3173}`,ef=`#define STANDARD 3174varying vec3 vViewPosition; 3175#ifdef USE_TRANSMISSION 3176 varying vec3 vWorldPosition; 3177#endif 3178#include <common> 3179#include <batching_pars_vertex> 3180#include <uv_pars_vertex> 3181#include <displacementmap_pars_vertex> 3182#include <color_pars_vertex> 3183#include <fog_pars_vertex> 3184#include <normal_pars_vertex> 3185#include <morphtarget_pars_vertex> 3186#include <skinning_pars_vertex> 3187#include <shadowmap_pars_vertex> 3188#include <logdepthbuf_pars_vertex> 3189#include <clipping_planes_pars_vertex> 3190void main() { 3191 #include <uv_vertex> 3192 #include <color_vertex> 3193 #include <morphinstance_vertex> 3194 #include <morphcolor_vertex> 3195 #include <batching_vertex> 3196 #include <beginnormal_vertex> 3197 #include <morphnormal_vertex> 3198 #include <skinbase_vertex> 3199 #include <skinnormal_vertex> 3200 #include <defaultnormal_vertex> 3201 #include <normal_vertex> 3202 #include <begin_vertex> 3203 #include <morphtarget_vertex> 3204 #include <skinning_vertex> 3205 #include <displacementmap_vertex> 3206 #include <project_vertex> 3207 #include <logdepthbuf_vertex> 3208 #include <clipping_planes_vertex> 3209 vViewPosition = - mvPosition.xyz; 3210 #include <worldpos_vertex> 3211 #include <shadowmap_vertex> 3212 #include <fog_vertex> 3213#ifdef USE_TRANSMISSION 3214 vWorldPosition = worldPosition.xyz; 3215#endif 3216}`,tf=`#define STANDARD 3217#ifdef PHYSICAL 3218 #define IOR 3219 #define USE_SPECULAR 3220#endif 3221uniform vec3 diffuse; 3222uniform vec3 emissive; 3223uniform float roughness; 3224uniform float metalness; 3225uniform float opacity; 3226#ifdef IOR 3227 uniform float ior; 3228#endif 3229#ifdef USE_SPECULAR 3230 uniform float specularIntensity; 3231 uniform vec3 specularColor; 3232 #ifdef USE_SPECULAR_COLORMAP 3233 uniform sampler2D specularColorMap; 3234 #endif 3235 #ifdef USE_SPECULAR_INTENSITYMAP 3236 uniform sampler2D specularIntensityMap; 3237 #endif 3238#endif 3239#ifdef USE_CLEARCOAT 3240 uniform float clearcoat; 3241 uniform float clearcoatRoughness; 3242#endif 3243#ifdef USE_DISPERSION 3244 uniform float dispersion; 3245#endif
3246#ifdef USE_IRIDESCENCE 3247 uniform float iridescence; 3248 uniform float iridescenceIOR; 3249 uniform float iridescenceThicknessMinimum; 3250 uniform float iridescenceThicknessMaximum; 3251#endif 3252#ifdef USE_SHEEN 3253 uniform vec3 sheenColor; 3254 uniform float sheenRoughness; 3255 #ifdef USE_SHEEN_COLORMAP 3256 uniform sampler2D sheenColorMap; 3257 #endif 3258 #ifdef USE_SHEEN_ROUGHNESSMAP 3259 uniform sampler2D sheenRoughnessMap; 3260 #endif 3261#endif 3262#ifdef USE_ANISOTROPY 3263 uniform vec2 anisotropyVector; 3264 #ifdef USE_ANISOTROPYMAP 3265 uniform sampler2D anisotropyMap; 3266 #endif 3267#endif 3268varying vec3 vViewPosition; 3269#include <common> 3270#include <packing> 3271#include <dithering_pars_fragment> 3272#include <color_pars_fragment> 3273#include <uv_pars_fragment> 3274#include <map_pars_fragment> 3275#include <alphamap_pars_fragment> 3276#include <alphatest_pars_fragment> 3277#include <alphahash_pars_fragment> 3278#include <aomap_pars_fragment> 3279#include <lightmap_pars_fragment> 3280#include <emissivemap_pars_fragment> 3281#include <iridescence_fragment> 3282#include <cube_uv_reflection_fragment> 3283#include <envmap_common_pars_fragment> 3284#include <envmap_physical_pars_fragment> 3285#include <fog_pars_fragment> 3286#include <lights_pars_begin> 3287#include <normal_pars_fragment> 3288#include <lights_physical_pars_fragment> 3289#include <transmission_pars_fragment> 3290#include <shadowmap_pars_fragment> 3291#include <bumpmap_pars_fragment> 3292#include <normalmap_pars_fragment> 3293#include <clearcoat_pars_fragment> 3294#include <iridescence_pars_fragment> 3295#include <roughnessmap_pars_fragment> 3296#include <metalnessmap_pars_fragment> 3297#include <logdepthbuf_pars_fragment> 3298#include <clipping_planes_pars_fragment> 3299void main() { 3300 vec4 diffuseColor = vec4( diffuse, opacity ); 3301 #include <clipping_planes_fragment> 3302 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3303 vec3 totalEmissiveRadiance = emissive; 3304 #include <logdepthbuf_fragment> 3305 #include <map_fragment> 3306 #include <color_fragment> 3307 #include <alphamap_fragment> 3308 #include <alphatest_fragment> 3309 #include <alphahash_fragment> 3310 #include <roughnessmap_fragment> 3311 #include <metalnessmap_fragment> 3312 #include <normal_fragment_begin> 3313 #include <normal_fragment_maps> 3314 #include <clearcoat_normal_fragment_begin> 3315 #include <clearcoat_normal_fragment_maps> 3316 #include <emissivemap_fragment> 3317 #include <lights_physical_fragment> 3318 #include <lights_fragment_begin> 3319 #include <lights_fragment_maps> 3320 #include <lights_fragment_end> 3321 #include <aomap_fragment> 3322 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3323 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3324 #include <transmission_fragment> 3325 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3326 #ifdef USE_SHEEN 3327 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3328 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3329 #endif 3330 #ifdef USE_CLEARCOAT 3331 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3332 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3333 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3334 #endif 3335 #include <opaque_fragment> 3336 #include <tonemapping_fragment> 3337 #include <colorspace_fragment> 3338 #include <fog_fragment> 3339 #include <premultiplied_alpha_fragment> 3340 #include <dithering_fragment> 3341}`,nf=`#define TOON 3342varying vec3 vViewPosition; 3343#include <common> 3344#include <batching_pars_vertex> 3345#include <uv_pars_vertex> 3346#include <displacementmap_pars_vertex> 3347#include <color_pars_vertex> 3348#include <fog_pars_vertex> 3349#include <normal_pars_vertex> 3350#include <morphtarget_pars_vertex> 3351#include <skinning_pars_vertex> 3352#include <shadowmap_pars_vertex> 3353#include <logdepthbuf_pars_vertex> 3354#include <clipping_planes_pars_vertex> 3355void main() { 3356 #include <uv_vertex> 3357 #include <color_vertex> 3358 #include <morphinstance_vertex> 3359 #include <morphcolor_vertex> 3360 #include <batching_vertex> 3361 #include <beginnormal_vertex> 3362 #include <morphnormal_vertex> 3363 #include <skinbase_vertex> 3364 #include <skinnormal_vertex> 3365 #include <defaultnormal_vertex> 3366 #include <normal_vertex> 3367 #include <begin_vertex> 3368 #include <morphtarget_vertex> 3369 #include <skinning_vertex> 3370 #include <displacementmap_vertex> 3371 #include <project_vertex> 3372 #include <logdepthbuf_vertex> 3373 #include <clipping_planes_vertex> 3374 vViewPosition = - mvPosition.xyz; 3375 #include <worldpos_vertex> 3376 #include <shadowmap_vertex> 3377 #include <fog_vertex> 3378}`,rf=`#define TOON 3379uniform vec3 diffuse; 3380uniform vec3 emissive; 3381uniform float opacity; 3382#include <common> 3383#include <packing> 3384#include <dithering_pars_fragment> 3385#include <color_pars_fragment> 3386#include <uv_pars_fragment> 3387#include <map_pars_fragment> 3388#include <alphamap_pars_fragment> 3389#include <alphatest_pars_fragment> 3390#include <alphahash_pars_fragment> 3391#include <aomap_pars_fragment> 3392#include <lightmap_pars_fragment> 3393#include <emissivemap_pars_fragment> 3394#include <gradientmap_pars_fragment> 3395#include <fog_pars_fragment> 3396#include <bsdfs> 3397#include <lights_pars_begin> 3398#include <normal_pars_fragment> 3399#include <lights_toon_pars_fragment> 3400#include <shadowmap_pars_fragment> 3401#include <bumpmap_pars_fragment> 3402#include <normalmap_pars_fragment> 3403#include <logdepthbuf_pars_fragment> 3404#include <clipping_planes_pars_fragment> 3405void main() { 3406 vec4 diffuseColor = vec4( diffuse, opacity ); 3407 #include <clipping_planes_fragment> 3408 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3409 vec3 totalEmissiveRadiance = emissive; 3410 #include <logdepthbuf_fragment> 3411 #include <map_fragment> 3412 #include <color_fragment> 3413 #include <alphamap_fragment> 3414 #include <alphatest_fragment> 3415 #include <alphahash_fragment> 3416 #include <normal_fragment_begin> 3417 #include <normal_fragment_maps> 3418 #include <emissivemap_fragment> 3419 #include <lights_toon_fragment> 3420 #include <lights_fragment_begin> 3421 #include <lights_fragment_maps> 3422 #include <lights_fragment_end> 3423 #include <aomap_fragment> 3424 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3425 #include <opaque_fragment> 3426 #include <tonemapping_fragment> 3427 #include <colorspace_fragment> 3428 #include <fog_fragment> 3429 #include <premultiplied_alpha_fragment> 3430 #include <dithering_fragment> 3431}`,sf=`uniform float size; 3432uniform float scale; 3433#include <common> 3434#include <color_pars_vertex> 3435#include <fog_pars_vertex> 3436#include <morphtarget_pars_vertex> 3437#include <logdepthbuf_pars_vertex> 3438#include <clipping_planes_pars_vertex> 3439#ifdef USE_POINTS_UV 3440 varying vec2 vUv; 3441 uniform mat3 uvTransform; 3442#endif 3443void main() { 3444 #ifdef USE_POINTS_UV 3445 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3446 #endif 3447 #include <color_vertex> 3448 #include <morphinstance_vertex> 3449 #include <morphcolor_vertex> 3450 #include <begin_vertex> 3451 #include <morphtarget_vertex> 3452 #include <project_vertex> 3453 gl_PointSize = size; 3454 #ifdef USE_SIZEATTENUATION 3455 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3456 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3457 #endif 3458 #include <logdepthbuf_vertex> 3459 #include <clipping_planes_vertex> 3460 #include <worldpos_vertex> 3461 #include <fog_vertex> 3462}`,af=`uniform vec3 diffuse; 3463uniform float opacity; 3464#include <common> 3465#include <color_pars_fragment> 3466#include <map_particle_pars_fragment> 3467#include <alphatest_pars_fragment> 3468#include <alphahash_pars_fragment> 3469#include <fog_pars_fragment> 3470#include <logdepthbuf_pars_fragment> 3471#include <clipping_planes_pars_fragment> 3472void main() { 3473 vec4 diffuseColor = vec4( diffuse, opacity ); 3474 #include <clipping_planes_fragment> 3475 vec3 outgoingLight = vec3( 0.0 ); 3476 #include <logdepthbuf_fragment> 3477 #include <map_particle_fragment> 3478 #include <color_fragment> 3479 #include <alphatest_fragment> 3480 #include <alphahash_fragment> 3481 outgoingLight = diffuseColor.rgb; 3482 #include <opaque_fragment> 3483 #include <tonemapping_fragment> 3484 #include <colorspace_fragment> 3485 #include <fog_fragment> 3486 #include <premultiplied_alpha_fragment> 3487}`,of=`#include <common> 3488#include <batching_pars_vertex> 3489#include <fog_pars_vertex> 3490#include <morphtarget_pars_vertex> 3491#include <skinning_pars_vertex> 3492#include <logdepthbuf_pars_vertex> 3493#include <shadowmap_pars_vertex> 3494void main() { 3495 #include <batching_vertex> 3496 #include <beginnormal_vertex> 3497 #include <morphinstance_vertex> 3498 #include <morphnormal_vertex> 3499 #include <skinbase_vertex> 3500 #include <skinnormal_vertex> 3501 #include <defaultnormal_vertex> 3502 #include <begin_vertex> 3503 #include <morphtarget_vertex> 3504 #include <skinning_vertex> 3505 #include <project_vertex> 3506 #include <logdepthbuf_vertex> 3507 #include <worldpos_vertex> 3508 #include <shadowmap_vertex> 3509 #include <fog_vertex> 3510}`,lf=`uniform vec3 color; 3511uniform float opacity; 3512#include <common> 3513#include <packing> 3514#include <fog_pars_fragment> 3515#include <bsdfs> 3516#include <lights_pars_begin> 3517#include <logdepthbuf_pars_fragment> 3518#include <shadowmap_pars_fragment> 3519#include <shadowmask_pars_fragment> 3520void main() { 3521 #include <logdepthbuf_fragment> 3522 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3523 #include <tonemapping_fragment> 3524 #include <colorspace_fragment> 3525 #include <fog_fragment> 3526}`,cf=`uniform float rotation; 3527uniform vec2 center; 3528#include <common> 3529#include <uv_pars_vertex> 3530#include <fog_pars_vertex> 3531#include <logdepthbuf_pars_vertex> 3532#include <clipping_planes_pars_vertex> 3533void main() { 3534 #include <uv_vertex> 3535 vec4 mvPosition = modelViewMatrix[ 3 ]; 3536 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3537 #ifndef USE_SIZEATTENUATION 3538 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3539 if ( isPerspective ) scale *= - mvPosition.z; 3540 #endif 3541 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3542 vec2 rotatedPosition; 3543 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3544 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3545 mvPosition.xy += rotatedPosition; 3546 gl_Position = projectionMatrix * mvPosition; 3547 #include <logdepthbuf_vertex> 3548 #include <clipping_planes_vertex> 3549 #include <fog_vertex> 3550}`,uf=`uniform vec3 diffuse; 3551uniform float opacity; 3552#include <common> 3553#include <uv_pars_fragment> 3554#include <map_pars_fragment> 3555#include <alphamap_pars_fragment> 3556#include <alphatest_pars_fragment> 3557#include <alphahash_pars_fragment> 3558#include <fog_pars_fragment> 3559#include <logdepthbuf_pars_fragment> 3560#include <clipping_planes_pars_fragment> 3561void main() { 3562 vec4 diffuseColor = vec4( diffuse, opacity ); 3563 #include <clipping_planes_fragment> 3564 vec3 outgoingLight = vec3( 0.0 ); 3565 #include <logdepthbuf_fragment> 3566 #include <map_fragment> 3567 #include <alphamap_fragment> 3568 #include <alphatest_fragment> 3569 #include <alphahash_fragment> 3570 outgoingLight = diffuseColor.rgb; 3571 #include <opaque_fragment> 3572 #include <tonemapping_fragment> 3573 #include <colorspace_fragment> 3574 #include <fog_fragment> 3575}`,Le={alphahash_fragment:Dc,alphahash_pars_fragment:Lc,alphamap_fragment:Uc,alphamap_pars_fragment:Ic,alphatest_fragment:Nc,alphatest_pars_fragment:Fc,aomap_fragment:Oc,aomap_pars_fragment:Bc,batching_pars_vertex:zc,batching_vertex:Hc,begin_vertex:Vc,beginnormal_vertex:Gc,bsdfs:kc,iridescence_fragment:W
vendor: 7,101 bytes, line 3575
3575c,bumpmap_pars_fragment:Xc,clipping_planes_fragment:qc,clipping_planes_pars_fragment:Yc,clipping_planes_pars_vertex:Kc,clipping_planes_vertex:Zc,color_fragment:$c,color_pars_fragment:jc,color_pars_vertex:Jc,color_vertex:Qc,common:eu,cube_uv_reflection_fragment:tu,defaultnormal_vertex:nu,displacementmap_pars_vertex:iu,displacementmap_vertex:ru,emissivemap_fragment:su,emissivemap_pars_fragment:au,colorspace_fragment:ou,colorspace_pars_fragment:lu,envmap_fragment:cu,envmap_common_pars_fragment:uu,envmap_pars_fragment:hu,envmap_pars_vertex:fu,envmap_physical_pars_fragment:yu,envmap_vertex:du,fog_vertex:pu,fog_pars_vertex:mu,fog_fragment:gu,fog_pars_fragment:_u,gradientmap_pars_fragment:vu,lightmap_pars_fragment:xu,lights_lambert_fragment:Mu,lights_lambert_pars_fragment:Su,lights_pars_begin:Eu,lights_toon_fragment:Tu,lights_toon_pars_fragment:bu,lights_phong_fragment:Au,lights_phong_pars_fragment:wu,lights_physical_fragment:Ru,lights_physical_pars_fragment:Cu,lights_fragment_begin:Pu,lights_fragment_maps:Du,lights_fragment_end:Lu,logdepthbuf_fragment:Uu,logdepthbuf_pars_fragment:Iu,logdepthbuf_pars_vertex:Nu,logdepthbuf_vertex:Fu,map_fragment:Ou,map_pars_fragment:Bu,map_particle_fragment:zu,map_particle_pars_fragment:Hu,metalnessmap_fragment:Vu,metalnessmap_pars_fragment:Gu,morphinstance_vertex:ku,morphcolor_vertex:Wu,morphnormal_vertex:Xu,morphtarget_pars_vertex:qu,morphtarget_vertex:Yu,normal_fragment_begin:Ku,normal_fragment_maps:Zu,normal_pars_fragment:$u,normal_pars_vertex:ju,normal_vertex:Ju,normalmap_pars_fragment:Qu,clearcoat_normal_fragment_begin:eh,clearcoat_normal_fragment_maps:th,clearcoat_pars_fragment:nh,iridescence_pars_fragment:ih,opaque_fragment:rh,packing:sh,premultiplied_alpha_fragment:ah,project_vertex:oh,dithering_fragment:lh,dithering_pars_fragment:ch,roughnessmap_fragment:uh,roughnessmap_pars_fragment:hh,shadowmap_pars_fragment:fh,shadowmap_pars_vertex:dh,shadowmap_vertex:ph,shadowmask_pars_fragment:mh,skinbase_vertex:gh,skinning_pars_vertex:_h,skinning_vertex:vh,skinnormal_vertex:xh,specularmap_fragment:Mh,specularmap_pars_fragment:Sh,tonemapping_fragment:Eh,tonemapping_pars_fragment:yh,transmission_fragment:Th,transmission_pars_fragment:bh,uv_pars_fragment:Ah,uv_pars_vertex:wh,uv_vertex:Rh,worldpos_vertex:Ch,background_vert:Ph,background_frag:Dh,backgroundCube_vert:Lh,backgroundCube_frag:Uh,cube_vert:Ih,cube_frag:Nh,depth_vert:Fh,depth_frag:Oh,distanceRGBA_vert:Bh,distanceRGBA_frag:zh,equirect_vert:Hh,equirect_frag:Vh,linedashed_vert:Gh,linedashed_frag:kh,meshbasic_vert:Wh,meshbasic_frag:Xh,meshlambert_vert:qh,meshlambert_frag:Yh,meshmatcap_vert:Kh,meshmatcap_frag:Zh,meshnormal_vert:$h,meshnormal_frag:jh,meshphong_vert:Jh,meshphong_frag:Qh,meshphysical_vert:ef,meshphysical_frag:tf,meshtoon_vert:nf,meshtoon_frag:rf,points_vert:sf,points_frag:af,shadow_vert:of,shadow_frag:lf,sprite_vert:cf,sprite_frag:uf},ne={common:{diffuse:{value:new Ue(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Pe}},envmap:{envMap:{value:null},envMapRotation:{value:new Pe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Pe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Pe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Pe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Pe},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Pe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Pe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Pe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Pe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ue(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 Ue(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0},uvTransform:{value:new Pe}},sprite:{diffuse:{value:new Ue(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0}}},zt={basic:{uniforms:gt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:Le.meshbasic_vert,fragmentShader:Le.meshbasic_frag},lambert:{uniforms:gt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Le.meshlambert_vert,fragmentShader:Le.meshlambert_frag},phong:{uniforms:gt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Ue(0)},specular:{value:new Ue(1118481)},shininess:{value:30}}]),vertexShader:Le.meshphong_vert,fragmentShader:Le.meshphong_frag},standard:{uniforms:gt([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new Ue(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Le.meshphysical_vert,fragmentShader:Le.meshphysical_frag},toon:{uniforms:gt([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Le.meshtoon_vert,fragmentShader:Le.meshtoon_frag},matcap:{uniforms:gt([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matc
vendor: 5,263 bytes, line 3575
3575ap:{value:null}}]),vertexShader:Le.meshmatcap_vert,fragmentShader:Le.meshmatcap_frag},points:{uniforms:gt([ne.points,ne.fog]),vertexShader:Le.points_vert,fragmentShader:Le.points_frag},dashed:{uniforms:gt([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Le.linedashed_vert,fragmentShader:Le.linedashed_frag},depth:{uniforms:gt([ne.common,ne.displacementmap]),vertexShader:Le.depth_vert,fragmentShader:Le.depth_frag},normal:{uniforms:gt([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:Le.meshnormal_vert,fragmentShader:Le.meshnormal_frag},sprite:{uniforms:gt([ne.sprite,ne.fog]),vertexShader:Le.sprite_vert,fragmentShader:Le.sprite_frag},background:{uniforms:{uvTransform:{value:new Pe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Le.background_vert,fragmentShader:Le.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Pe}},vertexShader:Le.backgroundCube_vert,fragmentShader:Le.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Le.cube_vert,fragmentShader:Le.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Le.equirect_vert,fragmentShader:Le.equirect_frag},distanceRGBA:{uniforms:gt([ne.common,ne.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Le.distanceRGBA_vert,fragmentShader:Le.distanceRGBA_frag},shadow:{uniforms:gt([ne.lights,ne.fog,{color:{value:new Ue(0)},opacity:{value:1}}]),vertexShader:Le.shadow_vert,fragmentShader:Le.shadow_frag}};zt.physical={uniforms:gt([zt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Pe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Pe},clearcoatNormalScale:{value:new we(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Pe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Pe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Pe},sheen:{value:0},sheenColor:{value:new Ue(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Pe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Pe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Pe},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Pe},attenuationDistance:{value:0},attenuationColor:{value:new Ue(0)},specularColor:{value:new Ue(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Pe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Pe},anisotropyVector:{value:new we},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Pe}}]),vertexShader:Le.meshphysical_vert,fragmentShader:Le.meshphysical_frag};const $i={r:0,b:0,g:0},Tn=new Gt,hf=new Ze;function ff(i,e,t,n,r,s,a){const o=new Ue(0);let l=s===!0?0:1,c,h,f=null,d=0,m=null;function _(b){let T=b.isScene===!0?b.background:null;return T&&T.isTexture&&(T=(b.backgroundBlurriness>0?t:e).get(T)),T}function M(b){let T=!1;const S=_(b);S===null?u(o,l):S&&S.isColor&&(u(S,1),T=!0);const F=i.xr.getEnvironmentBlendMode();F==="additive"?n.buffers.color.setClear(0,0,0,1,a):F==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||T)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function p(b,T){const S=_(T);S&&(S.isCubeTexture||S.mapping===ur)?(h===void 0&&(h=new Ft(new wi(1,1,1),new dt({name:"BackgroundCubeMaterial",uniforms:si(zt.backgroundCube.uniforms),vertexShader:zt.backgroundCube.vertexShader,fragmentShader:zt.backgroundCube.fragmentShader,side:xt,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(F,R,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Tn.copy(T.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(hf.makeRotationFromEuler(Tn)),h.material.toneMapped=Ve.getTransfer(S.colorSpace)!==Ke,(f!==S||d!==S.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,f=S,d=S.version,m=i.toneMapping),h.layers.enableAll(),b.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new Ft(new Ri(2,2),new dt({name:"Backgroun
3575dMaterial",uniforms:si(zt.background.uniforms),vertexShader:zt.background.vertexShader,fragmentShader:zt.background.fragmentShader,side:vn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Ve.getTransfer(S.colorSpace)!==Ke,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(f!==S||d!==S.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,f=S,d=S.version,m=i.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function u(b,T){b.getRGB($i,Io(i)),n.buffers.color.setClear($i.r,$i.g,$i.b,T,a)}return{getClearColor:function(){return o},setClearColor:function(b,T=1){o.set(b),l=T,u(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,u(o,l)},render:M,addToRenderList:p}}function df(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null);let s=r,a=!1;function o(x,A,W,z,G){let Z=!1;const k=f(z,W,A);s!==k&&(s=k,c(s.object)),Z=m(x,z,W,G),Z&&_(x,z,W,G),G!==null&&e.update(G,i.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,S(x,A,W,z),G!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function f(x,A,W){const z=W.wireframe===!0;let G=n[x.id];G===void 0&&(G={},n[x.id]=G);let Z=G[A.id];Z===void 0&&(Z={},G[A.id]=Z);let k=Z[z];return k===void 0&&(k=d(l()),Z[z]=k),k}function d(x){const A=[],W=[],z=[];for(let G=0;G<t;G++)A[G]=0,W[G]=0,z[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:A,enabledAttributes:W,attributeDivisors:z,object:x,attributes:{},index:null}}function m(x,A,W,z){const G=s.attributes,Z=A.attributes;let k=0;const J=W.getAttributes();for(const H in J)if(J[H].location>=0){const ce=G[H];let xe=Z[H];if(xe===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(xe=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(xe=x.instanceColor)),ce===void 0||ce.attribute!==xe||xe&&ce.data!==xe.data)return!0;k++}return s.attributesNum!==k||s.index!==z}function _(x,A,W,z){const G={},Z=A.attributes;let k=0;const J=W.getAttributes();for(const H in J)if(J[H].location>=0){let ce=Z[H];ce===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(ce=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(ce=x.instanceColor));const xe={};xe.attribute=ce,ce&&ce.data&&(xe.data=ce.data),G[H]=xe,k++}s.attributes=G,s.attributesNum=k,s.index=z}function M(){const x=s.newAttributes;for(let A=0,W=x.length;A<W;A++)x[A]=0}function p(x){u(x,0)}function u(x,A){const W=s.newAttributes,z=s.enabledAttributes,G=s.attributeDivisors;W[x]=1,z[x]===0&&(i.enableVertexAttribArray(x),z[x]=1),G[x]!==A&&(i.vertexAttribDivisor(x,A),G[x]=A)}function b(){const x=s.newAttributes,A=s.enabledAttributes;for(let W=0,z=A.length;W<z;W++)A[W]!==x[W]&&(i.disableVertexAttribArray(W),A[W]=0)}function T(x,A,W,z,G,Z,k){k===!0?i.vertexAttribIPointer(x,A,W,G,Z):i.vertexAttribPointer(x,A,W,z,G,Z)}function S(x,A,W,z){M();const G=z.attributes,Z=W.getAttributes(),k=A.defaultAttributeValues;for(const J in Z){const H=Z[J];if(H.location>=0){let te=G[J];if(te===void 0&&(J==="instanceMatrix"&&x.instanceMatrix&&(te=x.instanceMatrix),J==="instanceColor"&&x.instanceColor&&(te=x.instanceColor)),te!==void 0){const ce=te.normalized,xe=te.itemSize,Ie=e.get(te);if(Ie===void 0)continue;const ke=Ie.buffer,q=Ie.type,ee=Ie.bytesPerElement,ge=q===i.INT||q===i.UNSIGNED_INT||te.gpuType===Fs;if(te.isInterleavedBufferAttribute){const re=te.data,ye=re.stride,Ae=te.offset;if(re.isInstancedInterleavedBuffer){for(let Ne=0;Ne<H.locationSize;Ne++)u(H.location+Ne,re.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Ne=0;Ne<H.locationSize;Ne++)p(H.location+Ne);i.bindBuffer(i.ARRAY_BUFFER,ke);for(let Ne=0;Ne<H.locationSize;
vendor: 16,070 bytes, lines 3575-3650
3575Ne++)T(H.location+Ne,xe/H.locationSize,q,ce,ye*ee,(Ae+xe/H.locationSize*Ne)*ee,ge)}else{if(te.isInstancedBufferAttribute){for(let re=0;re<H.locationSize;re++)u(H.location+re,te.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let re=0;re<H.locationSize;re++)p(H.location+re);i.bindBuffer(i.ARRAY_BUFFER,ke);for(let re=0;re<H.locationSize;re++)T(H.location+re,xe/H.locationSize,q,ce,xe*ee,xe/H.locationSize*re*ee,ge)}}else if(k!==void 0){const ce=k[J];if(ce!==void 0)switch(ce.length){case 2:i.vertexAttrib2fv(H.location,ce);break;case 3:i.vertexAttrib3fv(H.location,ce);break;case 4:i.vertexAttrib4fv(H.location,ce);break;default:i.vertexAttrib1fv(H.location,ce)}}}}b()}function F(){I();for(const x in n){const A=n[x];for(const W in A){const z=A[W];for(const G in z)h(z[G].object),delete z[G];delete A[W]}delete n[x]}}function R(x){if(n[x.id]===void 0)return;const A=n[x.id];for(const W in A){const z=A[W];for(const G in z)h(z[G].object),delete z[G];delete A[W]}delete n[x.id]}function w(x){for(const A in n){const W=n[A];if(W[x.id]===void 0)continue;const z=W[x.id];for(const G in z)h(z[G].object),delete z[G];delete W[x.id]}}function I(){E(),a=!0,s!==r&&(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:I,resetDefaultState:E,dispose:F,releaseStatesOfGeometry:R,releaseStatesOfProgram:w,initAttributes:M,enableAttribute:p,disableUnusedAttributes:b}}function pf(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,f){f!==0&&(i.drawArraysInstanced(n,c,h,f),t.update(h,n,f))}function o(c,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,f);let m=0;for(let _=0;_<f;_++)m+=h[_];t.update(m,n,1)}function l(c,h,f,d){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let _=0;_<c.length;_++)a(c[_],h[_],d[_]);else{m.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,f);let _=0;for(let M=0;M<f;M++)_+=h[M]*d[M];t.update(_,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function mf(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==Nt&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const I=w===Vt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==an&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==en&&!I)}function l(w){if(w==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const f=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),u=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=_>0,R=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:d,maxTextures:m,maxVertexTextures:_,maxTextureSize:M,maxCubemapSize:p,maxAttributes:u,maxVertexUniforms:b,maxVaryings:T,maxFragmentUniforms:S,vertexTextures:F,maxSamples:R}}function gf(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new mn,o=new Pe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){const m=f.length!==0||d||n!==0||r;return r=d,n=f.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=h(f,d,0)},this.setState=function(f,d,m){const _=f.clippingPlanes,M=f.clipIntersection,p=f.clipShadows,u=i.get(f);if(!r||_===null||_.length===0||s&&!p)s?h(null):c();else{const b=s?0:n,T=b*4;let S=u.clippingState||null;l.value=S,S=h(_,d,T,m);for(let F=0;F!==T;++F)S[F]=t[F];u.clippingState=S,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(f,d,m,_){const M=f!==null?f.length:0;let p=null;if(M!==0){if(p=l.value,_!==!0||p===null){const u=m+M*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length<u)&&(p=new Float32Array(u));for(let T=0,S=m;T!==M;++T,S+=4)a.copy(f[T]).applyMatrix4(b,o),a.normal.toArray(p,S),p[S+3]=a.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,p}}function _f(i){let e=new WeakMap;function t(a,o){return o===ns?a.mapping=ei:o===is&&(a.mapping=ti),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===ns||o===is)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new wc(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Bo extends No{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Kn=4,Ca=[.125,.215,.35,.446,.526,.582],Rn=20,Br=new Bo,Pa=new Ue;let zr=null,Hr=0,Vr=0,Gr=!1;const An=(1+Math.sqrt(5))/2,qn=1/An,Da=[new U(-An,qn,0),new U(An,qn,0),new U(-qn,0,An),new U(qn,0,An),new U(0,An,-qn),new U(0,An,qn),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)];class La{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){zr=this._renderer.getRenderTarget(),Hr=this._renderer.getActiveCubeFace(),Vr=this._renderer.getActiveMipmapLevel(),Gr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Na(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ia(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(zr,Hr,Vr),this._renderer.xr.enabled=Gr,e.scissorTest=!1,ji(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ei||e.mapping===ti?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zr=this._renderer.getRenderTarget(),Hr=this._renderer.getActiveCubeFace(),Vr=this._renderer.getActiveMipmapLevel(),Gr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ht,minFilter:Ht,generateMipmaps:!1,type:Vt,format:Nt,colorSpace:ai,depthBuffer:!1},r=Ua(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ua(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=vf(s)),this._blurMaterial=xf(s,e,t)}return r}_compileMaterial(e){const t=new Ft(this._lodPlanes[0],e);this._renderer.compile(t,Br)}_sceneToCubeUV(e,t,n,r){const o=new vt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,d=h.toneMapping;h.getClearColor(Pa),h.toneMapping=_n,h.autoClear=!1;const m=new Xs({name:"PMREM.Background",side:xt,depthWrite:!1,depthTest:!1}),_=new Ft(new wi,m);let M=!1;const p=e.background;p?p.isColor&&(m.color.copy(p),e.background=null,M=!0):(m.color.copy(Pa),M=!0);for(let u=0;u<6;u++){const b=u%3;b===0?(o.up.set(0,l[u],0),o.lookAt(c[u],0,0)):b===1?(o.up.set(0,0,l[u]),o.lookAt(0,c[u],0)):(o.up.set(0,l[u],0),o.lookAt(0,0,c[u]));const T=this._cubeSize;ji(r,b*T,u>2?T:0,T,T),h.setRenderTarget(r),M&&h.render(_,o),h.render(e,o)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=d,h.autoClear=f,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===ei||e.mapping===ti;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Na()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ia());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Ft(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;ji(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Br)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Da[(r-s-1)%Da.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,f=new Ft(this._lodPlanes[r],c),d=c.uniforms,m=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*Rn-1),M=s/_,p=isFinite(s)?1+Math.floor(h*M):Rn;p>Rn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Rn}`);const u=[];let b=0;for(let w=0;w<Rn;++w){const I=w/M,E=Math.exp(-I*I/2);u.push(E),w===0?b+=E:w<p&&(b+=2*E)}for(let w=0;w<u.length;w++)u[w]=u[w]/b;d.envMap.value=e.texture,d.samples.value=p,d.weights.value=u,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:T}=this;d.dTheta.value=_,d.mipInt.value=T-n;const S=this._sizeLods[r],F=3*S*(r>T-Kn?r-T+Kn:0),R=4*(this._cubeSize-S);ji(t,F,R,3*S,2*S),l.setRenderTarget(t),l.render(f,Br)}}function vf(i){const e=[],t=[],n=[];let r=i;const s=i-Kn+1+Ca.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-Kn?l=Ca[a-i+Kn-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,f=1+c,d=[h,h,f,h,f,f,h,h,f,f,h,f],m=6,_=6,M=3,p=2,u=1,b=new Float32Array(M*_*m),T=new Float32Array(p*_*m),S=new Float32Array(u*_*m);for(let R=0;R<m;R++){const w=R%3*2/3-1,I=R>2?0:-1,E=[w,I,0,w+2/3,I,0,w+2/3,I+1,0,w,I,0,w+2/3,I+1,0,w,I+1,0];b.set(E,M*_*R),T.set(d,p*_*R);const x=[R,R,R,R,R,R];S.set(x,u*_*R)}const F=new kt;F.setAttribute("position",new Ot(b,M)),F.setAttribute("uv",new Ot(T,p)),F.setAttribute("faceIndex",new Ot(S,u)),e.push(F),r>Kn&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Ua(i,e,t){const n=new Rt(i,e,t);return n.texture.mapping=ur,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ji(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function xf(i,e,t){const n=new Float32Array(Rn),r=new U(0,1,0);return new dt({name:"SphericalGaussianBlur",defines:{n:Rn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ys(),fragmentShader:` 3576 3577 precision mediump float; 3578 precision mediump int; 3579 3580 varying vec3 vOutputDirection; 3581 3582 uniform sampler2D envMap; 3583 uniform int samples; 3584 uniform float weights[ n ]; 3585 uniform bool latitudinal; 3586 uniform float dTheta; 3587 uniform float mipInt; 3588 uniform vec3 poleAxis; 3589 3590 #define ENVMAP_TYPE_CUBE_UV 3591 #include <cube_uv_reflection_fragment> 3592 3593 vec3 getSample( float theta, vec3 axis ) { 3594 3595 float cosTheta = cos( theta ); 3596 // Rodrigues' axis-angle rotation 3597 vec3 sampleDirection = vOutputDirection * cosTheta 3598 + cross( axis, vOutputDirection ) * sin( theta ) 3599 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3600 3601 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3602 3603 } 3604 3605 void main() { 3606 3607 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3608 3609 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3610 3611 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3612 3613 } 3614 3615 axis = normalize( axis ); 3616 3617 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3618 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3619 3620 for ( int i = 1; i < n; i++ ) { 3621 3622 if ( i >= samples ) { 3623 3624 break; 3625 3626 } 3627 3628 float theta = dTheta * float( i ); 3629 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3630 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3631 3632 } 3633 3634 } 3635 `,blending:nn,depthTest:!1,depthWrite:!1})}function Ia(){return new dt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ys(),fragmentShader:` 3636 3637 precision mediump float; 3638 precision mediump int; 3639 3640 varying vec3 vOutputDirection; 3641 3642 uniform sampler2D envMap; 3643 3644 #include <common> 3645 3646 void main() { 3647 3648 vec3 outputDirection = normalize( vOutputDirection ); 3649 vec2 uv = equirectUv( outputDirection ); 3650
3651 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3652 3653 } 3654 `,blending:nn,depthTest:!1,depthWrite:!1})}function Na(){return new dt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ys(),fragmentShader:` 3655 3656 precision mediump float; 3657 precision mediump int; 3658 3659 uniform float flipEnvMap; 3660 3661 varying vec3 vOutputDirection; 3662 3663 uniform samplerCube envMap; 3664 3665 void main() { 3666 3667 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3668 3669 } 3670 `,blending:nn,depthTest:!1,depthWrite:!1})}function Ys(){return` 3671 3672 precision mediump float; 3673 precision mediump int; 3674 3675 attribute float faceIndex; 3676 3677 varying vec3 vOutputDirection; 3678 3679 // RH coordinate system; PMREM face-indexing convention 3680 vec3 getDirection( vec2 uv, float face ) { 3681 3682 uv = 2.0 * uv - 1.0; 3683 3684 vec3 direction = vec3( uv, 1.0 ); 3685 3686 if ( face == 0.0 ) { 3687 3688 direction = direction.zyx; // ( 1, v, u ) pos x 3689 3690 } else if ( face == 1.0 ) { 3691 3692 direction = direction.xzy; 3693 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3694 3695 } else if ( face == 2.0 ) { 3696 3697 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3698 3699 } else if ( face == 3.0 ) { 3700 3701 direction = direction.zyx; 3702 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3703 3704 } else if ( face == 4.0 ) { 3705 3706 direction = direction.xzy; 3707 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3708 3709 } else if ( face == 5.0 ) { 3710 3711 direction.z *= -1.0; // ( u, v, -1 ) neg z 3712 3713 } 3714 3715 return direction; 3716 3717 } 3718 3719 void main() { 3720 3721 vOutputDirection = getDirection( uv, faceIndex ); 3722 gl_Position = vec4( position, 1.0 ); 3723 3724 } 3725 `}function Mf(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===ns||l===is,h=l===ei||l===ti;if(c||h){let f=e.get(o);const d=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new La(i)),f=c?t.fromEquirectangular(o,f):t.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const m=o.image;return c&&m&&m.height>0||h&&m&&r(m)?(t===null&&(t=new La(i)),f=c?t.fromEquirectangular(o):t.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Sf(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&vi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Ef(i,e,t,n){const r={},s=new WeakMap;function a(f){const d=f.target;d.index!==null&&e.remove(d.index);for(const _ in d.attributes)e.remove(d.attributes[_]);for(const _ in d.morphAttributes){const M=d.morphAttributes[_];for(let p=0,u=M.length;p<u;p++)e.remove(M[p])}d.removeEventListener("dispose",a),delete r[d.id];const m=s.get(d);
vendor: 14,287 bytes, lines 3725-3730
3725m&&(e.remove(m),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(f,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,t.memory.geometries++),d}function l(f){const d=f.attributes;for(const _ in d)e.update(d[_],i.ARRAY_BUFFER);const m=f.morphAttributes;for(const _ in m){const M=m[_];for(let p=0,u=M.length;p<u;p++)e.update(M[p],i.ARRAY_BUFFER)}}function c(f){const d=[],m=f.index,_=f.attributes.position;let M=0;if(m!==null){const b=m.array;M=m.version;for(let T=0,S=b.length;T<S;T+=3){const F=b[T+0],R=b[T+1],w=b[T+2];d.push(F,R,R,w,w,F)}}else if(_!==void 0){const b=_.array;M=_.version;for(let T=0,S=b.length/3-1;T<S;T+=3){const F=T+0,R=T+1,w=T+2;d.push(F,R,R,w,w,F)}}else return;const p=new(Ro(d)?Uo:Lo)(d,1);p.version=M;const u=s.get(f);u&&e.remove(u),s.set(f,p)}function h(f){const d=s.get(f);if(d){const m=f.index;m!==null&&d.version<m.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:h}}function yf(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,m){i.drawElements(n,m,s,d*a),t.update(m,n,1)}function c(d,m,_){_!==0&&(i.drawElementsInstanced(n,m,s,d*a,_),t.update(m,n,_))}function h(d,m,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,s,d,0,_);let p=0;for(let u=0;u<_;u++)p+=m[u];t.update(p,n,1)}function f(d,m,_,M){if(_===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let u=0;u<d.length;u++)c(d[u]/a,m[u],M[u]);else{p.multiDrawElementsInstancedWEBGL(n,m,0,s,d,0,M,0,_);let u=0;for(let b=0;b<_;b++)u+=m[b]*M[b];t.update(u,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=f}function Tf(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function bf(i,e,t){const n=new WeakMap,r=new qe;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==f){let E=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",E)};d!==void 0&&d.texture.dispose();const m=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,M=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let T=0;m===!0&&(T=1),_===!0&&(T=2),M===!0&&(T=3);let S=o.attributes.position.count*T,F=1;S>e.maxTextureSize&&(F=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const R=new Float32Array(S*F*4*f),w=new Po(R,S,F,f);w.type=en,w.needsUpdate=!0;const I=T*4;for(let x=0;x<f;x++){const A=p[x],W=u[x],z=b[x],G=S*F*4*x;for(let Z=0;Z<A.count;Z++){const k=Z*I;m===!0&&(r.fromBufferAttribute(A,Z),R[G+k+0]=r.x,R[G+k+1]=r.y,R[G+k+2]=r.z,R[G+k+3]=0),_===!0&&(r.fromBufferAttribute(W,Z),R[G+k+4]=r.x,R[G+k+5]=r.y,R[G+k+6]=r.z,R[G+k+7]=0),M===!0&&(r.fromBufferAttribute(z,Z),R[G+k+8]=r.x,R[G+k+9]=r.y,R[G+k+10]=r.z,R[G+k+11]=z.itemSize===4?r.w:1)}}d={count:f,texture:w,size:new we(S,F)},n.set(o,d),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let m=0;for(let M=0;M<c.length;M++)m+=c[M];const _=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function Af(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,f=e.get(l,h);if(r.get(f)!==c&&(e.update(f),r.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return f}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class zo extends pt{constructor(e,t,n,r,s,a,o,l,c,h=jn){if(h!==jn&&h!==ii)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===jn&&(n=Dn),n===void 0&&h===ii&&(n=ni),super(null,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:yt,this.minFilter=l!==void 0?l:yt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const Ho=new pt,Fa=new zo(1,1),Vo=new Po,Go=new cc,ko=new Fo,Oa=[],Ba=[],za=new Float32Array(16),Ha=new Float32Array(9),Va=new Float32Array(4);function ui(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Oa[r];if(s===void 0&&(s=new Float32Array(r),Oa[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function st(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function at(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function dr(i,e){let t=Ba[e];t===void 0&&(t=new Int32Array(e),Ba[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function wf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Rf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(st(t,e))return;i.uniform2fv(this.addr,e),at(t,e)}}function Cf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(st(t,e))return;i.uniform3fv(this.addr,e),at(t,e)}}function Pf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(st(t,e))return;i.uniform4fv(this.addr,e),at(t,e)}}function Df(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;Va.set(n),i.uniformMatrix2fv(this.addr,!1,Va),at(t,n)}}function Lf(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;Ha.set(n),i.uniformMatrix3fv(this.addr,!1,Ha),at(t,n)}}function Uf(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;za.set(n),i.uniformMatrix4fv(this.addr,!1,za),at(t,n)}}function If(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Nf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(st(t,e))return;i.uniform2iv(this.addr,e),at(t,e)}}function Ff(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(st(t,e))return;i.uniform3iv(this.addr,e),at(t,e)}}function Of(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(st(t,e))return;i.uniform4iv(this.addr,e),at(t,e)}}function Bf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function zf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(st(t,e))return;i.uniform2uiv(this.addr,e),at(t,e)}}function Hf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(st(t,e))return;i.uniform3uiv(this.addr,e),at(t,e)}}function Vf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(st(t,e))return;i.uniform4uiv(this.addr,e),at(t,e)}}function Gf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(Fa.compareFunction=wo,s=Fa):s=Ho,t.setTexture2D(e||s,r)}function kf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Go,r)}function Wf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||ko,r)}function Xf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Vo,r)}function qf(i){switch(i){case 5126:return wf;case 35664:return Rf;case 35665:return Cf;case 35666:return Pf;case 35674:return Df;case 35675:return Lf;case 35676:return Uf;case 5124:case 35670:return If;case 35667:case 35671:return Nf;case 35668:case 35672:return Ff;case 35669:case 35673:return Of;case 5125:return Bf;case 36294:return zf;case 36295:return Hf;case 36296:return Vf;case 35678:case 36198:case 36298:case 36306:case 35682:return Gf;case 35679:case 36299:case 36307:return kf;case 35680:case 36300:case 36308:case 36293:return Wf;case 36289:case 36303:case 36311:case 36292:return Xf}}function Yf(i,e){i.uniform1fv(this.addr,e)}function Kf(i,e){const t=ui(e,this.size,2);i.uniform2fv(this.addr,t)}function Zf(i,e){const t=ui(e,this.size,3);i.uniform3fv(this.addr,t)}function $f(i,e){const t=ui(e,this.size,4);i.uniform4fv(this.addr,t)}function jf(i,e){const t=ui(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Jf(i,e){const t=ui(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Qf(i,e){const t=ui(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function ed(i,e){i.uniform1iv(this.addr,e)}function td(i,e){i.uniform2iv(this.addr,e)}function nd(i,e){i.uniform3iv(this.addr,e)}function id(i,e){i.uniform4iv(this.addr,e)}function rd(i,e){i.uniform1uiv(this.addr,e)}function sd(i,e){i.uniform2uiv(this.addr,e)}function ad(i,e){i.uniform3uiv(this.addr,e)}function od(i,e){i.uniform4uiv(this.addr,e)}function ld(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Ho,s[a])}function cd(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Go,s[a])}function ud(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||ko,s[a])}function hd(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Vo,s[a])}function fd(i){switch(i){case 5126:return Yf;case 35664:return Kf;case 35665:return Zf;case 35666:return $f;case 35674:return jf;case 35675:return Jf;case 35676:return Qf;case 5124:case 35670:return ed;case 35667:case 35671:return td;case 35668:case 35672:return nd;case 35669:case 35673:return id;case 5125:return rd;case 36294:return sd;case 36295:return ad;case 36296:return od;case 35678:case 36198:case 36298:case 36306:case 35682:return ld;case 35679:case 36299:case 36307:return cd;case 35680:case 36300:case 36308:case 36293:return ud;case 36289:case 36303:case 36311:case 36292:return hd}}class dd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=qf(t.type)}}class pd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=fd(t.type)}}class md{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const kr=/(\w+)(\])?(\[|\.)?/g;function Ga(i,e){i.seq.push(e),i.map[e.id]=e}function gd(i,e,t){const n=i.name,r=n.length;for(kr.lastIndex=0;;){const s=kr.exec(n),a=kr.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Ga(t,c===void 0?new dd(o,i,e):new pd(o,i,e));break}else{let f=t.map[o];f===void 0&&(f=new md(o),Ga(t,f)),t=f}}}class ar{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);gd(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function ka(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const _d=37297;let vd=0;function xd(i,e){const t=i.split(` 3726`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3727`)}const Wa=new Pe;function Md(i){Ve._getMatrix(Wa,Ve.workingColorSpace,i);const e=`mat3( ${Wa.elements.map(t=>t.toFixed(4))} )`;switch(Ve.getTransfer(i)){case hr:return[e,"LinearTransferOETF"];case Ke:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Xa(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3728 3729`+r+` 3730
3731`+xd(i.getShaderSource(e),a)}else return r}function Sd(i,e){const t=Md(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3732`)}function Ed(i,e){let t;switch(e){case Ml:t="Linear";break;case Sl:t="Reinhard";break;case El:t="Cineon";break;case yl:t="ACESFilmic";break;case bl:t="AgX";break;case Al:t="Neutral";break;case Tl:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ji=new U;function yd(){Ve.getLuminanceCoefficients(Ji);const i=Ji.x.toFixed(4),e=Ji.y.toFixed(4),t=Ji.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3733`)}function Td(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(xi).join(` 3734`)}function bd(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3735`)}function Ad(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function xi(i){return i!==""}function qa(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ya(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const wd=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ls(i){return i.replace(wd,Cd)}const Rd=new Map;function Cd(i,e){let t=Le[e];if(t===void 0){const n=Rd.get(e);if(n!==void 0)t=Le[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ls(t)}const Pd=/#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 Ka(i){return i.replace(Pd,Dd)}function Dd(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Za(i){let e=`precision ${i.precision} float; 3736 precision ${i.precision} int; 3737 precision ${i.precision} sampler2D; 3738 precision ${i.precision} samplerCube; 3739 precision ${i.precision} sampler3D; 3740 precision ${i.precision} sampler2DArray; 3741 precision ${i.precision} sampler2DShadow; 3742 precision ${i.precision} samplerCubeShadow; 3743 precision ${i.precision} sampler2DArrayShadow; 3744 precision ${i.precision} isampler2D; 3745 precision ${i.precision} isampler3D; 3746 precision ${i.precision} isamplerCube; 3747 precision ${i.precision} isampler2DArray; 3748 precision ${i.precision} usampler2D; 3749 precision ${i.precision} usampler3D; 3750 precision ${i.precision} usamplerCube; 3751 precision ${i.precision} usampler2DArray; 3752 `;return i.precision==="highp"?e+=` 3753#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3754#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3755#define LOW_PRECISION`),e}function Ld(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===fo?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Qo?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===jt&&(e="SHADOWMAP_TYPE_VSM"),e}function Ud(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case ei:case ti:e="ENVMAP_TYPE_CUBE";break;case ur:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Id(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case ti:e="ENVMAP_MODE_REFRACTION";break}return e}function Nd(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case po:e="ENVMAP_BLENDING_MULTIPLY";break;case vl:e="ENVMAP_BLENDING_MIX";break;case xl:e="ENVMAP_BLENDING_ADD";break}return e}function Fd(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Od(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Ld(t),c=Ud(t),h=Id(t),f=Nd(t),d=Fd(t),m=Td(t),_=bd(s),M=r.createProgram();let p,u,b=t.glslVersion?"#version "+t.glslVersion+` 3756`:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(xi).join(` 3757`),p.length>0&&(p+=` 3758`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(xi).join(` 3759`),u.length>0&&(u+=` 3760`)):(p=[Za(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionCl
vendor: 6,454 bytes, lines 3760-3762
3760ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," 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",` 3761`].filter(xi).join(` 3762`),u=[Za(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3762IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==_n?"#define TONE_MAPPING":"",t.toneMapping!==_n?Le.tonemapping_pars_fragment:"",t.toneMapping!==_n?Ed("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Le.colorspace_pars_fragment,Sd("linearToOutputTexel",t.outputColorSpace),yd(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3763`].filter(xi).join(` 3764`)),a=Ls(a),a=qa(a,t),a=Ya(a,t),o=Ls(o),o=qa(o,t),o=Ya(o,t),a=Ka(a),o=Ka(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es 3765`,p=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3766`)+` 3767`+p,u=["#define varying in",t.glslVersion===oa?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===oa?"":"#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(` 3768`)+` 3769`+u);const T=b+p+a,S=b+u+o,F=ka(r,r.VERTEX_SHADER,T),R=ka(r,r.FRAGMENT_SHADER,S);r.attachShader(M,F),r.attachShader(M,R),t.index0AttributeName!==void 0?r.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);function w(A){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(M).trim(),z=r.getShaderInfoLog(F).trim(),G=r.getShaderInfoLog(R).trim();let Z=!0,k=!0;if(r.getProgramParameter(M,r.LINK_STATUS)===!1)if(Z=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,M,F,R);else{const J=Xa(r,F,"vertex"),H=Xa(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(M,r.VALIDATE_STATUS)+` 3770 3771Material Name: `+A.name+` 3772Material Type: `+A.type+` 3773 3774Program Info Log: `+W+` 3775`+J+` 3776`+H)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(z===""||G==="")&&(k=!1);k&&(A.diagnostics={runnable:Z,programLog:W,vertexShader:{log:z,prefix:p},fragmentShader:{log:G,prefix:u}})}r.deleteShader(F),r.deleteShader(R),I=new ar(r,M),E=Ad(r,M)}let I;this.getUniforms=function(){return I===void 0&&w(this),I};let E;this.getAttributes=function(){return E===void 0&&w(this),E};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(
vendor: 28,514 bytes, lines 3776-3804
3776M,_d)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=vd++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=F,this.fragmentShader=R,this}let Bd=0;class zd{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Hd(e),t.set(e,n)),n}}class Hd{constructor(e){this.id=Bd++,this.code=e,this.usedTimes=0}}function Vd(i,e,t,n,r,s,a){const o=new Ws,l=new zd,c=new Set,h=[],f=r.logarithmicDepthBuffer,d=r.vertexTextures;let m=r.precision;const _={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 M(E){return c.add(E),E===0?"uv":`uv${E}`}function p(E,x,A,W,z){const G=W.fog,Z=z.geometry,k=E.isMeshStandardMaterial?W.environment:null,J=(E.isMeshStandardMaterial?t:e).get(E.envMap||k),H=J&&J.mapping===ur?J.image.height:null,te=_[E.type];E.precision!==null&&(m=r.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const ce=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,xe=ce!==void 0?ce.length:0;let Ie=0;Z.morphAttributes.position!==void 0&&(Ie=1),Z.morphAttributes.normal!==void 0&&(Ie=2),Z.morphAttributes.color!==void 0&&(Ie=3);let ke,q,ee,ge;if(te){const Ye=zt[te];ke=Ye.vertexShader,q=Ye.fragmentShader}else ke=E.vertexShader,q=E.fragmentShader,l.update(E),ee=l.getVertexShaderID(E),ge=l.getFragmentShaderID(E);const re=i.getRenderTarget(),ye=i.state.buffers.depth.getReversed(),Ae=z.isInstancedMesh===!0,Ne=z.isBatchedMesh===!0,tt=!!E.map,ze=!!E.matcap,it=!!J,L=!!E.aoMap,Tt=!!E.lightMap,Fe=!!E.bumpMap,Oe=!!E.normalMap,Se=!!E.displacementMap,Je=!!E.emissiveMap,Me=!!E.metalnessMap,y=!!E.roughnessMap,g=E.anisotropy>0,N=E.clearcoat>0,Y=E.dispersion>0,$=E.iridescence>0,X=E.sheen>0,_e=E.transmission>0,se=g&&!!E.anisotropyMap,ue=N&&!!E.clearcoatMap,He=N&&!!E.clearcoatNormalMap,j=N&&!!E.clearcoatRoughnessMap,he=$&&!!E.iridescenceMap,Ee=$&&!!E.iridescenceThicknessMap,Te=X&&!!E.sheenColorMap,fe=X&&!!E.sheenRoughnessMap,Be=!!E.specularMap,De=!!E.specularColorMap,$e=!!E.specularIntensityMap,C=_e&&!!E.transmissionMap,ie=_e&&!!E.thicknessMap,V=!!E.gradientMap,K=!!E.alphaMap,le=E.alphaTest>0,ae=!!E.alphaHash,Re=!!E.extensions;let nt=_n;E.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(nt=i.toneMapping);const ct={shaderID:te,shaderType:E.type,shaderName:E.name,vertexShader:ke,fragmentShader:q,defines:E.defines,customVertexShaderID:ee,customFragmentShaderID:ge,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Ne,batchingColor:Ne&&z._colorsTexture!==null,instancing:Ae,instancingColor:Ae&&z.instanceColor!==null,instancingMorph:Ae&&z.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:re===null?i.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:ai,alphaToCoverage:!!E.alphaToCoverage,map:tt,matcap:ze,envMap:it,envMapMode:it&&J.mapping,envMapCubeUVHeight:H,aoMap:L,lightMap:Tt,bumpMap:Fe,normalMap:Oe,displacementMap:d&&Se,emissiveMap:Je,normalMapObjectSpace:Oe&&E.normalMapType===Pl,normalMapTangentSpace:Oe&&E.normalMapType===Ao,metalnessMap:Me,roughnessMap:y,anisotropy:g,anisotropyMap:se,clearcoat:N,clearcoatMap:ue,clearcoatNormalMap:He,clearcoatRoughnessMap:j,dispersion:Y,iridescence:$,iridescenceMap:he,iridescenceThicknessMap:Ee,sheen:X,sheenColorMap:Te,sheenRoughnessMap:fe,specularMap:Be,specularColorMap:De,specularIntensityMap:$e,transmission:_e,transmissionMap:C,thicknessMap:ie,gradientMap:V,opaque:E.transparent===!1&&E.blending===$n&&E.alphaToCoverage===!1,alphaMap:K,alphaTest:le,alphaHash:ae,combine:E.combine,mapUv:tt&&M(E.map.channel),aoMapUv:L&&M(E.aoMap.channel),lightMapUv:Tt&&M(E.lightMap.channel),bumpMapUv:Fe&&M(E.bumpMap.channel),normalMapUv:Oe&&M(E.normalMap.channel),displacementMapUv:Se&&M(E.displacementMap.channel),emissiveMapUv:Je&&M(E.emissiveMap.channel),metalnessMapUv:Me&&M(E.metalnessMap.channel),roughnessMapUv:y&&M(E.roughnessMap.channel),anisotropyMapUv:se&&M(E.anisotropyMap.channel),clearcoatMapUv:ue&&M(E.clearcoatMap.channel),clearcoatNormalMapUv:He&&M(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:j&&M(E.clearcoatRoughnessMap.channel),iridescenceMapUv:he&&M(E.iridescenceMap.channel),iridescenceThicknessMapUv:Ee&&M(E.iridescenceThicknessMap.channel),sheenColorMapUv:Te&&M(E.sheenColorMap.channel),sheenRoughnessMapUv:fe&&M(E.sheenRoughnessMap.channel),specularMapUv:Be&&M(E.specularMap.channel),specularColorMapUv:De&&M(E.specularColorMap.channel),specularIntensityMapUv:$e&&M(E.specularIntensityMap.channel),transmissionMapUv:C&&M(E.transmissionMap.channel),thicknessMapUv:ie&&M(E.thicknessMap.channel),alphaMapUv:K&&M(E.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(Oe||g),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!Z.attributes.uv&&(tt||K),fog:!!G,useFog:E.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ye,skinning:z.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:xe,morphTextureStride:Ie,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&A.length>0,shadowMapType:i.shadowMap.type,toneMapping:nt,decodeVideoTexture:tt&&E.map.isVideoTexture===!0&&Ve.getTransfer(E.map.colorSpace)===Ke,decodeVideoTextureEmissive:Je&&E.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(E.emissiveMap.colorSpace)===Ke,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Jt,flipSided:E.side===xt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Re&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Re&&E.extensions.multiDraw===!0||Ne)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return ct.vertexUv1s=c.has(1),ct.vertexUv2s=c.has(2),ct.vertexUv3s=c.has(3),c.clear(),ct}function u(E){const x=[];if(E.shaderID?x.push(E.shaderID):(x.push(E.customVertexShaderID),x.push(E.customFragmentShaderID)),E.defines!==void 0)for(const A in E.defines)x.push(A),x.push(E.defines[A]);return E.isRawShaderMaterial===!1&&(b(x,E),T(x,E),x.push(i.outputColorSpace)),x.push(E.customProgramCacheKey),x.join()}function b(E,x){E.push(x.precision),E.push(x.outputColorSpace),E.push(x.envMapMode),E.push(x.envMapCubeUVHeight),E.push(x.mapUv),E.push(x.alphaMapUv),E.push(x.lightMapUv),E.push(x.aoMapUv),E.push(x.bumpMapUv),E.push(x.normalMapUv),E.push(x.displacementMapUv),E.push(x.emissiveMapUv),E.push(x.metalnessMapUv),E.push(x.roughnessMapUv),E.push(x.anisotropyMapUv),E.push(x.clearcoatMapUv),E.push(x.clearcoatNormalMapUv),E.push(x.clearcoatRoughnessMapUv),E.push(x.iridescenceMapUv),E.push(x.iridescenceThicknessMapUv),E.push(x.sheenColorMapUv),E.push(x.sheenRoughnessMapUv),E.push(x.specularMapUv),E.push(x.specularColorMapUv),E.push(x.specularIntensityMapUv),E.push(x.transmissionMapUv),E.push(x.thicknessMapUv),E.push(x.combine),E.push(x.fogExp2),E.push(x.sizeAttenuation),E.push(x.morphTargetsCount),E.push(x.morphAttributeCount),E.push(x.numDirLights),E.push(x.numPointLights),E.push(x.numSpotLights),E.push(x.numSpotLightMaps),E.push(x.numHemiLights),E.push(x.numRectAreaLights),E.push(x.numDirLightShadows),E.push(x.numPointLightShadows),E.push(x.numSpotLightShadows),E.push(x.numSpotLightShadowsWithMaps),E.push(x.numLightProbes),E.push(x.shadowMapType),E.push(x.toneMapping),E.push(x.numClippingPlanes),E.push(x.numClipIntersection),E.push(x.depthPacking)}function T(E,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),E.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),E.push(o.mask)}function S(E){const x=_[E.type];let A;if(x){const W=zt[x];A=yi.clone(W.uniforms)}else A=E.uniforms;return A}function F(E,x){let A;for(let W=0,z=h.length;W<z;W++){const G=h[W];if(G.cacheKey===x){A=G,++A.usedTimes;break}}return A===void 0&&(A=new Od(i,x,E,s),h.push(A)),A}function R(E){if(--E.usedTimes===0){const x=h.indexOf(E);h[x]=h[h.length-1],h.pop(),E.destroy()}}function w(E){l.remove(E)}function I(){l.dispose()}return{getParameters:p,getProgramCacheKey:u,getUniforms:S,acquireProgram:F,releaseProgram:R,releaseShaderCache:w,programs:h,dispose:I}}function Gd(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function kd(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function $a(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function ja(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(f,d,m,_,M,p){let u=i[e];return u===void 0?(u={id:f.id,object:f,geometry:d,material:m,groupOrder:_,renderOrder:f.renderOrder,z:M,group:p},i[e]=u):(u.id=f.id,u.object=f,u.geometry=d,u.material=m,u.groupOrder=_,u.renderOrder=f.renderOrder,u.z=M,u.group=p),e++,u}function o(f,d,m,_,M,p){const u=a(f,d,m,_,M,p);m.transmission>0?n.push(u):m.transparent===!0?r.push(u):t.push(u)}function l(f,d,m,_,M,p){const u=a(f,d,m,_,M,p);m.transmission>0?n.unshift(u):m.transparent===!0?r.unshift(u):t.unshift(u)}function c(f,d){t.length>1&&t.sort(f||kd),n.length>1&&n.sort(d||$a),r.length>1&&r.sort(d||$a)}function h(){for(let f=e,d=i.length;f<d;f++){const m=i[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Wd(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new ja,i.set(n,[a])):r>=s.length?(a=new ja,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Xd(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new Ue};break;case"SpotLight":t={position:new U,direction:new U,color:new Ue,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Ue,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Ue,groundColor:new Ue};break;case"RectAreaLight":t={color:new Ue,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function qd(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Yd=0;function Kd(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Zd(i){const e=new Xd,t=qd(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new U);const r=new U,s=new Ze,a=new Ze;function o(c){let h=0,f=0,d=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let m=0,_=0,M=0,p=0,u=0,b=0,T=0,S=0,F=0,R=0,w=0;c.sort(Kd);for(let E=0,x=c.length;E<x;E++){const A=c[E],W=A.color,z=A.intensity,G=A.distance,Z=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=W.r*z,f+=W.g*z,d+=W.b*z;else if(A.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(A.sh.coefficients[k],z);w++}else if(A.isDirectionalLight){const k=e.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity),A.castShadow){const J=A.shadow,H=t.get(A);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,n.directionalShadow[m]=H,n.directionalShadowMap[m]=Z,n.directionalShadowMatrix[m]=A.shadow.matrix,b++}n.directional[m]=k,m++}else if(A.isSpotLight){const k=e.get(A);k.position.setFromMatrixPosition(A.matrixWorld),k.color.copy(W).multiplyScalar(z),k.distance=G,k.coneCos=Math.cos(A.angle),k.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),k.decay=A.decay,n.spot[M]=k;const J=A.shadow;if(A.map&&(n.spotLightMap[F]=A.map,F++,J.updateMatrices(A),A.castShadow&&R++),n.spotLightMatrix[M]=J.matrix,A.castShadow){const H=t.get(A);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,n.spotShadow[M]=H,n.spotShadowMap[M]=Z,S++}M++}else if(A.isRectAreaLight){const k=e.get(A);k.color.copy(W).multiplyScalar(z),k.halfWidth.set(A.width*.5,0,0),k.halfHeight.set(0,A.height*.5,0),n.rectArea[p]=k,p++}else if(A.isPointLight){const k=e.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity),k.distance=A.distance,k.decay=A.decay,A.castShadow){const J=A.shadow,H=t.get(A);H.shadowIntensity=J.intensity,H.shadowBias=J.bias,H.shadowNormalBias=J.normalBias,H.shadowRadius=J.radius,H.shadowMapSize=J.mapSize,H.shadowCameraNear=J.camera.near,H.shadowCameraFar=J.camera.far,n.pointShadow[_]=H,n.pointShadowMap[_]=Z,n.pointShadowMatrix[_]=A.shadow.matrix,T++}n.point[_]=k,_++}else if(A.isHemisphereLight){const k=e.get(A);k.skyColor.copy(A.color).multiplyScalar(z),k.groundColor.copy(A.groundColor).multiplyScalar(z),n.hemi[u]=k,u++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ne.LTC_FLOAT_1,n.rectAreaLTC2=ne.LTC_FLOAT_2):(n.rectAreaLTC1=ne.LTC_HALF_1,n.rectAreaLTC2=ne.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=f,n.ambient[2]=d;const I=n.hash;(I.directionalLength!==m||I.pointLength!==_||I.spotLength!==M||I.rectAreaLength!==p||I.hemiLength!==u||I.numDirectionalShadows!==b||I.numPointShadows!==T||I.numSpotShadows!==S||I.numSpotMaps!==F||I.numLightProbes!==w)&&(n.directional.length=m,n.spot.length=M,n.rectArea.length=p,n.point.length=_,n.hemi.length=u,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=S+F-R,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=w,I.directionalLength=m,I.pointLength=_,I.spotLength=M,I.rectAreaLength=p,I.hemiLength=u,I.numDirectionalShadows=b,I.numPointShadows=T,I.numSpotShadows=S,I.numSpotMaps=F,I.numLightProbes=w,n.version=Yd++)}function l(c,h){let f=0,d=0,m=0,_=0,M=0;const p=h.matrixWorldInverse;for(let u=0,b=c.length;u<b;u++){const T=c[u];if(T.isDirectionalLight){const S=n.directional[f];S.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(p),f++}else if(T.isSpotLight){const S=n.spot[m];S.position.setFromMatrixPosition(T.matrixWorld),S.position.applyMatrix4(p),S.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(p),m++}else if(T.isRectAreaLight){const S=n.rectArea[_];S.position.setFromMatrixPosition(T.matrixWorld),S.position.applyMatrix4(p),a.identity(),s.copy(T.matrixWorld),s.premultiply(p),a.extractRotation(s),S.halfWidth.set(T.width*.5,0,0),S.halfHeight.set(0,T.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),_++}else if(T.isPointLight){const S=n.point[d];S.position.setFromMatrixPosition(T.matrixWorld),S.position.applyMatrix4(p),d++}else if(T.isHemisphereLight){const S=n.hemi[M];S.direction.setFromMatrixPosition(T.matrixWorld),S.direction.transformDirection(p),M++}}}return{setup:o,setupView:l,state:n}}function Ja(i){const e=new Zd(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function $d(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Ja(i),e.set(r,[o])):s>=a.length?(o=new Ja(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class jd extends ci{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=Rl,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Jd extends ci{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Qd=`void main() { 3777 gl_Position = vec4( position, 1.0 ); 3778}`,ep=`uniform sampler2D shadow_pass; 3779uniform vec2 resolution; 3780uniform float radius; 3781#include <packing> 3782void main() { 3783 const float samples = float( VSM_SAMPLES ); 3784 float mean = 0.0; 3785 float squared_mean = 0.0; 3786 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3787 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3788 for ( float i = 0.0; i < samples; i ++ ) { 3789 float uvOffset = uvStart + i * uvStride; 3790 #ifdef HORIZONTAL_PASS 3791 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3792 mean += distribution.x; 3793 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3794 #else 3795 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3796 mean += depth; 3797 squared_mean += depth * depth; 3798 #endif 3799 } 3800 mean = mean / samples; 3801 squared_mean = squared_mean / samples; 3802 float std_dev = sqrt( squared_mean - mean * mean ); 3803 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3804}`;function tp(i,e,t){let n=new qs;const r=new we,s=new we,a=new qe,o=new jd({depthPacking:Cl}),l=new Jd,c={},h=t.maxTextureSize,f={[vn]:xt,[xt]:vn,[Jt]:Jt},d=new dt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:Qd,fragmentShader:ep}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const _=new kt;_.setAttribute("position",new Ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new Ft(_,d),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=fo;let u=this.type;this.render=function(R,w,I){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||R.length===0)return;const E=i.getRenderTarget(),x=i.getActiveCubeFace(),A=i.getActiveMipmapLevel(),W=i.state;W.setBlending(nn),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const z=u!==jt&&this.type===jt,G=u===jt&&this.type!==jt;for(let Z=0,k=R.length;Z<k;Z++){const J=R[Z],H=J.shadow;if(H===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;r.copy(H.mapSize);const te=H.getFrameExtents();if(r.multiply(te),s.copy(H.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/te.x),r.x=s.x*te.x,H.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/te.y),r.y=s.y*te.y,H.mapSize.y=s.y)),H.map===null||z===!0||G===!0){const xe=this.type!==jt?{minFilter:yt,magFilter:yt}:{};H.map!==null&&H.map.dispose(),H.map=new Rt(r.x,r.y,xe),H.map.texture.name=J.name+".shadowMap",H.camera.updateProjectionMatrix()}i.setRenderTarget(H.map),i.clear();const ce=H.getViewportCount();for(let xe=0;xe<ce;xe++){const Ie=H.getViewport(xe);a.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),W.viewport(a),H.updateMatrices(J,xe),n=H.getFrustum(),S(w,I,H.camera,J,this.type)}H.isPointLightShadow!==!0&&this.type===jt&&b(H,I),H.needsUpdate=!1}u=this.type,p.needsUpdate=!1,i.setRenderTarget(E,x,A)};function b(R,w){const I=e.update(M);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 Rt(r.x,r.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(w,null,I,d,M,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(w,null,I,m,M,null)}function T(R,w,I,E){let x=null;const A=I.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(A!==void 0)x=A;else if(x=I.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const W=x.uuid,z=w.uuid;let G=c[W];G===void 0&&(G={},c[W]=G);let Z=G[z];Z===void 0&&(Z=x.clone(),G[z]=Z,w.addEventListener("dispose",F)),x=Z}if(x.visible=w.visible,x.wireframe=w.wireframe,E===jt?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:f[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,I.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const W=i.properties.get(x);W.light=I}return x}function S(R,w,I,E,x){if(R.visible===!1)return;if(R.layers.test(w.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===jt)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,R.matrixWorld);const z=e.update(R),G=R.material;if(Array.isArray(G)){const Z=z.groups;for(let k=0,J=Z.length;k<J;k++){const H=Z[k],te=G[H.materialIndex];if(te&&te.visible){const ce=T(R,te,E,x);R.onBeforeShadow(i,R,w,I,z,ce,H),i.renderBufferDirect(I,null,z,ce,R,H),R.onAfterShadow(i,R,w,I,z,ce,H)}}}else if(G.visible){const Z=T(R,G,E,x);R.onBeforeShadow(i,R,w,I,z,Z,null),i.renderBufferDirect(I,null,z,Z,R,null),R.onAfterShadow(i,R,w,I,z,Z,null)}}const W=R.children;for(let z=0,G=W.length;z<G;z++)S(W[z],w,I,E,x)}function F(R){R.target.removeEventListener("dispose",F);for(const I in c){const E=c[I],x=R.target.uuid;x in E&&(E[x].dispose(),delete E[x])}}}const np={[Zr]:$r,[jr]:es,[Jr]:ts,[Qn]:Qr,[$r]:Zr,[es]:jr,[ts]:Jr,[Qr]:Qn};function ip(i,e){function t(){let C=!1;const ie=new qe;let V=null;const K=new qe(0,0,0,0);return{setMask:function(le){V!==le&&!C&&(i.colorMask(le,le,le,le),V=le)},setLocked:function(le){C=le},setClear:function(le,ae,Re,nt,ct){ct===!0&&(le*=nt,ae*=nt,Re*=nt),ie.set(le,ae,Re,nt),K.equals(ie)===!1&&(i.clearColor(le,ae,Re,nt),K.copy(ie))},reset:function(){C=!1,V=null,K.set(-1,0,0,0)}}}function n(){let C=!1,ie=!1,V=null,K=null,le=null;return{setReversed:function(ae){if(ie!==ae){const Re=e.get("EXT_clip_control");ie?Re.clipControlEXT(Re.LOWER_LEFT_EXT,Re.ZERO_TO_ONE_EXT):Re.clipControlEXT(Re.LOWER_LEFT_EXT,Re.NEGATIVE_ONE_TO_ONE_EXT);const nt=le;le=null,this.setClear(nt)}ie=ae},getReversed:function(){return ie},setTest:function(ae){ae?re(i.DEPTH_TEST):ye(i.DEPTH_TEST)},setMask:function(ae){V!==ae&&!C&&(i.depthMask(ae),V=ae)},setFunc:function(ae){if(ie&&(ae=np[ae]),K!==ae){switch(ae){case Zr:i.depthFunc(i.NEVER);break;case $r:i.depthFunc(i.ALWAYS);break;case jr:i.depthFunc(i.LESS);break;case Qn:i.depthFunc(i.LEQUAL);break;case Jr:i.depthFunc(i.EQUAL);break;case Qr:i.depthFunc(i.GEQUAL);break;case es:i.depthFunc(i.GREATER);break;case ts:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=ae}},setLocked:function(ae){C=ae},setClear:function(ae){le!==ae&&(ie&&(ae=1-ae),i.clearDepth(ae),le=ae)},reset:function(){C=!1,V=null,K=null,le=null,ie=!1}}}function r(){let C=!1,ie=null,V=null,K=null,le=null,ae=null,Re=null,nt=null,ct=null;return{setTest:function(Ye){C||(Ye?re(i.STENCIL_TEST):ye(i.STENCIL_TEST))},setMask:function(Ye){ie!==Ye&&!C&&(i.stencilMask(Ye),ie=Ye)},setFunc:function(Ye,Ct,Wt){(V!==Ye||K!==Ct||le!==Wt)&&(i.stencilFunc(Ye,Ct,Wt),V=Ye,K=Ct,le=Wt)},setOp:function(Ye,Ct,Wt){(ae!==Ye||Re!==Ct||nt!==Wt)&&(i.stencilOp(Ye,Ct,Wt),ae=Ye,Re=Ct,
vendor: 7,235 bytes, line 3804
3804nt=Wt)},setLocked:function(Ye){C=Ye},setClear:function(Ye){ct!==Ye&&(i.clearStencil(Ye),ct=Ye)},reset:function(){C=!1,ie=null,V=null,K=null,le=null,ae=null,Re=null,nt=null,ct=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},f={},d=new WeakMap,m=[],_=null,M=!1,p=null,u=null,b=null,T=null,S=null,F=null,R=null,w=new Ue(0,0,0),I=0,E=!1,x=null,A=null,W=null,z=null,G=null;const Z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let k=!1,J=0;const H=i.getParameter(i.VERSION);H.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(H)[1]),k=J>=1):H.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),k=J>=2);let te=null,ce={};const xe=i.getParameter(i.SCISSOR_BOX),Ie=i.getParameter(i.VIEWPORT),ke=new qe().fromArray(xe),q=new qe().fromArray(Ie);function ee(C,ie,V,K){const le=new Uint8Array(4),ae=i.createTexture();i.bindTexture(C,ae),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Re=0;Re<V;Re++)C===i.TEXTURE_3D||C===i.TEXTURE_2D_ARRAY?i.texImage3D(ie,0,i.RGBA,1,1,K,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(ie+Re,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return ae}const ge={};ge[i.TEXTURE_2D]=ee(i.TEXTURE_2D,i.TEXTURE_2D,1),ge[i.TEXTURE_CUBE_MAP]=ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[i.TEXTURE_2D_ARRAY]=ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ge[i.TEXTURE_3D]=ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),re(i.DEPTH_TEST),a.setFunc(Qn),Fe(!1),Oe(na),re(i.CULL_FACE),L(nn);function re(C){h[C]!==!0&&(i.enable(C),h[C]=!0)}function ye(C){h[C]!==!1&&(i.disable(C),h[C]=!1)}function Ae(C,ie){return f[C]!==ie?(i.bindFramebuffer(C,ie),f[C]=ie,C===i.DRAW_FRAMEBUFFER&&(f[i.FRAMEBUFFER]=ie),C===i.FRAMEBUFFER&&(f[i.DRAW_FRAMEBUFFER]=ie),!0):!1}function Ne(C,ie){let V=m,K=!1;if(C){V=d.get(ie),V===void 0&&(V=[],d.set(ie,V));const le=C.textures;if(V.length!==le.length||V[0]!==i.COLOR_ATTACHMENT0){for(let ae=0,Re=le.length;ae<Re;ae++)V[ae]=i.COLOR_ATTACHMENT0+ae;V.length=le.length,K=!0}}else V[0]!==i.BACK&&(V[0]=i.BACK,K=!0);K&&i.drawBuffers(V)}function tt(C){return _!==C?(i.useProgram(C),_=C,!0):!1}const ze={[wn]:i.FUNC_ADD,[tl]:i.FUNC_SUBTRACT,[nl]:i.FUNC_REVERSE_SUBTRACT};ze[il]=i.MIN,ze[rl]=i.MAX;const it={[sl]:i.ZERO,[al]:i.ONE,[ol]:i.SRC_COLOR,[Yr]:i.SRC_ALPHA,[dl]:i.SRC_ALPHA_SATURATE,[hl]:i.DST_COLOR,[cl]:i.DST_ALPHA,[ll]:i.ONE_MINUS_SRC_COLOR,[Kr]:i.ONE_MINUS_SRC_ALPHA,[fl]:i.ONE_MINUS_DST_COLOR,[ul]:i.ONE_MINUS_DST_ALPHA,[pl]:i.CONSTANT_COLOR,[ml]:i.ONE_MINUS_CONSTANT_COLOR,[gl]:i.CONSTANT_ALPHA,[_l]:i.ONE_MINUS_CONSTANT_ALPHA};function L(C,ie,V,K,le,ae,Re,nt,ct,Ye){if(C===nn){M===!0&&(ye(i.BLEND),M=!1);return}if(M===!1&&(re(i.BLEND),M=!0),C!==el){if(C!==p||Ye!==E){if((u!==wn||S!==wn)&&(i.blendEquation(i.FUNC_ADD),u=wn,S=wn),Ye)switch(C){case $n:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case or:i.blendFunc(i.ONE,i.ONE);break;case ia:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ra:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}else switch(C){case $n:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case or:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case ia:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ra:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}b=null,T=null,F=null,R=null,w.set(0,0,0),I=0,p=C,E=Ye}return}le=le||ie,ae=ae||V,Re=Re||K,(ie!==u||le!==S)&&(i.blendEquationSeparate(ze[ie],ze[le]),u=ie,S=le),(V!==b||K!==T||ae!==F||Re!==R)&&(i.blendFuncSeparate(it[V],it[K],it[ae],it[Re]),b=V,T=K,F=ae,R=Re),(nt.equals(w)===!1||ct!==I)&&(i.blendColor(nt.r,nt.g,nt.b,ct),w.copy(nt),I=ct),p=C,E=!1}function Tt(C,ie){C.side===Jt?ye(i.CULL_FACE):re(i.CULL_FACE);let V=C.side===xt;ie&&(V=!V),Fe(V),C.blending===$n&&C.transparent===!1?L(nn):L(C.blending,C.blendEquation,C.blendSrc,C.blendDst,C.blendEquationAlpha,C.blendSrcAlpha,C.blendDstAlpha,C.blendColor,C.blendAlpha,C.premultipliedAlpha),a.setFunc(C.depthFunc),a.setTest(C.depthTest),a.setMask(C.depthWrite),s.setMask(C.colorWrite);const K=C.stencilWrite;o.setTest(K),K&&(o.setMask(C.stencilWriteMask),o.setFunc(C.stencilFunc,C.stencilRef,C.stencilFuncMask),o.setOp(C.stencilFail,C.stencilZFail,C.stencilZPass)),Je(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),C.alphaToCoverage===!0?re(i.SAMPLE_ALPHA_TO_COVERAGE):ye(i.SAMPLE_ALPHA_TO_COVERAGE)}function Fe(C){x!==C&&(C?i.frontFace(i.CW):i.frontFace(i.CCW),x=C)}function Oe(C){C!==jo?(re(i.CULL_FACE),C!==A&&(C===na?i.cullFace(i.BACK):C===Jo?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ye(i.CULL_FACE),A=C}function Se(C){C!==W&&(k&&i.lineWidth(C),W=C)}function Je(C,ie,V){C?(re(i.POLYGON_OFFSET_FILL),(z!==ie||G!==V)&&(i.polygonOffset(ie,V),z=ie,G=V)):ye(i.POLYGON_OFFSET_FILL)}function Me(C){C?re(i.SCISSOR_TEST):ye(i.SCISSOR_TEST)}function y(C){C===void 0&&(C=i.TEXTURE0+Z-1),te!==C&&(i.activeTexture(C),te=C)}function g(C,ie,V){V===void 0&&(te===null?V=i.TEXTURE0+Z-1:V=te);let K=ce[V];K===void 0&&(K={type:void 0,texture:void 0},ce[V]=K),(K.type!==C||K.texture!==ie)&&(te!==V&&(i.activeTexture(V),te=V),i.bindTexture(C,ie||ge[C]),K.type=C,K.texture=ie)}function N(){const C=ce[te];C!==void 0&&C.type!==void 0&&(i.bindTexture(C.type,null),C.type=void 0,C.texture=void 0)}function Y(){try{i.compressedTexImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function $(){try{i.compressedTexImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function X(){try{i.texSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function _e(){try{i.texSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function se(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ue(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function He(){try{i.texStorage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function j(){try{i.texStorage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function he(){try{i.texImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Ee(){try{i.texImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Te(C){ke.equals(C)===!1&&(i.scissor(C.x,C.y,C.z,C.w),ke.copy(C))}function fe(C){q.equals(C)===!1&&(i.viewport(C.x,C.y,C.z,C.w),q.copy(C))}function Be(C,ie){let V=c.get(ie);V===void 0&&(V=new WeakMap,c.set(ie,V));let K=V.get(C);K===void 0&&(K=i.getUniformBlockIndex(ie,C.name),V.set(C,K))}function De(C,ie){const K=c.get(ie).get(C);l.get(ie)!==K&&(i.uniformBlockBinding(ie,K,C.__bindingPointIndex),l.set(ie,K))}function $e(){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
vendor: 34,226 bytes, line 3804
3804(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},te=null,ce={},f={},d=new WeakMap,m=[],_=null,M=!1,p=null,u=null,b=null,T=null,S=null,F=null,R=null,w=new Ue(0,0,0),I=0,E=!1,x=null,A=null,W=null,z=null,G=null,ke.set(0,0,i.canvas.width,i.canvas.height),q.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:re,disable:ye,bindFramebuffer:Ae,drawBuffers:Ne,useProgram:tt,setBlending:L,setMaterial:Tt,setFlipSided:Fe,setCullFace:Oe,setLineWidth:Se,setPolygonOffset:Je,setScissorTest:Me,activeTexture:y,bindTexture:g,unbindTexture:N,compressedTexImage2D:Y,compressedTexImage3D:$,texImage2D:he,texImage3D:Ee,updateUBOMapping:Be,uniformBlockBinding:De,texStorage2D:He,texStorage3D:j,texSubImage2D:X,texSubImage3D:_e,compressedTexSubImage2D:se,compressedTexSubImage3D:ue,scissor:Te,viewport:fe,reset:$e}}function Qa(i,e,t,n){const r=rp(n);switch(t){case xo:return i*e;case So:return i*e;case Eo:return i*e*2;case yo:return i*e/r.components*r.byteLength;case zs:return i*e/r.components*r.byteLength;case To:return i*e*2/r.components*r.byteLength;case Hs:return i*e*2/r.components*r.byteLength;case Mo:return i*e*3/r.components*r.byteLength;case Nt:return i*e*4/r.components*r.byteLength;case Vs:return i*e*4/r.components*r.byteLength;case tr:case nr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ir:case rr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case os:case cs:return Math.max(i,16)*Math.max(e,8)/4;case as:case ls:return Math.max(i,8)*Math.max(e,8)/2;case us:case hs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case fs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ds:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ps:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case ms:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case gs:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case _s:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case vs:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case xs:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Ms:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Ss:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Es:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case ys:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Ts:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bs:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case As:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case sr:case ws:case Rs:return Math.ceil(i/4)*Math.ceil(e/4)*16;case bo:case Cs:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ps:case Ds:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function rp(i){switch(i){case an:case go:return{byteLength:1,components:1};case Ei:case _o:case Vt:return{byteLength:2,components:1};case Os:case Bs:return{byteLength:2,components:4};case Dn:case Fs:case en:return{byteLength:4,components:1};case vo:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function sp(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new we,h=new WeakMap;let f;const d=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(y,g){return m?new OffscreenCanvas(y,g):cr("canvas")}function M(y,g,N){let Y=1;const $=Me(y);if(($.width>N||$.height>N)&&(Y=N/Math.max($.width,$.height)),Y<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const X=Math.floor(Y*$.width),_e=Math.floor(Y*$.height);f===void 0&&(f=_(X,_e));const se=g?_(X,_e):f;return se.width=X,se.height=_e,se.getContext("2d").drawImage(y,0,0,X,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+X+"x"+_e+")."),se}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),y;return y}function p(y){return y.generateMipmaps}function u(y){i.generateMipmap(y)}function b(y){return y.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:y.isWebGL3DRenderTarget?i.TEXTURE_3D:y.isWebGLArrayRenderTarget||y.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(y,g,N,Y,$=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let X=g;if(g===i.RED&&(N===i.FLOAT&&(X=i.R32F),N===i.HALF_FLOAT&&(X=i.R16F),N===i.UNSIGNED_BYTE&&(X=i.R8)),g===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.R8UI),N===i.UNSIGNED_SHORT&&(X=i.R16UI),N===i.UNSIGNED_INT&&(X=i.R32UI),N===i.BYTE&&(X=i.R8I),N===i.SHORT&&(X=i.R16I),N===i.INT&&(X=i.R32I)),g===i.RG&&(N===i.FLOAT&&(X=i.RG32F),N===i.HALF_FLOAT&&(X=i.RG16F),N===i.UNSIGNED_BYTE&&(X=i.RG8)),g===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RG8UI),N===i.UNSIGNED_SHORT&&(X=i.RG16UI),N===i.UNSIGNED_INT&&(X=i.RG32UI),N===i.BYTE&&(X=i.RG8I),N===i.SHORT&&(X=i.RG16I),N===i.INT&&(X=i.RG32I)),g===i.RGB_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RGB8UI),N===i.UNSIGNED_SHORT&&(X=i.RGB16UI),N===i.UNSIGNED_INT&&(X=i.RGB32UI),N===i.BYTE&&(X=i.RGB8I),N===i.SHORT&&(X=i.RGB16I),N===i.INT&&(X=i.RGB32I)),g===i.RGBA_INTEGER&&(N===i.UNSIGNED_BYTE&&(X=i.RGBA8UI),N===i.UNSIGNED_SHORT&&(X=i.RGBA16UI),N===i.UNSIGNED_INT&&(X=i.RGBA32UI),N===i.BYTE&&(X=i.RGBA8I),N===i.SHORT&&(X=i.RGBA16I),N===i.INT&&(X=i.RGBA32I)),g===i.RGB&&N===i.UNSIGNED_INT_5_9_9_9_REV&&(X=i.RGB9_E5),g===i.RGBA){const _e=$?hr:Ve.getTransfer(Y);N===i.FLOAT&&(X=i.RGBA32F),N===i.HALF_FLOAT&&(X=i.RGBA16F),N===i.UNSIGNED_BYTE&&(X=_e===Ke?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT_4_4_4_4&&(X=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(X=i.RGB5_A1)}return(X===i.R16F||X===i.R32F||X===i.RG16F||X===i.RG32F||X===i.RGBA16F||X===i.RGBA32F)&&e.get("EXT_color_buffer_float"),X}function S(y,g){let N;return y?g===null||g===Dn||g===ni?N=i.DEPTH24_STENCIL8:g===en?N=i.DEPTH32F_STENCIL8:g===Ei&&(N=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):g===null||g===Dn||g===ni?N=i.DEPTH_COMPONENT24:g===en?N=i.DEPTH_COMPONENT32F:g===Ei&&(N=i.DEPTH_COMPONENT16),N}function F(y,g){return p(y)===!0||y.isFramebufferTexture&&y.minFilter!==yt&&y.minFilter!==Ht?Math.log2(Math.max(g.width,g.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?g.mipmaps.length:1}function R(y){const g=y.target;g.removeEventListener("dispose",R),I(g),g.isVideoTexture&&h.delete(g)}function w(y){const g=y.target;g.removeEventListener("dispose",w),x(g)}function I(y){const g=n.get(y);if(g.__webglInit===void 0)return;const N=y.source,Y=d.get(N);if(Y){const $=Y[g.__cacheKey];$.usedTimes--,$.usedTimes===0&&E(y),Object.keys(Y).length===0&&d.delete(N)}n.remove(y)}function E(y){const g=n.get(y);i.deleteTexture(g.__webglTexture);const N=y.source,Y=d.get(N);delete Y[g.__cacheKey],a.memory.textures--}function x(y){const g=n.get(y);if(y.depthTexture&&(y.depthTexture.dispose(),n.remove(y.depthTexture)),y.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(g.__webglFramebuffer[Y]))for(let $=0;$<g.__webglFramebuffer[Y].length;$++)i.deleteFramebuffer(g.__webglFramebuffer[Y][$]);else i.deleteFramebuffer(g.__webglFramebuffer[Y]);g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer[Y])}else{if(Array.isArray(g.__webglFramebuffer))for(let Y=0;Y<g.__webglFramebuffer.length;Y++)i.deleteFramebuffer(g.__webglFramebuffer[Y]);else i.deleteFramebuffer(g.__webglFramebuffer);if(g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer),g.__webglMultisampledFramebuffer&&i.deleteFramebuffer(g.__webglMultisampledFramebuffer),g.__webglColorRenderbuffer)for(let Y=0;Y<g.__webglColorRenderbuffer.length;Y++)g.__webglColorRenderbuffer[Y]&&i.deleteRenderbuffer(g.__webglColorRenderbuffer[Y]);g.__webglDepthRenderbuffer&&i.deleteRenderbuffer(g.__webglDepthRenderbuffer)}const N=y.textures;for(let Y=0,$=N.length;Y<$;Y++){const X=n.get(N[Y]);X.__webglTexture&&(i.deleteTexture(X.__webglTexture),a.memory.textures--),n.remove(N[Y])}n.remove(y)}let A=0;function W(){A=0}function z(){const y=A;return y>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),A+=1,y}function G(y){const g=[];return g.push(y.wrapS),g.push(y.wrapT),g.push(y.wrapR||0),g.push(y.magFilter),g.push(y.minFilter),g.push(y.anisotropy),g.push(y.internalFormat),g.push(y.format),g.push(y.type),g.push(y.generateMipmaps),g.push(y.premultiplyAlpha),g.push(y.flipY),g.push(y.unpackAlignment),g.push(y.colorSpace),g.join()}function Z(y,g){const N=n.get(y);if(y.isVideoTexture&&Se(y),y.isRenderTargetTexture===!1&&y.version>0&&N.__version!==y.version){const Y=y.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(N,y,g);return}}t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+g)}function k(y,g){const N=n.get(y);if(y.version>0&&N.__version!==y.version){q(N,y,g);return}t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+g)}function J(y,g){const N=n.get(y);if(y.version>0&&N.__version!==y.version){q(N,y,g);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+g)}function H(y,g){const N=n.get(y);if(y.version>0&&N.__version!==y.version){ee(N,y,g);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+g)}const te={[rs]:i.REPEAT,[Cn]:i.CLAMP_TO_EDGE,[ss]:i.MIRRORED_REPEAT},ce={[yt]:i.NEAREST,[wl]:i.NEAREST_MIPMAP_NEAREST,[Li]:i.NEAREST_MIPMAP_LINEAR,[Ht]:i.LINEAR,[_r]:i.LINEAR_MIPMAP_NEAREST,[Pn]:i.LINEAR_MIPMAP_LINEAR},xe={[Dl]:i.NEVER,[Ol]:i.ALWAYS,[Ll]:i.LESS,[wo]:i.LEQUAL,[Ul]:i.EQUAL,[Fl]:i.GEQUAL,[Il]:i.GREATER,[Nl]:i.NOTEQUAL};function Ie(y,g){if(g.type===en&&e.has("OES_texture_float_linear")===!1&&(g.magFilter===Ht||g.magFilter===_r||g.magFilter===Li||g.magFilter===Pn||g.minFilter===Ht||g.minFilter===_r||g.minFilter===Li||g.minFilter===Pn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,te[g.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,te[g.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,te[g.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,ce[g.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,ce[g.minFilter]),g.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,xe[g.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(g.magFilter===yt||g.minFilter!==Li&&g.minFilter!==Pn||g.type===en&&e.has("OES_texture_float_linear")===!1)return;if(g.anisotropy>1||n.get(g).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,r.getMaxAnisotropy())),n.get(g).__currentAnisotropy=g.anisotropy}}}function ke(y,g){let N=!1;y.__webglInit===void 0&&(y.__webglInit=!0,g.addEventListener("dispose",R));const Y=g.source;let $=d.get(Y);$===void 0&&($={},d.set(Y,$));const X=G(g);if(X!==y.__cacheKey){$[X]===void 0&&($[X]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),$[X].usedTimes++;const _e=$[y.__cacheKey];_e!==void 0&&($[y.__cacheKey].usedTimes--,_e.usedTimes===0&&E(g)),y.__cacheKey=X,y.__webglTexture=$[X].texture}return N}function q(y,g,N){let Y=i.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),g.isData3DTexture&&(Y=i.TEXTURE_3D);const $=ke(y,g),X=g.source;t.bindTexture(Y,y.__webglTexture,i.TEXTURE0+N);const _e=n.get(X);if(X.version!==_e.__version||$===!0){t.activeTexture(i.TEXTURE0+N);const se=Ve.getPrimaries(Ve.workingColorSpace),ue=g.colorSpace===gn?null:Ve.getPrimaries(g.colorSpace),He=g.colorSpace===gn||se===ue?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,He);let j=M(g.image,!1,r.maxTextureSize);j=Je(g,j);const he=s.convert(g.format,g.colorSpace),Ee=s.convert(g.type);let Te=T(g.internalFormat,he,Ee,g.colorSpace,g.isVideoTexture);Ie(Y,g);let fe;const Be=g.mipmaps,De=g.isVideoTexture!==!0,$e=_e.__version===void 0||$===!0,C=X.dataReady,ie=F(g,j);if(g.isDepthTexture)Te=S(g.format===ii,g.type),$e&&(De?t.texStorage2D(i.TEXTURE_2D,1,Te,j.width,j.height):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,he,Ee,null));else if(g.isDataTexture)if(Be.length>0){De&&$e&&t.texStorage2D(i.TEXTURE_2D,ie,Te,Be[0].width,Be[0].height);for(let V=0,K=Be.length;V<K;V++)fe=Be[V],De?C&&t.texSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,Ee,fe.data):t.texImage2D(i.TEXTURE_2D,V,Te,fe.width,fe.height,0,he,Ee,fe.data);g.generateMipmaps=!1}else De?($e&&t.texStorage2D(i.TEXTURE_2D,ie,Te,j.width,j.height),C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,j.width,j.height,he,Ee,j.data)):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,he,Ee,j.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){De&&$e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,Te,Be[0].width,Be[0].height,j.depth);for(let V=0,K=Be.length;V<K;V++)if(fe=Be[V],g.format!==Nt)if(he!==null)if(De){if(C)if(g.layerUpdates.size>0){const le=Qa(fe.width,fe.height,g.format,g.type);for(const ae of g.layerUpdates){const Re=fe.data.subarray(ae*le/fe.data.BYTES_PER_ELEMENT,(ae+1)*le/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,ae,fe.width,fe.height,1,he,Re)}g.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,0,fe.width,fe.height,j.depth,he,fe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,V,Te,fe.width,fe.height,j.depth,0,fe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else De?C&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,0,fe.width,fe.height,j.depth,he,Ee,fe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,V,Te,fe.width,fe.height,j.depth,0,he,Ee,fe.data)}else{De&&$e&&t.texStorage2D(i.TEXTURE_2D,ie,Te,Be[0].width,Be[0].height);for(let V=0,K=Be.length;V<K;V++)fe=Be[V],g.format!==Nt?he!==null?De?C&&t.compressedTexSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,fe.data):t.compressedTexImage2D(i.TEXTURE_2D,V,Te,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):De?C&&t.texSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,Ee,fe.data):t.texImage2D(i.TEXTURE_2D,V,Te,fe.width,fe.height,0,he,Ee,fe.data)}else if(g.isDataArrayTexture)if(De){if($e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,Te,j.width,j.height,j.depth),C)if(g.layerUpdates.size>0){const V=Qa(j.width,j.height,g.format,g.type);for(const K of g.layerUpdates){const le=j.data.subarray(K*V/j.data.BYTES_PER_ELEMENT,(K+1)*V/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,K,j.width,j.height,1,he,Ee,le)}g.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,he,Ee,j.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,j.width,j.height,j.depth,0,he,Ee,j.data);else if(g.isData3DTexture)De?($e&&t.texStorage3D(i.TEXTURE_3D,ie,Te,j.width,j.height,j.depth),C&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,he,Ee,j.data)):t.texImage3D(i.TEXTURE_3D,0,Te,j.width,j.height,j.depth,0,he,Ee,j.data);else if(g.isFramebufferTexture){if($e)if(De)t.texStorage2D(i.TEXTURE_2D,ie,Te,j.width,j.height);else{let V=j.width,K=j.height;for(let le=0;le<ie;le++)t.texImage2D(i.TEXTURE_2D,le,Te,V,K,0,he,Ee,null),V>>=1,K>>=1}}else if(Be.length>0){if(De&&$e){const V=Me(Be[0]);t.texStorage2D(i.TEXTURE_2D,ie,Te,V.width,V.height)}for(let V=0,K=Be.length;V<K;V++)fe=Be[V],De?C&&t.texSubImage2D(i.TEXTURE_2D,V,0,0,he,Ee,fe):t.texImage2D(i.TEXTURE_2D,V,Te,he,Ee,fe);g.generateMipmaps=!1}else if(De){if($e){const V=Me(j);t.texStorage2D(i.TEXTURE_2D,ie,Te,V.width,V.height)}C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,he,Ee,j)}else t.texImage2D(i.TEXTURE_2D,0,Te,he,Ee,j);p(g)&&u(Y),_e.__version=X.version,g.onUpdate&&g.onUpdate(g)}y.__version=g.version}function ee(y,g,N){if(g.image.length!==6)return;const Y=ke(y,g),$=g.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+N);const X=n.get($);if($.version!==X.__version||Y===!0){t.activeTexture(i.TEXTURE0+N);const _e=Ve.getPrimaries(Ve.workingColorSpace),se=g.colorSpace===gn?null:Ve.getPrimaries(g.colorSpace),ue=g.colorSpace===gn||_e===se?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ue);const He=g.isCompressedTexture||g.image[0].isCompressedTexture,j=g.image[0]&&g.image[0].isDataTexture,he=[];for(let K=0;K<6;K++)!He&&!j?he[K]=M(g.image[K],!0,r.maxCubemapSize):he[K]=j?g.image[K].image:g.image[K],he[K]=Je(g,he[K]);const Ee=he[0],Te=s.convert(g.format,g.colorSpace),fe=s.convert(g.type),Be=T(g.internalFormat,Te,fe,g.colorSpace),De=g.isVideoTexture!==!0,$e=X.__version===void 0||Y===!0,C=$.dataReady;let ie=F(g,Ee);Ie(i.TEXTURE_CUBE_MAP,g);let V;if(He){De&&$e&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ie,Be,Ee.width,Ee.height);for(let K=0;K<6;K++){V=he[K].mipmaps;for(let le=0;le<V.length;le++){const ae=V[le];g.format!==Nt?Te!==null?De?C&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,0,0,ae.width,ae.height,Te,ae.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,Be,ae.width,ae.height,0,ae.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,0,0,ae.width,ae.height,Te,fe,ae.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,Be,ae.width,ae.height,0,Te,fe,ae.data)}}}else{if(V=g.mipmaps,De&&$e){V.length>0&&ie++;const K=Me(he[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ie,Be,K.width,K.height)}for(let K=0;K<6;K++)if(j){De?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,he[K].width,he[K].height,Te,fe,he[K].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Be,he[K].width,he[K].height,0,Te,fe,he[K].data);for(let le=0;le<V.length;le++){const Re=V[le].image[K].image;De?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,0,0,Re.width,Re.height,Te,fe,Re.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,Be,Re.width,Re.height,0,Te,fe,Re.data)}}else{De?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,Te,fe,he[K]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Be,Te,fe,he[K]);for(let le=0;le<V.length;le++){const ae=V[le];De?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,0,0,Te,fe,ae.image[K]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,Be,Te,fe,ae.image[K])}}}p(g)&&u(i.TEXTURE_CUBE_MAP),X.__version=$.version,g.onUpdate&&g.onUpdate(g)}y.__version=g.version}function ge(y,g,N,Y,$,X){const _e=s.convert(N.format,N.colorSpace),se=s.convert(N.type),ue=T(N.internalFormat,_e,se,N.colorSpace),He=n.get(g),j=n.get(N);if(j.__renderTarget=g,!He.__hasExternalTextures){const he=Math.max(1,g.width>>X),Ee=Math.max(1,g.height>>X);$===i.TEXTURE_3D||$===i.TEXTURE_2D_ARRAY?t.texImage3D($,X,ue,he,Ee,g.depth,0,_e,se,null):t.texImage2D($,X,ue,he,Ee,0,_e,se,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),Oe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,$,j.__webglTexture,0,Fe(g)):($===i.TEXTURE_2D||$>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,$,j.__webglTexture,X),t.bindFramebuffer(i.FRAMEBUFFER,null)}function re(y,g,N){if(i.bindRenderbuffer(i.RENDERBUFFER,y),g.depthBuffer){const Y=g.depthTexture,$=Y&&Y.isDepthTexture?Y.type:null,X=S(g.stencilBuffer,$),_e=g.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,se=Fe(g);Oe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,se,X,g.width,g.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,se,X,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,X,g.width,g.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,_e,i.RENDERBUFFER,y)}else{const Y=g.textures;for(let $=0;$<Y.length;$++){const X=Y[$],_e=s.convert(X.format,X.colorSpace),se=s.convert(X.type),ue=T(X.internalFormat,_e,se,X.colorSpace),He=Fe(g);N&&Oe(g)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,He,ue,g.width,g.height):Oe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,He,ue,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,ue,g.width,g.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ye(y,g){if(g&&g.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,y),!(g.depthTexture&&g.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Y=n.get(g.depthTexture);Y.__renderTarget=g,(!Y.__webglTexture||g.depthTexture.image.width!==g.width||g.depthTexture.image.height!==g.height)&&(g.depthTexture.image.width=g.width,g.depthTexture.image.height=g.height,g.depthTexture.needsUpdate=!0),Z(g.depthTexture,0);const $=Y.__webglTexture,X=Fe(g);if(g.depthTexture.format===jn)Oe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0,X):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0);else if(g.depthTexture.format===ii)Oe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0,X):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function Ae(y){const g=n.get(y),N=y.isWebGLCubeRenderTarget===!0;if(g.__boundDepthTexture!==y.depthTexture){const Y=y.depthTexture;if(g.__depthDisposeCallback&&g.__depthDisposeCallback(),Y){const $=()=>{delete g.__boundDepthTexture,delete g.__depthDisposeCallback,Y.removeEventListener("dispose",$)};Y.addEventListener("dispose",$),g.__depthDisposeCallback=$}g.__boundDepthTexture=Y}if(y.depthTexture&&!g.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");ye(g.__webglFramebuffer,y)}else if(N){g.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[Y]),g.__webglDepthbuffer[Y]===void 0)g.__webglDepthbuffer[Y]=i.createRenderbuffer(),re(g.__webglDepthbuffer[Y],y,!1);else{const $=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,X=g.__webglDepthbuffer[Y];i.bindRenderbuffer(i.RENDERBUFFER,X),i.framebufferRenderbuffer(i.FRAMEBUFFER,$,i.RENDERBUFFER,X)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer),g.__webglDepthbuffer===void 0)g.__webglDepthbuffer=i.createRenderbuffer(),re(g.__webglDepthbuffer,y,!1);else{const Y=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,$=g.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,$),i.framebufferRenderbuffer(i.FRAMEBUFFER,Y,i.RENDERBUFFER,$)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ne(y,g,N){const Y=n.get(y);g!==void 0&&ge(Y.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&Ae(y)}function tt(y){const g=y.texture,N=n.get(y),Y=n.get(g);y.addEventListener("dispose",w);const $=y.textures,X=y.isWebGLCubeRenderTarget===!0,_e=$.length>1;if(_e||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=g.version,a.memory.textures++),X){N.__webglFramebuffer=[];for(let se=0;se<6;se++)if(g.mipmaps&&g.mipmaps.length>0){N.__webglFramebuffer[se]=[];for(let ue=0;ue<g.mipmaps.length;ue++)N.__webglFramebuffer[se][ue]=i.createFramebuffer()}else N.__webglFramebuffer[se]=i.createFramebuffer()}else{if(g.mipmaps&&g.mipmaps.length>0){N.__webglFramebuffer=[];for(let se=0;se<g.mipmaps.length;se++)N.__webglFramebuffer[se]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(_e)for(let se=0,ue=$.length;se<ue;se++){const He=n.get($[se]);He.__webglTexture===void 0&&(He.__webglTexture=i.createTexture(),a.memory.textures++)}if(y.samples>0&&Oe(y)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let se=0;se<$.length;se++){const ue=$[se];N.__webglColorRenderbuffer[se]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[se]);const He=s.convert(ue.format,ue.colorSpace),j=s.convert(ue.type),he=T(ue.internalFormat,He,j,ue.colorSpace,y.isXRRenderTarget===!0),Ee=Fe(y);i.renderbufferStorageMultisample(i.RENDERBUFFER,Ee,he,y.width,y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,N.__webglColorRenderbuffer[se])}i.bindRenderbuffer(i.RENDERBUFFER,null),y.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),re(N.__webglDepthRenderbuffer,y,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(X){t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture),Ie(i.TEXTURE_CUBE_MAP,g);for(let se=0;se<6;se++)if(g.mipmaps&&g.mipmaps.length>0)for(let ue=0;ue<g.mipmaps.length;ue++)ge(N.__webglFramebuffer[se][ue],y,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+se,ue);else ge(N.__webglFramebuffer[se],y,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+se,0);p(g)&&u(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_e){for(let se=0,ue=$.length;se<ue;se++){const He=$[se],j=n.get(He);t.bindTexture(i.TEXTURE_2D,j.__webglTexture),Ie(i.TEXTURE_2D,He),ge(N.__webglFramebuffer,y,He,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,0),p(He)&&u(i.TEXTURE_2D)}t.unbindTexture()}else{let se=i.TEXTURE_2D;if((y.isWebGL3DRenderTarget||y.isWebGLArrayRenderTarget)&&(se=y.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(se,Y.__webglTexture),Ie(se,g),g.mipmaps&&g.mipmaps.length>0)for(let ue=0;ue<g.mipmaps.length;ue++)ge(N.__webglFramebuffer[ue],y,g,i.COLOR_ATTACHMENT0,se,ue);else ge(N.__webglFramebuffer,y,g,i.COLOR_ATTACHMENT0,se,0);p(g)&&u(se),t.unbindTexture()}y.depthBuffer&&Ae(y)}function ze(y){const g=y.textures;for(let N=0,Y=g.length;N<Y;N++){const $=g[N];if(p($)){const X=b(y),_e=n.get($).__webglTexture;t.bindTexture(X,_e),u(X),t.unbindTexture()}}}const it=[],L=[];function Tt(y){if(y.samples>0){if(Oe(y)===!1){const g=y.textures,N=y.width,Y=y.height;let $=i.COLOR_BUFFER_BIT;const X=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_e=n.get(y),se=g.length>1;if(se)for(let ue=0;ue<g.length;ue++)t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let ue=0;ue<g.length;ue++){if(y.resolveDepthBuffer&&(y.depthBuffer&&($|=i.DEPTH_BUFFER_BIT),y.stencilBuffer&&y.resolveStencilBuffer&&($|=i.STENCIL_BUFFER_BIT)),se){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,_e.__webglColorRenderbuffer[ue]);const He=n.get(g[ue]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,He,0)}i.blitFramebuffer(0,0,N,Y,0,0,N,Y,$,i.NEAREST),l===!0&&(it.length=0,L.length=0,it.push(i.COLOR_ATTACHMENT0+ue),y.depthBuffer&&y.resolveDepthBuffer===!1&&(it.push(X),L.push(X),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,L)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,it))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),se)for(let ue=0;ue<g.length;ue++){t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,_e.__webglColorRenderbuffer[ue]);const He=n.get(g[ue]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,He,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}else if(y.depthBuffer&&y.resolveDepthBuffer===!1&&l){const g=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[g])}}}function Fe(y){return Math.min(r.maxSamples,y.samples)}function Oe(y){const g=n.get(y);return y.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&g.__useRenderToTexture!==!1}function Se(y){const g=a.render.frame;h.get(y)!==g&&(h.set(y,g),y.update())}function Je(y,g){const N=y.colorSpace,Y=y.format,$=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||N!==ai&&N!==gn&&(Ve.getTransfer(N)===Ke?(Y!==Nt||$!==an)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),g}function Me(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=W,this.setTexture2D=Z,this.setTexture2DArray=k,this.setTexture3D=J,this.setTextureCube=H,this.rebindTextures=Ne,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=ze,this.updateMultisampleRenderTarget=Tt,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=Oe}function ap(i,e){function t(n,r=gn){let s;const a=Ve.getTransfer(r);if(n===an)return i.UNSIGNED_BYTE;if(n===Os)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Bs)return i.UNSIGNED_SHORT_5_5_5_1;if(n===vo)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===go)return i.BYTE;if(n===_o)return i.SHORT;if(n===Ei)return i.UNSIGNED_SHORT;if(n===Fs)return i.INT;if(n===Dn)return i.UNSIGNED_INT;if(n===en)return i.FLOAT;if(n===Vt)return i.HALF_FLOAT;if(n===xo)return i.ALPHA;if(n===Mo)return i.RGB;if(n===Nt)return i.RGBA;if(n===So)return i.LUMINANCE;if(n===Eo)return i.LUMINANCE_ALPHA;if(n===jn)return i.DEPTH_COMPONENT;if(n===ii)return i.DEPTH_STENCIL;if(n===yo)return i.RED;if(n===zs)return i.RED_INTEGER;if(n===To)return i.RG;if(n===Hs)return i.RG_INTEGER;if(n===Vs)return i.RGBA_INTEGER;if(n===tr||n===nr||n===ir||n===rr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===tr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===nr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ir)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===tr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===nr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ir)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===rr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===as||n===os||n===ls||n===cs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===as)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===os)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ls)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===cs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===us||n===hs||n===fs)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===us||n===hs)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===fs)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ds||n===ps||n===ms||n===gs||n===_s||n===vs||n===xs||n===Ms||n===Ss||n===Es||n===ys||n===Ts||n===bs||n===As)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ds)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ps)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ms)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===gs)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===_s)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vs)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===xs)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ms)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ss)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Es)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ys)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ts)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bs)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===As)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===sr||n===ws||n===Rs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===sr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ws)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Rs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===bo||n===Cs||n===Ps||n===Ds)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===sr)return s.COMPRESSED_RED_RGT
vendor: 9,722 bytes, lines 3804-3828
3804C1_EXT;if(n===Cs)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ps)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ds)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ni?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class op extends vt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Zn extends lt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const lp={type:"move"};class Wr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zn,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 Zn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const M of e.hand.values()){const p=t.getJointPose(M,n),u=this._getHandJoint(c,M);p!==null&&(u.matrix.fromArray(p.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=p.radius),u.visible=p!==null}const h=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=h.position.distanceTo(f.position),m=.02,_=.005;c.inputState.pinching&&d>m+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=m-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(lp)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Zn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const cp=` 3805void main() { 3806 3807 gl_Position = vec4( position, 1.0 ); 3808 3809}`,up=` 3810uniform sampler2DArray depthColor; 3811uniform float depthWidth; 3812uniform float depthHeight; 3813 3814void main() { 3815 3816 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3817 3818 if ( coord.x >= 1.0 ) { 3819 3820 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3821 3822 } else { 3823 3824 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3825 3826 } 3827 3828}`;class hp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new pt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new dt({vertexShader:cp,fragmentShader:up,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ft(new Ri(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class fp extends oi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,f=null,d=null,m=null,_=null;const M=new hp,p=t.getContextAttributes();let u=null,b=null;const T=[],S=[],F=new we;let R=null;const w=new vt;w.viewport=new qe;const I=new vt;I.viewport=new qe;const E=[w,I],x=new op;let A=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let ee=T[q];return ee===void 0&&(ee=new Wr,T[q]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(q){let ee=T[q];return ee===void 0&&(ee=new Wr,T[q]=ee),ee.getGripSpace()},this.getHand=function(q){let ee=T[q];return ee===void 0&&(ee=new Wr,T[q]=ee),ee.getHandSpace()};function z(q){const ee=S.indexOf(q.inputSource);if(ee===-1)return;const ge=T[ee];ge!==void 0&&(ge.update(q.inputSource,q.frame,c||a),ge.dispatchEvent({type:q.type,data:q.inputSource}))}function G(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",Z);for(let q=0;q<T.length;q++){const ee=S[q];ee!==null&&(S[q]=null,T[q].disconnect(ee))}A=null,W=null,M.reset(),e.setRenderTarget(u),m=null,d=null,f=null,r=null,b=null,ke.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:m},this.getBinding=function(){return f},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(u=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",G),r.addEventListener("inputsourceschange",Z),p.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(F),r.renderState.layers===void 0){const ee={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,ee),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),b=new Rt(m.framebufferWidth,m.framebufferHeight,{format:Nt,type:an,colorSpace:e.outputColorSpace,stencilBuffer:p.stencil})}else{let ee=null,ge=null,re=null;p.depth&&(re=p.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ee=p.stencil?ii:jn,ge=p.stencil?ni:Dn);const ye={colorFormat:t.RGBA8,depthFormat:re,scaleFactor:s};f=new XRWebGLBinding(r,t),d=f.createProjectionLayer(ye),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new Rt(d.textureWidth,d.textureHeight,{format:Nt,type:an,depthTexture:new zo(d.textureWidth,d.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:p.stencil,colorSpace:e.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),ke.setContext(r),ke.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function Z(q){for(let ee=0;ee<q.removed.length;ee++){const ge=q.removed[ee],re=S.indexOf(ge);re>=0&&(S[re]=null,T[re].disconnect(ge))}for(let ee=0;ee<q.added.length;ee++){const ge=q.added[ee];let re=S.indexOf(ge);if(re===-1){for(let Ae=0;Ae<T.length;Ae++)if(Ae>=S.length){S.push(ge),re=Ae;break}else if(S[Ae]===null){S[Ae]=ge,re=Ae;break}if(re===-1)break}const ye=T[re];ye&&ye.connect(ge)}}const k=new U,J=new U;function H(q,ee,ge){k.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(ge.matrixWorld);const re=k.distanceTo(J),ye=ee.projectionMatrix.elements,Ae=ge.projectionMatrix.elements,Ne=ye[14]/(ye[10]-1),tt=ye[14]/(ye[10]+1),ze=(ye[9]+1)/ye[5],it=(ye[9]-1)/ye[5],L=(ye[8]-1)/ye[0],Tt=(Ae[8]+1)/Ae[0],Fe=Ne*L,Oe=Ne*Tt,Se=re/(-L+Tt),Je=Se*-L;if(ee.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(Je),q.translateZ(Se),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),ye[10]===-1)q.projectionMatrix.copy(ee.projectionMatrix),q.projectionMatrixInverse.copy(ee.projectionMatrixInverse);
vendor: 15,180 bytes, line 3828
3828else{const Me=Ne+Se,y=tt+Se,g=Fe-Je,N=Oe+(re-Je),Y=ze*tt/y*Me,$=it*tt/y*Me;q.projectionMatrix.makePerspective(g,N,Y,$,Me,y),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function te(q,ee){ee===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(ee.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;let ee=q.near,ge=q.far;M.texture!==null&&(M.depthNear>0&&(ee=M.depthNear),M.depthFar>0&&(ge=M.depthFar)),x.near=I.near=w.near=ee,x.far=I.far=w.far=ge,(A!==x.near||W!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),A=x.near,W=x.far),w.layers.mask=q.layers.mask|2,I.layers.mask=q.layers.mask|4,x.layers.mask=w.layers.mask|I.layers.mask;const re=q.parent,ye=x.cameras;te(x,re);for(let Ae=0;Ae<ye.length;Ae++)te(ye[Ae],re);ye.length===2?H(x,w,I):x.projectionMatrix.copy(w.projectionMatrix),ce(q,x,re)};function ce(q,ee,ge){ge===null?q.matrix.copy(ee.matrixWorld):(q.matrix.copy(ge.matrixWorld),q.matrix.invert(),q.matrix.multiply(ee.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(ee.projectionMatrix),q.projectionMatrixInverse.copy(ee.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=ri*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&m===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=q)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(x)};let xe=null;function Ie(q,ee){if(h=ee.getViewerPose(c||a),_=ee,h!==null){const ge=h.views;m!==null&&(e.setRenderTargetFramebuffer(b,m.framebuffer),e.setRenderTarget(b));let re=!1;ge.length!==x.cameras.length&&(x.cameras.length=0,re=!0);for(let Ae=0;Ae<ge.length;Ae++){const Ne=ge[Ae];let tt=null;if(m!==null)tt=m.getViewport(Ne);else{const it=f.getViewSubImage(d,Ne);tt=it.viewport,Ae===0&&(e.setRenderTargetTextures(b,it.colorTexture,d.ignoreDepthValues?void 0:it.depthStencilTexture),e.setRenderTarget(b))}let ze=E[Ae];ze===void 0&&(ze=new vt,ze.layers.enable(Ae),ze.viewport=new qe,E[Ae]=ze),ze.matrix.fromArray(Ne.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(Ne.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(tt.x,tt.y,tt.width,tt.height),Ae===0&&(x.matrix.copy(ze.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),re===!0&&x.cameras.push(ze)}const ye=r.enabledFeatures;if(ye&&ye.includes("depth-sensing")){const Ae=f.getDepthInformation(ge[0]);Ae&&Ae.isValid&&Ae.texture&&M.init(e,Ae,r.renderState)}}for(let ge=0;ge<T.length;ge++){const re=S[ge],ye=T[ge];re!==null&&ye!==void 0&&ye.update(re,ee,c||a)}xe&&xe(q,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),_=null}const ke=new Oo;ke.setAnimationLoop(Ie),this.setAnimationLoop=function(q){xe=q},this.dispose=function(){}}}const bn=new Gt,dp=new Ze;function pp(i,e){function t(p,u){p.matrixAutoUpdate===!0&&p.updateMatrix(),u.value.copy(p.matrix)}function n(p,u){u.color.getRGB(p.fogColor.value,Io(i)),u.isFog?(p.fogNear.value=u.near,p.fogFar.value=u.far):u.isFogExp2&&(p.fogDensity.value=u.density)}function r(p,u,b,T,S){u.isMeshBasicMaterial||u.isMeshLambertMaterial?s(p,u):u.isMeshToonMaterial?(s(p,u),f(p,u)):u.isMeshPhongMaterial?(s(p,u),h(p,u)):u.isMeshStandardMaterial?(s(p,u),d(p,u),u.isMeshPhysicalMaterial&&m(p,u,S)):u.isMeshMatcapMaterial?(s(p,u),_(p,u)):u.isMeshDepthMaterial?s(p,u):u.isMeshDistanceMaterial?(s(p,u),M(p,u)):u.isMeshNormalMaterial?s(p,u):u.isLineBasicMaterial?(a(p,u),u.isLineDashedMaterial&&o(p,u)):u.isPointsMaterial?l(p,u,b,T):u.isSpriteMaterial?c(p,u):u.isShadowMaterial?(p.color.value.copy(u.color),p.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(p,u){p.opacity.value=u.opacity,u.color&&p.diffuse.value.copy(u.color),u.emissive&&p.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(p.map.value=u.map,t(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.bumpMap&&(p.bumpMap.value=u.bumpMap,t(u.bumpMap,p.bumpMapTransform),p.bumpScale.value=u.bumpScale,u.side===xt&&(p.bumpScale.value*=-1)),u.normalMap&&(p.normalMap.value=u.normalMap,t(u.normalMap,p.normalMapTransform),p.normalScale.value.copy(u.normalScale),u.side===xt&&p.normalScale.value.negate()),u.displacementMap&&(p.displacementMap.value=u.displacementMap,t(u.displacementMap,p.displacementMapTransform),p.displacementScale.value=u.displacementScale,p.displacementBias.value=u.displacementBias),u.emissiveMap&&(p.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,p.emissiveMapTransform)),u.specularMap&&(p.specularMap.value=u.specularMap,t(u.specularMap,p.specularMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest);const b=e.get(u),T=b.envMap,S=b.envMapRotation;T&&(p.envMap.value=T,bn.copy(S),bn.x*=-1,bn.y*=-1,bn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(bn.y*=-1,bn.z*=-1),p.envMapRotation.value.setFromMatrix4(dp.makeRotationFromEuler(bn)),p.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=u.reflectivity,p.ior.value=u.ior,p.refractionRatio.value=u.refractionRatio),u.lightMap&&(p.lightMap.value=u.lightMap,p.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,p.lightMapTransform)),u.aoMap&&(p.aoMap.value=u.aoMap,p.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,p.aoMapTransform))}function a(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform))}function o(p,u){p.dashSize.value=u.dashSize,p.totalSize.value=u.dashSize+u.gapSize,p.scale.value=u.scale}function l(p,u,b,T){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.size.value=u.size*b,p.scale.value=T*.5,u.map&&(p.map.value=u.map,t(u.map,p.uvTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function c(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.rotation.value=u.rotation,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function h(p,u){p.specular.value.copy(u.specular),p.shininess.value=Math.max(u.shininess,1e-4)}function f(p,u){u.gradientMap&&(p.gradientMap.value=u.gradientMap)}function d(p,u){p.metalness.value=u.metalness,u.metalnessMap&&(p.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,p.metalnessMapTransform)),p.roughness.value=u.roughness,u.roughnessMap&&(p.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,p.roughnessMapTransform)),u.envMap&&(p.envMapIntensity.value=u.envMapIntensity)}function m(p,u,b){p.ior.value=u.ior,u.sheen>0&&(p.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),p.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(p.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,p.sheenColorMapTransform)),u.sheenRoughnessMap&&(p.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,p.sheenRoughnessMapTransform))),u.clearcoat>0&&(p.clearcoat.value=u.clearcoat,p.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(p.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,p.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(p.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===xt&&p.clearcoatNormalScale.value.negate())),u.dispersion>0&&(p.dispersion.value=u.dispersion),u.iridescence>0&&(p.iridescence.value=u.iridescence,p.iridescenceIOR.value=u.iridescenceIOR,p.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(p.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,p.iridescenceMapTransform)),u.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),u.transmission>0&&(p.transmission.value=u.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),u.transmissionMap&&(p.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,p.transmissionMapTransform)),p.thickness.value=u.thickness,u.thicknessMap&&(p.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=u.attenuationDistance,p.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(p.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(p.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=u.specularIntensity,p.specularColor.value.copy(u.specularColor),u.specularColorMap&&(p.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,p.specularColorMapTransform)),u.specularIntensityMap&&(p.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,p.specularIntensityMapTransform))}function _(p,u){u.matcap&&(p.matcap.value=u.matcap)}function M(p,u){const b=e.get(u).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function mp(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,T){const S=T.program;n.uniformBlockBinding(b,S)}function c(b,T){let S=r[b.id];S===void 0&&(_(b),S=h(b),r[b.id]=S,b.addEventListener("dispose",p));const F=T.program;n.updateUBOMapping(b,F);const R=e.render.frame;s[b.id]!==R&&(d(b),s[b.id]=R)}function h(b){const T=f();b.__bindingPointIndex=T;const S=i.createBuffer(),F=b.__size,R=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,F,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,S),S}function f(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const T=r[b.id],S=b.uniforms,F=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let R=0,w=S.length;R<w;R++){const I=Array.isArray(S[R])?S[R]:[S[R]];for(let E=0,x=I.length;E<x;E++){const A=I[E];if(m(A,R,E,F)===!0){const W=A.__offset,z=Array.isArray(A.value)?A.value:[A.value];let G=0;for(let Z=0;Z<z.length;Z++){const k=z[Z],J=M(k);typeof k=="number"||typeof k=="boolean"?(A.__data[0]=k,i.bufferSubData(i.UNIFORM_BUFFER,W+G,A.__data)):k.isMatrix3?(A.__data[0]=k.elements[0],A.__data[1]=k.elements[1],A.__data[2]=k.elements[2],A.__data[3]=0,A.__data[4]=k.elements[3],A.__data[5]=k.elements[4],A.__data[6]=k.elements[5],A.__data[7]=0,A.__data[8]=k.elements[6],A.__data[9]=k.elements[7],A.__data[10]=k.elements[8],A.__data[11]=0):(k.toArray(A.__data,G),G+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,W,A.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(b,T,S,F){const R=b.value,w=T+"_"+S;if(F[w]===void 0)return typeof R=="number"||typeof R=="boolean"?F[w]=R:F[w]=R.clone(),!0;{const I=F[w];if(typeof R=="number"||typeof R=="boolean"){if(I!==R)return F[w]=R,!0}else if(I.equals(R)===!1)return I.copy(R),!0}return!1}function _(b){const T=b.uniforms;let S=0;const F=16;for(let w=0,I=T.length;w<I;w++){const E=Array.isArray(T[w])?T[w]:[T[w]];for(let x=0,A=E.length;x<A;x++){const W=E[x],z=Array.isArray(W.value)?W.value:[W.value];for(let G=0,Z=z.length;G<Z;G++){const k=z[G],J=M(k),H=S%F,te=H%J.boundary,ce=H+te;S+=te,ce!==0&&F-ce<J.storage&&(S+=F-ce),W.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=S,S+=J.storage}}}const R=S%F;return R>0&&(S+=F-R),b.__size=S,b.__cache={},this}function M(b){const T={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(T.boundary=4,T.storage=4):b.isVector2?(T.boundary=8,T.storage=8):b.isVector3||b.isColor?(T.boundary=16,T.storage=12):b.isVector4?(T.boundary=16,T.storage=16):b.isMatrix3?(T.boundary=48,T.storage=48):b.isMatrix4?(T.boundary=64,T.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),T}function p(b){const T=b.target;T.removeEventListener("dispose",p);const S=a.indexOf(T.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[T.id]),delete r[T.id],delete s[T.id]}function u(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:u}}class Up{constructor(e={}){const{canvas:t=tc(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const _=new Uint32Array(4),M=new Int32Array(4);let p=null,u=null;const b=[],T=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=wt,this.toneMapping=_n,this.toneMappingExposure=1;const S=this;let F=!1,R=0,w=0,I=null,E=-1,x=null;const A=new qe,W=new qe;let z=null;const G=new Ue(0);let Z=0,k=t.width,J=t.height,H=1,te=null,ce=null;const xe=new qe(0,0,k,J),Ie=new qe(0,0,k,J);let ke=!1;const q=new qs;let ee=!1,ge=!1;const re=new Ze,ye=new Ze,Ae=new U,Ne=new qe,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ze=!1;function it(){return I===null?H:1}let L=n;function Tt(v,P){return t.getContext(v,P)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ns}`),t.addEventListener("webglcontextlost",K,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",ae,!1),L===null){const P="webgl2";if(L=Tt(P,v),L===null)throw Tt(P)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw console.error("THREE.WebGLRenderer: "+v.message),v}let Fe,Oe,Se,Je,Me,y,g,N,Y,$,X,_e,se,ue,He,j,he,Ee,Te,fe,Be,De,$e,C;function ie(){Fe=new Sf(L),Fe.init(),De=new ap(L,Fe),Oe=new mf(L,Fe,e,De),Se=new ip(L,Fe),Oe.reverseDepthBuffer&&d&&Se.buffers.depth.setReversed(!0),Je=new Tf(L),Me=new Gd,y=new sp(L,Fe,Se,Me,Oe,De,Je),g=new _f(S),N=new Mf(S),Y=ne
vendor: 4,154 bytes, line 3828
3828w Pc(L),$e=new df(L,Y),$=new Ef(L,Y,Je,$e),X=new Af(L,$,Y,Je),Te=new bf(L,Oe,y),j=new gf(Me),_e=new Vd(S,g,N,Fe,Oe,$e,j),se=new pp(S,Me),ue=new Wd,He=new $d(Fe),Ee=new ff(S,g,N,Se,X,m,l),he=new tp(S,X,Oe),C=new mp(L,Je,Oe,Se),fe=new pf(L,Fe,Je),Be=new yf(L,Fe,Je),Je.programs=_e.programs,S.capabilities=Oe,S.extensions=Fe,S.properties=Me,S.renderLists=ue,S.shadowMap=he,S.state=Se,S.info=Je}ie();const V=new fp(S,L);this.xr=V,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const v=Fe.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Fe.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(v){v!==void 0&&(H=v,this.setSize(k,J,!1))},this.getSize=function(v){return v.set(k,J)},this.setSize=function(v,P,O=!0){if(V.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}k=v,J=P,t.width=Math.floor(v*H),t.height=Math.floor(P*H),O===!0&&(t.style.width=v+"px",t.style.height=P+"px"),this.setViewport(0,0,v,P)},this.getDrawingBufferSize=function(v){return v.set(k*H,J*H).floor()},this.setDrawingBufferSize=function(v,P,O){k=v,J=P,H=O,t.width=Math.floor(v*O),t.height=Math.floor(P*O),this.setViewport(0,0,v,P)},this.getCurrentViewport=function(v){return v.copy(A)},this.getViewport=function(v){return v.copy(xe)},this.setViewport=function(v,P,O,B){v.isVector4?xe.set(v.x,v.y,v.z,v.w):xe.set(v,P,O,B),Se.viewport(A.copy(xe).multiplyScalar(H).round())},this.getScissor=function(v){return v.copy(Ie)},this.setScissor=function(v,P,O,B){v.isVector4?Ie.set(v.x,v.y,v.z,v.w):Ie.set(v,P,O,B),Se.scissor(W.copy(Ie).multiplyScalar(H).round())},this.getScissorTest=function(){return ke},this.setScissorTest=function(v){Se.setScissorTest(ke=v)},this.setOpaqueSort=function(v){te=v},this.setTransparentSort=function(v){ce=v},this.getClearColor=function(v){return v.copy(Ee.getClearColor())},this.setClearColor=function(){Ee.setClearColor.apply(Ee,arguments)},this.getClearAlpha=function(){return Ee.getClearAlpha()},this.setClearAlpha=function(){Ee.setClearAlpha.apply(Ee,arguments)},this.clear=function(v=!0,P=!0,O=!0){let B=0;if(v){let D=!1;if(I!==null){const Q=I.texture.format;D=Q===Vs||Q===Hs||Q===zs}if(D){const Q=I.texture.type,oe=Q===an||Q===Dn||Q===Ei||Q===ni||Q===Os||Q===Bs,de=Ee.getClearColor(),pe=Ee.getClearAlpha(),be=de.r,Ce=de.g,me=de.b;oe?(_[0]=be,_[1]=Ce,_[2]=me,_[3]=pe,L.clearBufferuiv(L.COLOR,0,_)):(M[0]=be,M[1]=Ce,M[2]=me,M[3]=pe,L.clearBufferiv(L.COLOR,0,M))}else B|=L.COLOR_BUFFER_BIT}P&&(B|=L.DEPTH_BUFFER_BIT),O&&(B|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",K,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",ae,!1),ue.dispose(),He.dispose(),Me.dispose(),g.dispose(),N.dispose(),X.dispose(),$e.dispose(),C.dispose(),_e.dispose(),V.dispose(),V.removeEventListener("sessionstart",Ks),V.removeEventListener("sessionend",Zs),xn.stop()};function K(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;const v=Je.autoReset,P=he.enabled,O=he.autoUpdate,B=he.needsUpdate,D=he.type;ie(),Je.autoReset=v,he.enabled=P,he.autoUpdate=O,he.needsUpdate=B,he.type=D}function ae(v){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Re(v){const P=v.target;P.removeEventListener("dispose",Re),nt(P)}function nt(v){ct(v),Me.remove(v)}function ct(v){const P=Me.get(v).programs;P!==void 0&&(P.forEach(function(O){_e.releaseProgram(O)}),v.isShaderMaterial&&_e.releaseShaderCache(v))}this.renderBufferDirect=function(v,P,O,B,D,Q){P===null&&(P=tt);const oe=D.isMesh&&D.matrixWorld.determinant()<0,de=Ko(v,P,O,B,D);Se.setMaterial(B,oe);let pe=O.index,be=1;
vendor: 32,782 bytes, line 3828
3828if(B.wireframe===!0){if(pe=$.getWireframeAttribute(O),pe===void 0)return;be=2}const Ce=O.drawRange,me=O.attributes.position;let Ge=Ce.start*be,je=(Ce.start+Ce.count)*be;Q!==null&&(Ge=Math.max(Ge,Q.start*be),je=Math.min(je,(Q.start+Q.count)*be)),pe!==null?(Ge=Math.max(Ge,0),je=Math.min(je,pe.count)):me!=null&&(Ge=Math.max(Ge,0),je=Math.min(je,me.count));const Qe=je-Ge;if(Qe<0||Qe===1/0)return;$e.setup(D,B,de,O,pe);let _t,We=fe;if(pe!==null&&(_t=Y.get(pe),We=Be,We.setIndex(_t)),D.isMesh)B.wireframe===!0?(Se.setLineWidth(B.wireframeLinewidth*it()),We.setMode(L.LINES)):We.setMode(L.TRIANGLES);else if(D.isLine){let ve=B.linewidth;ve===void 0&&(ve=1),Se.setLineWidth(ve*it()),D.isLineSegments?We.setMode(L.LINES):D.isLineLoop?We.setMode(L.LINE_LOOP):We.setMode(L.LINE_STRIP)}else D.isPoints?We.setMode(L.POINTS):D.isSprite&&We.setMode(L.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)We.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(Fe.get("WEBGL_multi_draw"))We.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ve=D._multiDrawStarts,Xt=D._multiDrawCounts,Xe=D._multiDrawCount,Pt=pe?Y.get(pe).bytesPerElement:1,Ln=Me.get(B).currentProgram.getUniforms();for(let Mt=0;Mt<Xe;Mt++)Ln.setValue(L,"_gl_DrawID",Mt),We.render(ve[Mt]/Pt,Xt[Mt])}else if(D.isInstancedMesh)We.renderInstances(Ge,Qe,D.count);else if(O.isInstancedBufferGeometry){const ve=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,Xt=Math.min(O.instanceCount,ve);We.renderInstances(Ge,Qe,Xt)}else We.render(Ge,Qe)};function Ye(v,P,O){v.transparent===!0&&v.side===Jt&&v.forceSinglePass===!1?(v.side=xt,v.needsUpdate=!0,Di(v,P,O),v.side=vn,v.needsUpdate=!0,Di(v,P,O),v.side=Jt):Di(v,P,O)}this.compile=function(v,P,O=null){O===null&&(O=v),u=He.get(O),u.init(P),T.push(u),O.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(u.pushLight(D),D.castShadow&&u.pushShadow(D))}),v!==O&&v.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(u.pushLight(D),D.castShadow&&u.pushShadow(D))}),u.setupLights();const B=new Set;return v.traverse(function(D){if(!(D.isMesh||D.isPoints||D.isLine||D.isSprite))return;const Q=D.material;if(Q)if(Array.isArray(Q))for(let oe=0;oe<Q.length;oe++){const de=Q[oe];Ye(de,O,D),B.add(de)}else Ye(Q,O,D),B.add(Q)}),T.pop(),u=null,B},this.compileAsync=function(v,P,O=null){const B=this.compile(v,P,O);return new Promise(D=>{function Q(){if(B.forEach(function(oe){Me.get(oe).currentProgram.isReady()&&B.delete(oe)}),B.size===0){D(v);return}setTimeout(Q,10)}Fe.get("KHR_parallel_shader_compile")!==null?Q():setTimeout(Q,10)})};let Ct=null;function Wt(v){Ct&&Ct(v)}function Ks(){xn.stop()}function Zs(){xn.start()}const xn=new Oo;xn.setAnimationLoop(Wt),typeof self<"u"&&xn.setContext(self),this.setAnimationLoop=function(v){Ct=v,V.setAnimationLoop(v),v===null?xn.stop():xn.start()},V.addEventListener("sessionstart",Ks),V.addEventListener("sessionend",Zs),this.render=function(v,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),V.enabled===!0&&V.isPresenting===!0&&(V.cameraAutoUpdate===!0&&V.updateCamera(P),P=V.getCamera()),v.isScene===!0&&v.onBeforeRender(S,v,P,I),u=He.get(v,T.length),u.init(P),T.push(u),ye.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),q.setFromProjectionMatrix(ye),ge=this.localClippingEnabled,ee=j.init(this.clippingPlanes,ge),p=ue.get(v,b.length),p.init(),b.push(p),V.enabled===!0&&V.isPresenting===!0){const Q=S.xr.getDepthSensingMesh();Q!==null&&gr(Q,P,-1/0,S.sortObjects)}gr(v,P,0,S.sortObjects),p.finish(),S.sortObjects===!0&&p.sort(te,ce),ze=V.enabled===!1||V.isPresenting===!1||V.hasDepthSensing()===!1,ze&&Ee.addToRenderList(p,v),this.info.render.frame++,ee===!0&&j.beginShadows();const O=u.state.shadowsArray;he.render(O,v,P),ee===!0&&j.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=p.opaque,D=p.transmissive;if(u.setupLights(),P.isArrayCamera){const Q=P.cameras;if(D.length>0)for(let oe=0,de=Q.length;oe<de;oe++){const pe=Q[oe];js(B,D,v,pe)}ze&&Ee.render(v);for(let oe=0,de=Q.length;oe<de;oe++){const pe=Q[oe];$s(p,v,pe,pe.viewport)}}else D.length>0&&js(B,D,v,P),ze&&Ee.render(v),$s(p,v,P);I!==null&&(y.updateMultisampleRenderTarget(I),y.updateRenderTargetMipmap(I)),v.isScene===!0&&v.onAfterRender(S,v,P),$e.resetDefaultState(),E=-1,x=null,T.pop(),T.length>0?(u=T[T.length-1],ee===!0&&j.setGlobalState(S.clippingPlanes,u.state.camera)):u=null,b.pop(),b.length>0?p=b[b.length-1]:p=null};function gr(v,P,O,B){if(v.visible===!1)return;if(v.layers.test(P.layers)){if(v.isGroup)O=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(P);else if(v.isLight)u.pushLight(v),v.castShadow&&u.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||q.intersectsSprite(v)){B&&Ne.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ye);const oe=X.update(v),de=v.material;de.visible&&p.push(v,oe,de,O,Ne.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||q.intersectsObject(v))){const oe=X.update(v),de=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),Ne.copy(v.boundingSphere.center)):(oe.boundingSphere===null&&oe.computeBoundingSphere(),Ne.copy(oe.boundingSphere.center)),Ne.applyMatrix4(v.matrixWorld).applyMatrix4(ye)),Array.isArray(de)){const pe=oe.groups;for(let be=0,Ce=pe.length;be<Ce;be++){const me=pe[be],Ge=de[me.materialIndex];Ge&&Ge.visible&&p.push(v,oe,Ge,O,Ne.z,me)}}else de.visible&&p.push(v,oe,de,O,Ne.z,null)}}const Q=v.children;for(let oe=0,de=Q.length;oe<de;oe++)gr(Q[oe],P,O,B)}function $s(v,P,O,B){const D=v.opaque,Q=v.transmissive,oe=v.transparent;u.setupLightsView(O),ee===!0&&j.setGlobalState(S.clippingPlanes,O),B&&Se.viewport(A.copy(B)),D.length>0&&Pi(D,P,O),Q.length>0&&Pi(Q,P,O),oe.length>0&&Pi(oe,P,O),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function js(v,P,O,B){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;u.state.transmissionRenderTarget[B.id]===void 0&&(u.state.transmissionRenderTarget[B.id]=new Rt(1,1,{generateMipmaps:!0,type:Fe.has("EXT_color_buffer_half_float")||Fe.has("EXT_color_buffer_float")?Vt:an,minFilter:Pn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace}));const Q=u.state.transmissionRenderTarget[B.id],oe=B.viewport||A;Q.setSize(oe.z,oe.w);const de=S.getRenderTarget();S.setRenderTarget(Q),S.getClearColor(G),Z=S.getClearAlpha(),Z<1&&S.setClearColor(16777215,.5),S.clear(),ze&&Ee.render(O);const pe=S.toneMapping;S.toneMapping=_n;const be=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),u.setupLightsView(B),ee===!0&&j.setGlobalState(S.clippingPlanes,B),Pi(v,O,B),y.updateMultisampleRenderTarget(Q),y.updateRenderTargetMipmap(Q),Fe.has("WEBGL_multisampled_render_to_texture")===!1){let Ce=!1;for(let me=0,Ge=P.length;me<Ge;me++){const je=P[me],Qe=je.object,_t=je.geometry,We=je.material,ve=je.group;if(We.side===Jt&&Qe.layers.test(B.layers)){const Xt=We.side;We.side=xt,We.needsUpdate=!0,Js(Qe,O,B,_t,We,ve),We.side=Xt,We.needsUpdate=!0,Ce=!0}}Ce===!0&&(y.updateMultisampleRenderTarget(Q),y.updateRenderTargetMipmap(Q))}S.setRenderTarget(de),S.setClearColor(G,Z),be!==void 0&&(B.viewport=be),S.toneMapping=pe}function Pi(v,P,O){const B=P.isScene===!0?P.overrideMaterial:null;for(let D=0,Q=v.length;D<Q;D++){const oe=v[D],de=oe.object,pe=oe.geometry,be=B===null?oe.material:B,Ce=oe.group;de.layers.test(O.layers)&&Js(de,P,O,pe,be,Ce)}}function Js(v,P,O,B,D,Q){v.onBeforeRender(S,P,O,B,D,Q),v.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),D.onBeforeRender(S,P,O,B,v,Q),D.transparent===!0&&D.side===Jt&&D.forceSinglePass===!1?(D.side=xt,D.needsUpdate=!0,S.renderBufferDirect(O,P,B,D,v,Q),D.side=vn,D.needsUpdate=!0,S.renderBufferDirect(O,P,B,D,v,Q),D.side=Jt):S.renderBufferDirect(O,P,B,D,v,Q),v.onAfterRender(S,P,O,B,D,Q)}function Di(v,P,O){P.isScene!==!0&&(P=tt);const B=Me.get(v),D=u.state.lights,Q=u.state.shadowsArray,oe=D.state.version,de=_e.getParameters(v,D.state,Q,P,O),pe=_e.getProgramCacheKey(de);let be=B.programs;B.environment=v.isMeshStandardMaterial?P.environment:null,B.fog=P.fog,B.envMap=(v.isMeshStandardMaterial?N:g).get(v.envMap||B.environment),B.envMapRotation=B.environment!==null&&v.envMap===null?P.environmentRotation:v.envMapRotation,be===void 0&&(v.addEventListener("dispose",Re),be=new Map,B.programs=be);let Ce=be.get(pe);if(Ce!==void 0){if(B.currentProgram===Ce&&B.lightsStateVersion===oe)return ea(v,de),Ce}else de.uniforms=_e.getUniforms(v),v.onBeforeCompile(de,S),Ce=_e.acquireProgram(de,pe),be.set(pe,Ce),B.uniforms=de.uniforms;const me=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(me.clippingPlanes=j.uniform),ea(v,de),B.needsLights=$o(v),B.lightsStateVersion=oe,B.needsLights&&(me.ambientLightColor.value=D.state.ambient,me.lightProbe.value=D.state.probe,me.directionalLights.value=D.state.directional,me.directionalLightShadows.value=D.state.directionalShadow,me.spotLights.value=D.state.spot,me.spotLightShadows.value=D.state.spotShadow,me.rectAreaLights.value=D.state.rectArea,me.ltc_1.value=D.state.rectAreaLTC1,me.ltc_2.value=D.state.rectAreaLTC2,me.pointLights.value=D.state.point,me.pointLightShadows.value=D.state.pointShadow,me.hemisphereLights.value=D.state.hemi,me.directionalShadowMap.value=D.state.directionalShadowMap,me.directionalShadowMatrix.value=D.state.directionalShadowMatrix,me.spotShadowMap.value=D.state.spotShadowMap,me.spotLightMatrix.value=D.state.spotLightMatrix,me.spotLightMap.value=D.state.spotLightMap,me.pointShadowMap.value=D.state.pointShadowMap,me.pointShadowMatrix.value=D.state.pointShadowMatrix),B.currentProgram=Ce,B.uniformsList=null,Ce}function Qs(v){if(v.uniformsList===null){const P=v.currentProgram.getUniforms();v.uniformsList=ar.seqWithValue(P.seq,v.uniforms)}return v.uniformsList}function ea(v,P){const O=Me.get(v);O.outputColorSpace=P.outputColorSpace,O.batching=P.batching,O.batchingColor=P.batchingColor,O.instancing=P.instancing,O.instancingColor=P.instancingColor,O.instancingMorph=P.instancingMorph,O.skinning=P.skinning,O.morphTargets=P.morphTargets,O.morphNormals=P.morphNormals,O.morphColors=P.morphColors,O.morphTargetsCount=P.morphTargetsCount,O.numClippingPlanes=P.numClippingPlanes,O.numIntersection=P.numClipIntersection,O.vertexAlphas=P.vertexAlphas,O.vertexTangents=P.vertexTangents,O.toneMapping=P.toneMapping}function Ko(v,P,O,B,D){P.isScene!==!0&&(P=tt),y.resetTextureUnits();const Q=P.fog,oe=B.isMeshStandardMaterial?P.environment:null,de=I===null?S.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:ai,pe=(B.isMeshStandardMaterial?N:g).get(B.envMap||oe),be=B.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,Ce=!!O.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),me=!!O.morphAttributes.position,Ge=!!O.morphAttributes.normal,je=!!O.morphAttributes.color;let Qe=_n;B.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(Qe=S.toneMapping);const _t=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,We=_t!==void 0?_t.length:0,ve=Me.get(B),Xt=u.state.lights;if(ee===!0&&(ge===!0||v!==x)){const bt=v===x&&B.id===E;j.setState(B,v,bt)}let Xe=!1;B.version===ve.__version?(ve.needsLights&&ve.lightsStateVersion!==Xt.state.version||ve.outputColorSpace!==de||D.isBatchedMesh&&ve.batching===!1||!D.isBatchedMesh&&ve.batching===!0||D.isBatchedMesh&&ve.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&ve.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&ve.instancing===!1||!D.isInstancedMesh&&ve.instancing===!0||D.isSkinnedMesh&&ve.skinning===!1||!D.isSkinnedMesh&&ve.skinning===!0||D.isInstancedMesh&&ve.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&ve.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&ve.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&ve.instancingMorph===!1&&D.morphTexture!==null||ve.envMap!==pe||B.fog===!0&&ve.fog!==Q||ve.numClippingPlanes!==void 0&&(ve.numClippingPlanes!==j.numPlanes||ve.numIntersection!==j.numIntersection)||ve.vertexAlphas!==be||ve.vertexTangents!==Ce||ve.morphTargets!==me||ve.morphNormals!==Ge||ve.morphColors!==je||ve.toneMapping!==Qe||ve.morphTargetsCount!==We)&&(Xe=!0):(Xe=!0,ve.__version=B.version);let Pt=ve.currentProgram;Xe===!0&&(Pt=Di(B,P,D));let Ln=!1,Mt=!1,hi=!1;const et=Pt.getUniforms(),Bt=ve.uniforms;if(Se.useProgram(Pt.program)&&(Ln=!0,Mt=!0,hi=!0),B.id!==E&&(E=B.id,Mt=!0),Ln||x!==v){Se.buffers.depth.getReversed()?(re.copy(v.projectionMatrix),ic(re),rc(re),et.setValue(L,"projectionMatrix",re)):et.setValue(L,"projectionMatrix",v.projectionMatrix),et.setValue(L,"viewMatrix",v.matrixWorldInverse);const on=et.map.cameraPosition;on!==void 0&&on.setValue(L,Ae.setFromMatrixPosition(v.matrixWorld)),Oe.logarithmicDepthBuffer&&et.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&et.setValue(L,"isOrthographic",v.isOrthographicCamera===!0),x!==v&&(x=v,Mt=!0,hi=!0)}if(D.isSkinnedMesh){et.setOptional(L,D,"bindMatrix"),et.setOptional(L,D,"bindMatrixInverse");const bt=D.skeleton;bt&&(bt.boneTexture===null&&bt.computeBoneTexture(),et.setValue(L,"boneTexture",bt.boneTexture,y))}D.isBatchedMesh&&(et.setOptional(L,D,"batchingTexture"),et.setValue(L,"batchingTexture",D._matricesTexture,y),et.setOptional(L,D,"batchingIdTexture"),et.setValue(L,"batchingIdTexture",D._indirectTexture,y),et.setOptional(L,D,"batchingColorTexture"),D._colorsTexture!==null&&et.setValue(L,"batchingColorTexture",D._colorsTexture,y));const fi=O.morphAttributes;if((fi.position!==void 0||fi.normal!==void 0||fi.color!==void 0)&&Te.update(D,O,Pt),(Mt||ve.receiveShadow!==D.receiveShadow)&&(ve.receiveShadow=D.receiveShadow,et.setValue(L,"receiveShadow",D.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Bt.envMap.value=pe,Bt.flipEnvMap.value=pe.isCubeTexture&&pe.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&P.environment!==null&&(Bt.envMapIntensity.value=P.environmentIntensity),Mt&&(et.setValue(L,"toneMappingExposure",S.toneMappingExposure),ve.needsLights&&Zo(Bt,hi),Q&&B.fog===!0&&se.refreshFogUniforms(Bt,Q),se.refreshMaterialUniforms(Bt,B,H,J,u.state.transmissionRenderTarget[v.id]),ar.upload(L,Qs(ve),Bt,y)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(ar.upload(L,Qs(ve),Bt,y),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&et.setValue(L,"center",D.center),et.setValue(L,"modelViewMatrix",D.modelViewMatrix),et.setValue(L,"normalMatrix",D.normalMatrix),et.setValue(L,"modelMatrix",D.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const bt=B.uniformsGroups;for(let on=0,ln=bt.length;on<ln;on++){const ta=bt[on];C.update(ta,Pt),C.bind(ta,Pt)}}return Pt}function Zo(v,P){v.ambientLightColor.needsUpdate=P,v.lightProbe.needsUpdate=P,v.directionalLights.needsUpdate=P,v.directionalLightShadows.needsUpdate=P,v.pointLights.needsUpdate=P,v.pointLightShadows.needsUpdate=P,v.spotLights.needsUpdate=P,v.spotLightShadows.needsUpdate=P,v.rectAreaLights.needsUpdate=P,v.hemisphereLights.needsUpdate=P}function $o(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(v,P,O){Me.get(v.texture).__webglTexture=P,Me.get(v.depthTexture).__webglTexture=O;const B=Me.get(v);B.__hasExternalTextures=!0,B.__autoAllocateDepthBuffer=O===void 0,B.__autoAllocateDepthBuffer||Fe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),B.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(v,P){const O=Me.get(v);O.__webglFramebuffer=P,O.__useDefaultFramebuffer=P===void 0},this.setRenderTarget=function(v,P=0,O=0){I=v,R=P,w=O;let B=!0,D=null,Q=!1,oe=!1;if(v){const pe=Me.get(v);if(pe.__useDefaultFramebuffer!==void 0)Se.bindFramebuffer(L.FRAMEBUFFER,null),B=!1;else if(pe.__webglFramebuffer===void 0)y.setupRenderTarget(v);else if(pe.__hasExternalTextures)y.rebindTextures(v,Me.get(v.texture).__webglTexture,Me.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const me=v.depthTexture;if(pe.__boundDepthTexture!==me){if(me!==null&&Me.has(me)&&(v.width!==me.image.width||v.height!==me.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");y.setupDepthRenderbuffer(v)}}const be=v.texture;(be.isData3DTexture||be.isDataArrayTexture||be.isCompressedArrayTexture)&&(oe=!0);const Ce=Me.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Ce[P])?D=Ce[P][O]:D=Ce[P],Q=!0):v.samples>0&&y.useMultisampledRTT(v)===!1?D=Me.get(v).__webglMultisampledFramebuffer:Array.isArray(Ce)?D=Ce[O]:D=Ce,A.copy(v.viewport),W.copy(v.scissor),z=v.scissorTest}else A.copy(xe).multiplyScalar(H).floor(),W.copy(Ie).multiplyScalar(H).floor(),z=ke;if(Se.bindFramebuffer(L.FRAMEBUFFER,D)&&B&&Se.drawBuffers(v,D),Se.viewport(A),Se.scissor(W),Se.setScissorTest(z),Q){const pe=Me.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+P,pe.__webglTexture,O)}else if(oe){const pe=Me.get(v.texture),be=P||0;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,pe.__webglTexture,O||0,be)}E=-1},this.readRenderTargetPixels=function(v,P,O,B,D,Q,oe){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let de=Me.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&oe!==void 0&&(de=de[oe]),de){Se.bindFramebuffer(L.FRAMEBUFFER,de);try{const pe=v.texture,be=pe.format,Ce=pe.type;if(!Oe.textureFormatReadable(be)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Oe.textureTypeReadable(Ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=v.width-B&&O>=0&&O<=v.height-D&&L.readPixels(P,O,B,D,De.convert(be),De.convert(Ce),Q)}finally{const pe=I!==null?Me.get(I).__webglFramebuffer:null;Se.bindFramebuffer(L.FRAMEBUFFER,pe)}}},this.readRenderTargetPixelsAsync=async function(v,P,O,B,D,Q,oe){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let de=Me.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&oe!==void 0&&(de=de[oe]),de){const pe=v.texture,be=pe.format,Ce=pe.type;if(!Oe.textureFormatReadable(be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Oe.textureTypeReadable(Ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(P>=0&&P<=v.width-B&&O>=0&&O<=v.height-D){Se.bindFramebuffer(L.FRAMEBUFFER,de);const me=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,me),L.bufferData(L.PIXEL_PACK_BUFFER,Q.byteLength,L.STREAM_READ),L.readPixels(P,O,B,D,De.convert(be),De.convert(Ce),0);const Ge=I!==null?Me.get(I).__webglFramebuffer:null;Se.bindFramebuffer(L.FRAMEBUFFER,Ge);const je=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await nc(L,je,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,me),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,Q),L.deleteBuffer(me),L.deleteSync(je),Q}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(v,P=null,O=0){v.isTexture!==!0&&(vi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),P=arguments[0]||null,v=arguments[1]);const B=Math.pow(2,-O),D=Math.floor(v.image.width*B),Q=Math.floor(v.image.height*B),oe=P!==null?P.x:0,de=P!==null?P.y:0;y.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,O,0,0,oe,de,D,Q),Se.unbindTexture()},this.copyTextureToTexture=function(v,P,O=null,B=null,D=0){v.isTexture!==!0&&(vi("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,v=arguments[1],P=arguments[2],D=arguments[3]||0,O=null);let Q,oe,de,pe,be,Ce,me,Ge,je;const Qe=v.isCompressedTexture?v.mipmaps[D]:v.image;O!==null?(Q=O.max.x-O.min.x,oe=O.max.y-O.min.y,de=O.isBox3?O.max.z-O.min.z:1,pe=O.min.x,be=O.min.y,Ce=O.isBox3?O.min.z:0):(Q=Qe.width,oe=Qe.height,de=Qe.depth||1,pe=0,be=0,Ce=0),B!==null?(me=B.x,Ge=B.y,je=B.z):(me=0,Ge=0,je=0);const _t=De.convert(P.format),We=De.convert(P.type);let ve;P.isData3DTexture?(y.setTexture3D(P,0),ve=L.TEXTURE_3D):P.isDataArrayTexture||P.isCompressedArrayTexture?(y.setTexture2DArray(P,0),ve=L.TEXTURE_2D_ARRAY):(y.setTexture2D(P,0),ve=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,P.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,P.unpackAlignment);const Xt=L.getParameter(L.UNPACK_ROW_LENGTH),Xe=L.getParameter(L.UNPACK_IMAGE_HEIGHT),Pt=L.getParameter(L.UNPACK_SKIP_PIXELS),Ln=L.getParameter(L.UNPACK_SKIP_ROWS),Mt=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,Qe.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Qe.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,pe),L.pixelStorei(L.UNPACK_SKIP_ROWS,be),L.pixelStorei(L.UNPACK_SKIP_IMAGES,Ce);const hi=v.isDataArrayTexture||v.isData3DTexture,et=P.isDataArrayTexture||P.isData3DTexture;if(v.isRenderTargetTexture||v.isDepthTexture){const Bt=Me.get(v),fi=Me.get(P),bt=Me.get(Bt.__renderTarget),on=Me.get(fi.__renderTarget);Se.bindFramebuffer(L.READ_FRAMEBUFFER,bt.__webglFramebuffer),Se.bindFramebuffer(L.DRAW_FRAMEBUFFER,on.__webglFramebuffer);for(let ln=0;ln<de;ln++)hi&&L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Me.get(v).__webglTexture,D,Ce+ln),v.isDepthTexture?(et&&L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Me.get(P).__webglTexture,D,je+ln),L.blitFramebuffer(pe,be,Q,oe,me,Ge,Q,oe,L.DEPTH_BUFFER_BIT,L.NEAREST)):et?L.copyTexSubImage3D(ve,D,me,Ge,je+ln,pe,be,Q,oe):L.copyTexSubImage2D(ve,D,me,Ge,je+ln,pe,be,Q,oe);Se.bindFramebuffer(L.READ_FRAMEBUFFER,null),Se.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else et?v.isDataTexture||v.isData3DTexture?L.texSubImage3D(ve,D,me,Ge,je,Q,oe,de,_t,We,Qe.data):P.isCompressedArrayTexture?L.compressedTexSubImage3D(ve,D,me,Ge,je,Q,oe,de,_t,Qe.data):L.texSubImage3D(ve,D,me,Ge,je,Q,oe,de,_t,We,Qe):v.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,D,me,Ge,Q,oe,_t,We,Qe.data):v.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,D,me,Ge,Qe.width,Qe.height,_t,Qe.data):L.texSubImage2D(L.TEXTURE_2D,D,me,Ge,Q,oe,_t,We,Qe);L.pixelStorei(L.UNPACK_ROW_LENGTH,Xt),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Xe),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Pt),L.pixelStorei(L.UNPACK_SKIP_ROWS,Ln),L.pixelStorei(L.UNPACK_SKIP_IMAGES,Mt),D===0&&P.generateMipmaps&&L.generateMipmap(ve),Se.unbindTexture()},this.copyTextureToTexture3D=function(v,P,O=null,B=null,D=0){return v.isTexture!==!0&&(vi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),O=arguments[0]||null,B=arguments[1]||null,v=arguments[2],P=arguments[3],D=arguments[4]||0),vi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(v,P,O,B,D)},this.initRenderTarget=function(v){Me.get(v).__webglFramebuffer===void 0&&y.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?y.setTextureCube(v,0):v.isData3DTexture?y.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?y.setTexture2DArray(v,0):y.setTexture2D(v,0),Se.unbindTexture()},this.resetState=function(){R=0,w=0,I=null,Se.reset(),$e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}class Wo{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ue(e),this.density=t}clone(){return new Wo(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ip extends lt{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 Gt,this.environmentIntensity=1,this.environmentRotation=new Gt,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Np extends pt{constructor(e=null,t=1,n=1,r,s,a,o,l,c=yt,h=yt,f,d){super(null,a,o,l,c,h,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class gp extends ci{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Ue(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const eo=new Ze,Us=new ks,Qi=new fr,er=new U;class _p extends lt{constructor(e=new kt,t=new gp){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Qi.copy(n.boundingSphere),Qi.applyMatrix4(r),Qi.radius+=s,e.ray.intersectsSphere(Qi)===!1)return;eo.copy(r).invert(),Us.copy(e.ray).applyMatrix4(eo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,f=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let _=d,M=m;_<M;_++){const p=c.getX(_);er.fromBufferAttribute(f,p),to(er,p,l,r,e,t,this)}}else{const d=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count);for(let _=d,M=m;_<M;_++)er.fromBufferAttribute(f,_),to(er,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function to(i,e,t,n,r,s,a){const o=Us.distanceSqToPoint(i);if(o<t){const l=new U;Us.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Fp extends pt{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class vp extends dt{static get type(){return"RawShaderMaterial"}constructor(e){super(e),this.isRawShaderMaterial=!0}}class Op extends ci{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new Ue(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 Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new we(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 Gt,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class pr extends lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ue(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const Xr=new Ze,no=new U,io=new U;class Xo{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.map=null,this.mapPass=null,this.matrix=new Ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qs,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;no.setFromMatrixPosition(e.matrixWorld),t.position.copy(no),io.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(io),t.updateMatrixWorld(),Xr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Xr)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radiu
vendor: 4,141 bytes, line 3828
3828s=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class xp extends Xo{constructor(){super(new vt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ri*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Bp extends pr{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new xp}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const ro=new Ze,_i=new U,qr=new U;class Mp extends Xo{constructor(){super(new vt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new we(4,2),this._viewportCount=6,this._viewports=[new qe(2,1,1,1),new qe(0,1,1,1),new qe(3,1,1,1),new qe(1,1,1,1),new qe(3,0,1,1),new qe(1,0,1,1)],this._cubeDirections=[new U(1,0,0),new U(-1,0,0),new U(0,0,1),new U(0,0,-1),new U(0,1,0),new U(0,-1,0)],this._cubeUps=[new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,0,1),new U(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),_i.setFromMatrixPosition(e.matrixWorld),n.position.copy(_i),qr.copy(n.position),qr.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(qr),n.updateMatrixWorld(),r.makeTranslation(-_i.x,-_i.y,-_i.z),ro.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ro)}}class zp extends pr{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Mp}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Hp extends pr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Vp extends pr{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Sp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=so(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=so();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function so(){return performance.now()}const ao=new Ze;class Gp{constructor(e,t,n=0,r=1/0){this.ray=new ks(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Ws,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster:
3828Unsupported camera type: "+t.type)}setFromXRController(e){return ao.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ao),this}intersectObject(e,t=!0,n=[]){return Is(e,this,n,t),n.sort(oo),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Is(e[r],this,n,t);return n.sort(oo),n}}function oo(i,e){return i.distance-e.distance}function Is(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)Is(s[a],e,t,!0)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ns}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ns);const qo={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` 3829 3830 varying vec2 vUv; 3831 3832 void main() { 3833 3834 vUv = uv; 3835 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3836 3837 }`,fragmentShader:` 3838 3839 uniform float opacity; 3840 3841 uniform sampler2D tDiffuse; 3842 3843 varying vec2 vUv; 3844 3845 void main() { 3846 3847 vec4 texel = texture2D( tDiffuse, vUv ); 3848 gl_FragColor = opacity * texel; 3849 3850 3851 }`};class Ci{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Ep=new Bo(-1,1,1,-1,0,1);class yp extends kt{constructor(){super(),this.setAttribute("position",new sn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new sn([0,2,0,0,2,0],2))}}const Tp=new yp;class Yo{constructor(e){this._mesh=new Ft(Tp,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Ep)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class bp extends Ci{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof dt?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=yi.clone(e.uniforms),this.material=new dt({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Yo(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class lo extends Ci{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(o),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class Ap extends Ci{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class kp{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new we);this._width=n.width,this._height=n.height,t=new Rt(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Vt}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new bp(qo),this.copyPass.material.blending=nn,this.clock=new Sp}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;
vendor: 6,248 bytes, lines 3851-3883
3851l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}lo!==void 0&&(a instanceof lo?n=!0:a instanceof Ap&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new we);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class Wp extends Ci{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Ue}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}const wp={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Ue(0)},defaultOpacity:{value:0}},vertexShader:` 3852 3853 varying vec2 vUv; 3854 3855 void main() { 3856 3857 vUv = uv; 3858 3859 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3860 3861 }`,fragmentShader:` 3862 3863 uniform sampler2D tDiffuse; 3864 uniform vec3 defaultColor; 3865 uniform float defaultOpacity; 3866 uniform float luminosityThreshold; 3867 uniform float smoothWidth; 3868 3869 varying vec2 vUv; 3870 3871 void main() { 3872 3873 vec4 texel = texture2D( tDiffuse, vUv ); 3874 3875 float v = luminance( texel.xyz ); 3876 3877 vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity ); 3878 3879 float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v ); 3880 3881 gl_FragColor = mix( outputColor, texel, alpha ); 3882 3883 }`};class Ti extends Ci{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new we(e.x,e.y):new we(256,256),this.clearColor=new Ue(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Rt(s,a,{type:Vt}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let f=0;f<this.nMips;f++){const d=new Rt(s,a,{type:Vt});d.texture.name="UnrealBloomPass.h"+f,d.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(d);const m=new Rt(s,a,{type:Vt});m.texture.name="UnrealBloomPass.v"+f,m.texture.generateMipmaps=!1,this.renderTargetsVertical.push(m),s=Math.round(s/2),a=Math.round(a/2)}const o=wp;this.highPassUniforms=yi.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new dt({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let f=0;f<this.nMips;f++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[f])),this.separableBlurMaterials[f].uniforms.invSize.value=new we(1/s,1/a),s=Math.round(s/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new U(1,1,1),new U(1,1,1),new U(1,1,1),new U(1,1,1),new U(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const h=qo;this.copyUniforms=yi.clone(h.uniforms),this.blendMaterial=new dt({uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:or,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Ue,this.oldClearAlpha=1,this.basic=new Xs,this.fsQuad=new Yo(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.invSize.value=new we(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}
vendor: 4,564 bytes, lines 3883-3932
3883render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=Ti.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=Ti.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new dt({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new we(.5,.5)},direction:{value:new we(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv; 3884 void main() { 3885 vUv = uv; 3886 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3887 }`,fragmentShader:`#include <common> 3888 varying vec2 vUv; 3889 uniform sampler2D colorTexture; 3890 uniform vec2 invSize; 3891 uniform vec2 direction; 3892 uniform float gaussianCoefficients[KERNEL_RADIUS]; 3893 3894 void main() { 3895 float weightSum = gaussianCoefficients[0]; 3896 vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum; 3897 for( int i = 1; i < KERNEL_RADIUS; i ++ ) { 3898 float x = float(i); 3899 float w = gaussianCoefficients[i]; 3900 vec2 uvOffset = direction * invSize * x; 3901 vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb; 3902 vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb; 3903 diffuseSum += (sample1 + sample2) * w; 3904 weightSum += 2.0 * w; 3905 } 3906 gl_FragColor = vec4(diffuseSum/weightSum, 1.0); 3907 }`})}getCompositeMaterial(e){return new dt({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv; 3908 void main() { 3909 vUv = uv; 3910 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3911 }`,fragmentShader:`varying vec2 vUv; 3912 uniform sampler2D blurTexture1; 3913 uniform sampler2D blurTexture2; 3914 uniform sampler2D blurTexture3; 3915 uniform sampler2D blurTexture4; 3916 uniform sampler2D blurTexture5; 3917 uniform float bloomStrength; 3918 uniform float bloomRadius; 3919 uniform float bloomFactors[NUM_MIPS]; 3920 uniform vec3 bloomTintColors[NUM_MIPS]; 3921 3922 float lerpBloomFactor(const in float factor) { 3923 float mirrorFactor = 1.2 - factor; 3924 return mix(factor, mirrorFactor, bloomRadius); 3925 } 3926 3927 void main() { 3928 gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + 3929 lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + 3930 lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + 3931 lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + 3932 lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0
3932) * texture2D(blurTexture5, vUv) ); 3933 }`})}}Ti.BlurDirectionX=new we(1,0);Ti.BlurDirectionY=new we(0,1);class mr extends Ft{constructor(e,t={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new vt;const n=this,r=t.color!==void 0?new Ue(t.color):new Ue(8355711),s=t.textureWidth||512,a=t.textureHeight||512,o=t.clipBias||0,l=t.shader||mr.ReflectorShader,c=t.multisample!==void 0?t.multisample:4,h=new mn,f=new U,d=new U,m=new U,_=new Ze,M=new U(0,0,-1),p=new qe,u=new U,b=new U,T=new qe,S=new Ze,F=this.camera,R=new Rt(s,a,{samples:c,type:Vt}),w=new dt({name:l.name!==void 0?l.name:"unspecified",uniforms:yi.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});w.uniforms.tDiffuse.value=R.texture,w.uniforms.color.value=r,w.uniforms.textureMatrix.value=S,this.material=w,this.onBeforeRender=function(I,E,x){if(d.setFromMatrixPosition(n.matrixWorld),m.setFromMatrixPosition(x.matrixWorld),_.extractRotation(n.matrixWorld),f.set(0,0,1),f.applyMatrix4(_),u.subVectors(d,m),u.dot(f)>0)return;u.reflect(f).negate(),u.add(d),_.extractRotation(x.matrixWorld),M.set(0,0,-1),M.applyMatrix4(_),M.add(m),b.subVectors(d,M),b.reflect(f).negate(),b.add(d),F.position.copy(u),F.up.set(0,1,0),F.up.applyMatrix4(_),F.up.reflect(f),F.lookAt(b),F.far=x.far,F.updateMatrixWorld(),F.projectionMatrix.copy(x.projectionMatrix),S.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),S.multiply(F.projectionMatrix),S.multiply(F.matrixWorldInverse),S.multiply(n.matrixWorld),h.setFromNormalAndCoplanarPoint(f,d),h.applyMatrix4(F.matrixWorldInverse),p.set(h.normal.x,h.normal.y,h.normal.z,h.constant);const A=F.projectionMatrix;T.x=(Math.sign(p.x)+A.elements[8])/A.elements[0],T.y=(Math.sign(p.y)+A.elements[9])/A.elements[5],T.z=-1,T.w=(1+A.elements[10])/A.elements[14],p.multiplyScalar(2/p.dot(T)),A.elements[2]=p.x,A.elements[6]=p.y,A.elements[10]=p.z+1-o,A.elements[14]=p.w,n.visible=!1;const W=I.getRenderTarget(),z=I.xr.enabled,G=I.shadowMap.autoUpdate;I.xr.enabled=!1,I.shadowMap.autoUpdate=!1,I.setRenderTarget(R),I.state.buffers.depth.setMask(!0),I.autoClear===!1&&I.clear(),I.render(E,F),I.xr.enabled=z,I.shadowMap.autoUpdate=G,I.setRenderTarget(W);const Z=x.viewport;Z!==void 0&&I.state.viewport(Z),n.visible=!0},this.getRenderTarget=function(){return R},this.dispose=function(){R.dispose(),n.material.dispose()}}}mr.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` 3934 uniform mat4 textureMatrix; 3935 varying vec4 vUv; 3936 3937 #include <common> 3938 #include <logdepthbuf_pars_vertex> 3939 3940 void main() { 3941 3942 vUv = textureMatrix * vec4( position, 1.0 ); 3943 3944 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3945 3946 #include <logdepthbuf_vertex> 3947 3948 }`,fragmentShader:` 3949 uniform vec3 color; 3950 uniform sampler2D tDiffuse; 3951 varying vec4 vUv; 3952 3953 #include <logdepthbuf_pars_fragment> 3954 3955 float blendOverlay( float base, float blend ) { 3956 3957 return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); 3958 3959 } 3960 3961 vec3 blendOverlay( vec3 base, vec3 blend ) { 3962 3963 return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); 3964 3965 } 3966 3967 void main() { 3968 3969 #include <logdepthbuf_fragment> 3970 3971 vec4 base = texture2DProj( tDiffuse, vUv ); 3972 gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); 3973 3974 #include <tonemapping_fragment> 3975 #include <colorspace_fragment> 3976 3977 }`};const Rp=` 3978vec4 permute(vec4 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); } 3979vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 3980 3981float snoise(vec3 v) { 3982 const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0); 3983 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 3984 3985 vec3 i = floor(v + dot(v, C.yyy)); 3986 vec3 x0 = v - i + dot(i, C.xxx); 3987 3988 vec3 g = step(x0.yzx, x0.xyz); 3989 vec3 l = 1.0 - g; 3990 vec3 i1 = min(g.xyz, l.zxy); 3991 vec3 i2 = max(g.xyz, l.zxy); 3992 3993 vec3 x1 = x0 - i1 + C.xxx; 3994 vec3 x2 = x0 - i2 + C.yyy; 3995 vec3 x3 = x0 - D.yyy; 3996 3997 i = mod(i, 289.0); 3998 vec4 p = permute(permute(permute( 3999 i.z + vec4(0.0, i1.z, i2.z, 1.0)) 4000 + i.y + vec4(0.0, i1.y, i2.y, 1.0)) 4001 + i.x + vec4(0.0, i1.x, i2.x, 1.0)); 4002 4003 float n_ = 1.0 / 7.0; 4004 vec3 ns = n_ * D.wyz - D.xzx; 4005 4006 vec4 j = p - 49.0 * floor(p * ns.z * ns.z); 4007 4008 vec4 x_ = floor(j * ns.z); 4009 vec4 y_ = floor(j - 7.0 * x_); 4010 4011 vec4 x = x_ * ns.x + ns.yyyy; 4012 vec4 y = y_ * ns.x + ns.yyyy; 4013 vec4 h = 1.0 - abs(x) - abs(y); 4014 4015 vec4 b0 = vec4(x.xy, y.xy); 4016 vec4 b1 = vec4(x.zw, y.zw); 4017 4018 vec4 s0 = floor(b0) * 2.0 + 1.0; 4019 vec4 s1 = floor(b1) * 2.0 + 1.0; 4020 vec4 sh = -step(h, vec4(0.0)); 4021 4022 vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; 4023 vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww; 4024 4025 vec3 p0 = vec3(a0.xy, h.x); 4026 vec3 p1 = vec3(a0.zw, h.y); 4027 vec3 p2 = vec3(a1.xy, h.z); 4028 vec3 p3 = vec3(a1.zw, h.w); 4029 4030 vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); 4031 p0 *= norm.x; 4032 p1 *= norm.y; 4033 p2 *= norm.z; 4034 p3 *= norm.w; 4035 4036 vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0); 4037 m = m * m; 4038 return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3))); 4039}
4040`,co=1e5,uo=400,ho=250;function Cp(){const i=new kt,e=new Float32Array(co*3);let t=0;const n=.14,r=.14;for(let s=0;s<ho;s++)for(let a=0;a<uo&&!(t>=co);a++){const o=t*3;e[o]=(a-uo*.5)*n,e[o+1]=0,e[o+2]=(s-ho*.5)*r,t++}return i.setAttribute("position",new Ot(e,3)),i}const Pp=` 4041 precision highp float; 4042 precision highp int; 4043 4044 ${Rp} 4045 4046 uniform mat4 modelMatrix; 4047 uniform mat4 modelViewMatrix; 4048 uniform mat4 projectionMatrix; 4049 uniform float uTime; 4050 uniform float uLo; 4051 uniform float uMid; 4052 uniform float uHi; 4053 uniform float uDetail; 4054 uniform float uPointScale; 4055 4056 attribute vec3 position; 4057 4058 varying float vGlow; 4059 varying vec2 vWorldXZ; 4060 4061 void main() { 4062 vec3 p = position; 4063 4064 vec3 w = (modelMatrix * vec4(p, 1.0)).xyz; 4065 4066 float tLo = uTime * (0.22 + uLo * 0.35); 4067 float tHi = uTime * (2.4 + uHi * 4.5); 4068 4069 float kWave = 1.6; 4070 float swell = snoise(vec3(w.x * 0.055 * kWave, w.z * 0.055 * kWave, tLo)); 4071 float ridge = snoise(vec3(w.x * 0.11 * kWave + 17.0, w.z * 0.11 * kWave, tLo * 0.6)); 4072 float deep = (swell * 0.75 + ridge * 0.25) * (0.45 + uLo * 2.2); 4073 4074 float nervous = snoise(vec3(w.x * 2.2 * kWave, w.z * 2.2 * kWave, tHi)); 4075 float shimmer = snoise(vec3(w.x * 5.5 * kWave, w.z * 5.5 * kWave, tHi * 1.3)); 4076 float ripples = (nervous * 0.62 + shimmer * 0.38) * uHi * 0.55 * uDetail; 4077 4078 float mid = snoise(vec3(w.x * 0.9 * kWave, w.z * 0.9 * kWave, uTime * (0.9 + uMid * 1.2))) * uMid * 0.35 * uDetail; 4079 4080 float y = deep + ripples + mid; 4081 vec3 displaced = vec3(p.x, p.y + y, p.z); 4082 4083 vec4 mv = modelViewMatrix * vec4(displaced, 1.0); 4084 gl_Position = projectionMatrix * mv; 4085 4086 vWorldXZ = w.xz; 4087 vGlow = 0.35 + clamp(y * 0.45 + uHi * 0.25, -0.2, 1.4); 4088 gl_PointSize = uPointScale * (1.02 + vGlow * 0.52); 4089 } 4090 `,Dp=` 4091 precision highp float; 4092 4093 varying float vGlow; 4094 varying vec2 vWorldXZ; 4095 4096 uniform float uAlpha; 4097 uniform float uFade; 4098 uniform float uTime; 4099 uniform float uIridescent; 4100 uniform float uColorWaveActive[8]; 4101 uniform float uColorWaveAge[8]; 4102 uniform vec3 uColorDeep; 4103 uniform vec3 uColorPeak; 4104 uniform vec3 uColorWaveColor[8]; 4105 uniform vec2 uColorWaveOrigin[8]; 4106 4107 void main() { 4108 vec2 c = gl_PointCoord - vec2(0.5); 4109 float d2 = dot(c, c); 4110 if (d2 > 0.25) discard; 4111 4112 float core = smoothstep(0.25, 0.09, d2); 4113 core = pow(max(core, 0.0), 1.35); 4114 vec3 col = mix(uColorDeep, uColorPeak, vGlow); 4115 if (uIridescent > 0.001) { 4116 float ph = vGlow * 7.0 + uTime * 0.62; 4117 float ph2 = vGlow * 4.2 - uTime * 0.48; 4118 vec3 cyanA = vec3(0.02, 0.62, 0.78); 4119 vec3 cyanB = vec3(0.15, 0.95, 1.0); 4120 vec3 teal = vec3(0.08, 0.48, 0.55); 4121 float w = sin(ph) * 0.5 + 0.5; 4122 float w2 = sin(ph2 + 1.57) * 0.5 + 0.5; 4123 vec3 ir = mix(mix(teal, cyanA, w2), cyanB, w); 4124 vec3 shift = vec3( 4125 0.06 * sin(ph * 1.3 + 0.5), 4126 0.04 * sin(ph * 1.1 + 2.0), 4127 0.08 * sin(ph * 0.9 + 3.8) 4128 ); 4129 ir += shift * (0.25 + 0.55 * vGlow); 4130 col = mix(col, ir, uIridescent); 4131 } 4132 for (int i = 0; i < 8; i++) { 4133 if (uColorWaveActive[i] > 0.001) { 4134 float dist = distance(vWorldXZ, uColorWaveOrigin[i]); 4135 float front = uColorWaveAge[i] * 19.0; 4136 float captured = 1.0 - smoothstep(front - 9.5, front + 15.5, dist); 4137 float edge = 1.0 - smoothstep(0.0, 14.0, abs(dist - front)); 4138 float pulse = 0.92 + 0.08 * sin(uTime * 1.45 + dist * 0.07 + vGlow * 2.4 + float(i)); 4139 vec3 waveCol = uColorWaveColor[i] * (0.68 + vGlow * 0.48) * pulse; 4140 waveCol += uColorWaveColor[i] * edge * 0.22; 4141 float blend = smoothstep(0.0, 1.0, clamp(captured * uColorWaveActive[i], 0.0, 1.0)); 4142 col = mix(col, waveCol, blend); 4143 } 4144 } 4145 float a = core * uAlpha * uFade; 4146 gl_FragColor = vec4(col * a, a); 4147 } 4148 `;function Xp(i={}){const e=i.getPixelRatio??(()=>Math.min(window.devicePixelRatio,2)),t=e(),n=new Zn;n.name="monologueSea";const r={value:1},s=new Zn;n.add(s);const a=Cp(),o=new vp({vertexShader:Pp,fragmentShader:Dp,uniforms:{uTime:{value:0},uLo:{value:.28},uMid:{value:.12},uHi:{value:.18},uDetail:{value:0},uPointScale:{value:2*t},uAlpha:{value:.36},uFade:r,uColorDeep:{value:new U(.08,.14,.32)},uColorPeak:{value:new U(.55,.82,1)},uIridescent:{value:0},uColorWaveActive:{value:Array.from({length:8},()=>0)},uColorWaveAge:{value:Array.from({length:8},()=>999)},uColorWaveColor:{value:Array.from({length:8},()=>new U(1,1,1))},uColorWaveOrigin:{value:Array.from({length:8},()=>new we(0,0))}},transparent:!0,depthTest:!1,depthWrite:!1,blending:or,fog:!1}),l=new _p(a,o);l.frustumCulled=!1,l.renderOrder=10,s.add(l);const c=new Ri(320,320,1,1),h=new mr(c,{clipBias:.003,textureWidth:640,textureHeight:360,color:new Ue(197381),multisample:0});h.rotation.x=-Math.PI/2,h.position.y=-2.65,n.add(h);{const p=h.material;p.transparent=!0,p.uniforms.uFade=r,p.fragmentShader=p.fragmentShader.replace("uniform vec3 color;",`uniform vec3 color; 4149 uniform float uFade;`).replace("gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );",`vec3 reflCol = blendOverlay( base.rgb, color ); 4150 gl_FragColor = vec4( reflCol * uFade, uFade );`),p.needsUpdate=!0}function f(){const p=e(),u=Math.max(160,Math.floor(window.innerWidth*p*.38)),b=Math.max(160,Math.floor(window.innerHeight*p*.38)),T=h.getRenderTarget();(T.width!==u||T.height!==b)&&T.setSize(u,b)}function d(p,u,b){if(!p)return 0;const T=p.length,S=Math.max(0,Math.floor(T*u)),F=Math.min(T,Math.floor(T*b));if(F<=S)return 0;let R=0;for(let w=S;w<F;w++)R+=p[w];return R/((F-S)*255)}function m(p,u={},b={}){b.fade!==void 0&&(r.value=ec.clamp(b.fade,0,1));const{analyser:T,freqData:S,audioGraphReady:F,musicEl:R}=u,w=!!(T&&S&&R&&!R.paused&&F);if(w){T.getByteFrequencyData(S);const x=d(S,0,.07),A=d(S,.07,.38),W=d(S,.38,1),z=.28,G=.12,Z=.18,k=.14+x*.62,J=.04+A*.42,H=.07+W*.55,te=.48,ce=z+(k-z)*te,xe=G+(J-G)*te,Ie=Z+(H-Z)*te,ke=.055;o.uniforms.uLo.value+=(ce-o.uniforms.uLo.value)*ke,o.uniforms.uMid.value+=(xe-o.uniforms.uMid.value)*ke,o.uniforms.uHi.value+=(Ie-o.uniforms.uHi.value)*ke}else{const z=1-Math.exp(-p/.85);o.uniforms.uLo.value+=(.28-o.uniforms.uLo.value)*z,o.uniforms.uMid.value+=(.12-o.uniforms.uMid.value)*z,o.uniforms.uHi.value+=(.18-o.uniforms.uHi.value)*z}const I=w?1:0,E=w?.1:1-Math.exp(-p/1.15);o.uniforms.uDetail.value+=(I-o.uniforms.uDetail.value)*E,o.uniforms.uTime.value+=p,f()}function _(){o.uniforms.uPointScale.value=2*e(),f()}function M(){a.dispose(),o.dispose(),c.dispose(),h.dispose()}return f(),{root:n,material:o,reflector:h,points:l,seaFadeUniform:r,update:m,resize:_,dispose:M}}export{bl as A,wi as B,Cn as C,Np as D,kp as E,en as F,Zn as G,Vt as H,Ti as I,Vp as J,gn as K,Ht as L,Op as M,yt as N,lt as O,zp as P,bi as Q,Nt as R,Ip as S,Sp as T,mo as U,we as V,Up as W,Lp as a,ne as b,xt as c,Ft as d,Xs as e,Fp as f,wt as g,Ri as h,dt as i,Jt as j,U as k,ec as l,Ue as m,Wo as n,vt as o,La as p,Bp as q,Hp as r,kt as s,Ot as t,gp as u,or as v,_p as w,Xp as x,Gp as y,Wp as z};
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.