vendor: 5,318 bytes, lines 1-5
1import{j as Go}from"./jsx-runtime-JHL_I6WO.js";import{r as en}from"./chunk-OB3PAWPO-CIG0z4WM.js";/** 2 * @license 3 * Copyright 2010-2025 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const lr="180",Vo=0,ea=1,ko=2,io=1,Wo=2,on=3,cn=0,gt=1,Dt=2,Jt=0,ti=1,ta=2,na=3,ia=4,Xo=5,Ln=100,qo=101,Yo=102,Ko=103,$o=104,Zo=200,jo=201,Jo=202,Qo=203,Yr=204,Kr=205,el=206,tl=207,nl=208,il=209,rl=210,sl=211,al=212,ol=213,ll=214,$r=0,rr=1,Zr=2,ii=3,jr=4,Jr=5,Qr=6,es=7,ro=0,cl=1,ul=2,_n=0,fl=1,hl=2,dl=3,pl=4,ml=5,gl=6,_l=7,so=300,ri=301,si=302,ts=303,ns=304,cr=306,is=1e3,In=1001,rs=1002,qt=1003,vl=1004,Di=1005,Mt=1006,dr=1007,Nn=1008,At=1009,ao=1010,oo=1011,xi=1012,Bs=1013,Bn=1014,Zt=1015,Ei=1016,zs=1017,Hs=1018,ai=1020,lo=35902,co=35899,uo=1021,fo=1022,Wt=1023,Si=1026,oi=1027,ho=1028,Gs=1029,po=1030,Vs=1031,ks=1033,Qi=33776,er=33777,tr=33778,nr=33779,ss=35840,as=35841,os=35842,ls=35843,cs=36196,us=37492,fs=37496,hs=37808,ds=37809,ps=37810,ms=37811,gs=37812,_s=37813,vs=37814,xs=37815,Ss=37816,Ms=37817,Es=37818,Ts=37819,ys=37820,bs=37821,As=36492,Rs=36494,Cs=36495,ws=36283,Ps=36284,Ds=36285,Ls=36286,Ti=3200,xl=3201,Sl=0,Ml=1,$t="",ct="srgb",vn="srgb-linear",sr="linear",Je="srgb",Hn=7680,ra=519,El=512,Tl=513,yl=514,mo=515,bl=516,Al=517,Rl=518,Cl=519,sa=35044,Us="300 es",jt=2e3,ar=2001;class xn{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 xt=["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"],pr=Math.PI/180,Is=180/Math.PI;function yi(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(xt[n&255]+xt[n>>8&255]+xt[n>>16&255]+xt[n>>24&255]+"-"+xt[e&255]+xt[e>>8&255]+"-"+xt[e>>16&15|64]+xt[e>>24&255]+"-"+xt[t&63|128]+xt[t>>8&255]+"-"+xt[t>>16&255]+xt[t>>24&255]+xt[i&255]+xt[i>>8&255]+xt[i>>16&255]+xt[i>>24&255]).toLowerCase()}function We(n,e,t){return Math.max(e,Math.min(t,n))}function wl(n,e){return(n%e+e)%e}function mr(n,e,t){return(1-t)*n+t*e}function hi(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 bt(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 ze{constructor(e=0,t=0){ze.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 5
5sub(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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(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(We(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 bi{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 c=i[r+0],l=i[r+1],f=i[r+2],h=i[r+3];const d=s[a+0],p=s[a+1],v=s[a+2],x=s[a+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=f,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=v,e[t+3]=x;return}if(h!==x||c!==d||l!==p||f!==v){let m=1-o;const u=c*d+l*p+f*v+h*x,b=u>=0?1:-1,y=1-u*u;if(y>Number.EPSILON){const w=Math.sqrt(y),R=Math.atan2(w,u*b);m=Math.sin(m*R)/w,o=Math.sin(o*R)/w}const T=o*b;if(c=c*m+d*T,l=l*m+p*T,f=f*m+v*T,h=h*m+x*T,m===1-o){const w=1/Math.sqrt(c*c+l*l+f*f+h*h);c*=w,l*=w,f*=w,h*=w}}e[t]=c,e[t+1]=l,e[t+2]=f,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],c=i[r+1],l=i[r+2],f=i[r+3],h=s[a],d=s[a+1],p=s[a+2],v=s[a+3];return e[t]=o*v+f*h+c*p-l*d,e[t+1]=c*v+f*d+l*h-o*p,e[t+2]=l*v+f*p+o*d-c*h,e[t+3]=f*v-o*h-c*d-l*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,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,c=Math.sin,l=o(i/2),f=o(r/2),h=o(s/2),d=c(i/2),p=c(r/2),v=c(s/2);switch(a){case"XYZ":this._x=d*f*h+l*p*v,this._y=l*p*h-d*f*v,this._z=l*f*v+d*p*h,this._w=l*f*h-d*p*v;break;case"YXZ":this._x=d*f*h+l*p*v,this._y=l*p*h-d*f*v,this._z=l*f*v-d*p*h,this._w=l*f*h+d*p*v;break;case"ZXY":this._x=d*f*h-l*p*v,this._y=l*p*h+d*f*v,this._z=l*f*v+d*p*h,this._w=l*f*h-d*p*v;break;case"ZYX":this._x=d*f*h-l*p*v,this._y=l*p*h+d*f*v,this._z=l*f*v-d*p*h,this._w=l*f*h+d*p*v;break;case"YZX":this._x=d*f*h+l*p*v,this._y=l*p*h+d*f*v,this._z=l*f*v-d*p*h,this._w=l*f*h-d*p*v;break;case"XZY":this._x=d*f*h-l*p*v,this._y=l*p*h-d*f*v,this._z=l*f*v+d*p*h,this._w=l*f*h+d*p*v;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],c=t[9],l=t[2],f=t[6],h=t[10],d=i+o+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(f-c)*p,this._y=(s-l)*p,this._z=(a-r)*p}else if(i>o&&i>h){const p=2*Math.sqrt(1+i-o-h);this._w=(f-c)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+l)/p}else if(o>h){const p=2*Math.sqrt(1+o-i-h);this._w=(s-l)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(c+f)/p}else{const p=2*Math.sqrt(1+h-i-o);this._w=(a-r)/p,this._x=(s+l)/p,this._y=(c+f)/p,this._z=.25*p}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 5
5Math.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(We(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,c=t._y,l=t._z,f=t._w;return this._x=i*f+a*o+r*l-s*c,this._y=r*f+a*c+s*o-i*l,this._z=s*f+a*l+i*c-r*o,this._w=a*f-i*o-r*c-s*l,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 c=1-o*o;if(c<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const l=Math.sqrt(c),f=Math.atan2(l,o),h=Math.sin((1-t)*f)/l,d=Math.sin(t*f)/l;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,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 O{constructor(e=0,t=0,i=0){O.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(aa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(aa.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,286 bytes, line 5
5applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*i),f=2*(o*t-s*r),h=2*(s*i-a*t);return this.x=t+c*l+a*h-o*f,this.y=i+c*f+o*l-s*h,this.z=r+c*h+s*f-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(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,c=t.z;return this.x=r*c-s*o,this.y=s*a-i*c,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 gr.copy(this).projectOnVector(e),this.sub(gr)}reflect(e){return this.sub(gr.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(We(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 gr=new O,aa=new bi;class Fe{constructor(e,t,i,r,s,a,o,c,l){Fe.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,c,l)}set(e,t,i,r,s,a,o,c,l){const f=this.elements;return f[0]=e,f[1]=r,f[2]=o,f[3]=t,f[4]=s,f[5]=c,f[6]=i,f[7]=a,f[8]=l,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],c=i[6],l=i[1],f=i[4],h=i[7],d=i[2],p=i[5],v=i[8],x=r[0],m=r[3],u=r[6],b=r[1],y=r[4],T=r[7],w=r[2],R=r[5],D=r[8];return s[0]=a*x+o*b+c*w,s[3]=a*m+o*y+c*R,s[6]=a*u+o*T+c*D,s[1]=l*x+f*b+h*w,s[4]=l*m+f*y+h*R,s[7]=l*u+f*T+h*D,s[2]=d*x+p*b+v*w,s[5]=d*m+p*y+v*R,s[8]=d*u+p*T+v*D,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],c=e[6],l=e[7],f=e[8];return t*a*f-t*o*l-i*s*f+i*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],f=e[8],h=f*a-o*l,d=o*c-f*s,p=l*s-a*c,v=t*h+i*d+r*p;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return e[0]=h*x,e[1]=(r*l-f*i)*x,e[2]=(o*i-r*a)*x,e[3]=d*x,e[4]=(f*t-r*c)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*c-l*t)*x,e[8]=(a*t-i*s)*x,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 c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(_r.makeScale(e,t)),this}rotate(e){return this.premultiply(_r.makeRotation(-e)),this}translate(e,t){return this.premultiply(_r.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 _r=new Fe;function go(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function or(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Pl(){const n=or("canvas");return n.style.display="block",n}const oa={};function Mi(n){n in oa||(oa[n]=!0,console.warn(n))}function Dl(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)})}const la=new Fe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ca=new Fe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 30,891 bytes, line 5
57,1.0569715);function Ll(){const n={enabled:!0,workingColorSpace:vn,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Je&&(r.r=ln(r.r),r.g=ln(r.g),r.b=ln(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Je&&(r.r=ni(r.r),r.g=ni(r.g),r.b=ni(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===$t?sr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Mi("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Mi("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({[vn]:{primaries:e,whitePoint:i,transfer:sr,toXYZ:la,fromXYZ:ca,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ct},outputColorSpaceConfig:{drawingBufferColorSpace:ct}},[ct]:{primaries:e,whitePoint:i,transfer:Je,toXYZ:la,fromXYZ:ca,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ct}}}),n}const qe=Ll();function ln(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ni(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Gn;class Ul{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{Gn===void 0&&(Gn=or("canvas")),Gn.width=e.width,Gn.height=e.height;const r=Gn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Gn}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=or("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]=ln(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(ln(t[i]/255)*255):t[i]=ln(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 Il=0;class Ws{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Il++}),this.uuid=yi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const 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(vr(r[a].image)):s.push(vr(r[a]))}else s=vr(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function vr(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ul.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 Nl=0;const xr=new O;class vt extends xn{constructor(e=vt.DEFAULT_IMAGE,t=vt.DEFAULT_MAPPING,i=In,r=In,s=Mt,a=Nn,o=Wt,c=At,l=vt.DEFAULT_ANISOTROPY,f=$t){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nl++}),this.uuid=yi(),this.name="",this.source=new Ws(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new ze(0,0),this.repeat=new ze(1,1),this.center=new ze(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Fe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,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(xr).x}get height(){return this.source.getSize(xr).y}get depth(){return this.source.getSize(xr).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!==so)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case is:e.x=e.x-Math.floor(e.x);break;case In:e.x=e.x<0?0:1;break;case rs: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 is:e.y=e.y-Math.floor(e.y);break;case In:e.y=e.y<0?0:1;break;case rs: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++}}vt.DEFAULT_IMAGE=null;vt.DEFAULT_MAPPING=so;vt.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 c=e.elements,l=c[0],f=c[4],h=c[8],d=c[1],p=c[5],v=c[9],x=c[2],m=c[6],u=c[10];if(Math.abs(f-d)<.01&&Math.abs(h-x)<.01&&Math.abs(v-m)<.01){if(Math.abs(f+d)<.1&&Math.abs(h+x)<.1&&Math.abs(v+m)<.1&&Math.abs(l+p+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(l+1)/2,T=(p+1)/2,w=(u+1)/2,R=(f+d)/4,D=(h+x)/4,N=(v+m)/4;return y>T&&y>w?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=R/i,s=D/i):T>w?T<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),i=R/r,s=N/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=D/s,r=N/s),this.set(i,r,s,t),this}let b=Math.sqrt((m-v)*(m-v)+(h-x)*(h-x)+(d-f)*(d-f));return Math.abs(b)<.001&&(b=1),this.x=(m-v)/b,this.y=(h-x)/b,this.z=(d-f)/b,this.w=Math.acos((l+p+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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(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 Fl extends xn{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mt,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 vt(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:Mt,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 Ws(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 Bt extends Fl{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class _o extends vt{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=qt,this.minFilter=qt,this.wrapR=In,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ol extends vt{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=qt,this.minFilter=qt,this.wrapR=In,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ai{constructor(e=new O(1/0,1/0,1/0),t=new O(-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(Ht.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Ht.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=Ht.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,Ht):Ht.fromBufferAttribute(s,a),Ht.applyMatrix4(e.matrixWorld),this.expandByPoint(Ht);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Li.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Li.copy(i.boundingBox)),Li.applyMatrix4(e.matrixWorld),this.union(Li)}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,Ht),Ht.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(di),Ui.subVectors(this.max,di),Vn.subVectors(e.a,di),kn.subVectors(e.b,di),Wn.subVectors(e.c,di),fn.subVectors(kn,Vn),hn.subVectors(Wn,kn),yn.subVectors(Vn,Wn);let t=[0,-fn.z,fn.y,0,-hn.z,hn.y,0,-yn.z,yn.y,fn.z,0,-fn.x,hn.z,0,-hn.x,yn.z,0,-yn.x,-fn.y,fn.x,0,-hn.y,hn.x,0,-yn.y,yn.x,0];return!Sr(t,Vn,kn,Wn,Ui)||(t=[1,0,0,0,1,0,0,0,1],!Sr(t,Vn,kn,Wn,Ui))?!1:(Ii.crossVectors(fn,hn),t=[Ii.x,Ii.y,Ii.z],Sr(t,Vn,kn,Wn,Ui))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ht).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ht).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:(tn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),tn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),tn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),tn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),tn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),tn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),tn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),tn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(tn),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 tn=[new O,new O,new O,new O,new O,new O,new O,new O],Ht=new O,Li=new Ai,Vn=new O,kn=new O,Wn=new O,fn=new O,hn=new O,yn=new O,di=new O,Ui=new O,Ii=new O,bn=new O;function Sr(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){bn.fromArray(n,s);const o=r.x*Math.abs(bn.x)+r.y*Math.abs(bn.y)+r.z*Math.abs(bn.z),c=e.dot(bn),l=t.dot(bn),f=i.dot(bn);if(Math.max(-Math.max(c,l,f),Math.min(c,l,f))>o)return!1}return!0}const Bl=new Ai,pi=new O,Mr=new O;class Xs{constructor(e=new O,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):Bl.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;pi.subVectors(e,this.center);const t=pi.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(pi,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):(Mr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pi.copy(e.center).add(Mr)),this.expandByPoint(pi.copy(e.center).sub(Mr))),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 nn=new O,Er=new O,Ni=new O,dn=new O,Tr=new O,Fi=new O,yr=new O;class zl{constructor(e=new O,t=new O(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,nn)),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=nn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(nn.copy(this.origin).addScaledVector(this.direction,t),nn.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Er.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),dn.copy(this.origin).sub(Er);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ni),o=dn.dot(this.direction),c=-dn.dot(Ni),l=dn.lengthSq(),f=Math.abs(1-a*a);let h,d,p,v;if(f>0)if(h=a*c-o,d=a*o-c,v=s*f,h>=0)if(d>=-v)if(d<=v){const x=1/f;h*=x,d*=x,p=h*(h+a*d+2*o)+d*(a*h+d+2*c)+l}else d=s,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*c)+l;else d=-s,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*c)+l;else d<=-v?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-c),s),p=-h*h+d*(d+2*c)+l):d<=v?(h=0,d=Math.min(Math.max(-s,-c),s),p=d*(d+2*c)+l):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-c),s),p=-h*h+d*(d+2*c)+l);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(Er).addScaledVector(Ni,d),p}intersectSphere(e,t){nn.subVectors(e.center,this.origin);const i=nn.dot(this.direction),r=nn.dot(nn)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,c=i+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const 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,c;const l=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),f>=0?(s=(e.min.y-d.y)*f,a=(e.max.y-d.y)*f):(s=(e.max.y-d.y)*f,a=(e.min.y-d.y)*f),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),i>c||o>r)||((o>i||i!==i)&&(i=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,nn)!==null}intersectTriangle(e,t,i,r,s){Tr.subVectors(t,e),Fi.subVectors(i,e),yr.crossVectors(Tr,Fi);let a=this.direction.dot(yr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;dn.subVectors(this.origin,e);const c=o*this.direction.dot(Fi.crossVectors(dn,Fi));if(c<0)return null;const l=o*this.direction.dot(Tr.cross(dn));if(l<0||c+l>a)return null;const f=-o*dn.dot(yr);return f<0?null:this.at(f/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 ht{constructor(e,t,i,r,s,a,o,c,l,f,h,d,p,v,x,m){ht.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,c,l,f,h,d,p,v,x,m)}set(e,t,i,r,s,a,o,c,l,f,h,d,p,v,x,m){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]=c,u[2]=l,u[6]=f,u[10]=h,u[14]=d,u[3]=p,u[7]=v,u[11]=x,u[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ht().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/Xn.setFromMatrixColumn(e,0).length(),s=1/Xn.setFromMatrixColumn(e,1).length(),a=1/Xn.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),c=Math.cos(r),l=Math.sin(r),f=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*f,p=a*h,v=o*f,x=o*h;t[0]=c*f,t[4]=-c*h,t[8]=l,t[1]=p+v*l,t[5]=d-x*l,t[9]=-o*c,t[2]=x-d*l,t[6]=v+p*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*f,p=c*h,v=l*f,x=l*h;t[0]=d+x*o,t[4]=v*o-p,t[8]=a*l,t[1]=a*h,t[5]=a*f,t[9]=-o,t[2]=p*
vendor: 6,045 bytes, line 5
5o-v,t[6]=x+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*f,p=c*h,v=l*f,x=l*h;t[0]=d-x*o,t[4]=-a*h,t[8]=v+p*o,t[1]=p+v*o,t[5]=a*f,t[9]=x-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*f,p=a*h,v=o*f,x=o*h;t[0]=c*f,t[4]=v*l-p,t[8]=d*l+x,t[1]=c*h,t[5]=x*l+d,t[9]=p*l-v,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,p=a*l,v=o*c,x=o*l;t[0]=c*f,t[4]=x-d*h,t[8]=v*h+p,t[1]=h,t[5]=a*f,t[9]=-o*f,t[2]=-l*f,t[6]=p*h+v,t[10]=d-x*h}else if(e.order==="XZY"){const d=a*c,p=a*l,v=o*c,x=o*l;t[0]=c*f,t[4]=-h,t[8]=l*f,t[1]=d*h+x,t[5]=a*f,t[9]=p*h-v,t[2]=v*h-p,t[6]=o*f,t[10]=x*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hl,e,Gl)}lookAt(e,t,i){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),pn.crossVectors(i,wt),pn.lengthSq()===0&&(Math.abs(i.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),pn.crossVectors(i,wt)),pn.normalize(),Oi.crossVectors(wt,pn),r[0]=pn.x,r[4]=Oi.x,r[8]=wt.x,r[1]=pn.y,r[5]=Oi.y,r[9]=wt.y,r[2]=pn.z,r[6]=Oi.z,r[10]=wt.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],c=i[8],l=i[12],f=i[1],h=i[5],d=i[9],p=i[13],v=i[2],x=i[6],m=i[10],u=i[14],b=i[3],y=i[7],T=i[11],w=i[15],R=r[0],D=r[4],N=r[8],E=r[12],M=r[1],P=r[5],z=r[9],H=r[13],X=r[2],Y=r[6],W=r[10],ne=r[14],V=r[3],se=r[7],j=r[11],pe=r[15];return s[0]=a*R+o*M+c*X+l*V,s[4]=a*D+o*P+c*Y+l*se,s[8]=a*N+o*z+c*W+l*j,s[12]=a*E+o*H+c*ne+l*pe,s[1]=f*R+h*M+d*X+p*V,s[5]=f*D+h*P+d*Y+p*se,s[9]=f*N+h*z+d*W+p*j,s[13]=f*E+h*H+d*ne+p*pe,s[2]=v*R+x*M+m*X+u*V,s[6]=v*D+x*P+m*Y+u*se,s[10]=v*N+x*z+m*W+u*j,s[14]=v*E+x*H+m*ne+u*pe,s[3]=b*R+y*M+T*X+w*V,s[7]=b*D+y*P+T*Y+w*se,s[11]=b*N+y*z+T*W+w*j,s[15]=b*E+y*H+T*ne+w*pe,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],c=e[9],l=e[13],f=e[2],h=e[6],d=e[10],p=e[14],v=e[3],x=e[7],m=e[11],u=e[15];return v*(+s*c*h-r*l*h-s*o*d+i*l*d+r*o*p-i*c*p)+x*(+t*c*p-t*l*d+s*a*d-r*a*p+r*l*f-s*c*f)+m*(+t*l*h-t*o*p-s*a*h+i*a*p+s*o*f-i*l*f)+u*(-r*o*f-t*c*h+t*o*d+r*a*h-i*a*d+i*c*f)}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],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],p=e[11],v=e[12],x=e[13],m=e[14],u=e[15],b=h*m*l-x*d*l+x*c*p-o*m*p-h*c*u+o*d*u,y=v*d*l-f*m*l-v*c*p+a*m*p+f*c*u-a*d*u,T=f*x*l-v*h*l+v*o*p-a*x*p-f*o*u+a*h*u,w=v*h*c-f*x*c-v*o*d+a*x*d+f*o*m-a*h*m,R=t*b+i*y+r*T+s*w;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/R;return e[0]=b*D,e[1]=(x*d*s-h*m*s-x*r*p+i*m*p+h*r*u-i*d*u)*D,e[2]=(o*m*s-x*c*s+x*r*l-i*m*l-o*r*u+i*c*u)*D,e[3]=(h*c*s-o*d*s-h*r*l+i*d*l+o*r*p-i*c*p)*D,e[4]=y*D,e[5]=(f*m*s-v*d*s+v*r*p-t*m*p-f*r*u+t*d*u)*D,e[6]=(v*c*s-a*m*s-v*r*l+t*m*l+a*r*u-t*c*u)*D,e[7]=(a*d*s-f*c*s+f*r*l-t*d*l-a*r*p+t*c*p)*D,e[8]=T*D,e[9]=(v*h*s-f*x*s-v*i*p+t*x*p+f*i*u-t*h*u)*D,e[10]=(a*x*s-v*o*s+v*i*l-t*x*l-a*i*u+t*o*u)*D,e[11]=(f*o*s-a*h*s-f*i*l+t*h*l+a*i*p-t*o*p)*D,e[12]=w*D,e[13]=(f*x*r-v*h*r+v*i*d-t*x*d-f*i*m+t*h*m)*D,e[14]=(v*o*r-a*x*r-v*i*c+t*x*c+a*i*m-t*o*m)*D,e[15]=(a*h*r-f*o*r+f*i*c-t*h*c-a*i*d+t*o*d)*D,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,c=e.z,l=s*a,f=s*o;return this.set(l*a+i,l*o-r*c,l*c+r*o,0,l*o+r*c,f*o+i,f*c-r*a,0,l*c-r*o,f*c+r*a,s*c*c+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,c=t._w,l=s+s,f=a+a,h=o+o,d=s*l,p=s*f,v=s*h,x=a*f,m=a*h,u=o*h,b=c*l,y=c*f,T=c*h,w=i.x,R=i.y,D=i.z;return r[0]=(1-(x+u))*w,r[1]=(p+T)*w,r[2]=(v-y)*w,r[3]=0,r[4]=(p-T)*R,r[5]=(1-(d+u))*R,r[6]=(m+b)*R,r[7]=0,r[8]=(v+y)*D,r[9]=(m-b)*D,r[10]=(1-(d+x))*D,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=Xn.set(r[0],r[1],r[2]).length();const a=Xn.set(r[4],r[5],r[6]).length(),o=Xn.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],Gt.copy(this);const l=1/s,f=1/a,h=1/o;return Gt.elements[0]*=l,Gt.elements[1]*=l,Gt.elements[2]*=l,Gt.elements[4]*=f,Gt.elements[5]*=f,Gt.elements[6]*=f,Gt.elements[8]*=h,Gt.elements[9]*=h,Gt.elements[10]*=h,t.setFromRotationMatrix(Gt),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=jt,c=!1){const l=this.elements,f=2*s/(t-e),h=2*s/(i-r),d=(t+e)/(t-e),p=(i+r)/(i-r);let v,x;if(c)v=s/(a-s),x=a*s/(a-s);else if(o===jt)v=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===ar)v=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=f,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10
vendor: 5,631 bytes, line 5
5]=v,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=jt,c=!1){const l=this.elements,f=2/(t-e),h=2/(i-r),d=-(t+e)/(t-e),p=-(i+r)/(i-r);let v,x;if(c)v=1/(a-s),x=a/(a-s);else if(o===jt)v=-2/(a-s),x=-(a+s)/(a-s);else if(o===ar)v=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=f,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=h,l[9]=0,l[13]=p,l[2]=0,l[6]=0,l[10]=v,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 Xn=new O,Gt=new ht,Hl=new O(0,0,0),Gl=new O(1,1,1),pn=new O,Oi=new O,wt=new O,ua=new ht,fa=new bi;class un{constructor(e=0,t=0,i=0,r=un.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],c=r[1],l=r[5],f=r[9],h=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(We(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-f,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-We(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(We(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-We(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(We(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-We(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-f,p),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 ua.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ua,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fa.setFromEuler(this),this.setFromQuaternion(fa,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}}un.DEFAULT_ORDER="XYZ";class vo{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 Vl=0;const ha=new O,qn=new bi,rn=new ht,Bi=new O,mi=new O,kl=new O,Wl=new bi,da=new O(1,0,0),pa=new O(0,1,0),ma=new O(0,0,1),ga={type:"added"},Xl={type:"removed"},Yn={type:"childadded",child:null},br={type:"childremoved",child:null};class Lt extends xn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Vl++}),this.uuid=yi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Lt.DEFAULT_UP.clone();const e=new O,t=new un,i=new bi,r=new O(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 ht},normalMatrix:{value:new Fe}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=Lt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vo,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 5
5setRotationFromMatrix(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(da,e)}rotateY(e){return this.rotateOnAxis(pa,e)}rotateZ(e){return this.rotateOnAxis(ma,e)}translateOnAxis(e,t){return ha.copy(e).applyQuaternion(this.quaternion),this.position.add(ha.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(da,e)}translateY(e){return this.translateOnAxis(pa,e)}translateZ(e){return this.translateOnAxis(ma,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Bi.copy(e):Bi.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(mi,Bi,this.up):rn.lookAt(Bi,mi,this.up),this.quaternion.setFromRotationMatrix(rn),r&&(rn.extractRotation(r.matrixWorld),qn.setFromRotationMatrix(rn),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(ga),Yn.child=e,this.dispatchEvent(Yn),Yn.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(Xl),br.child=e,this.dispatchEvent(br),br.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),rn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(rn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ga),Yn.child=e,this.dispatchEvent(Yn),Yn.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(mi,e,kl),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,Wl,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: 7,131 bytes, line 5
5):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,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,f=c.length;l<f;l++){const h=c[l];s(e.shapes,h)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];r.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),f=a(e.images),h=a(e.shapes),d=a(e.skeletons),p=a(e.animations),v=a(e.nodes);o.length>0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),f.length>0&&(i.images=f),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),v.length>0&&(i.nodes=v)}return i.object=r,i;function a(o){const c=[];for(const l in o){const f=o[l];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.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}}Lt.DEFAULT_UP=new O(0,1,0);Lt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Vt=new O,sn=new O,Ar=new O,an=new O,Kn=new O,$n=new O,_a=new O,Rr=new O,Cr=new O,wr=new O,Pr=new ut,Dr=new ut,Lr=new ut;class kt{constructor(e=new O,t=new O,i=new O){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Vt.subVectors(e,t),r.cross(Vt);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){Vt.subVectors(r,t),sn.subVectors(i,t),Ar.subVectors(e,t);const a=Vt.dot(Vt),o=Vt.dot(sn),c=Vt.dot(Ar),l=sn.dot(sn),f=sn.dot(Ar),h=a*l-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,p=(l*c-o*f)*d,v=(a*f-o*c)*d;return s.set(1-p-v,v,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,an)===null?!1:an.x>=0&&an.y>=0&&an.x+an.y<=1}static getInterpolation(e,t,i,r,s,a,o,c){return this.getBarycoord(e,t,i,r,an)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,an.x),c.addScaledVector(a,an.y),c.addScaledVector(o,an.z),c)}static getInterpolatedAttribute(e,t,i,r,s,a){return Pr.setScalar(0),Dr.setScalar(0),Lr.setScalar(0),Pr.fromBufferAttribute(e,t),Dr.fromBufferAttribute(e,i),Lr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Pr,s.x),a.addScaledVector(Dr,s.y),a.addScaledVector(Lr,s.z),a}static isFrontFacing(e,t,i,r){return Vt.subVectors(i,t),sn.subVectors(e,t),Vt.cross(sn).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 Vt.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),Vt.cross(sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return kt.getInterpolation(e,this.a,this.b,this.c,t,i,r,s
vendor: 10,611 bytes, line 5
5)}containsPoint(e){return kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kt.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;Kn.subVectors(r,i),$n.subVectors(s,i),Rr.subVectors(e,i);const c=Kn.dot(Rr),l=$n.dot(Rr);if(c<=0&&l<=0)return t.copy(i);Cr.subVectors(e,r);const f=Kn.dot(Cr),h=$n.dot(Cr);if(f>=0&&h<=f)return t.copy(r);const d=c*h-f*l;if(d<=0&&c>=0&&f<=0)return a=c/(c-f),t.copy(i).addScaledVector(Kn,a);wr.subVectors(e,s);const p=Kn.dot(wr),v=$n.dot(wr);if(v>=0&&p<=v)return t.copy(s);const x=p*l-c*v;if(x<=0&&l>=0&&v<=0)return o=l/(l-v),t.copy(i).addScaledVector($n,o);const m=f*v-p*h;if(m<=0&&h-f>=0&&p-v>=0)return _a.subVectors(s,r),o=(h-f)/(h-f+(p-v)),t.copy(r).addScaledVector(_a,o);const u=1/(m+x+d);return a=x*u,o=d*u,t.copy(i).addScaledVector(Kn,a).addScaledVector($n,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const xo={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},zi={h:0,s:0,l:0};function Ur(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 Ze{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,qe.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=qe.workingColorSpace){return this.r=e,this.g=t,this.b=i,qe.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=qe.workingColorSpace){if(e=wl(e,1),t=We(t,0,1),i=We(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=Ur(a,s,e+1/3),this.g=Ur(a,s,e),this.b=Ur(a,s,e-1/3)}return qe.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=xo[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=ln(e.r),this.g=ln(e.g),this.b=ln(e.b),this}copyLinearToSRGB(e){return this.r=ni(e.r),this.g=ni(e.g),this.b=ni(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ct){return qe.workingToColorSpace(St.copy(this),e),Math.round(We(St.r*255,0,255))*65536+Math.round(We(St.g*255,0,255))*256+Math.round(We(St.b*255,0,255))}getHexString(e=ct){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qe.workingColorSpace){qe.workingToColorSpace(St.copy(this),t);const i=St.r,r=St.g,s=St.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let c,l;const f=(o+a)/2;if(o===a)c=0,l=0;else{const h=a-o;switch(l=f<=.5?h/(a+o):h/(2-a-o),a){case i:c=(r-s)/h+(r<s?6:0);break;case r:c=(s-i)/h+2;break;case s:c=(i-r)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=f,e}getRGB(e,t=qe.workingColorSpace){return qe.workingToColorSpace(St.copy(this),t),e.r=St.r,e.g=St.g,e.b=St.b,e}getStyle(e=ct){qe.workingToColorSpace(St.copy(this),e);const t=St.r,i=St.g,r=St.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(zi);const i=mr(mn.h,zi.h,t),r=mr(mn.s,zi.s,t),s=mr(mn.l,zi.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 St=new Ze;Ze.NAMES=xo;let ql=0;class ci extends xn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ql++}),this.uuid=yi(),this.name="",this.type="Material",this.blending=ti,this.side=cn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Yr,this.blendDst=Kr,this.blendEquation=Ln,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ze(0,0,0),this.blendAlpha=0,this.depthFunc=ii,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ra,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Hn,this.stencilZFail=Hn,this.stencilZPass=Hn,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,968 bytes, line 5
5i.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.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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!==ti&&(i.blending=this.blending),this.side!==cn&&(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!==Yr&&(i.blendSrc=this.blendSrc),this.blendDst!==Kr&&(i.blendDst=this.blendDst),this.blendEquation!==Ln&&(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!==ii&&(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!==ra&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Hn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Hn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Hn&&(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 c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(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 So extends ci{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ze(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 un,this.combine=ro,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 ft=new O,Hi=new ze;let Yl=0;class Ot{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:Yl++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=sa,this.updateRanges=[],this.gpuType=Zt,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++)Hi.fromBufferAttribute(this,t),Hi.applyMatrix3(e),this.setXY(t,Hi.x,Hi.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)ft.fromBufferAttribute(this,t),ft.applyMatrix3(e),this.setXYZ(t,ft.x,ft.y,ft.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ft.fromBufferAttribute(this,t),ft.applyMatrix4(e),this.setXYZ(t,ft.x,ft.y,ft.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ft.fromBufferAttribute(this,t),ft.applyNormalMatrix(e),this.setXYZ(t,ft.x,ft.y,ft.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ft.fromBufferAttribute(this,t),ft.transformDirection(e),this.setXYZ(t,ft.x,ft.y,ft.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=hi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=bt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=hi(t,this.array)),t}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=hi(t,this.array)),t}setY(e,t){return this.normalized&&(t=bt(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=hi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bt(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=hi(t,this.array)),t}setW(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),i=bt(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=bt(t,this.array),i=bt(i,this.array),r=bt(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=bt(t,this.array),i=bt(i,this.array),r=bt(r,this.array),s=bt(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 5
5onUpload(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!==sa&&(e.usage=this.usage),e}}class Mo extends Ot{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Eo extends Ot{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Fn extends Ot{constructor(e,t,i){super(new Float32Array(e),t,i)}}let Kl=0;const Nt=new ht,Ir=new Lt,Zn=new O,Pt=new Ai,gi=new Ai,mt=new O;class Sn extends xn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Kl++}),this.uuid=yi(),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(go(e)?Eo:Mo)(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 Fe().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 Nt.makeRotationFromQuaternion(e),this.applyMatrix4(Nt),this}rotateX(e){return Nt.makeRotationX(e),this.applyMatrix4(Nt),this}rotateY(e){return Nt.makeRotationY(e),this.applyMatrix4(Nt),this}rotateZ(e){return Nt.makeRotationZ(e),this.applyMatrix4(Nt),this}translate(e,t,i){return Nt.makeTranslation(e,t,i),this.applyMatrix4(Nt),this}scale(e,t,i){return Nt.makeScale(e,t,i),this.applyMatrix4(Nt),this}lookAt(e){return Ir.lookAt(e),Ir.updateMatrix(),this.applyMatrix4(Ir.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zn).negate(),this.translate(Zn.x,Zn.y,Zn.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 Fn(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 Ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new O(-1/0,-1/0,-1/0),new O(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];Pt.setFromBufferAttribute(s),this.morphTargetsRelative?(mt.addVectors(this.boundingBox.min,Pt.min),this.boundingBox.expandByPoint(mt),mt.addVectors(this.boundingBox.max,Pt.max),this.boundingBox.expandByPoint(mt)):(this.boundingBox.expandByPoint(Pt.min),this.boundingBox.expandByPoint(Pt.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 Xs);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 O,1/0);return}if(e){const i=this.boundingSphere.center;if(Pt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gi.setFromBufferAttribute(o),this.morphTargetsRelative?(mt.addVectors(Pt.min,gi.min),Pt.expandByPoint(mt),mt.addVectors(Pt.max,gi.max),Pt.expandByPoint(mt)):(Pt.expandByPoint(gi.min),Pt.expandByPoint(gi.max))}Pt.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;
vendor: 4,205 bytes, line 5
5s++)mt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(mt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,f=o.count;l<f;l++)mt.fromBufferAttribute(o,l),c&&(Zn.fromBufferAttribute(e,l),mt.add(Zn)),r=Math.max(r,i.distanceToSquared(mt))}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 Ot(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let N=0;N<i.count;N++)o[N]=new O,c[N]=new O;const l=new O,f=new O,h=new O,d=new ze,p=new ze,v=new ze,x=new O,m=new O;function u(N,E,M){l.fromBufferAttribute(i,N),f.fromBufferAttribute(i,E),h.fromBufferAttribute(i,M),d.fromBufferAttribute(s,N),p.fromBufferAttribute(s,E),v.fromBufferAttribute(s,M),f.sub(l),h.sub(l),p.sub(d),v.sub(d);const P=1/(p.x*v.y-v.x*p.y);isFinite(P)&&(x.copy(f).multiplyScalar(v.y).addScaledVector(h,-p.y).multiplyScalar(P),m.copy(h).multiplyScalar(p.x).addScaledVector(f,-v.x).multiplyScalar(P),o[N].add(x),o[E].add(x),o[M].add(x),c[N].add(m),c[E].add(m),c[M].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let N=0,E=b.length;N<E;++N){const M=b[N],P=M.start,z=M.count;for(let H=P,X=P+z;H<X;H+=3)u(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const y=new O,T=new O,w=new O,R=new O;function D(N){w.fromBufferAttribute(r,N),R.copy(w);const E=o[N];y.copy(E),y.sub(w.multiplyScalar(w.dot(E))).normalize(),T.crossVectors(R,E);const P=T.dot(c[N])<0?-1:1;a.setXYZW(N,y.x,y.y,y.z,P)}for(let N=0,E=b.length;N<E;++N){const M=b[N],P=M.start,z=M.count;for(let H=P,X=P+z;H<X;H+=3)D(e.getX(H+0)),D(e.getX(H+1)),D(e.getX(H+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 Ot(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const r=new O,s=new O,a=new O,o=new O,c=new O,l=new O,f=new O,h=new O;if(e)for(let d=0,p=e.count;d<p;d+=3){const v=e.getX(d+0),x=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,m),f.subVectors(a,s),h.subVectors(r,s),f.cross(h),o.fromBufferAttribute(i,v),c.fromBufferAttribute(i,x),l.fromBufferAttribute(i,m),o.add(f),c.add(f),l.add(f),i.setXYZ(v,o.x,o.y,o.z),i.setXYZ(x,c.x,c.y,c.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),f.subVectors(a,s),h.subVectors(r,s),f.cross(h),i.setXYZ(d+0,f.x,f.y,f.z),i.setXYZ(d+1,f.x,f.y,f.z),i.setXYZ(d+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)mt.fromBufferAttribute(e,t),mt.normalize(),e.setXYZ(t,mt.x,mt.y,mt.z)}toNonIndexed(){function e(o,c){const l=o.array,f=o.itemSize,h=o.normalized,d=new l.constructor(c.length*f);let p=0,v=0;for(let x=0,m=c.length;x<m;x++){o.isInterleavedBufferAttribute?p=c[x]*o.data.stride+o.offset:p=c[x]*f;for(let u=0;u<f;u++)d[v++]=l[p++]}return new Ot(d,f,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Sn,i=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,i);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let f=0,h=l.length;f<h;f++){const d=l[f],p=e(d,i);c.push(p)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 4,134 bytes, line 5
5if(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 c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],f=[];for(let h=0,d=l.length;h<d;h++){const p=l[h];f.push(p.toJSON(e.data))}f.length>0&&(r[c]=f,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 l in r){const f=r[l];this.setAttribute(l,f.clone(t))}const s=e.morphAttributes;for(const l in s){const f=[],h=s[l];for(let d=0,p=h.length;d<p;d++)f.push(h[d].clone(t));this.morphAttributes[l]=f}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,f=a.length;l<f;l++){const h=a[l];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const va=new ht,An=new zl,Gi=new Xs,xa=new O,Vi=new O,ki=new O,Wi=new O,Nr=new O,Xi=new O,Sa=new O,qi=new O;class Xt extends Lt{constructor(e=new Sn,t=new So){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){Xi.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const f=o[c],h=s[c];f!==0&&(Nr.fromBufferAttribute(h,e),a?Xi.addScaledVector(Nr,f):Xi.addScaledVector(Nr.sub(t),f))}t.add(Xi)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Gi.copy(i.boundingSphere),Gi.applyMatrix4(s),An.copy(e.ray).recast(e.near),!(Gi.containsPoint(An.origin)===!1&&(An.intersectSphere(Gi,xa)===null||An.origin.distanceToSquared(xa)>(e.far-e.near)**2))&&(va.copy(s).invert(),An.copy(e.ray).applyMatrix4(va),!(i.boundingBox!==null&&An.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,An)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,f=s.attributes.uv1,h=s.attributes.normal,d=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,x=d.length;v<x;v++){const m=d[v],u=a[m.materialIndex],b=Math.max(m.start,p.start),y=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let T=b,w=y;T<w;T+=3){const R=o.getX(T),D=o.getX(T+1),N=o.getX(T+2);
vendor: 7,410 bytes, lines 5-9
5r=Yi(this,u,e,i,l,f,h,R,D,N),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let m=v,u=x;m<u;m+=3){const b=o.getX(m),y=o.getX(m+1),T=o.getX(m+2);r=Yi(this,a,e,i,l,f,h,b,y,T),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let v=0,x=d.length;v<x;v++){const m=d[v],u=a[m.materialIndex],b=Math.max(m.start,p.start),y=Math.min(c.count,Math.min(m.start+m.count,p.start+p.count));for(let T=b,w=y;T<w;T+=3){const R=T,D=T+1,N=T+2;r=Yi(this,u,e,i,l,f,h,R,D,N),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let m=v,u=x;m<u;m+=3){const b=m,y=m+1,T=m+2;r=Yi(this,a,e,i,l,f,h,b,y,T),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function $l(n,e,t,i,r,s,a,o){let c;if(e.side===gt?c=i.intersectTriangle(a,s,r,!0,o):c=i.intersectTriangle(r,s,a,e.side===cn,o),c===null)return null;qi.copy(o),qi.applyMatrix4(n.matrixWorld);const l=t.ray.origin.distanceTo(qi);return l<t.near||l>t.far?null:{distance:l,point:qi.clone(),object:n}}function Yi(n,e,t,i,r,s,a,o,c,l){n.getVertexPosition(o,Vi),n.getVertexPosition(c,ki),n.getVertexPosition(l,Wi);const f=$l(n,e,t,i,Vi,ki,Wi,Sa);if(f){const h=new O;kt.getBarycoord(Sa,Vi,ki,Wi,h),r&&(f.uv=kt.getInterpolatedAttribute(r,o,c,l,h,new ze)),s&&(f.uv1=kt.getInterpolatedAttribute(s,o,c,l,h,new ze)),a&&(f.normal=kt.getInterpolatedAttribute(a,o,c,l,h,new O),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new O,materialIndex:0};kt.getNormal(Vi,ki,Wi,d.normal),f.face=d,f.barycoord=h}return f}class Ri extends Sn{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 c=[],l=[],f=[],h=[];let d=0,p=0;v("z","y","x",-1,-1,i,t,e,a,s,0),v("z","y","x",1,-1,i,t,-e,a,s,1),v("x","z","y",1,1,e,i,t,r,a,2),v("x","z","y",1,-1,e,i,-t,r,a,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new Fn(l,3)),this.setAttribute("normal",new Fn(f,3)),this.setAttribute("uv",new Fn(h,2));function v(x,m,u,b,y,T,w,R,D,N,E){const M=T/D,P=w/N,z=T/2,H=w/2,X=R/2,Y=D+1,W=N+1;let ne=0,V=0;const se=new O;for(let j=0;j<W;j++){const pe=j*P-H;for(let ce=0;ce<Y;ce++){const He=ce*M-z;se[x]=He*b,se[m]=pe*y,se[u]=X,l.push(se.x,se.y,se.z),se[x]=0,se[m]=0,se[u]=R>0?1:-1,f.push(se.x,se.y,se.z),h.push(ce/D),h.push(1-j/N),ne+=1}}for(let j=0;j<N;j++)for(let pe=0;pe<D;pe++){const ce=d+pe+Y*j,He=d+pe+Y*(j+1),Ke=d+(pe+1)+Y*(j+1),Ge=d+(pe+1)+Y*j;c.push(ce,He,Ge),c.push(He,Ke,Ge),V+=6}o.addGroup(p,V,E),p+=V,d+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ri(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function li(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 Tt(n){const e={};for(let t=0;t<n.length;t++){const i=li(n[t]);for(const r in i)e[r]=i[r]}return e}function Zl(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function To(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:qe.workingColorSpace}const jl={clone:li,merge:Tt};var Jl=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,Ql=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class zt extends ci{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Jl,this.fragmentShader=Ql,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=li(e.uniforms),this.uniformsGroups=Zl(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 yo extends Lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht,this.projectionMatrixInverse=new ht,this.coordinateSystem=jt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.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 gn=new O,Ma=new ze,Ea=new ze;class Ft extends yo{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=Is*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(pr*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,175 bytes, line 9
9getEffectiveFOV(){return Is*2*Math.atan(Math.tan(pr*.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){gn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(gn.x,gn.y).multiplyScalar(-e/gn.z),gn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(gn.x,gn.y).multiplyScalar(-e/gn.z)}getViewSize(e,t){return this.getViewBounds(e,Ma,Ea),t.subVectors(Ea,Ma)}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(pr*.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 c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*i/l,r*=a.width/c,i*=a.height/l}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.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const jn=-90,Jn=1;class ec extends Lt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ft(jn,Jn,e,t);r.layers=this.layers,this.add(r);const s=new Ft(jn,Jn,e,t);s.layers=this.layers,this.add(s);const a=new Ft(jn,Jn,e,t);a.layers=this.layers,this.add(a);const o=new Ft(jn,Jn,e,t);o.layers=this.layers,this.add(o);const c=new Ft(jn,Jn,e,t);c.layers=this.layers,this.add(c);const l=new Ft(jn,Jn,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===jt)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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===ar)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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,f]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const x=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,c),e.setRenderTarget(i,4,r),e.render(t,l),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),e.render(t,f),e.setRenderTarget(h,d,p),e.xr.enabled=v,i.texture.needsPMREMUpdate=!0}}class bo extends vt{constructor(e=[],t=ri,i,r,s,a,o,c,l,f){super(e,t,i,r,s,a,o,c,l,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tc extends Bt{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 bo(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 6,493 bytes, lines 9-44
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new Ri(5,5,5),s=new zt({name:"CubemapFromEquirect",uniforms:li(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:gt,blending:Jt});s.uniforms.tEquirect.value=t;const a=new Xt(r,s),o=t.minFilter;return t.minFilter===Nn&&(t.minFilter=Mt),new ec(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 Ki extends Lt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const nc={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ki,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 Ki,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new O,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new O),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ki,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new O,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new O),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,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const x of e.hand.values()){const m=t.getJointPose(x,i),u=this._getHandJoint(l,x);m!==null&&(u.matrix.fromArray(m.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=m.radius),u.visible=m!==null}const f=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=f.position.distanceTo(h.position),p=.02,v=.005;l.inputState.pinching&&d>p+v?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=p-v&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));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(nc)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Ki;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Ns extends Lt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new un,this.environmentIntensity=1,this.environmentRotation=new un,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 Or=new O,ic=new O,rc=new Fe;class Pn{constructor(e=new O(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: 15,601 bytes, lines 44-107
44setFromCoplanarPoints(e,t,i){const r=Or.subVectors(i,t).cross(ic.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(Or),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||rc.getNormalMatrix(e),r=this.coplanarPoint(Or).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 Rn=new Xs,sc=new ze(.5,.5),$i=new O;class Ao{constructor(e=new Pn,t=new Pn,i=new Pn,r=new Pn,s=new Pn,a=new Pn){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=jt,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],f=s[4],h=s[5],d=s[6],p=s[7],v=s[8],x=s[9],m=s[10],u=s[11],b=s[12],y=s[13],T=s[14],w=s[15];if(r[0].setComponents(l-a,p-f,u-v,w-b).normalize(),r[1].setComponents(l+a,p+f,u+v,w+b).normalize(),r[2].setComponents(l+o,p+h,u+x,w+y).normalize(),r[3].setComponents(l-o,p-h,u-x,w-y).normalize(),i)r[4].setComponents(c,d,m,T).normalize(),r[5].setComponents(l-c,p-d,u-m,w-T).normalize();else if(r[4].setComponents(l-c,p-d,u-m,w-T).normalize(),t===jt)r[5].setComponents(l+c,p+d,u+m,w+T).normalize();else if(t===ar)r[5].setComponents(c,d,m,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Rn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rn)}intersectsSprite(e){Rn.center.set(0,0,0);const t=sc.distanceTo(e.center);return Rn.radius=.7071067811865476+t,Rn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rn)}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($i.x=r.normal.x>0?e.max.x:e.min.x,$i.y=r.normal.y>0?e.max.y:e.min.y,$i.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint($i)<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 vi extends vt{constructor(e,t,i=Bn,r,s,a,o=qt,c=qt,l,f=Si,h=1){if(f!==Si&&f!==oi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:h};super(d,r,s,a,o,c,f,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ws(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 Ro extends vt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ci extends Sn{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),c=Math.floor(r),l=o+1,f=c+1,h=e/o,d=t/c,p=[],v=[],x=[],m=[];for(let u=0;u<f;u++){const b=u*d-a;for(let y=0;y<l;y++){const T=y*h-s;v.push(T,-b,0),x.push(0,0,1),m.push(y/o),m.push(1-u/c)}}for(let u=0;u<c;u++)for(let b=0;b<o;b++){const y=b+l*u,T=b+l*(u+1),w=b+1+l*(u+1),R=b+1+l*u;p.push(y,T,R),p.push(T,w,R)}this.setIndex(p),this.setAttribute("position",new Fn(v,3)),this.setAttribute("normal",new Fn(x,3)),this.setAttribute("uv",new Fn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ci(e.width,e.height,e.widthSegments,e.heightSegments)}}class ac extends ci{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ti,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 oc extends ci{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 qs extends yo{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=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,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=f*this.view.offsetY,c=o-f*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class lc extends Ft{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class cc{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 Ta(n,e,t,i){const r=uc(i);switch(t){case uo:return n*e;case ho:return n*e/r.components*r.byteLength;case Gs:return n*e/r.components*r.byteLength;case po:return n*e*2/r.components*r.byteLength;case Vs:return n*e*2/r.components*r.byteLength;case fo:return n*e*3/r.components*r.byteLength;case Wt:return n*e*4/r.components*r.byteLength;case ks:return n*e*4/r.components*r.byteLength;case Qi:case er:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case tr:case nr:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case as:case ls:return Math.max(n,16)*Math.max(e,8)/4;case ss:case os:return Math.max(n,8)*Math.max(e,8)/2;case cs:case us:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case fs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case hs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ds:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case ps:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case ms:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case gs:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case _s:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case vs:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case xs:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ss:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Ms:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Es:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Ts:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ys:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case bs:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case As:case Rs:case Cs:return Math.ceil(n/4)*Math.ceil(e/4)*16;case ws:case Ps:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Ds:case Ls:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function uc(n){switch(n){case At:case ao:return{byteLength:1,components:1};case xi:case oo:case Ei:return{byteLength:2,components:1};case zs:case Hs:return{byteLength:2,components:4};case Bn:case Bs:case Zt:return{byteLength:4,components:1};case lo:case co:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:lr}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=lr);/** 45 * @license 46 * Copyright 2010-2025 Three.js Authors 47 * SPDX-License-Identifier: MIT 48 */function Co(){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 fc(n){const e=new WeakMap;function t(o,c){const l=o.array,f=o.usage,h=l.byteLength,d=n.createBuffer();n.bindBuffer(c,d),n.bufferData(c,l,f),o.onUploadCallback();let p;if(l instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)p=n.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(l instanceof Int16Array)p=n.SHORT;else if(l instanceof Uint32Array)p=n.UNSIGNED_INT;else if(l instanceof Int32Array)p=n.INT;else if(l instanceof Int8Array)p=n.BYTE;else if(l instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:p,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:h}}function i(o,c,l){const f=c.array,h=c.updateRanges;if(n.bindBuffer(l,o),h.length===0)n.bufferSubData(l,0,f);else{h.sort((p,v)=>p.start-v.start);let d=0;for(let p=1;p<h.length;p++){const v=h[d],x=h[p];x.start<=v.start+v.count+1?v.count=Math.max(v.count,x.start+x.count-v.start):(++d,h[d]=x)}h.length=d+1;for(let p=0,v=h.length;p<v;p++){const x=h[p];n.bufferSubData(l,x.start*f.BYTES_PER_ELEMENT,f,x.start,x.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(n.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const f=e.get(o);(!f||f.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var hc=`#ifdef USE_ALPHAHASH 49 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 50#endif`,dc=`#ifdef USE_ALPHAHASH 51 const float ALPHA_HASH_SCALE = 0.05; 52 float hash2D( vec2 value ) { 53 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 54 } 55 float hash3D( vec3 value ) { 56 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 57 } 58 float getAlphaHashThreshold( vec3 position ) { 59 float maxDeriv = max( 60 length( dFdx( position.xyz ) ), 61 length( dFdy( position.xyz ) ) 62 ); 63 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 64 vec2 pixScales = vec2( 65 exp2( floor( log2( pixScale ) ) ), 66 exp2( ceil( log2( pixScale ) ) ) 67 ); 68 vec2 alpha = vec2( 69 hash3D( floor( pixScales.x * position.xyz ) ), 70 hash3D( floor( pixScales.y * position.xyz ) ) 71 ); 72 float lerpFactor = fract( log2( pixScale ) ); 73 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 74 float a = min( lerpFactor, 1.0 - lerpFactor ); 75 vec3 cases = vec3( 76 x * x / ( 2.0 * a * ( 1.0 - a ) ), 77 ( x - 0.5 * a ) / ( 1.0 - a ), 78 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 79 ); 80 float threshold = ( x < ( 1.0 - a ) ) 81 ? ( ( x < a ) ? cases.x : cases.y ) 82 : cases.z; 83 return clamp( threshold , 1.0e-6, 1.0 ); 84 } 85#endif`,pc=`#ifdef USE_ALPHAMAP 86 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 87#endif`,mc=`#ifdef USE_ALPHAMAP 88 uniform sampler2D alphaMap; 89#endif`,gc=`#ifdef USE_ALPHATEST 90 #ifdef ALPHA_TO_COVERAGE 91 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 92 if ( diffuseColor.a == 0.0 ) discard; 93 #else 94 if ( diffuseColor.a < alphaTest ) discard; 95 #endif 96#endif`,_c=`#ifdef USE_ALPHATEST 97 uniform float alphaTest; 98#endif`,vc=`#ifdef USE_AOMAP 99 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 100 reflectedLight.indirectDiffuse *= ambientOcclusion; 101 #if defined( USE_CLEARCOAT ) 102 clearcoatSpecularIndirect *= ambientOcclusion; 103 #endif 104 #if defined( USE_SHEEN ) 105 sheenSpecularIndirect *= ambientOcclusion; 106 #endif 107 #if defined( USE_ENVMAP ) && defined( STANDARD )
108 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 109 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 110 #endif 111#endif`,xc=`#ifdef USE_AOMAP 112 uniform sampler2D aoMap; 113 uniform float aoMapIntensity; 114#endif`,Sc=`#ifdef USE_BATCHING 115 #if ! defined( GL_ANGLE_multi_draw ) 116 #define gl_DrawID _gl_DrawID 117 uniform int _gl_DrawID; 118 #endif 119 uniform highp sampler2D batchingTexture; 120 uniform highp usampler2D batchingIdTexture; 121 mat4 getBatchingMatrix( const in float i ) { 122 int size = textureSize( batchingTexture, 0 ).x; 123 int j = int( i ) * 4; 124 int x = j % size; 125 int y = j / size; 126 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 127 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 128 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 129 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 130 return mat4( v1, v2, v3, v4 ); 131 } 132 float getIndirectIndex( const in int i ) { 133 int size = textureSize( batchingIdTexture, 0 ).x; 134 int x = i % size; 135 int y = i / size; 136 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 137 } 138#endif 139#ifdef USE_BATCHING_COLOR 140 uniform sampler2D batchingColorTexture; 141 vec3 getBatchingColor( const in float i ) { 142 int size = textureSize( batchingColorTexture, 0 ).x; 143 int j = int( i ); 144 int x = j % size; 145 int y = j / size; 146 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 147 } 148#endif`,Mc=`#ifdef USE_BATCHING 149 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 150#endif`,Ec=`vec3 transformed = vec3( position ); 151#ifdef USE_ALPHAHASH 152 vPosition = vec3( position ); 153#endif`,Tc=`vec3 objectNormal = vec3( normal ); 154#ifdef USE_TANGENT 155 vec3 objectTangent = vec3( tangent.xyz ); 156#endif`,yc=`float G_BlinnPhong_Implicit( ) { 157 return 0.25; 158} 159float D_BlinnPhong( const in float shininess, const in float dotNH ) { 160 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 161} 162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 163 vec3 halfDir = normalize( lightDir + viewDir ); 164 float dotNH = saturate( dot( normal, halfDir ) ); 165 float dotVH = saturate( dot( viewDir, halfDir ) ); 166 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 167 float G = G_BlinnPhong_Implicit( ); 168 float D = D_BlinnPhong( shininess, dotNH ); 169 return F * ( G * D ); 170} // validated`,bc=`#ifdef USE_IRIDESCENCE 171 const mat3 XYZ_TO_REC709 = mat3( 172 3.2404542, -0.9692660, 0.0556434, 173 -1.5371385, 1.8760108, -0.2040259, 174 -0.4985314, 0.0415560, 1.0572252 175 ); 176 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 177 vec3 sqrtF0 = sqrt( fresnel0 ); 178 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 179 } 180 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 181 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 182 } 183 float IorToFresnel0( float transmittedIor, float incidentIor ) { 184 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 185 } 186 vec3 evalSensitivity( float OPD, vec3 shift ) { 187 float phase = 2.0 * PI * OPD * 1.0e-9; 188 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 189 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 190 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 191 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 192 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 ) ); 193 xyz /= 1.0685e-7; 194 vec3 rgb = XYZ_TO_REC709 * xyz; 195 return rgb; 196 } 197 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 198 vec3 I; 199 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 200 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 201 float cosTheta2Sq = 1.0 - sinTheta2Sq; 202 if ( cosTheta2Sq < 0.0 ) { 203 return vec3( 1.0 ); 204 } 205 float cosTheta2 = sqrt( cosTheta2Sq ); 206 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 208 float T121 = 1.0 - R12; 209 float phi12 = 0.0; 210 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 211 float phi21 = PI - phi12; 212 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 213 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 214 vec3 phi23 = vec3( 0.0 ); 215 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 216 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 217 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 218 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 219 vec3 phi = vec3( phi21 ) + phi23; 220 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 221 vec3 r123 = sqrt( R123 ); 222 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 223 vec3 C0 = R12 + Rs; 224 I = C0; 225 vec3 Cm = Rs - T121; 226 for ( int m = 1; m <= 2; ++ m ) { 227 Cm *= r123; 228 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 229 I += Cm * Sm; 230 } 231 return max( I, vec3( 0.0 ) ); 232 } 233#endif`,Ac=`#ifdef USE_BUMPMAP 234 uniform sampler2D bumpMap; 235 uniform float bumpScale; 236 vec2 dHdxy_fwd() { 237 vec2 dSTdx = dFdx( vBumpMapUv ); 238 vec2 dSTdy = dFdy( vBumpMapUv ); 239 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 240 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 241 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 242 return vec2( dBx, dBy ); 243 } 244 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 245 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 246 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 247 vec3 vN = surf_norm; 248 vec3 R1 = cross( vSigmaY, vN ); 249 vec3 R2 = cross( vN, vSigmaX ); 250 float fDet = dot( vSigmaX, R1 ) * faceDirection; 251 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 252 return normalize( abs( fDet ) * surf_norm - vGrad ); 253 } 254#endif`,Rc=`#if NUM_CLIPPING_PLANES > 0 255 vec4 plane; 256 #ifdef ALPHA_TO_COVERAGE 257 float distanceToPlane, distanceGradient; 258 float clipOpacity = 1.0; 259 #pragma unroll_loop_start 260 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 261 plane = clippingPlanes[ i ]; 262 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 263 distanceGradient = fwidth( distanceToPlane ) / 2.0; 264 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 265 if ( clipOpacity == 0.0 ) discard; 266 } 267 #pragma unroll_loop_end 268 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 269 float unionClipOpacity = 1.0; 270 #pragma unroll_loop_start 271 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 272 plane = clippingPlanes[ i ]; 273 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 274 distanceGradient = fwidth( distanceToPlane ) / 2.0; 275 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 276 } 277 #pragma unroll_loop_end 278 clipOpacity *= 1.0 - unionClipOpacity; 279 #endif 280 diffuseColor.a *= clipOpacity; 281 if ( diffuseColor.a == 0.0 ) discard; 282 #else 283 #pragma unroll_loop_start 284 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 287 } 288 #pragma unroll_loop_end 289 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 290 bool clipped = true; 291 #pragma unroll_loop_start 292 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 293 plane = clippingPlanes[ i ]; 294 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 295 } 296 #pragma unroll_loop_end 297 if ( clipped ) discard; 298 #endif 299 #endif 300#endif`,Cc=`#if NUM_CLIPPING_PLANES > 0 301 varying vec3 vClipPosition; 302 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 303#endif`,wc=`#if NUM_CLIPPING_PLANES > 0 304 varying vec3 vClipPosition; 305#endif`,Pc=`#if NUM_CLIPPING_PLANES > 0 306 vClipPosition = - mvPosition.xyz; 307#endif`,Dc=`#if defined( USE_COLOR_ALPHA ) 308 diffuseColor *= vColor; 309#elif defined( USE_COLOR ) 310 diffuseColor.rgb *= vColor; 311#endif`,Lc=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) 314 varying vec3 vColor; 315#endif`,Uc=`#if defined( USE_COLOR_ALPHA ) 316 varying vec4 vColor; 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 varying vec3 vColor; 319#endif`,Ic=`#if defined( USE_COLOR_ALPHA ) 320 vColor = vec4( 1.0 ); 321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 322 vColor = vec3( 1.0 ); 323#endif 324#ifdef USE_COLOR 325 vColor *= color; 326#endif 327#ifdef USE_INSTANCING_COLOR 328 vColor.xyz *= instanceColor.xyz; 329#endif 330#ifdef USE_BATCHING_COLOR 331 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 332 vColor.xyz *= batchingColor.xyz; 333#endif`,Nc=`#define PI 3.141592653589793 334#define PI2 6.283185307179586 335#define PI_HALF 1.5707963267948966 336#define RECIPROCAL_PI 0.3183098861837907 337#define RECIPROCAL_PI2 0.15915494309189535 338#define EPSILON 1e-6 339#ifndef saturate 340#define saturate( a ) clamp( a, 0.0, 1.0 ) 341#endif 342#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 343float pow2( const in float x ) { return x*x; } 344vec3 pow2( const in vec3 x ) { return x*x; } 345float pow3( const in float x ) { return x*x*x; } 346float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 349highp float rand( const in vec2 uv ) { 350 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 351 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 352 return fract( sin( sn ) * c ); 353} 354#ifdef HIGH_PRECISION 355 float precisionSafeLength( vec3 v ) { return length( v ); } 356#else 357 float precisionSafeLength( vec3 v ) { 358 float maxComponent = max3( abs( v ) ); 359 return length( v / maxComponent ) * maxComponent; 360 } 361#endif 362struct IncidentLight { 363 vec3 color; 364 vec3 direction; 365 bool visible; 366}; 367struct ReflectedLight { 368 vec3 directDiffuse; 369 vec3 directSpecular; 370 vec3 indirectDiffuse; 371 vec3 indirectSpecular; 372}; 373#ifdef USE_ALPHAHASH 374 varying vec3 vPosition; 375#endif 376vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 377 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 378} 379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 381} 382mat3 transposeMat3( const in mat3 m ) { 383 mat3 tmp; 384 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 385 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 386 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 387 return tmp; 388} 389bool isPerspectiveMatrix( mat4 m ) { 390 return m[ 2 ][ 3 ] == - 1.0; 391} 392vec2 equirectUv( in vec3 dir ) { 393 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 394 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 395 return vec2( u, v ); 396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 398 return RECIPROCAL_PI * diffuseColor; 399} 400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} 404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 405 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 406 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 407} // validated`,Fc=`#ifdef ENVMAP_TYPE_CUBE_UV 408 #define cubeUV_minMipLevel 4.0 409 #define cubeUV_minTileSize 16.0 410 float getFace( vec3 direction ) { 411 vec3 absDirection = abs( direction ); 412 float face = - 1.0; 413 if ( absDirection.x > absDirection.z ) { 414 if ( absDirection.x > absDirection.y ) 415 face = direction.x > 0.0 ? 0.0 : 3.0; 416 else 417 face = direction.y > 0.0 ? 1.0 : 4.0; 418 } else { 419 if ( absDirection.z > absDirection.y ) 420 face = direction.z > 0.0 ? 2.0 : 5.0; 421 else 422 face = direction.y > 0.0 ? 1.0 : 4.0; 423 } 424 return face; 425 } 426 vec2 getUV( vec3 direction, float face ) { 427 vec2 uv; 428 if ( face == 0.0 ) { 429 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 430 } else if ( face == 1.0 ) { 431 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 432 } else if ( face == 2.0 ) { 433 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 434 } else if ( face == 3.0 ) { 435 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 436 } else if ( face == 4.0 ) { 437 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 438 } else { 439 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 440 } 441 return 0.5 * ( uv + 1.0 ); 442 } 443 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 444 float face = getFace( direction ); 445 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 446 mipInt = max( mipInt, cubeUV_minMipLevel ); 447 float faceSize = exp2( mipInt ); 448 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 449 if ( face > 2.0 ) { 450 uv.y += faceSize; 451 face -= 3.0; 452 } 453 uv.x += face * faceSize; 454 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 455 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 456 uv.x *= CUBEUV_TEXEL_WIDTH; 457 uv.y *= CUBEUV_TEXEL_HEIGHT; 458 #ifdef texture2DGradEXT 459 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 460 #else 461 return texture2D( envMap, uv ).rgb; 462 #endif 463 } 464 #define cubeUV_r0 1.0 465 #define cubeUV_m0 - 2.0 466 #define cubeUV_r1 0.8 467 #define cubeUV_m1 - 1.0 468 #define cubeUV_r4 0.4 469 #define cubeUV_m4 2.0 470 #define cubeUV_r5 0.305 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_m6 4.0 474 float roughnessToMip( float roughness ) { 475 float mip = 0.0; 476 if ( roughness >= cubeUV_r1 ) { 477 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 478 } else if ( roughness >= cubeUV_r4 ) { 479 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 480 } else if ( roughness >= cubeUV_r5 ) { 481 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 482 } else if ( roughness >= cubeUV_r6 ) { 483 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 484 } else { 485 mip = - 2.0 * log2( 1.16 * roughness ); } 486 return mip; 487 } 488 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 489 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 490 float mipF = fract( mip ); 491 float mipInt = floor( mip ); 492 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 493 if ( mipF == 0.0 ) { 494 return vec4( color0, 1.0 ); 495 } else { 496 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 497 return vec4( mix( color0, color1, mipF ), 1.0 ); 498 } 499 } 500#endif`,Oc=`vec3 transformedNormal = objectNormal; 501#ifdef USE_TANGENT 502 vec3 transformedTangent = objectTangent; 503#endif 504#ifdef USE_BATCHING 505 mat3 bm = mat3( batchingMatrix ); 506 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 507 transformedNormal = bm * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = bm * transformedTangent; 510 #endif 511#endif 512#ifdef USE_INSTANCING 513 mat3 im = mat3( instanceMatrix ); 514 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 515 transformedNormal = im * transformedNormal; 516 #ifdef USE_TANGENT 517 transformedTangent = im * transformedTangent; 518 #endif 519#endif 520transformedNormal = normalMatrix * transformedNormal; 521#ifdef FLIP_SIDED 522 transformedNormal = - transformedNormal; 523#endif 524#ifdef USE_TANGENT 525 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 526 #ifdef FLIP_SIDED 527 transformedTangent = - transformedTangent; 528 #endif 529#endif`,Bc=`#ifdef USE_DISPLACEMENTMAP 530 uniform sampler2D displacementMap; 531 uniform float displacementScale; 532 uniform float displacementBias; 533#endif`,zc=`#ifdef USE_DISPLACEMENTMAP 534 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias ); 535#endif`,Hc=`#ifdef USE_EMISSIVEMAP 536 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 537 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 538 emissiveColor = sRGBTransferEOTF( emissiveColor ); 539 #endif 540 totalEmissiveRadiance *= emissiveColor.rgb; 541#endif`,Gc=`#ifdef USE_EMISSIVEMAP 542 uniform sampler2D emissiveMap; 543#endif`,Vc="gl_FragColor = linearToOutputTexel( gl_FragColor );",kc=`vec4 LinearTransferOETF( in vec4 value ) { 544 return value; 545} 546vec4 sRGBTransferEOTF( in vec4 value ) { 547 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 ); 548} 549vec4 sRGBTransferOETF( in vec4 value ) { 550 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 ); 551}`,Wc=`#ifdef USE_ENVMAP 552 #ifdef ENV_WORLDPOS 553 vec3 cameraToFrag; 554 if ( isOrthographic ) { 555 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 556 } else { 557 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 558 } 559 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 560 #ifdef ENVMAP_MODE_REFLECTION 561 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 562 #else 563 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 564 #endif 565 #else 566 vec3 reflectVec = vReflect; 567 #endif 568 #ifdef ENVMAP_TYPE_CUBE 569 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 570 #else 571 vec4 envColor = vec4( 0.0 ); 572 #endif 573 #ifdef ENVMAP_BLENDING_MULTIPLY 574 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 575 #elif defined( ENVMAP_BLENDING_MIX ) 576 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 577 #elif defined( ENVMAP_BLENDING_ADD ) 578 outgoingLight += envColor.xyz * specularStrength * reflectivity; 579 #endif 580#endif`,Xc=`#ifdef USE_ENVMAP 581 uniform float envMapIntensity; 582 uniform float flipEnvMap; 583 uniform mat3 envMapRotation; 584 #ifdef ENVMAP_TYPE_CUBE 585 uniform samplerCube envMap; 586 #else 587 uniform sampler2D envMap; 588 #endif 589 590#endif`,qc=`#ifdef USE_ENVMAP 591 uniform float reflectivity; 592 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 593 #define ENV_WORLDPOS 594 #endif 595 #ifdef ENV_WORLDPOS 596 varying vec3 vWorldPosition; 597 uniform float refractionRatio; 598 #else 599 varying vec3 vReflect; 600 #endif 601#endif`,Yc=`#ifdef USE_ENVMAP 602 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 603 #define ENV_WORLDPOS 604 #endif 605 #ifdef ENV_WORLDPOS 606 607 varying vec3 vWorldPosition; 608 #else 609 varying vec3 vReflect; 610 uniform float refractionRatio; 611 #endif 612#endif`,Kc=`#ifdef USE_ENVMAP 613 #ifdef ENV_WORLDPOS 614 vWorldPosition = worldPosition.xyz; 615 #else 616 vec3 cameraToVertex; 617 if ( isOrthographic ) { 618 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 619 } else {
620 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 621 } 622 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 623 #ifdef ENVMAP_MODE_REFLECTION 624 vReflect = reflect( cameraToVertex, worldNormal ); 625 #else 626 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 627 #endif 628 #endif 629#endif`,$c=`#ifdef USE_FOG 630 vFogDepth = - mvPosition.z; 631#endif`,Zc=`#ifdef USE_FOG 632 varying float vFogDepth; 633#endif`,jc=`#ifdef USE_FOG 634 #ifdef FOG_EXP2 635 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 636 #else 637 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 638 #endif 639 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 640#endif`,Jc=`#ifdef USE_FOG 641 uniform vec3 fogColor; 642 varying float vFogDepth; 643 #ifdef FOG_EXP2 644 uniform float fogDensity; 645 #else 646 uniform float fogNear; 647 uniform float fogFar; 648 #endif 649#endif`,Qc=`#ifdef USE_GRADIENTMAP 650 uniform sampler2D gradientMap; 651#endif 652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 653 float dotNL = dot( normal, lightDirection ); 654 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 655 #ifdef USE_GRADIENTMAP 656 return vec3( texture2D( gradientMap, coord ).r ); 657 #else 658 vec2 fw = fwidth( coord ) * 0.5; 659 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 660 #endif 661}`,eu=`#ifdef USE_LIGHTMAP 662 uniform sampler2D lightMap; 663 uniform float lightMapIntensity; 664#endif`,tu=`LambertMaterial material; 665material.diffuseColor = diffuseColor.rgb; 666material.specularStrength = specularStrength;`,nu=`varying vec3 vViewPosition; 667struct LambertMaterial { 668 vec3 diffuseColor; 669 float specularStrength; 670}; 671void 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 ) { 672 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 673 vec3 irradiance = dotNL * directLight.color; 674 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 675} 676void 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 ) { 677 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 678} 679#define RE_Direct RE_Direct_Lambert 680#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,iu=`uniform bool receiveShadow; 681uniform vec3 ambientLightColor; 682#if defined( USE_LIGHT_PROBES ) 683 uniform vec3 lightProbe[ 9 ]; 684#endif 685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 686 float x = normal.x, y = normal.y, z = normal.z; 687 vec3 result = shCoefficients[ 0 ] * 0.886227; 688 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 689 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 690 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 691 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 692 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 693 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 694 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 695 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 696 return result; 697} 698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 699 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 700 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 701 return irradiance; 702} 703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 704 vec3 irradiance = ambientLightColor; 705 return irradiance; 706} 707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 708 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 709 if ( cutoffDistance > 0.0 ) { 710 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 711 } 712 return distanceFalloff; 713} 714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 715 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 716} 717#if NUM_DIR_LIGHTS > 0 718 struct DirectionalLight { 719 vec3 direction; 720 vec3 color; 721 }; 722 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 723 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 724 light.color = directionalLight.color; 725 light.direction = directionalLight.direction; 726 light.visible = true; 727 } 728#endif 729#if NUM_POINT_LIGHTS > 0 730 struct PointLight { 731 vec3 position; 732 vec3 color; 733 float distance; 734 float decay; 735 }; 736 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 737 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 738 vec3 lVector = pointLight.position - geometryPosition; 739 light.direction = normalize( lVector ); 740 float lightDistance = length( lVector ); 741 light.color = pointLight.color; 742 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 743 light.visible = ( light.color != vec3( 0.0 ) ); 744 } 745#endif
746#if NUM_SPOT_LIGHTS > 0 747 struct SpotLight { 748 vec3 position; 749 vec3 direction; 750 vec3 color; 751 float distance; 752 float decay; 753 float coneCos; 754 float penumbraCos; 755 }; 756 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 757 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 758 vec3 lVector = spotLight.position - geometryPosition; 759 light.direction = normalize( lVector ); 760 float angleCos = dot( light.direction, spotLight.direction ); 761 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 762 if ( spotAttenuation > 0.0 ) { 763 float lightDistance = length( lVector ); 764 light.color = spotLight.color * spotAttenuation; 765 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 766 light.visible = ( light.color != vec3( 0.0 ) ); 767 } else { 768 light.color = vec3( 0.0 ); 769 light.visible = false; 770 } 771 } 772#endif 773#if NUM_RECT_AREA_LIGHTS > 0 774 struct RectAreaLight { 775 vec3 color; 776 vec3 position; 777 vec3 halfWidth; 778 vec3 halfHeight; 779 }; 780 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 781 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 782#endif 783#if NUM_HEMI_LIGHTS > 0 784 struct HemisphereLight { 785 vec3 direction; 786 vec3 skyColor; 787 vec3 groundColor; 788 }; 789 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 790 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 791 float dotNL = dot( normal, hemiLight.direction ); 792 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 793 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 794 return irradiance; 795 } 796#endif`,ru=`#ifdef USE_ENVMAP 797 vec3 getIBLIrradiance( const in vec3 normal ) { 798 #ifdef ENVMAP_TYPE_CUBE_UV 799 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 800 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 801 return PI * envMapColor.rgb * envMapIntensity; 802 #else 803 return vec3( 0.0 ); 804 #endif 805 } 806 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 807 #ifdef ENVMAP_TYPE_CUBE_UV 808 vec3 reflectVec = reflect( - viewDir, normal ); 809 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 810 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 811 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 812 return envMapColor.rgb * envMapIntensity; 813 #else 814 return vec3( 0.0 ); 815 #endif 816 } 817 #ifdef USE_ANISOTROPY 818 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 819 #ifdef ENVMAP_TYPE_CUBE_UV 820 vec3 bentNormal = cross( bitangent, viewDir ); 821 bentNormal = normalize( cross( bentNormal, bitangent ) ); 822 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 823 return getIBLRadiance( viewDir, bentNormal, roughness ); 824 #else 825 return vec3( 0.0 ); 826 #endif 827 } 828 #endif 829#endif`,su=`ToonMaterial material; 830material.diffuseColor = diffuseColor.rgb;`,au=`varying vec3 vViewPosition; 831struct ToonMaterial { 832 vec3 diffuseColor; 833}; 834void 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 ) { 835 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 836 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 837} 838void 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 ) { 839 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 840} 841#define RE_Direct RE_Direct_Toon 842#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ou=`BlinnPhongMaterial material; 843material.diffuseColor = diffuseColor.rgb; 844material.specularColor = specular; 845material.specularShininess = shininess; 846material.specularStrength = specularStrength;`,lu=`varying vec3 vViewPosition; 847struct BlinnPhongMaterial { 848 vec3 diffuseColor; 849 vec3 specularColor; 850 float specularShininess; 851 float specularStrength; 852}; 853void 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 ) {
854 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 855 vec3 irradiance = dotNL * directLight.color; 856 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 858} 859void 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 ) { 860 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 861} 862#define RE_Direct RE_Direct_BlinnPhong 863#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,cu=`PhysicalMaterial material; 864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 868material.roughness = min( material.roughness, 1.0 ); 869#ifdef IOR 870 material.ior = ior; 871 #ifdef USE_SPECULAR 872 float specularIntensityFactor = specularIntensity; 873 vec3 specularColorFactor = specularColor; 874 #ifdef USE_SPECULAR_COLORMAP 875 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 876 #endif 877 #ifdef USE_SPECULAR_INTENSITYMAP 878 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 879 #endif 880 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 881 #else 882 float specularIntensityFactor = 1.0; 883 vec3 specularColorFactor = vec3( 1.0 ); 884 material.specularF90 = 1.0; 885 #endif 886 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 887#else 888 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 889 material.specularF90 = 1.0; 890#endif 891#ifdef USE_CLEARCOAT 892 material.clearcoat = clearcoat; 893 material.clearcoatRoughness = clearcoatRoughness; 894 material.clearcoatF0 = vec3( 0.04 ); 895 material.clearcoatF90 = 1.0; 896 #ifdef USE_CLEARCOATMAP 897 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 898 #endif 899 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 900 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 901 #endif 902 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 903 material.clearcoatRoughness += geometryRoughness; 904 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 905#endif 906#ifdef USE_DISPERSION 907 material.dispersion = dispersion; 908#endif 909#ifdef USE_IRIDESCENCE 910 material.iridescence = iridescence; 911 material.iridescenceIOR = iridescenceIOR; 912 #ifdef USE_IRIDESCENCEMAP 913 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 914 #endif 915 #ifdef USE_IRIDESCENCE_THICKNESSMAP 916 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 917 #else 918 material.iridescenceThickness = iridescenceThicknessMaximum; 919 #endif 920#endif 921#ifdef USE_SHEEN 922 material.sheenColor = sheenColor; 923 #ifdef USE_SHEEN_COLORMAP 924 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 925 #endif 926 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 927 #ifdef USE_SHEEN_ROUGHNESSMAP 928 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 929 #endif 930#endif 931#ifdef USE_ANISOTROPY 932 #ifdef USE_ANISOTROPYMAP 933 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 934 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 935 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 936 #else 937 vec2 anisotropyV = anisotropyVector; 938 #endif 939 material.anisotropy = length( anisotropyV ); 940 if( material.anisotropy == 0.0 ) { 941 anisotropyV = vec2( 1.0, 0.0 ); 942 } else { 943 anisotropyV /= material.anisotropy; 944 material.anisotropy = saturate( material.anisotropy ); 945 } 946 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 948 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 949#endif`,uu
vendor: 14,687 bytes, lines 949-1250
949=`struct PhysicalMaterial { 950 vec3 diffuseColor; 951 float roughness; 952 vec3 specularColor; 953 float specularF90; 954 float dispersion; 955 #ifdef USE_CLEARCOAT 956 float clearcoat; 957 float clearcoatRoughness; 958 vec3 clearcoatF0; 959 float clearcoatF90; 960 #endif 961 #ifdef USE_IRIDESCENCE 962 float iridescence; 963 float iridescenceIOR; 964 float iridescenceThickness; 965 vec3 iridescenceFresnel; 966 vec3 iridescenceF0; 967 #endif 968 #ifdef USE_SHEEN 969 vec3 sheenColor; 970 float sheenRoughness; 971 #endif 972 #ifdef IOR 973 float ior; 974 #endif 975 #ifdef USE_TRANSMISSION 976 float transmission; 977 float transmissionAlpha; 978 float thickness; 979 float attenuationDistance; 980 vec3 attenuationColor; 981 #endif 982 #ifdef USE_ANISOTROPY 983 float anisotropy; 984 float alphaT; 985 vec3 anisotropyT; 986 vec3 anisotropyB; 987 #endif 988}; 989vec3 clearcoatSpecularDirect = vec3( 0.0 ); 990vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 991vec3 sheenSpecularDirect = vec3( 0.0 ); 992vec3 sheenSpecularIndirect = vec3(0.0 ); 993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 994 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 995 float x2 = x * x; 996 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 997 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 998} 999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1000 float a2 = pow2( alpha ); 1001 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1002 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1003 return 0.5 / max( gv + gl, EPSILON ); 1004} 1005float D_GGX( const in float alpha, const in float dotNH ) { 1006 float a2 = pow2( alpha ); 1007 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1008 return RECIPROCAL_PI * a2 / pow2( denom ); 1009} 1010#ifdef USE_ANISOTROPY 1011 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 ) { 1012 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1013 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1014 float v = 0.5 / ( gv + gl ); 1015 return saturate(v); 1016 } 1017 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1018 float a2 = alphaT * alphaB; 1019 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1020 highp float v2 = dot( v, v ); 1021 float w2 = a2 / v2; 1022 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1023 } 1024#endif 1025#ifdef USE_CLEARCOAT 1026 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1027 vec3 f0 = material.clearcoatF0; 1028 float f90 = material.clearcoatF90; 1029 float roughness = material.clearcoatRoughness; 1030 float alpha = pow2( roughness ); 1031 vec3 halfDir = normalize( lightDir + viewDir ); 1032 float dotNL = saturate( dot( normal, lightDir ) ); 1033 float dotNV = saturate( dot( normal, viewDir ) ); 1034 float dotNH = saturate( dot( normal, halfDir ) ); 1035 float dotVH = saturate( dot( viewDir, halfDir ) ); 1036 vec3 F = F_Schlick( f0, f90, dotVH ); 1037 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1038 float D = D_GGX( alpha, dotNH ); 1039 return F * ( V * D ); 1040 } 1041#endif 1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1043 vec3 f0 = material.specularColor; 1044 float f90 = material.specularF90; 1045 float roughness = material.roughness; 1046 float alpha = pow2( roughness ); 1047 vec3 halfDir = normalize( lightDir + viewDir ); 1048 float dotNL = saturate( dot( normal, lightDir ) ); 1049 float dotNV = saturate( dot( normal, viewDir ) ); 1050 float dotNH = saturate( dot( normal, halfDir ) ); 1051 float dotVH = saturate( dot( viewDir, halfDir ) ); 1052 vec3 F = F_Schlick( f0, f90, dotVH ); 1053 #ifdef USE_IRIDESCENCE 1054 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1055 #endif 1056 #ifdef USE_ANISOTROPY 1057 float dotTL = dot( material.anisotropyT, lightDir ); 1058 float dotTV = dot( material.anisotropyT, viewDir ); 1059 float dotTH = dot( material.anisotropyT, halfDir ); 1060 float dotBL = dot( material.anisotropyB, lightDir ); 1061 float dotBV = dot( material.anisotropyB, viewDir ); 1062 float dotBH = dot( material.anisotropyB, halfDir ); 1063 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1064 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1065 #else 1066 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1067 float D = D_GGX( alpha, dotNH ); 1068 #endif 1069 return F * ( V * D ); 1070} 1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1072 const float LUT_SIZE = 64.0; 1073 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1074 const float LUT_BIAS = 0.5 / LUT_SIZE; 1075 float dotNV = saturate( dot( N, V ) ); 1076 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1077 uv = uv * LUT_SCALE + LUT_BIAS; 1078 return uv; 1079} 1080float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1081 float l = length( f ); 1082 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1083} 1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1085 float x = dot( v1, v2 ); 1086 float y = abs( x ); 1087 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1088 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1089 float v = a / b; 1090 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1091 return cross( v1, v2 ) * theta_sintheta; 1092} 1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1094 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1095 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1096 vec3 lightNormal = cross( v1, v2 ); 1097 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1098 vec3 T1, T2; 1099 T1 = normalize( V - N * dot( V, N ) ); 1100 T2 = - cross( N, T1 ); 1101 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1102 vec3 coords[ 4 ]; 1103 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1104 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1105 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1106 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1107 coords[ 0 ] = normalize( coords[ 0 ] ); 1108 coords[ 1 ] = normalize( coords[ 1 ] ); 1109 coords[ 2 ] = normalize( coords[ 2 ] ); 1110 coords[ 3 ] = normalize( coords[ 3 ] ); 1111 vec3 vectorFormFactor = vec3( 0.0 ); 1112 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1113 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1114 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1116 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1117 return vec3( result ); 1118} 1119#if defined( USE_SHEEN ) 1120float D_Charlie( float roughness, float dotNH ) { 1121 float alpha = pow2( roughness ); 1122 float invAlpha = 1.0 / alpha; 1123 float cos2h = dotNH * dotNH; 1124 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1125 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1126} 1127float V_Neubelt( float dotNV, float dotNL ) { 1128 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1129} 1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1131 vec3 halfDir = normalize( lightDir + viewDir ); 1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 float dotNH = saturate( dot( normal, halfDir ) ); 1135 float D = D_Charlie( sheenRoughness, dotNH ); 1136 float V = V_Neubelt( dotNV, dotNL ); 1137 return sheenColor * ( D * V ); 1138} 1139#endif 1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 float r2 = roughness * roughness; 1143 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1144 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1145 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1146 return saturate( DG * RECIPROCAL_PI ); 1147} 1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1149 float dotNV = saturate( dot( normal, viewDir ) ); 1150 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1151 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1152 vec4 r = roughness * c0 + c1; 1153 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1154 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1155 return fab; 1156} 1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1158 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1159 return specularColor * fab.x + specularF90 * fab.y; 1160} 1161#ifdef USE_IRIDESCENCE 1162void 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 ) { 1163#else 1164void 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 ) { 1165#endif 1166 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1167 #ifdef USE_IRIDESCENCE 1168 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1169 #else 1170 vec3 Fr = specularColor; 1171 #endif 1172 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1173 float Ess = fab.x + fab.y; 1174 float Ems = 1.0 - Ess; 1175 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1176 singleScatter += FssEss; 1177 multiScatter += Fms * Ems; 1178} 1179#if NUM_RECT_AREA_LIGHTS > 0 1180 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 ) { 1181 vec3 normal = geometryNormal; 1182 vec3 viewDir = geometryViewDir; 1183 vec3 position = geometryPosition; 1184 vec3 lightPos = rectAreaLight.position; 1185 vec3 halfWidth = rectAreaLight.halfWidth; 1186 vec3 halfHeight = rectAreaLight.halfHeight; 1187 vec3 lightColor = rectAreaLight.color; 1188 float roughness = material.roughness; 1189 vec3 rectCoords[ 4 ]; 1190 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1191 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1192 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1193 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1194 vec4 t1 = texture2D( ltc_1, uv ); 1195 vec4 t2 = texture2D( ltc_2, uv ); 1196 mat3 mInv = mat3( 1197 vec3( t1.x, 0, t1.y ), 1198 vec3( 0, 1, 0 ), 1199 vec3( t1.z, 0, t1.w ) 1200 ); 1201 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1202 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1203 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1204 } 1205#endif 1206void 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 ) { 1207 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1208 vec3 irradiance = dotNL * directLight.color; 1209 #ifdef USE_CLEARCOAT 1210 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1211 vec3 ccIrradiance = dotNLcc * directLight.color; 1212 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1213 #endif 1214 #ifdef USE_SHEEN 1215 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1216 #endif 1217 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1218 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1219} 1220void 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 ) { 1221 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1222} 1223void 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) { 1224 #ifdef USE_CLEARCOAT 1225 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1226 #endif 1227 #ifdef USE_SHEEN 1228 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1229 #endif 1230 vec3 singleScattering = vec3( 0.0 ); 1231 vec3 multiScattering = vec3( 0.0 ); 1232 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1233 #ifdef USE_IRIDESCENCE 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1237 #endif 1238 vec3 totalScattering = singleScattering + multiScattering; 1239 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1240 reflectedLight.indirectSpecular += radiance * singleScattering; 1241 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1242 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1243} 1244#define RE_Direct RE_Direct_Physical 1245#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1246#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1247#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1249 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1250}`,
1250fu=` 1251vec3 geometryPosition = - vViewPosition; 1252vec3 geometryNormal = normal; 1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1254vec3 geometryClearcoatNormal = vec3( 0.0 ); 1255#ifdef USE_CLEARCOAT 1256 geometryClearcoatNormal = clearcoatNormal; 1257#endif 1258#ifdef USE_IRIDESCENCE 1259 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1260 if ( material.iridescenceThickness == 0.0 ) { 1261 material.iridescence = 0.0; 1262 } else { 1263 material.iridescence = saturate( material.iridescence ); 1264 } 1265 if ( material.iridescence > 0.0 ) { 1266 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1267 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1268 } 1269#endif 1270IncidentLight directLight; 1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1272 PointLight pointLight; 1273 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1274 PointLightShadow pointLightShadow; 1275 #endif 1276 #pragma unroll_loop_start 1277 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1278 pointLight = pointLights[ i ]; 1279 getPointLightInfo( pointLight, geometryPosition, directLight ); 1280 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1281 pointLightShadow = pointLightShadows[ i ]; 1282 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1283 #endif 1284 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1285 } 1286 #pragma unroll_loop_end 1287#endif 1288#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1289 SpotLight spotLight; 1290 vec4 spotColor; 1291 vec3 spotLightCoord; 1292 bool inSpotLightMap; 1293 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1294 SpotLightShadow spotLightShadow; 1295 #endif 1296 #pragma unroll_loop_start 1297 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1298 spotLight = spotLights[ i ]; 1299 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1300 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1301 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1302 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1303 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1304 #else 1305 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1306 #endif 1307 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1308 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1309 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1310 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1311 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1312 #endif 1313 #undef SPOT_LIGHT_MAP_INDEX 1314 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1315 spotLightShadow = spotLightShadows[ i ]; 1316 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1317 #endif 1318 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1319 } 1320 #pragma unroll_loop_end 1321#endif 1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1323 DirectionalLight directionalLight; 1324 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1325 DirectionalLightShadow directionalLightShadow; 1326 #endif 1327 #pragma unroll_loop_start 1328 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1329 directionalLight = directionalLights[ i ]; 1330 getDirectionalLightInfo( directionalLight, directLight ); 1331 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1332 directionalLightShadow = directionalLightShadows[ i ]; 1333 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1334 #endif 1335 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1336 } 1337 #pragma unroll_loop_end 1338#endif 1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1340 RectAreaLight rectAreaLight; 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1343 rectAreaLight = rectAreaLights[ i ]; 1344 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1345 } 1346 #pragma unroll_loop_end 1347#endif 1348#if defined( RE_IndirectDiffuse ) 1349 vec3 iblIrradiance = vec3( 0.0 ); 1350 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1351 #if defined( USE_LIGHT_PROBES ) 1352 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1353 #endif 1354 #if ( NUM_HEMI_LIGHTS > 0 ) 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1357 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1358 } 1359 #pragma unroll_loop_end 1360 #endif 1361#endif 1362#if defined( RE_IndirectSpecular ) 1363 vec3 radiance = vec3( 0.0 ); 1364 vec3 clearcoatRadiance = vec3( 0.0 ); 1365#endif`,hu=`#if defined( RE_IndirectDiffuse ) 1366 #ifdef USE_LIGHTMAP 1367 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1368 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1369 irradiance += lightMapIrradiance; 1370 #endif 1371 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1372 iblIrradiance += getIBLIrradiance( geometryNormal ); 1373 #endif 1374#endif 1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1376 #ifdef USE_ANISOTROPY 1377 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1378 #else 1379 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1380 #endif 1381 #ifdef USE_CLEARCOAT 1382 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1383 #endif 1384#endif`,du=`#if defined( RE_IndirectDiffuse ) 1385 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1386#endif 1387#if defined( RE_IndirectSpecular ) 1388 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1389#endif`,pu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1390 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1391#endif`,mu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1392 uniform float logDepthBufFC; 1393 varying float vFragDepth; 1394 varying float vIsPerspective; 1395#endif`,gu=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1396 varying float vFragDepth; 1397 varying float vIsPerspective; 1398#endif`,_u=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1399 vFragDepth = 1.0 + gl_Position.w; 1400 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1401#endif`,vu=`#ifdef USE_MAP 1402 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1403 #ifdef DECODE_VIDEO_TEXTURE 1404 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1405 #endif 1406 diffuseColor *= sampledDiffuseColor; 1407#endif`,xu=`#ifdef USE_MAP 1408 uniform sampler2D map; 1409#endif`,Su=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1410 #if defined( USE_POINTS_UV ) 1411 vec2 uv = vUv; 1412 #else 1413 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1414 #endif 1415#endif 1416#ifdef USE_MAP 1417 diffuseColor *= texture2D( map, uv ); 1418#endif 1419#ifdef USE_ALPHAMAP 1420 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1421#endif`,Mu=`#if defined( USE_POINTS_UV ) 1422 varying vec2 vUv; 1423#else 1424 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1425 uniform mat3 uvTransform; 1426 #endif 1427#endif 1428#ifdef USE_MAP 1429 uniform sampler2D map; 1430#endif 1431#ifdef USE_ALPHAMAP 1432 uniform sampler2D alphaMap; 1433#endif`,Eu=`float metalnessFactor = metalness; 1434#ifdef USE_METALNESSMAP 1435 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1436 metalnessFactor *= texelMetalness.b; 1437#endif`,Tu=`#ifdef USE_METALNESSMAP 1438 uniform sampler2D metalnessMap; 1439#endif`,yu=`#ifdef USE_INSTANCING_MORPH 1440 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1441 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1442 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1443 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1444 } 1445#endif`,bu=`#if defined( USE_MORPHCOLORS ) 1446 vColor *= morphTargetBaseInfluence; 1447 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1448 #if defined( USE_COLOR_ALPHA ) 1449 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1450 #elif defined( USE_COLOR ) 1451 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1452 #endif 1453 } 1454#endif`,Au=`#ifdef USE_MORPHNORMALS 1455 objectNormal *= morphTargetBaseInfluence; 1456 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1457 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1458 } 1459#endif`,Ru=`#ifdef USE_MORPHTARGETS 1460 #ifndef USE_INSTANCING_MORPH 1461 uniform float morphTargetBaseInfluence; 1462 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1463 #endif 1464 uniform sampler2DArray morphTargetsTexture; 1465 uniform ivec2 morphTargetsTextureSize; 1466 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1467 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1468 int y = texelIndex / morphTargetsTextureSize.x; 1469 int x = texelIndex - y * morphTargetsTextureSize.x; 1470 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1471 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1472 } 1473#endif`,Cu=`#ifdef USE_MORPHTARGETS 1474 transformed *= morphTargetBaseInfluence; 1475 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1476 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1477 } 1478#endif`,wu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1479#ifdef FLAT_SHADED 1480 vec3 fdx = dFdx( vViewPosition ); 1481 vec3 fdy = dFdy( vViewPosition ); 1482 vec3 normal = normalize( cross( fdx, fdy ) ); 1483#else 1484 vec3 normal = normalize( vNormal ); 1485 #ifdef DOUBLE_SIDED 1486 normal *= faceDirection; 1487 #endif 1488#endif 1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1490 #ifdef USE_TANGENT 1491 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1492 #else 1493 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1494 #if defined( USE_NORMALMAP ) 1495 vNormalMapUv 1496 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1497 vClearcoatNormalMapUv 1498 #else 1499 vUv 1500 #endif 1501 ); 1502 #endif 1503 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1504 tbn[0] *= faceDirection; 1505 tbn[1] *= faceDirection; 1506 #endif 1507#endif 1508#ifdef USE_CLEARCOAT_NORMALMAP 1509 #ifdef USE_TANGENT 1510 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1511 #else 1512 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1513 #endif 1514 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1515 tbn2[0] *= faceDirection; 1516 tbn2[1] *= faceDirection; 1517 #endif 1518#endif 1519vec3 nonPerturbedNormal = normal;`,Pu=`#ifdef USE_NORMALMAP_OBJECTSPACE 1520 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1521 #ifdef FLIP_SIDED 1522 normal = - normal; 1523 #endif 1524 #ifdef DOUBLE_SIDED 1525 normal = normal * faceDirection; 1526 #endif 1527 normal = normalize( normalMatrix * normal ); 1528#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1529 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1530 mapN.xy *= normalScale; 1531 normal = normalize( tbn * mapN ); 1532#elif defined( USE_BUMPMAP )
1533 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1534#endif`,Du=`#ifndef FLAT_SHADED 1535 varying vec3 vNormal; 1536 #ifdef USE_TANGENT 1537 varying vec3 vTangent; 1538 varying vec3 vBitangent; 1539 #endif 1540#endif`,Lu=`#ifndef FLAT_SHADED 1541 varying vec3 vNormal; 1542 #ifdef USE_TANGENT 1543 varying vec3 vTangent; 1544 varying vec3 vBitangent; 1545 #endif 1546#endif`,Uu=`#ifndef FLAT_SHADED 1547 vNormal = normalize( transformedNormal ); 1548 #ifdef USE_TANGENT 1549 vTangent = normalize( transformedTangent ); 1550 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1551 #endif 1552#endif`,Iu=`#ifdef USE_NORMALMAP 1553 uniform sampler2D normalMap; 1554 uniform vec2 normalScale; 1555#endif 1556#ifdef USE_NORMALMAP_OBJECTSPACE 1557 uniform mat3 normalMatrix; 1558#endif 1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1560 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1561 vec3 q0 = dFdx( eye_pos.xyz ); 1562 vec3 q1 = dFdy( eye_pos.xyz ); 1563 vec2 st0 = dFdx( uv.st ); 1564 vec2 st1 = dFdy( uv.st ); 1565 vec3 N = surf_norm; 1566 vec3 q1perp = cross( q1, N ); 1567 vec3 q0perp = cross( N, q0 ); 1568 vec3 T = q1perp * st0.x + q0perp * st1.x; 1569 vec3 B = q1perp * st0.y + q0perp * st1.y; 1570 float det = max( dot( T, T ), dot( B, B ) ); 1571 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1572 return mat3( T * scale, B * scale, N ); 1573 } 1574#endif`,Nu=`#ifdef USE_CLEARCOAT 1575 vec3 clearcoatNormal = nonPerturbedNormal; 1576#endif`,Fu=`#ifdef USE_CLEARCOAT_NORMALMAP 1577 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1578 clearcoatMapN.xy *= clearcoatNormalScale; 1579 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1580#endif`,Ou=`#ifdef USE_CLEARCOATMAP 1581 uniform sampler2D clearcoatMap; 1582#endif 1583#ifdef USE_CLEARCOAT_NORMALMAP 1584 uniform sampler2D clearcoatNormalMap; 1585 uniform vec2 clearcoatNormalScale; 1586#endif 1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1588 uniform sampler2D clearcoatRoughnessMap; 1589#endif`,Bu=`#ifdef USE_IRIDESCENCEMAP 1590 uniform sampler2D iridescenceMap; 1591#endif 1592#ifdef USE_IRIDESCENCE_THICKNESSMAP 1593 uniform sampler2D iridescenceThicknessMap; 1594#endif`,zu=`#ifdef OPAQUE 1595diffuseColor.a = 1.0; 1596#endif 1597#ifdef USE_TRANSMISSION 1598diffuseColor.a *= material.transmissionAlpha; 1599#endif 1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Hu=`vec3 packNormalToRGB( const in vec3 normal ) { 1601 return normalize( normal ) * 0.5 + 0.5; 1602} 1603vec3 unpackRGBToNormal( const in vec3 rgb ) { 1604 return 2.0 * rgb.xyz - 1.0; 1605} 1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1607const float Inv255 = 1. / 255.; 1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1612vec4 packDepthToRGBA( const in float v ) { 1613 if( v <= 0.0 ) 1614 return vec4( 0., 0., 0., 0. ); 1615 if( v >= 1.0 ) 1616 return vec4( 1., 1., 1., 1. ); 1617 float vuf; 1618 float af = modf( v * PackFactors.a, vuf ); 1619 float bf = modf( vuf * ShiftRight8, vuf ); 1620 float gf = modf( vuf * ShiftRight8, vuf ); 1621 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1622} 1623vec3 packDepthToRGB( const in float v ) { 1624 if( v <= 0.0 ) 1625 return vec3( 0., 0., 0. ); 1626 if( v >= 1.0 ) 1627 return vec3( 1., 1., 1. ); 1628 float vuf; 1629 float bf = modf( v * PackFactors.b, vuf ); 1630 float gf = modf( vuf * ShiftRight8, vuf ); 1631 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1632} 1633vec2 packDepthToRG( const in float v ) { 1634 if( v <= 0.0 ) 1635 return vec2( 0., 0. ); 1636 if( v >= 1.0 ) 1637 return vec2( 1., 1. ); 1638 float vuf; 1639 float gf = modf( v * 256., vuf ); 1640 return vec2( vuf * Inv255, gf ); 1641} 1642float unpackRGBAToDepth( const in vec4 v ) { 1643 return dot( v, UnpackFactors4 ); 1644} 1645float unpackRGBToDepth( const in vec3 v ) { 1646 return dot( v, UnpackFactors3 ); 1647} 1648float unpackRGToDepth( const in vec2 v ) { 1649 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1650} 1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1653 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1654} 1655vec2 unpackRGBATo2Half( const in vec4 v ) { 1656 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1657} 1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1659 return ( viewZ + near ) / ( near - far ); 1660} 1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1662 return depth * ( near - far ) - near; 1663} 1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1665 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1666} 1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1668 return ( near * far ) / ( ( far - near ) * depth - far ); 1669}`,Gu=`#ifdef PREMULTIPLIED_ALPHA 1670 gl_FragColor.rgb *= gl_FragColor.a; 1671#endif`,Vu=`vec4 mvPosition = vec4( transformed, 1.0 ); 1672#ifdef USE_BATCHING 1673 mvPosition = batchingMatrix * mvPosition; 1674#endif 1675#ifdef USE_INSTANCING 1676 mvPosition = instanceMatrix * mvPosition; 1677#endif 1678mvPosition = modelViewMatrix * mvPosition; 1679gl_Position = projectionMatrix * mvPosition;`,ku=`#ifdef DITHERING 1680 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1681#endif`,Wu=`#ifdef DITHERING 1682 vec3 dithering( vec3 color ) { 1683 float grid_position = rand( gl_FragCoord.xy ); 1684 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1685 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1686 return color + dither_shift_RGB; 1687 } 1688#endif`,Xu=`float roughnessFactor = roughness; 1689#ifdef USE_ROUGHNESSMAP 1690 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1691 roughnessFactor *= texelRoughness.g; 1692#endif`,qu=`#ifdef USE_ROUGHNESSMAP 1693 uniform sampler2D roughnessMap; 1694#endif`,Yu=`#if NUM_SPOT_LIGHT_COORDS > 0 1695 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1696#endif 1697#if NUM_SPOT_LIGHT_MAPS > 0 1698 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1699#endif 1700#ifdef USE_SHADOWMAP 1701 #if NUM_DIR_LIGHT_SHADOWS > 0 1702 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1703 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1704 struct DirectionalLightShadow { 1705 float shadowIntensity; 1706 float shadowBias; 1707 float shadowNormalBias; 1708 float shadowRadius; 1709 vec2 shadowMapSize; 1710 }; 1711 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1712 #endif 1713 #if NUM_SPOT_LIGHT_SHADOWS > 0 1714 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1715 struct SpotLightShadow { 1716 float shadowIntensity; 1717 float shadowBias; 1718 float shadowNormalBias; 1719 float shadowRadius; 1720 vec2 shadowMapSize; 1721 }; 1722 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 #endif 1724 #if NUM_POINT_LIGHT_SHADOWS > 0 1725 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1726 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1727 struct PointLightShadow { 1728 float shadowIntensity; 1729 float shadowBias; 1730 float shadowNormalBias; 1731 float shadowRadius; 1732 vec2 shadowMapSize; 1733 float shadowCameraNear; 1734 float shadowCameraFar; 1735 }; 1736 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1737 #endif 1738 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1739 float depth = unpackRGBAToDepth( texture2D( depths, uv ) ); 1740 #ifdef USE_REVERSED_DEPTH_BUFFER 1741 return step( depth, compare ); 1742 #else 1743 return step( compare, depth ); 1744 #endif 1745 } 1746 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1747 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1748 } 1749 float VSMShadow( sampler2D shadow, vec2 uv, float compare ) { 1750 float occlusion = 1.0; 1751 vec2 distribution = texture2DDistribution( shadow, uv ); 1752 #ifdef USE_REVERSED_DEPTH_BUFFER 1753 float hard_shadow = step( distribution.x, compare ); 1754 #else 1755 float hard_shadow = step( compare, distribution.x ); 1756 #endif 1757 if ( hard_shadow != 1.0 ) { 1758 float distance = compare - distribution.x
vendor: 6,963 bytes, lines 1758-1889
1758; 1759 float variance = max( 0.00000, distribution.y * distribution.y ); 1760 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 ); 1761 } 1762 return occlusion; 1763 } 1764 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1765 float shadow = 1.0; 1766 shadowCoord.xyz /= shadowCoord.w; 1767 shadowCoord.z += shadowBias; 1768 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1769 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1770 if ( frustumTest ) { 1771 #if defined( SHADOWMAP_TYPE_PCF ) 1772 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1773 float dx0 = - texelSize.x * shadowRadius; 1774 float dy0 = - texelSize.y * shadowRadius; 1775 float dx1 = + texelSize.x * shadowRadius; 1776 float dy1 = + texelSize.y * shadowRadius; 1777 float dx2 = dx0 / 2.0; 1778 float dy2 = dy0 / 2.0; 1779 float dx3 = dx1 / 2.0; 1780 float dy3 = dy1 / 2.0; 1781 shadow = ( 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1791 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1792 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1793 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1794 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1795 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1796 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1798 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1799 ) * ( 1.0 / 17.0 ); 1800 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1801 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1802 float dx = texelSize.x; 1803 float dy = texelSize.y; 1804 vec2 uv = shadowCoord.xy; 1805 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1806 uv -= f * texelSize; 1807 shadow = ( 1808 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1809 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1810 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1811 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1812 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1813 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1814 f.x ) + 1815 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1816 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1817 f.x ) + 1818 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1819 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1820 f.y ) + 1821 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1822 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1823 f.y ) + 1824 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1825 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1826 f.x ), 1827 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1828 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1829 f.x ), 1830 f.y ) 1831 ) * ( 1.0 / 9.0 ); 1832 #elif defined( SHADOWMAP_TYPE_VSM ) 1833 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1834 #else 1835 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1836 #endif 1837 } 1838 return mix( 1.0, shadow, shadowIntensity ); 1839 } 1840 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1841 vec3 absV = abs( v ); 1842 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1843 absV *= scaleToCube; 1844 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1845 vec2 planar = v.xy; 1846 float almostATexel = 1.5 * texelSizeY; 1847 float almostOne = 1.0 - almostATexel; 1848 if ( absV.z >= almostOne ) { 1849 if ( v.z > 0.0 ) 1850 planar.x = 4.0 - v.x; 1851 } else if ( absV.x >= almostOne ) { 1852 float signX = sign( v.x ); 1853 planar.x = v.z * signX + 2.0 * signX; 1854 } else if ( absV.y >= almostOne ) { 1855 float signY = sign( v.y ); 1856 planar.x = v.x + 2.0 * signY + 2.0; 1857 planar.y = v.z * signY - 2.0; 1858 } 1859 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1860 } 1861 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1862 float shadow = 1.0; 1863 vec3 lightToPosition = shadowCoord.xyz; 1864 1865 float lightToPositionLength = length( lightToPosition ); 1866 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1867 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1868 vec3 bd3D = normalize( lightToPosition ); 1869 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1870 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1871 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1872 shadow = ( 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1874 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1875 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1876 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1877 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1878 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1879 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1880 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1881 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1882 ) * ( 1.0 / 9.0 ); 1883 #else 1884 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1885 #endif 1886 } 1887 return mix( 1.0, shadow, shadowIntensity ); 1888 } 1889#endif`,
1889Ku=`#if NUM_SPOT_LIGHT_COORDS > 0 1890 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1891 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1892#endif 1893#ifdef USE_SHADOWMAP 1894 #if NUM_DIR_LIGHT_SHADOWS > 0 1895 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1896 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1897 struct DirectionalLightShadow { 1898 float shadowIntensity; 1899 float shadowBias; 1900 float shadowNormalBias; 1901 float shadowRadius; 1902 vec2 shadowMapSize; 1903 }; 1904 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1905 #endif 1906 #if NUM_SPOT_LIGHT_SHADOWS > 0 1907 struct SpotLightShadow { 1908 float shadowIntensity; 1909 float shadowBias; 1910 float shadowNormalBias; 1911 float shadowRadius; 1912 vec2 shadowMapSize; 1913 }; 1914 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1915 #endif 1916 #if NUM_POINT_LIGHT_SHADOWS > 0 1917 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1918 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1919 struct PointLightShadow { 1920 float shadowIntensity; 1921 float shadowBias; 1922 float shadowNormalBias; 1923 float shadowRadius; 1924 vec2 shadowMapSize; 1925 float shadowCameraNear; 1926 float shadowCameraFar; 1927 }; 1928 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1929 #endif 1930#endif`,$u=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1931 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1932 vec4 shadowWorldPosition; 1933#endif 1934#if defined( USE_SHADOWMAP ) 1935 #if NUM_DIR_LIGHT_SHADOWS > 0 1936 #pragma unroll_loop_start 1937 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1938 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1939 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1940 } 1941 #pragma unroll_loop_end 1942 #endif 1943 #if NUM_POINT_LIGHT_SHADOWS > 0 1944 #pragma unroll_loop_start 1945 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1946 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1947 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1948 } 1949 #pragma unroll_loop_end 1950 #endif 1951#endif 1952#if NUM_SPOT_LIGHT_COORDS > 0 1953 #pragma unroll_loop_start 1954 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1955 shadowWorldPosition = worldPosition; 1956 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1957 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1958 #endif 1959 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1960 } 1961 #pragma unroll_loop_end 1962#endif`,Zu=`float getShadowMask() { 1963 float shadow = 1.0; 1964 #ifdef USE_SHADOWMAP 1965 #if NUM_DIR_LIGHT_SHADOWS > 0 1966 DirectionalLightShadow directionalLight; 1967 #pragma unroll_loop_start 1968 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1969 directionalLight = directionalLightShadows[ i ]; 1970 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1971 } 1972 #pragma unroll_loop_end 1973 #endif 1974 #if NUM_SPOT_LIGHT_SHADOWS > 0 1975 SpotLightShadow spotLight; 1976 #pragma unroll_loop_start 1977 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1978 spotLight = spotLightShadows[ i ]; 1979 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1980 } 1981 #pragma unroll_loop_end 1982 #endif 1983 #if NUM_POINT_LIGHT_SHADOWS > 0 1984 PointLightShadow pointLight; 1985 #pragma unroll_loop_start 1986 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1987 pointLight = pointLightShadows[ i ]; 1988 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1989 } 1990 #pragma unroll_loop_end 1991 #endif 1992 #endif 1993 return shadow; 1994}`,ju=`#ifdef USE_SKINNING 1995 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1996 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1997 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1998 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1999#endif`,Ju=`#ifdef USE_SKINNING 2000 uniform mat4 bindMatrix; 2001 uniform mat4 bindMatrixInverse; 2002 uniform highp sampler2D boneTexture; 2003 mat4 getBoneMatrix( const in float i ) { 2004 int size = textureSize( boneTexture, 0 ).x; 2005 int j = int( i ) * 4; 2006 int x = j % size; 2007 int y = j / size; 2008 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2009 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2010 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2011 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2012 return mat4( v1, v2, v3, v4 ); 2013 } 2014#endif`,Qu=`#ifdef USE_SKINNING 2015 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2016 vec4 skinned = vec4( 0.0 ); 2017 skinned += boneMatX * skinVertex * skinWeight.x; 2018 skinned += boneMatY * skinVertex * skinWeight.y; 2019 skinned += boneMatZ * skinVertex * skinWeight.z; 2020 skinned += boneMatW * skinVertex * skinWeight.w; 2021 transformed = ( bindMatrixInverse * skinned ).xyz; 2022#endif`,ef=`#ifdef USE_SKINNING 2023 mat4 skinMatrix = mat4( 0.0 ); 2024 skinMatrix += skinWeight.x * boneMatX; 2025 skinMatrix += skinWeight.y * boneMatY; 2026 skinMatrix += skinWeight.z * boneMatZ; 2027 skinMatrix += skinWeight.w * boneMatW; 2028 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2029 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2030 #ifdef USE_TANGENT 2031 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2032 #endif 2033#endif`,tf=`float specularStrength; 2034#ifdef USE_SPECULARMAP 2035 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2036 specularStrength = texelSpecular.r; 2037#else 2038 specularStrength = 1.0; 2039#endif`,nf=`#ifdef USE_SPECULARMAP 2040 uniform sampler2D specularMap; 2041#endif`,rf=`#if defined( TONE_MAPPING ) 2042 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2043#endif`,sf=`#ifndef saturate 2044#define saturate( a ) clamp( a, 0.0, 1.0 ) 2045#endif 2046uniform float toneMappingExposure; 2047vec3 LinearToneMapping( vec3 color ) { 2048 return saturate( toneMappingExposure * color ); 2049} 2050vec3 ReinhardToneMapping( vec3 color ) { 2051 color *= toneMappingExposure; 2052 return saturate( color / ( vec3( 1.0 ) + color ) ); 2053} 2054vec3 CineonToneMapping( vec3 color ) { 2055 color *= toneMappingExposure; 2056 color = max( vec3( 0.0 ), color - 0.004 ); 2057 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2058} 2059vec3 RRTAndODTFit( vec3 v ) { 2060 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2061 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2062 return a / b; 2063} 2064vec3 ACESFilmicToneMapping( vec3 color ) { 2065 const mat3 ACESInputMat = mat3( 2066 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2067 vec3( 0.04823, 0.01566, 0.83777 ) 2068 ); 2069 const mat3 ACESOutputMat = mat3( 2070 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2071 vec3( -0.07367, -0.00605, 1.07602 ) 2072 ); 2073 color *= toneMappingExposure / 0.6; 2074 color = ACESInputMat * color; 2075 color = RRTAndODTFit( color ); 2076 color = ACESOutputMat * color; 2077 return saturate( color ); 2078} 2079const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2080 vec3( 1.6605, - 0.1246, - 0.0182 ), 2081 vec3( - 0.5876, 1.1329, - 0.1006 ), 2082 vec3( - 0.0728, - 0.0083, 1.1187 ) 2083); 2084const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2085 vec3( 0.6274, 0.0691, 0.0164 ), 2086 vec3( 0.3293, 0.9195, 0.0880 ), 2087 vec3( 0.0433, 0.0113, 0.8956 ) 2088); 2089vec3 agxDefaultContrastApprox( vec3 x ) { 2090 vec3 x2 = x * x; 2091 vec3 x4 = x2 * x2; 2092 return + 15.5 * x4 * x2 2093 - 40.14 * x4 * x 2094 + 31.96 * x4 2095 - 6.868 * x2 * x 2096 + 0.4298 * x2 2097 + 0.1191 * x 2098 - 0.00232; 2099} 2100vec3 AgXToneMapping( vec3 color ) { 2101 const mat3 AgXInsetMatrix = mat3( 2102 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2103 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2104 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2105 );
2106 const mat3 AgXOutsetMatrix = mat3( 2107 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2108 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2109 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2110 ); 2111 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2112 color *= toneMappingExposure; 2113 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2114 color = AgXInsetMatrix * color; 2115 color = max( color, 1e-10 ); color = log2( color ); 2116 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2117 color = clamp( color, 0.0, 1.0 ); 2118 color = agxDefaultContrastApprox( color ); 2119 color = AgXOutsetMatrix * color; 2120 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2121 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2122 color = clamp( color, 0.0, 1.0 ); 2123 return color; 2124} 2125vec3 NeutralToneMapping( vec3 color ) { 2126 const float StartCompression = 0.8 - 0.04; 2127 const float Desaturation = 0.15; 2128 color *= toneMappingExposure; 2129 float x = min( color.r, min( color.g, color.b ) ); 2130 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2131 color -= offset; 2132 float peak = max( color.r, max( color.g, color.b ) ); 2133 if ( peak < StartCompression ) return color; 2134 float d = 1. - StartCompression; 2135 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2136 color *= newPeak / peak; 2137 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2138 return mix( color, vec3( newPeak ), g ); 2139} 2140vec3 CustomToneMapping( vec3 color ) { return color; }`,af=`#ifdef USE_TRANSMISSION 2141 material.transmission = transmission; 2142 material.transmissionAlpha = 1.0; 2143 material.thickness = thickness; 2144 material.attenuationDistance = attenuationDistance; 2145 material.attenuationColor = attenuationColor; 2146 #ifdef USE_TRANSMISSIONMAP 2147 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2148 #endif 2149 #ifdef USE_THICKNESSMAP 2150 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2151 #endif 2152 vec3 pos = vWorldPosition; 2153 vec3 v = normalize( cameraPosition - pos ); 2154 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2155 vec4 transmitted = getIBLVolumeRefraction( 2156 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2157 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2158 material.attenuationColor, material.attenuationDistance ); 2159 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2160 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2161#endif`,of=`#ifdef USE_TRANSMISSION 2162 uniform float transmission; 2163 uniform float thickness; 2164 uniform float attenuationDistance; 2165 uniform vec3 attenuationColor; 2166 #ifdef USE_TRANSMISSIONMAP 2167 uniform sampler2D transmissionMap; 2168 #endif 2169 #ifdef USE_THICKNESSMAP 2170 uniform sampler2D thicknessMap; 2171 #endif 2172 uniform vec2 transmissionSamplerSize; 2173 uniform sampler2D transmissionSamplerMap; 2174 uniform mat4 modelMatrix; 2175 uniform mat4 projectionMatrix; 2176 varying vec3 vWorldPosition; 2177 float w0( float a ) { 2178 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2179 } 2180 float w1( float a ) { 2181 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2182 } 2183 float w2( float a ){ 2184 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2185 } 2186 float w3( float a ) { 2187 return ( 1.0 / 6.0 ) * ( a * a * a ); 2188 } 2189 float g0( float a ) { 2190 return w0( a ) + w1( a ); 2191 } 2192 float g1( float a ) { 2193 return w2( a ) + w3( a ); 2194 } 2195 float h0( float a ) { 2196 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2197 } 2198 float h1( float a ) { 2199 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2200 } 2201 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2202 uv = uv * texelSize.zw + 0.5; 2203 vec2 iuv = floor( uv ); 2204 vec2 fuv = fract( uv ); 2205 float g0x = g0( fuv.x ); 2206 float g1x = g1( fuv.x ); 2207 float h0x = h0( fuv.x ); 2208 float h1x = h1( fuv.x ); 2209 float h0y = h0( fuv.y ); 2210 float h1y = h1( fuv.y ); 2211 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2212 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2213 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2214 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2215 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2216 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2217 } 2218 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2219 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2220 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2221 vec2 fLodSizeInv = 1.0 / fLodSize; 2222 vec2 cLodSizeInv = 1.0 / cLodSize; 2223 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2224 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2225 return mix( fSample, cSample, fract( lod ) ); 2226 } 2227 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2228 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2229 vec3 modelScale; 2230 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2231 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2232 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2233 return normalize( refractionVector ) * thickness * modelScale; 2234 } 2235 float applyIorToRoughness( const in float roughness, const in float ior ) { 2236 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2237 } 2238 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2239 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2240 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2241 } 2242 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2243 if ( isinf( attenuationDistance ) ) { 2244 return vec3( 1.0 ); 2245 } else { 2246 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2247 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2248 } 2249 } 2250 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2251 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2252 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2253 const in vec3 attenuationColor, const in float attenuationDistance ) { 2254 vec4 transmittedLight; 2255 vec3 transmittance; 2256 #ifdef USE_DISPERSION 2257 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2258 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2259 for ( int i = 0; i < 3; i ++ ) { 2260 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2261 vec3 refractedRayExit = position + transmissionRay; 2262 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2263 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2264 refractionCoords += 1.0; 2265 refractionCoords /= 2.0; 2266 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2267 transmittedLight[ i ] = transmissionSample[ i ]; 2268 transmittedLight.a += transmissionSample.a; 2269 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2270 } 2271 transmittedLight.a /= 3.0; 2272 #else 2273 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2274 vec3 refractedRayExit = position + transmissionRay; 2275 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2276 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2277 refractionCoords += 1.0; 2278 refractionCoords /= 2.0; 2279 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2280 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2281 #endif 2282 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2283 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2284 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2285 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2286 } 2287#endif`,lf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2288 varying vec2 vUv; 2289#endif 2290#ifdef USE_MAP 2291 varying vec2 vMapUv; 2292#endif 2293#ifdef USE_ALPHAMAP
2294 varying vec2 vAlphaMapUv; 2295#endif 2296#ifdef USE_LIGHTMAP 2297 varying vec2 vLightMapUv; 2298#endif 2299#ifdef USE_AOMAP 2300 varying vec2 vAoMapUv; 2301#endif 2302#ifdef USE_BUMPMAP 2303 varying vec2 vBumpMapUv; 2304#endif 2305#ifdef USE_NORMALMAP 2306 varying vec2 vNormalMapUv; 2307#endif 2308#ifdef USE_EMISSIVEMAP 2309 varying vec2 vEmissiveMapUv; 2310#endif 2311#ifdef USE_METALNESSMAP 2312 varying vec2 vMetalnessMapUv; 2313#endif 2314#ifdef USE_ROUGHNESSMAP 2315 varying vec2 vRoughnessMapUv; 2316#endif 2317#ifdef USE_ANISOTROPYMAP 2318 varying vec2 vAnisotropyMapUv; 2319#endif 2320#ifdef USE_CLEARCOATMAP 2321 varying vec2 vClearcoatMapUv; 2322#endif 2323#ifdef USE_CLEARCOAT_NORMALMAP 2324 varying vec2 vClearcoatNormalMapUv; 2325#endif 2326#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2327 varying vec2 vClearcoatRoughnessMapUv; 2328#endif 2329#ifdef USE_IRIDESCENCEMAP 2330 varying vec2 vIridescenceMapUv; 2331#endif 2332#ifdef USE_IRIDESCENCE_THICKNESSMAP 2333 varying vec2 vIridescenceThicknessMapUv; 2334#endif 2335#ifdef USE_SHEEN_COLORMAP 2336 varying vec2 vSheenColorMapUv; 2337#endif 2338#ifdef USE_SHEEN_ROUGHNESSMAP 2339 varying vec2 vSheenRoughnessMapUv; 2340#endif 2341#ifdef USE_SPECULARMAP 2342 varying vec2 vSpecularMapUv; 2343#endif 2344#ifdef USE_SPECULAR_COLORMAP 2345 varying vec2 vSpecularColorMapUv; 2346#endif 2347#ifdef USE_SPECULAR_INTENSITYMAP 2348 varying vec2 vSpecularIntensityMapUv; 2349#endif 2350#ifdef USE_TRANSMISSIONMAP 2351 uniform mat3 transmissionMapTransform; 2352 varying vec2 vTransmissionMapUv; 2353#endif 2354#ifdef USE_THICKNESSMAP 2355 uniform mat3 thicknessMapTransform; 2356 varying vec2 vThicknessMapUv; 2357#endif`,cf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2358 varying vec2 vUv; 2359#endif 2360#ifdef USE_MAP 2361 uniform mat3 mapTransform; 2362 varying vec2 vMapUv; 2363#endif 2364#ifdef USE_ALPHAMAP 2365 uniform mat3 alphaMapTransform; 2366 varying vec2 vAlphaMapUv; 2367#endif 2368#ifdef USE_LIGHTMAP 2369 uniform mat3 lightMapTransform; 2370 varying vec2 vLightMapUv; 2371#endif 2372#ifdef USE_AOMAP 2373 uniform mat3 aoMapTransform; 2374 varying vec2 vAoMapUv; 2375#endif 2376#ifdef USE_BUMPMAP 2377 uniform mat3 bumpMapTransform; 2378 varying vec2 vBumpMapUv; 2379#endif 2380#ifdef USE_NORMALMAP 2381 uniform mat3 normalMapTransform; 2382 varying vec2 vNormalMapUv; 2383#endif 2384#ifdef USE_DISPLACEMENTMAP 2385 uniform mat3 displacementMapTransform; 2386 varying vec2 vDisplacementMapUv; 2387#endif 2388#ifdef USE_EMISSIVEMAP 2389 uniform mat3 emissiveMapTransform; 2390 varying vec2 vEmissiveMapUv; 2391#endif 2392#ifdef USE_METALNESSMAP 2393 uniform mat3 metalnessMapTransform; 2394 varying vec2 vMetalnessMapUv; 2395#endif 2396#ifdef USE_ROUGHNESSMAP 2397 uniform mat3 roughnessMapTransform; 2398 varying vec2 vRoughnessMapUv; 2399#endif 2400#ifdef USE_ANISOTROPYMAP 2401 uniform mat3 anisotropyMapTransform; 2402 varying vec2 vAnisotropyMapUv; 2403#endif 2404#ifdef USE_CLEARCOATMAP 2405 uniform mat3 clearcoatMapTransform; 2406 varying vec2 vClearcoatMapUv; 2407#endif 2408#ifdef USE_CLEARCOAT_NORMALMAP 2409 uniform mat3 clearcoatNormalMapTransform; 2410 varying vec2 vClearcoatNormalMapUv; 2411#endif 2412#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2413 uniform mat3 clearcoatRoughnessMapTransform; 2414 varying vec2 vClearcoatRoughnessMapUv; 2415#endif 2416#ifdef USE_SHEEN_COLORMAP 2417 uniform mat3 sheenColorMapTransform; 2418 varying vec2 vSheenColorMapUv; 2419#endif 2420#ifdef USE_SHEEN_ROUGHNESSMAP 2421 uniform mat3 sheenRoughnessMapTransform; 2422 varying vec2 vSheenRoughnessMapUv; 2423#endif 2424#ifdef USE_IRIDESCENCEMAP 2425 uniform mat3 iridescenceMapTransform; 2426 varying vec2 vIridescenceMapUv; 2427#endif 2428#ifdef USE_IRIDESCENCE_THICKNESSMAP 2429 uniform mat3 iridescenceThicknessMapTransform; 2430 varying vec2 vIridescenceThicknessMapUv; 2431#endif 2432#ifdef USE_SPECULARMAP 2433 uniform mat3 specularMapTransform; 2434 varying vec2 vSpecularMapUv; 2435#endif 2436#ifdef USE_SPECULAR_COLORMAP 2437 uniform mat3 specularColorMapTransform; 2438 varying vec2 vSpecularColorMapUv; 2439#endif 2440#ifdef USE_SPECULAR_INTENSITYMAP 2441 uniform mat3 specularIntensityMapTransform; 2442 varying vec2 vSpecularIntensityMapUv; 2443#endif 2444#ifdef USE_TRANSMISSIONMAP 2445 uniform mat3 transmissionMapTransform; 2446 varying vec2 vTransmissionMapUv; 2447#endif 2448#ifdef USE_THICKNESSMAP 2449 uniform mat3 thicknessMapTransform; 2450 varying vec2 vThicknessMapUv; 2451#endif`,uf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2452 vUv = vec3( uv, 1 ).xy; 2453#endif 2454#ifdef USE_MAP 2455 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2456#endif 2457#ifdef USE_ALPHAMAP 2458 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2459#endif 2460#ifdef USE_LIGHTMAP 2461 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2462#endif 2463#ifdef USE_AOMAP 2464 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2465#endif 2466#ifdef USE_BUMPMAP 2467 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2468#endif 2469#ifdef USE_NORMALMAP 2470 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2471#endif 2472#ifdef USE_DISPLACEMENTMAP 2473 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2474#endif 2475#ifdef USE_EMISSIVEMAP 2476 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2477#endif 2478#ifdef USE_METALNESSMAP 2479 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2480#endif 2481#ifdef USE_ROUGHNESSMAP 2482 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2483#endif 2484#ifdef USE_ANISOTROPYMAP 2485 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2486#endif 2487#ifdef USE_CLEARCOATMAP 2488 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2489#endif 2490#ifdef USE_CLEARCOAT_NORMALMAP 2491 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2492#endif 2493#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2494 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2495#endif
2496#ifdef USE_IRIDESCENCEMAP 2497 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2498#endif 2499#ifdef USE_IRIDESCENCE_THICKNESSMAP 2500 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2501#endif 2502#ifdef USE_SHEEN_COLORMAP 2503 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2504#endif 2505#ifdef USE_SHEEN_ROUGHNESSMAP 2506 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2507#endif 2508#ifdef USE_SPECULARMAP 2509 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2510#endif 2511#ifdef USE_SPECULAR_COLORMAP 2512 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2513#endif 2514#ifdef USE_SPECULAR_INTENSITYMAP 2515 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2516#endif 2517#ifdef USE_TRANSMISSIONMAP 2518 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2519#endif 2520#ifdef USE_THICKNESSMAP 2521 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2522#endif`,ff=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2523 vec4 worldPosition = vec4( transformed, 1.0 ); 2524 #ifdef USE_BATCHING 2525 worldPosition = batchingMatrix * worldPosition; 2526 #endif 2527 #ifdef USE_INSTANCING 2528 worldPosition = instanceMatrix * worldPosition; 2529 #endif 2530 worldPosition = modelMatrix * worldPosition; 2531#endif`;const hf=`varying vec2 vUv; 2532uniform mat3 uvTransform; 2533void main() { 2534 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2535 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2536}`,df=`uniform sampler2D t2D; 2537uniform float backgroundIntensity; 2538varying vec2 vUv; 2539void main() { 2540 vec4 texColor = texture2D( t2D, vUv ); 2541 #ifdef DECODE_VIDEO_TEXTURE 2542 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2543 #endif 2544 texColor.rgb *= backgroundIntensity; 2545 gl_FragColor = texColor; 2546 #include <tonemapping_fragment> 2547 #include <colorspace_fragment> 2548}`,pf=`varying vec3 vWorldDirection; 2549#include <common> 2550void main() { 2551 vWorldDirection = transformDirection( position, modelMatrix ); 2552 #include <begin_vertex> 2553 #include <project_vertex> 2554 gl_Position.z = gl_Position.w; 2555}`,mf=`#ifdef ENVMAP_TYPE_CUBE 2556 uniform samplerCube envMap; 2557#elif defined( ENVMAP_TYPE_CUBE_UV ) 2558 uniform sampler2D envMap; 2559#endif 2560uniform float flipEnvMap; 2561uniform float backgroundBlurriness; 2562uniform float backgroundIntensity; 2563uniform mat3 backgroundRotation; 2564varying vec3 vWorldDirection; 2565#include <cube_uv_reflection_fragment> 2566void main() { 2567 #ifdef ENVMAP_TYPE_CUBE 2568 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2569 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2570 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2571 #else 2572 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2573 #endif 2574 texColor.rgb *= backgroundIntensity; 2575 gl_FragColor = texColor; 2576 #include <tonemapping_fragment> 2577 #include <colorspace_fragment> 2578}`,gf=`varying vec3 vWorldDirection; 2579#include <common> 2580void main() { 2581 vWorldDirection = transformDirection( position, modelMatrix ); 2582 #include <begin_vertex> 2583 #include <project_vertex> 2584 gl_Position.z = gl_Position.w; 2585}`,_f=`uniform samplerCube tCube; 2586uniform float tFlip; 2587uniform float opacity; 2588varying vec3 vWorldDirection; 2589void main() { 2590 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2591 gl_FragColor = texColor; 2592 gl_FragColor.a *= opacity; 2593 #include <tonemapping_fragment> 2594 #include <colorspace_fragment> 2595}`,vf=`#include <common> 2596#include <batching_pars_vertex> 2597#include <uv_pars_vertex> 2598#include <displacementmap_pars_vertex> 2599#include <morphtarget_pars_vertex> 2600#include <skinning_pars_vertex> 2601#include <logdepthbuf_pars_vertex> 2602#include <clipping_planes_pars_vertex> 2603varying vec2 vHighPrecisionZW; 2604void main() { 2605 #include <uv_vertex> 2606 #include <batching_vertex> 2607 #include <skinbase_vertex> 2608 #include <morphinstance_vertex> 2609 #ifdef USE_DISPLACEMENTMAP 2610 #include <beginnormal_vertex> 2611 #include <morphnormal_vertex> 2612 #include <skinnormal_vertex> 2613 #endif 2614 #include <begin_vertex> 2615 #include <morphtarget_vertex> 2616 #include <skinning_vertex> 2617 #include <displacementmap_vertex> 2618 #include <project_vertex> 2619 #include <logdepthbuf_vertex> 2620 #include <clipping_planes_vertex> 2621 vHighPrecisionZW = gl_Position.zw; 2622}`,xf=`#if DEPTH_PACKING == 3200 2623 uniform float opacity; 2624#endif 2625#include <common> 2626#include <packing> 2627#include <uv_pars_fragment> 2628#include <map_pars_fragment> 2629#include <alphamap_pars_fragment> 2630#include <alphatest_pars_fragment> 2631#include <alphahash_pars_fragment> 2632#include <logdepthbuf_pars_fragment> 2633#include <clipping_planes_pars_fragment> 2634varying vec2 vHighPrecisionZW; 2635void main() { 2636 vec4 diffuseColor = vec4( 1.0 ); 2637 #include <clipping_planes_fragment> 2638 #if DEPTH_PACKING == 3200 2639 diffuseColor.a = opacity; 2640 #endif 2641 #include <map_fragment> 2642 #include <alphamap_fragment> 2643 #include <alphatest_fragment> 2644 #include <alphahash_fragment> 2645 #include <logdepthbuf_fragment> 2646 #ifdef USE_REVERSED_DEPTH_BUFFER 2647 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2648 #else 2649 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2650 #endif 2651 #if DEPTH_PACKING == 3200 2652 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2653 #elif DEPTH_PACKING == 3201 2654 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2655 #elif DEPTH_PACKING == 3202 2656 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2657 #elif DEPTH_PACKING == 3203 2658 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2659 #endif 2660}`,Sf=`#define DISTANCE 2661varying vec3 vWorldPosition; 2662#include <common> 2663#include <batching_pars_vertex> 2664#include <uv_pars_vertex> 2665#include <displacementmap_pars_vertex> 2666#include <morphtarget_pars_vertex> 2667#include <skinning_pars_vertex> 2668#include <clipping_planes_pars_vertex> 2669void main() { 2670 #include <uv_vertex> 2671 #include <batching_vertex> 2672 #include <skinbase_vertex> 2673 #include <morphinstance_vertex> 2674 #ifdef USE_DISPLACEMENTMAP 2675 #include <beginnormal_vertex> 2676 #include <morphnormal_vertex> 2677 #include <skinnormal_vertex> 2678 #endif 2679 #include <begin_vertex> 2680 #include <morphtarget_vertex> 2681 #include <skinning_vertex> 2682 #include <displacementmap_vertex> 2683 #include <project_vertex> 2684 #include <worldpos_vertex> 2685 #include <clipping_planes_vertex> 2686 vWorldPosition = worldPosition.xyz; 2687}`,Mf=`#define DISTANCE 2688uniform vec3 referencePosition; 2689uniform float nearDistance; 2690uniform float farDistance; 2691varying vec3 vWorldPosition; 2692#include <common> 2693#include <packing> 2694#include <uv_pars_fragment> 2695#include <map_pars_fragment> 2696#include <alphamap_pars_fragment> 2697#include <alphatest_pars_fragment> 2698#include <alphahash_pars_fragment> 2699#include <clipping_planes_pars_fragment> 2700void main () { 2701 vec4 diffuseColor = vec4( 1.0 ); 2702 #include <clipping_planes_fragment> 2703 #include <map_fragment> 2704 #include <alphamap_fragment> 2705 #include <alphatest_fragment> 2706 #include <alphahash_fragment> 2707 float dist = length( vWorldPosition - referencePosition ); 2708 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2709 dist = saturate( dist ); 2710 gl_FragColor = packDepthToRGBA( dist ); 2711}`,Ef=`varying vec3 vWorldDirection; 2712#include <common> 2713void main() { 2714 vWorldDirection = transformDirection( position, modelMatrix ); 2715 #include <begin_vertex> 2716 #include <project_vertex> 2717}`,Tf=`uniform sampler2D tEquirect; 2718varying vec3 vWorldDirection; 2719#include <common> 2720void main() { 2721 vec3 direction = normalize( vWorldDirection ); 2722 vec2 sampleUV = equirectUv( direction ); 2723 gl_FragColor = texture2D( tEquirect, sampleUV ); 2724 #include <tonemapping_fragment> 2725 #include <colorspace_fragment> 2726}`,yf=`uniform float scale; 2727attribute float lineDistance; 2728varying float vLineDistance; 2729#include <common> 2730#include <uv_pars_vertex> 2731#include <color_pars_vertex> 2732#include <fog_pars_vertex> 2733#include <morphtarget_pars_vertex> 2734#include <logdepthbuf_pars_vertex> 2735#include <clipping_planes_pars_vertex> 2736void main() { 2737 vLineDistance = scale * lineDistance; 2738 #include <uv_vertex> 2739 #include <color_vertex> 2740 #include <morphinstance_vertex> 2741 #include <morphcolor_vertex> 2742 #include <begin_vertex> 2743 #include <morphtarget_vertex> 2744 #include <project_vertex> 2745 #include <logdepthbuf_vertex> 2746 #include <clipping_planes_vertex> 2747 #include <fog_vertex> 2748}`,bf=`uniform vec3 diffuse; 2749uniform float opacity; 2750uniform float dashSize; 2751uniform float totalSize; 2752varying float vLineDistance; 2753#include <common> 2754#include <color_pars_fragment> 2755#include <uv_pars_fragment> 2756#include <map_pars_fragment> 2757#include <fog_pars_fragment> 2758#include <logdepthbuf_pars_fragment> 2759#include <clipping_planes_pars_fragment> 2760void main() { 2761 vec4 diffuseColor = vec4( diffuse, opacity ); 2762 #include <clipping_planes_fragment> 2763 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2764 discard; 2765 } 2766 vec3 outgoingLight = vec3( 0.0 ); 2767 #include <logdepthbuf_fragment> 2768 #include <map_fragment> 2769 #include <color_fragment> 2770 outgoingLight = diffuseColor.rgb; 2771 #include <opaque_fragment> 2772 #include <tonemapping_fragment> 2773 #include <colorspace_fragment> 2774 #include <fog_fragment> 2775 #include <premultiplied_alpha_fragment> 2776}`,Af=`#include <common> 2777#include <batching_pars_vertex> 2778#include <uv_pars_vertex> 2779#include <envmap_pars_vertex> 2780#include <color_pars_vertex> 2781#include <fog_pars_vertex> 2782#include <morphtarget_pars_vertex> 2783#include <skinning_pars_vertex> 2784#include <logdepthbuf_pars_vertex> 2785#include <clipping_planes_pars_vertex> 2786void main() { 2787 #include <uv_vertex> 2788 #include <color_vertex> 2789 #include <morphinstance_vertex> 2790 #include <morphcolor_vertex> 2791 #include <batching_vertex> 2792 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2793 #include <beginnormal_vertex> 2794 #include <morphnormal_vertex> 2795 #include <skinbase_vertex> 2796 #include <skinnormal_vertex> 2797 #include <defaultnormal_vertex> 2798 #endif 2799 #include <begin_vertex> 2800 #include <morphtarget_vertex> 2801 #include <skinning_vertex> 2802 #include <project_vertex> 2803 #include <logdepthbuf_vertex> 2804 #include <clipping_planes_vertex> 2805 #include <worldpos_vertex> 2806 #include <envmap_vertex> 2807 #include <fog_vertex> 2808}`,Rf=`uniform vec3 diffuse; 2809uniform float opacity; 2810#ifndef FLAT_SHADED 2811 varying vec3 vNormal; 2812#endif 2813#include <common> 2814#include <dithering_pars_fragment> 2815#include <color_pars_fragment> 2816#include <uv_pars_fragment> 2817#include <map_pars_fragment> 2818#include <alphamap_pars_fragment> 2819#include <alphatest_pars_fragment> 2820#include <alphahash_pars_fragment> 2821#include <aomap_pars_fragment> 2822#include <lightmap_pars_fragment> 2823#include <envmap_common_pars_fragment> 2824#include <envmap_pars_fragment> 2825#include <fog_pars_fragment> 2826#include <specularmap_pars_fragment> 2827#include <logdepthbuf_pars_fragment> 2828#include <clipping_planes_pars_fragment> 2829void main() { 2830 vec4 diffuseColor = vec4( diffuse, opacity ); 2831 #include <clipping_planes_fragment> 2832 #include <logdepthbuf_fragment> 2833 #include <map_fragment> 2834 #include <color_fragment> 2835 #include <alphamap_fragment> 2836 #include <alphatest_fragment> 2837 #include <alphahash_fragment> 2838 #include <specularmap_fragment> 2839 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2840 #ifdef USE_LIGHTMAP 2841 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2842 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2843 #else 2844 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2845 #endif 2846 #include <aomap_fragment> 2847 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2848 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2849 #include <envmap_fragment> 2850 #include <opaque_fragment> 2851 #include <tonemapping_fragment> 2852 #include <colorspace_fragment> 2853 #include <fog_fragment> 2854 #include <premultiplied_alpha_fragment> 2855 #include <dithering_fragment> 2856}`,Cf=`#define LAMBERT 2857varying vec3 vViewPosition; 2858#include <common> 2859#include <batching_pars_vertex> 2860#include <uv_pars_vertex> 2861#include <displacementmap_pars_vertex> 2862#include <envmap_pars_vertex> 2863#include <color_pars_vertex> 2864#include <fog_pars_vertex> 2865#include <normal_pars_vertex> 2866#include <morphtarget_pars_vertex> 2867#include <skinning_pars_vertex> 2868#include <shadowmap_pars_vertex> 2869#include <logdepthbuf_pars_vertex> 2870#include <clipping_planes_pars_vertex> 2871void main() { 2872 #include <uv_vertex> 2873 #include <color_vertex> 2874 #include <morphinstance_vertex> 2875 #include <morphcolor_vertex> 2876 #include <batching_vertex> 2877 #include <beginnormal_vertex> 2878 #include <morphnormal_vertex> 2879 #include <skinbase_vertex> 2880 #include <skinnormal_vertex> 2881 #include <defaultnormal_vertex> 2882 #include <normal_vertex> 2883 #include <begin_vertex> 2884 #include <morphtarget_vertex> 2885 #include <skinning_vertex> 2886 #include <displacementmap_vertex> 2887 #include <project_vertex> 2888 #include <logdepthbuf_vertex> 2889 #include <clipping_planes_vertex> 2890 vViewPosition = - mvPosition.xyz; 2891 #include <worldpos_vertex> 2892 #include <envmap_vertex> 2893 #include <shadowmap_vertex> 2894 #include <fog_vertex> 2895}`,wf=`#define LAMBERT 2896uniform vec3 diffuse; 2897uniform vec3 emissive; 2898uniform float opacity; 2899#include <common> 2900#include <packing> 2901#include <dithering_pars_fragment> 2902#include <color_pars_fragment> 2903#include <uv_pars_fragment> 2904#include <map_pars_fragment> 2905#include <alphamap_pars_fragment> 2906#include <alphatest_pars_fragment> 2907#include <alphahash_pars_fragment> 2908#include <aomap_pars_fragment> 2909#include <lightmap_pars_fragment> 2910#include <emissivemap_pars_fragment> 2911#include <envmap_common_pars_fragment> 2912#include <envmap_pars_fragment> 2913#include <fog_pars_fragment> 2914#include <bsdfs> 2915#include <lights_pars_begin> 2916#include <normal_pars_fragment> 2917#include <lights_lambert_pars_fragment> 2918#include <shadowmap_pars_fragment> 2919#include <bumpmap_pars_fragment> 2920#include <normalmap_pars_fragment> 2921#include <specularmap_pars_fragment> 2922#include <logdepthbuf_pars_fragment> 2923#include <clipping_planes_pars_fragment> 2924void main() { 2925 vec4 diffuseColor = vec4( diffuse, opacity ); 2926 #include <clipping_planes_fragment> 2927 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2928 vec3 totalEmissiveRadiance = emissive; 2929 #include <logdepthbuf_fragment> 2930 #include <map_fragment> 2931 #include <color_fragment> 2932 #include <alphamap_fragment> 2933 #include <alphatest_fragment> 2934 #include <alphahash_fragment> 2935 #include <specularmap_fragment> 2936 #include <normal_fragment_begin> 2937 #include <normal_fragment_maps> 2938 #include <emissivemap_fragment> 2939 #include <lights_lambert_fragment> 2940 #include <lights_fragment_begin> 2941 #include <lights_fragment_maps> 2942 #include <lights_fragment_end> 2943 #include <aomap_fragment> 2944 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2945 #include <envmap_fragment> 2946 #include <opaque_fragment> 2947 #include <tonemapping_fragment> 2948 #include <colorspace_fragment> 2949 #include <fog_fragment> 2950 #include <premultiplied_alpha_fragment> 2951 #include <dithering_fragment> 2952}`,Pf=`#define MATCAP 2953varying vec3 vViewPosition; 2954#include <common> 2955#include <batching_pars_vertex> 2956#include <uv_pars_vertex> 2957#include <color_pars_vertex> 2958#include <displacementmap_pars_vertex> 2959#include <fog_pars_vertex> 2960#include <normal_pars_vertex> 2961#include <morphtarget_pars_vertex> 2962#include <skinning_pars_vertex> 2963#include <logdepthbuf_pars_vertex> 2964#include <clipping_planes_pars_vertex> 2965void main() { 2966 #include <uv_vertex> 2967 #include <color_vertex> 2968 #include <morphinstance_vertex> 2969 #include <morphcolor_vertex> 2970 #include <batching_vertex> 2971 #include <beginnormal_vertex> 2972 #include <morphnormal_vertex> 2973 #include <skinbase_vertex> 2974 #include <skinnormal_vertex> 2975 #include <defaultnormal_vertex> 2976 #include <normal_vertex> 2977 #include <begin_vertex> 2978 #include <morphtarget_vertex> 2979 #include <skinning_vertex> 2980 #include <displacementmap_vertex> 2981 #include <project_vertex> 2982 #include <logdepthbuf_vertex> 2983 #include <clipping_planes_vertex> 2984 #include <fog_vertex> 2985 vViewPosition = - mvPosition.xyz; 2986}`,Df=`#define MATCAP 2987uniform vec3 diffuse; 2988uniform float opacity; 2989uniform sampler2D matcap; 2990varying vec3 vViewPosition; 2991#include <common> 2992#include <dithering_pars_fragment> 2993#include <color_pars_fragment> 2994#include <uv_pars_fragment> 2995#include <map_pars_fragment> 2996#include <alphamap_pars_fragment> 2997#include <alphatest_pars_fragment> 2998#include <alphahash_pars_fragment> 2999#include <fog_pars_fragment> 3000#include <normal_pars_fragment> 3001#include <bumpmap_pars_fragment> 3002#include
3002 <normalmap_pars_fragment> 3003#include <logdepthbuf_pars_fragment> 3004#include <clipping_planes_pars_fragment> 3005void main() { 3006 vec4 diffuseColor = vec4( diffuse, opacity ); 3007 #include <clipping_planes_fragment> 3008 #include <logdepthbuf_fragment> 3009 #include <map_fragment> 3010 #include <color_fragment> 3011 #include <alphamap_fragment> 3012 #include <alphatest_fragment> 3013 #include <alphahash_fragment> 3014 #include <normal_fragment_begin> 3015 #include <normal_fragment_maps> 3016 vec3 viewDir = normalize( vViewPosition ); 3017 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3018 vec3 y = cross( viewDir, x ); 3019 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3020 #ifdef USE_MATCAP 3021 vec4 matcapColor = texture2D( matcap, uv ); 3022 #else 3023 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3024 #endif 3025 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3026 #include <opaque_fragment> 3027 #include <tonemapping_fragment> 3028 #include <colorspace_fragment> 3029 #include <fog_fragment> 3030 #include <premultiplied_alpha_fragment> 3031 #include <dithering_fragment> 3032}`,Lf=`#define NORMAL 3033#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3034 varying vec3 vViewPosition; 3035#endif 3036#include <common> 3037#include <batching_pars_vertex> 3038#include <uv_pars_vertex> 3039#include <displacementmap_pars_vertex> 3040#include <normal_pars_vertex> 3041#include <morphtarget_pars_vertex> 3042#include <skinning_pars_vertex> 3043#include <logdepthbuf_pars_vertex> 3044#include <clipping_planes_pars_vertex> 3045void main() { 3046 #include <uv_vertex> 3047 #include <batching_vertex> 3048 #include <beginnormal_vertex> 3049 #include <morphinstance_vertex> 3050 #include <morphnormal_vertex> 3051 #include <skinbase_vertex> 3052 #include <skinnormal_vertex> 3053 #include <defaultnormal_vertex> 3054 #include <normal_vertex> 3055 #include <begin_vertex> 3056 #include <morphtarget_vertex> 3057 #include <skinning_vertex> 3058 #include <displacementmap_vertex> 3059 #include <project_vertex> 3060 #include <logdepthbuf_vertex> 3061 #include <clipping_planes_vertex> 3062#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3063 vViewPosition = - mvPosition.xyz; 3064#endif 3065}`,Uf=`#define NORMAL 3066uniform float opacity; 3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3068 varying vec3 vViewPosition; 3069#endif 3070#include <packing> 3071#include <uv_pars_fragment> 3072#include <normal_pars_fragment> 3073#include <bumpmap_pars_fragment> 3074#include <normalmap_pars_fragment> 3075#include <logdepthbuf_pars_fragment> 3076#include <clipping_planes_pars_fragment> 3077void main() { 3078 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3079 #include <clipping_planes_fragment> 3080 #include <logdepthbuf_fragment> 3081 #include <normal_fragment_begin> 3082 #include <normal_fragment_maps> 3083 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3084 #ifdef OPAQUE 3085 gl_FragColor.a = 1.0; 3086 #endif 3087}`,If=`#define PHONG 3088varying vec3 vViewPosition; 3089#include <common> 3090#include <batching_pars_vertex> 3091#include <uv_pars_vertex> 3092#include <displacementmap_pars_vertex> 3093#include <envmap_pars_vertex> 3094#include <color_pars_vertex> 3095#include <fog_pars_vertex> 3096#include <normal_pars_vertex> 3097#include <morphtarget_pars_vertex> 3098#include <skinning_pars_vertex> 3099#include <shadowmap_pars_vertex> 3100#include <logdepthbuf_pars_vertex> 3101#include <clipping_planes_pars_vertex> 3102void main() { 3103 #include <uv_vertex> 3104 #include <color_vertex> 3105 #include <morphcolor_vertex> 3106 #include <batching_vertex> 3107 #include <beginnormal_vertex> 3108 #include <morphinstance_vertex> 3109 #include <morphnormal_vertex> 3110 #include <skinbase_vertex> 3111 #include <skinnormal_vertex> 3112 #include <defaultnormal_vertex> 3113 #include <normal_vertex> 3114 #include <begin_vertex> 3115 #include <morphtarget_vertex> 3116 #include <skinning_vertex> 3117 #include <displacementmap_vertex> 3118 #include <project_vertex> 3119 #include <logdepthbuf_vertex> 3120 #include <clipping_planes_vertex> 3121 vViewPosition = - mvPosition.xyz; 3122 #include <worldpos_vertex> 3123 #include <envmap_vertex> 3124 #include <shadowmap_vertex> 3125 #include <fog_vertex> 3126}`,Nf=`#define PHONG 3127uniform vec3 diffuse; 3128uniform vec3 emissive; 3129uniform vec3 specular; 3130uniform float shininess; 3131uniform float opacity; 3132#include <common> 3133#include <packing> 3134#include <dithering_pars_fragment> 3135#include <color_pars_fragment> 3136#include <uv_pars_fragment> 3137#include <map_pars_fragment> 3138#include <alphamap_pars_fragment> 3139#include <alphatest_pars_fragment> 3140#include <alphahash_pars_fragment> 3141#include <aomap_pars_fragment> 3142#include <lightmap_pars_fragment> 3143#include <emissivemap_pars_fragment> 3144#include <envmap_common_pars_fragment> 3145#include <envmap_pars_fragment> 3146#include <fog_pars_fragment> 3147#include <bsdfs> 3148#include <lights_pars_begin> 3149#include <normal_pars_fragment> 3150#include <lights_phong_pars_fragment> 3151#include <shadowmap_pars_fragment> 3152#include <bumpmap_pars_fragment> 3153#include <normalmap_pars_fragment> 3154#include <specularmap_pars_fragment> 3155#include <logdepthbuf_pars_fragment> 3156#include <clipping_planes_pars_fragment> 3157void main() { 3158 vec4 diffuseColor = vec4( diffuse, opacity ); 3159 #include <clipping_planes_fragment> 3160 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3161 vec3 totalEmissiveRadiance = emissive; 3162 #include <logdepthbuf_fragment> 3163 #include <map_fragment> 3164 #include <color_fragment> 3165 #include <alphamap_fragment> 3166 #include <alphatest_fragment> 3167 #include <alphahash_fragment> 3168 #include <specularmap_fragment> 3169 #include <normal_fragment_begin> 3170 #include <normal_fragment_maps> 3171 #include <emissivemap_fragment> 3172 #include <lights_phong_fragment> 3173 #include <lights_fragment_begin> 3174 #include <lights_fragment_maps> 3175 #include <lights_fragment_end> 3176 #include <aomap_fragment> 3177 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3178 #include <envmap_fragment> 3179 #include <opaque_fragment> 3180 #include <tonemapping_fragment> 3181 #include <colorspace_fragment> 3182 #include <fog_fragment> 3183 #include <premultiplied_alpha_fragment> 3184 #include <dithering_fragment> 3185}`,Ff=`#define STANDARD 3186varying vec3 vViewPosition; 3187#ifdef USE_TRANSMISSION 3188 varying vec3 vWorldPosition; 3189#endif 3190#include <common> 3191#include <batching_pars_vertex> 3192#include <uv_pars_vertex> 3193#include <displacementmap_pars_vertex> 3194#include <color_pars_vertex> 3195#include <fog_pars_vertex> 3196#include <normal_pars_vertex> 3197#include <morphtarget_pars_vertex> 3198#include <skinning_pars_vertex> 3199#include <shadowmap_pars_vertex> 3200#include <logdepthbuf_pars_vertex> 3201#include <clipping_planes_pars_vertex> 3202void main() { 3203 #include <uv_vertex> 3204 #include <color_vertex> 3205 #include <morphinstance_vertex> 3206 #include <morphcolor_vertex> 3207 #include <batching_vertex> 3208 #include <beginnormal_vertex> 3209 #include <morphnormal_vertex> 3210 #include <skinbase_vertex> 3211 #include <skinnormal_vertex> 3212 #include <defaultnormal_vertex> 3213 #include <normal_vertex> 3214 #include <begin_vertex> 3215 #include <morphtarget_vertex> 3216 #include <skinning_vertex> 3217 #include <displacementmap_vertex> 3218 #include <project_vertex> 3219 #include <logdepthbuf_vertex> 3220 #include <clipping_planes_vertex> 3221 vViewPosition = - mvPosition.xyz; 3222 #include <worldpos_vertex> 3223 #include <shadowmap_vertex> 3224 #include <fog_vertex> 3225#ifdef USE_TRANSMISSION 3226 vWorldPosition = worldPosition.xyz; 3227#endif 3228}`,Of=`#define STANDARD 3229#ifdef PHYSICAL 3230 #define IOR 3231 #define USE_SPECULAR 3232#endif 3233uniform vec3 diffuse; 3234uniform vec3 emissive; 3235uniform float roughness; 3236uniform float metalness; 3237uniform float opacity; 3238#ifdef IOR 3239 uniform float ior; 3240#endif 3241#ifdef USE_SPECULAR 3242 uniform float specularIntensity; 3243 uniform vec3 specularColor; 3244 #ifdef USE_SPECULAR_COLORMAP 3245 uniform sampler2D specularColorMap; 3246 #endif 3247 #ifdef USE_SPECULAR_INTENSITYMAP 3248 uniform sampler2D specularIntensityMap; 3249 #endif 3250#endif 3251#ifdef USE_CLEARCOAT 3252 uniform float clearcoat; 3253 uniform float clearcoatRoughness; 3254#endif 3255#ifdef USE_DISPERSION 3256 uniform float dispersion; 3257#endif
3258#ifdef USE_IRIDESCENCE 3259 uniform float iridescence; 3260 uniform float iridescenceIOR; 3261 uniform float iridescenceThicknessMinimum; 3262 uniform float iridescenceThicknessMaximum; 3263#endif 3264#ifdef USE_SHEEN 3265 uniform vec3 sheenColor; 3266 uniform float sheenRoughness; 3267 #ifdef USE_SHEEN_COLORMAP 3268 uniform sampler2D sheenColorMap; 3269 #endif 3270 #ifdef USE_SHEEN_ROUGHNESSMAP 3271 uniform sampler2D sheenRoughnessMap; 3272 #endif 3273#endif 3274#ifdef USE_ANISOTROPY 3275 uniform vec2 anisotropyVector; 3276 #ifdef USE_ANISOTROPYMAP 3277 uniform sampler2D anisotropyMap; 3278 #endif 3279#endif 3280varying vec3 vViewPosition; 3281#include <common> 3282#include <packing> 3283#include <dithering_pars_fragment> 3284#include <color_pars_fragment> 3285#include <uv_pars_fragment> 3286#include <map_pars_fragment> 3287#include <alphamap_pars_fragment> 3288#include <alphatest_pars_fragment> 3289#include <alphahash_pars_fragment> 3290#include <aomap_pars_fragment> 3291#include <lightmap_pars_fragment> 3292#include <emissivemap_pars_fragment> 3293#include <iridescence_fragment> 3294#include <cube_uv_reflection_fragment> 3295#include <envmap_common_pars_fragment> 3296#include <envmap_physical_pars_fragment> 3297#include <fog_pars_fragment> 3298#include <lights_pars_begin> 3299#include <normal_pars_fragment> 3300#include <lights_physical_pars_fragment> 3301#include <transmission_pars_fragment> 3302#include <shadowmap_pars_fragment> 3303#include <bumpmap_pars_fragment> 3304#include <normalmap_pars_fragment> 3305#include <clearcoat_pars_fragment> 3306#include <iridescence_pars_fragment> 3307#include <roughnessmap_pars_fragment> 3308#include <metalnessmap_pars_fragment> 3309#include <logdepthbuf_pars_fragment> 3310#include <clipping_planes_pars_fragment> 3311void main() { 3312 vec4 diffuseColor = vec4( diffuse, opacity ); 3313 #include <clipping_planes_fragment> 3314 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3315 vec3 totalEmissiveRadiance = emissive; 3316 #include <logdepthbuf_fragment> 3317 #include <map_fragment> 3318 #include <color_fragment> 3319 #include <alphamap_fragment> 3320 #include <alphatest_fragment> 3321 #include <alphahash_fragment> 3322 #include <roughnessmap_fragment> 3323 #include <metalnessmap_fragment> 3324 #include <normal_fragment_begin> 3325 #include <normal_fragment_maps> 3326 #include <clearcoat_normal_fragment_begin> 3327 #include <clearcoat_normal_fragment_maps> 3328 #include <emissivemap_fragment> 3329 #include <lights_physical_fragment> 3330 #include <lights_fragment_begin> 3331 #include <lights_fragment_maps> 3332 #include <lights_fragment_end> 3333 #include <aomap_fragment> 3334 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3335 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3336 #include <transmission_fragment> 3337 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3338 #ifdef USE_SHEEN 3339 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3340 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3341 #endif 3342 #ifdef USE_CLEARCOAT 3343 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3344 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3345 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3346 #endif 3347 #include <opaque_fragment> 3348 #include <tonemapping_fragment> 3349 #include <colorspace_fragment> 3350 #include <fog_fragment> 3351 #include <premultiplied_alpha_fragment> 3352 #include <dithering_fragment> 3353}`,Bf=`#define TOON 3354varying vec3 vViewPosition; 3355#include <common> 3356#include <batching_pars_vertex> 3357#include <uv_pars_vertex> 3358#include <displacementmap_pars_vertex> 3359#include <color_pars_vertex> 3360#include <fog_pars_vertex> 3361#include <normal_pars_vertex> 3362#include <morphtarget_pars_vertex> 3363#include <skinning_pars_vertex> 3364#include <shadowmap_pars_vertex> 3365#include <logdepthbuf_pars_vertex> 3366#include <clipping_planes_pars_vertex> 3367void main() { 3368 #include <uv_vertex> 3369 #include <color_vertex> 3370 #include <morphinstance_vertex> 3371 #include <morphcolor_vertex> 3372 #include <batching_vertex> 3373 #include <beginnormal_vertex> 3374 #include <morphnormal_vertex> 3375 #include <skinbase_vertex> 3376 #include <skinnormal_vertex> 3377 #include <defaultnormal_vertex> 3378 #include <normal_vertex> 3379 #include <begin_vertex> 3380 #include <morphtarget_vertex> 3381 #include <skinning_vertex> 3382 #include <displacementmap_vertex> 3383 #include <project_vertex> 3384 #include <logdepthbuf_vertex> 3385 #include <clipping_planes_vertex> 3386 vViewPosition = - mvPosition.xyz; 3387 #include <worldpos_vertex> 3388 #include <shadowmap_vertex> 3389 #include <fog_vertex> 3390}`,zf=`#define TOON 3391uniform vec3 diffuse; 3392uniform vec3 emissive; 3393uniform float opacity; 3394#include <common> 3395#include <packing> 3396#include <dithering_pars_fragment> 3397#include <color_pars_fragment> 3398#include <uv_pars_fragment> 3399#include <map_pars_fragment> 3400#include <alphamap_pars_fragment> 3401#include <alphatest_pars_fragment> 3402#include <alphahash_pars_fragment> 3403#include <aomap_pars_fragment> 3404#include <lightmap_pars_fragment> 3405#include <emissivemap_pars_fragment> 3406#include <gradientmap_pars_fragment> 3407#include <fog_pars_fragment> 3408#include <bsdfs> 3409#include <lights_pars_begin> 3410#include <normal_pars_fragment> 3411#include <lights_toon_pars_fragment> 3412#include <shadowmap_pars_fragment> 3413#include <bumpmap_pars_fragment> 3414#include <normalmap_pars_fragment> 3415#include <logdepthbuf_pars_fragment> 3416#include <clipping_planes_pars_fragment> 3417void main() { 3418 vec4 diffuseColor = vec4( diffuse, opacity ); 3419 #include <clipping_planes_fragment> 3420 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3421 vec3 totalEmissiveRadiance = emissive; 3422 #include <logdepthbuf_fragment> 3423 #include <map_fragment> 3424 #include <color_fragment> 3425 #include <alphamap_fragment> 3426 #include <alphatest_fragment> 3427 #include <alphahash_fragment> 3428 #include <normal_fragment_begin> 3429 #include <normal_fragment_maps> 3430 #include <emissivemap_fragment> 3431 #include <lights_toon_fragment> 3432 #include <lights_fragment_begin> 3433 #include <lights_fragment_maps> 3434 #include <lights_fragment_end> 3435 #include <aomap_fragment> 3436 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3437 #include <opaque_fragment> 3438 #include <tonemapping_fragment> 3439 #include <colorspace_fragment> 3440 #include <fog_fragment> 3441 #include <premultiplied_alpha_fragment> 3442 #include <dithering_fragment> 3443}`,Hf=`uniform float size; 3444uniform float scale; 3445#include <common> 3446#include <color_pars_vertex> 3447#include <fog_pars_vertex> 3448#include <morphtarget_pars_vertex> 3449#include <logdepthbuf_pars_vertex> 3450#include <clipping_planes_pars_vertex> 3451#ifdef USE_POINTS_UV 3452 varying vec2 vUv; 3453 uniform mat3 uvTransform; 3454#endif 3455void main() { 3456 #ifdef USE_POINTS_UV 3457 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3458 #endif 3459 #include <color_vertex> 3460 #include <morphinstance_vertex> 3461 #include <morphcolor_vertex> 3462 #include <begin_vertex> 3463 #include <morphtarget_vertex> 3464 #include <project_vertex> 3465 gl_PointSize = size; 3466 #ifdef USE_SIZEATTENUATION 3467 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3468 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3469 #endif 3470 #include <logdepthbuf_vertex> 3471 #include <clipping_planes_vertex> 3472 #include <worldpos_vertex> 3473 #include <fog_vertex> 3474}`,Gf=`uniform vec3 diffuse; 3475uniform float opacity; 3476#include <common> 3477#include <color_pars_fragment> 3478#include <map_particle_pars_fragment> 3479#include <alphatest_pars_fragment> 3480#include <alphahash_pars_fragment> 3481#include <fog_pars_fragment> 3482#include <logdepthbuf_pars_fragment> 3483#include <clipping_planes_pars_fragment> 3484void main() { 3485 vec4 diffuseColor = vec4( diffuse, opacity ); 3486 #include <clipping_planes_fragment> 3487 vec3 outgoingLight = vec3( 0.0 ); 3488 #include <logdepthbuf_fragment> 3489 #include <map_particle_fragment> 3490 #include <color_fragment> 3491 #include <alphatest_fragment> 3492 #include <alphahash_fragment> 3493 outgoingLight = diffuseColor.rgb; 3494 #include <opaque_fragment> 3495 #include <tonemapping_fragment> 3496 #include <colorspace_fragment> 3497 #include <fog_fragment> 3498 #include <premultiplied_alpha_fragment> 3499}`,Vf=`#include <common> 3500#include <batching_pars_vertex> 3501#include <fog_pars_vertex> 3502#include <morphtarget_pars_vertex> 3503#include <skinning_pars_vertex> 3504#include <logdepthbuf_pars_vertex> 3505#include <shadowmap_pars_vertex> 3506void main() { 3507 #include <batching_vertex> 3508 #include <beginnormal_vertex> 3509 #include <morphinstance_vertex> 3510 #include <morphnormal_vertex> 3511 #include <skinbase_vertex> 3512 #include <skinnormal_vertex> 3513 #include <defaultnormal_vertex> 3514 #include <begin_vertex> 3515 #include <morphtarget_vertex> 3516 #include <skinning_vertex> 3517 #include <project_vertex> 3518 #include <logdepthbuf_vertex> 3519 #include <worldpos_vertex> 3520 #include <shadowmap_vertex> 3521 #include <fog_vertex> 3522}`,kf=`uniform vec3 color; 3523uniform float opacity; 3524#include <common> 3525#include <packing> 3526#include <fog_pars_fragment> 3527#include <bsdfs> 3528#include <lights_pars_begin> 3529#include <logdepthbuf_pars_fragment> 3530#include <shadowmap_pars_fragment> 3531#include <shadowmask_pars_fragment> 3532void main() { 3533 #include <logdepthbuf_fragment> 3534 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3535 #include <tonemapping_fragment> 3536 #include <colorspace_fragment> 3537 #include <fog_fragment> 3538}`,Wf=`uniform float rotation; 3539uniform vec2 center; 3540#include <common> 3541#include <uv_pars_vertex> 3542#include <fog_pars_vertex> 3543#include <logdepthbuf_pars_vertex> 3544#include <clipping_planes_pars_vertex> 3545void main() { 3546 #include <uv_vertex> 3547 vec4 mvPosition = modelViewMatrix[ 3 ]; 3548 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3549 #ifndef USE_SIZEATTENUATION 3550 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3551 if ( isPerspective ) scale *= - mvPosition.z; 3552 #endif 3553 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3554 vec2 rotatedPosition; 3555 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3556 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3557 mvPosition.xy += rotatedPosition; 3558 gl_Position = projectionMatrix * mvPosition; 3559 #include <logdepthbuf_vertex> 3560 #include <clipping_planes_vertex> 3561 #include <fog_vertex> 3562}`,Xf=`uniform vec3 diffuse; 3563uniform float opacity; 3564#include <common> 3565#include <uv_pars_fragment> 3566#include <map_pars_fragment> 3567#include <alphamap_pars_fragment> 3568#include <alphatest_pars_fragment> 3569#include <alphahash_pars_fragment> 3570#include <fog_pars_fragment> 3571#include <logdepthbuf_pars_fragment> 3572#include <clipping_planes_pars_fragment> 3573void main() { 3574 vec4 diffuseColor = vec4( diffuse, opacity ); 3575 #include <clipping_planes_fragment> 3576 vec3 outgoingLight = vec3( 0.0 ); 3577 #include <logdepthbuf_fragment> 3578 #include <map_fragment> 3579 #include <alphamap_fragment> 3580 #include <alphatest_fragment> 3581 #include <alphahash_fragment> 3582 outgoingLight = diffuseColor.rgb; 3583 #include <opaque_fragment> 3584 #include <tonemapping_fragment> 3585 #include <colorspace_fragment> 3586 #include <fog_fragment> 3587}`,Oe={alphahash_fragment:hc,alphahash_pars_fragment:dc,alphamap_fragment:pc,alphamap_pars_fragment:mc,alphatest_fragment:gc,alphatest_pars_fragment:_c,aomap_fragment:vc,aomap_pars_fragment:xc,batching_pars_vertex:Sc,batching_vertex:Mc,begin_vertex:Ec,beginnormal_vertex:Tc,bsdfs:yc,iridescence_fragment:bc,bumpmap_pars_fragment:Ac,clipping_planes_fragment:Rc,clipping_planes_pars_fragment:Cc,clipping_planes_pars_vertex:wc,clipping_planes_vertex:Pc,color_fragment:Dc,color_pars_fragment:Lc,color_pars_vertex:Uc,color_vertex:Ic,common:Nc,
vendor: 6,868 bytes, line 3587
3587cube_uv_reflection_fragment:Fc,defaultnormal_vertex:Oc,displacementmap_pars_vertex:Bc,displacementmap_vertex:zc,emissivemap_fragment:Hc,emissivemap_pars_fragment:Gc,colorspace_fragment:Vc,colorspace_pars_fragment:kc,envmap_fragment:Wc,envmap_common_pars_fragment:Xc,envmap_pars_fragment:qc,envmap_pars_vertex:Yc,envmap_physical_pars_fragment:ru,envmap_vertex:Kc,fog_vertex:$c,fog_pars_vertex:Zc,fog_fragment:jc,fog_pars_fragment:Jc,gradientmap_pars_fragment:Qc,lightmap_pars_fragment:eu,lights_lambert_fragment:tu,lights_lambert_pars_fragment:nu,lights_pars_begin:iu,lights_toon_fragment:su,lights_toon_pars_fragment:au,lights_phong_fragment:ou,lights_phong_pars_fragment:lu,lights_physical_fragment:cu,lights_physical_pars_fragment:uu,lights_fragment_begin:fu,lights_fragment_maps:hu,lights_fragment_end:du,logdepthbuf_fragment:pu,logdepthbuf_pars_fragment:mu,logdepthbuf_pars_vertex:gu,logdepthbuf_vertex:_u,map_fragment:vu,map_pars_fragment:xu,map_particle_fragment:Su,map_particle_pars_fragment:Mu,metalnessmap_fragment:Eu,metalnessmap_pars_fragment:Tu,morphinstance_vertex:yu,morphcolor_vertex:bu,morphnormal_vertex:Au,morphtarget_pars_vertex:Ru,morphtarget_vertex:Cu,normal_fragment_begin:wu,normal_fragment_maps:Pu,normal_pars_fragment:Du,normal_pars_vertex:Lu,normal_vertex:Uu,normalmap_pars_fragment:Iu,clearcoat_normal_fragment_begin:Nu,clearcoat_normal_fragment_maps:Fu,clearcoat_pars_fragment:Ou,iridescence_pars_fragment:Bu,opaque_fragment:zu,packing:Hu,premultiplied_alpha_fragment:Gu,project_vertex:Vu,dithering_fragment:ku,dithering_pars_fragment:Wu,roughnessmap_fragment:Xu,roughnessmap_pars_fragment:qu,shadowmap_pars_fragment:Yu,shadowmap_pars_vertex:Ku,shadowmap_vertex:$u,shadowmask_pars_fragment:Zu,skinbase_vertex:ju,skinning_pars_vertex:Ju,skinning_vertex:Qu,skinnormal_vertex:ef,specularmap_fragment:tf,specularmap_pars_fragment:nf,tonemapping_fragment:rf,tonemapping_pars_fragment:sf,transmission_fragment:af,transmission_pars_fragment:of,uv_pars_fragment:lf,uv_pars_vertex:cf,uv_vertex:uf,worldpos_vertex:ff,background_vert:hf,background_frag:df,backgroundCube_vert:pf,backgroundCube_frag:mf,cube_vert:gf,cube_frag:_f,depth_vert:vf,depth_frag:xf,distanceRGBA_vert:Sf,distanceRGBA_frag:Mf,equirect_vert:Ef,equirect_frag:Tf,linedashed_vert:yf,linedashed_frag:bf,meshbasic_vert:Af,meshbasic_frag:Rf,meshlambert_vert:Cf,meshlambert_frag:wf,meshmatcap_vert:Pf,meshmatcap_frag:Df,meshnormal_vert:Lf,meshnormal_frag:Uf,meshphong_vert:If,meshphong_frag:Nf,meshphysical_vert:Ff,meshphysical_frag:Of,meshtoon_vert:Bf,meshtoon_frag:zf,points_vert:Hf,points_frag:Gf,shadow_vert:Vf,shadow_frag:kf,sprite_vert:Wf,sprite_frag:Xf},ae={common:{diffuse:{value:new Ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Fe}},envmap:{envMap:{value:null},envMapRotation:{value:new Fe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Fe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Fe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Fe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Fe},normalScale:{value:new ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Fe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Fe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Fe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Fe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ze(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 Ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0},uvTransform:{value:new Fe}},sprite:{diffuse:{value:new Ze(16777215)},opacity:{value:1},center:{value:new ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}}},Kt={basic:{uniforms:Tt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:Tt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new Ze(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:Tt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new Ze(0)},specular:{value:new Ze(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:Tt([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new Ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:Tt([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new Ze(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:Tt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matc
vendor: 5,280 bytes, line 3587
3587ap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:Tt([ae.points,ae.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:Tt([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:Tt([ae.common,ae.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:Tt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:Tt([ae.sprite,ae.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Fe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Fe}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:Tt([ae.common,ae.displacementmap,{referencePosition:{value:new O},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:Tt([ae.lights,ae.fog,{color:{value:new Ze(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Kt.physical={uniforms:Tt([Kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Fe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Fe},clearcoatNormalScale:{value:new ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Fe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Fe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Fe},sheen:{value:0},sheenColor:{value:new Ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Fe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Fe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Fe},transmissionSamplerSize:{value:new ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Fe},attenuationDistance:{value:0},attenuationColor:{value:new Ze(0)},specularColor:{value:new Ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Fe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Fe},anisotropyVector:{value:new ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Fe}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const Zi={r:0,b:0,g:0},Cn=new un,qf=new ht;function Yf(n,e,t,i,r,s,a){const o=new Ze(0);let c=s===!0?0:1,l,f,h=null,d=0,p=null;function v(y){let T=y.isScene===!0?y.background:null;return T&&T.isTexture&&(T=(y.backgroundBlurriness>0?t:e).get(T)),T}function x(y){let T=!1;const w=v(y);w===null?u(o,c):w&&w.isColor&&(u(w,1),T=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||T)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(y,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===cr)?(f===void 0&&(f=new Xt(new Ri(1,1,1),new zt({name:"BackgroundCubeMaterial",uniforms:li(Kt.backgroundCube.uniforms),vertexShader:Kt.backgroundCube.vertexShader,fragmentShader:Kt.backgroundCube.fragmentShader,side:gt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(R,D,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(f)),Cn.copy(T.backgroundRotation),Cn.x*=-1,Cn.y*=-1,Cn.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Cn.y*=-1,Cn.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(qf.makeRotationFromEuler(Cn)),f.material.toneMapped=qe.getTransfer(w.colorSpace)!==Je,(h!==w||d!==w.version||p!==n.toneMapping)&&(f.material.needsUpdate=!0,h=w,d=w.version,p=n.toneMapping),f.layers.enableAll(),y.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(l===void 0&&(l=new Xt(new Ci(2,2),new zt({name:"Backgroun
3587dMaterial",uniforms:li(Kt.background.uniforms),vertexShader:Kt.background.vertexShader,fragmentShader:Kt.background.fragmentShader,side:cn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=w,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.toneMapped=qe.getTransfer(w.colorSpace)!==Je,w.matrixAutoUpdate===!0&&w.updateMatrix(),l.material.uniforms.uvTransform.value.copy(w.matrix),(h!==w||d!==w.version||p!==n.toneMapping)&&(l.material.needsUpdate=!0,h=w,d=w.version,p=n.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function u(y,T){y.getRGB(Zi,To(n)),i.buffers.color.setClear(Zi.r,Zi.g,Zi.b,T,a)}function b(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,T=1){o.set(y),c=T,u(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(y){c=y,u(o,c)},render:x,addToRenderList:m,dispose:b}}function Kf(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,a=!1;function o(M,P,z,H,X){let Y=!1;const W=h(H,z,P);s!==W&&(s=W,l(s.object)),Y=p(M,H,z,X),Y&&v(M,H,z,X),X!==null&&e.update(X,n.ELEMENT_ARRAY_BUFFER),(Y||a)&&(a=!1,T(M,P,z,H),X!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function c(){return n.createVertexArray()}function l(M){return n.bindVertexArray(M)}function f(M){return n.deleteVertexArray(M)}function h(M,P,z){const H=z.wireframe===!0;let X=i[M.id];X===void 0&&(X={},i[M.id]=X);let Y=X[P.id];Y===void 0&&(Y={},X[P.id]=Y);let W=Y[H];return W===void 0&&(W=d(c()),Y[H]=W),W}function d(M){const P=[],z=[],H=[];for(let X=0;X<t;X++)P[X]=0,z[X]=0,H[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:z,attributeDivisors:H,object:M,attributes:{},index:null}}function p(M,P,z,H){const X=s.attributes,Y=P.attributes;let W=0;const ne=z.getAttributes();for(const V in ne)if(ne[V].location>=0){const j=X[V];let pe=Y[V];if(pe===void 0&&(V==="instanceMatrix"&&M.instanceMatrix&&(pe=M.instanceMatrix),V==="instanceColor"&&M.instanceColor&&(pe=M.instanceColor)),j===void 0||j.attribute!==pe||pe&&j.data!==pe.data)return!0;W++}return s.attributesNum!==W||s.index!==H}function v(M,P,z,H){const X={},Y=P.attributes;let W=0;const ne=z.getAttributes();for(const V in ne)if(ne[V].location>=0){let j=Y[V];j===void 0&&(V==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),V==="instanceColor"&&M.instanceColor&&(j=M.instanceColor));const pe={};pe.attribute=j,j&&j.data&&(pe.data=j.data),X[V]=pe,W++}s.attributes=X,s.attributesNum=W,s.index=H}function x(){const M=s.newAttributes;for(let P=0,z=M.length;P<z;P++)M[P]=0}function m(M){u(M,0)}function u(M,P){const z=s.newAttributes,H=s.enabledAttributes,X=s.attributeDivisors;z[M]=1,H[M]===0&&(n.enableVertexAttribArray(M),H[M]=1),X[M]!==P&&(n.vertexAttribDivisor(M,P),X[M]=P)}function b(){const M=s.newAttributes,P=s.enabledAttributes;for(let z=0,H=P.length;z<H;z++)P[z]!==M[z]&&(n.disableVertexAttribArray(z),P[z]=0)}function y(M,P,z,H,X,Y,W){W===!0?n.vertexAttribIPointer(M,P,z,X,Y):n.vertexAttribPointer(M,P,z,H,X,Y)}function T(M,P,z,H){x();const X=H.attributes,Y=z.getAttributes(),W=P.defaultAttributeValues;for(const ne in Y){const V=Y[ne];if(V.location>=0){let se=X[ne];if(se===void 0&&(ne==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),ne==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),se!==void 0){const j=se.normalized,pe=se.itemSize,ce=e.get(se);if(ce===void 0)continue;const He=ce.buffer,Ke=ce.type,Ge=ce.bytesPerElement,q=Ke===n.INT||Ke===n.UNSIGNED_INT||se.gpuType===Bs;if(se.isInterleavedBufferAttribute){const Z=se.data,he=Z.stride,we=se.offset;if(Z.isInstancedInterleavedBuffer){for(let xe=0;xe<V.locationSize;xe++)u(V.location+xe,Z.meshPerAttribute);M.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=Z.meshPerAttribute*Z.count)}
vendor: 2,024 bytes, line 3587
3587else for(let xe=0;xe<V.locationSize;xe++)m(V.location+xe);n.bindBuffer(n.ARRAY_BUFFER,He);for(let xe=0;xe<V.locationSize;xe++)y(V.location+xe,pe/V.locationSize,Ke,j,he*Ge,(we+pe/V.locationSize*xe)*Ge,q)}else{if(se.isInstancedBufferAttribute){for(let Z=0;Z<V.locationSize;Z++)u(V.location+Z,se.meshPerAttribute);M.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Z=0;Z<V.locationSize;Z++)m(V.location+Z);n.bindBuffer(n.ARRAY_BUFFER,He);for(let Z=0;Z<V.locationSize;Z++)y(V.location+Z,pe/V.locationSize,Ke,j,pe*Ge,pe/V.locationSize*Z*Ge,q)}}else if(W!==void 0){const j=W[ne];if(j!==void 0)switch(j.length){case 2:n.vertexAttrib2fv(V.location,j);break;case 3:n.vertexAttrib3fv(V.location,j);break;case 4:n.vertexAttrib4fv(V.location,j);break;default:n.vertexAttrib1fv(V.location,j)}}}}b()}function w(){N();for(const M in i){const P=i[M];for(const z in P){const H=P[z];for(const X in H)f(H[X].object),delete H[X];delete P[z]}delete i[M]}}function R(M){if(i[M.id]===void 0)return;const P=i[M.id];for(const z in P){const H=P[z];for(const X in H)f(H[X].object),delete H[X];delete P[z]}delete i[M.id]}function D(M){for(const P in i){const z=i[P];if(z[M.id]===void 0)continue;const H=z[M.id];for(const X in H)f(H[X].object),delete H[X];delete z[M.id]}}function N(){E(),a=!0,s!==r&&(s=r,l(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:N,resetDefaultState:E,dispose:w,releaseStatesOfGeometry:R,releaseStatesOfProgram:D,initAttributes:x,enableAttribute:m,disableUnusedAttributes:b}}function $f(n,e,t){let i;function r(l){i=l}function s(l,f){n.drawArrays(i,l,f),t.update(f,i,1)}function a(l,f,h){h!==0&&(n.drawArraysInstanced(i,l,f,h),t.update(f,i,h))}function o(l,f,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,f,0,h);let p=0;for(let v=0;v<h;v++)p+=f[v];t.update(p,i,1)}function c(l,f,h,d){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let v=0;v<l.length;v++)a(l[v],f[v],d[v]);
vendor: 12,668 bytes, lines 3587-3662
3587else{p.multiDrawArraysInstancedWEBGL(i,l,0,f,0,d,0,h);let v=0;for(let x=0;x<h;x++)v+=f[x]*d[x];t.update(v,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function Zf(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(D){return!(D!==Wt&&i.convert(D)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(D){const N=D===Ei&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==At&&i.convert(D)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==Zt&&!N)}function c(D){if(D==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const f=c(l);f!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",f,"instead."),l=f);const h=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),u=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),y=n.getParameter(n.MAX_VARYING_VECTORS),T=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=v>0,R=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:d,maxTextures:p,maxVertexTextures:v,maxTextureSize:x,maxCubemapSize:m,maxAttributes:u,maxVertexUniforms:b,maxVaryings:y,maxFragmentUniforms:T,vertexTextures:w,maxSamples:R}}function jf(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Pn,o=new Fe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||i!==0||r;return r=d,i=h.length,p},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=f(h,d,0)},this.setState=function(h,d,p){const v=h.clippingPlanes,x=h.clipIntersection,m=h.clipShadows,u=n.get(h);if(!r||v===null||v.length===0||s&&!m)s?f(null):l();else{const b=s?0:i,y=b*4;let T=u.clippingState||null;c.value=T,T=f(v,d,y,p);for(let w=0;w!==y;++w)T[w]=t[w];u.clippingState=T,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=b}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(h,d,p,v){const x=h!==null?h.length:0;let m=null;if(x!==0){if(m=c.value,v!==!0||m===null){const u=p+x*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<u)&&(m=new Float32Array(u));for(let y=0,T=p;y!==x;++y,T+=4)a.copy(h[y]).applyMatrix4(b,o),a.normal.toArray(m,T),m[T+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,m}}function Jf(n){let e=new WeakMap;function t(a,o){return o===ts?a.mapping=ri:o===ns&&(a.mapping=si),a}function i(a){if(a&&a.isTexture){const o=a.mapping;if(o===ts||o===ns)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new tc(c.height);return l.fromEquirectangularTexture(n,a),e.set(a,l),a.addEventListener("dispose",r),t(l.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}const ei=4,ya=[.125,.215,.35,.446,.526,.582],Un=20,Br=new qs,ba=new Ze;let zr=null,Hr=0,Gr=0,Vr=!1;const Dn=(1+Math.sqrt(5))/2,Qn=1/Dn,Aa=[new O(-Dn,Qn,0),new O(Dn,Qn,0),new O(-Qn,0,Dn),new O(Qn,0,Dn),new O(0,Dn,-Qn),new O(0,Dn,Qn),new O(-1,1,-1),new O(1,1,-1),new O(-1,1,1),new O(1,1,1)],Qf=new O;class Ra{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=Qf}=s;zr=this._renderer.getRenderTarget(),Hr=this._renderer.getActiveCubeFace(),Gr=this._renderer.getActiveMipmapLevel(),Vr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,i,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Pa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=wa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(zr,Hr,Gr),this._renderer.xr.enabled=Vr,e.scissorTest=!1,ji(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ri||e.mapping===si?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zr=this._renderer.getRenderTarget(),Hr=this._renderer.getActiveCubeFace(),Gr=this._renderer.getActiveMipmapLevel(),Vr=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:Mt,minFilter:Mt,generateMipmaps:!1,type:Ei,format:Wt,colorSpace:vn,depthBuffer:!1},r=Ca(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ca(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=eh(s)),this._blurMaterial=th(s,e,t)}return r}_compileMaterial(e){const t=new Xt(this._lodPlanes[0],e);this._renderer.compile(t,Br)}_sceneToCubeUV(e,t,i,r,s){const c=new Ft(90,1,t,i),l=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,p=h.toneMapping;h.getClearColor(ba),h.toneMapping=_n,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(r),h.clearDepth(),h.setRenderTarget(null));const x=new So({name:"PMREM.Background",side:gt,depthWrite:!1,depthTest:!1}),m=new Xt(new Ri,x);let u=!1;const b=e.background;b?b.isColor&&(x.color.copy(b),e.background=null,u=!0):(x.color.copy(ba),u=!0);for(let y=0;y<6;y++){const T=y%3;T===0?(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+f[y],s.y,s.z)):T===1?(c.up.set(0,0,l[y]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+f[y],s.z)):(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+f[y]));const w=this._cubeSize;ji(r,T*w,y>2?w:0,w,w),h.setRenderTarget(r),u&&h.render(m,c),h.render(e,c)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=p,h.autoClear=d,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===ri||e.mapping===si;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Pa()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=wa());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Xt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;ji(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(a,Br)}_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=Aa[(r-s-1)%Aa.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 c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,h=new Xt(this._lodPlanes[r],l),d=l.uniforms,p=this._sizeLods[i]-1,v=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Un-1),x=s/v,m=isFinite(s)?1+Math.floor(f*x):Un;m>Un&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Un}`);const u=[];let b=0;for(let D=0;D<Un;++D){const N=D/x,E=Math.exp(-N*N/2);u.push(E),D===0?b+=E:D<m&&(b+=2*E)}for(let D=0;D<u.length;D++)u[D]=u[D]/b;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=u,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:y}=this;d.dTheta.value=v,d.mipInt.value=y-i;const T=this._sizeLods[r],w=3*T*(r>y-ei?r-y+ei:0),R=4*(this._cubeSize-T);ji(t,w,R,3*T,2*T),c.setRenderTarget(t),c.render(h,Br)}}function eh(n){const e=[],t=[],i=[];let r=n;const s=n-ei+1+ya.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let c=1/o;a>n-ei?c=ya[a-n+ei-1]:a===0&&(c=0),i.push(c);const l=1/(o-2),f=-l,h=1+l,d=[f,f,h,f,h,h,f,f,h,h,f,h],p=6,v=6,x=3,m=2,u=1,b=new Float32Array(x*v*p),y=new Float32Array(m*v*p),T=new Float32Array(u*v*p);for(let R=0;R<p;R++){const D=R%3*2/3-1,N=R>2?0:-1,E=[D,N,0,D+2/3,N,0,D+2/3,N+1,0,D,N,0,D+2/3,N+1,0,D,N+1,0];b.set(E,x*v*R),y.set(d,m*v*R);const M=[R,R,R,R,R,R];T.set(M,u*v*R)}const w=new Sn;w.setAttribute("position",new Ot(b,x)),w.setAttribute("uv",new Ot(y,m)),w.setAttribute("faceIndex",new Ot(T,u)),e.push(w),r>ei&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Ca(n,e,t){const i=new Bt(n,e,t);return i.texture.mapping=cr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ji(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function th(n,e,t){const i=new Float32Array(Un),r=new O(0,1,0);return new zt({name:"SphericalGaussianBlur",defines:{n:Un,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:Ys(),fragmentShader:` 3588 3589 precision mediump float; 3590 precision mediump int; 3591 3592 varying vec3 vOutputDirection; 3593 3594 uniform sampler2D envMap; 3595 uniform int samples; 3596 uniform float weights[ n ]; 3597 uniform bool latitudinal; 3598 uniform float dTheta; 3599 uniform float mipInt; 3600 uniform vec3 poleAxis; 3601 3602 #define ENVMAP_TYPE_CUBE_UV 3603 #include <cube_uv_reflection_fragment> 3604 3605 vec3 getSample( float theta, vec3 axis ) { 3606 3607 float cosTheta = cos( theta ); 3608 // Rodrigues' axis-angle rotation 3609 vec3 sampleDirection = vOutputDirection * cosTheta 3610 + cross( axis, vOutputDirection ) * sin( theta ) 3611 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3612 3613 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3614 3615 } 3616 3617 void main() { 3618 3619 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3620 3621 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3622 3623 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3624 3625 } 3626 3627 axis = normalize( axis ); 3628 3629 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3630 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3631 3632 for ( int i = 1; i < n; i++ ) { 3633 3634 if ( i >= samples ) { 3635 3636 break; 3637 3638 } 3639 3640 float theta = dTheta * float( i ); 3641 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3642 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3643 3644 } 3645 3646 } 3647 `,blending:Jt,depthTest:!1,depthWrite:!1})}function wa(){return new zt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ys(),fragmentShader:` 3648 3649 precision mediump float; 3650 precision mediump int; 3651 3652 varying vec3 vOutputDirection; 3653 3654 uniform sampler2D envMap; 3655 3656 #include <common> 3657 3658 void main() { 3659 3660 vec3 outputDirection = normalize( vOutputDirection ); 3661 vec2 uv = equirectUv( outputDirection ); 3662
3663 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3664 3665 } 3666 `,blending:Jt,depthTest:!1,depthWrite:!1})}function Pa(){return new zt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ys(),fragmentShader:` 3667 3668 precision mediump float; 3669 precision mediump int; 3670 3671 uniform float flipEnvMap; 3672 3673 varying vec3 vOutputDirection; 3674 3675 uniform samplerCube envMap; 3676 3677 void main() { 3678 3679 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3680 3681 } 3682 `,blending:Jt,depthTest:!1,depthWrite:!1})}function Ys(){return` 3683 3684 precision mediump float; 3685 precision mediump int; 3686 3687 attribute float faceIndex; 3688 3689 varying vec3 vOutputDirection; 3690 3691 // RH coordinate system; PMREM face-indexing convention 3692 vec3 getDirection( vec2 uv, float face ) { 3693 3694 uv = 2.0 * uv - 1.0; 3695 3696 vec3 direction = vec3( uv, 1.0 ); 3697 3698 if ( face == 0.0 ) { 3699 3700 direction = direction.zyx; // ( 1, v, u ) pos x 3701 3702 } else if ( face == 1.0 ) { 3703 3704 direction = direction.xzy; 3705 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3706 3707 } else if ( face == 2.0 ) { 3708 3709 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3710 3711 } else if ( face == 3.0 ) { 3712 3713 direction = direction.zyx; 3714 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3715 3716 } else if ( face == 4.0 ) { 3717 3718 direction = direction.xzy; 3719 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3720 3721 } else if ( face == 5.0 ) { 3722 3723 direction.z *= -1.0; // ( u, v, -1 ) neg z 3724 3725 } 3726 3727 return direction; 3728 3729 } 3730 3731 void main() { 3732 3733 vOutputDirection = getDirection( uv, faceIndex ); 3734 gl_Position = vec4( position, 1.0 ); 3735 3736 } 3737 `}function nh(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const c=o.mapping,l=c===ts||c===ns,f=c===ri||c===si;if(l||f){let h=e.get(o);const d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new Ra(n)),h=l?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const p=o.image;return l&&p&&p.height>0||f&&p&&r(p)?(t===null&&(t=new Ra(n)),h=l?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function r(o){let c=0;const l=6;for(let f=0;f<l;f++)o[f]!==void 0&&c++;return c===l}function s(o){const c=o.target;c.removeEventListener("dispose",s);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function ih(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&&Mi("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function rh(n,e,t,i){const r={},s=new WeakMap;function a(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const v in d.attributes)e.remove(d.attributes[v]);d.removeEventListener("dispose",a),delete r[d.id];const p=s.get(d);p&&(e.remove(p),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(h,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,t.memory.geometries++),d}function c(h){const d=h.attributes;for(const p in d)e.update(d[p],n.ARRAY_BUFFER)}function l(h){const d=[],p=h.index,v=h.attributes.position;let x=0;if(p!==null){const b=p.array;x=p.version;for(let y=0,T=b.length;y<T;y+=3){const w=b[y+0],R=b[y+1],D=b[y+2];d.push(w,R,R,D,D,w)}}else if(v!==void 0){const b=v.array;x=v.version;for(let y=0,T=b.length/3-1;y<T;y+=3){const w=y+0,R=y+1,D=y+2;d.push(w,R,R,D,D,w)}}else return;const m=new(go(d)?Eo:Mo)(d,1);m.version=x;const u=s.get(h);u&&e.remove(u),s.set(h,m)}function f(h){const d=s.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&l(h)}else l(h);return s.get(h)}return{get:o,update:c,getWireframeAttribute:f}}function sh(n,e,t){let i;function r(d){i=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function c(d,p){n.drawElements(i,p,s,d*a),t.update(p,i,1)}function l(d,p,v){v!==0&&(n.drawElementsInstanced(i,p,s,d*a,v),t.update(p,i,v))}function f(d,p,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,s,d,0,v);let m=0;for(let u=0;u<v;u++)m+=p[u];t.update(m,i,1)}function h(d,p,v,x){if(v===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let u=0;u<d.length;u++)l(d[u]/a,p[u],x[u]);
vendor: 17,420 bytes, lines 3737-3772
3737else{m.multiDrawElementsInstancedWEBGL(i,p,0,s,d,0,x,0,v);let u=0;for(let b=0;b<v;b++)u+=p[b]*x[b];t.update(u,i,1)}}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=f,this.renderMultiDrawInstances=h}function ah(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 oh(n,e,t){const i=new WeakMap,r=new ut;function s(a,o,c){const l=a.morphTargetInfluences,f=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=f!==void 0?f.length:0;let d=i.get(o);if(d===void 0||d.count!==h){let E=function(){D.dispose(),i.delete(o),o.removeEventListener("dispose",E)};d!==void 0&&d.texture.dispose();const p=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,x=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let y=0;p===!0&&(y=1),v===!0&&(y=2),x===!0&&(y=3);let T=o.attributes.position.count*y,w=1;T>e.maxTextureSize&&(w=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const R=new Float32Array(T*w*4*h),D=new _o(R,T,w,h);D.type=Zt,D.needsUpdate=!0;const N=y*4;for(let M=0;M<h;M++){const P=m[M],z=u[M],H=b[M],X=T*w*4*M;for(let Y=0;Y<P.count;Y++){const W=Y*N;p===!0&&(r.fromBufferAttribute(P,Y),R[X+W+0]=r.x,R[X+W+1]=r.y,R[X+W+2]=r.z,R[X+W+3]=0),v===!0&&(r.fromBufferAttribute(z,Y),R[X+W+4]=r.x,R[X+W+5]=r.y,R[X+W+6]=r.z,R[X+W+7]=0),x===!0&&(r.fromBufferAttribute(H,Y),R[X+W+8]=r.x,R[X+W+9]=r.y,R[X+W+10]=r.z,R[X+W+11]=H.itemSize===4?r.w:1)}}d={count:h,texture:D,size:new ze(T,w)},i.set(o,d),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let p=0;for(let x=0;x<l.length;x++)p+=l[x];const v=o.morphTargetsRelative?1:1-p;c.getUniforms().setValue(n,"morphTargetBaseInfluence",v),c.getUniforms().setValue(n,"morphTargetInfluences",l)}c.getUniforms().setValue(n,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:s}}function lh(n,e,t,i){let r=new WeakMap;function s(c){const l=i.render.frame,f=c.geometry,h=e.get(c,f);if(r.get(h)!==l&&(e.update(h),r.set(h,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),r.get(c)!==l&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),r.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;r.get(d)!==l&&(d.update(),r.set(d,l))}return h}function a(){r=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:s,dispose:a}}const wo=new vt,Da=new vi(1,1),Po=new _o,Do=new Ol,Lo=new bo,La=[],Ua=[],Ia=new Float32Array(16),Na=new Float32Array(9),Fa=new Float32Array(4);function ui(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=La[r];if(s===void 0&&(s=new Float32Array(r),La[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 dt(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 pt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function ur(n,e){let t=Ua[e];t===void 0&&(t=new Int32Array(e),Ua[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function ch(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function uh(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(dt(t,e))return;n.uniform2fv(this.addr,e),pt(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.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(dt(t,e))return;n.uniform3fv(this.addr,e),pt(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.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(dt(t,e))return;n.uniform4fv(this.addr,e),pt(t,e)}}function dh(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(dt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,i))return;Fa.set(i),n.uniformMatrix2fv(this.addr,!1,Fa),pt(t,i)}}function ph(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(dt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,i))return;Na.set(i),n.uniformMatrix3fv(this.addr,!1,Na),pt(t,i)}}function mh(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(dt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,i))return;Ia.set(i),n.uniformMatrix4fv(this.addr,!1,Ia),pt(t,i)}}function gh(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function _h(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(dt(t,e))return;n.uniform2iv(this.addr,e),pt(t,e)}}function vh(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(dt(t,e))return;n.uniform3iv(this.addr,e),pt(t,e)}}function xh(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(dt(t,e))return;n.uniform4iv(this.addr,e),pt(t,e)}}function Sh(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Mh(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(dt(t,e))return;n.uniform2uiv(this.addr,e),pt(t,e)}}function Eh(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(dt(t,e))return;n.uniform3uiv(this.addr,e),pt(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||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(dt(t,e))return;n.uniform4uiv(this.addr,e),pt(t,e)}}function yh(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?(Da.compareFunction=mo,s=Da):s=wo,t.setTexture2D(e||s,r)}function bh(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||Do,r)}function Ah(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||Lo,r)}function Rh(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||Po,r)}function Ch(n){switch(n){case 5126:return ch;case 35664:return uh;case 35665:return fh;case 35666:return hh;case 35674:return dh;case 35675:return ph;case 35676:return mh;case 5124:case 35670:return gh;case 35667:case 35671:return _h;case 35668:case 35672:return vh;case 35669:case 35673:return xh;case 5125:return Sh;case 36294:return Mh;case 36295:return Eh;case 36296:return Th;case 35678:case 36198:case 36298:case 36306:case 35682:return yh;case 35679:case 36299:case 36307:return bh;case 35680:case 36300:case 36308:case 36293:return Ah;case 36289:case 36303:case 36311:case 36292:return Rh}}function wh(n,e){n.uniform1fv(this.addr,e)}function Ph(n,e){const t=ui(e,this.size,2);n.uniform2fv(this.addr,t)}function Dh(n,e){const t=ui(e,this.size,3);n.uniform3fv(this.addr,t)}function Lh(n,e){const t=ui(e,this.size,4);n.uniform4fv(this.addr,t)}function Uh(n,e){const t=ui(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function Ih(n,e){const t=ui(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function Nh(n,e){const t=ui(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Fh(n,e){n.uniform1iv(this.addr,e)}function Oh(n,e){n.uniform2iv(this.addr,e)}function Bh(n,e){n.uniform3iv(this.addr,e)}function zh(n,e){n.uniform4iv(this.addr,e)}function Hh(n,e){n.uniform1uiv(this.addr,e)}function Gh(n,e){n.uniform2uiv(this.addr,e)}function Vh(n,e){n.uniform3uiv(this.addr,e)}function kh(n,e){n.uniform4uiv(this.addr,e)}function Wh(n,e,t){const i=this.cache,r=e.length,s=ur(t,r);dt(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||wo,s[a])}function Xh(n,e,t){const i=this.cache,r=e.length,s=ur(t,r);dt(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Do,s[a])}function qh(n,e,t){const i=this.cache,r=e.length,s=ur(t,r);dt(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Lo,s[a])}function Yh(n,e,t){const i=this.cache,r=e.length,s=ur(t,r);dt(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Po,s[a])}function Kh(n){switch(n){case 5126:return wh;case 35664:return Ph;case 35665:return Dh;case 35666:return Lh;case 35674:return Uh;case 35675:return Ih;case 35676:return Nh;case 5124:case 35670:return Fh;case 35667:case 35671:return Oh;case 35668:case 35672:return Bh;case 35669:case 35673:return zh;case 5125:return Hh;case 36294:return Gh;case 36295:return Vh;case 36296:return kh;case 35678:case 36198:case 36298:case 36306:case 35682:return Wh;case 35679:case 36299:case 36307:return Xh;case 35680:case 36300:case 36308:case 36293:return qh;case 36289:case 36303:case 36311:case 36292:return Yh}}class $h{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=Ch(t.type)}}class Zh{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Kh(t.type)}}class jh{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 kr=/(\w+)(\])?(\[|\.)?/g;function Oa(n,e){n.seq.push(e),n.map[e.id]=e}function Jh(n,e,t){const i=n.name,r=i.length;for(kr.lastIndex=0;;){const s=kr.exec(i),a=kr.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){Oa(t,l===void 0?new $h(o,n,e):new Zh(o,n,e));break}else{let h=t.map[o];h===void 0&&(h=new jh(o),Oa(t,h)),t=h}}}class ir{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);Jh(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],c=i[o.id];c.needsUpdate!==!1&&o.setValue(e,c.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 Ba(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const Qh=37297;let ed=0;function td(n,e){const t=n.split(` 3738`),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(` 3739`)}const za=new Fe;function nd(n){qe._getMatrix(za,qe.workingColorSpace,n);const e=`mat3( ${za.elements.map(t=>t.toFixed(4))} )`;switch(qe.getTransfer(n)){case sr:return[e,"LinearTransferOETF"];case Je:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function Ha(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 3740 3741`+s+` 3742 3743`+td(n.getShaderSource(e),o)}else return s}function id(n,e){const t=nd(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3744`)}function rd(n,e){let t;switch(e){case fl:t="Linear";break;case hl:t="Reinhard";break;case dl:t="Cineon";break;case pl:t="ACESFilmic";break;case gl:t="AgX";break;case _l:t="Neutral";break;case ml:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ji=new O;function sd(){qe.getLuminanceCoefficients(Ji);const n=Ji.x.toFixed(4),e=Ji.y.toFixed(4),t=Ji.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3745`)}function ad(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_i).join(` 3746`)}function od(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` 3747`)}function ld(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 _i(n){return n!==""}function Ga(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 Va(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cd=/^[ \t]*#include +<([\w\d./]+)>/gm;function Fs(n){return n.replace(cd,fd)}const ud=new Map;function fd(n,e){let t=Oe[e];if(t===void 0){const i=ud.get(e);if(i!==void 0)t=Oe[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 Fs(t)}const hd=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ka(n){return n.replace(hd,dd)}function dd(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 Wa(n){let e=`precision ${n.precision} float; 3748 precision ${n.precision} int; 3749 precision ${n.precision} sampler2D; 3750 precision ${n.precision} samplerCube; 3751 precision ${n.precision} sampler3D; 3752 precision ${n.precision} sampler2DArray; 3753 precision ${n.precision} sampler2DShadow; 3754 precision ${n.precision} samplerCubeShadow; 3755 precision ${n.precision} sampler2DArrayShadow; 3756 precision ${n.precision} isampler2D; 3757 precision ${n.precision} isampler3D; 3758 precision ${n.precision} isamplerCube; 3759 precision ${n.precision} isampler2DArray; 3760 precision ${n.precision} usampler2D; 3761 precision ${n.precision} usampler3D; 3762 precision ${n.precision} usamplerCube; 3763 precision ${n.precision} usampler2DArray; 3764 `;return n.precision==="highp"?e+=` 3765#define HIGH_PRECISION`:n.precision==="mediump"?e+=` 3766#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=` 3767#define LOW_PRECISION`),e}function pd(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===io?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Wo?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===on&&(e="SHADOWMAP_TYPE_VSM"),e}function md(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case ri:case si:e="ENVMAP_TYPE_CUBE";break;case cr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function gd(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case si:e="ENVMAP_MODE_REFRACTION";break}return e}function _d(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case ro:e="ENVMAP_BLENDING_MULTIPLY";break;case cl:e="ENVMAP_BLENDING_MIX";break;case ul:e="ENVMAP_BLENDING_ADD";break}return e}function vd(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 xd(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=pd(t),l=md(t),f=gd(t),h=_d(t),d=vd(t),p=ad(t),v=od(s),x=r.createProgram();let m,u,b=t.glslVersion?"#version "+t.glslVersion+` 3768`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(_i).join(` 3769`),m.length>0&&(m+=` 3770`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(_i).join(` 3771`),u.length>0&&(u+=` 3772`)):(m=[Wa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 6,474 bytes, lines 3772-3774
3772ipCullDistance?"#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 "+f:"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3773`].filter(_i).join(` 3774`),u=[Wa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3774IDESCENCE":"",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 "+c:"",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_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==_n?"#define TONE_MAPPING":"",t.toneMapping!==_n?Oe.tonemapping_pars_fragment:"",t.toneMapping!==_n?rd("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,id("linearToOutputTexel",t.outputColorSpace),sd(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3775`].filter(_i).join(` 3776`)),a=Fs(a),a=Ga(a,t),a=Va(a,t),o=Fs(o),o=Ga(o,t),o=Va(o,t),a=ka(a),o=ka(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es 3777`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3778`)+` 3779`+m,u=["#define varying in",t.glslVersion===Us?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Us?"":"#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(` 3780`)+` 3781`+u);const y=b+m+a,T=b+u+o,w=Ba(r,r.VERTEX_SHADER,y),R=Ba(r,r.FRAGMENT_SHADER,T);r.attachShader(x,w),r.attachShader(x,R),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function D(P){if(n.debug.checkShaderErrors){const z=r.getProgramInfoLog(x)||"",H=r.getShaderInfoLog(w)||"",X=r.getShaderInfoLog(R)||"",Y=z.trim(),W=H.trim(),ne=X.trim();let V=!0,se=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(V=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,w,R);else{const j=Ha(r,w,"vertex"),pe=Ha(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` 3782 3783Material Name: `+P.name+` 3784Material Type: `+P.type+` 3785 3786Program Info Log: `+Y+` 3787`+j+` 3788`+pe)}else Y!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Y):(W===""||ne==="")&&(se=!1);se&&(P.diagnostics={runnable:V,programLog:Y,vertexShader:{log:W,prefix:m},fragmentShader:{log:ne,prefix:u}})}r.deleteShader(w),r.deleteShader(R),N=new ir(r,x),E=ld(r,x)}let N;this.getUniforms=function(){return N===void 0&&D(this),N};let E;this.getAttributes=function(){return E===void 0&&D(this),E};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(x,Qh)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ed++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=R,this}let Sd=0;class Md{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 Ed(e),t.set(e,i)),i}}class Ed{constructor(e){this.id=Sd++,this.code=e,this.usedTimes=0}}function Td(n,e,t,i,r,s,a){const o=new vo,c=new Md,l=new Set,f=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const v={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 x(E){return l.add(E),E===0?"uv":`uv${E}`}function m(E,M,P,z,H){const X=z.fog,Y=H.geometry,W=E.isMeshStandardMaterial?z.environment:null,ne=(E.isMeshStandardMaterial?t:e).get(E.envMap||W),V=ne&&ne.mapping===cr?ne.image.height:null,se=v[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const j=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,pe=j!==void 0?j.length:0;let ce=0;Y.morphAttributes.position!==void 0&&(ce=1),Y.morphAttributes.normal!==void 0&&(ce=2),Y.morphAttributes.color!==void 0&&(ce=3);let He,Ke,Ge,q;if(se){const $e=Kt[se];He=$e.vertexShader,Ke=$e.fragmentShader}else He=E.vertexShader,Ke=E.fragmentShader,c.update(E),Ge=c.getVertexShaderID(E),q=c.getFragmentShaderID(E);const Z=n.getRenderTarget(),he=n.state.buffers.depth.getReversed(),we=H.isInstancedMesh===!0,xe=H.isBatchedMesh===!0,Be=!!E.map,_t=!!E.matcap,A=!!ne,Ie=!!E.aoMap,Ae=!!E.lightMap,ye=!!E.bumpMap,me=!!E.normalMap,et=!!E.displacementMap,ge=!!E.emissiveMap,Le=!!E.metalnessMap,ot=!!E.roughnessMap,tt=E.anisotropy>0,S=E.clearcoat>0,g=E.dispersion>0,U=E.iridescence>0,G=E.sheen>0,K=E.transmission>0,k=tt&&!!E.anisotropyMap,Te=S&&!!E.clearcoatMap,ie=S&&!!E.clearcoatNormalMap,Se=S&&!!E.clearcoatRoughnessMap,Me=U&&!!E.iridescenceMap,ee=U&&!!E.iridescenceThicknessMap,ue=G&&!!E.sheenColorMap,Pe=G&&!!E.sheenRoughnessMap,Ee=!!E.specularMap,oe=!!E.specularColorMap,Ne=!!E.specularIntensityMap,C=K&&!!E.transmissionMap,te=K&&!!E.thicknessMap,re=!!E.gradientMap,de=!!E.alphaMap,J=E.alphaTest>0,$=!!E.alphaHash,ve=!!E.extensions;let Ue=_n;E.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Ue=n.toneMapping);const nt={shaderID:se,shaderType:E.type,shaderName:E.name,vertexShader:He,fragmentShader:Ke,defines:E.defines,customVertexShaderID:Ge,customFragmentShaderID:q,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:xe,batchingColor:xe&&H._colorsTexture!==null,instancing:we,instancingColor:we&&H.instanceColor!==null,instancingMorph:we&&H.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:Z===null?n.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:vn,alphaToCoverage:!!E.alphaToCoverage,map:Be,matcap:_t,envMap:A,envMapMode:A&&ne.mapping,envMapCubeUVHeight:V,aoMap:Ie,lightMap:Ae,bumpMap:ye,normalMap:me,displacementMap:d&&et,emissiveMap:ge,normalMapObjectSpace:me&&E.normalMapType===Ml,normalMapTangentSpace:me&&E.normalMapType===Sl,metalnessMap:Le,roughnessMap:ot,anisotropy:tt,anisotropyMap:k,clearcoat:S,clearcoatMap:Te,clearcoatNormalMap:ie,clearcoatRoughnessMap:Se,dispersion:g,iridescence:U,iridescenceMap:Me,iridescenceThicknessMap:ee,sheen:G,sheenColorMap:ue,sheenRoughnessMap:Pe,specularMap:Ee,specularColorMap:oe,specularIntensityMap:Ne,transmission:K,transmissionMap:C,thicknessMap:te,gradientMap:re,opaque:E.transparent===!1&&E.blending===ti&&E.alphaToCoverage===!1,alphaMap:de,alphaTest:J,alphaHash:$,combine:E.combine,mapUv:Be&&x(E.map.channel),aoMapUv:Ie&&x(E.aoMap.channel),lightMapUv:Ae&&x(E.lightMap.channel),bumpMapUv:ye&&x(E.bumpMap.channel),normalMapUv:me&&x(E.normalMap.channel),displacementMapUv:et&&x(E.displacementMap.channel),emissiveMapUv:ge&&x(E.emissiveMap.channel),metalnessMapUv:Le&&x(E.metalnessMap.channel),roughnessMapUv:ot&&x(E.roughnessMap.channel),anisotropyMapUv:k&&x(E.anisotropyMap.channel),clearcoatMapUv:Te&&x(E.clearcoatMap.channel),clearcoatNormalMapUv:ie&&x(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Se&&x(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&x(E.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&x(E.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&x(E.sheenColorMap.channel),sheenRoughnessMapUv:Pe&&x(E.sheenRoughnessMap.channel),specularMapUv:Ee&&x(E.specularMap.channel),specularColorMapUv:oe&&x(E.specularColorMap.channel),specularIntensityMapUv:Ne&&x(E.specularIntensityMap.channel),transmissionMapUv:C&&x(E.transmissionMap.channel),thicknessMapUv:te&&x(E.thicknessMap.channel),alphaMapUv:de&&x(E.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(me||tt),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!Y.attributes.uv&&(Be||de),fog:!!X,useFog:E.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:E.flatShading===!0&&E.wireframe===!1,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:he,skinning:H.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:ce,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:Ue,decodeVideoTexture:Be&&E.map.isVideoTexture===!0&&qe.getTransfer(E.map.colorSpace)===Je,decodeVideoTextureEmissive:ge&&E.emissiveMap.isVideoTexture===!0&&qe.getTransfer(E.emissiveMap.colorSpace)===Je,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Dt,flipSided:E.side===gt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionCl
vendor: 4,968 bytes, line 3788
3788ipCullDistance:ve&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&E.extensions.multiDraw===!0||xe)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return nt.vertexUv1s=l.has(1),nt.vertexUv2s=l.has(2),nt.vertexUv3s=l.has(3),l.clear(),nt}function u(E){const M=[];if(E.shaderID?M.push(E.shaderID):(M.push(E.customVertexShaderID),M.push(E.customFragmentShaderID)),E.defines!==void 0)for(const P in E.defines)M.push(P),M.push(E.defines[P]);return E.isRawShaderMaterial===!1&&(b(M,E),y(M,E),M.push(n.outputColorSpace)),M.push(E.customProgramCacheKey),M.join()}function b(E,M){E.push(M.precision),E.push(M.outputColorSpace),E.push(M.envMapMode),E.push(M.envMapCubeUVHeight),E.push(M.mapUv),E.push(M.alphaMapUv),E.push(M.lightMapUv),E.push(M.aoMapUv),E.push(M.bumpMapUv),E.push(M.normalMapUv),E.push(M.displacementMapUv),E.push(M.emissiveMapUv),E.push(M.metalnessMapUv),E.push(M.roughnessMapUv),E.push(M.anisotropyMapUv),E.push(M.clearcoatMapUv),E.push(M.clearcoatNormalMapUv),E.push(M.clearcoatRoughnessMapUv),E.push(M.iridescenceMapUv),E.push(M.iridescenceThicknessMapUv),E.push(M.sheenColorMapUv),E.push(M.sheenRoughnessMapUv),E.push(M.specularMapUv),E.push(M.specularColorMapUv),E.push(M.specularIntensityMapUv),E.push(M.transmissionMapUv),E.push(M.thicknessMapUv),E.push(M.combine),E.push(M.fogExp2),E.push(M.sizeAttenuation),E.push(M.morphTargetsCount),E.push(M.morphAttributeCount),E.push(M.numDirLights),E.push(M.numPointLights),E.push(M.numSpotLights),E.push(M.numSpotLightMaps),E.push(M.numHemiLights),E.push(M.numRectAreaLights),E.push(M.numDirLightShadows),E.push(M.numPointLightShadows),E.push(M.numSpotLightShadows),E.push(M.numSpotLightShadowsWithMaps),E.push(M.numLightProbes),E.push(M.shadowMapType),E.push(M.toneMapping),E.push(M.numClippingPlanes),E.push(M.numClipIntersection),E.push(M.depthPacking)}function y(E,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),M.gradientMap&&o.enable(22),E.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.reversedDepthBuffer&&o.enable(4),M.skinning&&o.enable(5),M.morphTargets&&o.enable(6),M.morphNormals&&o.enable(7),M.morphColors&&o.enable(8),M.premultipliedAlpha&&o.enable(9),M.shadowMapEnabled&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.decodeVideoTextureEmissive&&o.enable(20),M.alphaToCoverage&&o.enable(21),E.push(o.mask)}function T(E){const M=v[E.type];let P;if(M){const z=Kt[M];P=jl.clone(z.uniforms)}else P=E.uniforms;return P}function w(E,M){let P;for(let z=0,H=f.length;z<H;z++){const X=f[z];if(X.cacheKey===M){P=X,++P.usedTimes;break}}return P===void 0&&(P=new xd(n,M,E,s),f.push(P)),P}function R(E){if(--E.usedTimes===0){const M=f.indexOf(E);f[M]=f[f.length-1],f.pop(),E.destroy()}}function D(E){c.remove(E)}function N(){c.dispose()}return{getParameters:m,getProgramCacheKey:u,getUniforms:T,acquireProgram:w,releaseProgram:R,releaseShaderCache:D,programs:f,dispose:N}}function yd(){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,c){n.get(a)[o]=c}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function bd(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 Xa(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 qa(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h,d,p,v,x,m){let u=n[e];return u===void 0?(u={id:h.id,object:h,geometry:d,material:p,groupOrder:v,renderOrder:h.renderOrder,z:x,group:m},n[e]=u):(u.id=h.id,u.object=h,u.geometry=d,u.material=p,u.groupOrder=v,u.renderOrder=h.renderOrder,u.z=x,u.group=m),e++,u}function o(h,d,p,v,x,m){const u=a(h,d,p,v,x,m);p.transmission>
vendor: 1,773 bytes, line 3788
37880?i.push(u):p.transparent===!0?r.push(u):t.push(u)}function c(h,d,p,v,x,m){const u=a(h,d,p,v,x,m);p.transmission>0?i.unshift(u):p.transparent===!0?r.unshift(u):t.unshift(u)}function l(h,d){t.length>1&&t.sort(h||bd),i.length>1&&i.sort(d||Xa),r.length>1&&r.sort(d||Xa)}function f(){for(let h=e,d=n.length;h<d;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:o,unshift:c,finish:f,sort:l}}function Ad(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new qa,n.set(i,[a])):r>=s.length?(a=new qa,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Rd(){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 O,color:new Ze};break;case"SpotLight":t={position:new O,direction:new O,color:new Ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new O,color:new Ze,distance:0,decay:0};break;case"HemisphereLight":t={direction:new O,skyColor:new Ze,groundColor:new Ze};break;case"RectAreaLight":t={color:new Ze,position:new O,halfWidth:new O,halfHeight:new O};break}return n[e.id]=t,t}}}function Cd(){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 ze};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ze};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let wd=0;
vendor: 5,738 bytes, line 3788
3788function Pd(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Dd(n){const e=new Rd,t=Cd(),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 l=0;l<9;l++)i.probe.push(new O);const r=new O,s=new ht,a=new ht;function o(l){let f=0,h=0,d=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let p=0,v=0,x=0,m=0,u=0,b=0,y=0,T=0,w=0,R=0,D=0;l.sort(Pd);for(let E=0,M=l.length;E<M;E++){const P=l[E],z=P.color,H=P.intensity,X=P.distance,Y=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)f+=z.r*H,h+=z.g*H,d+=z.b*H;else if(P.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(P.sh.coefficients[W],H);D++}else if(P.isDirectionalLight){const W=e.get(P);if(W.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const ne=P.shadow,V=t.get(P);V.shadowIntensity=ne.intensity,V.shadowBias=ne.bias,V.shadowNormalBias=ne.normalBias,V.shadowRadius=ne.radius,V.shadowMapSize=ne.mapSize,i.directionalShadow[p]=V,i.directionalShadowMap[p]=Y,i.directionalShadowMatrix[p]=P.shadow.matrix,b++}i.directional[p]=W,p++}else if(P.isSpotLight){const W=e.get(P);W.position.setFromMatrixPosition(P.matrixWorld),W.color.copy(z).multiplyScalar(H),W.distance=X,W.coneCos=Math.cos(P.angle),W.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),W.decay=P.decay,i.spot[x]=W;const ne=P.shadow;if(P.map&&(i.spotLightMap[w]=P.map,w++,ne.updateMatrices(P),P.castShadow&&R++),i.spotLightMatrix[x]=ne.matrix,P.castShadow){const V=t.get(P);V.shadowIntensity=ne.intensity,V.shadowBias=ne.bias,V.shadowNormalBias=ne.normalBias,V.shadowRadius=ne.radius,V.shadowMapSize=ne.mapSize,i.spotShadow[x]=V,i.spotShadowMap[x]=Y,T++}x++}else if(P.isRectAreaLight){const W=e.get(P);W.color.copy(z).multiplyScalar(H),W.halfWidth.set(P.width*.5,0,0),W.halfHeight.set(0,P.height*.5,0),i.rectArea[m]=W,m++}else if(P.isPointLight){const W=e.get(P);if(W.color.copy(P.color).multiplyScalar(P.intensity),W.distance=P.distance,W.decay=P.decay,P.castShadow){const ne=P.shadow,V=t.get(P);V.shadowIntensity=ne.intensity,V.shadowBias=ne.bias,V.shadowNormalBias=ne.normalBias,V.shadowRadius=ne.radius,V.shadowMapSize=ne.mapSize,V.shadowCameraNear=ne.camera.near,V.shadowCameraFar=ne.camera.far,i.pointShadow[v]=V,i.pointShadowMap[v]=Y,i.pointShadowMatrix[v]=P.shadow.matrix,y++}i.point[v]=W,v++}else if(P.isHemisphereLight){const W=e.get(P);W.skyColor.copy(P.color).multiplyScalar(H),W.groundColor.copy(P.groundColor).multiplyScalar(H),i.hemi[u]=W,u++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ae.LTC_FLOAT_1,i.rectAreaLTC2=ae.LTC_FLOAT_2):(i.rectAreaLTC1=ae.LTC_HALF_1,i.rectAreaLTC2=ae.LTC_HALF_2)),i.ambient[0]=f,i.ambient[1]=h,i.ambient[2]=d;const N=i.hash;(N.directionalLength!==p||N.pointLength!==v||N.spotLength!==x||N.rectAreaLength!==m||N.hemiLength!==u||N.numDirectionalShadows!==b||N.numPointShadows!==y||N.numSpotShadows!==T||N.numSpotMaps!==w||N.numLightProbes!==D)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=m,i.point.length=v,i.hemi.length=u,i.directionalShadow.length=b,i.directionalShadowMap.length=b,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=b,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=T+w-R,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=R,i.numLightProbes=D,N.directionalLength=p,N.pointLength=v,N.spotLength=x,N.rectAreaLength=m,N.hemiLength=u,N.numDirectionalShadows=b,N.numPointShadows=y,N.numSpotShadows=T,N.numSpotMaps=w,N.numLightProbes=D,i.version=wd++)}function c(l,f){let h=0,d=0,p=0,v=0,x=0;const m=f.matrixWorldInverse;for(let u=0,b=l.length;u<b;u++){const y=l[u];if(y.isDirectionalLight){const T=i.directional[h];T.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(m),h++}else if(y.isSpotLight){const T=i.spot[p];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(m),T.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(m),p++}else if(y.isRectAreaLight){const T=i.rectArea[v];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(m),a.identity(),s.copy(y.matrixWorld),s.premultiply(m),a.extractRotation(s),T.halfWidth.set(y.width*.5,0,0),T.halfHeight.set(0,y.height*.5,0),T.halfWidth.applyMatrix4(a),T.halfHeight.applyMatrix4(a),v++}else if(y.isPointLight){const T=i.point[d];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(m),d++}else if(y.isHemisphereLight){const T=i.hemi[x];T.direction.setFromMatrixPosition(y.matrixWorld),T.direction.transformDirection(m),x++}}}return{setup:o,setupView:c,state:i}}function Ya(n){const e=new Dd(n),t=[],i=[];function r(f){l.camera=f,t.length=0,i.length=0}function s(f){t.push(f)}function a(f){i.push(f)}function o(){e.setup(t)}function c(f){e.setupView(t,f)}const l={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function Ld(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Ya(n),e.set(r,[o])):s>=a.length?(o=new Ya(n),a.push(o)):o=a[s],o}
vendor: 3,086 bytes, lines 3788-3816
3788function i(){e=new WeakMap}return{get:t,dispose:i}}const Ud=`void main() { 3789 gl_Position = vec4( position, 1.0 ); 3790}`,Id=`uniform sampler2D shadow_pass; 3791uniform vec2 resolution; 3792uniform float radius; 3793#include <packing> 3794void main() { 3795 const float samples = float( VSM_SAMPLES ); 3796 float mean = 0.0; 3797 float squared_mean = 0.0; 3798 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3799 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3800 for ( float i = 0.0; i < samples; i ++ ) { 3801 float uvOffset = uvStart + i * uvStride; 3802 #ifdef HORIZONTAL_PASS 3803 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3804 mean += distribution.x; 3805 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3806 #else 3807 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3808 mean += depth; 3809 squared_mean += depth * depth; 3810 #endif 3811 } 3812 mean = mean / samples; 3813 squared_mean = squared_mean / samples; 3814 float std_dev = sqrt( squared_mean - mean * mean ); 3815 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3816}`;function Nd(n,e,t){let i=new Ao;const r=new ze,s=new ze,a=new ut,o=new ac({depthPacking:xl}),c=new oc,l={},f=t.maxTextureSize,h={[cn]:gt,[gt]:cn,[Dt]:Dt},d=new zt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ze},radius:{value:4}},vertexShader:Ud,fragmentShader:Id}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const v=new Sn;v.setAttribute("position",new Ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Xt(v,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=io;let u=this.type;this.render=function(R,D,N){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||R.length===0)return;const E=n.getRenderTarget(),M=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),z=n.state;z.setBlending(Jt),z.buffers.depth.getReversed()===!0?z.buffers.color.setClear(0,0,0,0):z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const H=u!==on&&this.type===on,X=u===on&&this.type!==on;for(let Y=0,W=R.length;Y<W;Y++){const ne=R[Y],V=ne.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",ne,"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>f||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/se.x),r.x=s.x*se.x,V.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/se.y),r.y=s.y*se.y,V.mapSize.y=s.y)),V.map===null||H===!0||X===!0){const pe=this.type!==on?{minFilter:qt,magFilter:qt}:{};V.map!==null&&V.map.dispose(),V.map=new Bt(r.x,r.y,pe),V.map.texture.name=ne.name+".shadowMap",V.camera.updateProjectionMatrix()}n.setRenderTarget(V.map),n.clear();const j=V.getViewportCount();for(let pe=0;pe<j;pe++){const ce=V.getViewport(pe);a.set(s.x*ce.x,s.y*ce.y,s.x*ce.z,s.y*ce.w),z.viewport(a),V.updateMatrices(ne,pe),i=V.getFrustum(),T(D,N,V.camera,ne,this.type)}V.isPointLightShadow!==!0&&this.type===on&&b(V,N),V.needsUpdate=!1}
vendor: 7,036 bytes, line 3816
3816u=this.type,m.needsUpdate=!1,n.setRenderTarget(E,M,P)};function b(R,D){const N=e.update(x);d.defines.VSM_SAMPLES!==R.blurSamples&&(d.defines.VSM_SAMPLES=R.blurSamples,p.defines.VSM_SAMPLES=R.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Bt(r.x,r.y)),d.uniforms.shadow_pass.value=R.map.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,n.setRenderTarget(R.mapPass),n.clear(),n.renderBufferDirect(D,null,N,d,x,null),p.uniforms.shadow_pass.value=R.mapPass.texture,p.uniforms.resolution.value=R.mapSize,p.uniforms.radius.value=R.radius,n.setRenderTarget(R.map),n.clear(),n.renderBufferDirect(D,null,N,p,x,null)}function y(R,D,N,E){let M=null;const P=N.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(P!==void 0)M=P;else if(M=N.isPointLight===!0?c:o,n.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const z=M.uuid,H=D.uuid;let X=l[z];X===void 0&&(X={},l[z]=X);let Y=X[H];Y===void 0&&(Y=M.clone(),X[H]=Y,D.addEventListener("dispose",w)),M=Y}if(M.visible=D.visible,M.wireframe=D.wireframe,E===on?M.side=D.shadowSide!==null?D.shadowSide:D.side:M.side=D.shadowSide!==null?D.shadowSide:h[D.side],M.alphaMap=D.alphaMap,M.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,M.map=D.map,M.clipShadows=D.clipShadows,M.clippingPlanes=D.clippingPlanes,M.clipIntersection=D.clipIntersection,M.displacementMap=D.displacementMap,M.displacementScale=D.displacementScale,M.displacementBias=D.displacementBias,M.wireframeLinewidth=D.wireframeLinewidth,M.linewidth=D.linewidth,N.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const z=n.properties.get(M);z.light=N}return M}function T(R,D,N,E,M){if(R.visible===!1)return;if(R.layers.test(D.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&M===on)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,R.matrixWorld);const H=e.update(R),X=R.material;if(Array.isArray(X)){const Y=H.groups;for(let W=0,ne=Y.length;W<ne;W++){const V=Y[W],se=X[V.materialIndex];if(se&&se.visible){const j=y(R,se,E,M);R.onBeforeShadow(n,R,D,N,H,j,V),n.renderBufferDirect(N,null,H,j,R,V),R.onAfterShadow(n,R,D,N,H,j,V)}}}else if(X.visible){const Y=y(R,X,E,M);R.onBeforeShadow(n,R,D,N,H,Y,null),n.renderBufferDirect(N,null,H,Y,R,null),R.onAfterShadow(n,R,D,N,H,Y,null)}}const z=R.children;for(let H=0,X=z.length;H<X;H++)T(z[H],D,N,E,M)}function w(R){R.target.removeEventListener("dispose",w);for(const N in l){const E=l[N],M=R.target.uuid;M in E&&(E[M].dispose(),delete E[M])}}}const Fd={[$r]:rr,[Zr]:Qr,[jr]:es,[ii]:Jr,[rr]:$r,[Qr]:Zr,[es]:jr,[Jr]:ii};function Od(n,e){function t(){let C=!1;const te=new ut;let re=null;const de=new ut(0,0,0,0);return{setMask:function(J){re!==J&&!C&&(n.colorMask(J,J,J,J),re=J)},setLocked:function(J){C=J},setClear:function(J,$,ve,Ue,nt){nt===!0&&(J*=Ue,$*=Ue,ve*=Ue),te.set(J,$,ve,Ue),de.equals(te)===!1&&(n.clearColor(J,$,ve,Ue),de.copy(te))},reset:function(){C=!1,re=null,de.set(-1,0,0,0)}}}function i(){let C=!1,te=!1,re=null,de=null,J=null;return{setReversed:function($){if(te!==$){const ve=e.get("EXT_clip_control");$?ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.ZERO_TO_ONE_EXT):ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.NEGATIVE_ONE_TO_ONE_EXT),te=$;const Ue=J;J=null,this.setClear(Ue)}},getReversed:function(){return te},setTest:function($){$?Z(n.DEPTH_TEST):he(n.DEPTH_TEST)},setMask:function($){re!==$&&!C&&(n.depthMask($),re=$)},setFunc:function($){if(te&&($=Fd[$]),de!==$){switch($){case $r:n.depthFunc(n.NEVER);break;case rr:n.depthFunc(n.ALWAYS);break;case Zr:n.depthFunc(n.LESS);break;case ii:n.depthFunc(n.LEQUAL);break;case jr:n.depthFunc(n.EQUAL);break;case Jr:n.depthFunc(n.GEQUAL);break;case Qr:n.depthFunc(n.GREATER);break;case es:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}de=$}},setLocked:function($){C=$},setClear:function($){J!==$&&(te&&($=1-$),n.clearDepth($),J=$)},reset:function(){C=!1,re=null,de=null,J=null,te=!1}}}function r(){let C=!1,te=null,re=null,de=null,J=null,$=null,ve=null,Ue=null,nt=null;return{setTest:function($e){C||($e?Z(n.STENCIL_TEST):he(n.STENCIL_TEST))},setMask:function($e){te!==$e&&!C&&(n.stencilMask($e),te=$e)},setFunc:function($e,Qt,Yt){(re!==$e||de!==Qt||J!==Yt)&&(n.stencilFunc($e,Qt,Yt),re=$e,de=Qt,J=Yt)},setOp:function($e,Qt,Yt){($!==$e||ve!==Qt||Ue!==Yt)&&(n.stencilOp($e,Qt,Yt),$=$e,ve=Qt,Ue=Yt)},setLocked:function($e){C=$e},setClear:function($e){nt!==$e&&(n.clearStencil($e),nt=$e)},reset:function(){C=!1,te=null,re=null,de=null,J=null,$=null,ve=null,Ue=null,nt=null}}}const s=new t,a=new i,o=new r,c=new WeakMap,l=new WeakMap;let f={},h={},d=new WeakMap,p=[],v=null,x=!1,m=null,u=null,b=null,y=null,T=null,w=null,R=null,D=new Ze(0,0,0),N=0,E=!1,M=null,P=null,z=null,H=null,X=null;const Y=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,ne=0;const V=n.getParameter(n.VERSION);V.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(V)[1]),W=ne>=1):V.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),W=ne>=2);let se=null,j={};const pe=n.getParameter(n.SCISSOR_BOX),ce=n.getParameter(n.VIEWPORT),He=new ut().fromArray(pe),Ke=new ut().fromArray(ce);function Ge(C,te,re,de){const J=new Uint8Array(4),$=n.createTexture();n.bindTexture(C,$),n.texParameteri(C,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(C,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ve=0;ve<re;ve++)C===n.TEXTURE_3D||C===n.TEXTURE_2D_ARRAY?n.texImage3D(te,0,n.RGBA,1,1,de,0,n.RGBA,n.UNSIGNED_BYTE,J):n.texImage2D(te+ve,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,J);return $}const q={};q[n.TEXTURE_2D]=Ge(n.TEXTURE_2D,n.TEXTURE_2D,1),q[n.TEXTURE_CUBE_MAP]=Ge(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),q[n.TEXTURE_2D_ARRAY]=Ge(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),q[n.TEXTURE_3D]=Ge(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Z(n.DEPTH_TEST),a.setFunc(ii),ye(!1),me(ea),Z(n.CULL_FACE),Ie(Jt);function Z(C){f[C]!==!0&&(n.enable(C),f[C]=!0)}function he(C){f[C]!==!1&&(n.disable(C),f[C]=!1)}function we(C,te){return h[C]!==te?(n.bindFramebuffer(C,te),h[C]=te,C===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=te),C===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=te),!0):!1}function xe(C,te){let re=p,de=!1;if(C){re=d.get(te),re===void 0&&(re=[],d.set(te,re));const J=C.textures;if(re.length!==J.length||re[0]!==n.COLOR_ATTACHMENT0){for(let $=0,ve=J.length;$<ve;$++)re[$]=n.COLOR_ATTACHMENT0+$;re.length=J.length,de=!0}}else re[0]!==n.BACK&&(re[0]=n.BACK,de=!0);de&&n.drawBuffers(re)}function Be(C){return v!==C?(n.useProgram(C),v=C,!0):!1}const _t={[Ln]:n.FUNC_ADD,[qo]:n.FUNC_SUBTRACT,[Yo]:n.FUNC_REVERSE_SUBTRACT};_t[Ko]=n.MIN,_t[$o]=n.MAX;const A={[Zo]:n.ZERO,[jo]:n.ONE,[Jo]:n.SRC_COLOR,[Yr]:n.SRC_ALPHA,[rl]:n.SRC_ALPHA_SATURATE,[nl]:n.DST_COLOR,[el]:n.DST_ALPHA,[Qo]:n.ONE_MINUS_SRC_COLOR,[Kr]:n.ONE_MINUS_SRC_ALPHA,[il]:n.ONE_MINUS_DST_COLOR,[tl]:n.ONE_MINUS_DST_ALPHA,[
vendor: 1,722 bytes, line 3816
3816sl]:n.CONSTANT_COLOR,[al]:n.ONE_MINUS_CONSTANT_COLOR,[ol]:n.CONSTANT_ALPHA,[ll]:n.ONE_MINUS_CONSTANT_ALPHA};function Ie(C,te,re,de,J,$,ve,Ue,nt,$e){if(C===Jt){x===!0&&(he(n.BLEND),x=!1);return}if(x===!1&&(Z(n.BLEND),x=!0),C!==Xo){if(C!==m||$e!==E){if((u!==Ln||T!==Ln)&&(n.blendEquation(n.FUNC_ADD),u=Ln,T=Ln),$e)switch(C){case ti:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ta:n.blendFunc(n.ONE,n.ONE);break;case na:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case ia:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}else switch(C){case ti:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ta:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case na:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ia:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}b=null,y=null,w=null,R=null,D.set(0,0,0),N=0,m=C,E=$e}return}J=J||te,$=$||re,ve=ve||de,(te!==u||J!==T)&&(n.blendEquationSeparate(_t[te],_t[J]),u=te,T=J),(re!==b||de!==y||$!==w||ve!==R)&&(n.blendFuncSeparate(A[re],A[de],A[$],A[ve]),b=re,y=de,w=$,R=ve),(Ue.equals(D)===!1||nt!==N)&&(n.blendColor(Ue.r,Ue.g,Ue.b,nt),D.copy(Ue),N=nt),m=C,E=!1}function Ae(C,te){C.side===Dt?he(n.CULL_FACE):Z(n.CULL_FACE);let re=C.side===gt;te&&(re=!re),ye(re),C.blending===ti&&C.transparent===!1?Ie(Jt):Ie(C.blending,C.blendEquation,C.blendSrc,C.blendDst,C.blendEquationAlpha,C.blendSrcAlpha,
vendor: 3,112 bytes, line 3816
3816C.blendDstAlpha,C.blendColor,C.blendAlpha,C.premultipliedAlpha),a.setFunc(C.depthFunc),a.setTest(C.depthTest),a.setMask(C.depthWrite),s.setMask(C.colorWrite);const de=C.stencilWrite;o.setTest(de),de&&(o.setMask(C.stencilWriteMask),o.setFunc(C.stencilFunc,C.stencilRef,C.stencilFuncMask),o.setOp(C.stencilFail,C.stencilZFail,C.stencilZPass)),ge(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),C.alphaToCoverage===!0?Z(n.SAMPLE_ALPHA_TO_COVERAGE):he(n.SAMPLE_ALPHA_TO_COVERAGE)}function ye(C){M!==C&&(C?n.frontFace(n.CW):n.frontFace(n.CCW),M=C)}function me(C){C!==Vo?(Z(n.CULL_FACE),C!==P&&(C===ea?n.cullFace(n.BACK):C===ko?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):he(n.CULL_FACE),P=C}function et(C){C!==z&&(W&&n.lineWidth(C),z=C)}function ge(C,te,re){C?(Z(n.POLYGON_OFFSET_FILL),(H!==te||X!==re)&&(n.polygonOffset(te,re),H=te,X=re)):he(n.POLYGON_OFFSET_FILL)}function Le(C){C?Z(n.SCISSOR_TEST):he(n.SCISSOR_TEST)}function ot(C){C===void 0&&(C=n.TEXTURE0+Y-1),se!==C&&(n.activeTexture(C),se=C)}function tt(C,te,re){re===void 0&&(se===null?re=n.TEXTURE0+Y-1:re=se);let de=j[re];de===void 0&&(de={type:void 0,texture:void 0},j[re]=de),(de.type!==C||de.texture!==te)&&(se!==re&&(n.activeTexture(re),se=re),n.bindTexture(C,te||q[C]),de.type=C,de.texture=te)}function S(){const C=j[se];C!==void 0&&C.type!==void 0&&(n.bindTexture(C.type,null),C.type=void 0,C.texture=void 0)}function g(){try{n.compressedTexImage2D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function U(){try{n.compressedTexImage3D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function G(){try{n.texSubImage2D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function K(){try{n.texSubImage3D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function k(){try{n.compressedTexSubImage2D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Te(){try{n.compressedTexSubImage3D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ie(){try{n.texStorage2D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Se(){try{n.texStorage3D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Me(){try{n.texImage2D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ee(){try{n.texImage3D(...arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ue(C){He.equals(C)===!1&&(n.scissor(C.x,C.y,C.z,C.w),He.copy(C))}function Pe(C){Ke.equals(C)===!1&&(n.viewport(C.x,C.y,C.z,C.w),Ke.copy(C))}function Ee(C,te){let re=l.get(te);re===void 0&&(re=new WeakMap,l.set(te,re));let de=re.get(C);de===void 0&&(de=n.getUniformBlockIndex(te,C.name),re.set(C,de))}function oe(C,te){const de=l.get(te).get(C);c.get(te)!==de&&(n.uniformBlockBinding(te,de,C.__bindingPointIndex),c.set(te,de))}function Ne(){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,705 bytes, line 3816
3816(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),f={},se=null,j={},h={},d=new WeakMap,p=[],v=null,x=!1,m=null,u=null,b=null,y=null,T=null,w=null,R=null,D=new Ze(0,0,0),N=0,E=!1,M=null,P=null,z=null,H=null,X=null,He.set(0,0,n.canvas.width,n.canvas.height),Ke.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:Z,disable:he,bindFramebuffer:we,drawBuffers:xe,useProgram:Be,setBlending:Ie,setMaterial:Ae,setFlipSided:ye,setCullFace:me,setLineWidth:et,setPolygonOffset:ge,setScissorTest:Le,activeTexture:ot,bindTexture:tt,unbindTexture:S,compressedTexImage2D:g,compressedTexImage3D:U,texImage2D:Me,texImage3D:ee,updateUBOMapping:Ee,uniformBlockBinding:oe,texStorage2D:ie,texStorage3D:Se,texSubImage2D:G,texSubImage3D:K,compressedTexSubImage2D:k,compressedTexSubImage3D:Te,scissor:ue,viewport:Pe,reset:Ne}}function Bd(n,e,t,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new ze,f=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(S,g){return p?new OffscreenCanvas(S,g):or("canvas")}function x(S,g,U){let G=1;const K=tt(S);if((K.width>U||K.height>U)&&(G=U/Math.max(K.width,K.height)),G<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){const k=Math.floor(G*K.width),Te=Math.floor(G*K.height);h===void 0&&(h=v(k,Te));const ie=g?v(k,Te):h;return ie.width=k,ie.height=Te,ie.getContext("2d").drawImage(S,0,0,k,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+k+"x"+Te+")."),ie}else return"data"in S&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),S;return S}function m(S){return S.generateMipmaps}function u(S){n.generateMipmap(S)}function b(S){return S.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?n.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function y(S,g,U,G,K=!1){if(S!==null){if(n[S]!==void 0)return n[S];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let k=g;if(g===n.RED&&(U===n.FLOAT&&(k=n.R32F),U===n.HALF_FLOAT&&(k=n.R16F),U===n.UNSIGNED_BYTE&&(k=n.R8)),g===n.RED_INTEGER&&(U===n.UNSIGNED_BYTE&&(k=n.R8UI),U===n.UNSIGNED_SHORT&&(k=n.R16UI),U===n.UNSIGNED_INT&&(k=n.R32UI),U===n.BYTE&&(k=n.R8I),U===n.SHORT&&(k=n.R16I),U===n.INT&&(k=n.R32I)),g===n.RG&&(U===n.FLOAT&&(k=n.RG32F),U===n.HALF_FLOAT&&(k=n.RG16F),U===n.UNSIGNED_BYTE&&(k=n.RG8)),g===n.RG_INTEGER&&(U===n.UNSIGNED_BYTE&&(k=n.RG8UI),U===n.UNSIGNED_SHORT&&(k=n.RG16UI),U===n.UNSIGNED_INT&&(k=n.RG32UI),U===n.BYTE&&(k=n.RG8I),U===n.SHORT&&(k=n.RG16I),U===n.INT&&(k=n.RG32I)),g===n.RGB_INTEGER&&(U===n.UNSIGNED_BYTE&&(k=n.RGB8UI),U===n.UNSIGNED_SHORT&&(k=n.RGB16UI),U===n.UNSIGNED_INT&&(k=n.RGB32UI),U===n.BYTE&&(k=n.RGB8I),U===n.SHORT&&(k=n.RGB16I),U===n.INT&&(k=n.RGB32I)),g===n.RGBA_INTEGER&&(U===n.UNSIGNED_BYTE&&(k=n.RGBA8UI),U===n.UNSIGNED_SHORT&&(k=n.RGBA16UI),U===n.UNSIGNED_INT&&(k=n.RGBA32UI),U===n.BYTE&&(k=n.RGBA8I),U===n.SHORT&&(k=n.RGBA16I),U===n.INT&&(k=n.RGBA32I)),g===n.RGB&&(U===n.UNSIGNED_INT_5_9_9_9_REV&&(k=n.RGB9_E5),U===n.UNSIGNED_INT_10F_11F_11F_REV&&(k=n.R11F_G11F_B10F)),g===n.RGBA){const Te=K?sr:qe.getTransfer(G);U===n.FLOAT&&(k=n.RGBA32F),U===n.HALF_FLOAT&&(k=n.RGBA16F),U===n.UNSIGNED_BYTE&&(k=Te===Je?n.SRGB8_ALPHA8:n.RGBA8),U===n.UNSIGNED_SHORT_4_4_4_4&&(k=n.RGBA4),U===n.UNSIGNED_SHORT_5_5_5_1&&(k=n.RGB5_A1)}return(k===n.R16F||k===n.R32F||k===n.RG16F||k===n.RG32F||k===n.RGBA16F||k===n.RGBA32F)&&e.get("EXT_color_buffer_float"),k}function T(S,g){let U;return S?g===null||g===Bn||g===ai?U=n.DEPTH24_STENCIL8:g===Zt?U=n.DEPTH32F_STENCIL8:g===xi&&(U=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):g===null||g===Bn||g===ai?U=n.DEPTH_COMPONENT24:g===Zt?U=n.DEPTH_COMPONENT32F:g===xi&&(U=n.DEPTH_COMPONENT16),U}function w(S,g){return m(S)===!0||S.isFramebufferTexture&&S.minFilter!==qt&&S.minFilter!==Mt?Math.log2(Math.max(g.width,g.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?g.mipmaps.length:1}function R(S){const g=S.target;g.removeEventListener("dispose",R),N(g),g.isVideoTexture&&f.delete(g)}function D(S){const g=S.target;g.removeEventListener("dispose",D),M(g)}function N(S){const g=i.get(S);if(g.__webglInit===void 0)return;const U=S.source,G=d.get(U);if(G){const K=G[g.__cacheKey];K.usedTimes--,K.usedTimes===0&&E(S),Object.keys(G).length===0&&d.delete(U)}i.remove(S)}function E(S){const g=i.get(S);n.deleteTexture(g.__webglTexture);const U=S.source,G=d.get(U);delete G[g.__cacheKey],a.memory.textures--}function M(S){const g=i.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),i.remove(S.depthTexture)),S.isWebGLCubeRen
vendor: 6,013 bytes, line 3816
3816derTarget)for(let G=0;G<6;G++){if(Array.isArray(g.__webglFramebuffer[G]))for(let K=0;K<g.__webglFramebuffer[G].length;K++)n.deleteFramebuffer(g.__webglFramebuffer[G][K]);else n.deleteFramebuffer(g.__webglFramebuffer[G]);g.__webglDepthbuffer&&n.deleteRenderbuffer(g.__webglDepthbuffer[G])}else{if(Array.isArray(g.__webglFramebuffer))for(let G=0;G<g.__webglFramebuffer.length;G++)n.deleteFramebuffer(g.__webglFramebuffer[G]);else n.deleteFramebuffer(g.__webglFramebuffer);if(g.__webglDepthbuffer&&n.deleteRenderbuffer(g.__webglDepthbuffer),g.__webglMultisampledFramebuffer&&n.deleteFramebuffer(g.__webglMultisampledFramebuffer),g.__webglColorRenderbuffer)for(let G=0;G<g.__webglColorRenderbuffer.length;G++)g.__webglColorRenderbuffer[G]&&n.deleteRenderbuffer(g.__webglColorRenderbuffer[G]);g.__webglDepthRenderbuffer&&n.deleteRenderbuffer(g.__webglDepthRenderbuffer)}const U=S.textures;for(let G=0,K=U.length;G<K;G++){const k=i.get(U[G]);k.__webglTexture&&(n.deleteTexture(k.__webglTexture),a.memory.textures--),i.remove(U[G])}i.remove(S)}let P=0;function z(){P=0}function H(){const S=P;return S>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+r.maxTextures),P+=1,S}function X(S){const g=[];return g.push(S.wrapS),g.push(S.wrapT),g.push(S.wrapR||0),g.push(S.magFilter),g.push(S.minFilter),g.push(S.anisotropy),g.push(S.internalFormat),g.push(S.format),g.push(S.type),g.push(S.generateMipmaps),g.push(S.premultiplyAlpha),g.push(S.flipY),g.push(S.unpackAlignment),g.push(S.colorSpace),g.join()}function Y(S,g){const U=i.get(S);if(S.isVideoTexture&&Le(S),S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&U.__version!==S.version){const G=S.image;if(G===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(G.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(U,S,g);return}}else S.isExternalTexture&&(U.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,U.__webglTexture,n.TEXTURE0+g)}function W(S,g){const U=i.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&U.__version!==S.version){q(U,S,g);return}t.bindTexture(n.TEXTURE_2D_ARRAY,U.__webglTexture,n.TEXTURE0+g)}function ne(S,g){const U=i.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&U.__version!==S.version){q(U,S,g);return}t.bindTexture(n.TEXTURE_3D,U.__webglTexture,n.TEXTURE0+g)}function V(S,g){const U=i.get(S);if(S.version>0&&U.__version!==S.version){Z(U,S,g);return}t.bindTexture(n.TEXTURE_CUBE_MAP,U.__webglTexture,n.TEXTURE0+g)}const se={[is]:n.REPEAT,[In]:n.CLAMP_TO_EDGE,[rs]:n.MIRRORED_REPEAT},j={[qt]:n.NEAREST,[vl]:n.NEAREST_MIPMAP_NEAREST,[Di]:n.NEAREST_MIPMAP_LINEAR,[Mt]:n.LINEAR,[dr]:n.LINEAR_MIPMAP_NEAREST,[Nn]:n.LINEAR_MIPMAP_LINEAR},pe={[El]:n.NEVER,[Cl]:n.ALWAYS,[Tl]:n.LESS,[mo]:n.LEQUAL,[yl]:n.EQUAL,[Rl]:n.GEQUAL,[bl]:n.GREATER,[Al]:n.NOTEQUAL};function ce(S,g){if(g.type===Zt&&e.has("OES_texture_float_linear")===!1&&(g.magFilter===Mt||g.magFilter===dr||g.magFilter===Di||g.magFilter===Nn||g.minFilter===Mt||g.minFilter===dr||g.minFilter===Di||g.minFilter===Nn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(S,n.TEXTURE_WRAP_S,se[g.wrapS]),n.texParameteri(S,n.TEXTURE_WRAP_T,se[g.wrapT]),(S===n.TEXTURE_3D||S===n.TEXTURE_2D_ARRAY)&&n.texParameteri(S,n.TEXTURE_WRAP_R,se[g.wrapR]),n.texParameteri(S,n.TEXTURE_MAG_FILTER,j[g.magFilter]),n.texParameteri(S,n.TEXTURE_MIN_FILTER,j[g.minFilter]),g.compareFunction&&(n.texParameteri(S,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(S,n.TEXTURE_COMPARE_FUNC,pe[g.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(g.magFilter===qt||g.minFilter!==Di&&g.minFilter!==Nn||g.type===Zt&&e.has("OES_texture_float_linear")===!1)return;if(g.anisotropy>1||i.get(g).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");n.texParameterf(S,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,r.getMaxAnisotropy())),i.get(g).__currentAnisotropy=g.anisotropy}}}function He(S,g){let U=!1;S.__webglInit===void 0&&(S.__webglInit=!0,g.addEventListener("dispose",R));const G=g.source;let K=d.get(G);K===void 0&&(K={},d.set(G,K));const k=X(g);if(k!==S.__cacheKey){K[k]===void 0&&(K[k]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,U=!0),K[k].usedTimes++;const Te=K[S.__cacheKey];Te!==void 0&&(K[S.__cacheKey].usedTimes--,Te.usedTimes===0&&E(g)),S.__cacheKey=k,S.__webglTexture=K[k].texture}return U}function Ke(S,g,U){return Math.floor(Math.floor(S/U)/g)}function Ge(S,g,U,G){const k=S.updateRanges;if(k.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,g.width,g.height,U,G,g.data);else{k.sort((ee,ue)=>ee.start-ue.start);let Te=0;for(let ee=1;ee<k.length;ee++){const ue=k[Te],Pe=k[ee],Ee=ue.start+ue.count,oe=Ke(Pe.start,g.width,4),Ne=Ke(ue.start,g.width,4);Pe.start<=Ee+1&&oe===Ne&&Ke(Pe.start+Pe.count-1,g.width,4)===oe?ue.count=Math.max(ue.count,Pe.start+Pe.count-ue.start):(++Te,k[Te]=Pe)}k.length=Te+1;const ie=n.getParameter(n.UNPACK_ROW_LENGTH),Se=n.getParameter(n.UNPACK_SKIP_PIXELS),Me=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,g.width);for(let ee=0,ue=k.length;ee<ue;ee++){const Pe=k[ee],Ee=Math.floor(Pe.start/4),oe=Math.ceil(Pe.count/4),Ne=Ee%g.width,C=Math.floor(Ee/g.width),te=oe,re=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,Ne),n.pixelStorei(n.UNPACK_SKIP_ROWS,C),t.texSubImage2D(n.TEXTURE_2D,0,Ne,C,te,re,U,G,g.data)}S.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,ie),n.pixelStorei(n.UNPACK_SKIP_PIXELS,Se),n.pixelStorei(n.UNPACK_SKIP_ROWS,Me)}}function q(S,g,U){let G=n.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(G=n.TEXTURE_2D_ARRAY),g.isData3DTexture&&(G=n.TEXTURE_3D);const K=He(S,g),k=g.source;t.bindTexture(G,S.__webglTexture,n.TEXTURE0+U);const Te=i.get(k);if(k.version!==Te.__version||K===!0){t.activeTexture(n.TEXTURE0+U);
vendor: 13,130 bytes, line 3816
3816const ie=qe.getPrimaries(qe.workingColorSpace),Se=g.colorSpace===$t?null:qe.getPrimaries(g.colorSpace),Me=g.colorSpace===$t||ie===Se?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,g.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,g.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);let ee=x(g.image,!1,r.maxTextureSize);ee=ot(g,ee);const ue=s.convert(g.format,g.colorSpace),Pe=s.convert(g.type);let Ee=y(g.internalFormat,ue,Pe,g.colorSpace,g.isVideoTexture);ce(G,g);let oe;const Ne=g.mipmaps,C=g.isVideoTexture!==!0,te=Te.__version===void 0||K===!0,re=k.dataReady,de=w(g,ee);if(g.isDepthTexture)Ee=T(g.format===oi,g.type),te&&(C?t.texStorage2D(n.TEXTURE_2D,1,Ee,ee.width,ee.height):t.texImage2D(n.TEXTURE_2D,0,Ee,ee.width,ee.height,0,ue,Pe,null));else if(g.isDataTexture)if(Ne.length>0){C&&te&&t.texStorage2D(n.TEXTURE_2D,de,Ee,Ne[0].width,Ne[0].height);for(let J=0,$=Ne.length;J<$;J++)oe=Ne[J],C?re&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,oe.width,oe.height,ue,Pe,oe.data):t.texImage2D(n.TEXTURE_2D,J,Ee,oe.width,oe.height,0,ue,Pe,oe.data);g.generateMipmaps=!1}else C?(te&&t.texStorage2D(n.TEXTURE_2D,de,Ee,ee.width,ee.height),re&&Ge(g,ee,ue,Pe)):t.texImage2D(n.TEXTURE_2D,0,Ee,ee.width,ee.height,0,ue,Pe,ee.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){C&&te&&t.texStorage3D(n.TEXTURE_2D_ARRAY,de,Ee,Ne[0].width,Ne[0].height,ee.depth);for(let J=0,$=Ne.length;J<$;J++)if(oe=Ne[J],g.format!==Wt)if(ue!==null)if(C){if(re)if(g.layerUpdates.size>0){const ve=Ta(oe.width,oe.height,g.format,g.type);for(const Ue of g.layerUpdates){const nt=oe.data.subarray(Ue*ve/oe.data.BYTES_PER_ELEMENT,(Ue+1)*ve/oe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,Ue,oe.width,oe.height,1,ue,nt)}g.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,oe.width,oe.height,ee.depth,ue,oe.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,J,Ee,oe.width,oe.height,ee.depth,0,oe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?re&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,oe.width,oe.height,ee.depth,ue,Pe,oe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,J,Ee,oe.width,oe.height,ee.depth,0,ue,Pe,oe.data)}else{C&&te&&t.texStorage2D(n.TEXTURE_2D,de,Ee,Ne[0].width,Ne[0].height);for(let J=0,$=Ne.length;J<$;J++)oe=Ne[J],g.format!==Wt?ue!==null?C?re&&t.compressedTexSubImage2D(n.TEXTURE_2D,J,0,0,oe.width,oe.height,ue,oe.data):t.compressedTexImage2D(n.TEXTURE_2D,J,Ee,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?re&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,oe.width,oe.height,ue,Pe,oe.data):t.texImage2D(n.TEXTURE_2D,J,Ee,oe.width,oe.height,0,ue,Pe,oe.data)}else if(g.isDataArrayTexture)if(C){if(te&&t.texStorage3D(n.TEXTURE_2D_ARRAY,de,Ee,ee.width,ee.height,ee.depth),re)if(g.layerUpdates.size>0){const J=Ta(ee.width,ee.height,g.format,g.type);for(const $ of g.layerUpdates){const ve=ee.data.subarray($*J/ee.data.BYTES_PER_ELEMENT,($+1)*J/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,$,ee.width,ee.height,1,ue,Pe,ve)}g.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,ue,Pe,ee.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ee,ee.width,ee.height,ee.depth,0,ue,Pe,ee.data);else if(g.isData3DTexture)C?(te&&t.texStorage3D(n.TEXTURE_3D,de,Ee,ee.width,ee.height,ee.depth),re&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,ue,Pe,ee.data)):t.texImage3D(n.TEXTURE_3D,0,Ee,ee.width,ee.height,ee.depth,0,ue,Pe,ee.data);else if(g.isFramebufferTexture){if(te)if(C)t.texStorage2D(n.TEXTURE_2D,de,Ee,ee.width,ee.height);else{let J=ee.width,$=ee.height;for(let ve=0;ve<de;ve++)t.texImage2D(n.TEXTURE_2D,ve,Ee,J,$,0,ue,Pe,null),J>>=1,$>>=1}}else if(Ne.length>0){if(C&&te){const J=tt(Ne[0]);t.texStorage2D(n.TEXTURE_2D,de,Ee,J.width,J.height)}for(let J=0,$=Ne.length;J<$;J++)oe=Ne[J],C?re&&t.texSubImage2D(n.TEXTURE_2D,J,0,0,ue,Pe,oe):t.texImage2D(n.TEXTURE_2D,J,Ee,ue,Pe,oe);g.generateMipmaps=!1}else if(C){if(te){const J=tt(ee);t.texStorage2D(n.TEXTURE_2D,de,Ee,J.width,J.height)}re&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ue,Pe,ee)}else t.texImage2D(n.TEXTURE_2D,0,Ee,ue,Pe,ee);m(g)&&u(G),Te.__version=k.version,g.onUpdate&&g.onUpdate(g)}S.__version=g.version}function Z(S,g,U){if(g.image.length!==6)return;const G=He(S,g),K=g.source;t.bindTexture(n.TEXTURE_CUBE_MAP,S.__webglTexture,n.TEXTURE0+U);const k=i.get(K);if(K.version!==k.__version||G===!0){t.activeTexture(n.TEXTURE0+U);const Te=qe.getPrimaries(qe.workingColorSpace),ie=g.colorSpace===$t?null:qe.getPrimaries(g.colorSpace),Se=g.colorSpace===$t||Te===ie?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,g.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,g.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const Me=g.isCompressedTexture||g.image[0].isCompressedTexture,ee=g.image[0]&&g.image[0].isDataTexture,ue=[];for(let $=0;$<6;$++)!Me&&!ee?ue[$]=x(g.image[$],!0,r.maxCubemapSize):ue[$]=ee?g.image[$].image:g.image[$],ue[$]=ot(g,ue[$]);const Pe=ue[0],Ee=s.convert(g.format,g.colorSpace),oe=s.convert(g.type),Ne=y(g.internalFormat,Ee,oe,g.colorSpace),C=g.isVideoTexture!==!0,te=k.__version===void 0||G===!0,re=K.dataReady;let de=w(g,Pe);ce(n.TEXTURE_CUBE_MAP,g);let J;if(Me){C&&te&&t.texStorage2D(n.TEXTURE_CUBE_MAP,de,Ne,Pe.width,Pe.height);for(let $=0;$<6;$++){J=ue[$].mipmaps;for(let ve=0;ve<J.length;ve++){const Ue=J[ve];g.format!==Wt?Ee!==null?C?re&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,Ue.width,Ue.height,Ee,Ue.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,Ne,Ue.width,Ue.height,0,Ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,Ue.width,Ue.height,Ee,oe,Ue.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,Ne,Ue.width,Ue.height,0,Ee,oe,Ue.data)}}}else{if(J=g.mipmaps,C&&te){J.length>0&&de++;const $=tt(ue[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,de,Ne,$.width,$.height)}for(let $=0;$<6;$++)if(ee){C?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,ue[$].width,ue[$].height,Ee,oe,ue[$].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Ne,ue[$].width,ue[$].height,0,Ee,oe,ue[$].data);for(let ve=0;ve<J.length;ve++){const nt=J[ve].image[$].image;C?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,nt.width,nt.height,Ee,oe,nt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,Ne,nt.width,nt.height,0,Ee,oe,nt.data)}}else{C?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,Ee,oe,ue[$]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Ne,Ee,oe,ue[$]);for(let ve=0;ve<J.length;ve++){const Ue=J[ve];C?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,Ee,oe,Ue.image[$]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,Ne,Ee,oe,Ue.image[$])}}}m(g)&&u(n.TEXTURE_CUBE_MAP),k.__version=K.version,g.onUpdate&&g.onUpdate(g)}S.__version=g.version}function he(S,g,U,G,K,k){const Te=s.convert(U.format,U.colorSpace),ie=s.convert(U.type),Se=y(U.internalFormat,Te,ie,U.colorSpace),Me=i.get(g),ee=i.get(U);if(ee.__renderTarget=g,!Me.__hasExternalTextures){const ue=Math.max(1,g.width>>k),Pe=Math.max(1,g.height>>k);K===n.TEXTURE_3D||K===n.TEXTURE_2D_ARRAY?t.texImage3D(K,k,Se,ue,Pe,g.depth,0,Te,ie,null):t.texImage2D(K,k,Se,ue,Pe,0,Te,ie,null)}t.bindFramebuffer(n.FRAMEBUFFER,S),ge(g)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,G,K,ee.__webglTexture,0,et(g)):(K===n.TEXTURE_2D||K>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,G,K,ee.__webglTexture,k),t.bindFramebuffer(n.FRAMEBUFFER,null)}function we(S,g,U){if(n.bindRenderbuffer(n.RENDERBUFFER,S),g.depthBuffer){const G=g.depthTexture,K=G&&G.isDepthTexture?G.type:null,k=T(g.stencilBuffer,K),Te=g.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ie=et(g);ge(g)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,k,g.width,g.height):U?n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,k,g.width,g.height):n.renderbufferStorage(n.RENDERBUFFER,k,g.width,g.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Te,n.RENDERBUFFER,S)}else{const G=g.textures;for(let K=0;K<G.length;K++){const k=G[K],Te=s.convert(k.format,k.colorSpace),ie=s.convert(k.type),Se=y(k.internalFormat,Te,ie,k.colorSpace),Me=et(g);U&&ge(g)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Me,Se,g.width,g.height):ge(g)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Me,Se,g.width,g.height):n.renderbufferStorage(n.RENDERBUFFER,Se,g.width,g.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function xe(S,g){if(g&&g.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,S),!(g.depthTexture&&g.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const G=i.get(g.depthTexture);G.__renderTarget=g,(!G.__webglTexture||g.depthTexture.image.width!==g.width||g.depthTexture.image.height!==g.height)&&(g.depthTexture.image.width=g.width,g.depthTexture.image.height=g.height,g.depthTexture.needsUpdate=!0),Y(g.depthTexture,0);const K=G.__webglTexture,k=et(g);if(g.depthTexture.format===Si)ge(g)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,K,0,k):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,K,0);else if(g.depthTexture.format===oi)ge(g)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,K,0,k):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,K,0);else throw new Error("Unknown depthTexture format")}function Be(S){const g=i.get(S),U=S.isWebGLCubeRenderTarget===!0;if(g.__boundDepthTexture!==S.depthTexture){const G=S.depthTexture;if(g.__depthDisposeCallback&&g.__depthDisposeCallback(),G){const K=()=>{delete g.__boundDepthTexture,delete g.__depthDisposeCallback,G.removeEventListener("dispose",K)};G.addEventListener("dispose",K),g.__depthDisposeCallback=K}g.__boundDepthTexture=G}if(S.depthTexture&&!g.__autoAllocateDepthBuffer){if(U)throw new Error("target.depthTexture not supported in Cube render targets");const G=S.texture.mipmaps;G&&G.length>0?xe(g.__webglFramebuffer[0],S):xe(g.__webglFramebuffer,S)}else if(U){g.__webglDepthbuffer=[];for(let G=0;G<6;G++)if(t.bindFramebuffer(n.FRAMEBUFFER,g.__webglFramebuffer[G]),g.__webglDepthbuffer[G]===void 0)g.__webglDepthbuffer[G]=n.createRenderbuffer(),we(g.__webglDepthbuffer[G],S,!1);else{const K=S.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,k=g.__webglDepthbuffer[G];n.bindRenderbuffer(n.RENDERBUFFER,k),n.framebufferRenderbuffer(n.FRAMEBUFFER,K,n.RENDERBUFFER,k)}}else{const G=S.texture.mipmaps;if(G&&G.length>0?t.bindFramebuffer(n.FRAMEBUFFER,g.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,g.__webglFramebuffer),g.__webglDepthbuffer===void 0)g.__webglDepthbuffer=n.createRenderbuffer(),we(g.__webglDepthbuffer,S,!1);else{const K=S.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,k=g.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,k),n.framebufferRenderbuffer(n.FRAMEBUFFER,K,n.RENDERBUFFER,k)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function _t(S,g,U){const G=i.get(S);g!==void 0&&he(G.__webglFramebuffer,S,S.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),U!==void 0&&Be(S)}function A(S){const g=S.texture,U=i.get(S),G=i.get(g);S.addEventListener("dispose",D);const K=S.textures,k=S.isWebGLCubeRenderTarget===!0,Te=K.length>1;if(Te||(G.__webglTexture===void 0&&(G.__webglTexture=n.createTexture()),G.__version=g.version,a.memory.textures++),k){U.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(g.mipmaps&&g.mipmaps.length>0){U.__webglFramebuffer[ie]=[];for(let Se=0;Se<g.mipmaps.length;Se++)U.__webglFramebuffer[ie][Se]=n.createFramebuffer()}else U.__webglFramebuffer[ie]=n.createFramebuffer()}else{if(g.mipmaps&&g.mipmaps.length>0){U.__webglFramebuffer=[];for(let ie=0;ie<g.mipmaps.length;ie++)U.__webglFramebuffer[ie]=n.createFramebuffer()}else U.__webglFramebuffer=n.createFramebuffer();if(Te)for(let ie=0,Se=K.length;ie<Se;ie++){const Me=i.get(K[ie]);Me.__webglTexture===void 0&&(Me.__webglTexture=n.createTexture(),a.memory.textures++)}if(S.samples>0&&ge(S)===!1){U.__webglMultisampledFramebuffer=n.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let ie=0;ie<K.length;ie++){const Se=K[ie];U.__webglColorRenderbuffer[ie]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,U.__webglColorRenderbuffer[ie]);const Me=s.convert(Se.format,Se.colorSpace),ee=s.convert(Se.type),ue=y(Se.internalFormat,Me,ee,Se.colorSpace,S.isXRRenderTarget===!0),Pe=et(S);n.renderbufferStorageMultisample(n.RENDERBUFFER,Pe,ue,S.width,S.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ie,n.RENDERBUFFER,U.__webglColorRen
vendor: 4,454 bytes, line 3816
3816derbuffer[ie])}n.bindRenderbuffer(n.RENDERBUFFER,null),S.depthBuffer&&(U.__webglDepthRenderbuffer=n.createRenderbuffer(),we(U.__webglDepthRenderbuffer,S,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(k){t.bindTexture(n.TEXTURE_CUBE_MAP,G.__webglTexture),ce(n.TEXTURE_CUBE_MAP,g);for(let ie=0;ie<6;ie++)if(g.mipmaps&&g.mipmaps.length>0)for(let Se=0;Se<g.mipmaps.length;Se++)he(U.__webglFramebuffer[ie][Se],S,g,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Se);else he(U.__webglFramebuffer[ie],S,g,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0);m(g)&&u(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Te){for(let ie=0,Se=K.length;ie<Se;ie++){const Me=K[ie],ee=i.get(Me);let ue=n.TEXTURE_2D;(S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(ue=S.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ue,ee.__webglTexture),ce(ue,Me),he(U.__webglFramebuffer,S,Me,n.COLOR_ATTACHMENT0+ie,ue,0),m(Me)&&u(ue)}t.unbindTexture()}else{let ie=n.TEXTURE_2D;if((S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(ie=S.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ie,G.__webglTexture),ce(ie,g),g.mipmaps&&g.mipmaps.length>0)for(let Se=0;Se<g.mipmaps.length;Se++)he(U.__webglFramebuffer[Se],S,g,n.COLOR_ATTACHMENT0,ie,Se);else he(U.__webglFramebuffer,S,g,n.COLOR_ATTACHMENT0,ie,0);m(g)&&u(ie),t.unbindTexture()}S.depthBuffer&&Be(S)}function Ie(S){const g=S.textures;for(let U=0,G=g.length;U<G;U++){const K=g[U];if(m(K)){const k=b(S),Te=i.get(K).__webglTexture;t.bindTexture(k,Te),u(k),t.unbindTexture()}}}const Ae=[],ye=[];function me(S){if(S.samples>0){if(ge(S)===!1){const g=S.textures,U=S.width,G=S.height;let K=n.COLOR_BUFFER_BIT;const k=S.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Te=i.get(S),ie=g.length>1;if(ie)for(let Me=0;Me<g.length;Me++)t.bindFramebuffer(n.FRAMEBUFFER,Te.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Te.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Te.__webglMultisampledFramebuffer);const Se=S.texture.mipmaps;Se&&Se.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Te.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Te.__webglFramebuffer);for(let Me=0;Me<g.length;Me++){if(S.resolveDepthBuffer&&(S.depthBuffer&&(K|=n.DEPTH_BUFFER_BIT),S.stencilBuffer&&S.resolveStencilBuffer&&(K|=n.STENCIL_BUFFER_BIT)),ie){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Te.__webglColorRenderbuffer[Me]);const ee=i.get(g[Me]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,ee,0)}n.blitFramebuffer(0,0,U,G,0,0,U,G,K,n.NEAREST),c===!0&&(Ae.length=0,ye.length=0,Ae.push(n.COLOR_ATTACHMENT0+Me),S.depthBuffer&&S.resolveDepthBuffer===!1&&(Ae.push(k),ye.push(k),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,ye)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ae))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ie)for(let Me=0;Me<g.length;Me++){t.bindFramebuffer(n.FRAMEBUFFER,Te.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,Te.__webglColorRenderbuffer[Me]);const ee=i.get(g[Me]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Te.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,ee,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Te.__webglMultisampledFramebuffer)}else if(S.depthBuffer&&S.resolveDepthBuffer===!1&&c){const g=S.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[g])}}}function et(S){return Math.min(r.maxSamples,S.samples)}function ge(S){const g=i.get(S);return S.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&g.__useRenderToTexture!==!1}function Le(S){const g=a.render.frame;f.get(S)!==g&&(f.set(S,g),S.update())}function ot(S,g){const U=S.colorSpace,G=S.format,K=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||U!==vn&&U!==$t&&(qe.getTransfer(U)===Je?(G!==Wt||K!==At)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),g}function tt(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(l.width=S.naturalWi
vendor: 3,098 bytes, line 3816
3816dth||S.width,l.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(l.width=S.displayWidth,l.height=S.displayHeight):(l.width=S.width,l.height=S.height),l}this.allocateTextureUnit=H,this.resetTextureUnits=z,this.setTexture2D=Y,this.setTexture2DArray=W,this.setTexture3D=ne,this.setTextureCube=V,this.rebindTextures=_t,this.setupRenderTarget=A,this.updateRenderTargetMipmap=Ie,this.updateMultisampleRenderTarget=me,this.setupDepthRenderbuffer=Be,this.setupFrameBufferTexture=he,this.useMultisampledRTT=ge}function zd(n,e){function t(i,r=$t){let s;const a=qe.getTransfer(r);if(i===At)return n.UNSIGNED_BYTE;if(i===zs)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Hs)return n.UNSIGNED_SHORT_5_5_5_1;if(i===lo)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===co)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===ao)return n.BYTE;if(i===oo)return n.SHORT;if(i===xi)return n.UNSIGNED_SHORT;if(i===Bs)return n.INT;if(i===Bn)return n.UNSIGNED_INT;if(i===Zt)return n.FLOAT;if(i===Ei)return n.HALF_FLOAT;if(i===uo)return n.ALPHA;if(i===fo)return n.RGB;if(i===Wt)return n.RGBA;if(i===Si)return n.DEPTH_COMPONENT;if(i===oi)return n.DEPTH_STENCIL;if(i===ho)return n.RED;if(i===Gs)return n.RED_INTEGER;if(i===po)return n.RG;if(i===Vs)return n.RG_INTEGER;if(i===ks)return n.RGBA_INTEGER;if(i===Qi||i===er||i===tr||i===nr)if(a===Je)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Qi)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===er)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===tr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===nr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Qi)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===er)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===tr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===nr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===ss||i===as||i===os||i===ls)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===ss)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===as)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===os)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===ls)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===cs||i===us||i===fs)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===cs||i===us)return a===Je?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===fs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===hs||i===ds||i===ps||i===ms||i===gs||i===_s||i===vs||i===xs||i===Ss||i===Ms||i===Es||i===Ts||i===ys||i===bs)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===hs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===ds)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ps)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ms)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===gs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;
vendor: 11,615 bytes, lines 3816-3840
3816if(i===_s)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===xs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ss)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ms)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Es)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ts)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ys)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===bs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===As||i===Rs||i===Cs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===As)return a===Je?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Rs)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Cs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ws||i===Ps||i===Ds||i===Ls)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===ws)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ps)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ds)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Ls)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===ai?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const Hd=` 3817void main() { 3818 3819 gl_Position = vec4( position, 1.0 ); 3820 3821}`,Gd=` 3822uniform sampler2DArray depthColor; 3823uniform float depthWidth; 3824uniform float depthHeight; 3825 3826void main() { 3827 3828 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3829 3830 if ( coord.x >= 1.0 ) { 3831 3832 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3833 3834 } else { 3835 3836 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3837 3838 } 3839 3840}`;class Vd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new Ro(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new zt({vertexShader:Hd,fragmentShader:Gd,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Xt(new Ci(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class kd extends xn{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,f=null,h=null,d=null,p=null,v=null;const x=typeof XRWebGLBinding<"u",m=new Vd,u={},b=t.getContextAttributes();let y=null,T=null;const w=[],R=[],D=new ze;let N=null;const E=new Ft;E.viewport=new ut;const M=new Ft;M.viewport=new ut;const P=[E,M],z=new lc;let H=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let Z=w[q];return Z===void 0&&(Z=new Fr,w[q]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(q){let Z=w[q];return Z===void 0&&(Z=new Fr,w[q]=Z),Z.getGripSpace()},this.getHand=function(q){let Z=w[q];return Z===void 0&&(Z=new Fr,w[q]=Z),Z.getHandSpace()};function Y(q){const Z=R.indexOf(q.inputSource);if(Z===-1)return;const he=w[Z];he!==void 0&&(he.update(q.inputSource,q.frame,l||a),he.dispatchEvent({type:q.type,data:q.inputSource}))}function W(){r.removeEventListener("select",Y),r.removeEventListener("selectstart",Y),r.removeEventListener("selectend",Y),r.removeEventListener("squeeze",Y),r.removeEventListener("squeezestart",Y),r.removeEventListener("squeezeend",Y),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",ne);for(let q=0;q<w.length;q++){const Z=R[q];Z!==null&&(R[q]=null,w[q].disconnect(Z))}H=null,X=null,m.reset();for(const q in u)delete u[q];e.setRenderTarget(y),p=null,d=null,h=null,r=null,T=null,Ge.stop(),i.isPresenting=!1,e.setPixelRatio(N),e.setSize(D.width,D.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(q){l=q},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h===null&&x&&(h=new XRWebGLBinding(r,t)),h},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",Y),r.addEventListener("selectstart",Y),r.addEventListener("selectend",Y),r.addEventListener("squeeze",Y),r.addEventListener("squeezestart",Y),r.addEventListener("squeezeend",Y),r.addEventListener("end",W),r.addEventListener("inputsourceschange",ne),b.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(D),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let he=null,we=null,xe=null;b.depth&&(xe=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,he=b.stencil?oi:Si,we=b.stencil?ai:Bn);const Be={colorFormat:t.RGBA8,depthFormat:xe,scaleFactor:s};h=this.getBinding(),d=h.createProjectionLayer(Be),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new Bt(d.textureWidth,d.textureHeight,{format:Wt,type:At,depthTexture:new vi(d.textureWidth,d.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,he),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const he={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,he),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),T=new Bt(p.framebufferWidth,p.framebufferHeight,{format:Wt,type:At,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),Ge.setContext(r),Ge.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function ne(q){for(let Z=0;Z<q.removed.length;Z++){const he=q.removed[Z],we=R.indexOf(he);we>=0&&(R[we]=null,w[we].disconnect(he))}for(let Z=0;Z<q.added.length;Z++){const he=q.added[Z];let we=R.indexOf(he);if(we===-1){for(let Be=0;Be<w.length;Be++)if(Be>=R.length){R.push(he),we=Be;break}else if(R[Be]===null){R[Be]=he,we=Be;break}if(we===-1)break}const xe=w[we];xe&&xe.connect(he)}}const V=new O,se=new O;function j(q,Z,he){V.setFromMatrixPosition(Z.matrixWorld),se.setFromMatrixPosition(he.matrixWorld);const we=V.distanceTo(se),xe=Z.projectionMatrix.elements,Be=he.projectionMatrix.elements,_t=xe[14]/(xe[10]-1),A=xe[14]/(xe[10]+1),Ie=(xe[9]+1)/xe[5],Ae=(xe[9]-1)/xe[5],ye=(xe[8]-1)/xe[0],me=(Be[8]+1)/Be[0],et=_t*ye,ge=_t*me,Le=we/(-ye+me),ot=Le*-ye;if(Z.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(ot),q.translateZ(Le),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),xe[10]===-1)q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse);else{const tt=_t+Le,S=A+Le,g=et-ot,U=ge+(we-ot),G=Ie*A/S*tt,K=Ae*A/S*tt;q.projectionMatrix.makePerspective(g,U,G,K,tt,S),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function pe(q,Z){Z===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Z.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;let Z=q.near,he=q.far;m.texture!==null&&(m.depthNear>0&&(Z=m.depthNear),m.depthFar>0&&(he=m.depthFar)),z.near=M.near=E.near=Z,z.far=M.far=E.far=he,(H!==z.near||X!==z.far)&&(r.updateRenderState({depthNear:z.near,depthFar:z.far}),H=z.near,X=z.far),z.layers.mask=q.layers.mask|6,E.layers.mask=z.layers.mask&3,M.layers.mask=z.layers.mask&5;const we=q.parent,xe=z.cameras;pe(z,we);for(let Be=0;Be<xe.length;Be++)pe(xe[Be],we);xe.length===2?j(z,E,M):z.projectionMatrix.copy(E.projectionMatrix),ce(q,z,we)};function ce(q,Z,he){he===null?q.matrix.copy(Z.matrixWorld):(q.matrix.copy(he.matrixWorld),q.matrix.invert(),q.matrix.multiply(Z.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=Is*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(q){c=q,d!==null&&(d.fixedFoveation=q),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=q)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(z)},this.getCameraTexture=function(q){return u[q]};let He=null;function Ke(q,Z){if(f=Z.getViewerPose(l||a),v=Z,f!==null){const he=f.views;p!==null&&(e.setRenderTargetFramebuffer(T,p.framebuffer),e.setRenderTarget(T));let we=!1;he.length!==z.cameras.length&&(z.cameras.length=0,we=!0);for(let A=0;A<he.length;A++){const Ie=he[A];let Ae=null;if(p!==null)Ae=p.getViewport(Ie);else{const me=h.getViewSubImage(d,Ie);Ae=me.viewport,A===0&&(e.setRenderTargetTextures(T,me.colorTexture,me.depthStencilTexture),e.setRenderTarget(T))}let ye=P[A];ye===void 0&&(ye=new Ft,ye.layers.enable(A),ye.viewport=new ut,P[A]=ye),ye.matrix.fromArray(Ie.transform.matrix),ye.matrix.decompose(ye.position,ye.quaternion,ye.scale),ye.projectionMatrix.fromArray(Ie.projectionMatrix),ye.projectionMatrixInverse.copy(ye.projectionMatrix).invert(),ye.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),A===0&&(z.matrix.copy(ye.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),we===!0&&z.cameras.push(ye)}const xe=r.enabledFeatures;if(xe&&xe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){h=i.getBinding();const A=h.getDepthInformation(he[0]);A&&A.isValid&&A.texture&&m.init(A,r.renderState)}if(xe&&xe.includes("camera-access")&&x){e.state.unbindTexture(),h=i.getBinding();for(let A=0;A<he.length;A++){const Ie=he[A].camera;if(Ie){let Ae=u[Ie];Ae||(Ae=new Ro,u[Ie]=Ae);const ye=h.getCameraImage(Ie);Ae.sourceTexture=ye}}}}for(let he=0;he<w.length;he++){const we=R[he],xe=w[he];we!==null&&xe!==void 0&&xe.update(we,Z,l||a)}He&&He(q,Z),Z.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Z}),v=null}const Ge=new Co;Ge.setAnimationLoop(Ke),this.setAnimationLoop=function(q){He=q},this.dispose=function(){}}}const wn=new un,Wd=new ht;function Xd(n,e){function t(m,u){m.matrixAutoUpdate===!0&&m.updateMatrix(),u.value.copy(m.matrix)}function i(m,u){u.color.getRGB(m.fogColor.value,To(n)),u.isFog?(m.fogNear.value=u.near,m.fogFar.value=u.far):u.isFogExp2&&(m.fogDensity.value=u.density)}function r(m,u,b,y,T){u.isMeshBasicMaterial||u.isMeshLambertMaterial?s(m,u):u.isMeshToonMaterial?(s(m,u),h(m,u)):u.isMeshPhongMaterial?(s(m,u),f(m,u)):u.isMeshStandardMaterial?(s(m,u),d(m,u),u.isMeshPhysicalMaterial&&p(m,u,T)):u.isMeshMat
vendor: 13,223 bytes, line 3840
3840capMaterial?(s(m,u),v(m,u)):u.isMeshDepthMaterial?s(m,u):u.isMeshDistanceMaterial?(s(m,u),x(m,u)):u.isMeshNormalMaterial?s(m,u):u.isLineBasicMaterial?(a(m,u),u.isLineDashedMaterial&&o(m,u)):u.isPointsMaterial?c(m,u,b,y):u.isSpriteMaterial?l(m,u):u.isShadowMaterial?(m.color.value.copy(u.color),m.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(m,u){m.opacity.value=u.opacity,u.color&&m.diffuse.value.copy(u.color),u.emissive&&m.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(m.map.value=u.map,t(u.map,m.mapTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.bumpMap&&(m.bumpMap.value=u.bumpMap,t(u.bumpMap,m.bumpMapTransform),m.bumpScale.value=u.bumpScale,u.side===gt&&(m.bumpScale.value*=-1)),u.normalMap&&(m.normalMap.value=u.normalMap,t(u.normalMap,m.normalMapTransform),m.normalScale.value.copy(u.normalScale),u.side===gt&&m.normalScale.value.negate()),u.displacementMap&&(m.displacementMap.value=u.displacementMap,t(u.displacementMap,m.displacementMapTransform),m.displacementScale.value=u.displacementScale,m.displacementBias.value=u.displacementBias),u.emissiveMap&&(m.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,m.emissiveMapTransform)),u.specularMap&&(m.specularMap.value=u.specularMap,t(u.specularMap,m.specularMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest);const b=e.get(u),y=b.envMap,T=b.envMapRotation;y&&(m.envMap.value=y,wn.copy(T),wn.x*=-1,wn.y*=-1,wn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(wn.y*=-1,wn.z*=-1),m.envMapRotation.value.setFromMatrix4(Wd.makeRotationFromEuler(wn)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=u.reflectivity,m.ior.value=u.ior,m.refractionRatio.value=u.refractionRatio),u.lightMap&&(m.lightMap.value=u.lightMap,m.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,m.lightMapTransform)),u.aoMap&&(m.aoMap.value=u.aoMap,m.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,m.aoMapTransform))}function a(m,u){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,u.map&&(m.map.value=u.map,t(u.map,m.mapTransform))}function o(m,u){m.dashSize.value=u.dashSize,m.totalSize.value=u.dashSize+u.gapSize,m.scale.value=u.scale}function c(m,u,b,y){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,m.size.value=u.size*b,m.scale.value=y*.5,u.map&&(m.map.value=u.map,t(u.map,m.uvTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest)}function l(m,u){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,m.rotation.value=u.rotation,u.map&&(m.map.value=u.map,t(u.map,m.mapTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest)}function f(m,u){m.specular.value.copy(u.specular),m.shininess.value=Math.max(u.shininess,1e-4)}function h(m,u){u.gradientMap&&(m.gradientMap.value=u.gradientMap)}function d(m,u){m.metalness.value=u.metalness,u.metalnessMap&&(m.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,m.metalnessMapTransform)),m.roughness.value=u.roughness,u.roughnessMap&&(m.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,m.roughnessMapTransform)),u.envMap&&(m.envMapIntensity.value=u.envMapIntensity)}function p(m,u,b){m.ior.value=u.ior,u.sheen>0&&(m.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),m.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(m.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,m.sheenColorMapTransform)),u.sheenRoughnessMap&&(m.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,m.sheenRoughnessMapTransform))),u.clearcoat>0&&(m.clearcoat.value=u.clearcoat,m.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(m.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,m.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(m.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===gt&&m.clearcoatNormalScale.value.negate())),u.dispersion>0&&(m.dispersion.value=u.dispersion),u.iridescence>0&&(m.iridescence.value=u.iridescence,m.iridescenceIOR.value=u.iridescenceIOR,m.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(m.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,m.iridescenceMapTransform)),u.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),u.transmission>0&&(m.transmission.value=u.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),u.transmissionMap&&(m.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,m.transmissionMapTransform)),m.thickness.value=u.thickness,u.thicknessMap&&(m.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=u.attenuationDistance,m.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(m.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(m.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=u.specularIntensity,m.specularColor.value.copy(u.specularColor),u.specularColorMap&&(m.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,m.specularColorMapTransform)),u.specularIntensityMap&&(m.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,m.specularIntensityMapTransform))}function v(m,u){u.matcap&&(m.matcap.value=u.matcap)}function x(m,u){const b=e.get(u).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function qd(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,y){const T=y.program;i.uniformBlockBinding(b,T)}function l(b,y){let T=r[b.id];T===void 0&&(v(b),T=f(b),r[b.id]=T,b.addEventListener("dispose",m));const w=y.program;i.updateUBOMapping(b,w);const R=e.render.frame;s[b.id]!==R&&(d(b),s[b.id]=R)}function f(b){const y=h();b.__bindingPointIndex=y;const T=n.createBuffer(),w=b.__size,R=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,T),n.bufferData(n.UNIFORM_BUFFER,w,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,T),T}function h(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const y=r[b.id],T=b.uniforms,w=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let R=0,D=T.length;R<D;R++){const N=Array.isArray(T[R])?T[R]:[T[R]];for(let E=0,M=N.length;E<M;E++){const P=N[E];if(p(P,R,E,w)===!0){const z=P.__offset,H=Array.isArray(P.value)?P.value:[P.value];let X=0;for(let Y=0;Y<H.length;Y++){const W=H[Y],ne=x(W);typeof W=="number"||typeof W=="boolean"?(P.__data[0]=W,n.bufferSubData(n.UNIFORM_BUFFER,z+X,P.__data)):W.isMatrix3?(P.__data[0]=W.elements[0],P.__data[1]=W.elements[1],P.__data[2]=W.elements[2],P.__data[3]=0,P.__data[4]=W.elements[3],P.__data[5]=W.elements[4],P.__data[6]=W.elements[5],P.__data[7]=0,P.__data[8]=W.elements[6],P.__data[9]=W.elements[7],P.__data[10]=W.elements[8],P.__data[11]=0):(W.toArray(P.__data,X),X+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,z,P.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(b,y,T,w){const R=b.value,D=y+"_"+T;if(w[D]===void 0)return typeof R=="number"||typeof R=="boolean"?w[D]=R:w[D]=R.clone(),!0;{const N=w[D];if(typeof R=="number"||typeof R=="boolean"){if(N!==R)return w[D]=R,!0}else if(N.equals(R)===!1)return N.copy(R),!0}return!1}function v(b){const y=b.uniforms;let T=0;const w=16;for(let D=0,N=y.length;D<N;D++){const E=Array.isArray(y[D])?y[D]:[y[D]];for(let M=0,P=E.length;M<P;M++){const z=E[M],H=Array.isArray(z.value)?z.value:[z.value];for(let X=0,Y=H.length;X<Y;X++){const W=H[X],ne=x(W),V=T%w,se=V%ne.boundary,j=V+se;T+=se,j!==0&&w-j<ne.storage&&(T+=w-j),z.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),z.__offset=T,T+=ne.storage}}}const R=T%w;return R>0&&(T+=w-R),b.__size=T,b.__cache={},this}function x(b){const y={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(y.boundary=4,y.storage=4):b.isVector2?(y.boundary=8,y.storage=8):b.isVector3||b.isColor?(y.boundary=16,y.storage=12):b.isVector4?(y.boundary=16,y.storage=16):b.isMatrix3?(y.boundary=48,y.storage=48):b.isMatrix4?(y.boundary=64,y.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),y}function m(b){const y=b.target;y.removeEventListener("dispose",m);const T=a.indexOf(y.__bindingPointIndex);a.splice(T,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function u(){for(const b in r)n.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:c,update:l,dispose:u}}class Yd{constructor(e={}){const{canvas:t=Pl(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=a;const v=new Uint32Array(4),x=new Int32Array(4);let m=null,u=null;const b=[],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=_n,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let w=!1;this._outputColorSpace=ct;let R=0,D=0,N=null,E=-1,M=null;const P=new ut,z=new ut;let H=null;const X=new Ze(0);let Y=0,W=t.width,ne=t.height,V=1,se=null,j=null;const pe=new ut(0,0,W,ne),ce=new ut(0,0,W,ne);let He=!1;const Ke=new Ao;let Ge=!1,q=!1;const Z=new ht,he=new O,we=new ut,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function _t(){return N===null?V:1}let A=i;function Ie(_,L){return t.getContext(_,L)}try{const _={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:f,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${lr}`),t.addEventListener("webglcontextlost",re,!1),t.addEventListener("webglcontextrestored",de,!1),t.addEventListener("webglcontextcreationerror",J,!1),A===null){const L="webgl2";if(A=Ie(L,_),A===null)throw Ie(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(_){throw console.error("THREE.WebGLRenderer: "+_.message),_}let Ae,ye,me,et,ge,Le,ot,tt,S,g,U,G,K,k,Te,ie,Se,Me,ee,ue,Pe,Ee,oe,Ne;function C(){Ae=new ih(A),Ae.init(),Ee=new zd(A,Ae),ye=new Zf(A,Ae,e,Ee),me=new Od(A,Ae),ye.reversedDepthBuffer&&d&&me.buffers.depth.setReversed(!0),et=new ah(A),ge=new yd,Le=new Bd(A,Ae,me,ge,ye,Ee,et),ot=new Jf(T),tt=new nh(T),S=new fc(A),oe=new Kf(A,S),g=new rh(A,S,et,oe),U=new lh(A,g,S,et),ee=new oh(A,ye,Le),ie=new jf(ge),G=new Td(T,ot,tt,Ae,ye,oe,ie),K=new Xd(T,ge),k=new Ad,Te=new Ld(Ae),Me=new Yf(T,ot,tt,me,U,p,c),Se=new Nd(T,U,ye),Ne=new qd(A,et,ye,me),ue=new $f(A,Ae,et),Pe=new sh(A,Ae,et),et.programs=G.programs,T.capabilities=ye,T.extensions=Ae,T.properties=ge,T.renderLists=k,T.shadowMap=Se,T.state=me,T.info=et}C();const te=new kd(T,A);this.xr=te,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const _=Ae.get("WEBGL_lose_context");_&&_.loseContext()},this.forceContextRestore=function(){const _=Ae.get("WEBGL_lose_context");_&&_.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(_){_!==void 0&&(V=_,this.setSize(W,ne,!1))},this.getSize=function(_){return _.set(W,ne)},this.setSize=function(_,L,F=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=_,ne=L,t.width=Math.floor(_*V),t.height=Math.floor(L*V),F===!0&&(t.style.width=_+"px",t.style.height=L+"px"),this.setViewport(0,0,_,L)},this.getDrawingBufferSize=function(_){return _.set(W*V,ne*V).floor()},this.setDrawingBufferSize=function(_,L,F){W=_,ne=L,V=F,t.width=Math.floor(_*F),t.height=Math.floor(L*F),this.setViewport(0,0,_,L)},this.getCurrentViewport=function(_){return _.copy(P)},this.getViewport=function(_){return _.copy(pe)},this.setViewport=function(_,L,F,B){_.isVector4?pe.set(_.x,_.y,_.z,_.w):pe.set(_,L,F,B),me.viewport(P.copy(pe).multiplyScalar(V).round())}
vendor: 8,202 bytes, line 3840
3840,this.getScissor=function(_){return _.copy(ce)},this.setScissor=function(_,L,F,B){_.isVector4?ce.set(_.x,_.y,_.z,_.w):ce.set(_,L,F,B),me.scissor(z.copy(ce).multiplyScalar(V).round())},this.getScissorTest=function(){return He},this.setScissorTest=function(_){me.setScissorTest(He=_)},this.setOpaqueSort=function(_){se=_},this.setTransparentSort=function(_){j=_},this.getClearColor=function(_){return _.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(_=!0,L=!0,F=!0){let B=0;if(_){let I=!1;if(N!==null){const Q=N.texture.format;I=Q===ks||Q===Vs||Q===Gs}if(I){const Q=N.texture.type,le=Q===At||Q===Bn||Q===xi||Q===ai||Q===zs||Q===Hs,_e=Me.getClearColor(),fe=Me.getClearAlpha(),Ce=_e.r,De=_e.g,be=_e.b;le?(v[0]=Ce,v[1]=De,v[2]=be,v[3]=fe,A.clearBufferuiv(A.COLOR,0,v)):(x[0]=Ce,x[1]=De,x[2]=be,x[3]=fe,A.clearBufferiv(A.COLOR,0,x))}else B|=A.COLOR_BUFFER_BIT}L&&(B|=A.DEPTH_BUFFER_BIT),F&&(B|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.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",re,!1),t.removeEventListener("webglcontextrestored",de,!1),t.removeEventListener("webglcontextcreationerror",J,!1),Me.dispose(),k.dispose(),Te.dispose(),ge.dispose(),ot.dispose(),tt.dispose(),U.dispose(),oe.dispose(),Ne.dispose(),G.dispose(),te.dispose(),te.removeEventListener("sessionstart",Yt),te.removeEventListener("sessionend",Ks),En.stop()};function re(_){_.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const _=et.autoReset,L=Se.enabled,F=Se.autoUpdate,B=Se.needsUpdate,I=Se.type;C(),et.autoReset=_,Se.enabled=L,Se.autoUpdate=F,Se.needsUpdate=B,Se.type=I}function J(_){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",_.statusMessage)}function $(_){const L=_.target;L.removeEventListener("dispose",$),ve(L)}function ve(_){Ue(_),ge.remove(_)}function Ue(_){const L=ge.get(_).programs;L!==void 0&&(L.forEach(function(F){G.releaseProgram(F)}),_.isShaderMaterial&&G.releaseShaderCache(_))}this.renderBufferDirect=function(_,L,F,B,I,Q){L===null&&(L=xe);const le=I.isMesh&&I.matrixWorld.determinant()<0,_e=No(_,L,F,B,I);me.setMaterial(B,le);let fe=F.index,Ce=1;if(B.wireframe===!0){if(fe=g.getWireframeAttribute(F),fe===void 0)return;Ce=2}const De=F.drawRange,be=F.attributes.position;let Ve=De.start*Ce,je=(De.start+De.count)*Ce;Q!==null&&(Ve=Math.max(Ve,Q.start*Ce),je=Math.min(je,(Q.start+Q.count)*Ce)),fe!==null?(Ve=Math.max(Ve,0),je=Math.min(je,fe.count)):be!=null&&(Ve=Math.max(Ve,0),je=Math.min(je,be.count));const at=je-Ve;if(at<0||at===1/0)return;oe.setup(I,B,_e,F,fe);let it,Qe=ue;if(fe!==null&&(it=S.get(fe),Qe=Pe,Qe.setIndex(it)),I.isMesh)B.wireframe===!0?(me.setLineWidth(B.wireframeLinewidth*_t()),Qe.setMode(A.LINES)):Qe.setMode(A.TRIANGLES);else if(I.isLine){let Re=B.linewidth;Re===void 0&&(Re=1),me.setLineWidth(Re*_t()),I.isLineSegments?Qe.setMode(A.LINES):I.isLineLoop?Qe.setMode(A.LINE_LOOP):Qe.setMode(A.LINE_STRIP)}else I.isPoints?Qe.setMode(A.POINTS):I.isSprite&&Qe.setMode(A.TRIANGLES);if(I.isBatchedMesh)if(I._multiDrawInstances!==null)Mi("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(Ae.get("WEBGL_multi_draw"))Qe.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else{const Re=I._multiDrawStarts,rt=I._multiDrawCounts,Xe=I._multiDrawCount,Rt=fe?S.get(fe).bytesPerElement:1,zn=ge.get(B).currentProgram.getUniforms();for(let Ct=0;Ct<Xe;Ct++)zn.setValue(A,"_gl_DrawID",Ct),Qe.render(Re[Ct]/Rt,rt[Ct])}else if(I.isInstancedMesh)Qe.renderInstances(Ve,at,I.count);else if(F.isInstancedBufferGeometry){const Re=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,rt=Math.min(F.instanceCount,Re);Qe.renderInstances(Ve,at,rt)}else Qe.render(Ve,at)};function nt(_,L,F){_.transparent===!0&&_.side===Dt&&_.forceSinglePass===!1?(_.side=gt,_.needsUpdate=!0,Pi(_,L,F),_.side=cn,_.needsUpdate=!0,Pi(_,L,F),_.side=Dt):Pi(_,L,F)}this.compile=function(_,L,F=null){F===null&&(F=_),u=Te.get(F),u.init(L),y.push(u),F.traverseVisible(function(I){I.isLight&&I.layers.test(L.layers)&&(u.pushLight(I),I.castShadow&&u.pushShadow(I))}),_!==F&&_.traverseVisible(function(I){I.isLight&&I.layers.test(L.layers)&&(u.pushLight(I),I.castShadow&&u.pushShadow(I))}),u.setupLights();const B=new Set;return _.traverse(function(I){if(!(I.isMesh||I.isPoints||I.isLine||I.isSprite))return;const Q=I.material;if(Q)if(Array.isArray(Q))for(let le=0;le<Q.length;le++){const _e=Q[le];nt(_e,F,I),B.add(_e)}else nt(Q,F,I),B.add(Q)}),u=y.pop(),B},this.compileAsync=function(_,L,F=null){const B=this.compile(_,L,F);return new Promise(I=>{function Q(){if(B.forEach(function(le){ge.get(le).currentProgram.isReady()&&B.delete(le)}),B.size===0){I(_);return}setTimeout(Q,10)}Ae.get("KHR_parallel_shader_compile")!==null?Q():setTimeout(Q,10)})};let $e=null;function Qt(_){$e&&$e(_)}function Yt(){En.stop()}function Ks(){En.start()}const En=new Co;En.setAnimationLoop(Qt),typeof self<"u"&&En.setContext(self),this.setAnimationLoop=function(_){$e=_,te.setAnimationLoop(_),_===null?En.stop():En.start()},te.addEventListener("sessionstart",Yt),te.addEventListener("sessionend",Ks),this.render=function(_,L){if(L!==void 0&&L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;if(_.matrixWorldAutoUpdate===!0&&_.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(L),L=te.getCamera()),_.isScene===!0&&_.onBeforeRender(T,_,L,N),u=Te.get(_,y.length),u.init(L),y.push(u),Z.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),Ke.setFromProjectionMatrix(Z,jt,L.reversedDepth),q=this.localClippingEnabled,Ge=ie.init(this.clippingPlanes,q),m=k.get(_,b.length),m.init(),b.push(m),te.enabled===!0&&te.isPresenting===!0){const Q=T.xr.getDepthSensingMesh();Q!==null&&fr(Q,L,-1/0,T.sortObjects)}fr(_,L,0,T.sortObjects),m.finish(),T.sortObjects===!0&&m.sort(se,j),Be=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,Be&&Me.addToRenderList(m,_),this.info.render.frame++,Ge===!0&&ie.beginShadows();const F=u.state.shadowsArray;Se.render(F,_,L),Ge===!0&&ie.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=m.opaque,I=m.transmissive;if(u.setupLights(),L.isArrayCamera){const Q=L.cameras;if(I.length>0)for(let le=0,_e=Q.length;le<_e;le++){const fe=Q[le];Zs(B,I,_,fe)}Be&&Me.render(_);for(let le=0,_e=Q.length;le<_e;le++){const fe=Q[le];$s(m,_,fe,fe.viewport)}}else I.length>0&&Zs(B,I,_,L),Be&&Me.render(_),$s(m,_,L);N!==null&&D===0&&(Le.updateMultisampleRenderTarget(N),Le.updateRenderTargetMipmap(N)),_.isScene===!0&&_.onAfterRender(T,_,L),oe.resetDefaultState(),E=-1,M=null,y.pop(),y.length>0?(u=y[y.length-1],Ge===!0&&ie.setGlobalState(T.clippingPlanes,u.state.camera)):u=null,b.pop(),b.length>0?m=b[b.length-1]:m=null};function fr(_,L,F,B){if(_.visible===!1)return;if(_.layers.test(L.layers)){if(_.isGroup)F=_.renderOrder;else if(_.isLOD)_.autoUpdate===!0&&_.update(L);else if(_.isLight)u.pushLight(_),_.castShadow&&u.pushShadow(_);else if(_.isSprite){if(!_.frustumCulled||Ke.intersectsSprite(_)){B&&we.setFromMatrixPosition(_.matrixWorld).applyMatrix4(Z);const le=U.update(_),_e=_.material;_e.visible&&m.push(_,le,_e,F,we.z,null)}}else if((_.isMesh||_.isLine||_.isPoints)&&(!_.frustumCulled||Ke.intersectsObject(_))){const le=U.update(_),_e=_.material;if(B&&(_.boundingSphere!==void 0?(_.boundingSphere===null&&_.computeBoundingSphere(),we.copy(_.boundingSphere.center)):(le.boundingSphere===null&&le.computeBoundingSphere(),we.copy(le.boundingSphere.center)),we.applyM
vendor: 4,875 bytes, line 3840
3840atrix4(_.matrixWorld).applyMatrix4(Z)),Array.isArray(_e)){const fe=le.groups;for(let Ce=0,De=fe.length;Ce<De;Ce++){const be=fe[Ce],Ve=_e[be.materialIndex];Ve&&Ve.visible&&m.push(_,le,Ve,F,we.z,be)}}else _e.visible&&m.push(_,le,_e,F,we.z,null)}}const Q=_.children;for(let le=0,_e=Q.length;le<_e;le++)fr(Q[le],L,F,B)}function $s(_,L,F,B){const I=_.opaque,Q=_.transmissive,le=_.transparent;u.setupLightsView(F),Ge===!0&&ie.setGlobalState(T.clippingPlanes,F),B&&me.viewport(P.copy(B)),I.length>0&&wi(I,L,F),Q.length>0&&wi(Q,L,F),le.length>0&&wi(le,L,F),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Zs(_,L,F,B){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;u.state.transmissionRenderTarget[B.id]===void 0&&(u.state.transmissionRenderTarget[B.id]=new Bt(1,1,{generateMipmaps:!0,type:Ae.has("EXT_color_buffer_half_float")||Ae.has("EXT_color_buffer_float")?Ei:At,minFilter:Nn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qe.workingColorSpace}));const Q=u.state.transmissionRenderTarget[B.id],le=B.viewport||P;Q.setSize(le.z*T.transmissionResolutionScale,le.w*T.transmissionResolutionScale);const _e=T.getRenderTarget(),fe=T.getActiveCubeFace(),Ce=T.getActiveMipmapLevel();T.setRenderTarget(Q),T.getClearColor(X),Y=T.getClearAlpha(),Y<1&&T.setClearColor(16777215,.5),T.clear(),Be&&Me.render(F);const De=T.toneMapping;T.toneMapping=_n;const be=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),u.setupLightsView(B),Ge===!0&&ie.setGlobalState(T.clippingPlanes,B),wi(_,F,B),Le.updateMultisampleRenderTarget(Q),Le.updateRenderTargetMipmap(Q),Ae.has("WEBGL_multisampled_render_to_texture")===!1){let Ve=!1;for(let je=0,at=L.length;je<at;je++){const it=L[je],Qe=it.object,Re=it.geometry,rt=it.material,Xe=it.group;if(rt.side===Dt&&Qe.layers.test(B.layers)){const Rt=rt.side;rt.side=gt,rt.needsUpdate=!0,js(Qe,F,B,Re,rt,Xe),rt.side=Rt,rt.needsUpdate=!0,Ve=!0}}Ve===!0&&(Le.updateMultisampleRenderTarget(Q),Le.updateRenderTargetMipmap(Q))}T.setRenderTarget(_e,fe,Ce),T.setClearColor(X,Y),be!==void 0&&(B.viewport=be),T.toneMapping=De}function wi(_,L,F){const B=L.isScene===!0?L.overrideMaterial:null;for(let I=0,Q=_.length;I<Q;I++){const le=_[I],_e=le.object,fe=le.geometry,Ce=le.group;let De=le.material;De.allowOverride===!0&&B!==null&&(De=B),_e.layers.test(F.layers)&&js(_e,L,F,fe,De,Ce)}}function js(_,L,F,B,I,Q){_.onBeforeRender(T,L,F,B,I,Q),_.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,_.matrixWorld),_.normalMatrix.getNormalMatrix(_.modelViewMatrix),I.onBeforeRender(T,L,F,B,_,Q),I.transparent===!0&&I.side===Dt&&I.forceSinglePass===!1?(I.side=gt,I.needsUpdate=!0,T.renderBufferDirect(F,L,B,I,_,Q),I.side=cn,I.needsUpdate=!0,T.renderBufferDirect(F,L,B,I,_,Q),I.side=Dt):T.renderBufferDirect(F,L,B,I,_,Q),_.onAfterRender(T,L,F,B,I,Q)}function Pi(_,L,F){L.isScene!==!0&&(L=xe);const B=ge.get(_),I=u.state.lights,Q=u.state.shadowsArray,le=I.state.version,_e=G.getParameters(_,I.state,Q,L,F),fe=G.getProgramCacheKey(_e);let Ce=B.programs;B.environment=_.isMeshStandardMaterial?L.environment:null,B.fog=L.fog,B.envMap=(_.isMeshStandardMaterial?tt:ot).get(_.envMap||B.environment),B.envMapRotation=B.environment!==null&&_.envMap===null?L.environmentRotation:_.envMapRotation,Ce===void 0&&(_.addEventListener("dispose",$),Ce=new Map,B.programs=Ce);let De=Ce.get(fe);if(De!==void 0){if(B.currentProgram===De&&B.lightsStateVersion===le)return Qs(_,_e),De}else _e.uniforms=G.getUniforms(_),_.onBeforeCompile(_e,T),De=G.acquireProgram(_e,fe),Ce.set(fe,De),B.uniforms=_e.uniforms;const be=B.uniforms;return(!_.isShaderMaterial&&!_.isRawShaderMaterial||_.clipping===!0)&&(be.clippingPlanes=ie.uniform),Qs(_,_e),B.needsLights=Oo(_),B.lightsStateVersion=le,B.needsLights&&(be.ambientLightColor.value=I.state.ambient,be.lightProbe.value=I.state.probe,be.directionalLights.value=I.state.directional,be.directionalLightShadows.value=I.state.directionalShadow,be.spotLights.value=I.state.spot,be.spotLightShadows.value=I.state.spotShadow,be.rectAreaLights.value=I.state.rectArea,be.ltc_1.value=I.state.rectAreaLTC1,be.ltc_2.value=I.state.rectAreaLTC2,be.pointLights.value=I.state.point,be.pointLightShadows.value=I.state.pointShadow,be.hemisphereLights.value=I.state.hemi,be.directionalShadowMap.value=I.state.directionalShadowMap,be.directionalShadowMatrix.value=I.state.directionalShadowMatrix,be.spotShadowMap.value=I.state.spotShadowMap,be.spotLightMatrix.value=I.state.spotLightMatrix,be.spotLightMap.value=I.state.spotLightMap,be.pointShadowMap.value=I.state.pointShadowMap,be.pointShadowMatrix.value=I.state.pointShadowMatrix),B.currentProgram=De,B.uniformsList=null,De}function Js(_){if(_.uniformsList===null){const L=_.currentProgram.getUniforms();_.uniformsList=ir.seqWithValue(L.seq,_.uniforms)}return _.uniformsList}function Qs(_,L){const F=ge.get(_);
vendor: 11,959 bytes, line 3840
3840F.outputColorSpace=L.outputColorSpace,F.batching=L.batching,F.batchingColor=L.batchingColor,F.instancing=L.instancing,F.instancingColor=L.instancingColor,F.instancingMorph=L.instancingMorph,F.skinning=L.skinning,F.morphTargets=L.morphTargets,F.morphNormals=L.morphNormals,F.morphColors=L.morphColors,F.morphTargetsCount=L.morphTargetsCount,F.numClippingPlanes=L.numClippingPlanes,F.numIntersection=L.numClipIntersection,F.vertexAlphas=L.vertexAlphas,F.vertexTangents=L.vertexTangents,F.toneMapping=L.toneMapping}function No(_,L,F,B,I){L.isScene!==!0&&(L=xe),Le.resetTextureUnits();const Q=L.fog,le=B.isMeshStandardMaterial?L.environment:null,_e=N===null?T.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:vn,fe=(B.isMeshStandardMaterial?tt:ot).get(B.envMap||le),Ce=B.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,De=!!F.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),be=!!F.morphAttributes.position,Ve=!!F.morphAttributes.normal,je=!!F.morphAttributes.color;let at=_n;B.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(at=T.toneMapping);const it=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Qe=it!==void 0?it.length:0,Re=ge.get(B),rt=u.state.lights;if(Ge===!0&&(q===!0||_!==M)){const Et=_===M&&B.id===E;ie.setState(B,_,Et)}let Xe=!1;B.version===Re.__version?(Re.needsLights&&Re.lightsStateVersion!==rt.state.version||Re.outputColorSpace!==_e||I.isBatchedMesh&&Re.batching===!1||!I.isBatchedMesh&&Re.batching===!0||I.isBatchedMesh&&Re.batchingColor===!0&&I.colorTexture===null||I.isBatchedMesh&&Re.batchingColor===!1&&I.colorTexture!==null||I.isInstancedMesh&&Re.instancing===!1||!I.isInstancedMesh&&Re.instancing===!0||I.isSkinnedMesh&&Re.skinning===!1||!I.isSkinnedMesh&&Re.skinning===!0||I.isInstancedMesh&&Re.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&Re.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&Re.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&Re.instancingMorph===!1&&I.morphTexture!==null||Re.envMap!==fe||B.fog===!0&&Re.fog!==Q||Re.numClippingPlanes!==void 0&&(Re.numClippingPlanes!==ie.numPlanes||Re.numIntersection!==ie.numIntersection)||Re.vertexAlphas!==Ce||Re.vertexTangents!==De||Re.morphTargets!==be||Re.morphNormals!==Ve||Re.morphColors!==je||Re.toneMapping!==at||Re.morphTargetsCount!==Qe)&&(Xe=!0):(Xe=!0,Re.__version=B.version);let Rt=Re.currentProgram;Xe===!0&&(Rt=Pi(B,L,I));let zn=!1,Ct=!1,fi=!1;const st=Rt.getUniforms(),Ut=Re.uniforms;if(me.useProgram(Rt.program)&&(zn=!0,Ct=!0,fi=!0),B.id!==E&&(E=B.id,Ct=!0),zn||M!==_){me.buffers.depth.getReversed()&&_.reversedDepth!==!0&&(_._reversedDepth=!0,_.updateProjectionMatrix()),st.setValue(A,"projectionMatrix",_.projectionMatrix),st.setValue(A,"viewMatrix",_.matrixWorldInverse);const yt=st.map.cameraPosition;yt!==void 0&&yt.setValue(A,he.setFromMatrixPosition(_.matrixWorld)),ye.logarithmicDepthBuffer&&st.setValue(A,"logDepthBufFC",2/(Math.log(_.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&st.setValue(A,"isOrthographic",_.isOrthographicCamera===!0),M!==_&&(M=_,Ct=!0,fi=!0)}if(I.isSkinnedMesh){st.setOptional(A,I,"bindMatrix"),st.setOptional(A,I,"bindMatrixInverse");const Et=I.skeleton;Et&&(Et.boneTexture===null&&Et.computeBoneTexture(),st.setValue(A,"boneTexture",Et.boneTexture,Le))}I.isBatchedMesh&&(st.setOptional(A,I,"batchingTexture"),st.setValue(A,"batchingTexture",I._matricesTexture,Le),st.setOptional(A,I,"batchingIdTexture"),st.setValue(A,"batchingIdTexture",I._indirectTexture,Le),st.setOptional(A,I,"batchingColorTexture"),I._colorsTexture!==null&&st.setValue(A,"batchingColorTexture",I._colorsTexture,Le));const It=F.morphAttributes;if((It.position!==void 0||It.normal!==void 0||It.color!==void 0)&&ee.update(I,F,Rt),(Ct||Re.receiveShadow!==I.receiveShadow)&&(Re.receiveShadow=I.receiveShadow,st.setValue(A,"receiveShadow",I.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Ut.envMap.value=fe,Ut.flipEnvMap.value=fe.isCubeTexture&&fe.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&L.environment!==null&&(Ut.envMapIntensity.value=L.environmentIntensity),Ct&&(st.setValue(A,"toneMappingExposure",T.toneMappingExposure),Re.needsLights&&Fo(Ut,fi),Q&&B.fog===!0&&K.refreshFogUniforms(Ut,Q),K.refreshMaterialUniforms(Ut,B,V,ne,u.state.transmissionRenderTarget[_.id]),ir.upload(A,Js(Re),Ut,Le)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(ir.upload(A,Js(Re),Ut,Le),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&st.setValue(A,"center",I.center),st.setValue(A,"modelViewMatrix",I.modelViewMatrix),st.setValue(A,"normalMatrix",I.normalMatrix),st.setValue(A,"modelMatrix",I.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Et=B.uniformsGroups;for(let yt=0,hr=Et.length;yt<hr;yt++){const Tn=Et[yt];Ne.update(Tn,Rt),Ne.bind(Tn,Rt)}}return Rt}function Fo(_,L){_.ambientLightColor.needsUpdate=L,_.lightProbe.needsUpdate=L,_.directionalLights.needsUpdate=L,_.directionalLightShadows.needsUpdate=L,_.pointLights.needsUpdate=L,_.pointLightShadows.needsUpdate=L,_.spotLights.needsUpdate=L,_.spotLightShadows.needsUpdate=L,_.rectAreaLights.needsUpdate=L,_.hemisphereLights.needsUpdate=L}function Oo(_){return _.isMeshLambertMaterial||_.isMeshToonMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isShadowMaterial||_.isShaderMaterial&&_.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(_,L,F){const B=ge.get(_);B.__autoAllocateDepthBuffer=_.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),ge.get(_.texture).__webglTexture=L,ge.get(_.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:F,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(_,L){const F=ge.get(_);F.__webglFramebuffer=L,F.__useDefaultFramebuffer=L===void 0};const Bo=A.createFramebuffer();this.setRenderTarget=function(_,L=0,F=0){N=_,R=L,D=F;let B=!0,I=null,Q=!1,le=!1;if(_){const fe=ge.get(_);if(fe.__useDefaultFramebuffer!==void 0)me.bindFramebuffer(A.FRAMEBUFFER,null),B=!1;else if(fe.__webglFramebuffer===void 0)Le.setupRenderTarget(_);else if(fe.__hasExternalTextures)Le.rebindTextures(_,ge.get(_.texture).__webglTexture,ge.get(_.depthTexture).__webglTexture);else if(_.depthBuffer){const be=_.depthTexture;if(fe.__boundDepthTexture!==be){if(be!==null&&ge.has(be)&&(_.width!==be.image.width||_.height!==be.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Le.setupDepthRenderbuffer(_)}}const Ce=_.texture;(Ce.isData3DTexture||Ce.isDataArrayTexture||Ce.isCompressedArrayTexture)&&(le=!0);const De=ge.get(_).__webglFramebuffer;_.isWebGLCubeRenderTarget?(Array.isArray(De[L])?I=De[L][F]:I=De[L],Q=!0):_.samples>0&&Le.useMultisampledRTT(_)===!1?I=ge.get(_).__webglMultisampledFramebuffer:Array.isArray(De)?I=De[F]:I=De,P.copy(_.viewport),z.copy(_.scissor),H=_.scissorTest}else P.copy(pe).multiplyScalar(V).floor(),z.copy(ce).multiplyScalar(V).floor(),H=He;if(F!==0&&(I=Bo),me.bindFramebuffer(A.FRAMEBUFFER,I)&&B&&me.drawBuffers(_,I),me.viewport(P),me.scissor(z),me.setScissorTest(H),Q){const fe=ge.get(_.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+L,fe.__webglTexture,F)}else if(le){const fe=L;for(let Ce=0;Ce<_.textures.length;Ce++){const De=ge.get(_.textures[Ce]);A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0+Ce,De.__webglTexture,F,fe)}}else if(_!==null&&F!==0){const fe=ge.get(_.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,fe.__webglTexture,F)}E=-1},this.readRenderTargetPixels=function(_,L,F,B,I,Q,le,_e=0){if(!(_&&_.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let fe=ge.get(_).__webglFramebuffer;if(_.isWebGLCubeRenderTarget&&le!==void 0&&(fe=fe[le]),fe){me.bindFramebuffer(A.FRAMEBUFFER,fe);try{const Ce=_.textures[_e],De=Ce.format,be=Ce.type;if(!ye.textureFormatReadable(De)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ye.textureTypeReadable(be)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=_.width-B&&F>=0&&F<=_.height-I&&(_.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+_e),A.readPixels(L,F,B,I,Ee.convert(De),Ee.convert(be),Q))}finally{const Ce=N!==null?ge.get(N).__webglFramebuffer:null;me.bindFramebuffer(A.FRAMEBUFFER,Ce)}}},this.readRenderTargetPixelsAsync=async function(_,L,F,B,I,Q,le,_e=0){if(!(_&&_.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let fe=ge.get(_).__webglFramebuffer;if(_.isWebGLCubeRenderTarget&&le!==void 0&&(fe=fe[le]),fe)if(L>=0&&L<=_.width-B&&F>=0&&F<=_.height-I){me.bindFramebuffer(A.FRAMEBUFFER,fe);const Ce=_.textures[_e],De=Ce.format,be=Ce.type;if(!ye.textureFormatReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ye.textureTypeReadable(be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ve=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,Ve),A.bufferData(A.PIXEL_PACK_BUFFER,Q.byteLength,A.STREAM_READ),_.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+_e),A.readPixels(L,F,B,I,Ee.convert(De),Ee.convert(be),0);const je=N!==null?ge.get(N).__webglFramebuffer:null;me.bindFramebuffer(A.FRAMEBUFFER,je);const at=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await Dl(A,at,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,Ve),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,Q),A.deleteBuffer(Ve),A.deleteSync(at),Q}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(_,L=null,F=0){const B=Math.pow(2,-F),I=Math.floor(_.image.width*B),Q=Math.floor(_.image.height*B),le=L!==null?L.x:0,_e=L!==null?L.y:0;Le.setTexture2D(_,0),A.copyTexSubImage2D(A.TEXTURE_2D,F,0,0,le,_e,I,Q),me.unbindTexture()};const zo=A.createFramebuffer(),Ho=A.createFramebuffer();this.copyTextureToTexture=function(_,L,F=null,B=null,I=0,Q=null){Q===null&&(I!==0?(Mi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Q=I,I=0):Q=0);let le,_e,fe,Ce,De,be,Ve,je,at;const it=_.isCompressedTexture?_.mipmaps[Q]:_.image;if(F!==null)le=F.max.x-F.min.x,_e=F.max.y-F.min.y,fe=F.isBox3?F.max.z-F.min.z:1,Ce=F.min.x,De=F.min.y,be=F.isBox3?F.min.z:0;else{const It=Math.pow(2,-I);le=Math.floor(it.width*It),_e=Math.floor(it.height*It),_.isDataArrayTexture?fe=it.depth:_.isData3DTexture?fe=Math.floor(it.depth*It):fe=1,Ce=0,De=0,be=0}B!==null?(Ve=B.x,je=B.y,at=B.z):(Ve=0,je=0,at=0);const Qe=Ee.convert(L.format),Re=Ee.convert(L.type);let rt;L.isData3DTexture?(Le.setTexture3D(L,0),rt=A.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(Le.setTexture2DArray(L,0),rt=A.TEXTURE_2D_ARRAY):(Le.setTexture2D(L,0),rt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,L.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,L.unpackAlignment);const Xe=A.getParameter(A.UNPACK_ROW_LENGTH),Rt=A.getParameter(A.UNPACK_IMAGE_HEIGHT),zn=A.getParameter(A.UNPACK_SKIP_PIXELS),Ct=A.getParameter(A.UNPACK_SKIP_ROWS),fi=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,it.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,it.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Ce),A.pixelStorei(A.UNPACK_SKIP_ROWS,De),A.pixelStorei(A.UNPACK_SKIP_IMAGES,be);
vendor: 4,326 bytes, lines 3840-3845
3840const st=_.isDataArrayTexture||_.isData3DTexture,Ut=L.isDataArrayTexture||L.isData3DTexture;if(_.isDepthTexture){const It=ge.get(_),Et=ge.get(L),yt=ge.get(It.__renderTarget),hr=ge.get(Et.__renderTarget);me.bindFramebuffer(A.READ_FRAMEBUFFER,yt.__webglFramebuffer),me.bindFramebuffer(A.DRAW_FRAMEBUFFER,hr.__webglFramebuffer);for(let Tn=0;Tn<fe;Tn++)st&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,ge.get(_).__webglTexture,I,be+Tn),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,ge.get(L).__webglTexture,Q,at+Tn)),A.blitFramebuffer(Ce,De,le,_e,Ve,je,le,_e,A.DEPTH_BUFFER_BIT,A.NEAREST);me.bindFramebuffer(A.READ_FRAMEBUFFER,null),me.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(I!==0||_.isRenderTargetTexture||ge.has(_)){const It=ge.get(_),Et=ge.get(L);me.bindFramebuffer(A.READ_FRAMEBUFFER,zo),me.bindFramebuffer(A.DRAW_FRAMEBUFFER,Ho);for(let yt=0;yt<fe;yt++)st?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,It.__webglTexture,I,be+yt):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,It.__webglTexture,I),Ut?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Et.__webglTexture,Q,at+yt):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Et.__webglTexture,Q),I!==0?A.blitFramebuffer(Ce,De,le,_e,Ve,je,le,_e,A.COLOR_BUFFER_BIT,A.NEAREST):Ut?A.copyTexSubImage3D(rt,Q,Ve,je,at+yt,Ce,De,le,_e):A.copyTexSubImage2D(rt,Q,Ve,je,Ce,De,le,_e);me.bindFramebuffer(A.READ_FRAMEBUFFER,null),me.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else Ut?_.isDataTexture||_.isData3DTexture?A.texSubImage3D(rt,Q,Ve,je,at,le,_e,fe,Qe,Re,it.data):L.isCompressedArrayTexture?A.compressedTexSubImage3D(rt,Q,Ve,je,at,le,_e,fe,Qe,it.data):A.texSubImage3D(rt,Q,Ve,je,at,le,_e,fe,Qe,Re,it):_.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,Q,Ve,je,le,_e,Qe,Re,it.data):_.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,Q,Ve,je,it.width,it.height,Qe,it.data):A.texSubImage2D(A.TEXTURE_2D,Q,Ve,je,le,_e,Qe,Re,it);A.pixelStorei(A.UNPACK_ROW_LENGTH,Xe),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,Rt),A.pixelStorei(A.UNPACK_SKIP_PIXELS,zn),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ct),A.pixelStorei(A.UNPACK_SKIP_IMAGES,fi),Q===0&&L.generateMipmaps&&A.generateMipmap(rt),me.unbindTexture()},this.initRenderTarget=function(_){ge.get(_).__webglFramebuffer===void 0&&Le.setupRenderTarget(_)},this.initTexture=function(_){_.isCubeTexture?Le.setTextureCube(_,0):_.isData3DTexture?Le.setTexture3D(_,0):_.isDataArrayTexture||_.isCompressedArrayTexture?Le.setTexture2DArray(_,0):Le.setTexture2D(_,0),me.unbindTexture()},this.resetState=function(){R=0,D=0,N=null,me.reset(),oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return jt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=qe._getDrawingBufferColorSpace(e),t.unpackColorSpace=qe._getUnpackColorSpace()}}/** 3841 * postprocessing v6.39.5 build Wed Sep 09 2026 3842 * https://github.com/pmndrs/postprocessing 3843 * Copyright 2015-2026 Raoul van Rüschen 3844 * @license Zlib 3845 */var Kd=(()=>{const n=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new Sn;return t.setAttribute("position",new Ot(n,3)),t.setAttribute("uv",new Ot(e,2)),t})(),Mn=class Os{static get fullscreenGeometry(){return Kd}constructor(e="Pass",t=new Ns,i=new qs){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 Xt(Os.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new Ns),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}
3845setDepthTexture(e,t=Ti){}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 Bt||t instanceof ci||t instanceof vt||t instanceof Os)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},$d=class extends Mn{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)}},Zd=`#ifdef COLOR_WRITE 3846#include <common> 3847#include <dithering_pars_fragment> 3848#ifdef FRAMEBUFFER_PRECISION_HIGH 3849uniform mediump sampler2D inputBuffer; 3850#else 3851uniform lowp sampler2D inputBuffer; 3852#endif 3853#endif 3854#ifdef DEPTH_WRITE 3855#include <packing> 3856#ifdef GL_FRAGMENT_PRECISION_HIGH 3857uniform highp sampler2D depthBuffer; 3858#else 3859uniform mediump sampler2D depthBuffer; 3860#endif 3861float readDepth(const in vec2 uv){ 3862#if DEPTH_PACKING == 3201 3863return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 3864#else 3865return texture2D(depthBuffer,uv).r; 3866#endif 3867} 3868#endif 3869#ifdef USE_WEIGHTS 3870uniform vec4 channelWeights; 3871#endif 3872uniform float opacity;varying vec2 vUv;void main(){ 3873#ifdef COLOR_WRITE 3874vec4 texel=texture2D(inputBuffer,vUv); 3875#ifdef USE_WEIGHTS 3876texel*=channelWeights; 3877#endif 3878gl_FragColor=opacity*texel; 3879#ifdef COLOR_SPACE_CONVERSION 3880#include <colorspace_fragment> 3881#endif 3882#include <dithering_fragment> 3883#else 3884gl_FragColor=vec4(0.0); 3885#endif 3886#ifdef DEPTH_WRITE 3887gl_FragDepth=readDepth(vUv); 3888#endif 3889}`,jd="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Jd=class extends zt{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:Jt,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Zd,vertexShader:jd}),this.depthFunc=rr}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}},Qd=class extends Mn{constructor(n,e=!0){super("CopyPass"),this.fullscreenMaterial=new Jd,this.needsSwap=!1,this.renderTarget=n,n===void 0&&(this.renderTarget=new Bt(1,1,{minFilter:Mt,magFilter:Mt,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!==At?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":n!==null&&n.outputColorSpace===ct&&(this.renderTarget.texture.colorSpace=ct))}},Ka=new Ze,Uo=class extends Mn{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(),c=s!==null,l=a>=0;c?(n.getClearColor(Ka),n.setClearColor(s,l?a:o)):l&&n.setClearAlpha(a),n.setRenderTarget(this.renderToScreen?null:e),n.clear(this.color,this.depth,this.stencil),c?n.setClearColor(Ka,o):l&&n.setClearAlpha(o)}},ep=class extends Mn{constructor(n,e){super("MaskPass",n,e),this.needsSwap=!1,this.clearPass=new Uo(!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,c=this.camera,l=this.clearPass,f=this.inverted?0:1,h=1-f;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,f,4294967295),a.stencil.setClear(h),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?l.render(n,null):(l.render(n,e),l.render(n,t))),this.renderToScreen?(n.setRenderTarget(null),n.render(o,c)):(n.setRenderTarget(e),n.render(o,c),n.setRenderTarget(t),n.render(o,c)),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)}};function tp(n,e){const t=n.getContext();if(e<=0||typeof t.renderbufferStorageMultisample!="function")return 0;const i=t.getParameter(t.MAX_SAMPLES),r=Math.min(e,i);if(r<=0)return 0;const s=t.getParameter(t.RENDERBUFFER_BINDING),a=t.createRenderbuffer();try{return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.RGBA8,1,1),r}catch{return 0}finally{t.bindRenderbuffer(t.RENDERBUFFER,s),t.deleteRenderbuffer(a)}}var Wr=1/1e3,np=1e3,ip=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*Wr}get fixedDelta(){return this._fixedDelta*Wr}set fixedDelta(n){this._fixedDelta=n*np}get elapsed(){return this._elapsed*Wr}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}},$a=class{constructor(n=null,{depthBuffer:e=!0,stencilBuffer:t=!1,multisampling:i=0,frameBufferType:r=At}={}
3889){this.renderer=null,this.inputBuffer=this.createBuffer(e,t,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Qd,this.depthRenderTarget=null,this.passes=[],this.timer=new ip,this.autoRenderToScreen=!0,this.setRenderer(n)}get stableDepthTexture(){return this.depthRenderTarget===null?null:this.depthRenderTarget.depthTexture}get multisampling(){return this.inputBuffer.samples}set multisampling(n){const e=this.renderer===null?n:tp(this.renderer,n);this.multisampling!==e&&(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(n){if(this.renderer=n,n!==null){const e=n.getSize(new ze),t=n.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===At&&n.outputColorSpace===ct&&(this.inputBuffer.texture.colorSpace=ct,this.outputBuffer.texture.colorSpace=ct,this.inputBuffer.dispose(),this.outputBuffer.dispose());const r=this.multisampling;this.multisampling=r,n.autoClear=!1,this.setSize(e.width,e.height);for(const s of this.passes)s.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=new vi;n.name="EffectComposer.InputDepth",this.inputBuffer.stencilBuffer?(n.format=oi,n.type=ai):n.type=Zt;const e=new vi;e.format=n.format,e.type=n.type,e.name="EffectComposer.OutputDepth";const t=new vi;t.format=n.format,t.type=n.type,t.name="EffectComposer.StableDepth",this.inputBuffer.depthTexture=n,this.outputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.outputBuffer.dispose();const{width:i,height:r}=this.inputBuffer;this.depthRenderTarget=new Bt(i,r,{depthBuffer:!0,stencilBuffer:this.inputBuffer.stencilBuffer,depthTexture: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(){const n=this.stableDepthTexture;for(const e of this.passes)e.getDepthTexture()===n&&e.setDepthTexture(null);this.depthRenderTarget!==null&&(this.depthRenderTarget.dispose(),this.depthRenderTarget=null),this.inputBuffer.depthTexture!==null&&(this.inputBuffer.depthTexture.dispose(),this.inputBuffer.depthTexture=null),this.outputBuffer.depthTexture!==null&&(this.outputBuffer.depthTexture.dispose(),this.outputBuffer.depthTexture=null)}createBuffer(n,e,t,i){const r=this.renderer,s=r===null?new ze:r.getDrawingBufferSize(new ze),a=new Bt(s.width,s.height,{minFilter:Mt,magFilter:Mt,samples:i,stencilBuffer:e,depthBuffer:n,type:t});return t===At&&r!==null&&r.outputColorSpace===ct&&(a.texture.colorSpace=ct),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}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 ze),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.depthRenderTarget!==null)if(this.depthRenderTarget===null){this.createDepthTexture();for(const o of t)o.setDepthTexture(this.stableDepthTexture)}else n.setDepthTexture(this.stableDepthTexture)}removePass(n){const e=this.passes,t=e.indexOf(n);if(t!==-1&&e.splice(t,1).length>0){const s=this.stableDepthTexture;if(s!==null){const a=(c,l)=>c||l.needsDepthTexture;e.reduce(a,!1)||(n.getDepthTexture()===s&&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;
3889n===void 0&&(this.timer.update(),n=this.timer.getDelta());for(const o of this.passes)if(o.enabled){if(o.render(e,i,r,n,a),o.needsDepthBlit&&this.depthRenderTarget!==null&&this.blitDepthBuffer(i),o.needsSwap){if(a){t.renderToScreen=o.renderToScreen;const c=e.getContext(),l=e.state.buffers.stencil;l.setFunc(c.NOTEQUAL,1,4294967295),t.render(e,i,r,n,a),l.setFunc(c.EQUAL,1,4294967295)}s=i,i=r,r=s}o instanceof ep?a=!0:o instanceof $d&&(a=!1)}}setSize(n,e,t){const i=this.renderer,r=i.getSize(new ze);(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 ze);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.deleteDepthTexture(),this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.copyPass.dispose(),this.timer.dispose(),this.passes=[],Mn.fullscreenGeometry.dispose()}},On={NONE:0,DEPTH:1,CONVOLUTION:2},Ye={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"},rp=class{constructor(){this.shaderParts=new Map([[Ye.FRAGMENT_HEAD,null],[Ye.FRAGMENT_MAIN_UV,null],[Ye.FRAGMENT_MAIN_IMAGE,null],[Ye.VERTEX_HEAD,null],[Ye.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=On.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=vn}},Xr=!1,Za=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 Dt:t=this.materialsFlatShadedDoubleSide;break;case gt:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case Dt: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 zt))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=cn;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=Dt,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=Dt,i})}}render(n,e,t){const i=n.shadowMap.enabled;if(n.shadowMap.enabled=!1,Xr){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);
3889for(const e of n)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return Xr}static set workaroundEnabled(n){Xr=n}},ke={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},sp="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);}",ap="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}",op="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);}",lp="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);}",cp="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);}",up="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);}",fp="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);}",hp="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);}",dp="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);}",pp="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);}",mp="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);}",gp="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);}",_p="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);}",vp="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);}",xp="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);}",Sp="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);}",Mp="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);}",Ep="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);}",Tp="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);}",yp="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);}",bp="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);}",Ap="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);}",Rp="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}",Cp="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);}",wp="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);}",Pp="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);}",Dp="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);}",Lp="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);}",Up="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);}",Ip="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}",Np="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);}",Fp="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);}",Op=new Map([[ke.ADD,sp],[ke.ALPHA,ap],[ke.AVERAGE,op],[ke.COLOR,lp],[ke.COLOR_BURN,cp],[ke.COLOR_DODGE,up],[ke.DARKEN,fp],[ke.DIFFERENCE,hp],[ke.DIVIDE,dp],[ke.DST,null],[ke.EXCLUSION,pp],[ke.HARD_LIGHT,mp],[ke.HARD_MIX,gp],[ke.HUE,_p],[ke.INVERT,vp
vendor: 10,786 bytes, lines 3889-3931
3889],[ke.INVERT_RGB,xp],[ke.LIGHTEN,Sp],[ke.LINEAR_BURN,Mp],[ke.LINEAR_DODGE,Ep],[ke.LINEAR_LIGHT,Tp],[ke.LUMINOSITY,yp],[ke.MULTIPLY,bp],[ke.NEGATION,Ap],[ke.NORMAL,Rp],[ke.OVERLAY,Cp],[ke.PIN_LIGHT,wp],[ke.REFLECT,Pp],[ke.SATURATION,Dp],[ke.SCREEN,Lp],[ke.SOFT_LIGHT,Up],[ke.SRC,Ip],[ke.SUBTRACT,Np],[ke.VIVID_LIGHT,Fp]]),Bp=class extends xn{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 Op.get(this.blendFunction)}},Io=class extends xn{constructor(n,e,{attributes:t=On.NONE,blendFunction:i=ke.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 Bp(i),this.blendMode.addEventListener("change",c=>this.setChanged()),this._inputColorSpace=vn,this._outputColorSpace=$t}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=Ti){}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 Bt||e instanceof ci||e instanceof vt||e instanceof Mn)&&this[n].dispose()}}},ja=class extends Mn{constructor(n,e,t=null){super("RenderPass",n,e),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new Uo,this.overrideMaterialManager=t===null?null:new Za(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 Za(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,c=a.layers.mask,l=s.background,f=n.shadowMap.autoUpdate,h=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(h),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(n,s,a):n.render(s,a),a.layers.mask=c,s.background=l,n.shadowMap.autoUpdate=f}},zp=`#include <common> 3890#include <packing> 3891#include <dithering_pars_fragment> 3892#define packFloatToRGBA(v) packDepthToRGBA(v) 3893#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 3894#ifdef FRAMEBUFFER_PRECISION_HIGH 3895uniform mediump sampler2D inputBuffer; 3896#else 3897uniform lowp sampler2D inputBuffer; 3898#endif 3899#if DEPTH_PACKING == 3201 3900uniform lowp sampler2D depthBuffer; 3901#elif defined(GL_FRAGMENT_PRECISION_HIGH) 3902uniform highp sampler2D depthBuffer; 3903#else 3904uniform mediump sampler2D depthBuffer; 3905#endif 3906uniform 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){ 3907#if DEPTH_PACKING == 3201 3908float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv)); 3909#else 3910float depth=texture2D(depthBuffer,uv).r; 3911#endif 3912#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH) 3913float 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; 3914#elif defined(USE_REVERSED_DEPTH_BUFFER) 3915depth=1.0-depth; 3916#endif 3917return depth;}float getViewZ(const in float depth){ 3918#ifdef PERSPECTIVE_CAMERA 3919return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); 3920#else 3921return orthographicDepthToViewZ(depth,cameraNear,cameraFar); 3922#endif 3923}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; 3924#ifdef ENCODE_OUTPUT 3925#include <colorspace_fragment> 3926#endif 3927#include <dithering_fragment> 3928}`,Hp="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);}",Gp=class extends zt{constructor(n,e,t,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:lr.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new lt(null),depthBuffer:new lt(null),resolution:new lt(new ze),texelSize:new lt(new ze),cameraNear:new lt(.3),cameraFar:new lt(1e3),aspect:new lt(1),time:new lt(0)},blending:Jt,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=Ti){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=zp.replace(Ye.FRAGMENT_HEAD,n.get(Ye.FRAGMENT_HEAD)||"").replace(Ye.FRAGMENT_MAIN_UV,n.get(Ye.FRAGMENT_MAIN_UV)||"").replace(Ye.FRAGMENT_MAIN_IMAGE,n.get(Ye.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=Hp.replace(Ye.VERTEX_HEAD,n.get(Ye.VERTEX_HEAD)||"").replace(Ye.VERTEX_MAIN_SUPPORT,n.get(Ye.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 Ft?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 Ye}};function Ja(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 Vp(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&On.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,c=t.shaderParts;let l=c.get(Ye.FRAGMENT_HEAD)||"",f=c.get(Ye.FRAGMENT_MAIN_UV)||"",h=c.get(Ye.FRAGMENT_MAIN_IMAGE)||"",d=c.get(Ye.VERTEX_HEAD)||"",p=c.get(Ye.VERTEX_MAIN_SUPPORT)||"";const v=new Set,x=new Set;if(a&&(f+=` ${n}MainUv(UV); 3929`,t.uvTransformation=!0),r!==null&&/mainSupport/.test(r)){const b=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);p+=` ${n}MainSupport(`,p+=b?`vUv); 3930`:`); 3931`;for(const y of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const T of y[1].split(/\s*,\s*/))t.varyings.add(T),v.add(T),x.add(T);for(const y of r.matchAll(o))x.add(y[1])}for(const b of i.matchAll(o))x.add(b[1]);for(const b of e.defines.keys())x.add(b.replace(/\([\w\s,]*\)/g,""));for(const b of e.uniforms.keys())x.add(b);x.delete("while"),x.delete("for"),x.delete("if"),e.uniforms.forEac
3931h((b,y)=>t.uniforms.set(n+y.charAt(0).toUpperCase()+y.slice(1),b)),e.defines.forEach((b,y)=>t.defines.set(n+y.charAt(0).toUpperCase()+y.slice(1),b));const m=new Map([["fragment",i],["vertex",r]]);Ja(n,x,t.defines),Ja(n,x,m),i=m.get("fragment"),r=m.get("vertex");const u=e.blendMode;if(t.blendModes.set(u.blendFunction,u),s){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(h+=e.inputColorSpace===ct?`color0 = sRGBTransferOETF(color0); 3932 `:`color0 = sRGBToLinear(color0); 3933 `),e.outputColorSpace!==$t?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);const b=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;h+=`${n}MainImage(color0, UV, `,(t.attributes&On.DEPTH)!==0&&b.test(i)&&(h+="depth, ",t.readDepth=!0),h+=`color1); 3934 `;const y=n+"BlendOpacity";t.uniforms.set(y,u.opacity),h+=`color0 = blend${u.blendFunction}(color0, color1, ${y}); 3935 3936 `,l+=`uniform float ${y}; 3937 3938`}if(l+=i+` 3939`,r!==null&&(d+=r+` 3940`),c.set(Ye.FRAGMENT_HEAD,l),c.set(Ye.FRAGMENT_MAIN_UV,f),c.set(Ye.FRAGMENT_MAIN_IMAGE,h),c.set(Ye.VERTEX_HEAD,d),c.set(Ye.VERTEX_MAIN_SUPPORT,p),e.extensions!==null)for(const b of e.extensions)t.extensions.add(b)}}var Qa=class extends Mn{constructor(n,...e){super("EffectPass"),this.fullscreenMaterial=new Gp(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 rp;let e=0;for(const a of this.effects)if(a.blendMode.blendFunction===ke.DST)n.attributes|=a.getAttributes()&On.DEPTH;else{if((n.attributes&a.getAttributes()&On.CONVOLUTION)!==0)throw new Error(`Convolution effects cannot be merged (${a.name})`);Vp("e"+e++,a,n)}let t=n.shaderParts.get(Ye.FRAGMENT_HEAD),i=n.shaderParts.get(Ye.FRAGMENT_MAIN_IMAGE),r=n.shaderParts.get(Ye.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const a of n.blendModes.values())t+=a.getShaderCode().replace(s,`blend${a.blendFunction}`)+` 3941`;(n.attributes&On.DEPTH)!==0?(n.readDepth&&(i=`float depth = readDepth(UV); 3942 3943 `+i),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,n.colorSpace
3943===ct&&(i+=`color0 = sRGBToLinear(color0); 3944 `),n.uvTransformation?(r=`vec2 transformedUv = vUv; 3945`+r,n.defines.set("UV","transformedUv")):n.defines.set("UV","vUv"),n.shaderParts.set(Ye.FRAGMENT_HEAD,t),n.shaderParts.set(Ye.FRAGMENT_MAIN_IMAGE,i),n.shaderParts.set(Ye.FRAGMENT_MAIN_UV,r);for(const[a,o]of n.shaderParts)o!==null&&n.shaderParts.set(a,o.trim().replace(/^#/,` 3946#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(n)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(n,e=Ti){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!==At&&(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 kp=()=>{const e=document.createElement("canvas");e.width=64,e.height=64;const t=e.getContext("2d");if(!t)throw new Error("2D context not available");t.fillStyle="black",t.fillRect(0,0,e.width,e.height);const i=new vt(e);i.minFilter=Mt,i.magFilter=Mt,i.generateMipmaps=!1;const r=[];let s=null;const a=64;let o=.1*64;const c=1/a,l=()=>{t.fillStyle="black",t.fillRect(0,0,e.width,e.height)},f=p=>{const v={x:p.x*64,y:(1-p.y)*64};let x=1;const m=T=>Math.sin(T*Math.PI/2),u=T=>-T*(T-2);p.age<a*.3?x=m(p.age/(a*.3)):x=u(1-(p.age-a*.3)/(a*.7))||0,x*=p.force;const b=`${(p.vx+1)/2*255}, ${(p.vy+1)/2*255}, ${x*255}`,y=320;t.shadowOffsetX=y,t.shadowOffsetY=y,t.shadowBlur=o,t.shadowColor=`rgba(${b},${.22*x})`,t.beginPath(),t.fillStyle="rgba(255,0,0,1)",t.arc(v.x-y,v.y-y,o,0,Math.PI*2),t.fill()};return{canvas:e,texture:i,addTouch:p=>{let v=0,x=0,m=0;if(s){const u=p.x-s.x,b=p.y-s.y;if(u===0&&b===0)return;const y=u*u+b*b,T=Math.sqrt(y);x=u/(T||1),m=b/(T||1),v=Math.min(y*1e4,1)}s={x:p.x,y:p.y},r.push({x:p.x,y:p.y,age:0,force:v,vx:x,vy:m})},update:()=>{l();for(let p=r.length-1;p>=0;p--){const v=r[p],x=v.force*c*(1-v.age/a);v.x+=v.vx*x,v.y+=v.vy*x,v.age++,v.age>a&&r.splice(p,1)}for(let p=0;p<r.length;p++)f(r[p]);i.needsUpdate=!0},set radiusScale(p){o=.1*64*p},get radiusScale(){return o/(.1*64)},size:64}},Wp=(n,e)=>{const t=` 3947 uniform sampler2D uTexture; 3948 uniform float uStrength; 3949 uniform float uTime; 3950 uniform float uFreq; 3951 3952 void mainUv(inout vec2 uv) { 3953 vec4 tex = texture2D(uTexture, uv); 3954 float vx = tex.r * 2.0 - 1.0; 3955 float vy = tex.g * 2.0 - 1.0; 3956 float intensity = tex.b; 3957 3958 float wave = 0.5 + 0.5 * sin(uTime * uFreq + intensity * 6.2831853); 3959 3960 float amt = uStrength * intensity * wave; 3961 3962 uv += vec2(vx, vy) * amt; 3963 } 3964 `;return new Io("LiquidEffect",t,{uniforms:new Map([["uTexture",new lt(n)],["uStrength",new lt((e==null?void 0:e.strength)??.025)],["uTime",new lt(0)],["uFreq",new lt((e==null?void 0:e.freq)??4.5)]])})},eo={square:0,circle:1,triangle:2,diamond:3},Xp=` 3965void main() { 3966 gl_Position = vec4(position, 1.0); 3967} 3968`,qp=` 3969precision highp float; 3970 3971uniform vec3 uColor; 3972uniform vec2 uResolution; 3973uniform float uTime; 3974uniform float uPixelSize; 3975uniform float uScale; 3976uniform float uDensity; 3977uniform float uPixelJitter; 3978uniform int uEnableRipples; 3979uniform float uRippleSpeed; 3980uniform float uRippleThickness; 3981uniform float uRippleIntensity; 3982uniform float uEdgeFade; 3983uniform float uCenterHole; 3984 3985uniform int uShapeType; 3986const int SHAPE_SQUARE = 0; 3987const int SHAPE_CIRCLE = 1; 3988const int SHAPE_TRIANGLE = 2; 3989const int SHAPE_DIAMOND = 3; 3990 3991const int MAX_CLICKS = 10; 3992 3993uniform vec2 uClickPos [MAX_CLICKS]; 3994uniform float uClickTimes[MAX_CLICKS]; 3995 3996out vec4 fragColor; 3997 3998float Bayer2(vec2 a) { 3999 a = floor(a); 4000 return fract(a.x / 2. + a.y * a.y * .75); 4001} 4002#define Bayer4(a) (Bayer2(.5*(a))*0.25 + Bayer2(a)) 4003#define Bayer8(a) (Bayer4(.5*(a))*0.25 + Bayer2(a)) 4004 4005#define FBM_OCTAVES 5 4006#define FBM_LACUNARITY 1.25 4007#define FBM_GAIN 1.0 4008 4009float hash11(float n){ return fract(sin(n)*43758.5453); } 4010 4011float vnoise(vec3 p){ 4012 vec3 ip = floor(p); 4013 vec3 fp = fract(p); 4014 float n000 = hash11(dot(ip + vec3(0.0,0.0,0.0), vec3(1.0,57.0,113.0))); 4015 float n100 = hash11(dot(ip + vec3(1.0,0.0,0.0), vec3(1.0,57.0,113.0))); 4016 float n010 = hash11(dot(ip + vec3(0.0,1.0,0.0), vec3(1.0,57.0,113.0))); 4017 float n110 = hash11(dot(ip + vec3(1.0,1.0,0.0), vec3(1.0,57.0,113.0))); 4018 float n001 = hash11(dot(ip + vec3(0.0,0.0,1.0), vec3(1.0,57.0,113.0))); 4019 float n101 = hash11(dot(ip + vec3(1.0,0.0,1.0), vec3(1.0,57.0,113.0))); 4020 float n011 = hash11(dot(ip + vec3(0.0,1.0,1.0), vec3(1.0,57.0,113.0))); 4021 float n111 = hash11(dot(ip + vec3(1.0,1.0,1.0), vec3(1.0,57.0,113.0))); 4022 vec3 w = fp*fp*fp*(fp*(fp*6.0-15.0)+10.0); 4023 float x00 = mix(n000, n100, w.x); 4024 float x10 = mix(n010, n110, w.x); 4025 float x01 = mix(n001, n101, w.x); 4026 float x11 = mix(n011, n111, w.x); 4027 float y0 = mix(x00, x10, w.y); 4028 float y1 = mix(x01, x11, w.y); 4029 return mix(y0, y1, w.z) * 2.0 - 1.0; 4030} 4031 4032float fbm2(vec2 uv, float t){ 4033 vec3 p = vec3(uv * uScale, t); 4034 float amp = 1.0; 4035 float freq = 1.0; 4036 float sum = 1.0; 4037 for (int i = 0;
4037 i < FBM_OCTAVES; ++i){ 4038 sum += amp * vnoise(p * freq); 4039 freq *= FBM_LACUNARITY; 4040 amp *= FBM_GAIN; 4041 } 4042 return sum * 0.5 + 0.5; 4043} 4044 4045float maskCircle(vec2 p, float cov){ 4046 float r = sqrt(cov) * .25; 4047 float d = length(p - 0.5) - r; 4048 float aa = 0.5 * fwidth(d); 4049 return cov * (1.0 - smoothstep(-aa, aa, d * 2.0)); 4050} 4051 4052float maskTriangle(vec2 p, vec2 id, float cov){ 4053 bool flip = mod(id.x + id.y, 2.0) > 0.5; 4054 if (flip) p.x = 1.0 - p.x; 4055 float r = sqrt(cov); 4056 float d = p.y - r*(1.0 - p.x); 4057 float aa = fwidth(d); 4058 return cov * clamp(0.5 - d/aa, 0.0, 1.0); 4059} 4060 4061float maskDiamond(vec2 p, float cov){ 4062 float r = sqrt(cov) * 0.564; 4063 return step(abs(p.x - 0.49) + abs(p.y - 0.49), r); 4064} 4065 4066void main(){ 4067 float pixelSize = uPixelSize; 4068 vec2 fragCoord = gl_FragCoord.xy - uResolution * .5; 4069 float aspectRatio = uResolution.x / uResolution.y; 4070 4071 vec2 pixelId = floor(fragCoord / pixelSize); 4072 vec2 pixelUV = fract(fragCoord / pixelSize); 4073 4074 float cellPixelSize = 8.0 * pixelSize; 4075 vec2 cellId = floor(fragCoord / cellPixelSize); 4076 vec2 cellCoord = cellId * cellPixelSize; 4077 vec2 uv = cellCoord / uResolution * vec2(aspectRatio, 1.0); 4078 4079 float base = fbm2(uv, uTime * 0.05); 4080 base = base * 0.5 - 0.65; 4081 4082 float feed = base + (uDensity - 0.5) * 0.3; 4083 4084 float speed = uRippleSpeed; 4085 float thickness = uRippleThickness; 4086 const float dampT = 1.0; 4087 const float dampR = 10.0; 4088 4089 if (uEnableRipples == 1) { 4090 for (int i = 0; i < MAX_CLICKS; ++i){ 4091 vec2 pos = uClickPos[i]; 4092 if (pos.x < 0.0) continue; 4093 float cellPixelSize = 8.0 * pixelSize; 4094 vec2 cuv = (((pos - uResolution * .5 - cellPixelSize * .5) / (uResolution))) * vec2(aspectRatio, 1.0); 4095 float t = max(uTime - uClickTimes[i], 0.0); 4096 float r = distance(uv, cuv); 4097 float waveR = speed * t; 4098 float ring = exp(-pow((r - waveR) / thickness, 2.0)); 4099 float atten = exp(-dampT * t) * exp(-dampR * r); 4100 feed = max(feed, ring * atten * uRippleIntensity); 4101 } 4102 } 4103 4104 float bayer = Bayer8(fragCoord / uPixelSize) - 0.5; 4105 float bw = step(0.5, feed + bayer); 4106 4107 float h = fract(sin(dot(floor(fragCoord / uPixelSize), vec2(127.1, 311.7))) * 43758.5453); 4108 float jitterScale = 1.0 + (h - 0.5) * uPixelJitter; 4109 float coverage = bw * jitterScale; 4110 float M; 4111 if (uShapeType == SHAPE_CIRCLE) M = maskCircle (pixelUV, coverage); 4112 else if (uShapeType == SHAPE_TRIANGLE) M = maskTriangle(pixelUV, pixelId, coverage); 4113 else if (uShapeType == SHAPE_DIAMOND) M = maskDiamond(pixelUV, coverage); 4114 else M = coverage; 4115 4116 if (uEdgeFade > 0.0) { 4117 vec2 norm = gl_FragCoord.xy / uResolution; 4118 float edge = min(min(norm.x, norm.y), min(1.0 - norm.x, 1.0 - norm.y)); 4119 float fade = smoothstep(0.0, uEdgeFade, edge); 4120 M *= fade; 4121 } 4122 4123 // The inverse of the fade above: hold the band at full strength for most of 4124 // its width, then take it to nothing by the time it reaches uCenterHole in 4125 // from the nearest edge. Feathered rather than cut so the field runs out 4126 // instead of stopping on a line. 4127 if (uCenterHole > 0.0) { 4128 vec2 norm = gl_FragCoord.xy / uResolution; 4129 float edge = min(min(norm.x, norm.y), min(1.0 - norm.x, 1.0 - norm.y)); 4130 M *= 1.0 - smoothstep(uCenterHole * 0.6, uCenterHole, edge); 4131 } 4132 4133 vec3 color = uColor; 4134 4135 // sRGB gamma correction - convert linear to sRGB for accurate color output 4136 vec3 srgbColor = mix( 4137 color * 12.92, 4138 1.055 * pow(color, vec3(1.0 / 2.4)) - 0.055, 4139 step(0.0031308, color) 4140 ); 4141 4142 fragColor = vec4(srgbColor, M); 4143} 4144`,qr=10,to=3,no=(n,e)=>{var i,r,s,a;n.listeners.abort(),(i=n.resizeObserver)==null||i.disconnect(),(r=n.intersectionObserver)==null||r.disconnect(),cancelAnimationFrame(n.raf),(s=n.quad)==null||s.geometry.dispose(),n.material.dispose(),(a=n.composer)==null||a.dispose(),n.renderer.dispose(),n.renderer.forceContextLoss();const t=n.renderer.domElement;e&&t.parentElement===e&&e.removeChild(t)},$p=({variant:n="square",pixelSize:e=3,color:t="#B497CF",className:i,style:r,antialias:s=!0,patternScale:a=2,patternDensity:o=1,liquid:c=!1,liquidStrength:l=.1,liquidRadius:f=1,pixelSizeJitter:h=0,enableRipples:d=!0,rippleIntensityScale:p=1,rippleThickness:v=.1,rippleSpeed:x=.3,liquidWobbleSpeed:m=4.5,autoPauseOffscreen:u=!0,speed:b=.5,transparent:y=!0,edgeFade:T=.5,centerHole:w=0,noiseAmount:R=0})=>{const D=en.useRef(null),N=en.useRef({visible:!0}),E=en.useRef(b),[M,P]=en.useState(0),z=en.useRef(0),H=en.useRef(null),X=en.useRef(null);return en.useEffect(()=>{const Y=D.current;if(!Y)return;const W=window.matchMedia("(prefers-reduced-motion: reduce)").matches;E.current=b;
4144const ne=["antialias","liquid","noiseAmount","contextEpoch"],V={antialias:s,liquid:c,noiseAmount:R,contextEpoch:M};let se=!1;if(!H.current)se=!0;else if(X.current){for(const j of ne)if(X.current[j]!==V[j]){se=!0;break}}if(se){H.current&&(no(H.current,Y),H.current=null);const j=document.createElement("canvas"),pe=new AbortController,ce=new Yd({canvas:j,antialias:s,alpha:!0,powerPreference:"high-performance"});ce.domElement.style.width="100%",ce.domElement.style.height="100%",ce.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),Y.appendChild(ce.domElement),j.addEventListener("webglcontextlost",S=>{if(S.preventDefault(),z.current+=1,z.current>to){console.warn(`PixelBlast lost its WebGL context and has rebuilt ${to} times already; leaving it off.`);return}console.warn("PixelBlast lost its WebGL context; rebuilding"),P(g=>g+1)},{once:!0,signal:pe.signal}),y?ce.setClearAlpha(0):ce.setClearColor(0,1);const He={uResolution:{value:new ze(0,0)},uTime:{value:0},uColor:{value:new Ze(t)},uClickPos:{value:Array.from({length:qr},()=>new ze(-1,-1))},uClickTimes:{value:new Float32Array(qr)},uShapeType:{value:eo[n]??0},uPixelSize:{value:e*ce.getPixelRatio()},uScale:{value:a},uDensity:{value:o},uPixelJitter:{value:h},uEnableRipples:{value:d?1:0},uRippleSpeed:{value:x},uRippleThickness:{value:v},uRippleIntensity:{value:p},uEdgeFade:{value:T},uCenterHole:{value:w}},Ke=new Ns,Ge=new qs(-1,1,1,-1,0,1),q=new zt({vertexShader:Xp,fragmentShader:qp,uniforms:He,transparent:!0,depthTest:!1,depthWrite:!1,glslVersion:Us}),Z=new Ci(2,2),he=new Xt(Z,q);Ke.add(he);const we=new cc,xe=()=>{var G;const S=Y.clientWidth||1,g=Y.clientHeight||1,U=Math.min(window.devicePixelRatio||1,2);U!==ce.getPixelRatio()&&ce.setPixelRatio(U),!(ce.domElement.width===Math.floor(S*U)&&ce.domElement.height===Math.floor(g*U))&&(ce.setSize(S,g,!1),He.uResolution.value.set(ce.domElement.width,ce.domElement.height),(G=H.current)!=null&&G.composer&&H.current.composer.setSize(ce.domElement.width,ce.domElement.height),He.uPixelSize.value=e*ce.getPixelRatio())};xe();let Be;u&&(Be=new IntersectionObserver(S=>{N.current.visible=S.some(g=>g.isIntersecting)},{rootMargin:"100px"}),Be.observe(Y));const A=(()=>{var S;if(typeof window<"u"&&((S=window.crypto)!=null&&S.getRandomValues)){const g=new Uint32Array(1);return window.crypto.getRandomValues(g),g[0]/4294967295}return Math.random()})()*1e3;let Ie,Ae,ye;if(c){Ae=kp(),Ae.radiusScale=f,Ie=new $a(ce);const S=new ja(Ke,Ge);ye=Wp(Ae.texture,{strength:l,freq:m});const g=new Qa(Ge,ye);g.renderToScreen=!0,Ie.addPass(S),Ie.addPass(g)}if(R>0){Ie||(Ie=new $a(ce),Ie.addPass(new ja(Ke,Ge)));const S=new Io("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)]])}),g=new Qa(Ge,S);g.renderToScreen=!0,Ie&&Ie.passes.length>0&&Ie.passes.forEach(U=>U.renderToScreen=!1),Ie.addPass(g)}Ie&&Ie.setSize(ce.domElement.width,ce.domElement.height);const me=S=>{const g=ce.domElement.getBoundingClientRect(),U=ce.domElement.width/g.width,G=ce.domElement.height/g.height,K=(S.clientX-g.left)*U,k=(g.height-(S.clientY-g.top))*G;return{fx:K,fy:k,w:ce.domElement.width,h:ce.domElement.height}},et=S=>{var K;const{fx:g,fy:U}=me(S),G=((K=H.current)==null?void 0:K.clickIx)??0;He.uClickPos.value[G].set(g,U),He.uClickTimes.value[G]=He.uTime.value,H.current&&(H.current.clickIx=(G+1)%qr)},ge=S=>{if(!Ae)return;const{fx:g,fy:U,w:G,h:K}=me(S);Ae.addTouch({x:g/G,y:U/K})};ce.domElement.addEventListener("pointerdown",et,{passive:!0,signal:pe.signal}),ce.domElement.addEventListener("pointermove",ge,{passive:!0,signal:pe.signal});const Le=()=>{He.uTime.value=A+we.getElapsedTime()*E.current,ye&&(ye.uniforms.get("uTime").value=He.uTime.value),Ie?(Ae&&Ae.update(),Ie.passes.forEach(S=>{const g=S.effects;g&&g.forEach(U=>{var K;const G=(K=U.uniforms)==null?void 0:K.get("uTime");G&&(G.value=He.uTime.value)})}),Ie.render()):ce.render(Ke,Ge)},ot=new ResizeObserver(()=>{xe(),Le()});ot.observe(Y);let tt=0;if(W)Le();else{const S=()=>
4144{if(u&&!N.current.visible){tt=requestAnimationFrame(S);return}Le(),tt=requestAnimationFrame(S)};tt=requestAnimationFrame(S)}H.current={renderer:ce,scene:Ke,camera:Ge,material:q,clock:we,clickIx:0,uniforms:He,resizeObserver:ot,intersectionObserver:Be,raf:tt,quad:he,timeOffset:A,composer:Ie,touch:Ae,liquidEffect:ye,listeners:pe}}else{const j=H.current;if(!j)return;if(j.uniforms.uShapeType.value=eo[n]??0,j.uniforms.uPixelSize.value=e*j.renderer.getPixelRatio(),j.uniforms.uColor.value.set(t),j.uniforms.uScale.value=a,j.uniforms.uDensity.value=o,j.uniforms.uPixelJitter.value=h,j.uniforms.uEnableRipples.value=d?1:0,j.uniforms.uRippleIntensity.value=p,j.uniforms.uRippleThickness.value=v,j.uniforms.uRippleSpeed.value=x,j.uniforms.uEdgeFade.value=T,j.uniforms.uCenterHole.value=w,y?j.renderer.setClearAlpha(0):j.renderer.setClearColor(0,1),j.liquidEffect){const pe=j.liquidEffect.uniforms.get("uStrength");pe&&(pe.value=l);const ce=j.liquidEffect.uniforms.get("uFreq");ce&&(ce.value=m)}j.touch&&(j.touch.radiusScale=f)}X.current=V},[s,c,R,e,a,o,d,p,v,x,h,T,w,y,l,f,m,u,n,t,b,M]),en.useEffect(()=>()=>{H.current&&(no(H.current,D.current),H.current=null)},[]),Go.jsx("div",{ref:D,className:`pixel-blast-container ${i??""}`,style:r,"aria-hidden":"true"})};export{$p 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.