PageSourceSearch

https://spacemit.com/assets/js/AILabView-Dh2CWSNB.js

js spacemit.com collected 2026-10-02 06:23:04 UTC 528,098 bytes, 4,113 lines download raw bytes

vendor: 5,824 bytes, lines 1-6
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css/ailab-ZYo2wWFu.css"])))=>i.map(i=>d[i]);
2import{b as Po,u as _l,a as gl,c as vl,h as xl,_ as Sl}from"./index-A_wQVeED.js";import{u as Do}from"./vue-i18n-DB8TWyTj.js";import{d as na,ay as Ml,b as Gt,o as ia,t as El,w as Tl,ab as vt,ad as yl,ar,ae as xt,c as Qt,i as ya,ac as Ge,k as us,u as an,ao as Bt,ap as ba,an as bl,F as qn,am as Si,az as Er,h as Tr,p as Aa}from"./vue-core-ChiBto-t.js";import{a as Al}from"./utils-vendor-JQb4SikA.js";import{_ as Rl,n as ds,r as Cl,V as wl}from"./antd-vendor-CCWKs8P6.js";import"./vue-router-DvxZXMKK.js";/**
3 * @license
4 * Copyright 2010-2025 Three.js Authors
5 * SPDX-License-Identifier: MIT
6 */const gr="178",Pl=0,Ra=1,Dl=2,Io=1,Il=2,fn=3,mn=0,gt=1,Lt=2,rn=0,li=1,Ca=2,wa=3,Pa=4,Ll=5,Bn=100,Ul=101,Nl=102,Fl=103,Ol=104,Bl=200,zl=201,Hl=202,Gl=203,fs=204,hs=205,Vl=206,kl=207,Wl=208,Xl=209,ql=210,Yl=211,Kl=212,$l=213,Zl=214,ps=0,hr=1,ms=2,di=3,_s=4,gs=5,vs=6,xs=7,Lo=0,jl=1,Jl=2,Tn=0,Ql=1,ec=2,tc=3,nc=4,ic=5,rc=6,sc=7,Uo=300,fi=301,hi=302,Ss=303,Ms=304,vr=306,Es=1e3,Hn=1001,Ts=1002,Jt=1003,ac=1004,Bi=1005,Tt=1006,yr=1007,Gn=1008,Nt=1009,No=1010,Fo=1011,Ri=1012,ra=1013,Wn=1014,nn=1015,wi=1016,sa=1017,aa=1018,pi=1020,Oo=35902,Bo=1021,zo=1022,Zt=1023,Ci=1026,mi=1027,Ho=1028,oa=1029,Go=1030,la=1031,ca=1033,or=33776,lr=33777,cr=33778,ur=33779,ys=35840,bs=35841,As=35842,Rs=35843,Cs=36196,ws=37492,Ps=37496,Ds=37808,Is=37809,Ls=37810,Us=37811,Ns=37812,Fs=37813,Os=37814,Bs=37815,zs=37816,Hs=37817,Gs=37818,Vs=37819,ks=37820,Ws=37821,dr=36492,Xs=36494,qs=36495,Vo=36283,Ys=36284,Ks=36285,$s=36286,Pi=3200,oc=3201,lc=0,cc=1,tn="",ct="srgb",yn="srgb-linear",pr="linear",Je="srgb",Yn=7680,Da=519,uc=512,dc=513,fc=514,ko=515,hc=516,pc=517,mc=518,_c=519,Ia=35044,Zs="300 es",hn=2e3,mr=2001;class bn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Mt=["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"],br=Math.PI/180,js=180/Math.PI;function Di(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[i&255]+Mt[i>>8&255]+Mt[i>>16&255]+Mt[i>>24&255]).toLowerCase()}function He(n,e,t){return Math.max(e,Math.min(t,n))}function gc(n,e){return(n%e+e)%e}function Ar(n,e,t){return(1-t)*n+t*e}function Mi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ct(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Oe{constructor(e=0,t=0){Oe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 5,558 bytes, line 6
6sub(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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+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=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(He(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(He(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ii{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3];const p=s[a+0],m=s[a+1],x=s[a+2],M=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f;return}if(o===1){e[t+0]=p,e[t+1]=m,e[t+2]=x,e[t+3]=M;return}if(f!==M||l!==p||c!==m||d!==x){let h=1-o;const u=l*p+c*m+d*x+f*M,T=u>=0?1:-1,y=1-u*u;if(y>Number.EPSILON){const L=Math.sqrt(y),A=Math.atan2(L,u*T);h=Math.sin(h*A)/L,o=Math.sin(o*A)/L}const E=o*T;if(l=l*h+p*E,c=c*h+m*E,d=d*h+x*E,f=f*h+M*E,h===1-o){const L=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=L,c*=L,d*=L,f*=L}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=s[a],p=s[a+1],m=s[a+2],x=s[a+3];return e[t]=o*x+d*f+l*m-c*p,e[t+1]=l*x+d*p+c*f-o*m,e[t+2]=c*x+d*m+o*p-l*f,e[t+3]=d*x-o*f-l*p-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,i,r){return this._x=e,this._y=t,this._z=i,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 i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(s/2),p=l(i/2),m=l(r/2),x=l(s/2);switch(a){case"XYZ":this._x=p*d*f+c*m*x,this._y=c*m*f-p*d*x,this._z=c*d*x+p*m*f,this._w=c*d*f-p*m*x;break;case"YXZ":this._x=p*d*f+c*m*x,this._y=c*m*f-p*d*x,this._z=c*d*x-p*m*f,this._w=c*d*f+p*m*x;break;case"ZXY":this._x=p*d*f-c*m*x,this._y=c*m*f+p*d*x,this._z=c*d*x+p*m*f,this._w=c*d*f-p*m*x;break;case"ZYX":this._x=p*d*f-c*m*x,this._y=c*m*f+p*d*x,this._z=c*d*x-p*m*f,this._w=c*d*f+p*m*x;break;case"YZX":this._x=p*d*f+c*m*x,this._y=c*m*f+p*d*x,this._z=c*d*x-p*m*f,this._w=c*d*f-p*m*x;break;case"XZY":this._x=p*d*f-c*m*x,this._y=c*m*f-p*d*x,this._z=c*d*x+p*m*f,this._w=c*d*f+p*m*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],f=t[10],p=i+o+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(i>o&&i>f){const m=2*Math.sqrt(1+i-o-f);this._w=(d-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-i-f);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+d)/m}else{const m=2*Math.sqrt(1+f-i-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>
vendor: 4,716 bytes, line 6
6Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(He(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*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=i,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*i+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),d=Math.atan2(c,o),f=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=a*f+this._w*p,this._x=i*f+this._x*p,this._y=r*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);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 z{constructor(e=0,t=0,i=0){z.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(La.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(La.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}
vendor: 8,826 bytes, line 6
6applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),f=2*(s*i-a*t);return this.x=t+l*c+a*f-o*d,this.y=i+l*d+o*c-s*f,this.z=r+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+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=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this.z=He(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this.z=He(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(He(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=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-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Rr.copy(this).projectOnVector(e),this.sub(Rr)}reflect(e){return this.sub(Rr.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 i=this.dot(e)/t;return Math.acos(He(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,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,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Rr=new z,La=new Ii;class Ue{constructor(e,t,i,r,s,a,o,l,c){Ue.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],p=i[2],m=i[5],x=i[8],M=r[0],h=r[3],u=r[6],T=r[1],y=r[4],E=r[7],L=r[2],A=r[5],C=r[8];return s[0]=a*M+o*T+l*L,s[3]=a*h+o*y+l*A,s[6]=a*u+o*E+l*C,s[1]=c*M+d*T+f*L,s[4]=c*h+d*y+f*A,s[7]=c*u+d*E+f*C,s[2]=p*M+m*T+x*L,s[5]=p*h+m*y+x*A,s[8]=p*u+m*E+x*C,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],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,p=o*l-d*s,m=c*s-a*l,x=t*f+i*p+r*m;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/x;return e[0]=f*M,e[1]=(r*c-d*i)*M,e[2]=(o*i-r*a)*M,e[3]=p*M,e[4]=(d*t-r*l)*M,e[5]=(r*s-o*t)*M,e[6]=m*M,e[7]=(i*l-c*t)*M,e[8]=(a*t-i*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,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(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(Cr.makeScale(e,t)),this}rotate(e){return this.premultiply(Cr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Cr.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Cr=new Ue;function Wo(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function _r(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vc(){const n=_r("canvas");return n.style.display="block",n}const Ua={};function ci(n){n in Ua||(Ua[n]=!0,console.warn(n))}function xc(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}function Sc(n){const e=n.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 Mc(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Na=new Ue().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Fa=new Ue().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ec(){const n={enabled:!0,workingColorSpace:yn,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Je&&(r.r=pn(r.r),r.g=pn(r.g),r.b=pn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyM
vendor: 31,144 bytes, line 6
6atrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Je&&(r.r=ui(r.r),r.g=ui(r.g),r.b=ui(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===tn?pr:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ci("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ci("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[yn]:{primaries:e,whitePoint:i,transfer:pr,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ct},outputColorSpaceConfig:{drawingBufferColorSpace:ct}},[ct]:{primaries:e,whitePoint:i,transfer:Je,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ct}}}),n}const We=Ec();function pn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ui(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Kn;class Tc{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Kn===void 0&&(Kn=_r("canvas")),Kn.width=e.width,Kn.height=e.height;const r=Kn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Kn}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=_r("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=pn(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(pn(t[i]/255)*255):t[i]=pn(t[i]);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 yc=0;class ua{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:yc++}),this.uuid=Di(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={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(wr(r[a].image)):s.push(wr(r[a]))}else s=wr(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function wr(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Tc.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bc=0;const Pr=new z;class St extends bn{constructor(e=St.DEFAULT_IMAGE,t=St.DEFAULT_MAPPING,i=Hn,r=Hn,s=Tt,a=Gn,o=Zt,l=Nt,c=St.DEFAULT_ANISOTROPY,d=tn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bc++}),this.uuid=Di(),this.name="",this.source=new ua(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ue,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Pr).x}get height(){return this.source.getSize(Pr).y}get depth(){return this.source.getSize(Pr).z}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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Uo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Es:e.x=e.x-Math.floor(e.x);break;case Hn:e.x=e.x<0?0:1;break;case Ts: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 Es:e.y=e.y-Math.floor(e.y);break;case Hn:e.y=e.y<0?0:1;break;case Ts: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++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=Uo;St.DEFAULT_ANISOTROPY=1;class ut{constructor(e=0,t=0,i=0,r=1){ut.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,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,i,r){return this.x=e,this.y=t,this.z=i,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,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+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,i,r,s;const l=e.elements,c=l[0],d=l[4],f=l[8],p=l[1],m=l[5],x=l[9],M=l[2],h=l[6],u=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-M)<.01&&Math.abs(x-h)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+M)<.1&&Math.abs(x+h)<.1&&Math.abs(c+m+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,E=(m+1)/2,L=(u+1)/2,A=(d+p)/4,C=(f+M)/4,U=(x+h)/4;return y>E&&y>L?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=A/i,s=C/i):E>L?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=A/r,s=U/r):L<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),i=C/s,r=U/s),this.set(i,r,s,t),this}let T=Math.sqrt((h-x)*(h-x)+(f-M)*(f-M)+(p-d)*(p-d));return Math.abs(T)<.001&&(T=1),this.x=(h-x)/T,this.y=(f-M)/T,this.z=(p-d)/T,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=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this.z=He(this.z,e.z,t.z),this.w=He(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this.z=He(this.z,e,t),this.w=He(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(He(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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 Ac extends bn{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Tt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new ut(0,0,e,t),this.scissorTest=!1,this.viewport=new ut(0,0,e,t);const r={width:e,height:t,depth:i.depth},s=new St(r);this.textures=[];const a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:Tt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;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=i,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new ua(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class kt extends Ac{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Xo extends St{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Jt,this.minFilter=Jt,this.wrapR=Hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Rc extends St{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Jt,this.minFilter=Jt,this.wrapR=Hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Li{constructor(e=new z(1/0,1/0,1/0),t=new z(-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,i=e.length;t<i;t+=3)this.expandByPoint(qt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(qt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=qt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 i=e.geometry;if(i!==void 0){const s=i.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,qt):qt.fromBufferAttribute(s,a),qt.applyMatrix4(e.matrixWorld),this.expandByPoint(qt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),zi.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),zi.copy(i.boundingBox)),zi.applyMatrix4(e.matrixWorld),this.union(zi)}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,qt),qt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ei),Hi.subVectors(this.max,Ei),$n.subVectors(e.a,Ei),Zn.subVectors(e.b,Ei),jn.subVectors(e.c,Ei),gn.subVectors(Zn,$n),vn.subVectors(jn,Zn),Pn.subVectors($n,jn);let t=[0,-gn.z,gn.y,0,-vn.z,vn.y,0,-Pn.z,Pn.y,gn.z,0,-gn.x,vn.z,0,-vn.x,Pn.z,0,-Pn.x,-gn.y,gn.x,0,-vn.y,vn.x,0,-Pn.y,Pn.x,0];return!Dr(t,$n,Zn,jn,Hi)||(t=[1,0,0,0,1,0,0,0,1],!Dr(t,$n,Zn,jn,Hi))?!1:(Gi.crossVectors(gn,vn),t=[Gi.x,Gi.y,Gi.z],Dr(t,$n,Zn,jn,Hi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qt).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const on=[new z,new z,new z,new z,new z,new z,new z,new z],qt=new z,zi=new Li,$n=new z,Zn=new z,jn=new z,gn=new z,vn=new z,Pn=new z,Ei=new z,Hi=new z,Gi=new z,Dn=new z;function Dr(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Dn.fromArray(n,s);const o=r.x*Math.abs(Dn.x)+r.y*Math.abs(Dn.y)+r.z*Math.abs(Dn.z),l=e.dot(Dn),c=t.dot(Dn),d=i.dot(Dn);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Cc=new Li,Ti=new z,Ir=new z;class da{constructor(e=new z,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 i=this.center;t!==void 0?i.copy(t):Cc.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.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 i=this.center.distanceToSquared(e);return t.copy(e),i>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;Ti.subVectors(e,this.center);const t=Ti.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Ti,r/i),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):(Ir.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ti.copy(e.center).add(Ir)),this.expandByPoint(Ti.copy(e.center).sub(Ir))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ln=new z,Lr=new z,Vi=new z,xn=new z,Ur=new z,ki=new z,Nr=new z;class wc{constructor(e=new z,t=new z(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,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Lr.copy(e).add(t).multiplyScalar(.5),Vi.copy(t).sub(e).normalize(),xn.copy(this.origin).sub(Lr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Vi),o=xn.dot(this.direction),l=-xn.dot(Vi),c=xn.lengthSq(),d=Math.abs(1-a*a);let f,p,m,x;if(d>0)if(f=a*l-o,p=a*o-l,x=s*d,f>=0)if(p>=-x)if(p<=x){const M=1/d;f*=M,p*=M,m=f*(f+a*p+2*o)+p*(a*f+p+2*l)+c}else p=s,f=Math.max(0,-(a*p+o)),m=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(a*p+o)),m=-f*f+p*(p+2*l)+c;else p<=-x?(f=Math.max(0,-(-a*s+o)),p=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c):p<=x?(f=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(f=Math.max(0,-(a*s+o)),p=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c);else p=a>0?-s:s,f=Math.max(0,-(a*p+o)),m=-f*f+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Lr).addScaledVector(Vi,p),m}intersectSphere(e,t){ln.subVectors(e.center,this.origin);const i=ln.dot(this.direction),r=ln.dot(ln)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,i,r,s){Ur.subVectors(t,e),ki.subVectors(i,e),Nr.crossVectors(Ur,ki);let a=this.direction.dot(Nr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;xn.subVectors(this.origin,e);const l=o*this.direction.dot(ki.crossVectors(xn,ki));if(l<0)return null;const c=o*this.direction.dot(Ur.cross(xn));if(c<0||l+c>a)return null;const d=-o*xn.dot(Nr);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ft{constructor(e,t,i,r,s,a,o,l,c,d,f,p,m,x,M,h){ft.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,i,r,s,a,o,l,c,d,f,p,m,x,M,h)}set(e,t,i,r,s,a,o,l,c,d,f,p,m,x,M,h){const u=this.elements;return u[0]=e,u[4]=t,u[8]=i,u[12]=r,u[1]=s,u[5]=a,u[9]=o,u[13]=l,u[2]=c,u[6]=d,u[10]=f,u[14]=p,u[3]=m,u[7]=x,u[11]=M,u[15]=h,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 ft().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Jn.setFromMatrixColumn(e,0).length(),s=1/Jn.setFromMatrixColumn(e,1).length(),a=1/Jn.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=a*d,m=a*f,x=o*d,M=o*f;t[0]=l*d,t[4]=-l*f,t[8]=c,t[1]=m+x*c,t[5]=p-M*c,t[9]=-o*l,t[2]=M-p*c,t[6]=x+m*c,t[10]=a*l}else if(e.order==="YXZ"){const p=l*d,m=l*f,x=c*d,M=c*f;t[0]=p+M*o,t[4]=x*o-m,t[8]=a*c,t[1]=a*f,t[5]=a*d,t[9]=-o,t[2]=m*o-x,t[6]=M+p*o,t[10]=a*l}else if(e.order==="ZXY"){const p=l*d,m=l*f,x=c*d,M=c*f;t[0]=p-M*o,t[4]=-a*f,t[8]=x+m*o,t[1]=m+x*o,t[5]=a*d,t[9]=M-p*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const p=a*d,m=a*f,x=o*d,M=o*f;t[0]=l*d,t[4]=x*c-m,t[8]=p*c+M,t[1]=l*f,t[5]=M*c+p,t[9]=m*c-x,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const p=a*l,m=a*c,x=o*l,M=o*c;t[0]=l*d,t[4]=M-p*f,t[8]=x*f+m,t[1]=f,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=m*f+x,t[10]=p-M*f}else if(e.order==="XZY"){const p=a*l,m=a*c,x=o*l,M=o*c;t[0]=l*d,t[4]=-f,t[8]=c*d,t[1]=p*f+M,t[5]=a*d,t[9]=m*f-x,t[2]=x*f-m,t[6]=o*d,t[10]=M*f+p}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(Pc,e,Dc)}lookAt(e,t,i){const r=this.elements;
vendor: 10,834 bytes, line 6
6return Dt.subVectors(e,t),Dt.lengthSq()===0&&(Dt.z=1),Dt.normalize(),Sn.crossVectors(i,Dt),Sn.lengthSq()===0&&(Math.abs(i.z)===1?Dt.x+=1e-4:Dt.z+=1e-4,Dt.normalize(),Sn.crossVectors(i,Dt)),Sn.normalize(),Wi.crossVectors(Dt,Sn),r[0]=Sn.x,r[4]=Wi.x,r[8]=Dt.x,r[1]=Sn.y,r[5]=Wi.y,r[9]=Dt.y,r[2]=Sn.z,r[6]=Wi.z,r[10]=Dt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],p=i[9],m=i[13],x=i[2],M=i[6],h=i[10],u=i[14],T=i[3],y=i[7],E=i[11],L=i[15],A=r[0],C=r[4],U=r[8],g=r[12],S=r[1],w=r[5],X=r[9],O=r[13],H=r[2],Y=r[6],G=r[10],te=r[14],V=r[3],se=r[7],ce=r[11],ve=r[15];return s[0]=a*A+o*S+l*H+c*V,s[4]=a*C+o*w+l*Y+c*se,s[8]=a*U+o*X+l*G+c*ce,s[12]=a*g+o*O+l*te+c*ve,s[1]=d*A+f*S+p*H+m*V,s[5]=d*C+f*w+p*Y+m*se,s[9]=d*U+f*X+p*G+m*ce,s[13]=d*g+f*O+p*te+m*ve,s[2]=x*A+M*S+h*H+u*V,s[6]=x*C+M*w+h*Y+u*se,s[10]=x*U+M*X+h*G+u*ce,s[14]=x*g+M*O+h*te+u*ve,s[3]=T*A+y*S+E*H+L*V,s[7]=T*C+y*w+E*Y+L*se,s[11]=T*U+y*X+E*G+L*ce,s[15]=T*g+y*O+E*te+L*ve,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],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],m=e[14],x=e[3],M=e[7],h=e[11],u=e[15];return x*(+s*l*f-r*c*f-s*o*p+i*c*p+r*o*m-i*l*m)+M*(+t*l*m-t*c*p+s*a*p-r*a*m+r*c*d-s*l*d)+h*(+t*c*f-t*o*m-s*a*f+i*a*m+s*o*d-i*c*d)+u*(-r*o*d-t*l*f+t*o*p+r*a*f-i*a*p+i*l*d)}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,i){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]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],p=e[10],m=e[11],x=e[12],M=e[13],h=e[14],u=e[15],T=f*h*c-M*p*c+M*l*m-o*h*m-f*l*u+o*p*u,y=x*p*c-d*h*c-x*l*m+a*h*m+d*l*u-a*p*u,E=d*M*c-x*f*c+x*o*m-a*M*m-d*o*u+a*f*u,L=x*f*l-d*M*l-x*o*p+a*M*p+d*o*h-a*f*h,A=t*T+i*y+r*E+s*L;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/A;return e[0]=T*C,e[1]=(M*p*s-f*h*s-M*r*m+i*h*m+f*r*u-i*p*u)*C,e[2]=(o*h*s-M*l*s+M*r*c-i*h*c-o*r*u+i*l*u)*C,e[3]=(f*l*s-o*p*s-f*r*c+i*p*c+o*r*m-i*l*m)*C,e[4]=y*C,e[5]=(d*h*s-x*p*s+x*r*m-t*h*m-d*r*u+t*p*u)*C,e[6]=(x*l*s-a*h*s-x*r*c+t*h*c+a*r*u-t*l*u)*C,e[7]=(a*p*s-d*l*s+d*r*c-t*p*c-a*r*m+t*l*m)*C,e[8]=E*C,e[9]=(x*f*s-d*M*s-x*i*m+t*M*m+d*i*u-t*f*u)*C,e[10]=(a*M*s-x*o*s+x*i*c-t*M*c-a*i*u+t*o*u)*C,e[11]=(d*o*s-a*f*s-d*i*c+t*f*c+a*i*m-t*o*m)*C,e[12]=L*C,e[13]=(d*M*r-x*f*r+x*i*p-t*M*p-d*i*h+t*f*h)*C,e[14]=(x*o*r-a*M*r-x*i*l+t*M*l+a*i*h-t*o*h)*C,e[15]=(a*f*r-d*o*r+d*i*l-t*f*l-a*i*p+t*o*p)*C,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,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],i=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,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,f=o+o,p=s*c,m=s*d,x=s*f,M=a*d,h=a*f,u=o*f,T=l*c,y=l*d,E=l*f,L=i.x,A=i.y,C=i.z;return r[0]=(1-(M+u))*L,r[1]=(m+E)*L,r[2]=(x-y)*L,r[3]=0,r[4]=(m-E)*A,r[5]=(1-(p+u))*A,r[6]=(h+T)*A,r[7]=0,r[8]=(x+y)*C,r[9]=(h-T)*C,r[10]=(1-(p+M))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Jn.set(r[0],r[1],r[2]).length();const a=Jn.set(r[4],r[5],r[6]).length(),o=Jn.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],Yt.copy(this);const c=1/s,d=1/a,f=1/o;return Yt.elements[0]*=c,Yt.elements[1]*=c,Yt.elements[2]*=c,Yt.elements[4]*=d,Yt.elements[5]*=d,Yt.elements[6]*=d,Yt.elements[8]*=f,Yt.elements[9]*=f,Yt.elements[10]*=f,t.setFromRotationMatrix(Yt),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=hn){const l=this.elements,c=2*s/(t-e),d=2*s/(i-r),f=(t+e)/(t-e),p=(i+r)/(i-r);let m,x;if(o===hn)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===mr)m=-a/(a-s),x=-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]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=hn){const l=this.elements,c=1/(t-e),d=1/(i-r),f=1/(a-s),p=(t+e)*c,m=(i+r)*d;let x,M;if(o===hn)x=(a+s)*f,M=-2*f;else if(o===mr)x=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]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=M,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Jn=new z,Yt=new ft,Pc=new z(0,0,0),Dc=new z(1,1,1),Sn=new z,Wi=new z,Dt=new z,Oa=new ft,Ba=new Ii;class _n{constructor(e=0,t=0,i=0,r=_n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,r=this._order){return this._x=e,this._y=t,this._z=i,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,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(He(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-He(d,-1,1)),Math.abs(d)<.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(He(p,-1,1)),Math.abs(p)<.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(-He(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(He(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-He(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Oa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Oa,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ba.setFromEuler(this),this.setFromQuaternion(Ba,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}}_n.DEFAULT_ORDER="XYZ";class qo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Ic=0;const za=new z,Qn=new Ii,cn=new ft,Xi=new z,yi=new z,Lc=new z,Uc=new Ii,Ha=new z(1,0,0),Ga=new z(0,1,0),Va=new z(0,0,1),ka={type:"added"},Nc={type:"removed"},ei={type:"childadded",child:null},Fr={type:"childremoved",child:null};class Ut extends bn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ic++}),this.uuid=Di(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ut.DEFAULT_UP.clone();const e=new z,t=new _n,i=new Ii,r=new z(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._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:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ft},normalMatrix:{value:new Ue}}),this.matrix=new ft,this.matrixWorld=new ft,this.matrixAutoUpdate=Ut.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,289 bytes, line 6
6setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.multiply(Qn),this}rotateOnWorldAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.premultiply(Qn),this}rotateX(e){return this.rotateOnAxis(Ha,e)}rotateY(e){return this.rotateOnAxis(Ga,e)}rotateZ(e){return this.rotateOnAxis(Va,e)}translateOnAxis(e,t){return za.copy(e).applyQuaternion(this.quaternion),this.position.add(za.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ha,e)}translateY(e){return this.translateOnAxis(Ga,e)}translateZ(e){return this.translateOnAxis(Va,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(cn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Xi.copy(e):Xi.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),yi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?cn.lookAt(yi,Xi,this.up):cn.lookAt(Xi,yi,this.up),this.quaternion.setFromRotationMatrix(cn),r&&(cn.extractRotation(r.matrixWorld),Qn.setFromRotationMatrix(cn),this.quaternion.premultiply(Qn.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(ka),ei.child=e,this.dispatchEvent(ei),ei.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Nc),Fr.child=e,this.dispatchEvent(Fr),Fr.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),cn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),cn.multiply(e.parent.matrixWorld)),e.applyMatrix4(cn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ka),ei.child=e,this.dispatchEvent(ei),ei.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 i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yi,e,Lc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yi,Uc,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].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):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 4,834 bytes, line 6
6):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",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),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.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const 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),d=a(e.images),f=a(e.shapes),p=a(e.skeletons),m=a(e.animations),x=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),x.length>0&&(i.nodes=x)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.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 i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Ut.DEFAULT_UP=new z(0,1,0);
vendor: 12,908 bytes, line 6
6Ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Kt=new z,un=new z,Or=new z,dn=new z,ti=new z,ni=new z,Wa=new z,Br=new z,zr=new z,Hr=new z,Gr=new ut,Vr=new ut,kr=new ut;class $t{constructor(e=new z,t=new z,i=new z){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Kt.subVectors(e,t),r.cross(Kt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Kt.subVectors(r,t),un.subVectors(i,t),Or.subVectors(e,t);const a=Kt.dot(Kt),o=Kt.dot(un),l=Kt.dot(Or),c=un.dot(un),d=un.dot(Or),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const p=1/f,m=(c*l-o*d)*p,x=(a*d-o*l)*p;return s.set(1-m-x,x,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,dn)===null?!1:dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,dn)===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,dn.x),l.addScaledVector(a,dn.y),l.addScaledVector(o,dn.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Gr.setScalar(0),Vr.setScalar(0),kr.setScalar(0),Gr.fromBufferAttribute(e,t),Vr.fromBufferAttribute(e,i),kr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Gr,s.x),a.addScaledVector(Vr,s.y),a.addScaledVector(kr,s.z),a}static isFrontFacing(e,t,i,r){return Kt.subVectors(i,t),un.subVectors(e,t),Kt.cross(un).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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 Kt.subVectors(this.c,this.b),un.subVectors(this.a,this.b),Kt.cross(un).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return $t.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return $t.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return $t.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return $t.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return $t.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;ti.subVectors(r,i),ni.subVectors(s,i),Br.subVectors(e,i);const l=ti.dot(Br),c=ni.dot(Br);if(l<=0&&c<=0)return t.copy(i);zr.subVectors(e,r);const d=ti.dot(zr),f=ni.dot(zr);if(d>=0&&f<=d)return t.copy(r);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(ti,a);Hr.subVectors(e,s);const m=ti.dot(Hr),x=ni.dot(Hr);if(x>=0&&m<=x)return t.copy(s);const M=m*c-l*x;if(M<=0&&c>=0&&x<=0)return o=c/(c-x),t.copy(i).addScaledVector(ni,o);const h=d*x-m*f;if(h<=0&&f-d>=0&&m-x>=0)return Wa.subVectors(s,r),o=(f-d)/(f-d+(m-x)),t.copy(r).addScaledVector(Wa,o);const u=1/(h+M+p);return a=M*u,o=p*u,t.copy(i).addScaledVector(ti,a).addScaledVector(ni,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Yo={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},Mn={h:0,s:0,l:0},qi={h:0,s:0,l:0};function Wr(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class $e{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===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,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ct){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,We.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=We.workingColorSpace){return this.r=e,this.g=t,this.b=i,We.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=We.workingColorSpace){if(e=gc(e,1),t=He(t,0,1),i=He(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Wr(a,s,e+1/3),this.g=Wr(a,s,e),this.b=Wr(a,s,e-1/3)}return We.colorSpaceToWorking(this,r),this}setStyle(e,t=ct){function i(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 i(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 i(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 i(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=ct){const i=Yo[e.toLowerCase()];return i!==void 0?this.setHex(i,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=pn(e.r),this.g=pn(e.g),this.b=pn(e.b),this}copyLinearToSRGB(e){return this.r=ui(e.r),this.g=ui(e.g),this.b=ui(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ct){return We.workingToColorSpace(Et.copy(this),e),Math.round(He(Et.r*255,0,255))*65536+Math.round(He(Et.g*255,0,255))*256+Math.round(He(Et.b*255,0,255))}getHexString(e=ct){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=We.workingColorSpace){We.workingToColorSpace(Et.copy(this),t);const i=Et.r,r=Et.g,s=Et.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case i:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-i)/f+2;break;case s:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=We.workingColorSpace){return We.workingToColorSpace(Et.copy(this),t),e.r=Et.r,e.g=Et.g,e.b=Et.b,e}getStyle(e=ct){We.workingToColorSpace(Et.copy(this),e);const t=Et.r,i=Et.g,r=Et.b;return e!==ct?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Mn),this.setHSL(Mn.h+e,Mn.s+t,Mn.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Mn),e.getHSL(qi);const i=Ar(Mn.h,qi.h,t),r=Ar(Mn.s,qi.s,t),s=Ar(Mn.l,qi.l,t);return this.setHSL(i,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,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+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 Et=new $e;$e.NAMES=Yo;let Fc=0;class gi extends bn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fc++}),this.uuid=Di(),this.name="",this.type="Material",this.blending=li,this.side=mn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=fs,this.blendDst=hs,this.blendEquation=Bn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new $e(0,0,0),this.blendAlpha=0,this.depthFunc=di,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Da,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yn,this.stencilZFail=Yn,this.stencilZPass=Yn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===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(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 13,748 bytes, line 6
6i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==li&&(i.blending=this.blending),this.side!==mn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==fs&&(i.blendSrc=this.blendSrc),this.blendDst!==hs&&(i.blendDst=this.blendDst),this.blendEquation!==Bn&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==di&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Da&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Yn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Yn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.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&&(i.textures=s),a.length>0&&(i.images=a)}return i}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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ko extends gi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new $e(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 _n,this.combine=Lo,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 dt=new z,Yi=new Oe;let Oc=0;class Vt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Oc++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ia,this.updateRanges=[],this.gpuType=nn,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Yi.fromBufferAttribute(this,t),Yi.applyMatrix3(e),this.setXY(t,Yi.x,Yi.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyMatrix3(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyMatrix4(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyNormalMatrix(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.transformDirection(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Mi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ct(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Mi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ct(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Mi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ct(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=Mi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ct(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=Mi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ct(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ct(t,this.array),i=Ct(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ct(t,this.array),i=Ct(i,this.array),r=Ct(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Ct(t,this.array),i=Ct(i,this.array),r=Ct(r,this.array),s=Ct(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}
vendor: 4,829 bytes, line 6
6onUpload(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!==Ia&&(e.usage=this.usage),e}}class $o extends Vt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Zo extends Vt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Vn extends Vt{constructor(e,t,i){super(new Float32Array(e),t,i)}}let Bc=0;const zt=new ft,Xr=new Ut,ii=new z,It=new Li,bi=new Li,_t=new z;class An extends bn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Bc++}),this.uuid=Di(),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(Wo(e)?Zo:$o)(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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}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 i=this.attributes.normal;if(i!==void 0){const s=new Ue().getNormalMatrix(e);i.applyNormalMatrix(s),i.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 zt.makeRotationFromQuaternion(e),this.applyMatrix4(zt),this}rotateX(e){return zt.makeRotationX(e),this.applyMatrix4(zt),this}rotateY(e){return zt.makeRotationY(e),this.applyMatrix4(zt),this}rotateZ(e){return zt.makeRotationZ(e),this.applyMatrix4(zt),this}translate(e,t,i){return zt.makeTranslation(e,t,i),this.applyMatrix4(zt),this}scale(e,t,i){return zt.makeScale(e,t,i),this.applyMatrix4(zt),this}lookAt(e){return Xr.lookAt(e),Xr.updateMatrix(),this.applyMatrix4(Xr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ii).negate(),this.translate(ii.x,ii.y,ii.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Vn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,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 Li);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 z(-1/0,-1/0,-1/0),new z(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];It.setFromBufferAttribute(s),this.morphTargetsRelative?(_t.addVectors(this.boundingBox.min,It.min),this.boundingBox.expandByPoint(_t),_t.addVectors(this.boundingBox.max,It.max),this.boundingBox.expandByPoint(_t)):(this.boundingBox.expandByPoint(It.min),this.boundingBox.expandByPoint(It.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 da);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 z,1/0);return}if(e){const i=this.boundingSphere.center;if(It.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];bi.setFromBufferAttribute(o),this.morphTargetsRelative?(_t.addVectors(It.min,bi.min),It.expandByPoint(_t),_t.addVectors(It.max,bi.max),It.expandByPoint(_t)):(It.expandByPoint(bi.min),It.expandByPoint(bi.max))}It.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;
vendor: 4,205 bytes, line 6
6s++)_t.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(_t));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)_t.fromBufferAttribute(o,c),l&&(ii.fromBufferAttribute(e,c),_t.add(ii)),r=Math.max(r,i.distanceToSquared(_t))}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 i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vt(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<i.count;U++)o[U]=new z,l[U]=new z;const c=new z,d=new z,f=new z,p=new Oe,m=new Oe,x=new Oe,M=new z,h=new z;function u(U,g,S){c.fromBufferAttribute(i,U),d.fromBufferAttribute(i,g),f.fromBufferAttribute(i,S),p.fromBufferAttribute(s,U),m.fromBufferAttribute(s,g),x.fromBufferAttribute(s,S),d.sub(c),f.sub(c),m.sub(p),x.sub(p);const w=1/(m.x*x.y-x.x*m.y);isFinite(w)&&(M.copy(d).multiplyScalar(x.y).addScaledVector(f,-m.y).multiplyScalar(w),h.copy(f).multiplyScalar(m.x).addScaledVector(d,-x.x).multiplyScalar(w),o[U].add(M),o[g].add(M),o[S].add(M),l[U].add(h),l[g].add(h),l[S].add(h))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let U=0,g=T.length;U<g;++U){const S=T[U],w=S.start,X=S.count;for(let O=w,H=w+X;O<H;O+=3)u(e.getX(O+0),e.getX(O+1),e.getX(O+2))}const y=new z,E=new z,L=new z,A=new z;function C(U){L.fromBufferAttribute(r,U),A.copy(L);const g=o[U];y.copy(g),y.sub(L.multiplyScalar(L.dot(g))).normalize(),E.crossVectors(A,g);const w=E.dot(l[U])<0?-1:1;a.setXYZW(U,y.x,y.y,y.z,w)}for(let U=0,g=T.length;U<g;++U){const S=T[U],w=S.start,X=S.count;for(let O=w,H=w+X;O<H;O+=3)C(e.getX(O+0)),C(e.getX(O+1)),C(e.getX(O+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Vt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new z,s=new z,a=new z,o=new z,l=new z,c=new z,d=new z,f=new z;if(e)for(let p=0,m=e.count;p<m;p+=3){const x=e.getX(p+0),M=e.getX(p+1),h=e.getX(p+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,M),a.fromBufferAttribute(t,h),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),o.fromBufferAttribute(i,x),l.fromBufferAttribute(i,M),c.fromBufferAttribute(i,h),o.add(d),l.add(d),c.add(d),i.setXYZ(x,o.x,o.y,o.z),i.setXYZ(M,l.x,l.y,l.z),i.setXYZ(h,c.x,c.y,c.z)}else for(let p=0,m=t.count;p<m;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),i.setXYZ(p+0,d.x,d.y,d.z),i.setXYZ(p+1,d.x,d.y,d.z),i.setXYZ(p+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)_t.fromBufferAttribute(e,t),_t.normalize(),e.setXYZ(t,_t.x,_t.y,_t.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,p=new c.constructor(l.length*d);let m=0,x=0;for(let M=0,h=l.length;M<h;M++){o.isInterleavedBufferAttribute?m=l[M]*o.data.stride+o.offset:m=l[M]*d;for(let u=0;u<d;u++)p[x++]=c[m++]}return new Vt(p,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new An,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const p=c[d],m=e(p,i);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.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 3,379 bytes, line 6
6if(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 i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,p=c.length;f<p;f++){const m=c[f];d.push(m.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let p=0,m=f.length;p<m;p++)d.push(f[p].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const 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 Xa=new ft,In=new wc,Ki=new da,qa=new z,$i=new z,Zi=new z,ji=new z,qr=new z,Ji=new z,Ya=new z,Qi=new z;class jt extends Ut{constructor(e=new An,t=new Ko){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[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 i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ji.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(qr.fromBufferAttribute(f,e),a?Ji.addScaledVector(qr,d):Ji.addScaledVector(qr.sub(t),d))}t.add(Ji)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ki.copy(i.boundingSphere),Ki.applyMatrix4(s),In.
vendor: 8,100 bytes, lines 6-10
6copy(e.ray).recast(e.near),!(Ki.containsPoint(In.origin)===!1&&(In.intersectSphere(Ki,qa)===null||In.origin.distanceToSquared(qa)>(e.far-e.near)**2))&&(Xa.copy(s).invert(),In.copy(e.ray).applyMatrix4(Xa),!(i.boundingBox!==null&&In.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,In)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,M=p.length;x<M;x++){const h=p[x],u=a[h.materialIndex],T=Math.max(h.start,m.start),y=Math.min(o.count,Math.min(h.start+h.count,m.start+m.count));for(let E=T,L=y;E<L;E+=3){const A=o.getX(E),C=o.getX(E+1),U=o.getX(E+2);r=er(this,u,e,i,c,d,f,A,C,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=h.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),M=Math.min(o.count,m.start+m.count);for(let h=x,u=M;h<u;h+=3){const T=o.getX(h),y=o.getX(h+1),E=o.getX(h+2);r=er(this,a,e,i,c,d,f,T,y,E),r&&(r.faceIndex=Math.floor(h/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let x=0,M=p.length;x<M;x++){const h=p[x],u=a[h.materialIndex],T=Math.max(h.start,m.start),y=Math.min(l.count,Math.min(h.start+h.count,m.start+m.count));for(let E=T,L=y;E<L;E+=3){const A=E,C=E+1,U=E+2;r=er(this,u,e,i,c,d,f,A,C,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=h.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),M=Math.min(l.count,m.start+m.count);for(let h=x,u=M;h<u;h+=3){const T=h,y=h+1,E=h+2;r=er(this,a,e,i,c,d,f,T,y,E),r&&(r.faceIndex=Math.floor(h/3),t.push(r))}}}}function zc(n,e,t,i,r,s,a,o){let l;if(e.side===gt?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===mn,o),l===null)return null;Qi.copy(o),Qi.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Qi);return c<t.near||c>t.far?null:{distance:c,point:Qi.clone(),object:n}}function er(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,$i),n.getVertexPosition(l,Zi),n.getVertexPosition(c,ji);const d=zc(n,e,t,i,$i,Zi,ji,Ya);if(d){const f=new z;$t.getBarycoord(Ya,$i,Zi,ji,f),r&&(d.uv=$t.getInterpolatedAttribute(r,o,l,c,f,new Oe)),s&&(d.uv1=$t.getInterpolatedAttribute(s,o,l,c,f,new Oe)),a&&(d.normal=$t.getInterpolatedAttribute(a,o,l,c,f,new z),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new z,materialIndex:0};$t.getNormal($i,Zi,ji,p.normal),d.face=p,d.barycoord=f}return d}class Ui extends An{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let p=0,m=0;x("z","y","x",-1,-1,i,t,e,a,s,0),x("z","y","x",1,-1,i,t,-e,a,s,1),x("x","z","y",1,1,e,i,t,r,a,2),x("x","z","y",1,-1,e,i,-t,r,a,3),x("x","y","z",1,-1,e,t,i,r,s,4),x("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Vn(c,3)),this.setAttribute("normal",new Vn(d,3)),this.setAttribute("uv",new Vn(f,2));function x(M,h,u,T,y,E,L,A,C,U,g){const S=E/C,w=L/U,X=E/2,O=L/2,H=A/2,Y=C+1,G=U+1;let te=0,V=0;const se=new z;for(let ce=0;ce<G;ce++){const ve=ce*w-O;for(let ue=0;ue<Y;ue++){const we=ue*S-X;se[M]=we*T,se[h]=ve*y,se[u]=H,c.push(se.x,se.y,se.z),se[M]=0,se[h]=0,se[u]=A>0?1:-1,d.push(se.x,se.y,se.z),f.push(ue/C),f.push(1-ce/U),te+=1}}for(let ce=0;ce<U;ce++)for(let ve=0;ve<C;ve++){const ue=p+ve+Y*ce,we=p+ve+Y*(ce+1),k=p+(ve+1)+Y*(ce+1),Q=p+(ve+1)+Y*ce;l.push(ue,we,Q),l.push(we,k,Q),V+=6}o.addGroup(m,V,g),m+=V,p+=te}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ui(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function _i(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function At(n){const e={};for(let t=0;t<n.length;t++){const i=_i(n[t]);for(const r in i)e[r]=i[r]}return e}function Hc(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function jo(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:We.workingColorSpace}const Gc={clone:_i,merge:At};var Vc=`void main() {
7	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
8}`,kc=`void main() {
9	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
10}`;class Wt extends gi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Vc,this.fragmentShader=kc,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=_i(e.uniforms),this.uniformsGroups=Hc(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 i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Jo extends Ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ft,this.projectionMatrix=new ft,this.projectionMatrixInverse=new ft,this.coordinateSystem=hn}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 En=new z,Ka=new Oe,$a=new Oe;class Ht extends Jo{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,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=js*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(br*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,156 bytes, line 10
10getEffectiveFOV(){return js*2*Math.atan(Math.tan(br*.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,i){En.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(En.x,En.y).multiplyScalar(-e/En.z),En.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(En.x,En.y).multiplyScalar(-e/En.z)}getViewSize(e,t){return this.getViewBounds(e,Ka,$a),t.subVectors($a,Ka)}setViewOffset(e,t,i,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=i,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(br*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,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*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,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 ri=-90,si=1;class Wc extends Ut{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ht(ri,si,e,t);r.layers=this.layers,this.add(r);const s=new Ht(ri,si,e,t);s.layers=this.layers,this.add(s);const a=new Ht(ri,si,e,t);a.layers=this.layers,this.add(a);const o=new Ht(ri,si,e,t);o.layers=this.layers,this.add(o);const l=new Ht(ri,si,e,t);l.layers=this.layers,this.add(l);const c=new Ht(ri,si,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===hn)i.up.set(0,1,0),i.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===mr)i.up.set(0,-1,0),i.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:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const M=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,o),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=M,e.setRenderTarget(i,5,r),e.render(t,d),e.setRenderTarget(f,p,m),e.xr.enabled=x,i.texture.needsPMREMUpdate=!0}}class Qo extends St{constructor(e=[],t=fi,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Xc extends kt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Qo(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 6,493 bytes, lines 10-45
10=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
11
12				varying vec3 vWorldDirection;
13
14				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
15
16					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
17
18				}
19
20				void main() {
21
22					vWorldDirection = transformDirection( position, modelMatrix );
23
24					#include <begin_vertex>
25					#include <project_vertex>
26
27				}
28			`,fragmentShader:`
29
30				uniform sampler2D tEquirect;
31
32				varying vec3 vWorldDirection;
33
34				#include <common>
35
36				void main() {
37
38					vec3 direction = normalize( vWorldDirection );
39
40					vec2 sampleUV = equirectUv( direction );
41
42					gl_FragColor = texture2D( tEquirect, sampleUV );
43
44				}
45			`},r=new Ui(5,5,5),s=new Wt({name:"CubemapFromEquirect",uniforms:_i(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:gt,blending:rn});s.uniforms.tEquirect.value=t;const a=new jt(r,s),o=t.minFilter;return t.minFilter===Gn&&(t.minFilter=Tt),new Wc(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}class tr extends Ut{constructor(){super(),this.isGroup=!0,this.type="Group"}}const qc={type:"move"};class Yr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new tr,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 tr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new tr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){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 h=t.getJointPose(M,i),u=this._getHandJoint(c,M);h!==null&&(u.matrix.fromArray(h.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=h.radius),u.visible=h!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),m=.02,x=.005;c.inputState.pinching&&p>m+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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,i),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(qc)))}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 i=new tr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Js extends Ut{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 _n,this.environmentIntensity=1,this.environmentRotation=new _n,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Kr=new z,Yc=new z,Kc=new Ue;class Fn{constructor(e=new z(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 5,959 bytes, line 45
45setFromCoplanarPoints(e,t,i){const r=Kr.subVectors(i,t).cross(Yc.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 i=e.delta(Kr),r=this.normal.dot(i);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(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||Kc.getNormalMatrix(e),r=this.coplanarPoint(Kr).applyMatrix4(e),s=this.normal.applyMatrix3(i).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 Ln=new da,$c=new Oe(.5,.5),nr=new z;class el{constructor(e=new Fn,t=new Fn,i=new Fn,r=new Fn,s=new Fn,a=new Fn){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=hn){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],d=r[5],f=r[6],p=r[7],m=r[8],x=r[9],M=r[10],h=r[11],u=r[12],T=r[13],y=r[14],E=r[15];if(i[0].setComponents(l-s,p-c,h-m,E-u).normalize(),i[1].setComponents(l+s,p+c,h+m,E+u).normalize(),i[2].setComponents(l+a,p+d,h+x,E+T).normalize(),i[3].setComponents(l-a,p-d,h-x,E-T).normalize(),i[4].setComponents(l-o,p-f,h-M,E-y).normalize(),t===hn)i[5].setComponents(l+o,p+f,h+M,E+y).normalize();else if(t===mr)i[5].setComponents(o,f,M,y).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(),Ln.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ln)}intersectsSprite(e){Ln.center.set(0,0,0);const t=$c.distanceTo(e.center);return Ln.radius=.7071067811865476+t,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(nr.x=r.normal.x>0?e.max.x:e.min.x,nr.y=r.normal.y>0?e.max.y:e.min.y,nr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(nr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class fa extends St{constructor(e,t,i=Wn,r,s,a,o=Jt,l=Jt,c,d=Ci,f=1){if(d!==Ci&&d!==mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:f};super(p,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ua(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Ni extends An{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,p=t/l,m=[],x=[],M=[],h=[];for(let u=0;u<d;u++){const T=u*p-a;for(let y=0;y<c;y++){const E=y*f-s;x.push(E,-T,0),M.push(0,0,1),h.push(y/o),h.push(1-u/l)}}for(let u=0;u<l;u++)for(let T=0;T<o;T++){const y=T+c*u,E=T+c*(u+1),L=T+1+c*(u+1),A=T+1+c*u;m.push(y,E,A),m.push(E,L,A)}this.setIndex(m),this.setAttribute("position",new Vn(x,3)),this.setAttribute("normal",new Vn(M,3)),this.setAttribute("uv",new Vn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ni(e.width,e.height,e.widthSegments,e.heightSegments)}}class Zc extends gi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Pi,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 jc extends gi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class ha extends Jo{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
45phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,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,i,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=i,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),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Jc extends Ht{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Qc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),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=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class lt{constructor(e){this.value=e}clone(){return new lt(this.value.clone===void 0?this.value:this.value.clone())}}function Za(n,e,t,i){const r=eu(i);switch(t){case Bo:return n*e;case Ho:return n*e/r.components*r.byteLength;case oa:return n*e/r.components*r.byteLength;case Go:return n*e*2/r.components*r.byteLength;case la:return n*e*2/r.components*r.byteLength;case zo:return n*e*3/r.components*r.byteLength;case Zt:return n*e*4/r.components*r.byteLength;case ca:return n*e*4/r.components*r.byteLength;case or:case lr:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case cr:case ur:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case bs:case Rs:return Math.max(n,16)*Math.max(e,8)/4;case ys:case As:return Math.max(n,8)*Math.max(e,8)/2;case Cs:case ws:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Ps:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ds:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Is:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Ls:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Us:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Ns:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Fs:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Os:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Bs:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case zs:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Hs:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Gs:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Vs:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ks:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Ws:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case dr:case Xs:case qs:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Vo:case Ys:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Ks:case $s:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function eu(n){switch(n){case Nt:case No:return{byteLength:1,components:1};case Ri:case Fo:case wi:return{byteLength:2,components:1};case sa:case aa:return{byteLength:2,components:4};case Wn:case ra:case nn:return{byteLength:4,components:1};case Oo:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gr}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gr);/**
46 * @license
47 * Copyright 2010-2025 Three.js Authors
48 * SPDX-License-Identifier: MIT
49 */function tl(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function tu(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,f=c.byteLength,p=n.createBuffer();n.bindBuffer(l,p),n.bufferData(l,c,d),o.onUploadCallback();let m;if(c instanceof Float32Array)m=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)m=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=n.HALF_FLOAT:m=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=n.SHORT;else if(c instanceof Uint32Array)m=n.UNSIGNED_INT;else if(c instanceof Int32Array)m=n.INT;else if(c instanceof Int8Array)m=n.BYTE;else if(c instanceof Uint8Array)m=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function i(o,l,c){const d=l.array,f=l.updateRanges;if(n.bindBuffer(c,o),f.length===0)n.bufferSubData(c,0,d);else{f.sort((m,x)=>m.start-x.start);let p=0;for(let m=1;m<f.length;m++){const x=f[p],M=f[m];
vendor: 5,162 bytes, lines 49-162
49M.start<=x.start+x.count+1?x.count=Math.max(x.count,M.start+M.count-x.start):(++p,f[p]=M)}f.length=p+1;for(let m=0,x=f.length;m<x;m++){const M=f[m];n.bufferSubData(c,M.start*d.BYTES_PER_ELEMENT,d,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&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var nu=`#ifdef USE_ALPHAHASH
50	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
51#endif`,iu=`#ifdef USE_ALPHAHASH
52	const float ALPHA_HASH_SCALE = 0.05;
53	float hash2D( vec2 value ) {
54		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
55	}
56	float hash3D( vec3 value ) {
57		return hash2D( vec2( hash2D( value.xy ), value.z ) );
58	}
59	float getAlphaHashThreshold( vec3 position ) {
60		float maxDeriv = max(
61			length( dFdx( position.xyz ) ),
62			length( dFdy( position.xyz ) )
63		);
64		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
65		vec2 pixScales = vec2(
66			exp2( floor( log2( pixScale ) ) ),
67			exp2( ceil( log2( pixScale ) ) )
68		);
69		vec2 alpha = vec2(
70			hash3D( floor( pixScales.x * position.xyz ) ),
71			hash3D( floor( pixScales.y * position.xyz ) )
72		);
73		float lerpFactor = fract( log2( pixScale ) );
74		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
75		float a = min( lerpFactor, 1.0 - lerpFactor );
76		vec3 cases = vec3(
77			x * x / ( 2.0 * a * ( 1.0 - a ) ),
78			( x - 0.5 * a ) / ( 1.0 - a ),
79			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
80		);
81		float threshold = ( x < ( 1.0 - a ) )
82			? ( ( x < a ) ? cases.x : cases.y )
83			: cases.z;
84		return clamp( threshold , 1.0e-6, 1.0 );
85	}
86#endif`,ru=`#ifdef USE_ALPHAMAP
87	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
88#endif`,su=`#ifdef USE_ALPHAMAP
89	uniform sampler2D alphaMap;
90#endif`,au=`#ifdef USE_ALPHATEST
91	#ifdef ALPHA_TO_COVERAGE
92	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
93	if ( diffuseColor.a == 0.0 ) discard;
94	#else
95	if ( diffuseColor.a < alphaTest ) discard;
96	#endif
97#endif`,ou=`#ifdef USE_ALPHATEST
98	uniform float alphaTest;
99#endif`,lu=`#ifdef USE_AOMAP
100	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
101	reflectedLight.indirectDiffuse *= ambientOcclusion;
102	#if defined( USE_CLEARCOAT ) 
103		clearcoatSpecularIndirect *= ambientOcclusion;
104	#endif
105	#if defined( USE_SHEEN ) 
106		sheenSpecularIndirect *= ambientOcclusion;
107	#endif
108	#if defined( USE_ENVMAP ) && defined( STANDARD )
109		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
110		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
111	#endif
112#endif`,cu=`#ifdef USE_AOMAP
113	uniform sampler2D aoMap;
114	uniform float aoMapIntensity;
115#endif`,uu=`#ifdef USE_BATCHING
116	#if ! defined( GL_ANGLE_multi_draw )
117	#define gl_DrawID _gl_DrawID
118	uniform int _gl_DrawID;
119	#endif
120	uniform highp sampler2D batchingTexture;
121	uniform highp usampler2D batchingIdTexture;
122	mat4 getBatchingMatrix( const in float i ) {
123		int size = textureSize( batchingTexture, 0 ).x;
124		int j = int( i ) * 4;
125		int x = j % size;
126		int y = j / size;
127		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
128		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
129		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
130		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
131		return mat4( v1, v2, v3, v4 );
132	}
133	float getIndirectIndex( const in int i ) {
134		int size = textureSize( batchingIdTexture, 0 ).x;
135		int x = i % size;
136		int y = i / size;
137		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
138	}
139#endif
140#ifdef USE_BATCHING_COLOR
141	uniform sampler2D batchingColorTexture;
142	vec3 getBatchingColor( const in float i ) {
143		int size = textureSize( batchingColorTexture, 0 ).x;
144		int j = int( i );
145		int x = j % size;
146		int y = j / size;
147		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
148	}
149#endif`,du=`#ifdef USE_BATCHING
150	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
151#endif`,fu=`vec3 transformed = vec3( position );
152#ifdef USE_ALPHAHASH
153	vPosition = vec3( position );
154#endif`,hu=`vec3 objectNormal = vec3( normal );
155#ifdef USE_TANGENT
156	vec3 objectTangent = vec3( tangent.xyz );
157#endif`,pu=`float G_BlinnPhong_Implicit( ) {
158	return 0.25;
159}
160float D_BlinnPhong( const in float shininess, const in float dotNH ) {
161	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
162}
163vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
164	vec3 halfDir = normalize( lightDir + viewDir );
165	float dotNH = saturate( dot( normal, halfDir ) );
166	float dotVH = saturate( dot( viewDir, halfDir ) );
167	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
168	float G = G_BlinnPhong_Implicit( );
169	float D = D_BlinnPhong( shininess, dotNH );
170	return F * ( G * D );
171} // validated`,mu=`#ifdef USE_IRIDESCENCE
172	const mat3 XYZ_TO_REC709 = mat3(
173		 3.2404542, -0.9692660,  0.0556434,
174		-1.5371385,  1.8760108, -0.2040259,
175		-0.4985314,  0.0415560,  1.0572252
176	);
177	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
178		vec3 sqrtF0 = sqrt( fresnel0 );
179		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
180	}
181	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
182		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
183	}
184	float IorToFresnel0( float transmittedIor, float incidentIor ) {
185		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
186	}
187	vec3 evalSensitivity( float OPD, vec3 shift ) {
188		float phase = 2.0 * PI * OPD * 1.0e-9;
189		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
190		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
191		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
192		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
193		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 ) );
194		xyz /= 1.0685e-7;
195		vec3 rgb = XYZ_TO_REC709 * xyz;
196		return rgb;
197	}
198	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
199		vec3 I;
200		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
201		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
202		float cosTheta2Sq = 1.0 - sinTheta2Sq;
203		if ( cosTheta2Sq < 0.0 ) {
204			return vec3( 1.0 );
205		}
206		float cosTheta2 = sqrt( cosTheta2Sq );
207		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
208		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
209		float T121 = 1.0 - R12;
210		float phi12 = 0.0;
211		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
212		float phi21 = PI - phi12;
213		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
214		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
215		vec3 phi23 = vec3( 0.0 );
216		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
217		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
218		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
219		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
220		vec3 phi = vec3( phi21 ) + phi23;
221		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
222		vec3 r123 = sqrt( R123 );
223		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
224		vec3 C0 = R12 + Rs;
225		I = C0;
226		vec3 Cm = Rs - T121;
227		for ( int m = 1; m <= 2; ++ m ) {
228			Cm *= r123;
229			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
230			I += Cm * Sm;
231		}
232		return max( I, vec3( 0.0 ) );
233	}
234#endif`,_u=`#ifdef USE_BUMPMAP
235	uniform sampler2D bumpMap;
236	uniform float bumpScale;
237	vec2 dHdxy_fwd() {
238		vec2 dSTdx = dFdx( vBumpMapUv );
239		vec2 dSTdy = dFdy( vBumpMapUv );
240		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
241		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
242		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
243		return vec2( dBx, dBy );
244	}
245	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
246		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
247		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
248		vec3 vN = surf_norm;
249		vec3 R1 = cross( vSigmaY, vN );
250		vec3 R2 = cross( vN, vSigmaX );
251		float fDet = dot( vSigmaX, R1 ) * faceDirection;
252		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
253		return normalize( abs( fDet ) * surf_norm - vGrad );
254	}
255#endif`,gu=`#if NUM_CLIPPING_PLANES > 0
256	vec4 plane;
257	#ifdef ALPHA_TO_COVERAGE
258		float distanceToPlane, distanceGradient;
259		float clipOpacity = 1.0;
260		#pragma unroll_loop_start
261		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
262			plane = clippingPlanes[ i ];
263			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
264			distanceGradient = fwidth( distanceToPlane ) / 2.0;
265			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
266			if ( clipOpacity == 0.0 ) discard;
267		}
268		#pragma unroll_loop_end
269		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
270			float unionClipOpacity = 1.0;
271			#pragma unroll_loop_start
272			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
273				plane = clippingPlanes[ i ];
274				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
275				distanceGradient = fwidth( distanceToPlane ) / 2.0;
276				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
277			}
278			#pragma unroll_loop_end
279			clipOpacity *= 1.0 - unionClipOpacity;
280		#endif
281		diffuseColor.a *= clipOpacity;
282		if ( diffuseColor.a == 0.0 ) discard;
283	#else
284		#pragma unroll_loop_start
285		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
286			plane = clippingPlanes[ i ];
287			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
288		}
289		#pragma unroll_loop_end
290		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
291			bool clipped = true;
292			#pragma unroll_loop_start
293			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
294				plane = clippingPlanes[ i ];
295				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
296			}
297			#pragma unroll_loop_end
298			if ( clipped ) discard;
299		#endif
300	#endif
301#endif`,vu=`#if NUM_CLIPPING_PLANES > 0
302	varying vec3 vClipPosition;
303	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
304#endif`,xu=`#if NUM_CLIPPING_PLANES > 0
305	varying vec3 vClipPosition;
306#endif`,Su=`#if NUM_CLIPPING_PLANES > 0
307	vClipPosition = - mvPosition.xyz;
308#endif`,Mu=`#if defined( USE_COLOR_ALPHA )
309	diffuseColor *= vColor;
310#elif defined( USE_COLOR )
311	diffuseColor.rgb *= vColor;
312#endif`,Eu=`#if defined( USE_COLOR_ALPHA )
313	varying vec4 vColor;
314#elif defined( USE_COLOR )
315	varying vec3 vColor;
316#endif`,Tu=`#if defined( USE_COLOR_ALPHA )
317	varying vec4 vColor;
318#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
319	varying vec3 vColor;
320#endif`,yu=`#if defined( USE_COLOR_ALPHA )
321	vColor = vec4( 1.0 );
322#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
323	vColor = vec3( 1.0 );
324#endif
325#ifdef USE_COLOR
326	vColor *= color;
327#endif
328#ifdef USE_INSTANCING_COLOR
329	vColor.xyz *= instanceColor.xyz;
330#endif
331#ifdef USE_BATCHING_COLOR
332	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
333	vColor.xyz *= batchingColor.xyz;
334#endif`,bu=`#define PI 3.141592653589793
335#define PI2 6.283185307179586
336#define PI_HALF 1.5707963267948966
337#define RECIPROCAL_PI 0.3183098861837907
338#define RECIPROCAL_PI2 0.15915494309189535
339#define EPSILON 1e-6
340#ifndef saturate
341#define saturate( a ) clamp( a, 0.0, 1.0 )
342#endif
343#define whiteComplement( a ) ( 1.0 - saturate( a ) )
344float pow2( const in float x ) { return x*x; }
345vec3 pow2( const in vec3 x ) { return x*x; }
346float pow3( const in float x ) { return x*x*x; }
347float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
348float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
349float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
350highp float rand( const in vec2 uv ) {
351	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
352	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
353	return fract( sin( sn ) * c );
354}
355#ifdef HIGH_PRECISION
356	float precisionSafeLength( vec3 v ) { return length( v ); }
357#else
358	float precisionSafeLength( vec3 v ) {
359		float maxComponent = max3( abs( v ) );
360		return length( v / maxComponent ) * maxComponent;
361	}
362#endif
363struct IncidentLight {
364	vec3 color;
365	vec3 direction;
366	bool visible;
367};
368struct ReflectedLight {
369	vec3 directDiffuse;
370	vec3 directSpecular;
371	vec3 indirectDiffuse;
372	vec3 indirectSpecular;
373};
374#ifdef USE_ALPHAHASH
375	varying vec3 vPosition;
376#endif
377vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
378	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
379}
380vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
381	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
382}
383mat3 transposeMat3( const in mat3 m ) {
384	mat3 tmp;
385	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
386	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
387	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
388	return tmp;
389}
390bool isPerspectiveMatrix( mat4 m ) {
391	return m[ 2 ][ 3 ] == - 1.0;
392}
393vec2 equirectUv( in vec3 dir ) {
394	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
395	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
396	return vec2( u, v );
397}
398vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
399	return RECIPROCAL_PI * diffuseColor;
400}
401vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
402	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
403	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
404}
405float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
406	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
407	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
408} // validated`,Au=`#ifdef ENVMAP_TYPE_CUBE_UV
409	#define cubeUV_minMipLevel 4.0
410	#define cubeUV_minTileSize 16.0
411	float getFace( vec3 direction ) {
412		vec3 absDirection = abs( direction );
413		float face = - 1.0;
414		if ( absDirection.x > absDirection.z ) {
415			if ( absDirection.x > absDirection.y )
416				face = direction.x > 0.0 ? 0.0 : 3.0;
417			else
418				face = direction.y > 0.0 ? 1.0 : 4.0;
419		} else {
420			if ( absDirection.z > absDirection.y )
421				face = direction.z > 0.0 ? 2.0 : 5.0;
422			else
423				face = direction.y > 0.0 ? 1.0 : 4.0;
424		}
425		return face;
426	}
427	vec2 getUV( vec3 direction, float face ) {
428		vec2 uv;
429		if ( face == 0.0 ) {
430			uv = vec2( direction.z, direction.y ) / abs( direction.x );
431		} else if ( face == 1.0 ) {
432			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
433		} else if ( face == 2.0 ) {
434			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
435		} else if ( face == 3.0 ) {
436			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
437		} else if ( face == 4.0 ) {
438			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
439		} else {
440			uv = vec2( direction.x, direction.y ) / abs( direction.z );
441		}
442		return 0.5 * ( uv + 1.0 );
443	}
444	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
445		float face = getFace( direction );
446		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
447		mipInt = max( mipInt, cubeUV_minMipLevel );
448		float faceSize = exp2( mipInt );
449		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
450		if ( face > 2.0 ) {
451			uv.y += faceSize;
452			face -= 3.0;
453		}
454		uv.x += face * faceSize;
455		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
456		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
457		uv.x *= CUBEUV_TEXEL_WIDTH;
458		uv.y *= CUBEUV_TEXEL_HEIGHT;
459		#ifdef texture2DGradEXT
460			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
461		#else
462			return texture2D( envMap, uv ).rgb;
463		#endif
464	}
465	#define cubeUV_r0 1.0
466	#define cubeUV_m0 - 2.0
467	#define cubeUV_r1 0.8
468	#define cubeUV_m1 - 1.0
469	#define cubeUV_r4 0.4
470	#define cubeUV_m4 2.0
471	#define cubeUV_r5 0.305
472	#define cubeUV_m5 3.0
473	#define cubeUV_r6 0.21
474	#define cubeUV_m6 4.0
475	float roughnessToMip( float roughness ) {
476		float mip = 0.0;
477		if ( roughness >= cubeUV_r1 ) {
478			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
479		} else if ( roughness >= cubeUV_r4 ) {
480			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
481		} else if ( roughness >= cubeUV_r5 ) {
482			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
483		} else if ( roughness >= cubeUV_r6 ) {
484			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
485		} else {
486			mip = - 2.0 * log2( 1.16 * roughness );		}
487		return mip;
488	}
489	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
490		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
491		float mipF = fract( mip );
492		float mipInt = floor( mip );
493		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
494		if ( mipF == 0.0 ) {
495			return vec4( color0, 1.0 );
496		} else {
497			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
498			return vec4( mix( color0, color1, mipF ), 1.0 );
499		}
500	}
501#endif`,Ru=`vec3 transformedNormal = objectNormal;
502#ifdef USE_TANGENT
503	vec3 transformedTangent = objectTangent;
504#endif
505#ifdef USE_BATCHING
506	mat3 bm = mat3( batchingMatrix );
507	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
508	transformedNormal = bm * transformedNormal;
509	#ifdef USE_TANGENT
510		transformedTangent = bm * transformedTangent;
511	#endif
512#endif
513#ifdef USE_INSTANCING
514	mat3 im = mat3( instanceMatrix );
515	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
516	transformedNormal = im * transformedNormal;
517	#ifdef USE_TANGENT
518		transformedTangent = im * transformedTangent;
519	#endif
520#endif
521transformedNormal = normalMatrix * transformedNormal;
522#ifdef FLIP_SIDED
523	transformedNormal = - transformedNormal;
524#endif
525#ifdef USE_TANGENT
526	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
527	#ifdef FLIP_SIDED
528		transformedTangent = - transformedTangent;
529	#endif
530#endif`,Cu=`#ifdef USE_DISPLACEMENTMAP
531	uniform sampler2D displacementMap;
532	uniform float displacementScale;
533	uniform float displacementBias;
534#endif`,wu=`#ifdef USE_DISPLACEMENTMAP
535	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
535placementBias );
536#endif`,Pu=`#ifdef USE_EMISSIVEMAP
537	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
538	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
539		emissiveColor = sRGBTransferEOTF( emissiveColor );
540	#endif
541	totalEmissiveRadiance *= emissiveColor.rgb;
542#endif`,Du=`#ifdef USE_EMISSIVEMAP
543	uniform sampler2D emissiveMap;
544#endif`,Iu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Lu=`vec4 LinearTransferOETF( in vec4 value ) {
545	return value;
546}
547vec4 sRGBTransferEOTF( in vec4 value ) {
548	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 );
549}
550vec4 sRGBTransferOETF( in vec4 value ) {
551	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 );
552}`,Uu=`#ifdef USE_ENVMAP
553	#ifdef ENV_WORLDPOS
554		vec3 cameraToFrag;
555		if ( isOrthographic ) {
556			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
557		} else {
558			cameraToFrag = normalize( vWorldPosition - cameraPosition );
559		}
560		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
561		#ifdef ENVMAP_MODE_REFLECTION
562			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
563		#else
564			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
565		#endif
566	#else
567		vec3 reflectVec = vReflect;
568	#endif
569	#ifdef ENVMAP_TYPE_CUBE
570		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
571	#else
572		vec4 envColor = vec4( 0.0 );
573	#endif
574	#ifdef ENVMAP_BLENDING_MULTIPLY
575		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
576	#elif defined( ENVMAP_BLENDING_MIX )
577		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
578	#elif defined( ENVMAP_BLENDING_ADD )
579		outgoingLight += envColor.xyz * specularStrength * reflectivity;
580	#endif
581#endif`,Nu=`#ifdef USE_ENVMAP
582	uniform float envMapIntensity;
583	uniform float flipEnvMap;
584	uniform mat3 envMapRotation;
585	#ifdef ENVMAP_TYPE_CUBE
586		uniform samplerCube envMap;
587	#else
588		uniform sampler2D envMap;
589	#endif
590	
591#endif`,Fu=`#ifdef USE_ENVMAP
592	uniform float reflectivity;
593	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
594		#define ENV_WORLDPOS
595	#endif
596	#ifdef ENV_WORLDPOS
597		varying vec3 vWorldPosition;
598		uniform float refractionRatio;
599	#else
600		varying vec3 vReflect;
601	#endif
602#endif`,Ou=`#ifdef USE_ENVMAP
603	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
604		#define ENV_WORLDPOS
605	#endif
606	#ifdef ENV_WORLDPOS
607		
608		varying vec3 vWorldPosition;
609	#else
610		varying vec3 vReflect;
611		uniform float refractionRatio;
612	#endif
613#endif`,Bu=`#ifdef USE_ENVMAP
614	#ifdef ENV_WORLDPOS
615		vWorldPosition = worldPosition.xyz;
616	#else
617		vec3 cameraToVertex;
618		if ( isOrthographic ) {
619			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
620		} else {
621			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
622		}
623		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
624		#ifdef ENVMAP_MODE_REFLECTION
625			vReflect = reflect( cameraToVertex, worldNormal );
626		#else
627			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
628		#endif
629	#endif
630#endif`,zu=`#ifdef USE_FOG
631	vFogDepth = - mvPosition.z;
632#endif`,Hu=`#ifdef USE_FOG
633	varying float vFogDepth;
634#endif`,Gu=`#ifdef USE_FOG
635	#ifdef FOG_EXP2
636		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
637	#else
638		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
639	#endif
640	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
641#endif`,Vu=`#ifdef USE_FOG
642	uniform vec3 fogColor;
643	varying float vFogDepth;
644	#ifdef FOG_EXP2
645		uniform float fogDensity;
646	#else
647		uniform float fogNear;
648		uniform float fogFar;
649	#endif
650#endif`,ku=`#ifdef USE_GRADIENTMAP
651	uniform sampler2D gradientMap;
652#endif
653vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
654	float dotNL = dot( normal, lightDirection );
655	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
656	#ifdef USE_GRADIENTMAP
657		return vec3( texture2D( gradientMap, coord ).r );
658	#else
659		vec2 fw = fwidth( coord ) * 0.5;
660		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
661	#endif
662}`,Wu=`#ifdef USE_LIGHTMAP
663	uniform sampler2D lightMap;
664	uniform float lightMapIntensity;
665#endif`,Xu=`LambertMaterial material;
666material.diffuseColor = diffuseColor.rgb;
667material.specularStrength = specularStrength;`,qu=`varying vec3 vViewPosition;
668struct LambertMaterial {
669	vec3 diffuseColor;
670	float specularStrength;
671};
672void 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 ) {
673	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
674	vec3 irradiance = dotNL * directLight.color;
675	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
676}
677void 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 ) {
678	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
679}
680#define RE_Direct				RE_Direct_Lambert
681#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,Yu=`uniform bool receiveShadow;
682uniform vec3 ambientLightColor;
683#if defined( USE_LIGHT_PROBES )
684	uniform vec3 lightProbe[ 9 ];
685#endif
686vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
687	float x = normal.x, y = normal.y, z = normal.z;
688	vec3 result = shCoefficients[ 0 ] * 0.886227;
689	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
690	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
691	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
692	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
693	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
694	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
695	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
696	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
697	return result;
698}
699vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
700	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
701	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
702	return irradiance;
703}
704vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
705	vec3 irradiance = ambientLightColor;
706	return irradiance;
707}
708float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
709	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
710	if ( cutoffDistance > 0.0 ) {
711		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
712	}
713	return distanceFalloff;
714}
715float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
716	return smoothstep( coneCosine, penumbraCosine, angleCosine );
717}
718#if NUM_DIR_LIGHTS > 0
719	struct DirectionalLight {
720		vec3 direction;
721		vec3 color;
722	};
723	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
724	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
725		light.color = directionalLight.color;
726		light.direction = directionalLight.direction;
727		light.visible = true;
728	}
729#endif
730#if NUM_POINT_LIGHTS > 0
731	struct PointLight {
732		vec3 position;
733		vec3 color;
734		float distance;
735		float decay;
736	};
737	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
738	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
739		vec3 lVector = pointLight.position - geometryPosition;
740		light.direction = normalize( lVector );
741		float lightDistance = length( lVector );
742		light.color = pointLight.color;
743		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
744		light.visible = ( light.color != vec3( 0.0 ) );
745	}
746#endif
747#if NUM_SPOT_LIGHTS > 0
748	struct SpotLight {
749		vec3 position;
750		vec3 direction;
751		vec3 color;
752		float distance;
753		float decay;
754		float coneCos;
755		float penumbraCos;
756	};
757	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
758	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
759		vec3 lVector = spotLight.position - geometryPosition;
760		light.direction = normalize( lVector );
761		float angleCos = dot( light.direction, spotLight.direction );
762		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
763		if ( spotAttenuation > 0.0 ) {
764			float lightDistance = length( lVector );
765			light.color = spotLight.color * spotAttenuation;
766			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
767			light.visible = ( light.color != vec3( 0.0 ) );
768		} else {
769			light.color = vec3( 0.0 );
770			light.visible = false;
771		}
772	}
773#endif
774#if NUM_RECT_AREA_LIGHTS > 0
775	struct RectAreaLight {
776		vec3 color;
777		vec3 position;
778		vec3 halfWidth;
779		vec3 halfHeight;
780	};
781	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
782	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
783#endif
784#if NUM_HEMI_LIGHTS > 0
785	struct HemisphereLight {
786		vec3 direction;
787		vec3 skyColor;
788		vec3 groundColor;
789	};
790	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
791	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
792		float dotNL = dot( normal, hemiLight.direction );
793		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
794		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
795		return irradiance;
796	}
797#endif`,Ku=`#ifdef USE_ENVMAP
798	vec3 getIBLIrradiance( const in vec3 normal ) {
799		#ifdef ENVMAP_TYPE_CUBE_UV
800			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
801			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
802			return PI * envMapColor.rgb * envMapIntensity;
803		#else
804			return vec3( 0.0 );
805		#endif
806	}
807	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
808		#ifdef ENVMAP_TYPE_CUBE_UV
809			vec3 reflectVec = reflect( - viewDir, normal );
810			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
811			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
812			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
813			return envMapColor.rgb * envMapIntensity;
814		#else
815			return vec3( 0.0 );
816		#endif
817	}
818	#ifdef USE_ANISOTROPY
819		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
820			#ifdef ENVMAP_TYPE_CUBE_UV
821				vec3 bentNormal = cross( bitangent, viewDir );
822				bentNormal = normalize( cross( bentNormal, bitangent ) );
823				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
824				return getIBLRadiance( viewDir, bentNormal, roughness );
825			#else
826				return vec3( 0.0 );
827			#endif
828		}
829	#endif
830#endif`,$u=`ToonMaterial material;
831material.diffuseColor = diffuseColor.rgb;`,Zu=`varying vec3 vViewPosition;
832struct ToonMaterial {
833	vec3 diffuseColor;
834};
835void 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 ) {
836	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
837	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
838}
839void 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 ) {
840	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
841}
842#define RE_Direct				RE_Direct_Toon
843#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,ju=`BlinnPhongMaterial material;
844material.diffuseColor = diffuseColor.rgb;
845material.specularColor = specular;
846material.specularShininess = shininess;
847material.specularStrength = specularStrength;`,Ju=`varying vec3 vViewPosition;
848struct BlinnPhongMaterial {
849	vec3 diffuseColor;
850	vec3 specularColor;
851	float specularShininess;
852	float specularStrength;
853};
854void 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 ) {
855	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
856	vec3 irradiance = dotNL * directLight.color;
857	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
858	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
859}
860void 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 ) {
861	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
862}
863#define RE_Direct				RE_Direct_BlinnPhong
864#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Qu=`PhysicalMaterial material;
865material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
866vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
867float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
868material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
869material.roughness = min( material.roughness, 1.0 );
870#ifdef IOR
871	material.ior = ior;
872	#ifdef USE_SPECULAR
873		float specularIntensityFactor = specularIntensity;
874		vec3 specularColorFactor = specularColor;
875		#ifdef USE_SPECULAR_COLORMAP
876			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
877		#endif
878		#ifdef USE_SPECULAR_INTENSITYMAP
879			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
880		#endif
881		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
882	#else
883		float specularIntensityFactor = 1.0;
884		vec3 specularColorFactor = vec3( 1.0 );
885		material.specularF90 = 1.0;
886	#endif
887	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
888#else
889	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
890	material.specularF90 = 1.0;
891#endif
892#ifdef USE_CLEARCOAT
893	material.clearcoat = clearcoat;
894	material.clearcoatRoughness = clearcoatRoughness;
895	material.clearcoatF0 = vec3( 0.04 );
896	material.clearcoatF90 = 1.0;
897	#ifdef USE_CLEARCOATMAP
898		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
899	#endif
900	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
901		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
902	#endif
903	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
904	material.clearcoatRoughness += geometryRoughness;
905	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
906#endif
907#ifdef USE_DISPERSION
908	material.dispersion = dispersion;
909#endif
910#ifdef USE_IRIDESCENCE
911	material.iridescence = iridescence;
912	material.iridescenceIOR = iridescenceIOR;
913	#ifdef USE_IRIDESCENCEMAP
914		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
915	#endif
916	#ifdef USE_IRIDESCENCE_THICKNESSMAP
917		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
918	#else
919		material.iridescenceThickness = iridescenceThicknessMaximum;
920	#endif
921#endif
922#ifdef USE_SHEEN
923	material.sheenColor = sheenColor;
924	#ifdef USE_SHEEN_COLORMAP
925		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
926	#endif
927	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
928	#ifdef USE_SHEEN_ROUGHNESSMAP
929		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
930	#endif
931#endif
932#ifdef USE_ANISOTROPY
933	#ifdef USE_ANISOTROPYMAP
934		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
935		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
936		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
937	#else
938		vec2 anisotropyV = anisotropyVector;
939	#endif
940	material.anisotropy = length( anisotropyV );
941	if( material.anisotropy == 0.0 ) {
942		anisotropyV = vec2( 1.0, 0.0 );
943	} else {
944		anisotropyV /= material.anisotropy;
945		material.anisotropy = saturate( material.anisotropy );
946	}
947	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
948	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
949	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
950#endif`,ed
vendor: 14,688 bytes, lines 950-1251
950=`struct PhysicalMaterial {
951	vec3 diffuseColor;
952	float roughness;
953	vec3 specularColor;
954	float specularF90;
955	float dispersion;
956	#ifdef USE_CLEARCOAT
957		float clearcoat;
958		float clearcoatRoughness;
959		vec3 clearcoatF0;
960		float clearcoatF90;
961	#endif
962	#ifdef USE_IRIDESCENCE
963		float iridescence;
964		float iridescenceIOR;
965		float iridescenceThickness;
966		vec3 iridescenceFresnel;
967		vec3 iridescenceF0;
968	#endif
969	#ifdef USE_SHEEN
970		vec3 sheenColor;
971		float sheenRoughness;
972	#endif
973	#ifdef IOR
974		float ior;
975	#endif
976	#ifdef USE_TRANSMISSION
977		float transmission;
978		float transmissionAlpha;
979		float thickness;
980		float attenuationDistance;
981		vec3 attenuationColor;
982	#endif
983	#ifdef USE_ANISOTROPY
984		float anisotropy;
985		float alphaT;
986		vec3 anisotropyT;
987		vec3 anisotropyB;
988	#endif
989};
990vec3 clearcoatSpecularDirect = vec3( 0.0 );
991vec3 clearcoatSpecularIndirect = vec3( 0.0 );
992vec3 sheenSpecularDirect = vec3( 0.0 );
993vec3 sheenSpecularIndirect = vec3(0.0 );
994vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
995    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
996    float x2 = x * x;
997    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
998    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
999}
1000float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1001	float a2 = pow2( alpha );
1002	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1003	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1004	return 0.5 / max( gv + gl, EPSILON );
1005}
1006float D_GGX( const in float alpha, const in float dotNH ) {
1007	float a2 = pow2( alpha );
1008	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1009	return RECIPROCAL_PI * a2 / pow2( denom );
1010}
1011#ifdef USE_ANISOTROPY
1012	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 ) {
1013		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1014		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1015		float v = 0.5 / ( gv + gl );
1016		return saturate(v);
1017	}
1018	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1019		float a2 = alphaT * alphaB;
1020		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1021		highp float v2 = dot( v, v );
1022		float w2 = a2 / v2;
1023		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1024	}
1025#endif
1026#ifdef USE_CLEARCOAT
1027	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1028		vec3 f0 = material.clearcoatF0;
1029		float f90 = material.clearcoatF90;
1030		float roughness = material.clearcoatRoughness;
1031		float alpha = pow2( roughness );
1032		vec3 halfDir = normalize( lightDir + viewDir );
1033		float dotNL = saturate( dot( normal, lightDir ) );
1034		float dotNV = saturate( dot( normal, viewDir ) );
1035		float dotNH = saturate( dot( normal, halfDir ) );
1036		float dotVH = saturate( dot( viewDir, halfDir ) );
1037		vec3 F = F_Schlick( f0, f90, dotVH );
1038		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1039		float D = D_GGX( alpha, dotNH );
1040		return F * ( V * D );
1041	}
1042#endif
1043vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1044	vec3 f0 = material.specularColor;
1045	float f90 = material.specularF90;
1046	float roughness = material.roughness;
1047	float alpha = pow2( roughness );
1048	vec3 halfDir = normalize( lightDir + viewDir );
1049	float dotNL = saturate( dot( normal, lightDir ) );
1050	float dotNV = saturate( dot( normal, viewDir ) );
1051	float dotNH = saturate( dot( normal, halfDir ) );
1052	float dotVH = saturate( dot( viewDir, halfDir ) );
1053	vec3 F = F_Schlick( f0, f90, dotVH );
1054	#ifdef USE_IRIDESCENCE
1055		F = mix( F, material.iridescenceFresnel, material.iridescence );
1056	#endif
1057	#ifdef USE_ANISOTROPY
1058		float dotTL = dot( material.anisotropyT, lightDir );
1059		float dotTV = dot( material.anisotropyT, viewDir );
1060		float dotTH = dot( material.anisotropyT, halfDir );
1061		float dotBL = dot( material.anisotropyB, lightDir );
1062		float dotBV = dot( material.anisotropyB, viewDir );
1063		float dotBH = dot( material.anisotropyB, halfDir );
1064		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1065		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1066	#else
1067		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1068		float D = D_GGX( alpha, dotNH );
1069	#endif
1070	return F * ( V * D );
1071}
1072vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1073	const float LUT_SIZE = 64.0;
1074	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1075	const float LUT_BIAS = 0.5 / LUT_SIZE;
1076	float dotNV = saturate( dot( N, V ) );
1077	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1078	uv = uv * LUT_SCALE + LUT_BIAS;
1079	return uv;
1080}
1081float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1082	float l = length( f );
1083	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1084}
1085vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1086	float x = dot( v1, v2 );
1087	float y = abs( x );
1088	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1089	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1090	float v = a / b;
1091	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1092	return cross( v1, v2 ) * theta_sintheta;
1093}
1094vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1095	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1096	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1097	vec3 lightNormal = cross( v1, v2 );
1098	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1099	vec3 T1, T2;
1100	T1 = normalize( V - N * dot( V, N ) );
1101	T2 = - cross( N, T1 );
1102	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1103	vec3 coords[ 4 ];
1104	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1105	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1106	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1107	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1108	coords[ 0 ] = normalize( coords[ 0 ] );
1109	coords[ 1 ] = normalize( coords[ 1 ] );
1110	coords[ 2 ] = normalize( coords[ 2 ] );
1111	coords[ 3 ] = normalize( coords[ 3 ] );
1112	vec3 vectorFormFactor = vec3( 0.0 );
1113	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1114	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1115	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1116	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1117	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1118	return vec3( result );
1119}
1120#if defined( USE_SHEEN )
1121float D_Charlie( float roughness, float dotNH ) {
1122	float alpha = pow2( roughness );
1123	float invAlpha = 1.0 / alpha;
1124	float cos2h = dotNH * dotNH;
1125	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1126	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1127}
1128float V_Neubelt( float dotNV, float dotNL ) {
1129	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1130}
1131vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1132	vec3 halfDir = normalize( lightDir + viewDir );
1133	float dotNL = saturate( dot( normal, lightDir ) );
1134	float dotNV = saturate( dot( normal, viewDir ) );
1135	float dotNH = saturate( dot( normal, halfDir ) );
1136	float D = D_Charlie( sheenRoughness, dotNH );
1137	float V = V_Neubelt( dotNV, dotNL );
1138	return sheenColor * ( D * V );
1139}
1140#endif
1141float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1142	float dotNV = saturate( dot( normal, viewDir ) );
1143	float r2 = roughness * roughness;
1144	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1145	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1146	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1147	return saturate( DG * RECIPROCAL_PI );
1148}
1149vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1150	float dotNV = saturate( dot( normal, viewDir ) );
1151	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1152	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1153	vec4 r = roughness * c0 + c1;
1154	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1155	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1156	return fab;
1157}
1158vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1159	vec2 fab = DFGApprox( normal, viewDir, roughness );
1160	return specularColor * fab.x + specularF90 * fab.y;
1161}
1162#ifdef USE_IRIDESCENCE
1163void 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 ) {
1164#else
1165void 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 ) {
1166#endif
1167	vec2 fab = DFGApprox( normal, viewDir, roughness );
1168	#ifdef USE_IRIDESCENCE
1169		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1170	#else
1171		vec3 Fr = specularColor;
1172	#endif
1173	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1174	float Ess = fab.x + fab.y;
1175	float Ems = 1.0 - Ess;
1176	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1177	singleScatter += FssEss;
1178	multiScatter += Fms * Ems;
1179}
1180#if NUM_RECT_AREA_LIGHTS > 0
1181	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 ) {
1182		vec3 normal = geometryNormal;
1183		vec3 viewDir = geometryViewDir;
1184		vec3 position = geometryPosition;
1185		vec3 lightPos = rectAreaLight.position;
1186		vec3 halfWidth = rectAreaLight.halfWidth;
1187		vec3 halfHeight = rectAreaLight.halfHeight;
1188		vec3 lightColor = rectAreaLight.color;
1189		float roughness = material.roughness;
1190		vec3 rectCoords[ 4 ];
1191		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1192		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1193		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1194		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1195		vec4 t1 = texture2D( ltc_1, uv );
1196		vec4 t2 = texture2D( ltc_2, uv );
1197		mat3 mInv = mat3(
1198			vec3( t1.x, 0, t1.y ),
1199			vec3(    0, 1,    0 ),
1200			vec3( t1.z, 0, t1.w )
1201		);
1202		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1203		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1204		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1205	}
1206#endif
1207void 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 ) {
1208	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1209	vec3 irradiance = dotNL * directLight.color;
1210	#ifdef USE_CLEARCOAT
1211		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1212		vec3 ccIrradiance = dotNLcc * directLight.color;
1213		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1214	#endif
1215	#ifdef USE_SHEEN
1216		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1217	#endif
1218	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1219	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1220}
1221void 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 ) {
1222	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1223}
1224void 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) {
1225	#ifdef USE_CLEARCOAT
1226		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1227	#endif
1228	#ifdef USE_SHEEN
1229		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1230	#endif
1231	vec3 singleScattering = vec3( 0.0 );
1232	vec3 multiScattering = vec3( 0.0 );
1233	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1234	#ifdef USE_IRIDESCENCE
1235		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1236	#else
1237		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1238	#endif
1239	vec3 totalScattering = singleScattering + multiScattering;
1240	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1241	reflectedLight.indirectSpecular += radiance * singleScattering;
1242	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1243	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1244}
1245#define RE_Direct				RE_Direct_Physical
1246#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1247#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1248#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1249float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1250	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1251}`,t
1251d=`
1252vec3 geometryPosition = - vViewPosition;
1253vec3 geometryNormal = normal;
1254vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1255vec3 geometryClearcoatNormal = vec3( 0.0 );
1256#ifdef USE_CLEARCOAT
1257	geometryClearcoatNormal = clearcoatNormal;
1258#endif
1259#ifdef USE_IRIDESCENCE
1260	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1261	if ( material.iridescenceThickness == 0.0 ) {
1262		material.iridescence = 0.0;
1263	} else {
1264		material.iridescence = saturate( material.iridescence );
1265	}
1266	if ( material.iridescence > 0.0 ) {
1267		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1268		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1269	}
1270#endif
1271IncidentLight directLight;
1272#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1273	PointLight pointLight;
1274	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1275	PointLightShadow pointLightShadow;
1276	#endif
1277	#pragma unroll_loop_start
1278	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1279		pointLight = pointLights[ i ];
1280		getPointLightInfo( pointLight, geometryPosition, directLight );
1281		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1282		pointLightShadow = pointLightShadows[ i ];
1283		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1284		#endif
1285		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1286	}
1287	#pragma unroll_loop_end
1288#endif
1289#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1290	SpotLight spotLight;
1291	vec4 spotColor;
1292	vec3 spotLightCoord;
1293	bool inSpotLightMap;
1294	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1295	SpotLightShadow spotLightShadow;
1296	#endif
1297	#pragma unroll_loop_start
1298	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1299		spotLight = spotLights[ i ];
1300		getSpotLightInfo( spotLight, geometryPosition, directLight );
1301		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1302		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1303		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1304		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1305		#else
1306		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1307		#endif
1308		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1309			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1310			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1311			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1312			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1313		#endif
1314		#undef SPOT_LIGHT_MAP_INDEX
1315		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1316		spotLightShadow = spotLightShadows[ i ];
1317		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1318		#endif
1319		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1320	}
1321	#pragma unroll_loop_end
1322#endif
1323#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1324	DirectionalLight directionalLight;
1325	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1326	DirectionalLightShadow directionalLightShadow;
1327	#endif
1328	#pragma unroll_loop_start
1329	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1330		directionalLight = directionalLights[ i ];
1331		getDirectionalLightInfo( directionalLight, directLight );
1332		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1333		directionalLightShadow = directionalLightShadows[ i ];
1334		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1335		#endif
1336		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1337	}
1338	#pragma unroll_loop_end
1339#endif
1340#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1341	RectAreaLight rectAreaLight;
1342	#pragma unroll_loop_start
1343	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1344		rectAreaLight = rectAreaLights[ i ];
1345		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1346	}
1347	#pragma unroll_loop_end
1348#endif
1349#if defined( RE_IndirectDiffuse )
1350	vec3 iblIrradiance = vec3( 0.0 );
1351	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1352	#if defined( USE_LIGHT_PROBES )
1353		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1354	#endif
1355	#if ( NUM_HEMI_LIGHTS > 0 )
1356		#pragma unroll_loop_start
1357		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1358			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1359		}
1360		#pragma unroll_loop_end
1361	#endif
1362#endif
1363#if defined( RE_IndirectSpecular )
1364	vec3 radiance = vec3( 0.0 );
1365	vec3 clearcoatRadiance = vec3( 0.0 );
1366#endif`,nd=`#if defined( RE_IndirectDiffuse )
1367	#ifdef USE_LIGHTMAP
1368		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1369		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1370		irradiance += lightMapIrradiance;
1371	#endif
1372	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1373		iblIrradiance += getIBLIrradiance( geometryNormal );
1374	#endif
1375#endif
1376#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1377	#ifdef USE_ANISOTROPY
1378		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1379	#else
1380		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1381	#endif
1382	#ifdef USE_CLEARCOAT
1383		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1384	#endif
1385#endif`,id=`#if defined( RE_IndirectDiffuse )
1386	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1387#endif
1388#if defined( RE_IndirectSpecular )
1389	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1390#endif`,rd=`#if defined( USE_LOGDEPTHBUF )
1391	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1392#endif`,sd=`#if defined( USE_LOGDEPTHBUF )
1393	uniform float logDepthBufFC;
1394	varying float vFragDepth;
1395	varying float vIsPerspective;
1396#endif`,ad=`#ifdef USE_LOGDEPTHBUF
1397	varying float vFragDepth;
1398	varying float vIsPerspective;
1399#endif`,od=`#ifdef USE_LOGDEPTHBUF
1400	vFragDepth = 1.0 + gl_Position.w;
1401	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1402#endif`,ld=`#ifdef USE_MAP
1403	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1404	#ifdef DECODE_VIDEO_TEXTURE
1405		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1406	#endif
1407	diffuseColor *= sampledDiffuseColor;
1408#endif`,cd=`#ifdef USE_MAP
1409	uniform sampler2D map;
1410#endif`,ud=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1411	#if defined( USE_POINTS_UV )
1412		vec2 uv = vUv;
1413	#else
1414		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1415	#endif
1416#endif
1417#ifdef USE_MAP
1418	diffuseColor *= texture2D( map, uv );
1419#endif
1420#ifdef USE_ALPHAMAP
1421	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1422#endif`,dd=`#if defined( USE_POINTS_UV )
1423	varying vec2 vUv;
1424#else
1425	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1426		uniform mat3 uvTransform;
1427	#endif
1428#endif
1429#ifdef USE_MAP
1430	uniform sampler2D map;
1431#endif
1432#ifdef USE_ALPHAMAP
1433	uniform sampler2D alphaMap;
1434#endif`,fd=`float metalnessFactor = metalness;
1435#ifdef USE_METALNESSMAP
1436	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1437	metalnessFactor *= texelMetalness.b;
1438#endif`,hd=`#ifdef USE_METALNESSMAP
1439	uniform sampler2D metalnessMap;
1440#endif`,pd=`#ifdef USE_INSTANCING_MORPH
1441	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1442	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1443	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1444		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1445	}
1446#endif`,md=`#if defined( USE_MORPHCOLORS )
1447	vColor *= morphTargetBaseInfluence;
1448	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1449		#if defined( USE_COLOR_ALPHA )
1450			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1451		#elif defined( USE_COLOR )
1452			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1453		#endif
1454	}
1455#endif`,_d=`#ifdef USE_MORPHNORMALS
1456	objectNormal *= morphTargetBaseInfluence;
1457	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1458		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1459	}
1460#endif`,gd=`#ifdef USE_MORPHTARGETS
1461	#ifndef USE_INSTANCING_MORPH
1462		uniform float morphTargetBaseInfluence;
1463		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1464	#endif
1465	uniform sampler2DArray morphTargetsTexture;
1466	uniform ivec2 morphTargetsTextureSize;
1467	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1468		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1469		int y = texelIndex / morphTargetsTextureSize.x;
1470		int x = texelIndex - y * morphTargetsTextureSize.x;
1471		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1472		return texelFetch( morphTargetsTexture, morphUV, 0 );
1473	}
1474#endif`,vd=`#ifdef USE_MORPHTARGETS
1475	transformed *= morphTargetBaseInfluence;
1476	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1477		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1478	}
1479#endif`,xd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1480#ifdef FLAT_SHADED
1481	vec3 fdx = dFdx( vViewPosition );
1482	vec3 fdy = dFdy( vViewPosition );
1483	vec3 normal = normalize( cross( fdx, fdy ) );
1484#else
1485	vec3 normal = normalize( vNormal );
1486	#ifdef DOUBLE_SIDED
1487		normal *= faceDirection;
1488	#endif
1489#endif
1490#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1491	#ifdef USE_TANGENT
1492		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1493	#else
1494		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1495		#if defined( USE_NORMALMAP )
1496			vNormalMapUv
1497		#elif defined( USE_CLEARCOAT_NORMALMAP )
1498			vClearcoatNormalMapUv
1499		#else
1500			vUv
1501		#endif
1502		);
1503	#endif
1504	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1505		tbn[0] *= faceDirection;
1506		tbn[1] *= faceDirection;
1507	#endif
1508#endif
1509#ifdef USE_CLEARCOAT_NORMALMAP
1510	#ifdef USE_TANGENT
1511		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1512	#else
1513		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1514	#endif
1515	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1516		tbn2[0] *= faceDirection;
1517		tbn2[1] *= faceDirection;
1518	#endif
1519#endif
1520vec3 nonPerturbedNormal = normal;`,Sd=`#ifdef USE_NORMALMAP_OBJECTSPACE
1521	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1522	#ifdef FLIP_SIDED
1523		normal = - normal;
1524	#endif
1525	#ifdef DOUBLE_SIDED
1526		normal = normal * faceDirection;
1527	#endif
1528	normal = normalize( normalMatrix * normal );
1529#elif defined( USE_NORMALMAP_TANGENTSPACE )
1530	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1531	mapN.xy *= normalScale;
1532	normal = normalize( tbn * mapN );
1533#elif defined( USE_BUMPMAP )
1534	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1535#endif`,Md=`#ifndef FLAT_SHADED
1536	varying vec3 vNormal;
1537	#ifdef USE_TANGENT
1538		varying vec3 vTangent;
1539		varying vec3 vBitangent;
1540	#endif
1541#endif`,Ed=`#ifndef FLAT_SHADED
1542	varying vec3 vNormal;
1543	#ifdef USE_TANGENT
1544		varying vec3 vTangent;
1545		varying vec3 vBitangent;
1546	#endif
1547#endif`,Td=`#ifndef FLAT_SHADED
1548	vNormal = normalize( transformedNormal );
1549	#ifdef USE_TANGENT
1550		vTangent = normalize( transformedTangent );
1551		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1552	#endif
1553#endif`,yd=`#ifdef USE_NORMALMAP
1554	uniform sampler2D normalMap;
1555	uniform vec2 normalScale;
1556#endif
1557#ifdef USE_NORMALMAP_OBJECTSPACE
1558	uniform mat3 normalMatrix;
1559#endif
1560#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1561	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1562		vec3 q0 = dFdx( eye_pos.xyz );
1563		vec3 q1 = dFdy( eye_pos.xyz );
1564		vec2 st0 = dFdx( uv.st );
1565		vec2 st1 = dFdy( uv.st );
1566		vec3 N = surf_norm;
1567		vec3 q1perp = cross( q1, N );
1568		vec3 q0perp = cross( N, q0 );
1569		vec3 T = q1perp * st0.x + q0perp * st1.x;
1570		vec3 B = q1perp * st0.y + q0perp * st1.y;
1571		float det = max( dot( T, T ), dot( B, B ) );
1572		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1573		return mat3( T * scale, B * scale, N );
1574	}
1575#endif`,bd=`#ifdef USE_CLEARCOAT
1576	vec3 clearcoatNormal = nonPerturbedNormal;
1577#endif`,Ad=`#ifdef USE_CLEARCOAT_NORMALMAP
1578	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1579	clearcoatMapN.xy *= clearcoatNormalScale;
1580	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1581#endif`,Rd=`#ifdef USE_CLEARCOATMAP
1582	uniform sampler2D clearcoatMap;
1583#endif
1584#ifdef USE_CLEARCOAT_NORMALMAP
1585	uniform sampler2D clearcoatNormalMap;
1586	uniform vec2 clearcoatNormalScale;
1587#endif
1588#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1589	uniform sampler2D clearcoatRoughnessMap;
1590#endif`,Cd=`#ifdef USE_IRIDESCENCEMAP
1591	uniform sampler2D iridescenceMap;
1592#endif
1593#ifdef USE_IRIDESCENCE_THICKNESSMAP
1594	uniform sampler2D iridescenceThicknessMap;
1595#endif`,wd=`#ifdef OPAQUE
1596diffuseColor.a = 1.0;
1597#endif
1598#ifdef USE_TRANSMISSION
1599diffuseColor.a *= material.transmissionAlpha;
1600#endif
1601gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Pd=`vec3 packNormalToRGB( const in vec3 normal ) {
1602	return normalize( normal ) * 0.5 + 0.5;
1603}
1604vec3 unpackRGBToNormal( const in vec3 rgb ) {
1605	return 2.0 * rgb.xyz - 1.0;
1606}
1607const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1608const float Inv255 = 1. / 255.;
1609const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1610const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1611const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1612const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1613vec4 packDepthToRGBA( const in float v ) {
1614	if( v <= 0.0 )
1615		return vec4( 0., 0., 0., 0. );
1616	if( v >= 1.0 )
1617		return vec4( 1., 1., 1., 1. );
1618	float vuf;
1619	float af = modf( v * PackFactors.a, vuf );
1620	float bf = modf( vuf * ShiftRight8, vuf );
1621	float gf = modf( vuf * ShiftRight8, vuf );
1622	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1623}
1624vec3 packDepthToRGB( const in float v ) {
1625	if( v <= 0.0 )
1626		return vec3( 0., 0., 0. );
1627	if( v >= 1.0 )
1628		return vec3( 1., 1., 1. );
1629	float vuf;
1630	float bf = modf( v * PackFactors.b, vuf );
1631	float gf = modf( vuf * ShiftRight8, vuf );
1632	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1633}
1634vec2 packDepthToRG( const in float v ) {
1635	if( v <= 0.0 )
1636		return vec2( 0., 0. );
1637	if( v >= 1.0 )
1638		return vec2( 1., 1. );
1639	float vuf;
1640	float gf = modf( v * 256., vuf );
1641	return vec2( vuf * Inv255, gf );
1642}
1643float unpackRGBAToDepth( const in vec4 v ) {
1644	return dot( v, UnpackFactors4 );
1645}
1646float unpackRGBToDepth( const in vec3 v ) {
1647	return dot( v, UnpackFactors3 );
1648}
1649float unpackRGToDepth( const in vec2 v ) {
1650	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1651}
1652vec4 pack2HalfToRGBA( const in vec2 v ) {
1653	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1654	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1655}
1656vec2 unpackRGBATo2Half( const in vec4 v ) {
1657	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1658}
1659float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1660	return ( viewZ + near ) / ( near - far );
1661}
1662float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1663	return depth * ( near - far ) - near;
1664}
1665float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1666	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1667}
1668float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1669	return ( near * far ) / ( ( far - near ) * depth - far );
1670}`,Dd=`#ifdef PREMULTIPLIED_ALPHA
1671	gl_FragColor.rgb *= gl_FragColor.a;
1672#endif`,Id=`vec4 mvPosition = vec4( transformed, 1.0 );
1673#ifdef USE_BATCHING
1674	mvPosition = batchingMatrix * mvPosition;
1675#endif
1676#ifdef USE_INSTANCING
1677	mvPosition = instanceMatrix * mvPosition;
1678#endif
1679mvPosition = modelViewMatrix * mvPosition;
1680gl_Position = projectionMatrix * mvPosition;`,Ld=`#ifdef DITHERING
1681	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1682#endif`,Ud=`#ifdef DITHERING
1683	vec3 dithering( vec3 color ) {
1684		float grid_position = rand( gl_FragCoord.xy );
1685		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1686		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1687		return color + dither_shift_RGB;
1688	}
1689#endif`,Nd=`float roughnessFactor = roughness;
1690#ifdef USE_ROUGHNESSMAP
1691	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1692	roughnessFactor *= texelRoughness.g;
1693#endif`,Fd=`#ifdef USE_ROUGHNESSMAP
1694	uniform sampler2D roughnessMap;
1695#endif`,Od=
vendor: 8,887 bytes, lines 1695-1881
1695`#if NUM_SPOT_LIGHT_COORDS > 0
1696	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1697#endif
1698#if NUM_SPOT_LIGHT_MAPS > 0
1699	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1700#endif
1701#ifdef USE_SHADOWMAP
1702	#if NUM_DIR_LIGHT_SHADOWS > 0
1703		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1704		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1705		struct DirectionalLightShadow {
1706			float shadowIntensity;
1707			float shadowBias;
1708			float shadowNormalBias;
1709			float shadowRadius;
1710			vec2 shadowMapSize;
1711		};
1712		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1713	#endif
1714	#if NUM_SPOT_LIGHT_SHADOWS > 0
1715		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1716		struct SpotLightShadow {
1717			float shadowIntensity;
1718			float shadowBias;
1719			float shadowNormalBias;
1720			float shadowRadius;
1721			vec2 shadowMapSize;
1722		};
1723		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1724	#endif
1725	#if NUM_POINT_LIGHT_SHADOWS > 0
1726		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1727		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1728		struct PointLightShadow {
1729			float shadowIntensity;
1730			float shadowBias;
1731			float shadowNormalBias;
1732			float shadowRadius;
1733			vec2 shadowMapSize;
1734			float shadowCameraNear;
1735			float shadowCameraFar;
1736		};
1737		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1738	#endif
1739	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1740		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1741	}
1742	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1743		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1744	}
1745	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1746		float occlusion = 1.0;
1747		vec2 distribution = texture2DDistribution( shadow, uv );
1748		float hard_shadow = step( compare , distribution.x );
1749		if (hard_shadow != 1.0 ) {
1750			float distance = compare - distribution.x ;
1751			float variance = max( 0.00000, distribution.y * distribution.y );
1752			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 );
1753		}
1754		return occlusion;
1755	}
1756	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1757		float shadow = 1.0;
1758		shadowCoord.xyz /= shadowCoord.w;
1759		shadowCoord.z += shadowBias;
1760		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1761		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1762		if ( frustumTest ) {
1763		#if defined( SHADOWMAP_TYPE_PCF )
1764			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1765			float dx0 = - texelSize.x * shadowRadius;
1766			float dy0 = - texelSize.y * shadowRadius;
1767			float dx1 = + texelSize.x * shadowRadius;
1768			float dy1 = + texelSize.y * shadowRadius;
1769			float dx2 = dx0 / 2.0;
1770			float dy2 = dy0 / 2.0;
1771			float dx3 = dx1 / 2.0;
1772			float dy3 = dy1 / 2.0;
1773			shadow = (
1774				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1775				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1776				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1777				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1778				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1779				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1780				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1781				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1782				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1791			) * ( 1.0 / 17.0 );
1792		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1793			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1794			float dx = texelSize.x;
1795			float dy = texelSize.y;
1796			vec2 uv = shadowCoord.xy;
1797			vec2 f = fract( uv * shadowMapSize + 0.5 );
1798			uv -= f * texelSize;
1799			shadow = (
1800				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1801				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1802				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1803				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1804				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1805					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1806					 f.x ) +
1807				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1808					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1809					 f.x ) +
1810				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1811					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1812					 f.y ) +
1813				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1814					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1815					 f.y ) +
1816				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1817						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1818						  f.x ),
1819					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1820						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1821						  f.x ),
1822					 f.y )
1823			) * ( 1.0 / 9.0 );
1824		#elif defined( SHADOWMAP_TYPE_VSM )
1825			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1826		#else
1827			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1828		#endif
1829		}
1830		return mix( 1.0, shadow, shadowIntensity );
1831	}
1832	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1833		vec3 absV = abs( v );
1834		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1835		absV *= scaleToCube;
1836		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1837		vec2 planar = v.xy;
1838		float almostATexel = 1.5 * texelSizeY;
1839		float almostOne = 1.0 - almostATexel;
1840		if ( absV.z >= almostOne ) {
1841			if ( v.z > 0.0 )
1842				planar.x = 4.0 - v.x;
1843		} else if ( absV.x >= almostOne ) {
1844			float signX = sign( v.x );
1845			planar.x = v.z * signX + 2.0 * signX;
1846		} else if ( absV.y >= almostOne ) {
1847			float signY = sign( v.y );
1848			planar.x = v.x + 2.0 * signY + 2.0;
1849			planar.y = v.z * signY - 2.0;
1850		}
1851		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1852	}
1853	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1854		float shadow = 1.0;
1855		vec3 lightToPosition = shadowCoord.xyz;
1856		
1857		float lightToPositionLength = length( lightToPosition );
1858		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1859			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1860			vec3 bd3D = normalize( lightToPosition );
1861			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1862			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1863				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1864				shadow = (
1865					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1866					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1867					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1868					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1869					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1870					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1871					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1872					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1873					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1874				) * ( 1.0 / 9.0 );
1875			#else
1876				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1877			#endif
1878		}
1879		return mix( 1.0, shadow, shadowIntensity );
1880	}
1881#endif`,
1881Bd=`#if NUM_SPOT_LIGHT_COORDS > 0
1882	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1883	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1884#endif
1885#ifdef USE_SHADOWMAP
1886	#if NUM_DIR_LIGHT_SHADOWS > 0
1887		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1888		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1889		struct DirectionalLightShadow {
1890			float shadowIntensity;
1891			float shadowBias;
1892			float shadowNormalBias;
1893			float shadowRadius;
1894			vec2 shadowMapSize;
1895		};
1896		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1897	#endif
1898	#if NUM_SPOT_LIGHT_SHADOWS > 0
1899		struct SpotLightShadow {
1900			float shadowIntensity;
1901			float shadowBias;
1902			float shadowNormalBias;
1903			float shadowRadius;
1904			vec2 shadowMapSize;
1905		};
1906		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1907	#endif
1908	#if NUM_POINT_LIGHT_SHADOWS > 0
1909		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1910		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1911		struct PointLightShadow {
1912			float shadowIntensity;
1913			float shadowBias;
1914			float shadowNormalBias;
1915			float shadowRadius;
1916			vec2 shadowMapSize;
1917			float shadowCameraNear;
1918			float shadowCameraFar;
1919		};
1920		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1921	#endif
1922#endif`,zd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1923	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1924	vec4 shadowWorldPosition;
1925#endif
1926#if defined( USE_SHADOWMAP )
1927	#if NUM_DIR_LIGHT_SHADOWS > 0
1928		#pragma unroll_loop_start
1929		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1930			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1931			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1932		}
1933		#pragma unroll_loop_end
1934	#endif
1935	#if NUM_POINT_LIGHT_SHADOWS > 0
1936		#pragma unroll_loop_start
1937		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1938			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1939			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1940		}
1941		#pragma unroll_loop_end
1942	#endif
1943#endif
1944#if NUM_SPOT_LIGHT_COORDS > 0
1945	#pragma unroll_loop_start
1946	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1947		shadowWorldPosition = worldPosition;
1948		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1949			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1950		#endif
1951		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1952	}
1953	#pragma unroll_loop_end
1954#endif`,Hd=`float getShadowMask() {
1955	float shadow = 1.0;
1956	#ifdef USE_SHADOWMAP
1957	#if NUM_DIR_LIGHT_SHADOWS > 0
1958	DirectionalLightShadow directionalLight;
1959	#pragma unroll_loop_start
1960	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1961		directionalLight = directionalLightShadows[ i ];
1962		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1963	}
1964	#pragma unroll_loop_end
1965	#endif
1966	#if NUM_SPOT_LIGHT_SHADOWS > 0
1967	SpotLightShadow spotLight;
1968	#pragma unroll_loop_start
1969	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1970		spotLight = spotLightShadows[ i ];
1971		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1972	}
1973	#pragma unroll_loop_end
1974	#endif
1975	#if NUM_POINT_LIGHT_SHADOWS > 0
1976	PointLightShadow pointLight;
1977	#pragma unroll_loop_start
1978	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1979		pointLight = pointLightShadows[ i ];
1980		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1981	}
1982	#pragma unroll_loop_end
1983	#endif
1984	#endif
1985	return shadow;
1986}`,Gd=`#ifdef USE_SKINNING
1987	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1988	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1989	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1990	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1991#endif`,Vd=`#ifdef USE_SKINNING
1992	uniform mat4 bindMatrix;
1993	uniform mat4 bindMatrixInverse;
1994	uniform highp sampler2D boneTexture;
1995	mat4 getBoneMatrix( const in float i ) {
1996		int size = textureSize( boneTexture, 0 ).x;
1997		int j = int( i ) * 4;
1998		int x = j % size;
1999		int y = j / size;
2000		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2001		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2002		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2003		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2004		return mat4( v1, v2, v3, v4 );
2005	}
2006#endif`,kd=`#ifdef USE_SKINNING
2007	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2008	vec4 skinned = vec4( 0.0 );
2009	skinned += boneMatX * skinVertex * skinWeight.x;
2010	skinned += boneMatY * skinVertex * skinWeight.y;
2011	skinned += boneMatZ * skinVertex * skinWeight.z;
2012	skinned += boneMatW * skinVertex * skinWeight.w;
2013	transformed = ( bindMatrixInverse * skinned ).xyz;
2014#endif`,Wd=`#ifdef USE_SKINNING
2015	mat4 skinMatrix = mat4( 0.0 );
2016	skinMatrix += skinWeight.x * boneMatX;
2017	skinMatrix += skinWeight.y * boneMatY;
2018	skinMatrix += skinWeight.z * boneMatZ;
2019	skinMatrix += skinWeight.w * boneMatW;
2020	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2021	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2022	#ifdef USE_TANGENT
2023		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2024	#endif
2025#endif`,Xd=`float specularStrength;
2026#ifdef USE_SPECULARMAP
2027	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2028	specularStrength = texelSpecular.r;
2029#else
2030	specularStrength = 1.0;
2031#endif`,qd=`#ifdef USE_SPECULARMAP
2032	uniform sampler2D specularMap;
2033#endif`,Yd=`#if defined( TONE_MAPPING )
2034	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2035#endif`,Kd=`#ifndef saturate
2036#define saturate( a ) clamp( a, 0.0, 1.0 )
2037#endif
2038uniform float toneMappingExposure;
2039vec3 LinearToneMapping( vec3 color ) {
2040	return saturate( toneMappingExposure * color );
2041}
2042vec3 ReinhardToneMapping( vec3 color ) {
2043	color *= toneMappingExposure;
2044	return saturate( color / ( vec3( 1.0 ) + color ) );
2045}
2046vec3 CineonToneMapping( vec3 color ) {
2047	color *= toneMappingExposure;
2048	color = max( vec3( 0.0 ), color - 0.004 );
2049	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2050}
2051vec3 RRTAndODTFit( vec3 v ) {
2052	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2053	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2054	return a / b;
2055}
2056vec3 ACESFilmicToneMapping( vec3 color ) {
2057	const mat3 ACESInputMat = mat3(
2058		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2059		vec3( 0.04823, 0.01566, 0.83777 )
2060	);
2061	const mat3 ACESOutputMat = mat3(
2062		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2063		vec3( -0.07367, -0.00605,  1.07602 )
2064	);
2065	color *= toneMappingExposure / 0.6;
2066	color = ACESInputMat * color;
2067	color = RRTAndODTFit( color );
2068	color = ACESOutputMat * color;
2069	return saturate( color );
2070}
2071const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2072	vec3( 1.6605, - 0.1246, - 0.0182 ),
2073	vec3( - 0.5876, 1.1329, - 0.1006 ),
2074	vec3( - 0.0728, - 0.0083, 1.1187 )
2075);
2076const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2077	vec3( 0.6274, 0.0691, 0.0164 ),
2078	vec3( 0.3293, 0.9195, 0.0880 ),
2079	vec3( 0.0433, 0.0113, 0.8956 )
2080);
2081vec3 agxDefaultContrastApprox( vec3 x ) {
2082	vec3 x2 = x * x;
2083	vec3 x4 = x2 * x2;
2084	return + 15.5 * x4 * x2
2085		- 40.14 * x4 * x
2086		+ 31.96 * x4
2087		- 6.868 * x2 * x
2088		+ 0.4298 * x2
2089		+ 0.1191 * x
2090		- 0.00232;
2091}
2092vec3 AgXToneMapping( vec3 color ) {
2093	const mat3 AgXInsetMatrix = mat3(
2094		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2095		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2096		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2097	);
2098	const mat3 AgXOutsetMatrix = mat3(
2099		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2100		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2101		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2102	);
2103	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2104	color *= toneMappingExposure;
2105	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2106	color = AgXInsetMatrix * color;
2107	color = max( color, 1e-10 );	color = log2( color );
2108	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2109	color = clamp( color, 0.0, 1.0 );
2110	color = agxDefaultContrastApprox( color );
2111	color = AgXOutsetMatrix * color;
2112	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2113	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2114	color = clamp( color, 0.0, 1.0 );
2115	return color;
2116}
2117vec3 NeutralToneMapping( vec3 color ) {
2118	const float StartCompression = 0.8 - 0.04;
2119	const float Desaturation = 0.15;
2120	color *= toneMappingExposure;
2121	float x = min( color.r, min( color.g, color.b ) );
2122	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2123	color -= offset;
2124	float peak = max( color.r, max( color.g, color.b ) );
2125	if ( peak < StartCompression ) return color;
2126	float d = 1. - StartCompression;
2127	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2128	color *= newPeak / peak;
2129	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2130	return mix( color, vec3( newPeak ), g );
2131}
2132vec3 CustomToneMapping( vec3 color ) { return color; }`,$d=`#ifdef USE_TRANSMISSION
2133	material.transmission = transmission;
2134	material.transmissionAlpha = 1.0;
2135	material.thickness = thickness;
2136	material.attenuationDistance = attenuationDistance;
2137	material.attenuationColor = attenuationColor;
2138	#ifdef USE_TRANSMISSIONMAP
2139		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2140	#endif
2141	#ifdef USE_THICKNESSMAP
2142		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2143	#endif
2144	vec3 pos = vWorldPosition;
2145	vec3 v = normalize( cameraPosition - pos );
2146	vec3 n = inverseTransformDirection( normal, viewMatrix );
2147	vec4 transmitted = getIBLVolumeRefraction(
2148		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2149		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2150		material.attenuationColor, material.attenuationDistance );
2151	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2152	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2153#endif`,Zd=`#ifdef USE_TRANSMISSION
2154	uniform float transmission;
2155	uniform float thickness;
2156	uniform float attenuationDistance;
2157	uniform vec3 attenuationColor;
2158	#ifdef USE_TRANSMISSIONMAP
2159		uniform sampler2D transmissionMap;
2160	#endif
2161	#ifdef USE_THICKNESSMAP
2162		uniform sampler2D thicknessMap;
2163	#endif
2164	uniform vec2 transmissionSamplerSize;
2165	uniform sampler2D transmissionSamplerMap;
2166	uniform mat4 modelMatrix;
2167	uniform mat4 projectionMatrix;
2168	varying vec3 vWorldPosition;
2169	float w0( float a ) {
2170		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2171	}
2172	float w1( float a ) {
2173		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2174	}
2175	float w2( float a ){
2176		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2177	}
2178	float w3( float a ) {
2179		return ( 1.0 / 6.0 ) * ( a * a * a );
2180	}
2181	float g0( float a ) {
2182		return w0( a ) + w1( a );
2183	}
2184	float g1( float a ) {
2185		return w2( a ) + w3( a );
2186	}
2187	float h0( float a ) {
2188		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2189	}
2190	float h1( float a ) {
2191		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2192	}
2193	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2194		uv = uv * texelSize.zw + 0.5;
2195		vec2 iuv = floor( uv );
2196		vec2 fuv = fract( uv );
2197		float g0x = g0( fuv.x );
2198		float g1x = g1( fuv.x );
2199		float h0x = h0( fuv.x );
2200		float h1x = h1( fuv.x );
2201		float h0y = h0( fuv.y );
2202		float h1y = h1( fuv.y );
2203		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2204		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2205		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2206		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2207		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2208			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2209	}
2210	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2211		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2212		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2213		vec2 fLodSizeInv = 1.0 / fLodSize;
2214		vec2 cLodSizeInv = 1.0 / cLodSize;
2215		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2216		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2217		return mix( fSample, cSample, fract( lod ) );
2218	}
2219	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2220		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2221		vec3 modelScale;
2222		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2223		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2224		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2225		return normalize( refractionVector ) * thickness * modelScale;
2226	}
2227	float applyIorToRoughness( const in float roughness, const in float ior ) {
2228		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2229	}
2230	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2231		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2232		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2233	}
2234	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2235		if ( isinf( attenuationDistance ) ) {
2236			return vec3( 1.0 );
2237		} else {
2238			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2239			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2240		}
2241	}
2242	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2243		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2244		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2245		const in vec3 attenuationColor, const in float attenuationDistance ) {
2246		vec4 transmittedLight;
2247		vec3 transmittance;
2248		#ifdef USE_DISPERSION
2249			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2250			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2251			for ( int i = 0; i < 3; i ++ ) {
2252				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2253				vec3 refractedRayExit = position + transmissionRay;
2254				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2255				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2256				refractionCoords += 1.0;
2257				refractionCoords /= 2.0;
2258				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2259				transmittedLight[ i ] = transmissionSample[ i ];
2260				transmittedLight.a += transmissionSample.a;
2261				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2262			}
2263			transmittedLight.a /= 3.0;
2264		#else
2265			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2266			vec3 refractedRayExit = position + transmissionRay;
2267			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2268			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2269			refractionCoords += 1.0;
2270			refractionCoords /= 2.0;
2271			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2272			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
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`,jd=`#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`,Jd=`#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`,Qd=`#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`,ef=`#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 tf=`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}`,nf=`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}`,rf=`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}`,sf=`#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}`,af=`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}`,of=`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}`,lf=`#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}`,cf=`#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}`,uf=`#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}`,df=`#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}`,ff=`varying vec3 vWorldDirection;
2700#include <common>
2701void main() {
2702	vWorldDirection = transformDirection( position, modelMatrix );
2703	#include <begin_vertex>
2704	#include <project_vertex>
2705}`,hf=`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}`,pf=`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}`,mf=`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}`,_f=`#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}`,gf=`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}`,vf=`#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}`,xf=`#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}`,Sf=`#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}`,Mf=`#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}`,Ef=`#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}`,Tf=`#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}`,yf=`#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}`,bf=`#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}`,Af=`#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}`,Rf=`#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}`,Cf=`#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}`,wf=`#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}`,Pf=`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}`,Df=`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}`,If=`#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}`,Uf=`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}`,Nf=`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}`,Fe={alphahash_fragment:nu,alphahash_pars_fragment:iu,alphamap_fragment:ru,alphamap_pars_fragment:su,alphatest_fragment:au,alphatest_pars_fragment:ou,aomap_fragment:lu,aomap_pars_fragment:cu,batching_pars_vertex:uu,batching_vertex:du,begin_vertex:fu,beginnormal_vertex:hu,bsdfs:pu,iridescence_fragment:mu,bumpmap_pars_fragment:_u,clipping_planes_fragment:gu,clipping_planes_pars_fragment:vu,clipping_planes_pars_vertex:xu,clipping_planes_vertex:Su,color_fragment:Mu,color_pars_fragment:Eu,color_pars_vertex:Tu,color_vertex:yu,common:bu,cube_uv_reflection_fragment:Au,defaultnormal_vertex:Ru,displacementmap_pars_vertex:Cu,displacementmap_vertex:wu,emissivemap_fragment:Pu,emissivemap_pars_fragment:Du,colorspace_fragment:Iu,colorspace_pars_fragment:Lu,envmap_fragment:Uu,envmap_common_pars_fragment:Nu,envmap_pars_fragment:Fu,envmap_pars_vertex:Ou,envmap_physical_pars_fragment:Ku,envmap_vertex:Bu,fog_vertex:zu,fog_pars_vertex:Hu,fog_fragment:Gu,fog_pars_fragment:Vu,gradientmap_pars_fragment:ku,lightmap_pars_fragment:Wu,lights_lambert_fragment:Xu,lights_lambert_pars_fragment:qu,lights_pars_begin:Yu,lights_toon_fragment:$u,lights_toon_pars_fragment:Zu,lights_phong_fragment:ju,lights_phong_pars_fragment:Ju,lights_physical_fragment:Qu,lights_physical_pars_fragment:ed,lights_fragment_begin:td,lights_fragment_maps:nd,lights_fragment_end:id,logdepthbuf_fragment:rd,logdepthbuf_pars_fragment:sd,logdepthbuf_pars_vertex:ad,logdepthbuf_vertex:od,map_fragment:ld,map_pars_fragment:cd,map_particle_fragment:ud,map_particle_pars_fragment:dd,metalnessmap_fragment:fd,metalnessmap_pars_fragment:hd,morphinstance_vertex:pd,morphcolor_vertex:md,morphnormal_vertex:_d,morphtarget_pars_vertex:gd,morphtarget_vertex:vd,normal_fragment_begin:xd,normal_fragment_maps:Sd,normal_pars_fragment:Md,normal_pars_vertex:Ed,normal_vertex:Td,normalmap_pars_fragment:yd,clearcoat_normal_fragment_begin:bd,clearcoat_normal_fragment_maps:Ad,clearcoat_pars_fragment:Rd,iridescence_pars_fragment:Cd,opaque_fragment:wd,packing:Pd,premultiplied_alpha_fragment:Dd,project_vertex:Id,dithering_fragment:Ld,dithering_pars_fragment:Ud,roughnessmap_fragment:Nd,roughnessmap_pars_fragment:Fd,shadowmap_pars_fragment:Od,shadowmap_pars_vertex:Bd,shadowmap_vertex:zd,shadowmask_pars_fragment:Hd,skinbase_vertex:Gd,skinning_pars_vertex:Vd,skinning_vertex:kd,skinnormal_vertex:Wd,specularmap_fragment:Xd,specularmap_pars_fragment:qd,tonemapping_fragment:Yd,tonemapping_pars_fragment:Kd,transmission_fragment:$d,transmission_pars_fragment:Zd,uv_pars_fragment:jd,uv_pars_vertex:Jd,uv_vertex:Qd,worldpos_vertex:ef,background_vert:tf,background_frag:nf,backgroundCube_vert:rf,backgroundCube_frag:sf,cube_vert:af,cube_frag:of,depth_vert:lf,depth_frag:cf,distanceRGBA_vert:uf,distanceRGBA_frag:df,equirect_vert:ff,equirect_frag:hf,linedashed_vert:pf,linedashed_frag:mf,meshbasic_vert:_f,meshbasic_frag:gf,meshlambert_vert:vf,meshlambert_frag:xf,meshmatcap_vert:Sf,meshmatcap_frag:Mf,meshnormal_vert:Ef,meshnormal_frag:Tf,meshphong_vert:yf,meshphong_frag:bf,meshphysical_vert:Af,meshphysical_frag:Rf,meshtoon_vert:Cf,meshtoon_frag:wf,points_vert:Pf,points_frag:Df,shadow_vert:If,shadow_frag:Lf,sprite_vert:Uf,sprite_frag:Nf},ie={common:{diffuse:{value:new $e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ue}},envmap:{envMap:{value:null},envMapRotation:{value:new Ue},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ue}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ue}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ue},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ue},normalScale:{value:new Oe(1,1)}}
vendor: 7,102 bytes, line 3575
3575,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ue},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ue}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ue}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ue}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new $e(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 $e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0},uvTransform:{value:new Ue}},sprite:{diffuse:{value:new $e(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}}},en={basic:{uniforms:At([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.fog]),vertexShader:Fe.meshbasic_vert,fragmentShader:Fe.meshbasic_frag},lambert:{uniforms:At([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new $e(0)}}]),vertexShader:Fe.meshlambert_vert,fragmentShader:Fe.meshlambert_frag},phong:{uniforms:At([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new $e(0)},specular:{value:new $e(1118481)},shininess:{value:30}}]),vertexShader:Fe.meshphong_vert,fragmentShader:Fe.meshphong_frag},standard:{uniforms:At([ie.common,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.roughnessmap,ie.metalnessmap,ie.fog,ie.lights,{emissive:{value:new $e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag},toon:{uniforms:At([ie.common,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.gradientmap,ie.fog,ie.lights,{emissive:{value:new $e(0)}}]),vertexShader:Fe.meshtoon_vert,fragmentShader:Fe.meshtoon_frag},matcap:{uniforms:At([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,{matcap:{value:null}}]),vertexShader:Fe.meshmatcap_vert,fragmentShader:Fe.meshmatcap_frag},points:{uniforms:At([ie.points,ie.fog]),vertexShader:Fe.points_vert,fragmentShader:Fe.points_frag},dashed:{uniforms:At([ie.common,ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fe.linedashed_vert,fragmentShader:Fe.linedashed_frag},depth:{uniforms:At([ie.common,ie.displacementmap]),vertexShader:Fe.depth_vert,fragmentShader:Fe.depth_frag},normal:{uniforms:At([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,{opacity:{value:1}}]),vertexShader:Fe.meshnormal_vert,fragmentShader:Fe.meshnormal_frag},sprite:{uniforms:At([ie.sprite,ie.fog]),vertexShader:Fe.sprite_vert,fragmentShader:Fe.sprite_frag},background:{uniforms:{uvTransform:{value:new Ue},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fe.background_vert,fragmentShader:Fe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ue}},vertexShader:Fe.backgroundCube_vert,fragmentShader:Fe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fe.cube_vert,fragmentShader:Fe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fe.equirect_vert,fragmentShader:Fe.equirect_frag},distanceRGBA:{uniforms:At([ie.common,ie.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fe.distanceRGBA_vert,fragmentShader:Fe.distanceRGBA_frag},shadow:{uniforms:At([ie.lights,ie.fog,{color:{value:new $e(0)},opacity:{value:1}}]),vertexShader:Fe.shadow_vert,fragmentShader:Fe.shadow_frag}};en.physical={uniforms:At([en.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ue},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ue},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ue},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ue},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ue},sheen:{value:0},sheenColor:{value:new $e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ue},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ue},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ue},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ue},attenuationDistance:{value:0},attenuationColor:{value:new $e(0)},specularColor:{value:new $e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ue},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ue},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ue}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag};const ir={r:0,b:0,g:0},Un=new _n,Ff=new ft;function Of(n,e,t,i,r,s,a){const o=new $e(0);let l=s===!0?0:1,c,d,f=null,p=0,m=null;function x(y){let E=y.isScene===!0?y.background:null;return E&&E.isTexture&&(E=(y.backgroundBlurriness>0?t:e).get(E)),E}function M(y){let E=!1;const L=x(y);L===null?u(o,l):L&&L.isColor&&(u(L,1),E=!0);const A=n.xr.getEnvironmentBlendMode();
vendor: 4,544 bytes, line 3575
3575A==="additive"?i.buffers.color.setClear(0,0,0,1,a):A==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||E)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function h(y,E){const L=x(E);L&&(L.isCubeTexture||L.mapping===vr)?(d===void 0&&(d=new jt(new Ui(1,1,1),new Wt({name:"BackgroundCubeMaterial",uniforms:_i(en.backgroundCube.uniforms),vertexShader:en.backgroundCube.vertexShader,fragmentShader:en.backgroundCube.fragmentShader,side:gt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(A,C,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),Un.copy(E.backgroundRotation),Un.x*=-1,Un.y*=-1,Un.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(Un.y*=-1,Un.z*=-1),d.material.uniforms.envMap.value=L,d.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Ff.makeRotationFromEuler(Un)),d.material.toneMapped=We.getTransfer(L.colorSpace)!==Je,(f!==L||p!==L.version||m!==n.toneMapping)&&(d.material.needsUpdate=!0,f=L,p=L.version,m=n.toneMapping),d.layers.enableAll(),y.unshift(d,d.geometry,d.material,0,0,null)):L&&L.isTexture&&(c===void 0&&(c=new jt(new Ni(2,2),new Wt({name:"BackgroundMaterial",uniforms:_i(en.background.uniforms),vertexShader:en.background.vertexShader,fragmentShader:en.background.fragmentShader,side:mn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!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=L,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=We.getTransfer(L.colorSpace)!==Je,L.matrixAutoUpdate===!0&&L.updateMatrix(),c.material.uniforms.uvTransform.value.copy(L.matrix),(f!==L||p!==L.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,f=L,p=L.version,m=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function u(y,E){y.getRGB(ir,jo(n)),i.buffers.color.setClear(ir.r,ir.g,ir.b,E,a)}function T(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,E=1){o.set(y),l=E,u(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,u(o,l)},render:M,addToRenderList:h,dispose:T}}function Bf(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=p(null);let s=r,a=!1;function o(S,w,X,O,H){let Y=!1;const G=f(O,X,w);s!==G&&(s=G,c(s.object)),Y=m(S,O,X,H),Y&&x(S,O,X,H),H!==null&&e.update(H,n.ELEMENT_ARRAY_BUFFER),(Y||a)&&(a=!1,E(S,w,X,O),H!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function d(S){return n.deleteVertexArray(S)}function f(S,w,X){const O=X.wireframe===!0;let H=i[S.id];H===void 0&&(H={},i[S.id]=H);let Y=H[w.id];Y===void 0&&(Y={},H[w.id]=Y);let G=Y[O];return G===void 0&&(G=p(l()),Y[O]=G),G}function p(S){const w=[],X=[],O=[];for(let H=0;H<t;H++)w[H]=0,X[H]=0,O[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:w,enabledAttributes:X,attributeDivisors:O,object:S,attributes:{},index:null}}function m(S,w,X,O){const H=s.attributes,Y=w.attributes;let G=0;const te=X.getAttributes();for(const V in te)if(te[V].location>=0){const ce=H[V];let ve=Y[V];if(ve===void 0&&(V==="instanceMatrix"&&S.instanceMatrix&&(ve=S.instanceMatrix),V==="instanceColor"&&S.instanceColor&&(ve=S.instanceColor)),ce===void 0||ce.attribute!==ve||ve&&ce.data!==ve.data)return!0;G++}return s.attributesNum!==G||s.index!==O}function x(S,w,X,O){const H={},Y=w.attributes;let G=0;const te=X.getAttributes();for(const V in te)if(te[V].location>=0){let ce=Y[V];ce===void 0&&(V==="instanceMatrix"&&S.instanceMatrix&&(ce=S.instanceMatrix),V==="instanceColor"&&S.instanceColor&&(ce=S.instanceColor));const ve={};ve.attribute=ce,ce&&ce.data&&(ve.data=ce.data),H[V]=ve,G++}s.attributes=H,s.attributesNum=G,s.index=O}function M(){const S=s.newAttributes;for(let w=0,X=S.length;w<X;w++)S[w]=0}function h(S){u(S,0)}
vendor: 3,249 bytes, line 3575
3575function u(S,w){const X=s.newAttributes,O=s.enabledAttributes,H=s.attributeDivisors;X[S]=1,O[S]===0&&(n.enableVertexAttribArray(S),O[S]=1),H[S]!==w&&(n.vertexAttribDivisor(S,w),H[S]=w)}function T(){const S=s.newAttributes,w=s.enabledAttributes;for(let X=0,O=w.length;X<O;X++)w[X]!==S[X]&&(n.disableVertexAttribArray(X),w[X]=0)}function y(S,w,X,O,H,Y,G){G===!0?n.vertexAttribIPointer(S,w,X,H,Y):n.vertexAttribPointer(S,w,X,O,H,Y)}function E(S,w,X,O){M();const H=O.attributes,Y=X.getAttributes(),G=w.defaultAttributeValues;for(const te in Y){const V=Y[te];if(V.location>=0){let se=H[te];if(se===void 0&&(te==="instanceMatrix"&&S.instanceMatrix&&(se=S.instanceMatrix),te==="instanceColor"&&S.instanceColor&&(se=S.instanceColor)),se!==void 0){const ce=se.normalized,ve=se.itemSize,ue=e.get(se);if(ue===void 0)continue;const we=ue.buffer,k=ue.type,Q=ue.bytesPerElement,_e=k===n.INT||k===n.UNSIGNED_INT||se.gpuType===ra;if(se.isInterleavedBufferAttribute){const le=se.data,Ee=le.stride,qe=se.offset;if(le.isInstancedInterleavedBuffer){for(let Ce=0;Ce<V.locationSize;Ce++)u(V.location+Ce,le.meshPerAttribute);S.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let Ce=0;Ce<V.locationSize;Ce++)h(V.location+Ce);n.bindBuffer(n.ARRAY_BUFFER,we);for(let Ce=0;Ce<V.locationSize;Ce++)y(V.location+Ce,ve/V.locationSize,k,ce,Ee*Q,(qe+ve/V.locationSize*Ce)*Q,_e)}else{if(se.isInstancedBufferAttribute){for(let le=0;le<V.locationSize;le++)u(V.location+le,se.meshPerAttribute);S.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let le=0;le<V.locationSize;le++)h(V.location+le);n.bindBuffer(n.ARRAY_BUFFER,we);for(let le=0;le<V.locationSize;le++)y(V.location+le,ve/V.locationSize,k,ce,ve*Q,ve/V.locationSize*le*Q,_e)}}else if(G!==void 0){const ce=G[te];if(ce!==void 0)switch(ce.length){case 2:n.vertexAttrib2fv(V.location,ce);break;case 3:n.vertexAttrib3fv(V.location,ce);break;case 4:n.vertexAttrib4fv(V.location,ce);break;default:n.vertexAttrib1fv(V.location,ce)}}}}T()}function L(){U();for(const S in i){const w=i[S];for(const X in w){const O=w[X];for(const H in O)d(O[H].object),delete O[H];delete w[X]}delete i[S]}}function A(S){if(i[S.id]===void 0)return;const w=i[S.id];for(const X in w){const O=w[X];for(const H in O)d(O[H].object),delete O[H];delete w[X]}delete i[S.id]}function C(S){for(const w in i){const X=i[w];if(X[S.id]===void 0)continue;const O=X[S.id];for(const H in O)d(O[H].object),delete O[H];delete X[S.id]}}function U(){g(),a=!0,s!==r&&(s=r,c(s.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:U,resetDefaultState:g,dispose:L,releaseStatesOfGeometry:A,releaseStatesOfProgram:C,initAttributes:M,enableAttribute:h,disableUnusedAttributes:T}}function zf(n,e,t){let i;function r(c){i=c}function s(c,d){n.drawArrays(i,c,d),t.update(d,i,1)}function a(c,d,f){f!==0&&(n.drawArraysInstanced(i,c,d,f),t.update(d,i,f))}function o(c,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,d,0,f);let m=0;for(let x=0;x<f;x++)m+=d[x];t.update(m,i,1)}function l(c,d,f,p){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let x=0;x<c.length;x++)a(c[x],d[x],p[x]);
vendor: 12,567 bytes, lines 3575-3650
3575else{m.multiDrawArraysInstancedWEBGL(i,c,0,d,0,p,0,f);let x=0;for(let M=0;M<f;M++)x+=d[M]*p[M];t.update(x,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Hf(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(C){return!(C!==Zt&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const U=C===wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Nt&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==nn&&!U)}function l(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=n.getParameter(n.MAX_TEXTURE_SIZE),h=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),u=n.getParameter(n.MAX_VERTEX_ATTRIBS),T=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),y=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),L=x>0,A=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:m,maxVertexTextures:x,maxTextureSize:M,maxCubemapSize:h,maxAttributes:u,maxVertexUniforms:T,maxVaryings:y,maxFragmentUniforms:E,vertexTextures:L,maxSamples:A}}function Gf(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Fn,o=new Ue,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||i!==0||r;return r=p,i=f.length,m},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=d(f,p,0)},this.setState=function(f,p,m){const x=f.clippingPlanes,M=f.clipIntersection,h=f.clipShadows,u=n.get(f);if(!r||x===null||x.length===0||s&&!h)s?d(null):c();else{const T=s?0:i,y=T*4;let E=u.clippingState||null;l.value=E,E=d(x,p,y,m);for(let L=0;L!==y;++L)E[L]=t[L];u.clippingState=E,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(f,p,m,x){const M=f!==null?f.length:0;let h=null;if(M!==0){if(h=l.value,x!==!0||h===null){const u=m+M*4,T=p.matrixWorldInverse;o.getNormalMatrix(T),(h===null||h.length<u)&&(h=new Float32Array(u));for(let y=0,E=m;y!==M;++y,E+=4)a.copy(f[y]).applyMatrix4(T,o),a.normal.toArray(h,E),h[E+3]=a.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,h}}function Vf(n){let e=new WeakMap;function t(a,o){return o===Ss?a.mapping=fi:o===Ms&&(a.mapping=hi),a}function i(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ss||o===Ms)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 Xc(l.height);return c.fromEquirectangularTexture(n,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:i,dispose:s}}const oi=4,ja=[.125,.215,.35,.446,.526,.582],zn=20,$r=new ha,Ja=new $e;let Zr=null,jr=0,Jr=0,Qr=!1;const On=(1+Math.sqrt(5))/2,ai=1/On,Qa=[new z(-On,ai,0),new z(On,ai,0),new z(-ai,0,On),new z(ai,0,On),new z(0,On,-ai),new z(0,On,ai),new z(-1,1,-1),new z(1,1,-1),new z(-1,1,1),new z(1,1,1)],kf=new z;class eo{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,i=.1,r=100,s={}){const{size:a=256,position:o=kf}=s;Zr=this._renderer.getRenderTarget(),jr=this._renderer.getActiveCubeFace(),Jr=this._renderer.getActiveMipmapLevel(),Qr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=io(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=no(),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,jr,Jr),this._renderer.xr.enabled=Qr,e.scissorTest=!1,rr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fi||e.mapping===hi?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(),jr=this._renderer.getActiveCubeFace(),Jr=this._renderer.getActiveMipmapLevel(),Qr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Tt,minFilter:Tt,generateMipmaps:!1,type:wi,format:Zt,colorSpace:yn,depthBuffer:!1},r=to(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=to(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Wf(s)),this._blurMaterial=Xf(s,e,t)}return r}_compileMaterial(e){const t=new jt(this._lodPlanes[0],e);this._renderer.compile(t,$r)}_sceneToCubeUV(e,t,i,r,s){const l=new Ht(90,1,t,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,m=f.toneMapping;f.getClearColor(Ja),f.toneMapping=Tn,f.autoClear=!1;const x=new Ko({name:"PMREM.Background",side:gt,depthWrite:!1,depthTest:!1}),M=new jt(new Ui,x);let h=!1;const u=e.background;u?u.isColor&&(x.color.copy(u),e.background=null,h=!0):(x.color.copy(Ja),h=!0);for(let T=0;T<6;T++){const y=T%3;y===0?(l.up.set(0,c[T],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[T],s.y,s.z)):y===1?(l.up.set(0,0,c[T]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[T],s.z)):(l.up.set(0,c[T],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[T]));const E=this._cubeSize;rr(r,y*E,T>2?E:0,E,E),f.setRenderTarget(r),h&&f.render(M,l),f.render(e,l)}M.geometry.dispose(),M.material.dispose(),f.toneMapping=m,f.autoClear=p,e.background=u}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===fi||e.mapping===hi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=io()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=no());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new jt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;rr(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,$r)}_applyPMREM(e){const t=this._renderer,i=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=Qa[(r-s-1)%Qa.length];this._blur(e,s-1,s,a,o)}t.autoClear=i}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,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 d=3,f=new jt(this._lodPlanes[r],c),p=c.uniforms,m=this._sizeLods[i]-1,x=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*zn-1),M=s/x,h=isFinite(s)?1+Math.floor(d*M):zn;h>zn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${zn}`);const u=[];let T=0;for(let C=0;C<zn;++C){const U=C/M,g=Math.exp(-U*U/2);u.push(g),C===0?T+=g:C<h&&(T+=2*g)}for(let C=0;C<u.length;C++)u[C]=u[C]/T;p.envMap.value=e.texture,p.samples.value=h,p.weights.value=u,p.latitudinal.value=a==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:y}=this;p.dTheta.value=x,p.mipInt.value=y-i;const E=this._sizeLods[r],L=3*E*(r>y-oi?r-y+oi:0),A=4*(this._cubeSize-E);rr(t,L,A,3*E,2*E),l.setRenderTarget(t),l.render(f,$r)}}function Wf(n){const e=[],t=[],i=[];let r=n;const s=n-oi+1+ja.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>n-oi?l=ja[a-n+oi-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],m=6,x=6,M=3,h=2,u=1,T=new Float32Array(M*x*m),y=new Float32Array(h*x*m),E=new Float32Array(u*x*m);for(let A=0;A<m;A++){const C=A%3*2/3-1,U=A>2?0:-1,g=[C,U,0,C+2/3,U,0,C+2/3,U+1,0,C,U,0,C+2/3,U+1,0,C,U+1,0];T.set(g,M*x*A),y.set(p,h*x*A);const S=[A,A,A,A,A,A];E.set(S,u*x*A)}const L=new An;L.setAttribute("position",new Vt(T,M)),L.setAttribute("uv",new Vt(y,h)),L.setAttribute("faceIndex",new Vt(E,u)),e.push(L),r>oi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function to(n,e,t){const i=new kt(n,e,t);return i.texture.mapping=vr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function rr(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Xf(n,e,t){const i=new Float32Array(zn),r=new z(0,1,0);return new Wt({name:"SphericalGaussianBlur",defines:{n:zn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:pa(),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:rn,depthTest:!1,depthWrite:!1})}function no(){return new Wt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pa(),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:rn,depthTest:!1,depthWrite:!1})}function io(){return new Wt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pa(),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:rn,depthTest:!1,depthWrite:!1})}function pa(){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 qf(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ss||l===Ms,d=l===fi||l===hi;if(c||d){let f=e.get(o);const p=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return t===null&&(t=new eo(n)),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||d&&m&&r(m)?(t===null&&(t=new eo(n)),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 d=0;d<c;d++)o[d]!==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:i,dispose:a}}function Yf(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==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(i){const r=t(i);return r===null&&ci("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function Kf(n,e,t,i){const r={},s=new WeakMap;function a(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const x in p.attributes)e.remove(p.attributes[x]);p.removeEventListener("dispose",a),delete r[p.id];const m=s.get(p);m&&(e.remove(m),s.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function o(f,p){return r[p.id]===!0||(p.addEventListener("dispose",a),r[p.id]=!0,t.memory.geometries++),p}function l(f){const p=f.attributes;for(const m in p)e.update(p[m],n.ARRAY_BUFFER)}function c(f){const p=[],m=f.index,x=f.attributes.position;let M=0;if(m!==null){const T=m.array;M=m.version;for(let y=0,E=T.length;y<E;y+=3){const L=T[y+0],A=T[y+1],C=T[y+2];p.push(L,A,A,C,C,L)}}else if(x!==void 0){const T=x.array;M=x.version;for(let y=0,E=T.length/3-1;y<E;y+=3){const L=y+0,A=y+1,C=y+2;p.push(L,A,A,C,C,L)}}else return;const h=new(Wo(p)?Zo:$o)(p,1);h.version=M;const u=s.get(f);u&&e.remove(u),s.set(f,h)}function d(f){const p=s.get(f);if(p){const m=f.index;m!==null&&p.version<m.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function $f(n,e,t){let i;function r(p){i=p}let s,a;function o(p){s=p.type,a=p.bytesPerElement}function l(p,m){n.drawElements(i,m,s,p*a),t.update(m,i,1)}function c(p,m,x){x!==0&&(n.drawElementsInstanced(i,m,s,p*a,x),t.update(m,i,x))}function d(p,m,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,s,p,0,x);let h=0;for(let u=0;u<x;u++)h+=m[u];t.update(h,i,1)}function f(p,m,x,M){if(x===0)return;const h=e.get("WEBGL_multi_draw");if(h===null)for(let u=0;u<p.length;u++)c(p[u]/a,m[u],M[u]);
vendor: 17,414 bytes, lines 3725-3760
3725else{h.multiDrawElementsInstancedWEBGL(i,m,0,s,p,0,M,0,x);let u=0;for(let T=0;T<x;T++)u+=m[T]*M[T];t.update(u,i,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function Zf(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.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:i}}function jf(n,e,t){const i=new WeakMap,r=new ut;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=d!==void 0?d.length:0;let p=i.get(o);if(p===void 0||p.count!==f){let g=function(){C.dispose(),i.delete(o),o.removeEventListener("dispose",g)};p!==void 0&&p.texture.dispose();const m=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,M=o.morphAttributes.color!==void 0,h=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],T=o.morphAttributes.color||[];let y=0;m===!0&&(y=1),x===!0&&(y=2),M===!0&&(y=3);let E=o.attributes.position.count*y,L=1;E>e.maxTextureSize&&(L=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const A=new Float32Array(E*L*4*f),C=new Xo(A,E,L,f);C.type=nn,C.needsUpdate=!0;const U=y*4;for(let S=0;S<f;S++){const w=h[S],X=u[S],O=T[S],H=E*L*4*S;for(let Y=0;Y<w.count;Y++){const G=Y*U;m===!0&&(r.fromBufferAttribute(w,Y),A[H+G+0]=r.x,A[H+G+1]=r.y,A[H+G+2]=r.z,A[H+G+3]=0),x===!0&&(r.fromBufferAttribute(X,Y),A[H+G+4]=r.x,A[H+G+5]=r.y,A[H+G+6]=r.z,A[H+G+7]=0),M===!0&&(r.fromBufferAttribute(O,Y),A[H+G+8]=r.x,A[H+G+9]=r.y,A[H+G+10]=r.z,A[H+G+11]=O.itemSize===4?r.w:1)}}p={count:f,texture:C,size:new Oe(E,L)},i.set(o,p),o.addEventListener("dispose",g)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let m=0;for(let M=0;M<c.length;M++)m+=c[M];const x=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(n,"morphTargetBaseInfluence",x),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",p.size)}return{update:s}}function Jf(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,d=l.geometry,f=e.get(l,d);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,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const p=l.skeleton;r.get(p)!==c&&(p.update(),r.set(p,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}}const nl=new St,ro=new fa(1,1),il=new Xo,rl=new Rc,sl=new Qo,so=[],ao=[],oo=new Float32Array(16),lo=new Float32Array(9),co=new Float32Array(4);function vi(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=so[r];if(s===void 0&&(s=new Float32Array(r),so[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function pt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function mt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function xr(n,e){let t=ao[e];t===void 0&&(t=new Int32Array(e),ao[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function Qf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function eh(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(pt(t,e))return;n.uniform2fv(this.addr,e),mt(t,e)}}function th(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.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)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(pt(t,e))return;n.uniform3fv(this.addr,e),mt(t,e)}}function nh(n,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)&&(n.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(pt(t,e))return;n.uniform4fv(this.addr,e),mt(t,e)}}function ih(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(pt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),mt(t,e)}else{if(pt(t,i))return;co.set(i),n.uniformMatrix2fv(this.addr,!1,co),mt(t,i)}}function rh(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(pt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),mt(t,e)}else{if(pt(t,i))return;lo.set(i),n.uniformMatrix3fv(this.addr,!1,lo),mt(t,i)}}function sh(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(pt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),mt(t,e)}else{if(pt(t,i))return;oo.set(i),n.uniformMatrix4fv(this.addr,!1,oo),mt(t,i)}}function ah(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function oh(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(pt(t,e))return;n.uniform2iv(this.addr,e),mt(t,e)}}function lh(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(pt(t,e))return;n.uniform3iv(this.addr,e),mt(t,e)}}function ch(n,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)&&(n.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(pt(t,e))return;n.uniform4iv(this.addr,e),mt(t,e)}}function uh(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function dh(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(pt(t,e))return;n.uniform2uiv(this.addr,e),mt(t,e)}}function fh(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(pt(t,e))return;n.uniform3uiv(this.addr,e),mt(t,e)}}function hh(n,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)&&(n.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(pt(t,e))return;n.uniform4uiv(this.addr,e),mt(t,e)}}function ph(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(ro.compareFunction=ko,s=ro):s=nl,t.setTexture2D(e||s,r)}function mh(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||rl,r)}function _h(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||sl,r)}function gh(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||il,r)}function vh(n){switch(n){case 5126:return Qf;case 35664:return eh;case 35665:return th;case 35666:return nh;case 35674:return ih;case 35675:return rh;case 35676:return sh;case 5124:case 35670:return ah;case 35667:case 35671:return oh;case 35668:case 35672:return lh;case 35669:case 35673:return ch;case 5125:return uh;case 36294:return dh;case 36295:return fh;case 36296:return hh;case 35678:case 36198:case 36298:case 36306:case 35682:return ph;case 35679:case 36299:case 36307:return mh;case 35680:case 36300:case 36308:case 36293:return _h;case 36289:case 36303:case 36311:case 36292:return gh}}function xh(n,e){n.uniform1fv(this.addr,e)}function Sh(n,e){const t=vi(e,this.size,2);n.uniform2fv(this.addr,t)}function Mh(n,e){const t=vi(e,this.size,3);n.uniform3fv(this.addr,t)}function Eh(n,e){const t=vi(e,this.size,4);n.uniform4fv(this.addr,t)}function Th(n,e){const t=vi(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function yh(n,e){const t=vi(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function bh(n,e){const t=vi(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Ah(n,e){n.uniform1iv(this.addr,e)}function Rh(n,e){n.uniform2iv(this.addr,e)}function Ch(n,e){n.uniform3iv(this.addr,e)}function wh(n,e){n.uniform4iv(this.addr,e)}function Ph(n,e){n.uniform1uiv(this.addr,e)}function Dh(n,e){n.uniform2uiv(this.addr,e)}function Ih(n,e){n.uniform3uiv(this.addr,e)}function Lh(n,e){n.uniform4uiv(this.addr,e)}function Uh(n,e,t){const i=this.cache,r=e.length,s=xr(t,r);pt(i,s)||(n.uniform1iv(this.addr,s),mt(i,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||nl,s[a])}function Nh(n,e,t){const i=this.cache,r=e.length,s=xr(t,r);pt(i,s)||(n.uniform1iv(this.addr,s),mt(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||rl,s[a])}function Fh(n,e,t){const i=this.cache,r=e.length,s=xr(t,r);pt(i,s)||(n.uniform1iv(this.addr,s),mt(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||sl,s[a])}function Oh(n,e,t){const i=this.cache,r=e.length,s=xr(t,r);pt(i,s)||(n.uniform1iv(this.addr,s),mt(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||il,s[a])}function Bh(n){switch(n){case 5126:return xh;case 35664:return Sh;case 35665:return Mh;case 35666:return Eh;case 35674:return Th;case 35675:return yh;case 35676:return bh;case 5124:case 35670:return Ah;case 35667:case 35671:return Rh;case 35668:case 35672:return Ch;case 35669:case 35673:return wh;case 5125:return Ph;case 36294:return Dh;case 36295:return Ih;case 36296:return Lh;case 35678:case 36198:case 36298:case 36306:case 35682:return Uh;case 35679:case 36299:case 36307:return Nh;case 35680:case 36300:case 36308:case 36293:return Fh;case 36289:case 36303:case 36311:case 36292:return Oh}}class zh{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=vh(t.type)}}class Hh{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Bh(t.type)}}class Gh{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const es=/(\w+)(\])?(\[|\.)?/g;function uo(n,e){n.seq.push(e),n.map[e.id]=e}function Vh(n,e,t){const i=n.name,r=i.length;for(es.lastIndex=0;;){const s=es.exec(i),a=es.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){uo(t,c===void 0?new zh(o,n,e):new Hh(o,n,e));break}else{let f=t.map[o];f===void 0&&(f=new Gh(o),uo(t,f)),t=f}}}class fr{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Vh(s,a,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function fo(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const kh=37297;let Wh=0;function Xh(n,e){const t=n.split(`
3726`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
3727`)}const ho=new Ue;function qh(n){We._getMatrix(ho,We.workingColorSpace,n);const e=`mat3( ${ho.elements.map(t=>t.toFixed(4))} )`;switch(We.getTransfer(n)){case pr:return[e,"LinearTransferOETF"];case Je:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function po(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3728
3729`+r+`
3730
3731`+Xh(n.getShaderSource(e),a)}else return r}function Yh(n,e){const t=qh(e);return[`vec4 ${n}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3732`)}function Kh(n,e){let t;switch(e){case Ql:t="Linear";break;case ec:t="Reinhard";break;case tc:t="Cineon";break;case nc:t="ACESFilmic";break;case rc:t="AgX";break;case sc:t="Neutral";break;case ic:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const sr=new z;function $h(){We.getLuminanceCoefficients(sr);const n=sr.x.toFixed(4),e=sr.y.toFixed(4),t=sr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${n}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3733`)}function Zh(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ai).join(`
3734`)}function jh(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
3735`)}function Jh(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function Ai(n){return n!==""}function mo(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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 _o(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Qh=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qs(n){return n.replace(Qh,tp)}const ep=new Map;function tp(n,e){let t=Fe[e];if(t===void 0){const i=ep.get(e);if(i!==void 0)t=Fe[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Qs(t)}const np=/#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 go(n){return n.replace(np,ip)}function ip(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function vo(n){let e=`precision ${n.precision} float;
3736	precision ${n.precision} int;
3737	precision ${n.precision} sampler2D;
3738	precision ${n.precision} samplerCube;
3739	precision ${n.precision} sampler3D;
3740	precision ${n.precision} sampler2DArray;
3741	precision ${n.precision} sampler2DShadow;
3742	precision ${n.precision} samplerCubeShadow;
3743	precision ${n.precision} sampler2DArrayShadow;
3744	precision ${n.precision} isampler2D;
3745	precision ${n.precision} isampler3D;
3746	precision ${n.precision} isamplerCube;
3747	precision ${n.precision} isampler2DArray;
3748	precision ${n.precision} usampler2D;
3749	precision ${n.precision} usampler3D;
3750	precision ${n.precision} usamplerCube;
3751	precision ${n.precision} usampler2DArray;
3752	`;return n.precision==="highp"?e+=`
3753#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3754#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3755#define LOW_PRECISION`),e}function rp(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Io?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Il?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===fn&&(e="SHADOWMAP_TYPE_VSM"),e}function sp(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case fi:case hi:e="ENVMAP_TYPE_CUBE";break;case vr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function ap(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case hi:e="ENVMAP_MODE_REFRACTION";break}return e}function op(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Lo:e="ENVMAP_BLENDING_MULTIPLY";break;case jl:e="ENVMAP_BLENDING_MIX";break;case Jl:e="ENVMAP_BLENDING_ADD";break}return e}function lp(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function cp(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=rp(t),c=sp(t),d=ap(t),f=op(t),p=lp(t),m=Zh(t),x=jh(s),M=r.createProgram();let h,u,T=t.glslVersion?"#version "+t.glslVersion+`
3756`:"";t.isRawShaderMaterial?(h=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Ai).join(`
3757`),h.length>0&&(h+=`
3758`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Ai).join(`
3759`),u.length>0&&(u+=`
3760`)):(h=[vo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,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 "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.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(Ai).join(`
3762`),u=[vo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==Tn?"#define TONE_MAPPING":"",t.toneMapping!==Tn?Fe.tonemapping_pars_fragment:"",t.toneMapping!==Tn?Kh("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fe.colorspace_pars_fragment,Yh("linearToOutputTexel",t.outputColorSpace),$h(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3763`].filter(Ai).join(`
3764`)),a=Qs(a),a=mo(a,t),a=_o(a,t),o=Qs(o),o=mo(o,t),o=_o(o,t),a=go(a),o=go(o),t.isRawShaderMaterial!==!0&&(T=`#version 300 es
3765`,h=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3766`)+`
3767`+h,u=["#define varying in",t.glslVersion===Zs?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Zs?"":"#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 y=T+h+a,E=T+u+o,L=fo(r,r.VERTEX_SHADER,y),A=fo(r,r.FRAGMENT_SHADER,E);r.attachShader(M,L),r.attachShader(M,A),t.index0AttributeName!==void 0?r.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);function C(w){if(n.debug.checkShaderErrors){const X=r.getProgramInfoLog(M).trim(),O=r.getShaderInfoLog(L).trim(),H=r.getShaderInfoLog(A).trim();let Y=!0,G=!0;if(r.getProgramParameter(M,r.LINK_STATUS)===!1)if(Y=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,M,L,A);else{const te=po(r,L,"vertex"),V=po(r,A,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(M,r.VALIDATE_STATUS)+`
3770
3771Material Name: `+w.name+`
3772Material Type: `+w.type+`
3773
3774Program Info Log: `+X+`
3775`+te+`
3776`+V)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(O===""||H==="")&&(G=!1);G&&(w.diagnostics={runnable:Y,programLog:X,vertexShader:{log:O,prefix:h},fragmentShader:{log:H,prefix:u}})}r.deleteShader(L),r.deleteShader(A),U=new fr(r,M),g=Jh(r,M)}let U;this.getUniforms=function(){return U===void 0&&C(this),U};let g;this.getAttributes=function(){return g===void 0&&C(this),g};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(
vendor: 23,031 bytes, lines 3776-3804
3776M,kh)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Wh++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=L,this.fragmentShader=A,this}let up=0;class dp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),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 i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new fp(e),t.set(e,i)),i}}class fp{constructor(e){this.id=up++,this.code=e,this.usedTimes=0}}function hp(n,e,t,i,r,s,a){const o=new qo,l=new dp,c=new Set,d=[],f=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const x={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(g){return c.add(g),g===0?"uv":`uv${g}`}function h(g,S,w,X,O){const H=X.fog,Y=O.geometry,G=g.isMeshStandardMaterial?X.environment:null,te=(g.isMeshStandardMaterial?t:e).get(g.envMap||G),V=te&&te.mapping===vr?te.image.height:null,se=x[g.type];g.precision!==null&&(m=r.getMaxPrecision(g.precision),m!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",m,"instead."));const ce=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,ve=ce!==void 0?ce.length:0;let ue=0;Y.morphAttributes.position!==void 0&&(ue=1),Y.morphAttributes.normal!==void 0&&(ue=2),Y.morphAttributes.color!==void 0&&(ue=3);let we,k,Q,_e;if(se){const Ze=en[se];we=Ze.vertexShader,k=Ze.fragmentShader}else we=g.vertexShader,k=g.fragmentShader,l.update(g),Q=l.getVertexShaderID(g),_e=l.getFragmentShaderID(g);const le=n.getRenderTarget(),Ee=n.state.buffers.depth.getReversed(),qe=O.isInstancedMesh===!0,Ce=O.isBatchedMesh===!0,rt=!!g.map,st=!!g.matcap,Ye=!!te,R=!!g.aoMap,yt=!!g.lightMap,Ke=!!g.bumpMap,et=!!g.normalMap,xe=!!g.displacementMap,Ve=!!g.emissiveMap,ye=!!g.metalnessMap,Ne=!!g.roughnessMap,ht=g.anisotropy>0,b=g.clearcoat>0,_=g.dispersion>0,N=g.iridescence>0,q=g.sheen>0,$=g.transmission>0,W=ht&&!!g.anisotropyMap,Se=b&&!!g.clearcoatMap,re=b&&!!g.clearcoatNormalMap,ge=b&&!!g.clearcoatRoughnessMap,Me=N&&!!g.iridescenceMap,Z=N&&!!g.iridescenceThicknessMap,de=q&&!!g.sheenColorMap,Re=q&&!!g.sheenRoughnessMap,Ae=!!g.specularMap,ne=!!g.specularColorMap,Ie=!!g.specularIntensityMap,P=$&&!!g.transmissionMap,ae=$&&!!g.thicknessMap,j=!!g.gradientMap,he=!!g.alphaMap,J=g.alphaTest>0,K=!!g.alphaHash,pe=!!g.extensions;let Le=Tn;g.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(Le=n.toneMapping);const tt={shaderID:se,shaderType:g.type,shaderName:g.name,vertexShader:we,fragmentShader:k,defines:g.defines,customVertexShaderID:Q,customFragmentShaderID:_e,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:m,batching:Ce,batchingColor:Ce&&O._colorsTexture!==null,instancing:qe,instancingColor:qe&&O.instanceColor!==null,instancingMorph:qe&&O.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:le===null?n.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:yn,alphaToCoverage:!!g.alphaToCoverage,map:rt,matcap:st,envMap:Ye,envMapMode:Ye&&te.mapping,envMapCubeUVHeight:V,aoMap:R,lightMap:yt,bumpMap:Ke,normalMap:et,displacementMap:p&&xe,emissiveMap:Ve,normalMapObjectSpace:et&&g.normalMapType===cc,normalMapTangentSpace:et&&g.normalMapType===lc,metalnessMap:ye,roughnessMap:Ne,anisotropy:ht,anisotropyMap:W,clearcoat:b,clearcoatMap:Se,clearcoatNormalMap:re,clearcoatRoughnessMap:ge,dispersion:_,iridescence:N,iridescenceMap:Me,iridescenceThicknessMap:Z,sheen:q,sheenColorMap:de,sheenRoughnessMap:Re,specularMap:Ae,specularColorMap:ne,specularIntensityMap:Ie,transmission:$,transmissionMap:P,thicknessMap:ae,gradientMap:j,opaque:g.transparent===!1&&g.blending===li&&g.alphaToCoverage===!1,alphaMap:he,alphaTest:J,alphaHash:K,combine:g.combine,mapUv:rt&&M(g.map.channel),aoMapUv:R&&M(g.aoMap.channel),lightMapUv:yt&&M(g.lightMap.channel),bumpMapUv:Ke&&M(g.bumpMap.channel),normalMapUv:et&&M(g.normalMap.channel),displacementMapUv:xe&&M(g.displacementMap.channel),emissiveMapUv:Ve&&M(g.emissiveMap.channel),metalnessMapUv:ye&&M(g.metalnessMap.channel),roughnessMapUv:Ne&&M(g.roughnessMap.channel),anisotropyMapUv:W&&M(g.anisotropyMap.channel),clearcoatMapUv:Se&&M(g.clearcoatMap.channel),clearcoatNormalMapUv:re&&M(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ge&&M(g.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&M(g.iridescenceMap.channel),iridescenceThicknessMapUv:Z&&M(g.iridescenceThicknessMap.channel),sheenColorMapUv:de&&M(g.sheenColorMap.channel),sheenRoughnessMapUv:Re&&M(g.sheenRoughnessMap.channel),specularMapUv:Ae&&M(g.specularMap.channel),specularColorMapUv:ne&&M(g.specularColorMap.channel),specularIntensityMapUv:Ie&&M(g.specularIntensityMap.channel),transmissionMapUv:P&&M(g.transmissionMap.channel),thicknessMapUv:ae&&M(g.thicknessMap.channel),alphaMapUv:he&&M(g.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(et||ht),vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!Y.attributes.uv&&(rt||he),fog:!!H,useFog:g.fog===!0,fogExp2:!!H&&H.isFogExp2,flatShading:g.flatShading===!0&&g.wireframe===!1,sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:Ee,skinning:O.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:ue,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:g.dithering,shadowMapEnabled:n.shadowMap.enabled&&w.length>0,shadowMapType:n.shadowMap.type,toneMapping:Le,decodeVideoTexture:rt&&g.map.isVideoTexture===!0&&We.getTransfer(g.map.colorSpace)===Je,decodeVideoTextureEmissive:Ve&&g.emissiveMap.isVideoTexture===!0&&We.getTransfer(g.emissiveMap.colorSpace)===Je,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===Lt,flipSided:g.side===gt,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:pe&&g.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pe&&g.extensions.multiDraw===!0||Ce)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return tt.vertexUv1s=c.has(1),tt.vertexUv2s=c.has(2),tt.vertexUv3s=c.has(3),c.clear(),tt}function u(g){const S=[];if(g.shaderID?S.push(g.shaderID):(S.push(g.customVertexShaderID),S.push(g.customFragmentShaderID)),g.defines!==void 0)for(const w in g.defines)S.push(w),S.push(g.defines[w]);return g.isRawShaderMaterial===!1&&(T(S,g),y(S,g),S.push(n.outputColorSpace)),S.push(g.customProgramCacheKey),S.join()}function T(g,S){g.push(S.precision),g.push(S.outputColorSpace),g.push(S.envMapMode),g.push(S.envMapCubeUVHeight),g.push(S.mapUv),g.push(S.alphaMapUv),g.push(S.lightMapUv),g.push(S.aoMapUv),g.push(S.bumpMapUv),g.push(S.normalMapUv),g.push(S.displacementMapUv),g.push(S.emissiveMapUv),g.push(S.metalnessMapUv),g.push(S.roughnessMapUv),g.push(S.anisotropyMapUv),g.push(S.clearcoatMapUv),g.push(S.clearcoatNormalMapUv),g.push(S.clearcoatRoughnessMapUv),g.push(S.iridescenceMapUv),g.push(S.iridescenceThicknessMapUv),g.push(S.sheenColorMapUv),g.push(S.sheenRoughnessMapUv),g.push(S.specularMapUv),g.push(S.specularColorMapUv),g.push(S.specularIntensityMapUv),g.push(S.transmissionMapUv),g.push(S.thicknessMapUv),g.push(S.combine),g.push(S.fogExp2),g.push(S.sizeAttenuation),g.push(S.morphTargetsCount),g.push(S.morphAttributeCount),g.push(S.numDirLights),g.push(S.numPointLights),g.push(S.numSpotLights),g.push(S.numSpotLightMaps),g.push(S.numHemiLights),g.push(S.numRectAreaLights),g.push(S.numDirLightShadows),g.push(S.numPointLightShadows),g.push(S.numSpotLightShadows),g.push(S.numSpotLightShadowsWithMaps),g.push(S.numLightProbes),g.push(S.shadowMapType),g.push(S.toneMapping),g.push(S.numClippingPlanes),g.push(S.numClipIntersection),g.push(S.depthPacking)}function y(g,S){o.disableAll(),S.supportsVertexTextures&&o.enable(0),S.instancing&&o.enable(1),S.instancingColor&&o.enable(2),S.instancingMorph&&o.enable(3),S.matcap&&o.enable(4),S.envMap&&o.enable(5),S.normalMapObjectSpace&&o.enable(6),S.normalMapTangentSpace&&o.enable(7),S.clearcoat&&o.enable(8),S.iridescence&&o.enable(9),S.alphaTest&&o.enable(10),S.vertexColors&&o.enable(11),S.vertexAlphas&&o.enable(12),S.vertexUv1s&&o.enable(13),S.vertexUv2s&&o.enable(14),S.vertexUv3s&&o.enable(15),S.vertexTangents&&o.enable(16),S.anisotropy&&o.enable(17),S.alphaHash&&o.enable(18),S.batching&&o.enable(19),S.dispersion&&o.enable(20),S.batchingColor&&o.enable(21),S.gradientMap&&o.enable(22),g.push(o.mask),o.disableAll(),S.fog&&o.enable(0),S.useFog&&o.enable(1),S.flatShading&&o.enable(2),S.logarithmicDepthBuffer&&o.enable(3),S.reverseDepthBuffer&&o.enable(4),S.skinning&&o.enable(5),S.morphTargets&&o.enable(6),S.morphNormals&&o.enable(7),S.morphColors&&o.enable(8),S.premultipliedAlpha&&o.enable(9),S.shadowMapEnabled&&o.enable(10),S.doubleSided&&o.enable(11),S.flipSided&&o.enable(12),S.useDepthPacking&&o.enable(13),S.dithering&&o.enable(14),S.transmission&&o.enable(15),S.sheen&&o.enable(16),S.opaque&&o.enable(17),S.pointsUvs&&o.enable(18),S.decodeVideoTexture&&o.enable(19),S.decodeVideoTextureEmissive&&o.enable(20),S.alphaToCoverage&&o.enable(21),g.push(o.mask)}function E(g){const S=x[g.type];let w;if(S){const X=en[S];w=Gc.clone(X.uniforms)}else w=g.uniforms;return w}function L(g,S){let w;for(let X=0,O=d.length;X<O;X++){const H=d[X];if(H.cacheKey===S){w=H,++w.usedTimes;break}}return w===void 0&&(w=new cp(n,S,g,s),d.push(w)),w}function A(g){if(--g.usedTimes===0){const S=d.indexOf(g);d[S]=d[d.length-1],d.pop(),g.destroy()}}function C(g){l.remove(g)}function U(){l.dispose()}return{getParameters:h,getProgramCacheKey:u,getUniforms:E,acquireProgram:L,releaseProgram:A,releaseShaderCache:C,programs:d,dispose:U}}function pp(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function mp(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function xo(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function So(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(f,p,m,x,M,h){let u=n[e];return u===void 0?(u={id:f.id,object:f,geometry:p,material:m,groupOrder:x,renderOrder:f.renderOrder,z:M,group:h},n[e]=u):(u.id=f.id,u.object=f,u.geometry=p,u.material=m,u.groupOrder=x,u.renderOrder=f.renderOrder,u.z=M,u.group=h),e++,u}function o(f,p,m,x,M,h){const u=a(f,p,m,x,M,h);m.transmission>0?i.push(u):m.transparent===!0?r.push(u):t.push(u)}function l(f,p,m,x,M,h){const u=a(f,p,m,x,M,h);m.transmission>0?i.unshift(u):m.transparent===!0?r.unshift(u):t.unshift(u)}function c(f,p){t.length>1&&t.sort(f||mp),i.length>1&&i.sort(p||xo),r.length>1&&r.sort(p||xo)}function d(){for(let f=e,p=n.length;f<p;f++){const m=n[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:i,transparent:r,init:s,push:o,unshift:l,finish:d,sort:c}}function _p(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new So,n.set(i,[a])):r>=s.length?(a=new So,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function gp(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new z,color:new $e};break;case"SpotLight":t={position:new z,direction:new z,color:new $e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new z,color:new $e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new z,skyColor:new $e,groundColor:new $e};break;case"RectAreaLight":t={color:new $e,position:new z,halfWidth:new z,halfHeight:new z};break}return n[e.id]=t,t}}}function vp(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let xp=0;function Sp(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Mp(n){const e=new gp,t=vp(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new z);const r=new z,s=new ft,a=new ft;function o(c){let d=0,f=0,p=0;for(let g=0;g<9;g++)i.probe[g].set(0,0,0);let m=0,x=0,M=0,h=0,u=0,T=0,y=0,E=0,L=0,A=0,C=0;c.sort(Sp);for(let g=0,S=c.length;g<S;g++){const w=c[g],X=w.color,O=w.intensity,H=w.distance,Y=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)d+=X.r*O,f+=X.g*O,p+=X.b*O;else if(w.isLightProbe){for(let G=0;G<9;G++)i.probe[G].addScaledVector(w.sh.coefficients[G],O);C++}else if(w.isDirectionalLight){const G=e.get(w);if(G.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const te=w.shadow,V=t.get(w);V.shadowIntensity=te.intensity,V.shadowBias=te.bias,V.shadowNormalBias=te.normalBias,V.shadowRadius=te.radius,V.shadowMapSize=te.mapSize,i.directionalShadow[m]=V,i.directionalShadowMap[m]=Y,i.directionalShadowMatrix[m]=w.shadow.matrix,T++}i.directional[m]=G,m++}else if(w.isSpotLight){const G=e.get(w);G.position.setFromMatrixPosition(w.matrixWorld),G.color.copy(X).multiplyScalar(O),G.distance=H,G.coneCos=Math.cos(w.angle),G.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),G.decay=w.decay,i.spot[M]=G;const te=w.shadow;if(w.map&&(i.spotLightMap[L]=w.map,L++,te.updateMatrices(w),w.castShadow&&A++),i.spotLightMatrix[M]=te.matrix,w.castShadow){const V=t.get(w);V.shadowIntensity=te.intensity,V.shadowBias=te.bias,V.shadowNormalBias=te.normalBias,V.shadowRadius=te.radius,V.shadowMapSize=te.mapSize,i.spotShadow[M]=V,i.spotShadowMap[M]=Y,E++}M++}else if(w.isRectAreaLight){const G=e.get(w);G.color.copy(X).multiplyScalar(O),G.halfWidth.set(w.width*.5,0,0),G.halfHeight.set(0,w.height*.5,0),i.rectArea[h]=G,h++}else if(w.isPointLight){const G=e.get(w);if(G.color.copy(w.color).multiplyScalar(w.intensity),G.distance=w.distance,G.decay=w.decay,w.castShadow){const te=w.shadow,V=t.get(w);V.shadowIntensity=te.intensity,V.shadowBias=te.bias,V.shadowNormalBias=te.normalBias,V.shadowRadius=te.radius,V.shadowMapSize=te.mapSize,V.shadowCameraNear=te.camera.near,V.shadowCameraFar=te.camera.far,i.pointShadow[x]=V,i.pointShadowMap[x]=Y,i.pointShadowMatrix[x]=w.shadow.matrix,y++}i.point[x]=G,x++}else if(w.isHemisphereLight){const G=e.get(w);G.skyColor.copy(w.color).multiplyScalar(O),G.groundColor.copy(w.groundColor).multiplyScalar(O),i.hemi[u]=G,u++}}h>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ie.LTC_FLOAT_1,i.rectAreaLTC2=ie.LTC_FLOAT_2):(i.rectAreaLTC1=ie.LTC_HALF_1,i.rectAreaLTC2=ie.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=p;const U=i.hash;(U.directionalLength!==m||U.pointLength!==x||U.spotLength!==M||U.rectAreaLength!==h||U.hemiLength!==u||U.numDirectionalShadows!==T||U.numPointShadows!==y||U.numSpotShadows!==E||U.numSpotMaps!==L||U.numLightProbes!==C)&&(i.directional.length=m,i.spot.length=M,i.rectArea.length=h,i.point.length=x,i.hemi.length=u,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=E+L-A,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=A,i.numLightProbes=C,U.directionalLength=m,U.pointLength=x,U.spotLength=M,U.rectAreaLength=h,U.hemiLength=u,U.numDirectionalShadows=T,U.numPointShadows=y,U.numSpotShadows=E,U.numSpotMaps=L,U.numLightProbes=C,i.version=xp++)}function l(c,d){let f=0,p=0,m=0,x=0,M=0;const h=d.matrixWorldInverse;for(let u=0,T=c.length;u<T;u++){const y=c[u];if(y.isDirectionalLight){const E=i.directional[f];E.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(h),f++}else if(y.isSpotLight){const E=i.spot[m];E.position.setFromMatrixPosition(y.matrixWorld),E.position.applyMatrix4(h),E.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(h),m++}else if(y.isRectAreaLight){const E=i.rectArea[x];E.position.setFromMatrixPosition(y.matrixWorld),E.position.applyMatrix4(h),a.identity(),s.copy(y.matrixWorld),s.premultiply(h),a.extractRotation(s),E.halfWidth.set(y.width*.5,0,0),E.halfHeight.set(0,y.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),x++}else if(y.isPointLight){const E=i.point[p];E.position.setFromMatrixPosition(y.matrixWorld),E.position.applyMatrix4(h),p++}else if(y.isHemisphereLight){const E=i.hemi[M];E.direction.setFromMatrixPosition(y.matrixWorld),E.direction.transformDirection(h),M++}}}return{setup:o,setupView:l,state:i}}function Mo(n){const e=new Mp(n),t=[],i=[];function r(d){c.camera=d,t.length=0,i.length=0}function s(d){t.push(d)}function a(d){i.push(d)}function o(){e.setup(t)}function l(d){e.setupView(t,d)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Ep(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Mo(n),e.set(r,[o])):s>=a.length?(o=new Mo(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}const Tp=`void main() {
3777	gl_Position = vec4( position, 1.0 );
3778}`,yp=`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 bp(n,e,t){let i=new el;const r=new Oe,s=new Oe,a=new ut,o=new Zc({depthPacking:oc}),l=new jc,c={},d=t.maxTextureSize,f={[mn]:gt,[gt]:mn,[Lt]:Lt},p=new Wt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Tp,fragmentShader:yp}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const x=new An;x.setAttribute("position",new Vt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new jt(x,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Io;let u=this.type;this.render=function(A,C,U){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||A.length===0)return;const g=n.getRenderTarget(),S=n.getActiveCubeFace(),w=n.getActiveMipmapLevel(),X=n.state;X.setBlending(rn),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const O=u!==fn&&this.type===fn,H=u===fn&&this.type!==fn;for(let Y=0,G=A.length;Y<G;Y++){const te=A[Y],V=te.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",te,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const se=V.getFrameExtents();if(r.multiply(se),s.copy(V.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/se.x),r.x=s.x*se.x,V.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/se.y),r.y=s.y*se.y,V.mapSize.y=s.y)),V.map===null||O===!0||H===!0){const ve=this.type!==fn?{minFilter:Jt,magFilter:Jt}:{};V.map!==null&&V.map.dispose(),V.map=new kt(r.x,r.y,ve),V.map.texture.name=te.name+".shadowMap",V.camera.updateProjectionMatrix()}n.setRenderTarget(V.map),n.clear();const ce=V.getViewportCount();for(let ve=0;ve<ce;ve++){const ue=V.getViewport(ve);a.set(s.x*ue.x,s.y*ue.y,s.x*ue.z,s.y*ue.w),X.viewport(a),V.updateMatrices(te,ve),i=V.getFrustum(),E(C,U,V.camera,te,this.type)}V.isPointLightShadow!==!0&&this.type===fn&&T(V,U),V.needsUpdate=!1}
vendor: 7,318 bytes, line 3804
3804u=this.type,h.needsUpdate=!1,n.setRenderTarget(g,S,w)};function T(A,C){const U=e.update(M);p.defines.VSM_SAMPLES!==A.blurSamples&&(p.defines.VSM_SAMPLES=A.blurSamples,m.defines.VSM_SAMPLES=A.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new kt(r.x,r.y)),p.uniforms.shadow_pass.value=A.map.texture,p.uniforms.resolution.value=A.mapSize,p.uniforms.radius.value=A.radius,n.setRenderTarget(A.mapPass),n.clear(),n.renderBufferDirect(C,null,U,p,M,null),m.uniforms.shadow_pass.value=A.mapPass.texture,m.uniforms.resolution.value=A.mapSize,m.uniforms.radius.value=A.radius,n.setRenderTarget(A.map),n.clear(),n.renderBufferDirect(C,null,U,m,M,null)}function y(A,C,U,g){let S=null;const w=U.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(w!==void 0)S=w;else if(S=U.isPointLight===!0?l:o,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const X=S.uuid,O=C.uuid;let H=c[X];H===void 0&&(H={},c[X]=H);let Y=H[O];Y===void 0&&(Y=S.clone(),H[O]=Y,C.addEventListener("dispose",L)),S=Y}if(S.visible=C.visible,S.wireframe=C.wireframe,g===fn?S.side=C.shadowSide!==null?C.shadowSide:C.side:S.side=C.shadowSide!==null?C.shadowSide:f[C.side],S.alphaMap=C.alphaMap,S.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,S.map=C.map,S.clipShadows=C.clipShadows,S.clippingPlanes=C.clippingPlanes,S.clipIntersection=C.clipIntersection,S.displacementMap=C.displacementMap,S.displacementScale=C.displacementScale,S.displacementBias=C.displacementBias,S.wireframeLinewidth=C.wireframeLinewidth,S.linewidth=C.linewidth,U.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const X=n.properties.get(S);X.light=U}return S}function E(A,C,U,g,S){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&S===fn)&&(!A.frustumCulled||i.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,A.matrixWorld);const O=e.update(A),H=A.material;if(Array.isArray(H)){const Y=O.groups;for(let G=0,te=Y.length;G<te;G++){const V=Y[G],se=H[V.materialIndex];if(se&&se.visible){const ce=y(A,se,g,S);A.onBeforeShadow(n,A,C,U,O,ce,V),n.renderBufferDirect(U,null,O,ce,A,V),A.onAfterShadow(n,A,C,U,O,ce,V)}}}else if(H.visible){const Y=y(A,H,g,S);A.onBeforeShadow(n,A,C,U,O,Y,null),n.renderBufferDirect(U,null,O,Y,A,null),A.onAfterShadow(n,A,C,U,O,Y,null)}}const X=A.children;for(let O=0,H=X.length;O<H;O++)E(X[O],C,U,g,S)}function L(A){A.target.removeEventListener("dispose",L);for(const U in c){const g=c[U],S=A.target.uuid;S in g&&(g[S].dispose(),delete g[S])}}}const Ap={[ps]:hr,[ms]:vs,[_s]:xs,[di]:gs,[hr]:ps,[vs]:ms,[xs]:_s,[gs]:di};function Rp(n,e){function t(){let P=!1;const ae=new ut;let j=null;const he=new ut(0,0,0,0);return{setMask:function(J){j!==J&&!P&&(n.colorMask(J,J,J,J),j=J)},setLocked:function(J){P=J},setClear:function(J,K,pe,Le,tt){tt===!0&&(J*=Le,K*=Le,pe*=Le),ae.set(J,K,pe,Le),he.equals(ae)===!1&&(n.clearColor(J,K,pe,Le),he.copy(ae))},reset:function(){P=!1,j=null,he.set(-1,0,0,0)}}}function i(){let P=!1,ae=!1,j=null,he=null,J=null;return{setReversed:function(K){if(ae!==K){const pe=e.get("EXT_clip_control");K?pe.clipControlEXT(pe.LOWER_LEFT_EXT,pe.ZERO_TO_ONE_EXT):pe.clipControlEXT(pe.LOWER_LEFT_EXT,pe.NEGATIVE_ONE_TO_ONE_EXT),ae=K;const Le=J;J=null,this.setClear(Le)}},getReversed:function(){return ae},setTest:function(K){K?le(n.DEPTH_TEST):Ee(n.DEPTH_TEST)},setMask:function(K){j!==K&&!P&&(n.depthMask(K),j=K)},setFunc:function(K){if(ae&&(K=Ap[K]),he!==K){switch(K){case ps:n.depthFunc(n.NEVER);break;case hr:n.depthFunc(n.ALWAYS);break;case ms:n.depthFunc(n.LESS);break;case di:n.depthFunc(n.LEQUAL);break;case _s:n.depthFunc(n.EQUAL);break;case gs:n.depthFunc(n.GEQUAL);break;case vs:n.depthFunc(n.GREATER);break;case xs:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}he=K}},setLocked:function(K){P=K},setClear:function(K){J!==K&&(ae&&(K=1-K),n.clearDepth(K),J=K)},reset:function(){P=!1,j=null,he=null,J=null,ae=!1}}}function r(){let P=!1,ae=null,j=null,he=null,J=null,K=null,pe=null,Le=null,tt=null;return{setTest:function(Ze){P||(Ze?le(n.STENCIL_TEST):Ee(n.STENCIL_TEST))},setMask:function(Ze){ae!==Ze&&!P&&(n.stencilMask(Ze),ae=Ze)},setFunc:function(Ze,Xt,sn){(j!==Ze||he!==Xt||J!==sn)&&(n.stencilFunc(Ze,Xt,sn),j=Ze,he=Xt,J=sn)},setOp:function(Ze,Xt,sn){(K!==Ze||pe!==Xt||Le!==sn)&&(n.stencilOp(Ze,Xt,sn),K=Ze,pe=Xt,Le=sn)},setLocked:function(Ze){P=Ze},setClear:function(Ze){tt!==Ze&&(n.clearStencil(Ze),tt=Ze)},reset:function(){P=!1,ae=null,j=null,he=null,J=null,K=null,pe=null,Le=null,tt=null}}}const s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},f={},p=new WeakMap,m=[],x=null,M=!1,h=null,u=null,T=null,y=null,E=null,L=null,A=null,C=new $e(0,0,0),U=0,g=!1,S=null,w=null,X=null,O=null,H=null;const Y=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let G=!1,te=0;const V=n.getParameter(n.VERSION);V.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(V)[1]),G=te>=1):V.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),G=te>=2);let se=null,ce={};const ve=n.getParameter(n.SCISSOR_BOX),ue=n.getParameter(n.VIEWPORT),we=new ut().fromArray(ve),k=new ut().fromArray(ue);function Q(P,ae,j,he){const J=new Uint8Array(4),K=n.createTexture();n.bindTexture(P,K),n.texParameteri(P,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(P,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let pe=0;pe<j;pe++)P===n.TEXTURE_3D||P===n.TEXTURE_2D_ARRAY?n.texImage3D(ae,0,n.RGBA,1,1,he,0,n.RGBA,n.UNSIGNED_BYTE,J):n.texImage2D(ae+pe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,J);return K}const _e={};_e[n.TEXTURE_2D]=Q(n.TEXTURE_2D,n.TEXTURE_2D,1),_e[n.TEXTURE_CUBE_MAP]=Q(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),_e[n.TEXTURE_2D_ARRAY]=Q(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),_e[n.TEXTURE_3D]=Q(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),le(n.DEPTH_TEST),a.setFunc(di),Ke(!1),et(Ra),le(n.CULL_FACE),R(rn);function le(P){d[P]!==!0&&(n.enable(P),d[P]=!0)}function Ee(P){d[P]!==!1&&(n.disable(P),d[P]=!1)}function qe(P,ae){return f[P]!==ae?(n.bindFramebuffer(P,ae),f[P]=ae,P===n.DRAW_FRAMEBUFFER&&(f[n.FRAMEBUFFER]=ae),P===n.FRAMEBUFFER&&(f[n.DRAW_FRAMEBUFFER]=ae),!0):!1}function Ce(P,ae){let j=m,he=!1;if(P){j=p.get(ae),j===void 0&&(j=[],p.set(ae,j));const J=P.textures;if(j.length!==J.length||j[0]!==n.COLOR_ATTACHMENT0){for(let K=0,pe=J.length;K<pe;K++)j[K]=n.COLOR_ATTACHMENT0+K;j.length=J.length,he=!0}}else j[0]!==n.BACK&&(j[0]=n.BACK,he=!0);he&&n.drawBuffers(j)}function rt(P){return x!==P?(n.useProgram(P),x=P,!0):!1}const st={[Bn]:n.FUNC_ADD,[Ul]:n.FUNC_SUBTRACT,[Nl]:n.FUNC_REVERSE_SUBTRACT};st[Fl]=n.MIN,st[Ol]=n.MAX;const Ye={[Bl]:n.ZERO,[zl]:n.ONE,[Hl]:n.SRC_COLOR,[fs]:n.SRC_ALPHA,[ql]:n.SRC_ALPHA_SATURATE,[Wl]:n.DST_COLOR,[Vl]:n.DST_ALPHA,[Gl]:n.ONE_MINUS_SRC_COLOR,[hs]:n.ONE_MINUS_SRC_ALPHA,[Xl]:n.ONE_MINUS_DST_COLOR,[kl]:n.ONE_MINUS_DST_ALPHA,[Yl]:n.CONSTANT_COLOR,[Kl]:n.ONE_MINUS_CONSTANT_COLOR,[$l]:n.CONSTANT_ALPHA,[Zl]:n.ONE_MINUS_CONSTANT_ALPHA};function R(P,ae,j,he,J,K,pe,Le,tt,Ze){if(P===rn){M===!0&&(Ee(n.BLEND),M=!1);return}if(M===!1&&(le(n.BLEND),M=!0),P!==Ll){if(P!==h||Ze!==g){if((u!==Bn||E!==Bn)&&(n.blendEquation(n.FUNC_ADD),u=
vendor: 4,515 bytes, line 3804
3804Bn,E=Bn),Ze)switch(P){case li:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ca:n.blendFunc(n.ONE,n.ONE);break;case wa:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pa:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}else switch(P){case li:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ca:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case wa:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Pa:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}T=null,y=null,L=null,A=null,C.set(0,0,0),U=0,h=P,g=Ze}return}J=J||ae,K=K||j,pe=pe||he,(ae!==u||J!==E)&&(n.blendEquationSeparate(st[ae],st[J]),u=ae,E=J),(j!==T||he!==y||K!==L||pe!==A)&&(n.blendFuncSeparate(Ye[j],Ye[he],Ye[K],Ye[pe]),T=j,y=he,L=K,A=pe),(Le.equals(C)===!1||tt!==U)&&(n.blendColor(Le.r,Le.g,Le.b,tt),C.copy(Le),U=tt),h=P,g=!1}function yt(P,ae){P.side===Lt?Ee(n.CULL_FACE):le(n.CULL_FACE);let j=P.side===gt;ae&&(j=!j),Ke(j),P.blending===li&&P.transparent===!1?R(rn):R(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),s.setMask(P.colorWrite);const he=P.stencilWrite;o.setTest(he),he&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),Ve(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?le(n.SAMPLE_ALPHA_TO_COVERAGE):Ee(n.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(P){S!==P&&(P?n.frontFace(n.CW):n.frontFace(n.CCW),S=P)}function et(P){P!==Pl?(le(n.CULL_FACE),P!==w&&(P===Ra?n.cullFace(n.BACK):P===Dl?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ee(n.CULL_FACE),w=P}function xe(P){P!==X&&(G&&n.lineWidth(P),X=P)}function Ve(P,ae,j){P?(le(n.POLYGON_OFFSET_FILL),(O!==ae||H!==j)&&(n.polygonOffset(ae,j),O=ae,H=j)):Ee(n.POLYGON_OFFSET_FILL)}function ye(P){P?le(n.SCISSOR_TEST):Ee(n.SCISSOR_TEST)}function Ne(P){P===void 0&&(P=n.TEXTURE0+Y-1),se!==P&&(n.activeTexture(P),se=P)}function ht(P,ae,j){j===void 0&&(se===null?j=n.TEXTURE0+Y-1:j=se);let he=ce[j];he===void 0&&(he={type:void 0,texture:void 0},ce[j]=he),(he.type!==P||he.texture!==ae)&&(se!==j&&(n.activeTexture(j),se=j),n.bindTexture(P,ae||_e[P]),he.type=P,he.texture=ae)}function b(){const P=ce[se];P!==void 0&&P.type!==void 0&&(n.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function _(){try{n.compressedTexImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function N(){try{n.compressedTexImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function q(){try{n.texSubImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function $(){try{n.texSubImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function W(){try{n.compressedTexSubImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Se(){try{n.compressedTexSubImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function re(){try{n.texStorage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ge(){try{n.texStorage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Me(){try{n.texImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Z(){try{n.texImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function de(P){we.equals(P)===!1&&(n.scissor(P.x,P.y,P.z,P.w),we.copy(P))}function Re(P){k.equals(P)===!1&&(n.viewport(P.x,P.y,P.z,P.w),k.copy(P))}function Ae(P,ae){let j=c.get(ae);j===void 0&&(j=new WeakMap,c.set(ae,j));let he=j.get(P);he===void 0&&(he=n.getUniformBlockIndex(ae,P.name),j.set(P,he))}function ne(P,ae){const he=c.get(ae).get(P);l.get(ae)!==he&&(n.uniformBlockBinding(ae,he,P.__bindingPointIndex),l.set(ae,he))}function Ie(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor
vendor: 5,645 bytes, line 3804
3804(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),d={},se=null,ce={},f={},p=new WeakMap,m=[],x=null,M=!1,h=null,u=null,T=null,y=null,E=null,L=null,A=null,C=new $e(0,0,0),U=0,g=!1,S=null,w=null,X=null,O=null,H=null,we.set(0,0,n.canvas.width,n.canvas.height),k.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:le,disable:Ee,bindFramebuffer:qe,drawBuffers:Ce,useProgram:rt,setBlending:R,setMaterial:yt,setFlipSided:Ke,setCullFace:et,setLineWidth:xe,setPolygonOffset:Ve,setScissorTest:ye,activeTexture:Ne,bindTexture:ht,unbindTexture:b,compressedTexImage2D:_,compressedTexImage3D:N,texImage2D:Me,texImage3D:Z,updateUBOMapping:Ae,uniformBlockBinding:ne,texStorage2D:re,texStorage3D:ge,texSubImage2D:q,texSubImage3D:$,compressedTexSubImage2D:W,compressedTexSubImage3D:Se,scissor:de,viewport:Re,reset:Ie}}function Cp(n,e,t,i,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 Oe,d=new WeakMap;let f;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(b,_){return m?new OffscreenCanvas(b,_):_r("canvas")}function M(b,_,N){let q=1;const $=ht(b);if(($.width>N||$.height>N)&&(q=N/Math.max($.width,$.height)),q<1)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap||typeof VideoFrame<"u"&&b instanceof VideoFrame){const W=Math.floor(q*$.width),Se=Math.floor(q*$.height);f===void 0&&(f=x(W,Se));const re=_?x(W,Se):f;return re.width=W,re.height=Se,re.getContext("2d").drawImage(b,0,0,W,Se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+W+"x"+Se+")."),re}else return"data"in b&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),b;return b}function h(b){return b.generateMipmaps}function u(b){n.generateMipmap(b)}function T(b){return b.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:b.isWebGL3DRenderTarget?n.TEXTURE_3D:b.isWebGLArrayRenderTarget||b.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function y(b,_,N,q,$=!1){if(b!==null){if(n[b]!==void 0)return n[b];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let W=_;if(_===n.RED&&(N===n.FLOAT&&(W=n.R32F),N===n.HALF_FLOAT&&(W=n.R16F),N===n.UNSIGNED_BYTE&&(W=n.R8)),_===n.RED_INTEGER&&(N===n.UNSIGNED_BYTE&&(W=n.R8UI),N===n.UNSIGNED_SHORT&&(W=n.R16UI),N===n.UNSIGNED_INT&&(W=n.R32UI),N===n.BYTE&&(W=n.R8I),N===n.SHORT&&(W=n.R16I),N===n.INT&&(W=n.R32I)),_===n.RG&&(N===n.FLOAT&&(W=n.RG32F),N===n.HALF_FLOAT&&(W=n.RG16F),N===n.UNSIGNED_BYTE&&(W=n.RG8)),_===n.RG_INTEGER&&(N===n.UNSIGNED_BYTE&&(W=n.RG8UI),N===n.UNSIGNED_SHORT&&(W=n.RG16UI),N===n.UNSIGNED_INT&&(W=n.RG32UI),N===n.BYTE&&(W=n.RG8I),N===n.SHORT&&(W=n.RG16I),N===n.INT&&(W=n.RG32I)),_===n.RGB_INTEGER&&(N===n.UNSIGNED_BYTE&&(W=n.RGB8UI),N===n.UNSIGNED_SHORT&&(W=n.RGB16UI),N===n.UNSIGNED_INT&&(W=n.RGB32UI),N===n.BYTE&&(W=n.RGB8I),N===n.SHORT&&(W=n.RGB16I),N===n.INT&&(W=n.RGB32I)),_===n.RGBA_INTEGER&&(N===n.UNSIGNED_BYTE&&(W=n.RGBA8UI),N===n.UNSIGNED_SHORT&&(W=n.RGBA16UI),N===n.UNSIGNED_INT&&(W=n.RGBA32UI),N===n.BYTE&&(W=n.RGBA8I),N===n.SHORT&&(W=n.RGBA16I),N===n.INT&&(W=n.RGBA32I)),_===n.RGB&&N===n.UNSIGNED_INT_5_9_9_9_REV&&(W=n.RGB9_E5),_===n.RGBA){const Se=$?pr:We.getTransfer(q);N===n.FLOAT&&(W=n.RGBA32F),N===n.HALF_FLOAT&&(W=n.RGBA16F),N===n.UNSIGNED_BYTE&&(W=Se===Je?n.SRGB8_ALPHA8:n.RGBA8),N===n.UNSIGNED_SHORT_4_4_4_4&&(W=n.RGBA4),N===n.UNSIGNED_SHORT_5_5_5_1&&(W=n.RGB5_A1)}return(W===n.R16F||W===n.R32F||W===n.RG16F||W===n.RG32F||W===n.RGBA16F||W===n.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function E(b,_){let N;return b?_===null||_===Wn||_===pi?N=n.DEPTH24_STENCIL8:_===nn?N=n.DEPTH32F_STENCIL8:_===Ri&&(N=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Wn||_===pi?N=n.DEPTH_COMPONENT24:_===nn?N=n.DEPTH_COMPONENT32F:_===Ri&&(N=n.DEPTH_COMPONENT16),N}function L(b,_){return h(b)===!0||b.isFramebufferTexture&&b.minFilter!==Jt&&b.minFilter!==Tt?Math.log2(Math.max(_.width,_.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?_.mipmaps.length:1}function A(b){const _=b.target;_.removeEventListener("dispose",A),U(_),_.isVideoTexture&&d.delete(_)}function C(b){const _=b.target;_.removeEventListener("dispose",C),S(_)}function U(b){const _=i.get(b);if(_.__webglInit===void 0)return;const N=b.source,q=p.get(N);if(q){const $=q[_.__cacheKey];$.usedTimes--,$.usedTimes===0&&g(b),Object.keys(q).length===0&&p.delete(N)}i.remove(b)}function g(b){const _=i.get(b);n.deleteTexture(_.__webglTexture);const N=b.source,q=p.get(N);delete q[_.__cacheKey],a.memory.textures--}function S(b){const _=i.get(b);if(b.depthTexture&&(b.depthTexture.dispose(),i.remove(b.depthTexture)),b.isWebGLCubeRen
vendor: 5,566 bytes, line 3804
3804derTarget)for(let q=0;q<6;q++){if(Array.isArray(_.__webglFramebuffer[q]))for(let $=0;$<_.__webglFramebuffer[q].length;$++)n.deleteFramebuffer(_.__webglFramebuffer[q][$]);else n.deleteFramebuffer(_.__webglFramebuffer[q]);_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer[q])}else{if(Array.isArray(_.__webglFramebuffer))for(let q=0;q<_.__webglFramebuffer.length;q++)n.deleteFramebuffer(_.__webglFramebuffer[q]);else n.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&n.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let q=0;q<_.__webglColorRenderbuffer.length;q++)_.__webglColorRenderbuffer[q]&&n.deleteRenderbuffer(_.__webglColorRenderbuffer[q]);_.__webglDepthRenderbuffer&&n.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const N=b.textures;for(let q=0,$=N.length;q<$;q++){const W=i.get(N[q]);W.__webglTexture&&(n.deleteTexture(W.__webglTexture),a.memory.textures--),i.remove(N[q])}i.remove(b)}let w=0;function X(){w=0}function O(){const b=w;return b>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+r.maxTextures),w+=1,b}function H(b){const _=[];return _.push(b.wrapS),_.push(b.wrapT),_.push(b.wrapR||0),_.push(b.magFilter),_.push(b.minFilter),_.push(b.anisotropy),_.push(b.internalFormat),_.push(b.format),_.push(b.type),_.push(b.generateMipmaps),_.push(b.premultiplyAlpha),_.push(b.flipY),_.push(b.unpackAlignment),_.push(b.colorSpace),_.join()}function Y(b,_){const N=i.get(b);if(b.isVideoTexture&&ye(b),b.isRenderTargetTexture===!1&&b.version>0&&N.__version!==b.version){const q=b.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{_e(N,b,_);return}}t.bindTexture(n.TEXTURE_2D,N.__webglTexture,n.TEXTURE0+_)}function G(b,_){const N=i.get(b);if(b.version>0&&N.__version!==b.version){_e(N,b,_);return}t.bindTexture(n.TEXTURE_2D_ARRAY,N.__webglTexture,n.TEXTURE0+_)}function te(b,_){const N=i.get(b);if(b.version>0&&N.__version!==b.version){_e(N,b,_);return}t.bindTexture(n.TEXTURE_3D,N.__webglTexture,n.TEXTURE0+_)}function V(b,_){const N=i.get(b);if(b.version>0&&N.__version!==b.version){le(N,b,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+_)}const se={[Es]:n.REPEAT,[Hn]:n.CLAMP_TO_EDGE,[Ts]:n.MIRRORED_REPEAT},ce={[Jt]:n.NEAREST,[ac]:n.NEAREST_MIPMAP_NEAREST,[Bi]:n.NEAREST_MIPMAP_LINEAR,[Tt]:n.LINEAR,[yr]:n.LINEAR_MIPMAP_NEAREST,[Gn]:n.LINEAR_MIPMAP_LINEAR},ve={[uc]:n.NEVER,[_c]:n.ALWAYS,[dc]:n.LESS,[ko]:n.LEQUAL,[fc]:n.EQUAL,[mc]:n.GEQUAL,[hc]:n.GREATER,[pc]:n.NOTEQUAL};function ue(b,_){if(_.type===nn&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Tt||_.magFilter===yr||_.magFilter===Bi||_.magFilter===Gn||_.minFilter===Tt||_.minFilter===yr||_.minFilter===Bi||_.minFilter===Gn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(b,n.TEXTURE_WRAP_S,se[_.wrapS]),n.texParameteri(b,n.TEXTURE_WRAP_T,se[_.wrapT]),(b===n.TEXTURE_3D||b===n.TEXTURE_2D_ARRAY)&&n.texParameteri(b,n.TEXTURE_WRAP_R,se[_.wrapR]),n.texParameteri(b,n.TEXTURE_MAG_FILTER,ce[_.magFilter]),n.texParameteri(b,n.TEXTURE_MIN_FILTER,ce[_.minFilter]),_.compareFunction&&(n.texParameteri(b,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(b,n.TEXTURE_COMPARE_FUNC,ve[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Jt||_.minFilter!==Bi&&_.minFilter!==Gn||_.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||i.get(_).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");n.texParameterf(b,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy}}}function we(b,_){let N=!1;b.__webglInit===void 0&&(b.__webglInit=!0,_.addEventListener("dispose",A));const q=_.source;let $=p.get(q);$===void 0&&($={},p.set(q,$));const W=H(_);if(W!==b.__cacheKey){$[W]===void 0&&($[W]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,N=!0),$[W].usedTimes++;const Se=$[b.__cacheKey];Se!==void 0&&($[b.__cacheKey].usedTimes--,Se.usedTimes===0&&g(_)),b.__cacheKey=W,b.__webglTexture=$[W].texture}return N}function k(b,_,N){return Math.floor(Math.floor(b/N)/_)}function Q(b,_,N,q){const W=b.updateRanges;if(W.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,_.width,_.height,N,q,_.data);else{W.sort((Z,de)=>Z.start-de.start);let Se=0;for(let Z=1;Z<W.length;Z++){const de=W[Se],Re=W[Z],Ae=de.start+de.count,ne=k(Re.start,_.width,4),Ie=k(de.start,_.width,4);Re.start<=Ae+1&&ne===Ie&&k(Re.start+Re.count-1,_.width,4)===ne?de.count=Math.max(de.count,Re.start+Re.count-de.start):(++Se,W[Se]=Re)}W.length=Se+1;const re=n.getParameter(n.UNPACK_ROW_LENGTH),ge=n.getParameter(n.UNPACK_SKIP_PIXELS),Me=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,_.width);for(let Z=0,de=W.length;Z<de;Z++){const Re=W[Z],Ae=Math.floor(Re.start/4),ne=Math.ceil(Re.count/4),Ie=Ae%_.width,P=Math.floor(Ae/_.width),ae=ne,j=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,Ie),n.pixelStorei(n.UNPACK_SKIP_ROWS,P),t.texSubImage2D(n.TEXTURE_2D,0,Ie,P,ae,j,N,q,_.data)}b.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,re),n.pixelStorei(n.UNPACK_SKIP_PIXELS,ge),n.pixelStorei(n.UNPACK_SKIP_ROWS,Me)}}function _e(b,_,N){let q=n.TEXTURE_2D;
vendor: 9,049 bytes, line 3804
3804(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(q=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&(q=n.TEXTURE_3D);const $=we(b,_),W=_.source;t.bindTexture(q,b.__webglTexture,n.TEXTURE0+N);const Se=i.get(W);if(W.version!==Se.__version||$===!0){t.activeTexture(n.TEXTURE0+N);const re=We.getPrimaries(We.workingColorSpace),ge=_.colorSpace===tn?null:We.getPrimaries(_.colorSpace),Me=_.colorSpace===tn||re===ge?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);let Z=M(_.image,!1,r.maxTextureSize);Z=Ne(_,Z);const de=s.convert(_.format,_.colorSpace),Re=s.convert(_.type);let Ae=y(_.internalFormat,de,Re,_.colorSpace,_.isVideoTexture);ue(q,_);let ne;const Ie=_.mipmaps,P=_.isVideoTexture!==!0,ae=Se.__version===void 0||$===!0,j=W.dataReady,he=L(_,Z);if(_.isDepthTexture)Ae=E(_.format===mi,_.type),ae&&(P?t.texStorage2D(n.TEXTURE_2D,1,Ae,Z.width,Z.height):t.texImage2D(n.TEXTURE_2D,0,Ae,Z.width,Z.height,0,de,Re,null));else if(_.isDataTexture)if(Ie.length>0){P&&ae&&t.texStorage2D(n.TEXTURE_2D,he,Ae,Ie[0].width,Ie[0].height);for(let J=0,K=Ie.length;J<K;J++)ne=Ie[J],P?j&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,ne.width,ne.height,de,Re,ne.data):t.texImage2D(n.TEXTURE_2D,J,Ae,ne.width,ne.height,0,de,Re,ne.data);_.generateMipmaps=!1}else P?(ae&&t.texStorage2D(n.TEXTURE_2D,he,Ae,Z.width,Z.height),j&&Q(_,Z,de,Re)):t.texImage2D(n.TEXTURE_2D,0,Ae,Z.width,Z.height,0,de,Re,Z.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){P&&ae&&t.texStorage3D(n.TEXTURE_2D_ARRAY,he,Ae,Ie[0].width,Ie[0].height,Z.depth);for(let J=0,K=Ie.length;J<K;J++)if(ne=Ie[J],_.format!==Zt)if(de!==null)if(P){if(j)if(_.layerUpdates.size>0){const pe=Za(ne.width,ne.height,_.format,_.type);for(const Le of _.layerUpdates){const tt=ne.data.subarray(Le*pe/ne.data.BYTES_PER_ELEMENT,(Le+1)*pe/ne.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,Le,ne.width,ne.height,1,de,tt)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,ne.width,ne.height,Z.depth,de,ne.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,J,Ae,ne.width,ne.height,Z.depth,0,ne.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else P?j&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,ne.width,ne.height,Z.depth,de,Re,ne.data):t.texImage3D(n.TEXTURE_2D_ARRAY,J,Ae,ne.width,ne.height,Z.depth,0,de,Re,ne.data)}else{P&&ae&&t.texStorage2D(n.TEXTURE_2D,he,Ae,Ie[0].width,Ie[0].height);for(let J=0,K=Ie.length;J<K;J++)ne=Ie[J],_.format!==Zt?de!==null?P?j&&t.compressedTexSubImage2D(n.TEXTURE_2D,J,0,0,ne.width,ne.height,de,ne.data):t.compressedTexImage2D(n.TEXTURE_2D,J,Ae,ne.width,ne.height,0,ne.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):P?j&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,ne.width,ne.height,de,Re,ne.data):t.texImage2D(n.TEXTURE_2D,J,Ae,ne.width,ne.height,0,de,Re,ne.data)}else if(_.isDataArrayTexture)if(P){if(ae&&t.texStorage3D(n.TEXTURE_2D_ARRAY,he,Ae,Z.width,Z.height,Z.depth),j)if(_.layerUpdates.size>0){const J=Za(Z.width,Z.height,_.format,_.type);for(const K of _.layerUpdates){const pe=Z.data.subarray(K*J/Z.data.BYTES_PER_ELEMENT,(K+1)*J/Z.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,K,Z.width,Z.height,1,de,Re,pe)}_.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,de,Re,Z.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ae,Z.width,Z.height,Z.depth,0,de,Re,Z.data);else if(_.isData3DTexture)P?(ae&&t.texStorage3D(n.TEXTURE_3D,he,Ae,Z.width,Z.height,Z.depth),j&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,de,Re,Z.data)):t.texImage3D(n.TEXTURE_3D,0,Ae,Z.width,Z.height,Z.depth,0,de,Re,Z.data);else if(_.isFramebufferTexture){if(ae)if(P)t.texStorage2D(n.TEXTURE_2D,he,Ae,Z.width,Z.height);else{let J=Z.width,K=Z.height;for(let pe=0;pe<he;pe++)t.texImage2D(n.TEXTURE_2D,pe,Ae,J,K,0,de,Re,null),J>>=1,K>>=1}}else if(Ie.length>0){if(P&&ae){const J=ht(Ie[0]);t.texStorage2D(n.TEXTURE_2D,he,Ae,J.width,J.height)}for(let J=0,K=Ie.length;J<K;J++)ne=Ie[J],P?j&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,de,Re,ne):t.texImage2D(n.TEXTURE_2D,J,Ae,de,Re,ne);_.generateMipmaps=!1}else if(P){if(ae){const J=ht(Z);t.texStorage2D(n.TEXTURE_2D,he,Ae,J.width,J.height)}j&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,de,Re,Z)}else t.texImage2D(n.TEXTURE_2D,0,Ae,de,Re,Z);h(_)&&u(q),Se.__version=W.version,_.onUpdate&&_.onUpdate(_)}b.__version=_.version}function le(b,_,N){if(_.image.length!==6)return;const q=we(b,_),$=_.source;t.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture,n.TEXTURE0+N);const W=i.get($);if($.version!==W.__version||q===!0){t.activeTexture(n.TEXTURE0+N);const Se=We.getPrimaries(We.workingColorSpace),re=_.colorSpace===tn?null:We.getPrimaries(_.colorSpace),ge=_.colorSpace===tn||Se===re?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ge);const Me=_.isCompressedTexture||_.image[0].isCompressedTexture,Z=_.image[0]&&_.image[0].isDataTexture,de=[];for(let K=0;K<6;K++)!Me&&!Z?de[K]=M(_.image[K],!0,r.maxCubemapSize):de[K]=Z?_.image[K].image:_.image[K],de[K]=Ne(_,de[K]);const Re=de[0],Ae=s.convert(_.format,_.colorSpace),ne=s.convert(_.type),Ie=y(_.internalFormat,Ae,ne,_.colorSpace),P=_.isVideoTexture!==!0,ae=W.__version===void 0||q===!0,j=$.dataReady;let he=L(_,Re);ue(n.TEXTURE_CUBE_MAP,_);let J;if(Me){P&&ae&&t.texStorage2D(n.TEXTURE_CUBE_MAP,he,Ie,Re.width,Re.height);for(let K=0;K<6;K++){J=de[K].mipmaps;for(let pe=0;pe<J.length;pe++){const Le=J[pe];_.format!==Zt?Ae!==null?P?j&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe,0,0,Le.width,Le.height,Ae,Le.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe,Ie,Le.width,Le.height,0,Le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?j&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe,0,0,Le.width,Le.height,Ae,ne,Le.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe,Ie,Le.width,Le.height,0,Ae,ne,Le.data)}}}else{if(J=_.mipmaps,P&&ae){J.length>0&&he++;const K=ht(de[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,he,Ie,K.width,K.height)}for(let K=0;K<6;K++)if(Z){P?j&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,de[K].width,de[K].height,Ae,ne,de[K].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Ie,de[K].width,de[K].height,0,Ae,ne,de[K].data);for(let pe=0;pe<J.length;pe++){const tt=J[pe].image[K].image;P?j&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe+1,0,0,tt.width,tt.height,Ae,ne,tt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe+1,Ie,tt.width,tt.height,0,Ae,ne,tt.data)}}else{P?j&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,Ae,ne,de[K]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Ie,Ae,ne,de[K]);for(let pe=0;pe<J.length;pe++){const Le=J[pe];P?j&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe+1,0,0,Ae,ne,Le.image[K]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+K,pe+1,Ie,Ae,ne,Le.image[K])}}}h(_)&&u(n.TEXTURE_CUBE_MAP),W.__version=$.version,_.onUpdate&&_.onUpdate(_)}b.__version=_.version}function Ee(b,_,N,q,$,W){const Se=s.convert(N.format,N.colorSpace),re=s.convert(N.type),ge=y(N.internalFormat,Se,re,N.colorSpace),Me=i.get(_),Z=i.get(N);if(Z.__renderTarget=_,!Me.__hasExternalTextures){const de=Math.max(1,_.width>>W),Re=Math.max(1,_.height>>W);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,W,ge,de,Re,_.depth,0,Se,re,null):t.texImage2D($,W,ge,de,Re,0,Se,re,null)}t.bindFramebuffer(n.FRAMEBUFFER,b),Ve(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,q,$,Z.__webglTexture,0,xe(_)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,q,$,Z.__webglTexture,W),t.bindFramebuffer(n.FRAMEBUFFER,null)}function qe(b,_,N){if(n.bindRenderbuffer(n.RENDERBUFFER,b),_.depthBuffer){const q=_.depthTexture,$=q&&q.isDepthTexture?q.type:null,W=E(_.stencilBuffer,$),Se=_.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,re=xe(_);Ve(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,re,W,_.width,_.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,re,W,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,W,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Se,n.RENDERBUFFER,b)}else{const q=_.textures;for(let $=0;$<q.length;$++){const W=q[$],Se=s.convert(W.format,W.colorSpace),re=s.convert(W.type),ge=y(W.internalFormat,Se,re,W.colorSpace),Me=xe(_);N&&Ve(_)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Me,ge,_.width,_.height):Ve(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Me,ge,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,ge,_.width,_.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}
3804function Ce(b,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,b),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const q=i.get(_.depthTexture);q.__renderTarget=_,(!q.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),Y(_.depthTexture,0);const $=q.__webglTexture,W=xe(_);if(_.depthTexture.format===Ci)Ve(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,$,0,W):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,$,0);else if(_.depthTexture.format===mi)Ve(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,$,0,W):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function rt(b){const _=i.get(b),N=b.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==b.depthTexture){const q=b.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),q){const $=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,q.removeEventListener("dispose",$)};q.addEventListener("dispose",$),_.__depthDisposeCallback=$}_.__boundDepthTexture=q}if(b.depthTexture&&!_.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");const q=b.texture.mipmaps;q&&q.length>0?Ce(_.__webglFramebuffer[0],b):Ce(_.__webglFramebuffer,b)}else if(N){_.__webglDepthbuffer=[];for(let q=0;q<6;q++)if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[q]),_.__webglDepthbuffer[q]===void 0)_.__webglDepthbuffer[q]=n.createRenderbuffer(),qe(_.__webglDepthbuffer[q],b,!1);
vendor: 4,864 bytes, line 3804
3804else{const $=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,W=_.__webglDepthbuffer[q];n.bindRenderbuffer(n.RENDERBUFFER,W),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,W)}}else{const q=b.texture.mipmaps;if(q&&q.length>0?t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=n.createRenderbuffer(),qe(_.__webglDepthbuffer,b,!1);else{const $=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,W=_.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,W),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,W)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function st(b,_,N){const q=i.get(b);_!==void 0&&Ee(q.__webglFramebuffer,b,b.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),N!==void 0&&rt(b)}function Ye(b){const _=b.texture,N=i.get(b),q=i.get(_);b.addEventListener("dispose",C);const $=b.textures,W=b.isWebGLCubeRenderTarget===!0,Se=$.length>1;if(Se||(q.__webglTexture===void 0&&(q.__webglTexture=n.createTexture()),q.__version=_.version,a.memory.textures++),W){N.__webglFramebuffer=[];for(let re=0;re<6;re++)if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer[re]=[];for(let ge=0;ge<_.mipmaps.length;ge++)N.__webglFramebuffer[re][ge]=n.createFramebuffer()}else N.__webglFramebuffer[re]=n.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer=[];for(let re=0;re<_.mipmaps.length;re++)N.__webglFramebuffer[re]=n.createFramebuffer()}else N.__webglFramebuffer=n.createFramebuffer();if(Se)for(let re=0,ge=$.length;re<ge;re++){const Me=i.get($[re]);Me.__webglTexture===void 0&&(Me.__webglTexture=n.createTexture(),a.memory.textures++)}if(b.samples>0&&Ve(b)===!1){N.__webglMultisampledFramebuffer=n.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let re=0;re<$.length;re++){const ge=$[re];N.__webglColorRenderbuffer[re]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,N.__webglColorRenderbuffer[re]);const Me=s.convert(ge.format,ge.colorSpace),Z=s.convert(ge.type),de=y(ge.internalFormat,Me,Z,ge.colorSpace,b.isXRRenderTarget===!0),Re=xe(b);n.renderbufferStorageMultisample(n.RENDERBUFFER,Re,de,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+re,n.RENDERBUFFER,N.__webglColorRenderbuffer[re])}n.bindRenderbuffer(n.RENDERBUFFER,null),b.depthBuffer&&(N.__webglDepthRenderbuffer=n.createRenderbuffer(),qe(N.__webglDepthRenderbuffer,b,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(W){t.bindTexture(n.TEXTURE_CUBE_MAP,q.__webglTexture),ue(n.TEXTURE_CUBE_MAP,_);for(let re=0;re<6;re++)if(_.mipmaps&&_.mipmaps.length>0)for(let ge=0;ge<_.mipmaps.length;ge++)Ee(N.__webglFramebuffer[re][ge],b,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+re,ge);else Ee(N.__webglFramebuffer[re],b,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);h(_)&&u(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Se){for(let re=0,ge=$.length;re<ge;re++){const Me=$[re],Z=i.get(Me);t.bindTexture(n.TEXTURE_2D,Z.__webglTexture),ue(n.TEXTURE_2D,Me),Ee(N.__webglFramebuffer,b,Me,n.COLOR_ATTACHMENT0+re,n.TEXTURE_2D,0),h(Me)&&u(n.TEXTURE_2D)}t.unbindTexture()}else{let re=n.TEXTURE_2D;if((b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(re=b.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(re,q.__webglTexture),ue(re,_),_.mipmaps&&_.mipmaps.length>0)for(let ge=0;ge<_.mipmaps.length;ge++)Ee(N.__webglFramebuffer[ge],b,_,n.COLOR_ATTACHMENT0,re,ge);else Ee(N.__webglFramebuffer,b,_,n.COLOR_ATTACHMENT0,re,0);h(_)&&u(re),t.unbindTexture()}b.depthBuffer&&rt(b)}function R(b){const _=b.textures;for(let N=0,q=_.length;N<q;N++){const $=_[N];if(h($)){const W=T(b),Se=i.get($).__webglTexture;t.bindTexture(W,Se),u(W),t.unbindTexture()}}}const yt=[],Ke=[];function et(b){if(b.samples>0){if(Ve(b)===!1){const _=b.textures,N=b.width,q=b.height;let $=n.COLOR_BUFFER_BIT;const W=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Se=i.get(b),re=_.length>1;if(re)for(let Me=0;Me<_.length;Me++)t.bindFramebuffer(n.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Se.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Se.__webglMultisampledFramebuffer);const ge=b.texture.mipmaps;ge&&ge.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Se.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Se.__webglFramebuffer);for(let Me=0;Me<_.length;Me++){if(b.resolveDepthBuffer&&(b.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),b.stencilBuffer&&b.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),re){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Se.__webglColorRen
vendor: 6,203 bytes, line 3804
3804derbuffer[Me]);const Z=i.get(_[Me]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Z,0)}n.blitFramebuffer(0,0,N,q,0,0,N,q,$,n.NEAREST),l===!0&&(yt.length=0,Ke.length=0,yt.push(n.COLOR_ATTACHMENT0+Me),b.depthBuffer&&b.resolveDepthBuffer===!1&&(yt.push(W),Ke.push(W),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Ke)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),re)for(let Me=0;Me<_.length;Me++){t.bindFramebuffer(n.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,Se.__webglColorRenderbuffer[Me]);const Z=i.get(_[Me]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Se.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,Z,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Se.__webglMultisampledFramebuffer)}else if(b.depthBuffer&&b.resolveDepthBuffer===!1&&l){const _=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_])}}}function xe(b){return Math.min(r.maxSamples,b.samples)}function Ve(b){const _=i.get(b);return b.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function ye(b){const _=a.render.frame;d.get(b)!==_&&(d.set(b,_),b.update())}function Ne(b,_){const N=b.colorSpace,q=b.format,$=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||N!==yn&&N!==tn&&(We.getTransfer(N)===Je?(q!==Zt||$!==Nt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),_}function ht(b){return typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement?(c.width=b.naturalWidth||b.width,c.height=b.naturalHeight||b.height):typeof VideoFrame<"u"&&b instanceof VideoFrame?(c.width=b.displayWidth,c.height=b.displayHeight):(c.width=b.width,c.height=b.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=X,this.setTexture2D=Y,this.setTexture2DArray=G,this.setTexture3D=te,this.setTextureCube=V,this.rebindTextures=st,this.setupRenderTarget=Ye,this.updateRenderTargetMipmap=R,this.updateMultisampleRenderTarget=et,this.setupDepthRenderbuffer=rt,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=Ve}function wp(n,e){function t(i,r=tn){let s;const a=We.getTransfer(r);if(i===Nt)return n.UNSIGNED_BYTE;if(i===sa)return n.UNSIGNED_SHORT_4_4_4_4;if(i===aa)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Oo)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===No)return n.BYTE;if(i===Fo)return n.SHORT;if(i===Ri)return n.UNSIGNED_SHORT;if(i===ra)return n.INT;if(i===Wn)return n.UNSIGNED_INT;if(i===nn)return n.FLOAT;if(i===wi)return n.HALF_FLOAT;if(i===Bo)return n.ALPHA;if(i===zo)return n.RGB;if(i===Zt)return n.RGBA;if(i===Ci)return n.DEPTH_COMPONENT;if(i===mi)return n.DEPTH_STENCIL;if(i===Ho)return n.RED;if(i===oa)return n.RED_INTEGER;if(i===Go)return n.RG;if(i===la)return n.RG_INTEGER;if(i===ca)return n.RGBA_INTEGER;if(i===or||i===lr||i===cr||i===ur)if(a===Je)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===or)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===or)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===lr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===ys||i===bs||i===As||i===Rs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===ys)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===bs)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===As)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Rs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Cs||i===ws||i===Ps)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Cs||i===ws)return a===Je?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Ps)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Ds||i===Is||i===Ls||i===Us||i===Ns||i===Fs||i===Os||i===Bs||i===zs||i===Hs||i===Gs||i===Vs||i===ks||i===Ws)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Ds)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Is)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Ls)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Us)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Ns)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Fs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Os)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Bs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===zs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Hs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Gs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Vs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ks)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ws)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===dr||i===Xs||i===qs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===dr)return a===Je?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Xs)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===qs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Vo||i===Ys||i===Ks||i===$s)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===dr)return s.COMPRESSED_RED_RGT
vendor: 11,032 bytes, lines 3804-3828
3804C1_EXT;if(i===Ys)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ks)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===$s)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===pi?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const Pp=`
3805void main() {
3806
3807	gl_Position = vec4( position, 1.0 );
3808
3809}`,Dp=`
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 Ip{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new St,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==i.depthNear||t.depthFar!==i.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,i=new Wt({vertexShader:Pp,fragmentShader:Dp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new jt(new Ni(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Lp extends bn{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,f=null,p=null,m=null,x=null;const M=new Ip,h=t.getContextAttributes();let u=null,T=null;const y=[],E=[],L=new Oe;let A=null;const C=new Ht;C.viewport=new ut;const U=new Ht;U.viewport=new ut;const g=[C,U],S=new Jc;let w=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let Q=y[k];return Q===void 0&&(Q=new Yr,y[k]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(k){let Q=y[k];return Q===void 0&&(Q=new Yr,y[k]=Q),Q.getGripSpace()},this.getHand=function(k){let Q=y[k];return Q===void 0&&(Q=new Yr,y[k]=Q),Q.getHandSpace()};function O(k){const Q=E.indexOf(k.inputSource);if(Q===-1)return;const _e=y[Q];_e!==void 0&&(_e.update(k.inputSource,k.frame,c||a),_e.dispatchEvent({type:k.type,data:k.inputSource}))}function H(){r.removeEventListener("select",O),r.removeEventListener("selectstart",O),r.removeEventListener("selectend",O),r.removeEventListener("squeeze",O),r.removeEventListener("squeezestart",O),r.removeEventListener("squeezeend",O),r.removeEventListener("end",H),r.removeEventListener("inputsourceschange",Y);for(let k=0;k<y.length;k++){const Q=E[k];Q!==null&&(E[k]=null,y[k].disconnect(Q))}w=null,X=null,M.reset(),e.setRenderTarget(u),m=null,p=null,f=null,r=null,T=null,we.stop(),i.isPresenting=!1,e.setPixelRatio(A),e.setSize(L.width,L.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(k){s=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(k){o=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(k){c=k},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return f},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function(k){if(r=k,r!==null){if(u=e.getRenderTarget(),r.addEventListener("select",O),r.addEventListener("selectstart",O),r.addEventListener("selectend",O),r.addEventListener("squeeze",O),r.addEventListener("squeezestart",O),r.addEventListener("squeezeend",O),r.addEventListener("end",H),r.addEventListener("inputsourceschange",Y),h.xrCompatible!==!0&&await t.makeXRCompatible(),A=e.getPixelRatio(),e.getSize(L),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let _e=null,le=null,Ee=null;h.depth&&(Ee=h.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,_e=h.stencil?mi:Ci,le=h.stencil?pi:Wn);const qe={colorFormat:t.RGBA8,depthFormat:Ee,scaleFactor:s};f=new XRWebGLBinding(r,t),p=f.createProjectionLayer(qe),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),T=new kt(p.textureWidth,p.textureHeight,{format:Zt,type:Nt,depthTexture:new fa(p.textureWidth,p.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,_e),stencilBuffer:h.stencil,colorSpace:e.outputColorSpace,samples:h.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const _e={antialias:h.antialias,alpha:!0,depth:h.depth,stencil:h.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,_e),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),T=new kt(m.framebufferWidth,m.framebufferHeight,{format:Zt,type:Nt,colorSpace:e.outputColorSpace,stencilBuffer:h.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),we.setContext(r),we.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function Y(k){for(let Q=0;Q<k.removed.length;Q++){const _e=k.removed[Q],le=E.indexOf(_e);le>=0&&(E[le]=null,y[le].disconnect(_e))}for(let Q=0;Q<k.added.length;Q++){const _e=k.added[Q];let le=E.indexOf(_e);if(le===-1){for(let qe=0;qe<y.length;qe++)if(qe>=E.length){E.push(_e),le=qe;break}else if(E[qe]===null){E[qe]=_e,le=qe;break}if(le===-1)break}const Ee=y[le];Ee&&Ee.connect(_e)}}const G=new z,te=new z;function V(k,Q,_e){G.setFromMatrixPosition(Q.matrixWorld),te.setFromMatrixPosition(_e.matrixWorld);const le=G.distanceTo(te),Ee=Q.projectionMatrix.elements,qe=_e.projectionMatrix.elements,Ce=Ee[14]/(Ee[10]-1),rt=Ee[14]/(Ee[10]+1),st=(Ee[9]+1)/Ee[5],Ye=(Ee[9]-1)/Ee[5],R=(Ee[8]-1)/Ee[0],yt=(qe[8]+1)/qe[0],Ke=Ce*R,et=Ce*yt,xe=le/(-R+yt),Ve=xe*-R;if(Q.matrixWorld.decompose(k.position,k.quaternion,k.scale),k.translateX(Ve),k.translateZ(xe),k.matrixWorld.compose(k.position,k.quaternion,k.scale),k.matrixWorldInverse.copy(k.matrixWorld).invert(),Ee[10]===-1)k.projectionMatrix.copy(Q.projectionMatrix),k.projectionMatrixInverse.copy(Q.projectionMatrixInverse);else{const ye=Ce+xe,Ne=rt+xe,ht=Ke-Ve,b=et+(le-Ve),_=st*rt/Ne*ye,N=Ye*rt/Ne*ye;k.projectionMatrix.makePerspective(ht,b,_,N,ye,Ne),k.projectionMatrixInverse.copy(k.projectionMatrix).invert()}}function se(k,Q){Q===null?k.matrixWorld.copy(k.matrix):k.matrixWorld.multiplyMatrices(Q.matrixWorld,k.matrix),k.matrixWorldInverse.copy(k.matrixWorld).invert()}this.updateCamera=function(k){if(r===null)return;let Q=k.near,_e=k.far;M.texture!==null&&(M.depthNear>0&&(Q=M.depthNear),M.depthFar>0&&(_e=M.depthFar)),S.near=U.near=C.near=Q,S.far=U.far=C.far=_e,(w!==S.near||X!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),w=S.near,X=S.far),C.layers.mask=k.layers.mask|2,U.layers.mask=k.layers.mask|4,S.layers.mask=C.layers.mask|U.layers.mask;const le=k.parent,Ee=S.cameras;se(S,le);for(let qe=0;qe<Ee.length;qe++)se(Ee[qe],le);Ee.length===2?V(S,C,U):S.projectionMatrix.copy(C.projectionMatrix),ce(k,S,le)};function ce(k,Q,_e){_e===null?k.matrix.copy(Q.matrixWorld):(k.matrix.copy(_e.matrixWorld),k.matrix.invert(),k.matrix.multiply(Q.matrixWorld)),k.matrix.decompose(k.position,k.quaternion,k.scale),k.updateMatrixWorld(!0),k.projectionMatrix.copy(Q.projectionMatrix),k.projectionMatrixInverse.copy(Q.projectionMatrixInverse),k.isPerspectiveCamera&&(k.fov=js*2*Math.atan(1/k.projectionMatrix.elements[5]),k.zoom=1)}this.getCamera=function(){return S},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(k){l=k,p!==null&&(p.fixedFoveation=k),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=k)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(S)};let ve=null;function ue(k,Q){if(d=Q.getViewerPose(c||a),x=Q,d!==null){const _e=d.views;m!==null&&(e.setRenderTargetFramebuffer(T,m.framebuffer),e.setRenderTarget(T));let le=!1;_e.length!==S.cameras.length&&(S.cameras.length=0,le=!0);for(let Ce=0;Ce<_e.length;Ce++){const rt=_e[Ce];let st=null;if(m!==null)st=m.getViewport(rt);else{const R=f.getViewSubImage(p,rt);st=R.viewport,Ce===0&&(e.setRenderTargetTextures(T,R.colorTexture,R.depthStencilTexture),e.setRenderTarget(T))}let Ye=g[Ce];Ye===void 0&&(Ye=new Ht,Ye.layers.enable(Ce),Ye.viewport=new ut,g[Ce]=Ye),Ye.matrix.fromArray(rt.transform.matrix),Ye.matrix.decompose(Ye.position,Ye.quaternion,Ye.scale),Ye.projectionMatrix.fromArray(rt.projectionMatrix),Ye.projectionMatrixInverse.copy(Ye.projectionMatrix).invert(),Ye.viewport.set(st.x,st.y,st.width,st.height),Ce===0&&(S.matrix.copy(Ye.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),le===!0&&S.cameras.push(Ye)}const Ee=r.enabledFeatures;if(Ee&&Ee.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&f){const Ce=f.getDepthInformation(_e[0]);Ce&&Ce.isValid&&Ce.texture&&M.init(e,Ce,r.renderState)}}for(let _e=0;_e<y.length;_e++){const le=E[_e],Ee=y[_e];le!==null&&Ee!==void 0&&Ee.update(le,Q,c||a)}ve&&ve(k,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),x=null}const we=new tl;we.setAnimationLoop(ue),this.setAnimationLoop=function(k){ve=k},this.dispose=function(){}}}const Nn=new _n,Up=new ft;function Np(n,e){function t(h,u){h.matrixAutoUpdate===!0&&h.updateMatrix(),u.value.copy(h.matrix)}function i(h,u){u.color.getRGB(h.fogColor.value,jo(n)),u.isFog?(h.fogNear.value=u.near,h.fogFar.value=u.far):u.isFogExp2&&(h.fogDensity.value=u.density)}function r(h,u,T,y,E){u.isMeshBasicMaterial||u.isMeshLambertMaterial?s(h,u):u.isMeshToonMaterial?(s(h,u),f(h,u)):u.isMeshPhongMaterial?(s(h,u),d(h,u)):u.isMeshStandardMaterial?(s(h,u),p(h,u),u.isMeshPhysicalMaterial&&m(h,u,E)):u.isMeshMatcapMaterial?(s(h,u),x(h,u)):u.isMeshDepthMaterial?s(h,u):u.isMeshDistanceMaterial?(s(h,u),M(h,u)):u.isMeshNormalMaterial?s(h,u):u.isLineBasicMaterial?(a(h,u),u.isLineDashedMaterial&&o(h,u)):u.isPointsMaterial?l(h,u,T,y):u.isSpriteMaterial?c(h,u):u.isShadowMaterial?(h.color.value.copy(u.color),h.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(h,u){h.opacity.value=u.opacity,u.color&&h.diffuse.value.copy(u.color),u.emissive&&h.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(h.map.value=u.map,t(u.map,h.mapTransform)),u.alphaMap&&(h.alphaMap.value=u.alphaMap,t(u.alphaMap,h.alphaMapTransform)),u.bumpMap&&(h.bumpMap.value=u.bumpMap,t(u.bumpMap,h.bumpMapTransform),h.bumpScale.value=u.bumpScale,u.side===gt&&(h.bumpScale.value*=-1)),u.normalMap&&(h.normalMap.value=u.normalMap,t(u.normalMap,h.normalMapTransform),h.normalScale.value.copy(u.normalScale),u.side===gt&&h.normalScale.value.negate()),u.displacementMap&&(h.displacementMap.value=u.displacementMap,t(u.dis
vendor: 10,608 bytes, line 3828
3828placementMap,h.displacementMapTransform),h.displacementScale.value=u.displacementScale,h.displacementBias.value=u.displacementBias),u.emissiveMap&&(h.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,h.emissiveMapTransform)),u.specularMap&&(h.specularMap.value=u.specularMap,t(u.specularMap,h.specularMapTransform)),u.alphaTest>0&&(h.alphaTest.value=u.alphaTest);const T=e.get(u),y=T.envMap,E=T.envMapRotation;y&&(h.envMap.value=y,Nn.copy(E),Nn.x*=-1,Nn.y*=-1,Nn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Nn.y*=-1,Nn.z*=-1),h.envMapRotation.value.setFromMatrix4(Up.makeRotationFromEuler(Nn)),h.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=u.reflectivity,h.ior.value=u.ior,h.refractionRatio.value=u.refractionRatio),u.lightMap&&(h.lightMap.value=u.lightMap,h.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,h.lightMapTransform)),u.aoMap&&(h.aoMap.value=u.aoMap,h.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,h.aoMapTransform))}function a(h,u){h.diffuse.value.copy(u.color),h.opacity.value=u.opacity,u.map&&(h.map.value=u.map,t(u.map,h.mapTransform))}function o(h,u){h.dashSize.value=u.dashSize,h.totalSize.value=u.dashSize+u.gapSize,h.scale.value=u.scale}function l(h,u,T,y){h.diffuse.value.copy(u.color),h.opacity.value=u.opacity,h.size.value=u.size*T,h.scale.value=y*.5,u.map&&(h.map.value=u.map,t(u.map,h.uvTransform)),u.alphaMap&&(h.alphaMap.value=u.alphaMap,t(u.alphaMap,h.alphaMapTransform)),u.alphaTest>0&&(h.alphaTest.value=u.alphaTest)}function c(h,u){h.diffuse.value.copy(u.color),h.opacity.value=u.opacity,h.rotation.value=u.rotation,u.map&&(h.map.value=u.map,t(u.map,h.mapTransform)),u.alphaMap&&(h.alphaMap.value=u.alphaMap,t(u.alphaMap,h.alphaMapTransform)),u.alphaTest>0&&(h.alphaTest.value=u.alphaTest)}function d(h,u){h.specular.value.copy(u.specular),h.shininess.value=Math.max(u.shininess,1e-4)}function f(h,u){u.gradientMap&&(h.gradientMap.value=u.gradientMap)}function p(h,u){h.metalness.value=u.metalness,u.metalnessMap&&(h.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,h.metalnessMapTransform)),h.roughness.value=u.roughness,u.roughnessMap&&(h.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,h.roughnessMapTransform)),u.envMap&&(h.envMapIntensity.value=u.envMapIntensity)}function m(h,u,T){h.ior.value=u.ior,u.sheen>0&&(h.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),h.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(h.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,h.sheenColorMapTransform)),u.sheenRoughnessMap&&(h.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,h.sheenRoughnessMapTransform))),u.clearcoat>0&&(h.clearcoat.value=u.clearcoat,h.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(h.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,h.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(h.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===gt&&h.clearcoatNormalScale.value.negate())),u.dispersion>0&&(h.dispersion.value=u.dispersion),u.iridescence>0&&(h.iridescence.value=u.iridescence,h.iridescenceIOR.value=u.iridescenceIOR,h.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(h.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,h.iridescenceMapTransform)),u.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),u.transmission>0&&(h.transmission.value=u.transmission,h.transmissionSamplerMap.value=T.texture,h.transmissionSamplerSize.value.set(T.width,T.height),u.transmissionMap&&(h.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,h.transmissionMapTransform)),h.thickness.value=u.thickness,u.thicknessMap&&(h.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=u.attenuationDistance,h.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(h.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(h.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=u.specularIntensity,h.specularColor.value.copy(u.specularColor),u.specularColorMap&&(h.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,h.specularColorMapTransform)),u.specularIntensityMap&&(h.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,h.specularIntensityMapTransform))}function x(h,u){u.matcap&&(h.matcap.value=u.matcap)}function M(h,u){const T=e.get(u).light;h.referencePosition.value.setFromMatrixPosition(T.matrixWorld),h.nearDistance.value=T.shadow.camera.near,h.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Fp(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,y){const E=y.program;i.uniformBlockBinding(T,E)}function c(T,y){let E=r[T.id];E===void 0&&(x(T),E=d(T),r[T.id]=E,T.addEventListener("dispose",h));const L=y.program;i.updateUBOMapping(T,L);const A=e.render.frame;s[T.id]!==A&&(p(T),s[T.id]=A)}function d(T){const y=f();T.__bindingPointIndex=y;const E=n.createBuffer(),L=T.__size,A=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,L,A),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,E),E}function f(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(T){const y=r[T.id],E=T.uniforms,L=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let A=0,C=E.length;A<C;A++){const U=Array.isArray(E[A])?E[A]:[E[A]];for(let g=0,S=U.length;g<S;g++){const w=U[g];if(m(w,A,g,L)===!0){const X=w.__offset,O=Array.isArray(w.value)?w.value:[w.value];let H=0;for(let Y=0;Y<O.length;Y++){const G=O[Y],te=M(G);typeof G=="number"||typeof G=="boolean"?(w.__data[0]=G,n.bufferSubData(n.UNIFORM_BUFFER,X+H,w.__data)):G.isMatrix3?(w.__data[0]=G.elements[0],w.__data[1]=G.elements[1],w.__data[2]=G.elements[2],w.__data[3]=0,w.__data[4]=G.elements[3],w.__data[5]=G.elements[4],w.__data[6]=G.elements[5],w.__data[7]=0,w.__data[8]=G.elements[6],w.__data[9]=G.elements[7],w.__data[10]=G.elements[8],w.__data[11]=0):(G.toArray(w.__data,H),H+=te.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,X,w.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(T,y,E,L){const A=T.value,C=y+"_"+E;if(L[C]===void 0)return typeof A=="number"||typeof A=="boolean"?L[C]=A:L[C]=A.clone(),!0;{const U=L[C];if(typeof A=="number"||typeof A=="boolean"){if(U!==A)return L[C]=A,!0}else if(U.equals(A)===!1)return U.copy(A),!0}return!1}function x(T){const y=T.uniforms;let E=0;const L=16;for(let C=0,U=y.length;C<U;C++){const g=Array.isArray(y[C])?y[C]:[y[C]];for(let S=0,w=g.length;S<w;S++){const X=g[S],O=Array.isArray(X.value)?X.value:[X.value];for(let H=0,Y=O.length;H<Y;H++){const G=O[H],te=M(G),V=E%L,se=V%te.boundary,ce=V+se;E+=se,ce!==0&&L-ce<te.storage&&(E+=L-ce),X.__data=new Float32Array(te.storage/Float32Array.BYTES_PER_ELEMENT),X.__offset=E,E+=te.storage}}}const A=E%L;return A>0&&(E+=L-A),T.__size=E,T.__cache={},this}function M(T){const y={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(y.boundary=4,y.storage=4):T.isVector2?(y.boundary=8,y.storage=8):T.isVector3||T.isColor?(y.boundary=16,y.storage=12):T.isVector4?(y.boundary=16,y.storage=16):T.isMatrix3?(y.boundary=48,y.storage=48):T.isMatrix4?(y.boundary=64,y.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),y}function h(T){const y=T.target;y.removeEventListener("dispose",h);const E=a.indexOf(y.__bindingPointIndex);a.splice(E,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function u(){for(const T in r)n.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:l,update:c,dispose:u}}class Op{constructor(e={}){const{canvas:t=vc(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=a;const x=new Uint32Array(4),M=new Int32Array(4);let h=null,u=null;const T=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Tn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let L=!1;this._outputColorSpace=ct;let A=0,C=0,U=null,g=-1,S=null;const w=new ut,X=new ut;let O=null;const H=new $e(0);let Y=0,G=t.width,te=t.height,V=1,se=null,ce=null;const ve=new ut(0,0,G,te),ue=new ut(0,0,G,te);let we=!1;const k=new el;let Q=!1,_e=!1;const le=new ft,Ee=new ft,qe=new z,Ce=new ut,rt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let st=!1;function Ye(){return U===null?V:1}let R=i;function yt(v,D){return t.getContext(v,D)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${gr}`),t.addEventListener("webglcontextlost",he,!1),t.addEventListener("webglcontextrestored",J,!1),t.addEventListener("webglcontextcreationerror",K,!1),R===null){const D="webgl2";if(R=yt(D,v),R===null)throw yt(D)?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 Ke,et,xe,Ve,ye,Ne,ht,b,_,N,q,$,W,Se,re,ge,Me,Z,de,Re,Ae,ne,Ie,P;function ae(){Ke=new Yf(R),Ke.init(),ne=new wp(R,Ke),et=new Hf(R,Ke,e,ne),xe=new Rp(R,Ke),et.reverseDepthBuffer&&p&&xe.buffers.depth.setReversed(!0),Ve=new Zf(R),ye=new pp,Ne=new Cp(R,Ke,xe,ye,et,ne,Ve),ht=new Vf(E),b=new qf(E),_=new tu(
vendor: 9,787 bytes, line 3828
3828R),Ie=new Bf(R,_),N=new Kf(R,_,Ve,Ie),q=new Jf(R,N,_,Ve),de=new jf(R,et,Ne),ge=new Gf(ye),$=new hp(E,ht,b,Ke,et,Ie,ge),W=new Np(E,ye),Se=new _p,re=new Ep(Ke),Z=new Of(E,ht,b,xe,q,m,l),Me=new bp(E,q,et),P=new Fp(R,Ve,et,xe),Re=new zf(R,Ke,Ve),Ae=new $f(R,Ke,Ve),Ve.programs=$.programs,E.capabilities=et,E.extensions=Ke,E.properties=ye,E.renderLists=Se,E.shadowMap=Me,E.state=xe,E.info=Ve}ae();const j=new Lp(E,R);this.xr=j,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const v=Ke.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Ke.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(v){v!==void 0&&(V=v,this.setSize(G,te,!1))},this.getSize=function(v){return v.set(G,te)},this.setSize=function(v,D,F=!0){if(j.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}G=v,te=D,t.width=Math.floor(v*V),t.height=Math.floor(D*V),F===!0&&(t.style.width=v+"px",t.style.height=D+"px"),this.setViewport(0,0,v,D)},this.getDrawingBufferSize=function(v){return v.set(G*V,te*V).floor()},this.setDrawingBufferSize=function(v,D,F){G=v,te=D,V=F,t.width=Math.floor(v*F),t.height=Math.floor(D*F),this.setViewport(0,0,v,D)},this.getCurrentViewport=function(v){return v.copy(w)},this.getViewport=function(v){return v.copy(ve)},this.setViewport=function(v,D,F,B){v.isVector4?ve.set(v.x,v.y,v.z,v.w):ve.set(v,D,F,B),xe.viewport(w.copy(ve).multiplyScalar(V).round())},this.getScissor=function(v){return v.copy(ue)},this.setScissor=function(v,D,F,B){v.isVector4?ue.set(v.x,v.y,v.z,v.w):ue.set(v,D,F,B),xe.scissor(X.copy(ue).multiplyScalar(V).round())},this.getScissorTest=function(){return we},this.setScissorTest=function(v){xe.setScissorTest(we=v)},this.setOpaqueSort=function(v){se=v},this.setTransparentSort=function(v){ce=v},this.getClearColor=function(v){return v.copy(Z.getClearColor())},this.setClearColor=function(){Z.setClearColor(...arguments)},this.getClearAlpha=function(){return Z.getClearAlpha()},this.setClearAlpha=function(){Z.setClearAlpha(...arguments)},this.clear=function(v=!0,D=!0,F=!0){let B=0;if(v){let I=!1;if(U!==null){const ee=U.texture.format;I=ee===ca||ee===la||ee===oa}if(I){const ee=U.texture.type,oe=ee===Nt||ee===Wn||ee===Ri||ee===pi||ee===sa||ee===aa,me=Z.getClearColor(),fe=Z.getClearAlpha(),Pe=me.r,De=me.g,Te=me.b;oe?(x[0]=Pe,x[1]=De,x[2]=Te,x[3]=fe,R.clearBufferuiv(R.COLOR,0,x)):(M[0]=Pe,M[1]=De,M[2]=Te,M[3]=fe,R.clearBufferiv(R.COLOR,0,M))}else B|=R.COLOR_BUFFER_BIT}D&&(B|=R.DEPTH_BUFFER_BIT),F&&(B|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.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",he,!1),t.removeEventListener("webglcontextrestored",J,!1),t.removeEventListener("webglcontextcreationerror",K,!1),Z.dispose(),Se.dispose(),re.dispose(),ye.dispose(),ht.dispose(),b.dispose(),q.dispose(),Ie.dispose(),P.dispose(),$.dispose(),j.dispose(),j.removeEventListener("sessionstart",ga),j.removeEventListener("sessionend",va),Cn.stop()};function he(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function J(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const v=Ve.autoReset,D=Me.enabled,F=Me.autoUpdate,B=Me.needsUpdate,I=Me.type;ae(),Ve.autoReset=v,Me.enabled=D,Me.autoUpdate=F,Me.needsUpdate=B,Me.type=I}function K(v){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function pe(v){const D=v.target;D.removeEventListener("dispose",pe),Le(D)}function Le(v){tt(v),ye.remove(v)}function tt(v){const D=ye.get(v).programs;D!==void 0&&(D.forEach(function(F){$.releaseProgram(F)}),v.isShaderMaterial&&$.releaseShaderCache(v))}this.renderBufferDirect=function(v,D,F,B,I,ee){D===null&&(D=rt);const oe=I.isMesh&&I.matrixWorld.determinant()<0,me=ul(v,D,F,B,I);xe.setMaterial(B,oe);let fe=F.index,Pe=1;if(B.wireframe===!0){if(fe=N.getWireframeAttribute(F),fe===void 0)return;Pe=2}const De=F.drawRange,Te=F.attributes.position;let Be=De.start*Pe,je=(De.start+De.count)*Pe;ee!==null&&(Be=Math.max(Be,ee.start*Pe),je=Math.min(je,(ee.start+ee.count)*Pe)),fe!==null?(Be=Math.max(Be,0),je=Math.min(je,fe.count)):Te!=null&&(Be=Math.max(Be,0),je=Math.min(je,Te.count));const ot=je-Be;if(ot<0||ot===1/0)return;Ie.setup(I,B,me,F,fe);let nt,Qe=Re;if(fe!==null&&(nt=_.get(fe),Qe=Ae,Qe.setIndex(nt)),I.isMesh)B.wireframe===!0?(xe.setLineWidth(B.wireframeLinewidth*Ye()),Qe.setMode(R.LINES)):Qe.setMode(R.TRIANGLES);else if(I.isLine){let be=B.linewidth;be===void 0&&(be=1),xe.setLineWidth(be*Ye()),I.isLineSegments?Qe.setMode(R.LINES):I.isLineLoop?Qe.setMode(R.LINE_LOOP):Qe.setMode(R.LINE_STRIP)}else I.isPoints?Qe.setMode(R.POINTS):I.isSprite&&Qe.setMode(R.TRIANGLES);if(I.isBatchedMesh)if(I._multiDrawInstances!==null)ci("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Qe.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances);else if(Ke.get("WEBGL_multi_draw"))Qe.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else{const be=I._multiDrawStarts,at=I._multiDrawCounts,ke=I._multiDrawCount,wt=fe?_.get(fe).bytesPerElement:1,Xn=ye.get(B).currentProgram.getUniforms();for(let Pt=0;Pt<ke;Pt++)Xn.setValue(R,"_gl_DrawID",Pt),Qe.render(be[Pt]/wt,at[Pt])}else if(I.isInstancedMesh)Qe.renderInstances(Be,ot,I.count);else if(F.isInstancedBufferGeometry){const be=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,at=Math.min(F.instanceCount,be);Qe.renderInstances(Be,ot,at)}else Qe.render(Be,ot)};function Ze(v,D,F){v.transparent===!0&&v.side===Lt&&v.forceSinglePass===!1?(v.side=gt,v.needsUpdate=!0,Oi(v,D,F),v.side=mn,v.needsUpdate=!0,Oi(v,D,F),v.side=Lt):Oi(v,D,F)}this.compile=function(v,D,F=null){F===null&&(F=v),u=re.get(F),u.init(D),y.push(u),F.traverseVisible(function(I){I.isLight&&I.layers.test(D.layers)&&(u.pushLight(I),I.castShadow&&u.pushShadow(I))}),v!==F&&v.traverseVisible(function(I){I.isLight&&I.layers.test(D.layers)&&(u.pushLight(I),I.castShadow&&u.pushShadow(I))}),u.setupLights();const B=new Set;return v.traverse(function(I){if(!(I.isMesh||I.isPoints||I.isLine||I.isSprite))return;const ee=I.material;if(ee)if(Array.isArray(ee))for(let oe=0;oe<ee.length;oe++){const me=ee[oe];Ze(me,F,I),B.add(me)}else Ze(ee,F,I),B.add(ee)}),u=y.pop(),B},this.compileAsync=function(v,D,F=null){const B=this.compile(v,D,F);return new Promise(I=>{function ee(){if(B.forEach(function(oe){ye.get(oe).currentProgram.isReady()&&B.delete(oe)}),B.size===0){I(v);return}setTimeout(ee,10)}Ke.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let Xt=null;function sn(v){Xt&&Xt(v)}function ga(){Cn.stop()}function va(){Cn.start()}const Cn=new tl;Cn.setAnimationLoop(sn),typeof self<"u"&&Cn.setContext(self),this.setAnimationLoop=function(v){Xt=v,j.setAnimationLoop(v),v===null?Cn.stop():Cn.start()},j.addEventListener("sessionstart",ga),j.addEventListener("sessionend",va),this.render=function(v,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),j.enabled===!0&&j.isPresenting===!0&&(j.cameraAutoUpdate===!0&&j.updateCamera(D),D=j.getCamera()),v.isScene===!0&&v.onBeforeRender(E,v,D,U),u=re.get(v,y.length),u.init(D),y.push(u),Ee.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),k.setFromProjectionMatrix(Ee),_e=this.localClippingEnabled,Q=ge.init(this.clippingPlanes,_e),h=Se.get(v,T.length),h.init(),T.push(h),j.enabled===!0&&j.isPresenting===!0){const ee=E.xr.getDepthSensingMesh();ee!==null&&Sr(ee,D,-1/0,E.sortObjects)}Sr(v,D,0,E.sortObjects),h.finish(),E.sortObjects===!0&&h.sort(se,ce),st=j.enabled===!1||j.isPresenting===!1||j.hasDepthSensing()===!1,st&&Z.addToRenderList(h,v),this.info.render.frame++,Q===!0&&ge.beginShadows();const F=u.state.shadowsArray;Me.render(F,v,D),Q===!0&&ge.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=h.opaque,I=h.transmissive;if(u.setupLights(),D.isArrayCamera){const ee=D.cameras;if(I.length>0)for(let oe=0,me=ee.length;oe<me;oe++){const fe=ee[oe];Sa(B,I,v,fe)}st&&Z.render(v);for(let oe=0,me=ee.length;oe<me;oe++){const fe=ee[oe];xa(h,v,fe,fe.viewport)}}else I.length>0&&Sa(B,I,v,D),st&&Z.render(v),xa(h,v,D);U!==null&&C===0&&(Ne.updateMultisampleRenderTarget(U),Ne.updateRenderTargetMipmap(U)),v.isScene===!0&&v.onAfterRender(E,v,D),Ie.resetDefaultState(),g=-1,S=null,y.pop(),y.length>0?(u=y[y.length-1],Q===!0&&ge.setGlobalState(E.clippingPlanes,u.state.camera)):u=null,T.pop(),T.length>0?h=T[T.length-1]:h=null};function Sr(v,D,F,B){if(v.visible===!1)return;if(v.layers.test(D.layers)){if(v.isGroup)F=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(D);else if(v.isLight)u.pushLight(v),v.castShadow&&u.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||k.intersectsSprite(v)){B&&Ce.setFromMatrixPosition(v.matrixWorld).applyMatrix4(Ee);const oe=q.update(v),me=v.material;me.visible&&h.push(v,oe,me,F,Ce.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||k.intersectsObject(v))){const oe=q.update(v),me=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),Ce.copy(v.boundingSphere.center)):(oe.boundingSphere===null&&oe.computeBoundingSphere(),Ce.copy(oe.boundingSphere.center)),Ce.applyM
vendor: 11,759 bytes, line 3828
3828atrix4(v.matrixWorld).applyMatrix4(Ee)),Array.isArray(me)){const fe=oe.groups;for(let Pe=0,De=fe.length;Pe<De;Pe++){const Te=fe[Pe],Be=me[Te.materialIndex];Be&&Be.visible&&h.push(v,oe,Be,F,Ce.z,Te)}}else me.visible&&h.push(v,oe,me,F,Ce.z,null)}}const ee=v.children;for(let oe=0,me=ee.length;oe<me;oe++)Sr(ee[oe],D,F,B)}function xa(v,D,F,B){const I=v.opaque,ee=v.transmissive,oe=v.transparent;u.setupLightsView(F),Q===!0&&ge.setGlobalState(E.clippingPlanes,F),B&&xe.viewport(w.copy(B)),I.length>0&&Fi(I,D,F),ee.length>0&&Fi(ee,D,F),oe.length>0&&Fi(oe,D,F),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function Sa(v,D,F,B){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;u.state.transmissionRenderTarget[B.id]===void 0&&(u.state.transmissionRenderTarget[B.id]=new kt(1,1,{generateMipmaps:!0,type:Ke.has("EXT_color_buffer_half_float")||Ke.has("EXT_color_buffer_float")?wi:Nt,minFilter:Gn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:We.workingColorSpace}));const ee=u.state.transmissionRenderTarget[B.id],oe=B.viewport||w;ee.setSize(oe.z*E.transmissionResolutionScale,oe.w*E.transmissionResolutionScale);const me=E.getRenderTarget(),fe=E.getActiveCubeFace(),Pe=E.getActiveMipmapLevel();E.setRenderTarget(ee),E.getClearColor(H),Y=E.getClearAlpha(),Y<1&&E.setClearColor(16777215,.5),E.clear(),st&&Z.render(F);const De=E.toneMapping;E.toneMapping=Tn;const Te=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),u.setupLightsView(B),Q===!0&&ge.setGlobalState(E.clippingPlanes,B),Fi(v,F,B),Ne.updateMultisampleRenderTarget(ee),Ne.updateRenderTargetMipmap(ee),Ke.has("WEBGL_multisampled_render_to_texture")===!1){let Be=!1;for(let je=0,ot=D.length;je<ot;je++){const nt=D[je],Qe=nt.object,be=nt.geometry,at=nt.material,ke=nt.group;if(at.side===Lt&&Qe.layers.test(B.layers)){const wt=at.side;at.side=gt,at.needsUpdate=!0,Ma(Qe,F,B,be,at,ke),at.side=wt,at.needsUpdate=!0,Be=!0}}Be===!0&&(Ne.updateMultisampleRenderTarget(ee),Ne.updateRenderTargetMipmap(ee))}E.setRenderTarget(me,fe,Pe),E.setClearColor(H,Y),Te!==void 0&&(B.viewport=Te),E.toneMapping=De}function Fi(v,D,F){const B=D.isScene===!0?D.overrideMaterial:null;for(let I=0,ee=v.length;I<ee;I++){const oe=v[I],me=oe.object,fe=oe.geometry,Pe=oe.group;let De=oe.material;De.allowOverride===!0&&B!==null&&(De=B),me.layers.test(F.layers)&&Ma(me,D,F,fe,De,Pe)}}function Ma(v,D,F,B,I,ee){v.onBeforeRender(E,D,F,B,I,ee),v.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),I.onBeforeRender(E,D,F,B,v,ee),I.transparent===!0&&I.side===Lt&&I.forceSinglePass===!1?(I.side=gt,I.needsUpdate=!0,E.renderBufferDirect(F,D,B,I,v,ee),I.side=mn,I.needsUpdate=!0,E.renderBufferDirect(F,D,B,I,v,ee),I.side=Lt):E.renderBufferDirect(F,D,B,I,v,ee),v.onAfterRender(E,D,F,B,I,ee)}function Oi(v,D,F){D.isScene!==!0&&(D=rt);const B=ye.get(v),I=u.state.lights,ee=u.state.shadowsArray,oe=I.state.version,me=$.getParameters(v,I.state,ee,D,F),fe=$.getProgramCacheKey(me);let Pe=B.programs;B.environment=v.isMeshStandardMaterial?D.environment:null,B.fog=D.fog,B.envMap=(v.isMeshStandardMaterial?b:ht).get(v.envMap||B.environment),B.envMapRotation=B.environment!==null&&v.envMap===null?D.environmentRotation:v.envMapRotation,Pe===void 0&&(v.addEventListener("dispose",pe),Pe=new Map,B.programs=Pe);let De=Pe.get(fe);if(De!==void 0){if(B.currentProgram===De&&B.lightsStateVersion===oe)return Ta(v,me),De}else me.uniforms=$.getUniforms(v),v.onBeforeCompile(me,E),De=$.acquireProgram(me,fe),Pe.set(fe,De),B.uniforms=me.uniforms;const Te=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Te.clippingPlanes=ge.uniform),Ta(v,me),B.needsLights=fl(v),B.lightsStateVersion=oe,B.needsLights&&(Te.ambientLightColor.value=I.state.ambient,Te.lightProbe.value=I.state.probe,Te.directionalLights.value=I.state.directional,Te.directionalLightShadows.value=I.state.directionalShadow,Te.spotLights.value=I.state.spot,Te.spotLightShadows.value=I.state.spotShadow,Te.rectAreaLights.value=I.state.rectArea,Te.ltc_1.value=I.state.rectAreaLTC1,Te.ltc_2.value=I.state.rectAreaLTC2,Te.pointLights.value=I.state.point,Te.pointLightShadows.value=I.state.pointShadow,Te.hemisphereLights.value=I.state.hemi,Te.directionalShadowMap.value=I.state.directionalShadowMap,Te.directionalShadowMatrix.value=I.state.directionalShadowMatrix,Te.spotShadowMap.value=I.state.spotShadowMap,Te.spotLightMatrix.value=I.state.spotLightMatrix,Te.spotLightMap.value=I.state.spotLightMap,Te.pointShadowMap.value=I.state.pointShadowMap,Te.pointShadowMatrix.value=I.state.pointShadowMatrix),B.currentProgram=De,B.uniformsList=null,De}function Ea(v){if(v.uniformsList===null){const D=v.currentProgram.getUniforms();v.uniformsList=fr.seqWithValue(D.seq,v.uniforms)}return v.uniformsList}function Ta(v,D){const F=ye.get(v);F.outputColorSpace=D.outputColorSpace,F.batching=D.batching,F.batchingColor=D.batchingColor,F.instancing=D.instancing,F.instancingColor=D.instancingColor,F.instancingMorph=D.instancingMorph,F.skinning=D.skinning,F.morphTargets=D.morphTargets,F.morphNormals=D.morphNormals,F.morphColors=D.morphColors,F.morphTargetsCount=D.morphTargetsCount,F.numClippingPlanes=D.numClippingPlanes,F.numIntersection=D.numClipIntersection,F.vertexAlphas=D.vertexAlphas,F.vertexTangents=D.vertexTangents,F.toneMapping=D.toneMapping}function ul(v,D,F,B,I){D.isScene!==!0&&(D=rt),Ne.resetTextureUnits();const ee=D.fog,oe=B.isMeshStandardMaterial?D.environment:null,me=U===null?E.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:yn,fe=(B.isMeshStandardMaterial?b:ht).get(B.envMap||oe),Pe=B.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,De=!!F.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Te=!!F.morphAttributes.position,Be=!!F.morphAttributes.normal,je=!!F.morphAttributes.color;let ot=Tn;B.toneMapped&&(U===null||U.isXRRenderTarget===!0)&&(ot=E.toneMapping);const nt=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Qe=nt!==void 0?nt.length:0,be=ye.get(B),at=u.state.lights;if(Q===!0&&(_e===!0||v!==S)){const bt=v===S&&B.id===g;ge.setState(B,v,bt)}let ke=!1;B.version===be.__version?(be.needsLights&&be.lightsStateVersion!==at.state.version||be.outputColorSpace!==me||I.isBatchedMesh&&be.batching===!1||!I.isBatchedMesh&&be.batching===!0||I.isBatchedMesh&&be.batchingColor===!0&&I.colorTexture===null||I.isBatchedMesh&&be.batchingColor===!1&&I.colorTexture!==null||I.isInstancedMesh&&be.instancing===!1||!I.isInstancedMesh&&be.instancing===!0||I.isSkinnedMesh&&be.skinning===!1||!I.isSkinnedMesh&&be.skinning===!0||I.isInstancedMesh&&be.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&be.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&be.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&be.instancingMorph===!1&&I.morphTexture!==null||be.envMap!==fe||B.fog===!0&&be.fog!==ee||be.numClippingPlanes!==void 0&&(be.numClippingPlanes!==ge.numPlanes||be.numIntersection!==ge.numIntersection)||be.vertexAlphas!==Pe||be.vertexTangents!==De||be.morphTargets!==Te||be.morphNormals!==Be||be.morphColors!==je||be.toneMapping!==ot||be.morphTargetsCount!==Qe)&&(ke=!0):(ke=!0,be.__version=B.version);let wt=be.currentProgram;ke===!0&&(wt=Oi(B,D,I));let Xn=!1,Pt=!1,xi=!1;const it=wt.getUniforms(),Ft=be.uniforms;if(xe.useProgram(wt.program)&&(Xn=!0,Pt=!0,xi=!0),B.id!==g&&(g=B.id,Pt=!0),Xn||S!==v){xe.buffers.depth.getReversed()?(le.copy(v.projectionMatrix),Sc(le),Mc(le),it.setValue(R,"projectionMatrix",le)):it.setValue(R,"projectionMatrix",v.projectionMatrix),it.setValue(R,"viewMatrix",v.matrixWorldInverse);const Rt=it.map.cameraPosition;Rt!==void 0&&Rt.setValue(R,qe.setFromMatrixPosition(v.matrixWorld)),et.logarithmicDepthBuffer&&it.setValue(R,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&it.setValue(R,"isOrthographic",v.isOrthographicCamera===!0),S!==v&&(S=v,Pt=!0,xi=!0)}if(I.isSkinnedMesh){it.setOptional(R,I,"bindMatrix"),it.setOptional(R,I,"bindMatrixInverse");const bt=I.skeleton;bt&&(bt.boneTexture===null&&bt.computeBoneTexture(),it.setValue(R,"boneTexture",bt.boneTexture,Ne))}I.isBatchedMesh&&(it.setOptional(R,I,"batchingTexture"),it.setValue(R,"batchingTexture",I._matricesTexture,Ne),it.setOptional(R,I,"batchingIdTexture"),it.setValue(R,"batchingIdTexture",I._indirectTexture,Ne),it.setOptional(R,I,"batchingColorTexture"),I._colorsTexture!==null&&it.setValue(R,"batchingColorTexture",I._colorsTexture,Ne));const Ot=F.morphAttributes;if((Ot.position!==void 0||Ot.normal!==void 0||Ot.color!==void 0)&&de.update(I,F,wt),(Pt||be.receiveShadow!==I.receiveShadow)&&(be.receiveShadow=I.receiveShadow,it.setValue(R,"receiveShadow",I.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Ft.envMap.value=fe,Ft.flipEnvMap.value=fe.isCubeTexture&&fe.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&D.environment!==null&&(Ft.envMapIntensity.value=D.environmentIntensity),Pt&&(it.setValue(R,"toneMappingExposure",E.toneMappingExposure),be.needsLights&&dl(Ft,xi),ee&&B.fog===!0&&W.refreshFogUniforms(Ft,ee),W.refreshMaterialUniforms(Ft,B,V,te,u.state.transmissionRenderTarget[v.id]),fr.upload(R,Ea(be),Ft,Ne)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(fr.upload(R,Ea(be),Ft,Ne),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&it.setValue(R,"center",I.center),it.setValue(R,"modelViewMatrix",I.modelViewMatrix),it.setValue(R,"normalMatrix",I.normalMatrix),it.setValue(R,"modelMatrix",I.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const bt=B.uniformsGroups;for(let Rt=0,Mr=bt.length;Rt<Mr;Rt++){const wn=bt[Rt];P.update(wn,wt),P.bind(wn,wt)}}return wt}function dl(v,D){v.ambientLightColor.needsUpdate=D,v.lightProbe.needsUpdate=D,v.directionalLights.needsUpdate=D,v.directionalLightShadows.needsUpdate=D,v.pointLights.needsUpdate=D,v.pointLightShadows.needsUpdate=D,v.spotLights.needsUpdate=D,v.spotLightShadows.needsUpdate=D,v.rectAreaLights.needsUpdate=D,v.hemisphereLights.needsUpdate=D}function fl(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(v,D,F){const B=ye.get(v);B.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),ye.get(v.texture).__webglTexture=D,ye.get(v.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:F,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,D){const F=ye.get(v);F.__webglFramebuffer=D,F.__useDefaultFramebuffer=D===void 0};const hl=R.createFramebuffer();this.setRenderTarget=function(v,D=0,F=0){U=v,A=D,C=F;let B=!0,I=null,ee=!1,oe=!1;if(v){const fe=ye.get(v);if(fe.__useDefaultFramebuffer!==void 0)xe.bindFramebuffer(R.FRAMEBUFFER,null),B=!1;else if(fe.__webglFramebuffer===void 0)Ne.setupRenderTarget(v);else if(fe.__hasExternalTextures)Ne.rebindTextures(v,ye.get(v.texture).__webglTexture,ye.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Te=v.depthTexture;if(fe.__boundDepthTexture!==Te){if(Te!==null&&ye.has(Te)&&(v.width!==Te.image.width||v.height!==Te.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Ne.setupDepthRenderbuffer(v)}}const Pe=v.texture;(Pe.isData3DTexture||Pe.isDataArrayTexture||Pe.isCompressedArrayTexture)&&(oe=!0);const De=ye.get(v).__webglFramebuffer;
vendor: 4,430 bytes, line 3828
3828v.isWebGLCubeRenderTarget?(Array.isArray(De[D])?I=De[D][F]:I=De[D],ee=!0):v.samples>0&&Ne.useMultisampledRTT(v)===!1?I=ye.get(v).__webglMultisampledFramebuffer:Array.isArray(De)?I=De[F]:I=De,w.copy(v.viewport),X.copy(v.scissor),O=v.scissorTest}else w.copy(ve).multiplyScalar(V).floor(),X.copy(ue).multiplyScalar(V).floor(),O=we;if(F!==0&&(I=hl),xe.bindFramebuffer(R.FRAMEBUFFER,I)&&B&&xe.drawBuffers(v,I),xe.viewport(w),xe.scissor(X),xe.setScissorTest(O),ee){const fe=ye.get(v.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+D,fe.__webglTexture,F)}else if(oe){const fe=ye.get(v.texture),Pe=D;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,fe.__webglTexture,F,Pe)}else if(v!==null&&F!==0){const fe=ye.get(v.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,fe.__webglTexture,F)}g=-1},this.readRenderTargetPixels=function(v,D,F,B,I,ee,oe,me=0){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let fe=ye.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&oe!==void 0&&(fe=fe[oe]),fe){xe.bindFramebuffer(R.FRAMEBUFFER,fe);try{const Pe=v.textures[me],De=Pe.format,Te=Pe.type;if(!et.textureFormatReadable(De)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!et.textureTypeReadable(Te)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=v.width-B&&F>=0&&F<=v.height-I&&(v.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+me),R.readPixels(D,F,B,I,ne.convert(De),ne.convert(Te),ee))}finally{const Pe=U!==null?ye.get(U).__webglFramebuffer:null;xe.bindFramebuffer(R.FRAMEBUFFER,Pe)}}},this.readRenderTargetPixelsAsync=async function(v,D,F,B,I,ee,oe,me=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let fe=ye.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&oe!==void 0&&(fe=fe[oe]),fe)if(D>=0&&D<=v.width-B&&F>=0&&F<=v.height-I){xe.bindFramebuffer(R.FRAMEBUFFER,fe);const Pe=v.textures[me],De=Pe.format,Te=Pe.type;if(!et.textureFormatReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!et.textureTypeReadable(Te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Be=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Be),R.bufferData(R.PIXEL_PACK_BUFFER,ee.byteLength,R.STREAM_READ),v.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+me),R.readPixels(D,F,B,I,ne.convert(De),ne.convert(Te),0);const je=U!==null?ye.get(U).__webglFramebuffer:null;xe.bindFramebuffer(R.FRAMEBUFFER,je);const ot=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await xc(R,ot,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Be),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ee),R.deleteBuffer(Be),R.deleteSync(ot),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,D=null,F=0){const B=Math.pow(2,-F),I=Math.floor(v.image.width*B),ee=Math.floor(v.image.height*B),oe=D!==null?D.x:0,me=D!==null?D.y:0;Ne.setTexture2D(v,0),R.copyTexSubImage2D(R.TEXTURE_2D,F,0,0,oe,me,I,ee),xe.unbindTexture()};const pl=R.createFramebuffer(),ml=R.createFramebuffer();this.copyTextureToTexture=function(v,D,F=null,B=null,I=0,ee=null){ee===null&&(I!==0?(ci("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ee=I,I=0):ee=0);let oe,me,fe,Pe,De,Te,Be,je,ot;const nt=v.isCompressedTexture?v.mipmaps[ee]:v.image;if(F!==null)oe=F.max.x-F.min.x,me=F.max.y-F.min.y,fe=F.isBox3?F.max.z-F.min.z:1,Pe=F.min.x,De=F.min.y,Te=F.isBox3?F.min.z:0;else{const Ot=Math.pow(2,-I);oe=Math.floor(nt.width*Ot),me=Math.floor(nt.height*Ot),v.isDataArrayTexture?fe=nt.depth:v.isData3DTexture?fe=Math.floor(nt.depth*Ot):fe=1,Pe=0,De=0,Te=0}B!==null?(Be=B.x,je=B.y,ot=B.z):(Be=0,je=0,ot=0);const Qe=ne.convert(D.format),be=ne.convert(D.type);let at;D.isData3DTexture?(Ne.setTexture3D(D,0),at=R.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(Ne.setTexture2DArray(D,0
vendor: 5,191 bytes, lines 3828-3833
3828),at=R.TEXTURE_2D_ARRAY):(Ne.setTexture2D(D,0),at=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,D.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,D.unpackAlignment);const ke=R.getParameter(R.UNPACK_ROW_LENGTH),wt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Xn=R.getParameter(R.UNPACK_SKIP_PIXELS),Pt=R.getParameter(R.UNPACK_SKIP_ROWS),xi=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,nt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,nt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Pe),R.pixelStorei(R.UNPACK_SKIP_ROWS,De),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Te);const it=v.isDataArrayTexture||v.isData3DTexture,Ft=D.isDataArrayTexture||D.isData3DTexture;if(v.isDepthTexture){const Ot=ye.get(v),bt=ye.get(D),Rt=ye.get(Ot.__renderTarget),Mr=ye.get(bt.__renderTarget);xe.bindFramebuffer(R.READ_FRAMEBUFFER,Rt.__webglFramebuffer),xe.bindFramebuffer(R.DRAW_FRAMEBUFFER,Mr.__webglFramebuffer);for(let wn=0;wn<fe;wn++)it&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,ye.get(v).__webglTexture,I,Te+wn),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,ye.get(D).__webglTexture,ee,ot+wn)),R.blitFramebuffer(Pe,De,oe,me,Be,je,oe,me,R.DEPTH_BUFFER_BIT,R.NEAREST);xe.bindFramebuffer(R.READ_FRAMEBUFFER,null),xe.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(I!==0||v.isRenderTargetTexture||ye.has(v)){const Ot=ye.get(v),bt=ye.get(D);xe.bindFramebuffer(R.READ_FRAMEBUFFER,pl),xe.bindFramebuffer(R.DRAW_FRAMEBUFFER,ml);for(let Rt=0;Rt<fe;Rt++)it?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Ot.__webglTexture,I,Te+Rt):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Ot.__webglTexture,I),Ft?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,bt.__webglTexture,ee,ot+Rt):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,bt.__webglTexture,ee),I!==0?R.blitFramebuffer(Pe,De,oe,me,Be,je,oe,me,R.COLOR_BUFFER_BIT,R.NEAREST):Ft?R.copyTexSubImage3D(at,ee,Be,je,ot+Rt,Pe,De,oe,me):R.copyTexSubImage2D(at,ee,Be,je,Pe,De,oe,me);xe.bindFramebuffer(R.READ_FRAMEBUFFER,null),xe.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else Ft?v.isDataTexture||v.isData3DTexture?R.texSubImage3D(at,ee,Be,je,ot,oe,me,fe,Qe,be,nt.data):D.isCompressedArrayTexture?R.compressedTexSubImage3D(at,ee,Be,je,ot,oe,me,fe,Qe,nt.data):R.texSubImage3D(at,ee,Be,je,ot,oe,me,fe,Qe,be,nt):v.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,ee,Be,je,oe,me,Qe,be,nt.data):v.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,ee,Be,je,nt.width,nt.height,Qe,nt.data):R.texSubImage2D(R.TEXTURE_2D,ee,Be,je,oe,me,Qe,be,nt);R.pixelStorei(R.UNPACK_ROW_LENGTH,ke),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,wt),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Xn),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pt),R.pixelStorei(R.UNPACK_SKIP_IMAGES,xi),ee===0&&D.generateMipmaps&&R.generateMipmap(at),xe.unbindTexture()},this.copyTextureToTexture3D=function(v,D,F=null,B=null,I=0){return ci('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(v,D,F,B,I)},this.initRenderTarget=function(v){ye.get(v).__webglFramebuffer===void 0&&Ne.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?Ne.setTextureCube(v,0):v.isData3DTexture?Ne.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?Ne.setTexture2DArray(v,0):Ne.setTexture2D(v,0),xe.unbindTexture()},this.resetState=function(){A=0,C=0,U=null,xe.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return hn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=We._getDrawingBufferColorSpace(e),t.unpackColorSpace=We._getUnpackColorSpace()}}/**
3829 * postprocessing v6.39.1 build Fri Apr 17 2026
3830 * https://github.com/pmndrs/postprocessing
3831 * Copyright 2015-2026 Raoul van Rüschen
3832 * @license Zlib
3833 */var Bp=(()=>{const n=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new An;return t.setAttribute("position",new Vt(n,3)),t.setAttribute("uv",new Vt(e,2)),t})(),Rn=class ea{static get fullscreenGeometry(){return Bp}constructor(e="Pass",t=new Js,i=new ha){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthBlit=!1,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;t!==null&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new jt(ea.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new Js),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}
vendor: 7,301 bytes, lines 3833-3877
3833setDepthTexture(e,t=Pi){}render(e,t,i,r,s){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof kt||t instanceof gi||t instanceof St||t instanceof ea)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},zp=class extends Rn{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(n,e,t,i,r){const s=n.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},Hp=`#ifdef COLOR_WRITE
3834#include <common>
3835#include <dithering_pars_fragment>
3836#ifdef FRAMEBUFFER_PRECISION_HIGH
3837uniform mediump sampler2D inputBuffer;
3838#else
3839uniform lowp sampler2D inputBuffer;
3840#endif
3841#endif
3842#ifdef DEPTH_WRITE
3843#include <packing>
3844#ifdef GL_FRAGMENT_PRECISION_HIGH
3845uniform highp sampler2D depthBuffer;
3846#else
3847uniform mediump sampler2D depthBuffer;
3848#endif
3849float readDepth(const in vec2 uv){
3850#if DEPTH_PACKING == 3201
3851return unpackRGBAToDepth(texture2D(depthBuffer,uv));
3852#else
3853return texture2D(depthBuffer,uv).r;
3854#endif
3855}
3856#endif
3857#ifdef USE_WEIGHTS
3858uniform vec4 channelWeights;
3859#endif
3860uniform float opacity;varying vec2 vUv;void main(){
3861#ifdef COLOR_WRITE
3862vec4 texel=texture2D(inputBuffer,vUv);
3863#ifdef USE_WEIGHTS
3864texel*=channelWeights;
3865#endif
3866gl_FragColor=opacity*texel;
3867#ifdef COLOR_SPACE_CONVERSION
3868#include <colorspace_fragment>
3869#endif
3870#include <dithering_fragment>
3871#else
3872gl_FragColor=vec4(0.0);
3873#endif
3874#ifdef DEPTH_WRITE
3875gl_FragDepth=readDepth(vUv);
3876#endif
3877}`,Gp="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Vp=class extends Wt{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new lt(null),depthBuffer:new lt(null),channelWeights:new lt(null),opacity:new lt(1)},blending:rn,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Hp,vertexShader:Gp}),this.depthFunc=hr}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(n){const e=n!==null;this.colorWrite!==e&&(e?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=e,this.needsUpdate=!0),this.uniforms.inputBuffer.value=n}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(n){const e=n!==null;this.depthWrite!==e&&(e?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=e,this.depthWrite=e,this.needsUpdate=!0),this.uniforms.depthBuffer.value=n}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return this.defines.COLOR_SPACE_CONVERSION!==void 0}set colorSpaceConversion(n){this.colorSpaceConversion!==n&&(n?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(n){n!==null?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=n):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(n){this.uniforms.inputBuffer.value=n}getOpacity(n){return this.uniforms.opacity.value}setOpacity(n){this.uniforms.opacity.value=n}},kp=class extends Rn{constructor(n,e=!0){super("CopyPass"),this.fullscreenMaterial=new Vp,this.needsSwap=!1,this.renderTarget=n,n===void 0&&(this.renderTarget=new kt(1,1,{minFilter:Tt,magFilter:Tt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(n){this.autoResize=n}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(n){this.autoResize=n}render(n,e,t,i,r){this.fullscreenMaterial.inputBuffer=e.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){this.autoResize&&this.renderTarget.setSize(n,e)}initialize(n,e,t){t!==void 0&&(this.renderTarget.texture.type=t,t!==Nt?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":n!==null&&n.outputColorSpace===ct&&(this.renderTarget.texture.colorSpace=ct))}},Eo=new $e,al=class extends Rn{constructor(n=!0,e=!0,t=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=n,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(n,e,t){this.color=n,this.depth=e,this.stencil=t}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(n){this.overrideClearColor=n}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(n){this.overrideClearAlpha=n}render(n,e,t,i,r){const s=this.overrideClearColor,a=this.overrideClearAlpha,o=n.getClearAlpha(),l=s!==null,c=a>=0;l?(n.getClearColor(Eo),n.setClearColor(s,c?a:o)):c&&n.setClearAlpha(a),n.setRenderTarget(this.renderToScreen?null:e),n.clear(this.color,this.depth,this.stencil),l?n.setClearColor(Eo,o):c&&n.setClearAlpha(o)}},Wp=class extends Rn{constructor(n,e){super("MaskPass",n,e),this.needsSwap=!1,this.clearPass=new al(!1,!1,!0),this.inverse=!1}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get inverted(){return this.inverse}set inverted(n){this.inverse=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(n){this.inverted=n}render(n,e,t,i,r){const s=n.getContext(),a=n.state.buffers,o=this.scene,l=this.camera,c=this.clearPass,d=this.inverted?0:1,f=1-d;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),a.stencil.setFunc(s.ALWAYS,d,4294967295),a.stencil.setClear(f),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(n,null):(c.render(n,e),c.render(n,t))),this.renderToScreen?(n.setRenderTarget(null),n.render(o,l)):(n.setRenderTarget(e),n.render(o,l),n.setRenderTarget(t),n.render(o,l)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(s.EQUAL,1,4294967295),a.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),a.stencil.setLocked(!0)}},ts=1/1e3,Xp=1e3,qp=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(n){typeof document<"u"&&document.hidden!==void 0&&(n?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=n)}get delta(){return this._delta*ts}get fixedDelta(){return this._fixedDelta*ts}set fixedDelta(n){this._fixedDelta=n*Xp}get elapsed(){return this._elapsed*ts}update(n){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(n!==void 0?n:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(n){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},To=class{constructor(n=null,{depthBuffer:e=!0,stencilBuffer:t=!1,multisampling:i=0,frameBufferType:r}={}
3877){this.renderer=null,this.inputBuffer=this.createBuffer(e,t,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new kp,this.depthTexture=null,this.depthRenderTarget=null,this.passes=[],this.timer=new qp,this.autoRenderToScreen=!0,this.setRenderer(n)}get multisampling(){return this.inputBuffer.samples}set multisampling(n){const e=this.inputBuffer,t=this.multisampling;t>0&&n>0?(this.inputBuffer.samples=n,this.outputBuffer.samples=n,this.inputBuffer.dispose(),this.outputBuffer.dispose()):t!==n&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,n),this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(n){if(this.renderer=n,n!==null){const e=n.getSize(new Oe),t=n.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===Nt&&n.outputColorSpace===ct&&(this.inputBuffer.texture.colorSpace=ct,this.outputBuffer.texture.colorSpace=ct,this.inputBuffer.dispose(),this.outputBuffer.dispose()),n.autoClear=!1,this.setSize(e.width,e.height);for(const r of this.passes)r.initialize(n,t,i)}}replaceRenderer(n,e=!0){const t=this.renderer,i=t.domElement.parentNode;return this.setRenderer(n),e&&i!==null&&(i.removeChild(t.domElement),i.appendChild(n.domElement)),t}createDepthTexture(){const n=this.inputBuffer,e=new fa;this.depthTexture=e,n.stencilBuffer?(e.format=mi,e.type=pi):e.type=nn;const t=e.clone();return t.name="EffectComposer.StableDepth",this.depthRenderTarget=new kt(n.width,n.height,{depthBuffer:!0,stencilBuffer:n.stencilBuffer,depthTexture:t}),t}blitDepthBuffer(n){const e=this.renderer,t=this.depthRenderTarget,i=e.properties,r=e.getContext();e.setRenderTarget(t);const s=i.get(n).__webglFramebuffer,a=i.get(t).__webglFramebuffer,o=n.stencilBuffer?r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT:r.DEPTH_BUFFER_BIT;r.bindFramebuffer(r.READ_FRAMEBUFFER,s),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,a),r.blitFramebuffer(0,0,n.width,n.height,0,0,t.width,t.height,o,r.NEAREST),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),e.setRenderTarget(null)}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.depthRenderTarget.dispose(),this.depthRenderTarget=null,this.inputBuffer.depthTexture=null,this.outputBuffer.depthTexture=null;for(const n of this.passes)n.setDepthTexture(null)}}createBuffer(n,e,t,i){const r=this.renderer,s=r===null?new Oe:r.getDrawingBufferSize(new Oe),a={minFilter:Tt,magFilter:Tt,stencilBuffer:e,depthBuffer:n,type:t},o=new kt(s.width,s.height,a);return i>0&&(o.samples=i),t===Nt&&r!==null&&r.outputColorSpace===ct&&(o.texture.colorSpace=ct),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(n){for(const e of this.passes)e.mainScene=n}setMainCamera(n){for(const e of this.passes)e.mainCamera=n}addPass(n,e){const t=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new Oe),s=i.getContext().getContextAttributes().alpha,a=this.inputBuffer.texture.type;if(n.renderer=i,n.setSize(r.width,r.height),n.initialize(i,s,a),this.autoRenderToScreen&&(t.length>0&&(t[t.length-1].renderToScreen=!1),n.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?t.splice(e,0,n):t.push(n),this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!0),n.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const o=this.createDepthTexture();for(n of t)n.setDepthTexture(o)}else{const o=this.depthRenderTarget.depthTexture;n.setDepthTexture(o)}}removePass(n){const e=this.passes,t=e.indexOf(n);if(t!==-1&&e.splice(t,1).length>0){if(this.depthTexture!==null){const s=(o,l)=>o||l.needsDepthTexture;if(!e.reduce(s,!1)){const o=this.depthRenderTarget.depthTexture;n.getDepthTexture()===o&&n.setDepthTexture(null),this.deleteDepthTexture()}}this.autoRenderToScreen&&t===e.length&&(n.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){const n=this.passes;this.deleteDepthTexture(),n.length>0&&(this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!1),this.passes=[])}render(n){const e=this.renderer,t=this.copyPass;let i=this.inputBuffer,r=this.outputBuffer,s,a=!1;
3877n===void 0&&(this.timer.update(),n=this.timer.getDelta());for(const o of this.passes)if(o.enabled){if(i.depthTexture=this.depthTexture,r.depthTexture=null,o.render(e,i,r,n,a),o.needsDepthBlit&&this.depthRenderTarget!==null&&this.blitDepthBuffer(i),o.needsSwap){if(a){t.renderToScreen=o.renderToScreen;const l=e.getContext(),c=e.state.buffers.stencil;c.setFunc(l.NOTEQUAL,1,4294967295),t.render(e,i,r,n,a),c.setFunc(l.EQUAL,1,4294967295)}s=i,i=r,r=s}o instanceof Wp?a=!0:o instanceof zp&&(a=!1)}}setSize(n,e,t){const i=this.renderer,r=i.getSize(new Oe);(n===void 0||e===void 0)&&(n=r.width,e=r.height),(r.width!==n||r.height!==e)&&i.setSize(n,e,t);const s=i.getDrawingBufferSize(new Oe);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height),this.depthRenderTarget!==null&&this.depthRenderTarget.setSize(s.width,s.height);for(const a of this.passes)a.setSize(s.width,s.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const n of this.passes)n.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),Rn.fullscreenGeometry.dispose()}},kn={NONE:0,DEPTH:1,CONVOLUTION:2},Xe={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Yp=class{constructor(){this.shaderParts=new Map([[Xe.FRAGMENT_HEAD,null],[Xe.FRAGMENT_MAIN_UV,null],[Xe.FRAGMENT_MAIN_IMAGE,null],[Xe.VERTEX_HEAD,null],[Xe.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=kn.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=yn}},ns=!1,yo=class{constructor(n=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(n),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Lt:t=this.materialsFlatShadedDoubleSide;break;case gt:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case Lt:t=this.materialsDoubleSide;break;case gt:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(n){if(!(n instanceof Wt))return n.clone();const e=n.uniforms,t=new Map;for(const r in e){const s=e[r].value;s.isRenderTargetTexture&&(e[r].value=null,t.set(r,s))}const i=n.clone();for(const r of t)e[r[0]].value=r[1],i.uniforms[r[0]].value=r[1];return i}setMaterial(n){if(this.disposeMaterials(),this.material=n,n!==null){const e=this.materials=[this.cloneMaterial(n),this.cloneMaterial(n),this.cloneMaterial(n)];for(const t of e)t.uniforms=Object.assign({},n.uniforms),t.side=mn;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=gt,i}),this.materialsDoubleSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=Lt,i}),this.materialsFlatShaded=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=gt,i}),this.materialsFlatShadedDoubleSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=Lt,i})}}render(n,e,t){const i=n.shadowMap.enabled;if(n.shadowMap.enabled=!1,ns){const r=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),n.render(e,t);for(const s of r)s[0].material=s[1];this.meshCount!==r.size&&r.clear()}else{const r=e.overrideMaterial;e.overrideMaterial=this.material,n.render(e,t),e.overrideMaterial=r}n.shadowMap.enabled=i}disposeMaterials(){if(this.material!==null){const n=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);
3877for(const e of n)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return ns}static set workaroundEnabled(n){ns=n}},ze={ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},Kp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",$p="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}",Zp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",jp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Jp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Qp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",em="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",tm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",nm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",im="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",rm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",sm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",am="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",om="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",lm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",cm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",um="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",dm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",fm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",hm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",pm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",mm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",_m="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}",gm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",vm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",xm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Sm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Mm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Em="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Tm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}",ym="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",bm="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Am=new Map([[ze.ADD,Kp],[ze.ALPHA,$p],[ze.AVERAGE,Zp],[ze.COLOR,jp],[ze.COLOR_BURN,Jp],[ze.COLOR_DODGE,Qp],[ze.DARKEN,em],[ze.DIFFERENCE,tm],[ze.DIVIDE,nm],[ze.DST,null],[ze.EXCLUSION,im],[ze.HARD_LIGHT,rm],[ze.HARD_MIX,sm],[ze.HUE,am],[ze.INVERT,om],[ze.INVERT_RGB,lm],[ze.LIGHTEN,
vendor: 10,753 bytes, lines 3877-3919
3877cm],[ze.LINEAR_BURN,um],[ze.LINEAR_DODGE,dm],[ze.LINEAR_LIGHT,fm],[ze.LUMINOSITY,hm],[ze.MULTIPLY,pm],[ze.NEGATION,mm],[ze.NORMAL,_m],[ze.OVERLAY,gm],[ze.PIN_LIGHT,vm],[ze.REFLECT,xm],[ze.SATURATION,Sm],[ze.SCREEN,Mm],[ze.SOFT_LIGHT,Em],[ze.SRC,Tm],[ze.SUBTRACT,ym],[ze.VIVID_LIGHT,bm]]),Rm=class extends bn{constructor(n,e=1){super(),this._blendFunction=n,this.opacity=new lt(e)}getOpacity(){return this.opacity.value}setOpacity(n){this.opacity.value=n}get blendFunction(){return this._blendFunction}set blendFunction(n){this._blendFunction=n,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(n){this.blendFunction=n}getShaderCode(){return Am.get(this.blendFunction)}},bo=class extends bn{constructor(n,e,{attributes:t=kn.NONE,blendFunction:i=ze.NORMAL,defines:r=new Map,uniforms:s=new Map,extensions:a=null,vertexShader:o=null}={}){super(),this.name=n,this.renderer=null,this.attributes=t,this.fragmentShader=e,this.vertexShader=o,this.defines=r,this.uniforms=s,this.extensions=a,this.blendMode=new Rm(i),this.blendMode.addEventListener("change",l=>this.setChanged()),this._inputColorSpace=yn,this._outputColorSpace=tn}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(n){this._inputColorSpace=n,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(n){this._outputColorSpace=n,this.setChanged()}set mainScene(n){}set mainCamera(n){}getName(){return this.name}setRenderer(n){this.renderer=n}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(n){this.attributes=n,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(n){this.fragmentShader=n,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(n){this.vertexShader=n,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(n,e=Pi){}update(n,e,t){}setSize(n,e){}initialize(n,e,t){}dispose(){for(const n of Object.keys(this)){const e=this[n];(e instanceof kt||e instanceof gi||e instanceof St||e instanceof Rn)&&this[n].dispose()}}},Ao=class extends Rn{constructor(n,e,t=null){super("RenderPass",n,e),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new al,this.overrideMaterialManager=t===null?null:new yo(t),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get renderToScreen(){return super.renderToScreen}set renderToScreen(n){super.renderToScreen=n,this.clearPass.renderToScreen=n}get overrideMaterial(){const n=this.overrideMaterialManager;return n!==null?n.material:null}set overrideMaterial(n){const e=this.overrideMaterialManager;n!==null?e!==null?e.setMaterial(n):this.overrideMaterialManager=new yo(n):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(n){this.overrideMaterial=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getSelection(){return this.selection}setSelection(n){this.selection=n}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(n){this.ignoreBackground=n}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(n){this.skipShadowMapUpdate=n}getClearPass(){return this.clearPass}render(n,e,t,i,r){const s=this.scene,a=this.camera,o=this.selection,l=a.layers.mask,c=s.background,d=n.shadowMap.autoUpdate,f=this.renderToScreen?null:e;o!==null&&a.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(n.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(n,e),n.setRenderTarget(f),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(n,s,a):n.render(s,a),a.layers.mask=l,s.background=c,n.shadowMap.autoUpdate=d}},Cm=`#include <common>
3878#include <packing>
3879#include <dithering_pars_fragment>
3880#define packFloatToRGBA(v) packDepthToRGBA(v)
3881#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
3882#ifdef FRAMEBUFFER_PRECISION_HIGH
3883uniform mediump sampler2D inputBuffer;
3884#else
3885uniform lowp sampler2D inputBuffer;
3886#endif
3887#if DEPTH_PACKING == 3201
3888uniform lowp sampler2D depthBuffer;
3889#elif defined(GL_FRAGMENT_PRECISION_HIGH)
3890uniform highp sampler2D depthBuffer;
3891#else
3892uniform mediump sampler2D depthBuffer;
3893#endif
3894uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){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);}float readDepth(const in vec2 uv){
3895#if DEPTH_PACKING == 3201
3896float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));
3897#else
3898float depth=texture2D(depthBuffer,uv).r;
3899#endif
3900#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)
3901float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;
3902#elif defined(USE_REVERSED_DEPTH_BUFFER)
3903depth=1.0-depth;
3904#endif
3905return depth;}float getViewZ(const in float depth){
3906#ifdef PERSPECTIVE_CAMERA
3907return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
3908#else
3909return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
3910#endif
3911}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;
3912#ifdef ENCODE_OUTPUT
3913#include <colorspace_fragment>
3914#endif
3915#include <dithering_fragment>
3916}`,wm="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",Pm=class extends Wt{constructor(n,e,t,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:gr.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new lt(null),depthBuffer:new lt(null),resolution:new lt(new Oe),texelSize:new lt(new Oe),cameraNear:new lt(.3),cameraFar:new lt(1e3),aspect:new lt(1),time:new lt(0)},blending:rn,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),n&&this.setShaderParts(n),e&&this.setDefines(e),t&&this.setUniforms(t),this.copyCameraSettings(i)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(n){this.uniforms.depthBuffer.value=n}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,e=Pi){this.depthBuffer=n,this.depthPacking=e}setShaderData(n){this.setShaderParts(n.shaderParts),this.setDefines(n.defines),this.setUniforms(n.uniforms),this.setExtensions(n.extensions)}setShaderParts(n){return this.fragmentShader=Cm.replace(Xe.FRAGMENT_HEAD,n.get(Xe.FRAGMENT_HEAD)||"").replace(Xe.FRAGMENT_MAIN_UV,n.get(Xe.FRAGMENT_MAIN_UV)||"").replace(Xe.FRAGMENT_MAIN_IMAGE,n.get(Xe.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=wm.replace(Xe.VERTEX_HEAD,n.get(Xe.VERTEX_HEAD)||"").replace(Xe.VERTEX_MAIN_SUPPORT,n.get(Xe.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(n){for(const e of n.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(n){for(const e of n.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(n){this.extensions={};for(const e of n)this.extensions[e]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(n){this.encodeOutput!==n&&(n?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(n){return this.encodeOutput}setOutputEncodingEnabled(n){this.encodeOutput=n}get time(){return this.uniforms.time.value}set time(n){this.uniforms.time.value=n}setDeltaTime(n){this.uniforms.time.value+=n}adoptCameraSettings(n){this.copyCameraSettings(n)}copyCameraSettings(n){n&&(this.uniforms.cameraNear.value=n.near,this.uniforms.cameraFar.value=n.far,n instanceof Ht?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(n,e){const t=this.uniforms;t.resolution.value.set(n,e),t.texelSize.value.set(1/n,1/e),t.aspect.value=n/e}static get Section(){return Xe}};function Ro(n,e,t){for(const i of e){const r="$1"+n+i.charAt(0).toUpperCase()+i.slice(1),s=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const a of t.entries())a[1]!==null&&t.set(a[0],a[1].replace(s,r))}}function Dm(n,e,t){let i=e.getFragmentShader(),r=e.getVertexShader();const s=i!==void 0&&/mainImage/.test(i),a=i!==void 0&&/mainUv/.test(i);if(t.attributes|=e.getAttributes(),i===void 0)throw new Error(`Missing fragment shader (${e.name})`);if(a&&(t.attributes&kn.CONVOLUTION)!==0)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!s&&!a)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const o=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=t.shaderParts;let c=l.get(Xe.FRAGMENT_HEAD)||"",d=l.get(Xe.FRAGMENT_MAIN_UV)||"",f=l.get(Xe.FRAGMENT_MAIN_IMAGE)||"",p=l.get(Xe.VERTEX_HEAD)||"",m=l.get(Xe.VERTEX_MAIN_SUPPORT)||"";const x=new Set,M=new Set;if(a&&(d+=`	${n}MainUv(UV);
3917`,t.uvTransformation=!0),r!==null&&/mainSupport/.test(r)){const T=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);m+=`	${n}MainSupport(`,m+=T?`vUv);
3918`:`);
3919`;for(const y of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const E of y[1].split(/\s*,\s*/))t.varyings.add(E),x.add(E),M.add(E);for(const y of r.matchAll(o))M.add(y[1])}for(const T of i.matchAll(o))M.add(T[1]);for(const T of e.defines.keys())M.add(T.replace(/\([\w\s,]*\)/g,""));for(const T of e.uniforms.keys())M.add(T);M.delete("while"),M.delete("for"),M.delete("if"),e.uniforms.forEac
3919h((T,y)=>t.uniforms.set(n+y.charAt(0).toUpperCase()+y.slice(1),T)),e.defines.forEach((T,y)=>t.defines.set(n+y.charAt(0).toUpperCase()+y.slice(1),T));const h=new Map([["fragment",i],["vertex",r]]);Ro(n,M,t.defines),Ro(n,M,h),i=h.get("fragment"),r=h.get("vertex");const u=e.blendMode;if(t.blendModes.set(u.blendFunction,u),s){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(f+=e.inputColorSpace===ct?`color0 = sRGBTransferOETF(color0);
3920	`:`color0 = sRGBToLinear(color0);
3921	`),e.outputColorSpace!==tn?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);const T=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;f+=`${n}MainImage(color0, UV, `,(t.attributes&kn.DEPTH)!==0&&T.test(i)&&(f+="depth, ",t.readDepth=!0),f+=`color1);
3922	`;const y=n+"BlendOpacity";t.uniforms.set(y,u.opacity),f+=`color0 = blend${u.blendFunction}(color0, color1, ${y});
3923
3924	`,c+=`uniform float ${y};
3925
3926`}if(c+=i+`
3927`,r!==null&&(p+=r+`
3928`),l.set(Xe.FRAGMENT_HEAD,c),l.set(Xe.FRAGMENT_MAIN_UV,d),l.set(Xe.FRAGMENT_MAIN_IMAGE,f),l.set(Xe.VERTEX_HEAD,p),l.set(Xe.VERTEX_MAIN_SUPPORT,m),e.extensions!==null)for(const T of e.extensions)t.extensions.add(T)}}var is=class extends Rn{constructor(n,...e){super("EffectPass"),this.fullscreenMaterial=new Pm(null,null,null,n),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(n){for(const e of this.effects)e.mainScene=n}set mainCamera(n){this.fullscreenMaterial.copyCameraSettings(n);for(const e of this.effects)e.mainCamera=n}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(n){this.fullscreenMaterial.encodeOutput=n}get dithering(){return this.fullscreenMaterial.dithering}set dithering(n){const e=this.fullscreenMaterial;e.dithering=n,e.needsUpdate=!0}setEffects(n){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=n.sort((e,t)=>t.attributes-e.attributes);for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const n=new Yp;let e=0;for(const a of this.effects)if(a.blendMode.blendFunction===ze.DST)n.attributes|=a.getAttributes()&kn.DEPTH;else{if((n.attributes&a.getAttributes()&kn.CONVOLUTION)!==0)throw new Error(`Convolution effects cannot be merged (${a.name})`);Dm("e"+e++,a,n)}let t=n.shaderParts.get(Xe.FRAGMENT_HEAD),i=n.shaderParts.get(Xe.FRAGMENT_MAIN_IMAGE),r=n.shaderParts.get(Xe.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const a of n.blendModes.values())t+=a.getShaderCode().replace(s,`blend${a.blendFunction}`)+`
3929`;(n.attributes&kn.DEPTH)!==0?(n.readDepth&&(i=`float depth = readDepth(UV);
3930
3931	`+i),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,n.colorSpace
vendor: 4,657 bytes, lines 3931-4045
3931===ct&&(i+=`color0 = sRGBToLinear(color0);
3932	`),n.uvTransformation?(r=`vec2 transformedUv = vUv;
3933`+r,n.defines.set("UV","transformedUv")):n.defines.set("UV","vUv"),n.shaderParts.set(Xe.FRAGMENT_HEAD,t),n.shaderParts.set(Xe.FRAGMENT_MAIN_IMAGE,i),n.shaderParts.set(Xe.FRAGMENT_MAIN_UV,r);for(const[a,o]of n.shaderParts)o!==null&&n.shaderParts.set(a,o.trim().replace(/^#/,`
3934#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(n)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(n,e=Pi){this.fullscreenMaterial.depthBuffer=n,this.fullscreenMaterial.depthPacking=e;for(const t of this.effects)t.setDepthTexture(n,e)}render(n,e,t,i,r){for(const s of this.effects)s.update(n,e,i);if(!this.skipRendering||this.renderToScreen){const s=this.fullscreenMaterial;s.inputBuffer=e.texture,s.time+=i*this.timeScale,n.setRenderTarget(this.renderToScreen?null:t),n.render(this.scene,this.camera)}}setSize(n,e){this.fullscreenMaterial.setSize(n,e);for(const t of this.effects)t.setSize(n,e)}initialize(n,e,t){this.renderer=n;for(const i of this.effects)i.initialize(n,e,t);this.updateMaterial(),t!==void 0&&t!==Nt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const n of this.effects)n.removeEventListener("change",this.listener),n.dispose()}handleEvent(n){switch(n.type){case"change":this.recompile();break}}};const Im=`
3935void main() {
3936  gl_Position = vec4(position, 1.0);
3937}
3938`,Lm=`
3939precision highp float;
3940
3941uniform vec3  uColor;
3942uniform vec2  uResolution;
3943uniform float uTime;
3944uniform float uPixelSize;
3945uniform float uScale;
3946uniform float uDensity;
3947uniform float uPixelJitter;
3948uniform int   uEnableRipples;
3949uniform float uRippleSpeed;
3950uniform float uRippleThickness;
3951uniform float uRippleIntensity;
3952uniform float uEdgeFade;
3953
3954uniform int   uShapeType;
3955const int SHAPE_SQUARE   = 0;
3956const int SHAPE_CIRCLE   = 1;
3957const int SHAPE_TRIANGLE = 2;
3958const int SHAPE_DIAMOND  = 3;
3959
3960const int   MAX_CLICKS = 10;
3961
3962uniform vec2  uClickPos  [MAX_CLICKS];
3963uniform float uClickTimes[MAX_CLICKS];
3964
3965out vec4 fragColor;
3966
3967float Bayer2(vec2 a) {
3968  a = floor(a);
3969  return fract(a.x / 2. + a.y * a.y * .75);
3970}
3971#define Bayer4(a) (Bayer2(.5*(a))*0.25 + Bayer2(a))
3972#define Bayer8(a) (Bayer4(.5*(a))*0.25 + Bayer2(a))
3973
3974#define FBM_OCTAVES     5
3975#define FBM_LACUNARITY  1.25
3976#define FBM_GAIN        1.0
3977
3978float hash11(float n){ return fract(sin(n)*43758.5453); }
3979
3980float vnoise(vec3 p){
3981  vec3 ip = floor(p);
3982  vec3 fp = fract(p);
3983  float n000 = hash11(dot(ip + vec3(0.0,0.0,0.0), vec3(1.0,57.0,113.0)));
3984  float n100 = hash11(dot(ip + vec3(1.0,0.0,0.0), vec3(1.0,57.0,113.0)));
3985  float n010 = hash11(dot(ip + vec3(0.0,1.0,0.0), vec3(1.0,57.0,113.0)));
3986  float n110 = hash11(dot(ip + vec3(1.0,1.0,0.0), vec3(1.0,57.0,113.0)));
3987  float n001 = hash11(dot(ip + vec3(0.0,0.0,1.0), vec3(1.0,57.0,113.0)));
3988  float n101 = hash11(dot(ip + vec3(1.0,0.0,1.0), vec3(1.0,57.0,113.0)));
3989  float n011 = hash11(dot(ip + vec3(0.0,1.0,1.0), vec3(1.0,57.0,113.0)));
3990  float n111 = hash11(dot(ip + vec3(1.0,1.0,1.0), vec3(1.0,57.0,113.0)));
3991  vec3 w = fp*fp*fp*(fp*(fp*6.0-15.0)+10.0);
3992  float x00 = mix(n000, n100, w.x);
3993  float x10 = mix(n010, n110, w.x);
3994  float x01 = mix(n001, n101, w.x);
3995  float x11 = mix(n011, n111, w.x);
3996  float y0  = mix(x00, x10, w.y);
3997  float y1  = mix(x01, x11, w.y);
3998  return mix(y0, y1, w.z) * 2.0 - 1.0;
3999}
4000
4001float fbm2(vec2 uv, float t){
4002  vec3 p = vec3(uv * uScale, t);
4003  float amp = 1.0;
4004  float freq = 1.0;
4005  float sum = 1.0;
4006  for (int i = 0; i < FBM_OCTAVES; ++i){
4007    sum  += amp * vnoise(p * freq);
4008    freq *= FBM_LACUNARITY;
4009    amp  *= FBM_GAIN;
4010  }
4011  return sum * 0.5 + 0.5;
4012}
4013
4014float maskCircle(vec2 p, float cov){
4015  float r = sqrt(cov) * .25;
4016  float d = length(p - 0.5) - r;
4017  float aa = 0.5 * fwidth(d);
4018  return cov * (1.0 - smoothstep(-aa, aa, d * 2.0));
4019}
4020
4021float maskTriangle(vec2 p, vec2 id, float cov){
4022  bool flip = mod(id.x + id.y, 2.0) > 0.5;
4023  if (flip) p.x = 1.0 - p.x;
4024  float r = sqrt(cov);
4025  float d  = p.y - r*(1.0 - p.x);
4026  float aa = fwidth(d);
4027  return cov * clamp(0.5 - d/aa, 0.0, 1.0);
4028}
4029
4030float maskDiamond(vec2 p, float cov){
4031  float r = sqrt(cov) * 0.564;
4032  return step(abs(p.x - 0.49) + abs(p.y - 0.49), r);
4033}
4034
4035void main(){
4036  float pixelSize = uPixelSize;
4037  vec2 fragCoord = gl_FragCoord.xy - uResolution * .5;
4038  float aspectRatio = uResolution.x / uResolution.y;
4039
4040  vec2 pixelId = floor(fragCoord / pixelSize);
4041  vec2 pixelUV = fract(fragCoord / pixelSize);
4042
4043  float cellPixelSize = 8.0 * pixelSize;
4044  vec2 cellId = floor(fragCoord / cellPixelSize);
4045  vec2 cellCoord = cellId * cellPixelSize;
4046  vec2 uv = cellCoord / uResolution * vec2(aspectRatio, 1.0);
4047
4048  float base = fbm2(uv, uTime * 0.05);
4049  base = base * 0.5 - 0.65;
4050
4051  float feed = base + (uDensity - 0.5) * 0.3;
4052
4053  float speed     = uRippleSpeed;
4054  float thickness = uRippleThickness;
4055  const float dampT     = 1.0;
4056  const float dampR     = 10.0;
4057
4058  if (uEnableRipples == 1) {
4059    for (int i = 0; i < MAX_CLICKS; ++i){
4060      vec2 pos = uClickPos[i];
4061      if (pos.x < 0.0) continue;
4062      float cellPixelSize = 8.0 * pixelSize;
4063      vec2 cuv = (((pos - uResolution * .5 - cellPixelSize * .5) / (uResolution))) * vec2(aspectRatio, 1.0);
4064      float t = max(uTime - uClickTimes[i], 0.0);
4065      float r = distance(uv, cuv);
4066      float waveR = speed * t;
4067      float ring  = exp(-pow((r - waveR) / thickness, 2.0));
4068      float atten = exp(-dampT * t) * exp(-dampR * r);
4069      feed = max(feed, ring * atten * uRippleIntensity);
4070    }
4071  }
4072
4073  float bayer = Bayer8(fragCoord / uPixelSize) - 0.5;
4074  float bw = step(0.5, feed + bayer);
4075
4076  float h = fract(sin(dot(floor(fragCoord / uPixelSize), vec2(127.1, 311.7))) * 43758.5453);
4077  float jitterScale = 1.0 + (h - 0.5) * uPixelJitter;
4078  float coverage = bw * jitterScale;
4079  float M;
4080  if      (uShapeType == SHAPE_CIRCLE)   M = maskCircle (pixelUV, coverage);
4081  else if (uShapeType == SHAPE_TRIANGLE) M = maskTriangle(pixelUV, pixelId, coverage);
4082  else if (uShapeType == SHAPE_DIAMOND)  M = maskDiamond(pixelUV, coverage);
4083  else                                   M = coverage;
4084
4085  if (uEdgeFade > 0.0) {
4086    vec2 norm = gl_FragCoord.xy / uResolution;
4087    float edge = min(min(norm.x, norm.y), min(1.0 - norm.x, 1.0 - norm.y));
4088    float fade = smoothstep(0.0, uEdgeFade, edge);
4089    M *= fade;
4090  }
4091
4092  vec3 color = uColor;
4093  fragColor = vec4(color, M);
4094}
4095`,rs=10,Um=na({__name:"PixelBlast",props:{variant:{default:"square"},pixelSize:{default:3},color:{default:"#B19EEF"},className:{},style:{},antialias:{type:Boolean,default:!0},patternScale:{default:2},patternDensity:{default:1},liquid:{type:Boolean,default:!1},liquidStrength:{default:.1},liquidRadius:{default:1},pixelSizeJitter:{default:0},enableRipples:{type:Boolean,default:!0},rippleIntensityScale:{default:1},rippleThickness:{default:.1},rippleSpeed:{default:.3},liquidWobbleSpeed:{default:4.5},autoPauseOffscreen:{type:Boolean,default:!0},speed:{default:.5},transparent:{type:Boolean,default:!0},edgeFade:{default:.5},noiseAmount:{default:0}},setup(n){const e=()=>{const m=document.createElement("canvas");m.width=64,m.height=64;const x=m.getContext("2d");if(!x)throw new Error("2D context not available");x.fillStyle="black",x.fillRect(0,0,m.width,m.height);const M=new St(m);M.minFilter=Tt,M.magFilter=Tt,M.generateMipmaps=!1;const h=[];let u=null;const T=64;let y=.1*64;const E=1/T,L=()=>{x.fillStyle="black",x.fillRect(0,0,m.width,m.height)},A=g=>{const S={x:g.x*64,y:(1-g.y)*64};let w=1;const X=G=>Math.sin(G*Math.PI/2),O=G=>-G*(G-2);g.age<T*.3?w=X(g.age/(T*.3)):w=O(1-(g.age-T*.3)/(T*.7))||0,w*=g.force;const H=`${(g.vx+1)/2*255}, ${(g.vy+1)/2*255}, ${w*255}`,Y=320;x.shadowOffsetX=Y,x.shadowOffsetY=Y,x.shadowBlur=y,x.shadowColor=`rgba(${H},${.22*w})`,x.beginPath(),x.fillStyle="rgba(255,0,0,1)",x.arc(S.x-Y,S.y-Y,y,0,Math.PI*2),x.fill()};return{canvas:m,texture:M,addTouch:g=>{let S=0,w=0,X=0;if(u){const O=g.x-u.x,H=g.y-u.y;if(O===0&&H===0)return;const Y=O*O+H*H,G=Math.sqrt(Y);w=O/(G||1),X=H/(G||1),S=Math.min(Y*1e4,1)}u={x:g.x,y:g.y},h.push({x:g.x,y:g.y,age:0,force:S,vx:w,vy:X})},update:()=>{L();for(let g=h.length-1;g>=0;g--){const S=h[g],w=S.force*E*(1-S.age/T);S.x+=S.vx*w,S.y+=S.vy*w,S.age++,S.age>T&&h.splice(g,1)}for(let g=0;g<h.length;g++)A(h[g]);M.needsUpdate=!0},set radiusScale(g){y=6.4*g},get radiusScale(){return y/6.4},size:64}},t=(p,m)=>{const x=`
4096    uniform sampler2D uTexture;
4097    uniform float uStrength;
4098    uniform float uTime;
4099    uniform float uFreq;
4100
4101    void mainUv(inout vec2 uv) {
4102      vec4 tex = texture2D(uTexture, uv);
4103      float vx = tex.r * 2.0 - 1.0;
4104      float vy = tex.g * 2.0 - 1.0;
4105      float intensity = tex.b;
4106
4107      float wave = 0.5 + 0.5 * sin(uTime * uFreq + intensity * 6.2831853);
4108
4109      float amt = uStrength * intensity * wave;
4110
4111      uv += vec2(vx, vy) * amt;
4112    }
4113    `;return new bo("LiquidEffect",x,{uniforms:new Map([["uTexture",new lt(p)],["uStrength",new lt(m?.strength??.025)],["uTime",new lt(0)],["uFreq",new lt(m?.freq??4.5)]])})},i={square:0,circle:1,triangle:2,diamond:3},r=n,s=Ml("containerRef"),a=Gt({visible:!0}),o=Gt(r.speed),l=Gt(null),c=Gt(null);let d=null;const f=()=>{const p=s.value;if(!p)return;o.value=r.speed;const m=["antialias","liquid","noiseAmount"],x={antialias:r.antialias,liquid:r.liquid,noiseAmount:r.noiseAmount};let M=!1;if(!l.value)M=!0;else if(c.value){for(const h of m)if(c.value[h]!==x[h]){M=!0;break}}if(M){if(l.value){const ue=l.value;ue.resizeObserver?.disconnect(),cancelAnimationFrame(ue.raf),ue.quad?.geometry.dispose(),ue.material.dispose(),ue.composer?.dispose(),ue.renderer.dispose(),ue.renderer.domElement.parentElement===p&&p.removeChild(ue.renderer.domElement),l.value=null}const h=document.createElement("canvas");
4113if(!h.getContext("webgl2",{antialias:r.antialias,alpha:!0}))return;const T=new Op({canvas:h,antialias:r.antialias,alpha:!0});T.domElement.style.width="100%",T.domElement.style.height="100%",T.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),p.appendChild(T.domElement);const y={uResolution:{value:new Oe(0,0)},uTime:{value:0},uColor:{value:new $e(r.color)},uClickPos:{value:Array.from({length:rs},()=>new Oe(-1,-1))},uClickTimes:{value:new Float32Array(rs)},uShapeType:{value:i[r.variant]??0},uPixelSize:{value:r.pixelSize*T.getPixelRatio()},uScale:{value:r.patternScale},uDensity:{value:r.patternDensity},uPixelJitter:{value:r.pixelSizeJitter},uEnableRipples:{value:r.enableRipples?1:0},uRippleSpeed:{value:r.rippleSpeed},uRippleThickness:{value:r.rippleThickness},uRippleIntensity:{value:r.rippleIntensityScale},uEdgeFade:{value:r.edgeFade}},E=new Js,L=new ha(-1,1,1,-1,0,1),A=new Wt({vertexShader:Im,fragmentShader:Lm,uniforms:y,transparent:!0,glslVersion:Zs,depthTest:!1,depthWrite:!1}),C=new Ni(2,2),U=new jt(C,A);E.add(U);const g=new Qc,S=()=>{const ue=p.clientWidth||1,we=p.clientHeight||1;T.setSize(ue,we,!1),y.uResolution.value.set(T.domElement.width,T.domElement.height),l.value?.composer&&l.value.composer.setSize(T.domElement.width,T.domElement.height),y.uPixelSize.value=r.pixelSize*T.getPixelRatio()};S();const w=new ResizeObserver(S);w.observe(p);const O=(()=>{if(typeof window<"u"&&window.crypto?.getRandomValues){const ue=new Uint32Array(1);return window.crypto.getRandomValues(ue),ue[0]/4294967295}return Math.random()})()*1e3;let H,Y,G;if(r.liquid){Y=e(),Y.radiusScale=r.liquidRadius,H=new To(T);const ue=new Ao(E,L);G=t(Y.texture,{strength:r.liquidStrength,freq:r.liquidWobbleSpeed});const we=new is(L,G);we.renderToScreen=!0,H.addPass(ue),H.addPass(we)}if(r.noiseAmount>0){H||(H=new To(T),H.addPass(new Ao(E,L)));const ue=new bo("NoiseEffect","uniform float uTime; uniform float uAmount; float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7))) * 43758.5453);} void mainUv(inout vec2 uv){} void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){ float n=hash(floor(uv*vec2(1920.0,1080.0))+floor(uTime*60.0)); float g=(n-0.5)*uAmount; outputColor=inputColor+vec4(vec3(g),0.0);} ",{uniforms:new Map([["uTime",new lt(0)],["uAmount",new lt(r.noiseAmount)]])}),we=new is(L,ue);we.renderToScreen=!0,H&&H.passes.length>0&&H.passes.forEach(k=>{"renderToScreen"in k&&(k.renderToScreen=!1)}),H.addPass(we)}H&&H.setSize(T.domElement.width,T.domElement.height);const te=ue=>{const we=T.domElement.getBoundingClientRect(),k=T.domElement.width/we.width,Q=T.domElement.height/we.height,_e=(ue.clientX-we.left)*k,le=(we.height-(ue.clientY-we.top))*Q;return{fx:_e,fy:le,w:T.domElement.width,h:T.domElement.height}},V=ue=>{const{fx:we,fy:k}=te(ue),Q=l.value?.clickIx??0;y.uClickPos.value[Q].set(we,k),y.uClickTimes.value[Q]=y.uTime.value,l.value&&(l.value.clickIx=(Q+1)%rs)},se=ue=>{if(!Y)return;const{fx:we,fy:k,w:Q,h:_e}=te(ue);Y.addTouch({x:we/Q,y:k/_e})};T.domElement.addEventListener("pointerdown",V,{passive:!0}),T.domElement.addEventListener("pointermove",se,{passive:!0});let ce=0;const ve=()=>{if(r.autoPauseOffscreen&&!a.value.visible){ce=requestAnimationFrame(ve);return}y.uTime.value=O+g.getElapsedTime()*o.value,G&&(G.uniforms.get("uTime").value=y.uTime.value),H?(Y&&Y.update(),H.passes.forEach(ue=>{ue instanceof is&&ue.effects?.forEach(k=>{const Q=k.uniforms.get("uTime");Q&&(Q.value=y.uTime.value)})}),H.render()):T.render(E,L),ce=requestAnimationFrame(ve)};ce=requestAnimationFrame(ve),l.value={renderer:T,scene:E,camera:L,material:A,clock:g,clickIx:0,uniforms:y,resizeObserver:w,raf:ce,quad:U,timeOffset:O,composer:H,touch:Y,liquidEffect:G}}else{const h=l.value;if(h.uniforms.uShapeType.value=i[r.variant]??0,h.uniforms.uPixelSize.value=r.pixelSize*h.renderer.getPixelRatio(),h.uniforms.uColor.value.set(r.color),h.uniforms.uScale.value=r.patternScale,h.uniforms.uDensity.value=r.patternDensity,h.uniforms.uPixelJitter.value=r.pixelSizeJitter,h.uniforms.uEnableRipples.value=r.enableRipples?1:0,h.uniforms.uRippleIntensity.value=r.rippleIntensityScale,h.uniforms.uRippleThickness.value=r.rippleThickness,h.uniforms.uRippleSpeed.value=r.rippleSpeed,h.uniforms.uEdgeFade.value=r.edgeFade,r.transparent?h.renderer.setClearAlpha(0):h.renderer.setClearColor(0,1),h.liquidEffect){const u=h.liquidEffect?.uniforms.get("uStrength");u&&(u.value=r.liquidStrength);const T=h.liquidEffect?.uniforms.get("uFreq");T&&(T.value=r.liquidWobbleSpeed)}h.touch&&(h.touch.radiusScale=r.liquidRadius)}c.value=x,d=()=>
4113{if(l.value&&M||!l.value)return;const h=l.value;h.resizeObserver?.disconnect(),cancelAnimationFrame(h.raf),h.quad?.geometry.dispose(),h.material.dispose(),h.composer?.dispose(),h.renderer.dispose(),h.renderer.domElement.parentElement===p&&p.removeChild(h.renderer.domElement),l.value=null}};return ia(()=>{f()}),El(()=>{d?.()}),Tl(r,()=>{d?.(),f()},{deep:!0}),(p,m)=>(xt(),vt("div",{ref_key:"containerRef",ref:s,class:ar(["w-full h-full relative overflow-hidden",n.className]),style:yl(n.style),"aria-label":"PixelBlast interactive background"},null,6))}}),Nm="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/Save%20Alt.svg",Fm="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/SPACEMIT%20AI%20LAB.svg",ss=8,ma=[{id:"llm",label:"大语言模型",labelEn:"Large Language Model"},{id:"vlm",label:"视觉语言模型",labelEn:"Vision Language Model"},{id:"vision",label:"视觉模型",labelEn:"Vision Model"},{id:"speech",label:"语音模型",labelEn:"Speech Model"}],_a="llm";async function Om(){return(await Po.get("/ai-lab/requestDevice")).data}async function Bm(){return(await Al.get("https://gdriscv.com/api/device/availableCount")).data.data}const zm={class:"hero-banner","aria-labelledby":"hero-title"},Hm={class:"background-layer","aria-hidden":"true"},Gm={class:"hero-shell"},Vm={class:"hero-copy"},km={id:"hero-title",class:"hero-title"},Wm=["src"],Xm={class:"hero-subtitle"},qm={class:"hero-actions"},Ym=["disabled"],Km={key:0,class:"available-count-wrapper"},$m={class:"available-count"},Zm={class:"available-count__label"},jm={class:"available-count__value"},Jm={class:"available-count-hint"},Qm={class:"page-section","aria-labelledby":"performance-title"},e_={class:"section-inner"},t_={class:"section-header"},n_={id:"performance-title",class:"section-title"},i_={class:"home-category-tabs",role:"tablist","aria-label":"性能模型分类"},r_=["aria-selected","onClick"],s_={class:"section-body-stack"},a_={class:"performance-table-shell"},o_={class:"performance-table-scroll"},l_={class:"performance-table"},c_={scope:"col"},u_=["href","aria-label"],d_={class:"performance-table__model-text"},f_=["src"],h_={key:0,class:"home-pagination","aria-label":"性能数据分页"},p_=["disabled"],m_={key:0,class:"home-pagination__ellipsis"},__=["aria-label","aria-current","onClick"],g_=["disabled"],v_=na({__name:"HomeView",emits:["tryModel","categoryChange"],setup(n,{emit:e}){const{t,locale:i}=Do(),r=Qt(()=>i.value==="zh"),s=e,a=ya("allModelCards"),o=ya("categories"),l=Qt(()=>o?.value??[]),c=Gt(_a),d=Gt(1),f=Gt(null),p=Qt(()=>f.value===null||f.value===0),m=Qt(()=>l.value.find(A=>A.id===c.value)??null),x=Qt(()=>m.value?r.value?m.value.performanceId:m.value.performanceIdEn:[]),M=Qt(()=>{if(!m.value)return[];const A=r.value?m.value.performanceId:m.value.performanceIdEn;return(a?.value[c.value]??[]).map(U=>({title:r.value?U.title:U.titleEn,values:A.map(g=>U.performance[g]??""),downloadUrl:U.downloadUrl}))}),h=Qt(()=>Math.max(1,Math.ceil(M.value.length/ss))),u=Qt(()=>{const A=(d.value-1)*ss;return M.value.slice(A,A+ss)});function T(A,C){return C<=7?Array.from({length:C},(U,g)=>g+1):A<=4?[1,2,3,4,5,"...",C]:A>=C-3?[1,"...",C-4,C-3,C-2,C-1,C]:[1,"...",A-1,A,A+1,"...",C]}const y=Qt(()=>T(d.value,h.value));function E(A){c.value=A,d.value=1,s("categoryChange",A)}function L(){s("tryModel",{})}return ia(()=>{Bm().then(A=>{f.value=A}).catch(A=>{console.error("Failed to fetch available count:",A)})}),(A,C)=>{const U=Rl;return xt(),vt("div",null,[Ge("section",zm,[Ge("div",Hm,[us(Um,{variant:"circle","pixel-size":6,color:"#A7EF9E","pattern-scale":3,"pattern-density":.45,"pixel-size-jitter":.5,"enable-ripples":!0,"ripple-speed":.4,"ripple-thickness":.12,"ripple-intensity-scale":1.5,liquid:!1,"liquid-strength":.12,"liquid-radius":1.2,"liquid-wobble-speed":5,speed:.6,"edge-fade":.25,transparent:!0})]),Ge("div",Gm,[Ge("div",Vm,[Ge("h1",km,[C[2]||(C[2]=Ge("span",{class:"sr-only"},"SPACEMIT AI LAB",-1)),Ge("img",{class:"hero-title-mark",src:an(Fm),alt:"","aria-hidden":"true"},null,8,Wm)]),Ge("p",Xm,Bt(an(t)("ailab.hero.subtitle")),1),Ge("div",qm,[us(U,{title:p.value?an(t)("ailab.hero.deviceUnavailable"):"",placement:"bottom"},{default:bl(()=>[Ge("button",{ref:"ctaButtonRef",class:ar(["cta-button",{"is-disabled":p.value}]),type:"button",disabled:p.value,onClick:L},Bt(an(t)("ailab.hero.cta")+" K3"),11,Ym)]),_:1},8,["title"]),f.value!==null?(xt(),vt("div",Km,[Ge("div",$m,[Ge("span",Zm,Bt(an(t)("ailab.hero.currentAvailable")),1),Ge("span",jm,Bt(f.value),1)]),Ge("p",Jm,Bt(an(t)("ailab.hero.usageHint")),1)])):ba("",!0)])])])]),Ge("section",Qm,[Ge("div",e_,[Ge("div",t_,[Ge("h2",n_,Bt(an(t)("ailab.performance.sectionTitle")),1),Ge("div",i_,[(xt(!0),vt(qn,null,Si(l.value,g=>(xt(),vt("button",{key:g.id,class:ar(["home-category-tab",{"is-active":g.id===c.value}]),type:"button",role:"tab","aria-selected":g.id===c.value,onClick:S=>E(g.id)},Bt(r.value?g.label:g.labelEn),11,r_))),128))])]),Ge("div",s_,[Ge("div",a_,[Ge("div",o_,[Ge("table",l_,[Ge("thead",null,[Ge("tr",null,[Ge("th",c_,Bt(r.value?"模型":"Model"),1),(xt(!0),vt(qn,null,Si(x.value,g=>(xt(),vt("th",{key:g,scope:"col"},Bt(g),1))),128))])]),Ge("tbody",null,[(xt(!0),vt(qn,null,Si(u.value,(g,S)=>(xt(),vt("tr",{key:S},[Ge("td",null,[Ge("a",{class:"performance-table__model",href:g.downloadUrl,target:"_blank",rel:"noopener noreferrer","aria-label":an(t)("ailab.performance.downloadAriaLabel",{title:g.title})}
4113,[Ge("span",d_,Bt(g.title),1),Ge("img",{class:"performance-table__download-icon",src:an(Nm),alt:"","aria-hidden":"true"},null,8,f_)],8,u_)]),(xt(!0),vt(qn,null,Si(g.values,(w,X)=>(xt(),vt("td",{key:X},Bt(w),1))),128))]))),128))])])])]),h.value>1?(xt(),vt("nav",h_,[Ge("button",{class:"home-pagination__button home-pagination__arrow",type:"button",disabled:d.value===1,"aria-label":"上一页",onClick:C[0]||(C[0]=g=>d.value--)},"‹",8,p_),(xt(!0),vt(qn,null,Si(y.value,g=>(xt(),vt(qn,{key:g},[g==="..."?(xt(),vt("span",m_,"…")):(xt(),vt("button",{key:1,class:ar(["home-pagination__button",{"is-active":g===d.value}]),type:"button","aria-label":`第 ${g} 页`,"aria-current":g===d.value?"page":void 0,onClick:S=>d.value=g},Bt(g),11,__))],64))),128)),Ge("button",{class:"home-pagination__button home-pagination__arrow",type:"button",disabled:d.value===h.value,"aria-label":"下一页",onClick:C[1]||(C[1]=g=>d.value++)},"›",8,g_)])):ba("",!0)])])])])}}}),x_="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_1.svg",S_="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_2.svg",ol="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_3.svg",ll="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_4.svg",M_="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_5.svg",E_="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_6.svg",ta="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_7.svg",cl="https://cdn-resource.spacemit.com/file/officialweb/assets/icons/aillab/model_icon_8.svg",T_={modelIcon1:x_,modelIcon2:S_,modelIcon3:ol,modelIcon4:ll,modelIcon5:M_,modelIcon6:E_,modelIcon7:ta,modelIcon8:cl};function y_(n,e){let t=T_[n];return t||(e.includes("llm")?t=ta:e.includes("vlm")?t=ol:e.includes("vision")?t=cl:e.includes("speech")?t=ll:t=ta),t}function Co(n){return{id:n.id,categoryIds:n.categoryIds,iconSrc:y_(n.iconSrc,n.categoryIds),title:n.title,titleEn:n.titleEn,description:n.description,descriptionEn:n.descriptionEn,meta:n.meta,metaEn:n.metaEn,experienceKind:n.experienceKind,performance:n.performance,downloadUrl:n.downloadUrl,plat:n.plat}}async function b_(n){const e=ma.find(a=>a.id===n),i=(await Po.get(`/ai-lab/models/${n}`)).data,r=Array.isArray(i.models)?i.models.map(Co):[],s=Array.isArray(i.subcategories)?i.subcategories.flatMap(a=>Array.isArray(a.models)?a.models.map(Co):[]):[];return{category:{...e,performanceId:i.performanceId??[],performanceIdEn:i.performanceIdEn??i.performanceId??[]},modelCards:[...r,...s]}}const as=Gt({}),os=Gt({}),ls=Gt(new Set),cs=Gt(_a),wo=Gt(ma.map(n=>({...n,performanceId:[],performanceIdEn:[]})));function A_(){async function n(e){if(as.value[e]){cs.value=e;return}if(!ls.value.has(e)){ls.value.add(e);try{const t=await b_(e);as.value[e]=t.modelCards,os.value[e]=t.category,wo.value=ma.map(i=>os.value[i.id]?os.value[i.id]:{...i,performanceId:[],performanceIdEn:[]}),cs.value=e}catch{ds.error("模型数据加载失败,请检查网络后刷新重试")}finally{ls.value.delete(e)}}}return{allModelCards:Er(as),categories:Er(wo),currentCategoryId:Er(cs),loadByType:n}}const R_={class:"ailab-page"},C_=na({__name:"AILabView",setup(n){const{t:e,locale:t}=Do(),i=_l(),r=Qt(()=>i.getters["app/getIsMobile"]),{allModelCards:s,categories:a,loadByType:o}=A_();Aa("allModelCards",s),Aa("categories",a);async function l(d){if(r.value){ds.warning(e("ailab.mobileNotSupported"));return}if(!await vl()){xl(window.location.href);return}console.log("Opening model experience page for model:",d);const p=Cl.info({title:null,icon:null,content:Tr("div",{style:"display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;"},[Tr(wl,{style:"font-size:56px;color:#9fef00;filter:drop-shadow(0 0 12px rgba(159,239,0,0.4))"}),Tr("span",{style:"margin-top:20px;font-size:16px;color:rgba(255,255,255,0.85);letter-spacing:0.5px"},e("ailab.device.loading"))]),footer:null,maskClosable:!1,keyboard:!1,width:360,centered:!0,wrapClassName:"device-loading-modal"});try{const m=await Om();p.destroy(),window.open(`https://gdriscv.com/spacemit-lab/${m.id}/models.html?lang=${t.value}`,"_blank")}catch(m){p.destroy(),console.error("Failed to request device:",m),ds.error(e("ailab.device.error"));return}}function c(d){o(d)}return ia(()=>{gl(()=>Promise.resolve({}),__vite__mapDeps([0])),o(_a)}),(d,f)=>(xt(),vt("main",R_,[us(v_,{onTryModel:l,onCategoryChange:c})]))}}),N_=Sl(C_,[["__scopeId","data-v-9e829351"]]);export{N_ as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.