vendor: 45,482 bytes, lines 1-5
1import{r as Ii,j as Al}from"./hybridContent-DS3p3aT4.js";/** 2 * @license 3 * Copyright 2010-2026 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const ia="185",Rl=0,Da=1,wl=2,cr=1,Cl=2,Ei=3,Rn=0,Ct=1,cn=2,fn=0,ri=1,gr=2,La=3,Ia=4,Pl=5,Un=100,Dl=101,Ll=102,Il=103,Ul=104,Nl=200,Fl=201,Ol=202,Bl=203,hs=204,ds=205,zl=206,Gl=207,Vl=208,Hl=209,kl=210,Wl=211,Xl=212,ql=213,Yl=214,ps=0,ms=1,gs=2,oi=3,_s=4,xs=5,vs=6,Ms=7,No=0,Kl=1,Zl=2,Qt=0,Fo=1,Oo=2,Bo=3,ra=4,zo=5,Go=6,Vo=7,Ho=300,Bn=301,li=302,Lr=303,Ir=304,Ar=306,Ss=1e3,un=1001,Es=1002,xt=1003,$l=1004,Ui=1005,Et=1006,Ur=1007,Fn=1008,Bt=1009,ko=1010,Wo=1011,bi=1012,sa=1013,tn=1014,$t=1015,dn=1016,aa=1017,oa=1018,Ai=1020,Xo=35902,qo=35899,Yo=1021,Ko=1022,kt=1023,pn=1026,On=1027,Zo=1028,la=1029,zn=1030,ca=1031,ua=1033,ur=33776,fr=33777,hr=33778,dr=33779,ys=35840,Ts=35841,bs=35842,As=35843,Rs=36196,ws=37492,Cs=37496,Ps=37488,Ds=37489,_r=37490,Ls=37491,Is=37808,Us=37809,Ns=37810,Fs=37811,Os=37812,Bs=37813,zs=37814,Gs=37815,Vs=37816,Hs=37817,ks=37818,Ws=37819,Xs=37820,qs=37821,Ys=36492,Ks=36494,Zs=36495,$s=36283,Js=36284,xr=36285,Qs=36286,Jl=3200,Ua=0,Ql=1,bn="",Ft="srgb",vr="srgb-linear",Mr="linear",Ye="srgb",Wn=7680,Na=519,jl=512,ec=513,tc=514,fa=515,nc=516,ic=517,ha=518,rc=519,Fa=35044,Oa="300 es",Jt=2e3,Sr=2001;function sc(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Er(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ac(){const i=Er("canvas");return i.style.display="block",i}const Ba={};function za(...i){const e="THREE."+i.shift();console.log(e,...i)}function $o(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Re(...i){i=$o(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ve(...i){i=$o(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function si(...i){const e=i.join(" ");e in Ba||(Ba[e]=!0,Re(...i))}function oc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const lc={[ps]:ms,[gs]:vs,[_s]:Ms,[oi]:xs,[ms]:ps,[vs]:gs,[Ms]:_s,[xs]:oi};class Vn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Mt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],pr=Math.PI/180,js=180/Math.PI;function Ri(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Mt[i&255]+Mt[i>>8&255]+Mt[i>>16&255]+Mt[i>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]).toLowerCase()}function Oe(i,e,t){return Math.max(e,Math.min(t,i))}function cc(i,e){return(i%e+e)%e}function Nr(i,e,t){return(1-t)*i+t*e}function pi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function wt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const _a=class _a{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: 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("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}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 n=this.dot(e)/t;return Math.acos(Oe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};_a.prototype.isVector2=!0;let Be=_a;class fi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let c=n[r+0],l=n[r+1],d=n[r+2],m=n[r+3],u=s[a+0],g=s[a+1],x=s[a+2],S=s[a+3];if(m!==S||c!==u||l!==g||d!==x){let p=c*u+l*g+d*x+m*S;p<0&&(u=-u,g=-g,x=-x,S=-S,p=-p);let f=1-o;if(p<.9995){const b=Math.acos(p),A=Math.sin(b);f=Math.sin(f*b)/A,o=Math.sin(o*b)/A,c=c*f+u*o,l=l*f+g*o,d=d*f+x*o,m=m*f+S*o}else{c=c*f+u*o,l=l*f+g*o,d=d*f+x*o,m=m*f+S*o;const b=1/Math.sqrt(c*c+l*l+d*d+m*m);c*=b,l*=b,d*=b,m*=b}}e[t]=c,e[t+1]=l,e[t+2]=d,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],c=n[r+1],l=n[r+2],d=n[r+3],m=s[a],u=s[a+1],g=s[a+2],x=s[a+3];return e[t]=o*x+d*m+c*g-l*u,e[t+1]=c*x+d*u+l*m-o*g,e[t+2]=l*x+d*g+o*u-c*m,e[t+3]=d*x-o*m-c*u-l*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),d=o(r/2),m=o(s/2),u=c(n/2),g=c(r/2),x=c(s/2);switch(a){case"XYZ":this._x=u*d*m+l*g*x,this._y=l*g*m-u*d*x,this._z=l*d*x+u*g*m,this._w=l*d*m-u*g*x;break;case"YXZ":this._x=u*d*m+l*g*x,this._y=l*g*m-u*d*x,this._z=l*d*x-u*g*m,this._w=l*d*m+u*g*x;break;case"ZXY":this._x=u*d*m-l*g*x,this._y=l*g*m+u*d*x,this._z=l*d*x+u*g*m,this._w=l*d*m-u*g*x;break;case"ZYX":this._x=u*d*m-l*g*x,this._y=l*g*m+u*d*x,this._z=l*d*x-u*g*m,this._w=l*d*m+u*g*x;break;case"YZX":this._x=u*d*m+l*g*x,this._y=l*g*m+u*d*x,this._z=l*d*x-u*g*m,this._w=l*d*m-u*g*x;break;case"XZY":this._x=u*d*m-l*g*x,this._y=l*g*m-u*d*x,this._z=l*d*x+u*g*m,this._w=l*d*m+u*g*x;break;default:Re("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],d=t[6],m=t[10],u=n+o+m;if(u>0){const g=.5/Math.sqrt(u+1);this._w=.25/g,this._x=(d-c)*g,this._y=(s-l)*g,this._z=(a-r)*g}else if(n>o&&n>m){const g=2*Math.sqrt(1+n-o-m);this._w=(d-c)/g,this._x=.25*g,this._y=(r+a)/g,this._z=(s+l)/g}else if(o>m){const g=2*Math.sqrt(1+o-n-m);this._w=(s-l)/g,this._x=(r+a)/g,this._y=.25*g,this._z=(c+d)/g}else{const g=2*Math.sqrt(1+m-n-o);this._w=(a-r)/g,this._x=(s+l)/g,this._y=(c+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Oe(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,d=t._w;return this._x=n*d+a*o+r*l-s*c,this._y=r*d+a*c+s*o-n*l,this._z=s*d+a*l+n*c-r*o,this._w=a*d-n*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),d=Math.sin(l);c=Math.sin(c*l)/d,t=Math.sin(t*l)/d,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const xa=class xa{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(Ga.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ga.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*n),d=2*(o*t-s*r),m=2*(s*n-a*t);return this.x=t+c*l+a*m-o*d,this.y=n+c*d+o*l-s*m,this.z=r+c*m+s*d-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,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=r*c-s*o,this.y=s*a-n*c,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fr.copy(this).projectOnVector(e),this.sub(Fr)}reflect(e){return this.sub(Fr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Oe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};xa.prototype.isVector3=!0;let U=xa;const Fr=new U,Ga=new fi,va=class va{constructor(e,t,n,r,s,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l)}set(e,t,n,r,s,a,o,c,l){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=c,d[6]=n,d[7]=a,d[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],d=n[4],m=n[7],u=n[2],g=n[5],x=n[8],S=r[0],p=r[3],f=r[6],b=r[1],A=r[4],M=r[7],R=r[2],y=r[5],w=r[8];return s[0]=a*S+o*b+c*R,s[3]=a*p+o*A+c*y,s[6]=a*f+o*M+c*w,s[1]=l*S+d*b+m*R,s[4]=l*p+d*A+m*y,s[7]=l*f+d*M+m*w,s[2]=u*S+g*b+x*R,s[5]=u*p+g*A+x*y,s[8]=u*f+g*M+x*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8];return t*a*d-t*o*l-n*s*d+n*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8],m=d*a-o*l,u=o*c-d*s,g=l*s-a*c,x=t*m+n*u+r*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=m*S,e[1]=(r*l-d*n)*S,e[2]=(o*n-r*a)*S,e[3]=u*S,e[4]=(d*t-r*c)*S,e[5]=(r*s-o*t)*S,e[6]=g*S,e[7]=(n*c-l*t)*S,e[8]=(a*t-n*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(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 si("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Or.makeScale(e,t)),this}rotate(e){return si("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Or.makeRotation(-e)),this}translate(e,t){return si("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Or.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};va.prototype.isMatrix3=!0;let Ce=va;const Or=new Ce,Va=new Ce().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ha=new Ce().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function uc(){const i={enabled:!0,workingColorSpace:vr,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ye&&(r.r=hn(r.r),r.g=hn(r.g),r.b=hn(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===Ye&&(r.r=ai(r.r),r.g=ai(r.g),r.b=ai(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===bn?Mr: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 si("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return si("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[vr]:{primaries:e,whitePoint:n,transfer:Mr,toXYZ:Va,fromXYZ:Ha,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ft},outputColorSpaceConfig:{drawingBufferColorSpace:Ft}},[Ft]:{primaries:e,whitePoint:n,transfer:Ye,toXYZ:Va,fromXYZ:Ha,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ft}}}),i}const Fe=uc();function hn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ai(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Xn;class fc{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xn===void 0&&(Xn=Er("canvas")),Xn.width=e.width,Xn.height=e.height;const r=Xn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Xn}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Er("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=hn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(hn(t[n]/255)*255):t[n]=hn(t[n]);return{data:t,width:e.width,height:e.height}}else return Re("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let hc=0;class da{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hc++}),this.uuid=Ri(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Br(r[a].image)):s.push(Br(r[a]))}else s=Br(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Br(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?fc.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Re("Texture: Unable to serialize Texture."),{})}let dc=0;const zr=new U;class Tt extends Vn{constructor(e=Tt.DEFAULT_IMAGE,t=Tt.DEFAULT_MAPPING,n=un,r=un,s=Et,a=Fn,o=kt,c=Bt,l=Tt.DEFAULT_ANISOTROPY,d=bn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dc++}),this.uuid=Ri(),this.name="",this.source=new da(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Be(0,0),this.repeat=new Be(1,1),this.center=new Be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ce,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(zr).x}get height(){return this.source.getSize(zr).y}get depth(){return this.source.getSize(zr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Re(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Re(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ho)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ss:e.x=e.x-Math.floor(e.x);break;case un:e.x=e.x<0?0:1;break;case Es: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 Ss:e.y=e.y-Math.floor(e.y);break;case un:e.y=e.y<0?0:1;break;case Es: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++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Ho;Tt.DEFAULT_ANISOTROPY=1;const Ma=class Ma{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: 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("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const c=e.elements,l=c[0],d=c[4],m=c[8],u=c[1],g=c[5],x=c[9],S=c[2],p=c[6],f=c[10];if(Math.abs(d-u)<.01&&Math.abs(m-S)<.01&&Math.abs(x-p)<.01){if(Math.abs(d+u)<.1&&Math.abs(m+S)<.1&&Math.abs(x+p)<.1&&Math.abs(l+g+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(l+1)/2,M=(g+1)/2,R=(f+1)/2,y=(d+u)/4,w=(m+S)/4,_=(x+p)/4;return A>M&&A>R?A<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(A),r=y/n,s=w/n):M>R?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=y/r,s=_/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=w/s,r=_/s),this.set(n,r,s,t),this}let b=Math.sqrt((p-x)*(p-x)+(m-S)*(m-S)+(u-d)*(u-d));return Math.abs(b)<.001&&(b=1),this.x=(p-x)/b,this.y=(m-S)/b,this.z=(u-d)/b,this.w=Math.acos((l+g+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this.w=Oe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this.w=Oe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Ma.prototype.isVector4=!0;let rt=Ma;class pc extends Vn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Et,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new rt(0,0,e,t),this.scissorTest=!1,this.viewport=new rt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new Tt(r),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Et,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new da(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class jt extends pc{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Jo extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class mc extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const br=class br{constructor(e,t,n,r,s,a,o,c,l,d,m,u,g,x,S,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l,d,m,u,g,x,S,p)}set(e,t,n,r,s,a,o,c,l,d,m,u,g,x,S,p){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=d,f[10]=m,f[14]=u,f[3]=g,f[7]=x,f[11]=S,f[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new br().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/qn.setFromMatrixColumn(e,0).length(),s=1/qn.setFromMatrixColumn(e,1).length(),a=1/qn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(r),l=Math.sin(r),d=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const u=a*d,g=a*m,x=o*d,S=o*m;t[0]=c*d,t[4]=-c*m,t[8]=l,t[1]=g+x*l,t[5]=u-S*l,t[9]=-o*c,t[2]=S-u*l,t[6]=x+g*l,t[10]=a*c}else if(e.order==="YXZ"){const u=c*d,g=c*m,x=l*d,S=l*m;t[0]=u+S*o,t[4]=x*o-g,t[8]=a*l,t[1]=a*m,t[5]=a*d,t[9]=-o,t[2]=g*o-x,t[6]=S+u*o,t[10]=a*c}else if(e.order==="ZXY"){const u=c*d,g=c*m,x=l*d,S=l*m;t[0]=u-S*o,t[4]=-a*m,t[8]=x+g*o,t[1]=g+x*o,t[5]=a*d,t[9]=S-u*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const u=a*d,g=a*m,x=o*d,S=o*m;t[0]=c*d,t[4]=x*l-g,t[8]=u*l+S,t[1]=c*m,t[5]=S*l+u,t[9]=g*l-x,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const u=a*c,g=a*l,x=o*c,S=o*l;t[0]=c*d,t[4]=S-u*m,t[8]=x*m+g,t[1]=m,t[5]=a*d,t[9]=-o*d,t[2]=-l*d,t[6]=g*m+x,t[10]=u-S*m}else if(e.order==="XZY"){const u=a*c,g=a*l,x=o*c,S=o*l;t[0]=c*d,t[4]=-m,t[8]=l*d,t[1]=u*m+S,t[5]=a*d,t[9]=g*m-x,t[2]=x*m-g,t[6]=o*d,t[10]=S*m+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gc,e,_c)}lookAt(e,t,n){const r=this.elements;
vendor: 5,184 bytes, line 5
5return Dt.subVectors(e,t),Dt.lengthSq()===0&&(Dt.z=1),Dt.normalize(),vn.crossVectors(n,Dt),vn.lengthSq()===0&&(Math.abs(n.z)===1?Dt.x+=1e-4:Dt.z+=1e-4,Dt.normalize(),vn.crossVectors(n,Dt)),vn.normalize(),Ni.crossVectors(Dt,vn),r[0]=vn.x,r[4]=Ni.x,r[8]=Dt.x,r[1]=vn.y,r[5]=Ni.y,r[9]=Dt.y,r[2]=vn.z,r[6]=Ni.z,r[10]=Dt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],d=n[1],m=n[5],u=n[9],g=n[13],x=n[2],S=n[6],p=n[10],f=n[14],b=n[3],A=n[7],M=n[11],R=n[15],y=r[0],w=r[4],_=r[8],T=r[12],C=r[1],D=r[5],F=r[9],Y=r[13],Z=r[2],G=r[6],X=r[10],H=r[14],J=r[3],j=r[7],ue=r[11],pe=r[15];return s[0]=a*y+o*C+c*Z+l*J,s[4]=a*w+o*D+c*G+l*j,s[8]=a*_+o*F+c*X+l*ue,s[12]=a*T+o*Y+c*H+l*pe,s[1]=d*y+m*C+u*Z+g*J,s[5]=d*w+m*D+u*G+g*j,s[9]=d*_+m*F+u*X+g*ue,s[13]=d*T+m*Y+u*H+g*pe,s[2]=x*y+S*C+p*Z+f*J,s[6]=x*w+S*D+p*G+f*j,s[10]=x*_+S*F+p*X+f*ue,s[14]=x*T+S*Y+p*H+f*pe,s[3]=b*y+A*C+M*Z+R*J,s[7]=b*w+A*D+M*G+R*j,s[11]=b*_+A*F+M*X+R*ue,s[15]=b*T+A*Y+M*H+R*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],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],d=e[2],m=e[6],u=e[10],g=e[14],x=e[3],S=e[7],p=e[11],f=e[15],b=c*g-l*u,A=o*g-l*m,M=o*u-c*m,R=a*g-l*d,y=a*u-c*d,w=a*m-o*d;return t*(S*b-p*A+f*M)-n*(x*b-p*R+f*y)+r*(x*A-S*R+f*w)-s*(x*M-S*y+p*w)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],c=e[2],l=e[6],d=e[10];return t*(a*d-o*l)-n*(s*d-o*c)+r*(s*l-a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8],m=e[9],u=e[10],g=e[11],x=e[12],S=e[13],p=e[14],f=e[15],b=t*o-n*a,A=t*c-r*a,M=t*l-s*a,R=n*c-r*o,y=n*l-s*o,w=r*l-s*c,_=d*S-m*x,T=d*p-u*x,C=d*f-g*x,D=m*p-u*S,F=m*f-g*S,Y=u*f-g*p,Z=b*Y-A*F+M*D+R*C-y*T+w*_;if(Z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const G=1/Z;return e[0]=(o*Y-c*F+l*D)*G,e[1]=(r*F-n*Y-s*D)*G,e[2]=(S*w-p*y+f*R)*G,e[3]=(u*y-m*w-g*R)*G,e[4]=(c*C-a*Y-l*T)*G,e[5]=(t*Y-r*C+s*T)*G,e[6]=(p*M-x*w-f*A)*G,e[7]=(d*w-u*M+g*A)*G,e[8]=(a*F-o*C+l*_)*G,e[9]=(n*C-t*F-s*_)*G,e[10]=(x*y-S*M+f*b)*G,e[11]=(m*M-d*y-g*b)*G,e[12]=(o*T-a*D-c*_)*G,e[13]=(t*D-n*T+r*_)*G,e[14]=(S*A-x*R-p*b)*G,e[15]=(d*R-m*A+u*b)*G,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,d=s*o;return this.set(l*a+n,l*o-r*c,l*c+r*o,0,l*o+r*c,d*o+n,d*c-r*a,0,l*c-r*o,d*c+r*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,d=a+a,m=o+o,u=s*l,g=s*d,x=s*m,S=a*d,p=a*m,f=o*m,b=c*l,A=c*d,M=c*m,R=n.x,y=n.y,w=n.z;return r[0]=(1-(S+f))*R,r[1]=(g+M)*R,r[2]=(x-A)*R,r[3]=0,r[4]=(g-M)*y,r[5]=(1-(u+f))*y,r[6]=(p+b)*y,r[7]=0,r[8]=(x+A)*w,r[9]=(p-b)*w,r[10]=(1-(u+S))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=qn.set(r[0],r[1],r[2]).length();const o=qn.set(r[4],r[5],r[6]).length(),c=qn.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Gt.copy(this);const l=1/a,d=1/o,m=1/c;return Gt.elements[0]*=l,Gt.elements[1]*=l,Gt.elements[2]*=l,Gt.elements[4]*=d,Gt.elements[5]*=d,Gt.elements[6]*=d,Gt.elements[8]*=m,Gt.elements[9]*=m,Gt.elements[10]*=m,t.setFromRotationMatrix(Gt),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,r,s,a,o=Jt,c=!1){const l=this.elements,d=2*s/(t-e),m=2*s/(n-r),u=(t+e)/(t-e),g=(n+r)/(n-r);let x,S;if(c)x=s/(a-s),S=a*s/(a-s);else if(o===Jt)x=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===Sr)x=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=d,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=m,l[9]=g,l[13]=0,l[2]=0,l[6]=0,l[10
vendor: 25,840 bytes, line 5
5]=x,l[14]=S,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Jt,c=!1){const l=this.elements,d=2/(t-e),m=2/(n-r),u=-(t+e)/(t-e),g=-(n+r)/(n-r);let x,S;if(c)x=1/(a-s),S=a/(a-s);else if(o===Jt)x=-2/(a-s),S=-(a+s)/(a-s);else if(o===Sr)x=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=d,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=m,l[9]=0,l[13]=g,l[2]=0,l[6]=0,l[10]=x,l[14]=S,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};br.prototype.isMatrix4=!0;let st=br;const qn=new U,Gt=new st,gc=new U(0,0,0),_c=new U(1,1,1),vn=new U,Ni=new U,Dt=new U,ka=new st,Wa=new fi;class Gn{constructor(e=0,t=0,n=0,r=Gn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],c=r[1],l=r[5],d=r[9],m=r[2],u=r[6],g=r[10];switch(t){case"XYZ":this._y=Math.asin(Oe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Oe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Oe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-m,g),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Oe(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(u,g),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Oe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,l),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-Oe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:Re("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ka.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ka,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Wa.setFromEuler(this),this.setFromQuaternion(Wa,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}}Gn.DEFAULT_ORDER="XYZ";class Qo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let xc=0;const Xa=new U,Yn=new fi,rn=new st,Fi=new U,mi=new U,vc=new U,Mc=new fi,qa=new U(1,0,0),Ya=new U(0,1,0),Ka=new U(0,0,1),Za={type:"added"},Sc={type:"removed"},Kn={type:"childadded",child:null},Gr={type:"childremoved",child:null};class bt extends Vn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xc++}),this.uuid=Ri(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DEFAULT_UP.clone();const e=new U,t=new Gn,n=new fi,r=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new st},normalMatrix:{value:new Ce}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Qo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Yn.setFromAxisAngle(e,t),this.quaternion.multiply(Yn),this}rotateOnWorldAxis(e,t){return Yn.setFromAxisAngle(e,t),this.quaternion.premultiply(Yn),this}rotateX(e){return this.rotateOnAxis(qa,e)}rotateY(e){return this.rotateOnAxis(Ya,e)}rotateZ(e){return this.rotateOnAxis(Ka,e)}translateOnAxis(e,t){return Xa.copy(e).applyQuaternion(this.quaternion),this.position.add(Xa.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(qa,e)}translateY(e){return this.translateOnAxis(Ya,e)}translateZ(e){return this.translateOnAxis(Ka,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,n){e.isVector3?Fi.copy(e):Fi.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(mi,Fi,this.up):rn.lookAt(Fi,mi,this.up),this.quaternion.setFromRotationMatrix(rn),r&&(rn.extractRotation(r.matrixWorld),Yn.setFromRotationMatrix(rn),this.quaternion.premultiply(Yn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ve("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(Za),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):Ve("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Sc),Gr.child=e,this.dispatchEvent(Gr),Gr.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(Za),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,e,vc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,Mc,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,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,d=c.length;l<d;l++){const m=c[l];s(e.shapes,m)}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),d=a(e.images),m=a(e.shapes),u=a(e.skeletons),g=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),d.length>0&&(n.images=d),m.length>0&&(n.shapes=m),u.length>0&&(n.skeletons=u),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=r,n;function a(o){const c=[];for(const l in o){const d=o[l];delete d.metadata,c.push(d)}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.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}bt.DEFAULT_UP=new U(0,1,0);bt.DEFAULT_MATRIX_AUTO_UPDATE=!0;bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class yi extends bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ec={type:"move"};class Vr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new yi,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 yi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new yi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const S of e.hand.values()){const p=t.getJointPose(S,n),f=this._getHandJoint(l,S);p!==null&&(f.matrix.fromArray(p.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=p.radius),f.visible=p!==null}const d=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],u=d.position.distanceTo(m.position),g=.02,x=.005;l.inputState.pinching&&u>g+x?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=g-x&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),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,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ec)))}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 n=new yi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const jo={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},Oi={h:0,s:0,l:0};function Hr(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class He{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Fe.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Fe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Fe.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Fe.workingColorSpace){if(e=cc(e,1),t=Oe(t,0,1),n=Oe(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Hr(a,s,e+1/3),this.g=Hr(a,s,e),this.b=Hr(a,s,e-1/3)}return Fe.colorSpaceToWorking(this,r),this}setStyle(e,t=Ft){function n(s){s!==void 0&&parseFloat(s)<1&&Re("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Re("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);Re("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ft){const n=jo[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Re("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=hn(e.r),this.g=hn(e.g),this.b=hn(e.b),this}copyLinearToSRGB(e){return this.r=ai(e.r),this.g=ai(e.g),this.b=ai(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ft){return Fe.workingToColorSpace(St.copy(this),e),Math.round(Oe(St.r*255,0,255))*65536+Math.round(Oe(St.g*255,0,255))*256+Math.round(Oe(St.b*255,0,255))}getHexString(e=Ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Fe.workingColorSpace){Fe.workingToColorSpace(St.copy(this),t);const n=St.r,r=St.g,s=St.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let c,l;const d=(o+a)/2;if(o===a)c=0,l=0;else{const m=a-o;switch(l=d<=.5?m/(a+o):m/(2-a-o),a){case n:c=(r-s)/m+(r<s?6:0);break;case r:c=(s-n)/m+2;break;case s:c=(n-r)/m+4;break}c/=6}return e.h=c,e.s=l,e.l=d,e}getRGB(e,t=Fe.workingColorSpace){return Fe.workingToColorSpace(St.copy(this),t),e.r=St.r,e.g=St.g,e.b=St.b,e}getStyle(e=Ft){Fe.workingToColorSpace(St.copy(this),e);const t=St.r,n=St.g,r=St.b;return e!==Ft?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Mn),this.setHSL(Mn.h+e,Mn.s+t,Mn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 4,456 bytes, line 5
5lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Mn),e.getHSL(Oi);const n=Nr(Mn.h,Oi.h,t),r=Nr(Mn.s,Oi.s,t),s=Nr(Mn.l,Oi.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const St=new He;He.NAMES=jo;class yc extends bt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Gn,this.environmentIntensity=1,this.environmentRotation=new Gn,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 Vt=new U,sn=new U,kr=new U,an=new U,Zn=new U,$n=new U,$a=new U,Wr=new U,Xr=new U,qr=new U,Yr=new rt,Kr=new rt,Zr=new rt;class zt{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),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,n,r,s){Vt.subVectors(r,t),sn.subVectors(n,t),kr.subVectors(e,t);const a=Vt.dot(Vt),o=Vt.dot(sn),c=Vt.dot(kr),l=sn.dot(sn),d=sn.dot(kr),m=a*l-o*o;if(m===0)return s.set(0,0,0),null;const u=1/m,g=(l*c-o*d)*u,x=(a*d-o*c)*u;return s.set(1-g-x,x,g)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,an)===null?!1:an.x>=0&&an.y>=0&&an.x+an.y<=1}static getInterpolation(e,t,n,r,s,a,o,c){return this.getBarycoord(e,t,n,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,n,r,s,a){return Yr.setScalar(0),Kr.setScalar(0),Zr.setScalar(0),Yr.fromBufferAttribute(e,t),Kr.fromBufferAttribute(e,n),Zr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Yr,s.x),a.addScaledVector(Kr,s.y),a.addScaledVector(Zr,s.z),a}static isFrontFacing(e,t,n,r){return Vt.subVectors(n,t),sn.subVectors(e,t),Vt.cross(sn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return 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 zt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return zt.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 24,586 bytes, line 5
5getInterpolation(e,t,n,r,s){return zt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return zt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return zt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zn.subVectors(r,n),$n.subVectors(s,n),Wr.subVectors(e,n);const c=Zn.dot(Wr),l=$n.dot(Wr);if(c<=0&&l<=0)return t.copy(n);Xr.subVectors(e,r);const d=Zn.dot(Xr),m=$n.dot(Xr);if(d>=0&&m<=d)return t.copy(r);const u=c*m-d*l;if(u<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(n).addScaledVector(Zn,a);qr.subVectors(e,s);const g=Zn.dot(qr),x=$n.dot(qr);if(x>=0&&g<=x)return t.copy(s);const S=g*l-c*x;if(S<=0&&l>=0&&x<=0)return o=l/(l-x),t.copy(n).addScaledVector($n,o);const p=d*x-g*m;if(p<=0&&m-d>=0&&g-x>=0)return $a.subVectors(s,r),o=(m-d)/(m-d+(g-x)),t.copy(r).addScaledVector($a,o);const f=1/(p+S+u);return a=S*f,o=u*f,t.copy(n).addScaledVector(Zn,a).addScaledVector($n,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class wi{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Ht.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ht.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ht.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ht):Ht.fromBufferAttribute(s,a),Ht.applyMatrix4(e.matrixWorld),this.expandByPoint(Ht);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Bi.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Bi.copy(n.boundingBox)),Bi.applyMatrix4(e.matrixWorld),this.union(Bi)}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,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(gi),zi.subVectors(this.max,gi),Jn.subVectors(e.a,gi),Qn.subVectors(e.b,gi),jn.subVectors(e.c,gi),Sn.subVectors(Qn,Jn),En.subVectors(jn,Qn),Cn.subVectors(Jn,jn);let t=[0,-Sn.z,Sn.y,0,-En.z,En.y,0,-Cn.z,Cn.y,Sn.z,0,-Sn.x,En.z,0,-En.x,Cn.z,0,-Cn.x,-Sn.y,Sn.x,0,-En.y,En.x,0,-Cn.y,Cn.x,0];return!$r(t,Jn,Qn,jn,zi)||(t=[1,0,0,0,1,0,0,0,1],!$r(t,Jn,Qn,jn,zi))?!1:(Gi.crossVectors(Sn,En),t=[Gi.x,Gi.y,Gi.z],$r(t,Jn,Qn,jn,zi))}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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const on=[new U,new U,new U,new U,new U,new U,new U,new U],Ht=new U,Bi=new wi,Jn=new U,Qn=new U,jn=new U,Sn=new U,En=new U,Cn=new U,gi=new U,zi=new U,Gi=new U,Pn=new U;function $r(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Pn.fromArray(i,s);const o=r.x*Math.abs(Pn.x)+r.y*Math.abs(Pn.y)+r.z*Math.abs(Pn.z),c=e.dot(Pn),l=t.dot(Pn),d=n.dot(Pn);if(Math.max(-Math.max(c,l,d),Math.min(c,l,d))>o)return!1}return!0}const ft=new U,Vi=new Be;let Tc=0;class en extends Vn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Tc++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Fa,this.updateRanges=[],this.gpuType=$t,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Vi.fromBufferAttribute(this,t),Vi.applyMatrix3(e),this.setXY(t,Vi.x,Vi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ft.fromBufferAttribute(this,t),ft.applyMatrix3(e),this.setXYZ(t,ft.x,ft.y,ft.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;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,n=this.count;t<n;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,n=this.count;t<n;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 n=this.array[e*this.itemSize+t];return this.normalized&&(n=pi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=wt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=pi(t,this.array)),t}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=pi(t,this.array)),t}setY(e,t){return this.normalized&&(t=wt(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=pi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=wt(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=pi(t,this.array)),t}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),r=wt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),r=wt(r,this.array),s=wt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Fa&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class el extends en{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class tl extends en{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class At extends en{constructor(e,t,n){super(new Float32Array(e),t,n)}}const bc=new wi,_i=new U,Jr=new U;class Ci{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):bc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_i.subVectors(e,this.center);const t=_i.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(_i,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Jr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_i.copy(e.center).add(Jr)),this.expandByPoint(_i.copy(e.center).sub(Jr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let Ac=0;const Nt=new st,Qr=new bt,ei=new U,Lt=new wi,xi=new wi,gt=new U;class It extends Vn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ac++}),this.uuid=Ri(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(sc(e)?tl:el)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ce().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,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,n){return Nt.makeTranslation(e,t,n),this.applyMatrix4(Nt),this}scale(e,t,n){return Nt.makeScale(e,t,n),this.applyMatrix4(Nt),this}lookAt(e){return Qr.lookAt(e),Qr.updateMatrix(),this.applyMatrix4(Qr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ei).negate(),this.translate(ei.x,ei.y,ei.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new At(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Re("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 wi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ve("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Lt.setFromBufferAttribute(s),this.morphTargetsRelative?(gt.addVectors(this.boundingBox.min,Lt.min),this.boundingBox.expandByPoint(gt),gt.addVectors(this.boundingBox.max,Lt.max),this.boundingBox.expandByPoint(gt)):(this.boundingBox.expandByPoint(Lt.min),this.boundingBox.expandByPoint(Lt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ve('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 Ci);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ve("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(Lt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];xi.setFromBufferAttribute(o),this.morphTargetsRelative?(gt.addVectors(Lt.min,xi.min),Lt.expandByPoint(gt),gt.addVectors(Lt.max,xi.max),Lt.expandByPoint(gt)):(Lt.expandByPoint(xi.min),Lt.expandByPoint(xi.max))}Lt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)gt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(gt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,d=o.count;l<d;l++)gt.fromBufferAttribute(o,l),c&&(ei.fromBufferAttribute(e,l),gt.add(ei)),r=Math.max(r,n.distanceToSquared(gt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ve('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){Ve("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new en(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new U,c[_]=new U;const l=new U,d=new U,m=new U,u=new Be,g=new Be,x=new Be,S=new U,p=new U;function f(_,T,C){l.fromBufferAttribute(n,_),d.fromBufferAttribute(n,T),m.fromBufferAttribute(n,C),u.fromBufferAttribute(s,_),g.fromBufferAttribute(s,T),x.fromBufferAttribute(s,C),d.sub(l),m.sub(l),g.sub(u),x.sub(u);const D=1/(g.x*x.y-x.x*g.y);isFinite(D)&&(S.copy(d).multiplyScalar(x.y).addScaledVector(m,-g.y).multiplyScalar(D),p.copy(m).multiplyScalar(g.x).addScaledVector(d,-x.x).multiplyScalar(D),o[_].add(S),o[T].add(S),o[C].add(S),c[_].add(p),c[T].add(p),c[C].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let _=0,T=b.length;_<T;++_){const C=b[_],D=C.start,F=C.count;for(let Y=D,Z=D+F;Y<Z;Y+=3)f(e.getX(Y+0),e.getX(Y+1),e.getX(Y+2))}const A=new U,M=new U,R=new U,y=new U;function w(_){R.fromBufferAttribute(r,_),y.copy(R);const T=o[_];A.copy(T),A.sub(R.multiplyScalar(R.dot(T))).normalize(),M.crossVectors(y,T);const D=M.dot(c[_])<0?-1:1;a.setXYZW(_,A.x,A.y,A.z,D)}for(let _=0,T=b.length;_<T;++_){const C=b[_],D=C.start,F=C.count;for(let Y=D,Z=D+F;Y<Z;Y+=3)w(e.getX(Y+0)),w(e.getX(Y+1)),w(e.getX(Y+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new en(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,g=n.count;u<g;u++)n.setXYZ(u,0,0,0);const r=new U,s=new U,a=new U,o=new U,c=new U,l=new U,d=new U,m=new U;if(e)for(let u=0,g=e.count;u<g;u+=3){const x=e.getX(u+0),S=e.getX(u+1),p=e.getX(u+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,p),d.subVectors(a,s),m.subVectors(r,s),d.cross(m),o.fromBufferAttribute(n,x),c.fromBufferAttribute(n,S),l.fromBufferAttribute(n,p),o.add(d),c.add(d),l.add(d),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(S,c.x,c.y,c.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let u=0,g=t.count;u<g;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),d.subVectors(a,s),m.subVectors(r,s),d.cross(m),n.setXYZ(u+0,d.x,d.y,d.z),n.setXYZ(u+1,d.x,d.y,d.z),n.setXYZ(u+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)gt.fromBufferAttribute(e,t),gt.normalize(),e.setXYZ(t,gt.x,gt.y,gt.z)}toNonIndexed(){function e(o,c){const l=o.array,d=o.itemSize,m=o.normalized,u=new l.constructor(c.length*d);let g=0,x=0;for(let S=0,p=c.length;S<p;S++){o.isInterleavedBufferAttribute?g=c[S]*o.data.stride+o.offset:g=c[S]*d;for(let f=0;f<d;f++)u[x++]=l[g++]}return new en(u,d,m)}if(this.index===null)return Re("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new It,n=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let d=0,m=l.length;d<m;d++){const u=l[d],g=e(u,n);c.push(g)}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"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!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 n=this.attributes;for(const c in n){const l=n[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],d=[];for(let m=0,u=l.length;m<u;m++){const g=l[m];d.push(g.toJSON(e.data))}d.length>0&&(r[c]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const l in r){const d=r[l];this.setAttribute(l,d.clone(t))}const s=e.morphAttributes;for(const l in s){const d=[],m=s[l];for(let u=0,g=m.length;u<g;u++)d.push(m[u].clone(t));this.morphAttributes[l]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,d=a.length;l<d;l++){const m=a[l];this.addGroup(m.start,m.count,m.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._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let Rc=0;class hi extends Vn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Rc++}),this.uuid=Ri(),this.name="",this.type="Material",this.blending=ri,this.side=Rn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=hs,this.blendDst=ds,this.blendEquation=Un,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new He(0,0,0),this.blendAlpha=0,this.depthFunc=oi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Na,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Wn,this.stencilZFail=Wn,this.stencilZPass=Wn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Re(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Re(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 16,661 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ri&&(n.blending=this.blending),this.side!==Rn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==hs&&(n.blendSrc=this.blendSrc),this.blendDst!==ds&&(n.blendDst=this.blendDst),this.blendEquation!==Un&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==oi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Na&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Wn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Wn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Wn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const 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&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new He().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Be().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Be().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 20,528 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const ln=new U,jr=new U,Hi=new U,yn=new U,es=new U,ki=new U,ts=new U;class pa{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){jr.copy(e).add(t).multiplyScalar(.5),Hi.copy(t).sub(e).normalize(),yn.copy(this.origin).sub(jr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Hi),o=yn.dot(this.direction),c=-yn.dot(Hi),l=yn.lengthSq(),d=Math.abs(1-a*a);let m,u,g,x;if(d>0)if(m=a*c-o,u=a*o-c,x=s*d,m>=0)if(u>=-x)if(u<=x){const S=1/d;m*=S,u*=S,g=m*(m+a*u+2*o)+u*(a*m+u+2*c)+l}else u=s,m=Math.max(0,-(a*u+o)),g=-m*m+u*(u+2*c)+l;else u=-s,m=Math.max(0,-(a*u+o)),g=-m*m+u*(u+2*c)+l;else u<=-x?(m=Math.max(0,-(-a*s+o)),u=m>0?-s:Math.min(Math.max(-s,-c),s),g=-m*m+u*(u+2*c)+l):u<=x?(m=0,u=Math.min(Math.max(-s,-c),s),g=u*(u+2*c)+l):(m=Math.max(0,-(a*s+o)),u=m>0?s:Math.min(Math.max(-s,-c),s),g=-m*m+u*(u+2*c)+l);else u=a>0?-s:s,m=Math.max(0,-(a*u+o)),g=-m*m+u*(u+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,m),r&&r.copy(jr).addScaledVector(Hi,u),g}intersectSphere(e,t){ln.subVectors(e.center,this.origin);const n=ln.dot(this.direction),r=ln.dot(ln)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,c=n+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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,c;const l=1/this.direction.x,d=1/this.direction.y,m=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),d>=0?(s=(e.min.y-u.y)*d,a=(e.max.y-u.y)*d):(s=(e.max.y-u.y)*d,a=(e.min.y-u.y)*d),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),m>=0?(o=(e.min.z-u.z)*m,c=(e.max.z-u.z)*m):(o=(e.max.z-u.z)*m,c=(e.min.z-u.z)*m),n>c||o>r)||((o>n||n!==n)&&(n=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,n,r,s){es.subVectors(t,e),ki.subVectors(n,e),ts.crossVectors(es,ki);let a=this.direction.dot(ts),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;yn.subVectors(this.origin,e);const c=o*this.direction.dot(ki.crossVectors(yn,ki));if(c<0)return null;const l=o*this.direction.dot(es.cross(yn));if(l<0||c+l>a)return null;const d=-o*yn.dot(ts);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class nl extends hi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new He(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 Gn,this.combine=No,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 Ja=new st,Dn=new pa,Wi=new Ci,Qa=new U,Xi=new U,qi=new U,Yi=new U,ns=new U,Ki=new U,ja=new U,Zi=new U;class mn extends bt{constructor(e=new It,t=new nl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ki.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const d=o[c],m=s[c];d!==0&&(ns.fromBufferAttribute(m,e),a?Ki.addScaledVector(ns,d):Ki.addScaledVector(ns.sub(t),d))}t.add(Ki)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Wi.copy(n.boundingSphere),Wi.applyMatrix4(s),Dn.copy(e.ray).recast(e.near),!(Wi.containsPoint(Dn.origin)===!1&&(Dn.intersectSphere(Wi,Qa)===null||Dn.origin.distanceToSquared(Qa)>(e.far-e.near)**2))&&(Ja.copy(s).invert(),Dn.copy(e.ray).applyMatrix4(Ja),!(n.boundingBox!==null&&Dn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Dn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,d=s.attributes.uv1,m=s.attributes.normal,u=s.groups,g=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const p=u[x],f=a[p.materialIndex],b=Math.max(p.start,g.start),A=Math.min(o.count,Math.min(p.start+p.count,g.start+g.count));for(let M=b,R=A;M<R;M+=3){const y=o.getX(M),w=o.getX(M+1),_=o.getX(M+2);r=$i(this,f,e,n,l,d,m,y,w,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const x=Math.max(0,g.start),S=Math.min(o.count,g.start+g.count);for(let p=x,f=S;p<f;p+=3){const b=o.getX(p),A=o.getX(p+1),M=o.getX(p+2);r=$i(this,a,e,n,l,d,m,b,A,M),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const p=u[x],f=a[p.materialIndex],b=Math.max(p.start,g.start),A=Math.min(c.count,Math.min(p.start+p.count,g.start+g.count));for(let M=b,R=A;M<R;M+=3){const y=M,w=M+1,_=M+2;r=$i(this,f,e,n,l,d,m,y,w,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const x=Math.max(0,g.start),S=Math.min(c.count,g.start+g.count);for(let p=x,f=S;p<f;p+=3){const b=p,A=p+1,M=p+2;r=$i(this,a,e,n,l,d,m,b,A,M),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}}}function wc(i,e,t,n,r,s,a,o){let c;if(e.side===Ct?c=n.intersectTriangle(a,s,r,!0,o):c=n.intersectTriangle(r,s,a,e.side===Rn,o),c===null)return null;Zi.copy(o),Zi.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(Zi);return l<t.near||l>t.far?null:{distance:l,point:Zi.clone(),object:i}}function $i(i,e,t,n,r,s,a,o,c,l){i.getVertexPosition(o,Xi),i.getVertexPosition(c,qi),i.getVertexPosition(l,Yi);const d=wc(i,e,t,n,Xi,qi,Yi,ja);if(d){const m=new U;zt.getBarycoord(ja,Xi,qi,Yi,m),r&&(d.uv=zt.getInterpolatedAttribute(r,o,c,l,m,new Be)),s&&(d.uv1=zt.getInterpolatedAttribute(s,o,c,l,m,new Be)),a&&(d.normal=zt.getInterpolatedAttribute(a,o,c,l,m,new U),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const u={a:o,b:c,c:l,normal:new U,materialIndex:0};zt.getNormal(Xi,qi,Yi,u.normal),d.face=u,d.barycoord=m}return d}class Cc extends Tt{constructor(e=null,t=1,n=1,r,s,a,o,c,l=xt,d=xt,m,u){super(null,a,o,c,l,d,r,s,m,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const is=new U,Pc=new U,Dc=new Ce;class In{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=is.subVectors(n,t).cross(Pc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const r=e.delta(is),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Dc.getNormalMatrix(e),r=this.coplanarPoint(is).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ln=new Ci,Lc=new Be(.5,.5),Ji=new U;class il{constructor(e=new In,t=new In,n=new In,r=new In,s=new In,a=new In){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Jt,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],d=s[4],m=s[5],u=s[6],g=s[7],x=s[8],S=s[9],p=s[10],f=s[11],b=s[12],A=s[13],M=s[14],R=s[15];if(r[0].setComponents(l-a,g-d,f-x,R-b).normalize(),r[1].setComponents(l+a,g+d,f+x,R+b).normalize(),r[2].setComponents(l+o,g+m,f+S,R+A).normalize(),r[3].setComponents(l-o,g-m,f-S,R-A).normalize(),n)r[4].setComponents(c,u,p,M).normalize(),r[5].setComponents(l-c,g-u,f-p,R-M).normalize();else if(r[4].setComponents(l-c,g-u,f-p,R-M).normalize(),t===Jt)r[5].setComponents(l+c,g+u,f+p,R+M).normalize();else if(t===Sr)r[5].setComponents(c,u,p,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ln.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ln)}intersectsSprite(e){Ln.center.set(0,0,0);const t=Lc.distanceTo(e.center);return Ln.radius=.7071067811865476+t,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Ji.x=r.normal.x>0?e.max.x:e.min.x,Ji.y=r.normal.y>0?e.max.y:e.min.y,Ji.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ji)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class rl extends hi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new He(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const yr=new U,Tr=new U,eo=new st,vi=new pa,Qi=new Ci,rs=new U,to=new U;class Ic extends bt{constructor(e=new It,t=new rl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)yr.fromBufferAttribute(t,r-1),Tr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=yr.distanceTo(Tr);e.setAttribute("lineDistance",new At(n,1))}else Re("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Qi.copy(n.boundingSphere),Qi.applyMatrix4(r),Qi.radius+=s,e.ray.intersectsSphere(Qi)===!1)return;eo.copy(r).invert(),vi.copy(e.ray).applyMatrix4(eo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,d=n.index,u=n.attributes.position;if(d!==null){const g=Math.max(0,a.start),x=Math.min(d.count,a.start+a.count);for(let S=g,p=x-1;S<p;S+=l){const f=d.getX(S),b=d.getX(S+1),A=ji(this,e,vi,c,f,b,S);A&&t.push(A)}if(this.isLineLoop){const S=d.getX(x-1),p=d.getX(g),f=ji(this,e,vi,c,S,p,x-1);f&&t.push(f)}}else{const g=Math.max(0,a.start),x=Math.min(u.count,a.start+a.count);for(let S=g,p=x-1;S<p;S+=l){const f=ji(this,e,vi,c,S,S+1,S);f&&t.push(f)}if(this.isLineLoop){const S=ji(this,e,vi,c,x-1,g,x-1);S&&t.push(S)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function ji(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(yr.fromBufferAttribute(o,r),Tr.fromBufferAttribute(o,s),t.distanceSqToSegment(yr,Tr,rs,to)>n)return;rs.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(rs);if(!(l<e.near||l>e.far))return{distance:l,point:to.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const no=new U,io=new U;class Uc extends Ic{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)no.fromBufferAttribute(t,r),io.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+no.distanceTo(io);e.setAttribute("lineDistance",new At(n,1))}else Re("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class sl extends hi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new He(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const ro=new st,ea=new pa,er=new Ci,tr=new U;class Nc extends bt{constructor(e=new It,t=new sl){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),er.copy(n.boundingSphere),er.applyMatrix4(r),er.radius+=s,e.ray.intersectsSphere(er)===!1)return;ro.copy(r).invert(),ea.copy(e.ray).applyMatrix4(ro);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,m=n.attributes.position;if(l!==null){const u=Math.max(0,a.start),g=Math.min(l.count,a.start+a.count);for(let x=u,S=g;x<S;x++){const p=l.getX(x);tr.fromBufferAttribute(m,p),so(tr,p,c,r,e,t,this)}}else{const u=Math.max(0,a.start),g=Math.min(m.count,a.start+a.count);for(let x=u,S=g;x<S;x++)tr.fromBufferAttribute(m,x),so(tr,x,c,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function so(i,e,t,n,r,s,a){const o=ea.distanceSqToPoint(i);if(o<t){const c=new U;ea.closestPointToPoint(i,c),c.applyMatrix4(n);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class al extends Tt{constructor(e=[],t=Bn,n,r,s,a,o,c,l,d){super(e,t,n,r,s,a,o,c,l,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ci extends Tt{constructor(e,t,n=tn,r,s,a,o=xt,c=xt,l,d=pn,m=1){if(d!==pn&&d!==On)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:m};super(u,r,s,a,o,c,d,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new da(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 Fc extends ci{constructor(e,t=tn,n=Bn,r,s,a=xt,o=xt,c,l=pn){const d={width:e,height:e,depth:1},m=[d,d,d,d,d,d];super(e,e,t,n,r,s,a,o,c,l),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ol extends Tt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Pi extends It{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],d=[],m=[];let u=0,g=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1
vendor: 4,812 bytes, line 5
5),x("x","z","y",1,1,e,n,t,r,a,2),x("x","z","y",1,-1,e,n,-t,r,a,3),x("x","y","z",1,-1,e,t,n,r,s,4),x("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new At(l,3)),this.setAttribute("normal",new At(d,3)),this.setAttribute("uv",new At(m,2));function x(S,p,f,b,A,M,R,y,w,_,T){const C=M/w,D=R/_,F=M/2,Y=R/2,Z=y/2,G=w+1,X=_+1;let H=0,J=0;const j=new U;for(let ue=0;ue<X;ue++){const pe=ue*D-Y;for(let _e=0;_e<G;_e++){const ke=_e*C-F;j[S]=ke*b,j[p]=pe*A,j[f]=Z,l.push(j.x,j.y,j.z),j[S]=0,j[p]=0,j[f]=y>0?1:-1,d.push(j.x,j.y,j.z),m.push(_e/w),m.push(1-ue/_),H+=1}}for(let ue=0;ue<_;ue++)for(let pe=0;pe<w;pe++){const _e=u+pe+G*ue,ke=u+pe+G*(ue+1),et=u+(pe+1)+G*(ue+1),We=u+(pe+1)+G*ue;c.push(_e,ke,We),c.push(ke,et,We),J+=6}o.addGroup(g,J,T),g+=J,u+=H}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class ma extends It{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const s=[],a=[];o(r),l(n),d(),this.setAttribute("position",new At(s,3)),this.setAttribute("normal",new At(s.slice(),3)),this.setAttribute("uv",new At(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(b){const A=new U,M=new U,R=new U;for(let y=0;y<t.length;y+=3)g(t[y+0],A),g(t[y+1],M),g(t[y+2],R),c(A,M,R,b)}function c(b,A,M,R){const y=R+1,w=[];for(let _=0;_<=y;_++){w[_]=[];const T=b.clone().lerp(M,_/y),C=A.clone().lerp(M,_/y),D=y-_;for(let F=0;F<=D;F++)F===0&&_===y?w[_][F]=T:w[_][F]=T.clone().lerp(C,F/D)}for(let _=0;_<y;_++)for(let T=0;T<2*(y-_)-1;T++){const C=Math.floor(T/2);T%2===0?(u(w[_][C+1]),u(w[_+1][C]),u(w[_][C])):(u(w[_][C+1]),u(w[_+1][C+1]),u(w[_+1][C]))}}function l(b){const A=new U;for(let M=0;M<s.length;M+=3)A.x=s[M+0],A.y=s[M+1],A.z=s[M+2],A.normalize().multiplyScalar(b),s[M+0]=A.x,s[M+1]=A.y,s[M+2]=A.z}function d(){const b=new U;for(let A=0;A<s.length;A+=3){b.x=s[A+0],b.y=s[A+1],b.z=s[A+2];const M=p(b)/2/Math.PI+.5,R=f(b)/Math.PI+.5;a.push(M,1-R)}x(),m()}function m(){for(let b=0;b<a.length;b+=6){const A=a[b+0],M=a[b+2],R=a[b+4],y=Math.max(A,M,R),w=Math.min(A,M,R);y>.9&&w<.1&&(A<.2&&(a[b+0]+=1),M<.2&&(a[b+2]+=1),R<.2&&(a[b+4]+=1))}}function u(b){s.push(b.x,b.y,b.z)}function g(b,A){const M=b*3;A.x=e[M+0],A.y=e[M+1],A.z=e[M+2]}function x(){const b=new U,A=new U,M=new U,R=new U,y=new Be,w=new Be,_=new Be;for(let T=0,C=0;T<s.length;T+=9,C+=6){b.set(s[T+0],s[T+1],s[T+2]),A.set(s[T+3],s[T+4],s[T+5]),M.set(s[T+6],s[T+7],s[T+8]),y.set(a[C+0],a[C+1]),w.set(a[C+2],a[C+3]),_.set(a[C+4],a[C+5]),R.copy(b).add(A).add(M).divideScalar(3);const D=p(R);S(y,C+0,b,D),S(w,C+2,A,D),S(_,C+4,M,D)}}function S(b,A,M,R){R<0&&b.x===1&&(a[A]=b.x-1),M.x===0&&M.z===0&&(a[A]=R/2/Math.PI+.5)}function p(b){return Math.atan2(b.z,-b.x)}function f(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ma(e.vertices,e.indices,e.radius,e.detail)}}const nr=new U,ir=new U,ss=new U,rr=new zt;class Oc extends It{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(pr*t),a=e.getIndex(),o=e.getAttribute("position"),c=a?a.count:o.count,l=[0,0,0],d=["a","b","c"],m=new Array(3),u={},g=[];for(let x=0;x<c;x+=3){a?(l[0]=a.getX(x),l[1]=a.getX(x+1),l[2]=a.getX(x+2)):(l[0]=x,l[1]=x+1,l[2]=x+2);const{a:S,b:p,c:f}=rr;if(S.fromBufferAttribute(o,l[0]),p.fromBufferAttribute(o,l[1]),f.fromBufferAttribute(o,l[2]),rr.getNormal(ss),m[0]=`${Math.round(S.x*r)},${Math.round(S.y*r)},${Math.round(S.z*r)}`,m[1]=`${Math.round(p.x*r)},${Math.round(p.y*r)},${Math.round(p.z*r)}`,m[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(m[0]===m[1]||m[1]===m[2]||m[2]===m[0]))for(let b=0;b<3;b++){const A=(b+1)%3,M=m[b],R=m[A],y=rr[d[b]],w=rr[d[A]],_=`${M}_${R}`,T=`${R}_${M}`;T in u&&u[T]?(ss.dot(u[T].normal)<=s&&(g.push(y.x,y.y,y.z),g.push(w.x,w.y,w.z)),u[T]=null):_ in u||(u[_]={index0:l[b],index1:l[A],normal:ss.clone()})}}for(const x in u)if(u[x]){const{index0:S,index1:p}=u[x];nr.fromBufferAttribute(o,S),ir.fromBufferAttribute(o,p),g.push(nr.x,nr.y,nr.z),g.push(ir.x,ir.y,ir.z)}this.setAttribute("position",new At(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class ga extends ma{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radiu
vendor: 4,473 bytes, lines 5-9
5s:e,detail:t}}static fromJSON(e){return new ga(e.radius,e.detail)}}class Rr extends It{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),c=Math.floor(r),l=o+1,d=c+1,m=e/o,u=t/c,g=[],x=[],S=[],p=[];for(let f=0;f<d;f++){const b=f*u-a;for(let A=0;A<l;A++){const M=A*m-s;x.push(M,-b,0),S.push(0,0,1),p.push(A/o),p.push(1-f/c)}}for(let f=0;f<c;f++)for(let b=0;b<o;b++){const A=b+l*f,M=b+l*(f+1),R=b+1+l*(f+1),y=b+1+l*f;g.push(A,M,y),g.push(M,R,y)}this.setIndex(g),this.setAttribute("position",new At(x,3)),this.setAttribute("normal",new At(S,3)),this.setAttribute("uv",new At(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rr(e.width,e.height,e.widthSegments,e.heightSegments)}}function ui(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(ao(r))r.isRenderTargetTexture?(Re("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(ao(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function yt(i){const e={};for(let t=0;t<i.length;t++){const n=ui(i[t]);for(const r in n)e[r]=n[r]}return e}function ao(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Bc(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function ll(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Fe.workingColorSpace}const zc={clone:ui,merge:yt};var Gc=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,Vc=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class nn extends hi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Gc,this.fragmentShader=Vc,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=ui(e.uniforms),this.uniformsGroups=Bc(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new He().setHex(r.value);break;case"v2":this.uniforms[n].value=new Be().fromArray(r.value);break;case"v3":this.uniforms[n].value=new U().fromArray(r.value);break;case"v4":this.uniforms[n].value=new rt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Ce().fromArray(r.value);break;
vendor: 5,378 bytes, line 9
9case"m4":this.uniforms[n].value=new st().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Hc extends nn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class kc extends hi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Jl,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 Wc extends hi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const sr=new U,ar=new fi,Yt=new U;class cl extends bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new st,this.projectionMatrix=new st,this.projectionMatrixInverse=new st,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.matrixWorld.decompose(sr,ar,Yt),Yt.x===1&&Yt.y===1&&Yt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sr,ar,Yt.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(sr,ar,Yt),Yt.x===1&&Yt.y===1&&Yt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sr,ar,Yt.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Tn=new U,oo=new Be,lo=new Be;class Ot extends cl{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=js*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(pr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return js*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,n){Tn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z),Tn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z)}getViewSize(e,t){return this.getViewBounds(e,oo,lo),t.subVectors(lo,oo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(pr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*n/l,r*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class ul extends cl{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
9phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=d*this.view.offsetY,c=o-d*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}}const ti=-90,ni=1;class Xc extends bt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ot(ti,ni,e,t);r.layers=this.layers,this.add(r);const s=new Ot(ti,ni,e,t);s.layers=this.layers,this.add(s);const a=new Ot(ti,ni,e,t);a.layers=this.layers,this.add(a);const o=new Ot(ti,ni,e,t);o.layers=this.layers,this.add(o);const c=new Ot(ti,ni,e,t);c.layers=this.layers,this.add(c);const l=new Ot(ti,ni,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===Jt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Sr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),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:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,d]=this.children,m=e.getRenderTarget(),u=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let p=!1;e.isWebGLRenderer===!0?p=e.state.buffers.depth.getReversed():p=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=S,e.setRenderTarget(n,5,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(m,u,g),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class qc extends Ot{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Sa=class Sa{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};Sa.prototype.isMatrix2=!0;let co=Sa;function uo(i,e,t,n){const r=Yc(n);switch(t){case Yo:return i*e;case Zo:return i*e/r.components*r.byteLength;case la:return i*e/r.components*r.byteLength;case zn:return i*e*2/r.components*r.byteLength;case ca:return i*e*2/r.components*r.byteLength;case Ko:return i*e*3/r.components*r.byteLength;case kt:return i*e*4/r.components*r.byteLength;case ua:return i*e*4/r.components*r.byteLength;case ur:case fr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case hr:case dr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ts:case As:return Math.max(i,16)*Math.max(e,8)/4;case ys:case bs:return Math.max(i,8)*Math.max(e,8)/2;case Rs:case ws:case Ps:case Ds:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Cs:case _r:case Ls:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Is:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Us:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Ns:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Fs:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Os:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Bs:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case zs:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Gs:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Vs:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Hs:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case ks:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Ws:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Xs:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case qs:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ys:case Ks:case Zs:return Math.ceil(i/4)*Math.ceil(e/4)*16;case $s:case Js:return Math.ceil(i/4)*Math.ceil(e/4)*8;case xr:case Qs:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Yc(i){switch(i){case Bt:case ko:return{byteLength:1,components:1};case bi:case Wo:case dn:return{byteLength:2,components:1};case aa:case oa:return{byteLength:2,components:4};case tn:case sa:case $t:return{byteLength:4,components:1};case Xo:case qo:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ia}}));typeof window<"u"&&(window.__THREE__?Re("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ia);/** 10 * @license 11 * Copyright 2010-2026 Three.js Authors 12 * SPDX-License-Identifier: MIT 13 */function fl(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Kc(i){const e=new WeakMap;function t(o,c){const l=o.array,d=o.usage,m=l.byteLength,u=i.createBuffer();i.bindBuffer(c,u),i.bufferData(c,l,d),o.onUploadCallback();let g;if(l instanceof Float32Array)g=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)g=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?g=i.HALF_FLOAT:g=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)g=i.SHORT;else if(l instanceof Uint32Array)g=i.UNSIGNED_INT;else if(l instanceof Int32Array)g=i.INT;else if(l instanceof Int8Array)g=i.BYTE;else if(l instanceof Uint8Array)g=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)g=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:u,type:g,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:m}}function n(o,c,l){const d=c.array,m=c.updateRanges;if(i.bindBuffer(l,o),m.length===0)i.bufferSubData(l,0,d);else{m.sort((g,x)=>g.start-x.start);let u=0;for(let g=1;g<m.length;g++){const x=m[u],S=m[g];
vendor: 5,158 bytes, lines 13-126
13S.start<=x.start+x.count+1?x.count=Math.max(x.count,S.start+S.count-x.start):(++u,m[u]=S)}m.length=u+1;for(let g=0,x=m.length;g<x;g++){const S=m[g];i.bufferSubData(l,S.start*d.BYTES_PER_ELEMENT,d,S.start,S.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&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const 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.");n(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var Zc=`#ifdef USE_ALPHAHASH 14 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 15#endif`,$c=`#ifdef USE_ALPHAHASH 16 const float ALPHA_HASH_SCALE = 0.05; 17 float hash2D( vec2 value ) { 18 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 19 } 20 float hash3D( vec3 value ) { 21 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 22 } 23 float getAlphaHashThreshold( vec3 position ) { 24 float maxDeriv = max( 25 length( dFdx( position.xyz ) ), 26 length( dFdy( position.xyz ) ) 27 ); 28 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 29 vec2 pixScales = vec2( 30 exp2( floor( log2( pixScale ) ) ), 31 exp2( ceil( log2( pixScale ) ) ) 32 ); 33 vec2 alpha = vec2( 34 hash3D( floor( pixScales.x * position.xyz ) ), 35 hash3D( floor( pixScales.y * position.xyz ) ) 36 ); 37 float lerpFactor = fract( log2( pixScale ) ); 38 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 39 float a = min( lerpFactor, 1.0 - lerpFactor ); 40 vec3 cases = vec3( 41 x * x / ( 2.0 * a * ( 1.0 - a ) ), 42 ( x - 0.5 * a ) / ( 1.0 - a ), 43 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 44 ); 45 float threshold = ( x < ( 1.0 - a ) ) 46 ? ( ( x < a ) ? cases.x : cases.y ) 47 : cases.z; 48 return clamp( threshold , 1.0e-6, 1.0 ); 49 } 50#endif`,Jc=`#ifdef USE_ALPHAMAP 51 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 52#endif`,Qc=`#ifdef USE_ALPHAMAP 53 uniform sampler2D alphaMap; 54#endif`,jc=`#ifdef USE_ALPHATEST 55 #ifdef ALPHA_TO_COVERAGE 56 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 57 if ( diffuseColor.a == 0.0 ) discard; 58 #else 59 if ( diffuseColor.a < alphaTest ) discard; 60 #endif 61#endif`,eu=`#ifdef USE_ALPHATEST 62 uniform float alphaTest; 63#endif`,tu=`#ifdef USE_AOMAP 64 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 65 reflectedLight.indirectDiffuse *= ambientOcclusion; 66 #if defined( USE_CLEARCOAT ) 67 clearcoatSpecularIndirect *= ambientOcclusion; 68 #endif 69 #if defined( USE_SHEEN ) 70 sheenSpecularIndirect *= ambientOcclusion; 71 #endif 72 #if defined( USE_ENVMAP ) && defined( STANDARD ) 73 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 74 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 75 #endif 76#endif`,nu=`#ifdef USE_AOMAP 77 uniform sampler2D aoMap; 78 uniform float aoMapIntensity; 79#endif`,iu=`#ifdef USE_BATCHING 80 #if ! defined( GL_ANGLE_multi_draw ) 81 #define gl_DrawID _gl_DrawID 82 uniform int _gl_DrawID; 83 #endif 84 uniform highp sampler2D batchingTexture; 85 uniform highp usampler2D batchingIdTexture; 86 mat4 getBatchingMatrix( const in float i ) { 87 int size = textureSize( batchingTexture, 0 ).x; 88 int j = int( i ) * 4; 89 int x = j % size; 90 int y = j / size; 91 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 92 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 93 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 94 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 95 return mat4( v1, v2, v3, v4 ); 96 } 97 float getIndirectIndex( const in int i ) { 98 int size = textureSize( batchingIdTexture, 0 ).x; 99 int x = i % size; 100 int y = i / size; 101 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 102 } 103#endif 104#ifdef USE_BATCHING_COLOR 105 uniform sampler2D batchingColorTexture; 106 vec4 getBatchingColor( const in float i ) { 107 int size = textureSize( batchingColorTexture, 0 ).x; 108 int j = int( i ); 109 int x = j % size; 110 int y = j / size; 111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 112 } 113#endif`,ru=`#ifdef USE_BATCHING 114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 115#endif`,su=`vec3 transformed = vec3( position ); 116#ifdef USE_ALPHAHASH 117 vPosition = vec3( position ); 118#endif`,au=`vec3 objectNormal = vec3( normal ); 119#ifdef USE_TANGENT 120 vec3 objectTangent = vec3( tangent.xyz ); 121#endif`,ou=`float G_BlinnPhong_Implicit( ) { 122 return 0.25; 123} 124float D_BlinnPhong( const in float shininess, const in float dotNH ) { 125 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 128 vec3 halfDir = normalize( lightDir + viewDir ); 129 float dotNH = saturate( dot( normal, halfDir ) ); 130 float dotVH = saturate( dot( viewDir, halfDir ) ); 131 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 132 float G = G_BlinnPhong_Implicit( ); 133 float D = D_BlinnPhong( shininess, dotNH ); 134 return F * ( G * D ); 135} // validated`,lu=`#ifdef USE_IRIDESCENCE 136 const mat3 XYZ_TO_REC709 = mat3( 137 3.2404542, -0.9692660, 0.0556434, 138 -1.5371385, 1.8760108, -0.2040259, 139 -0.4985314, 0.0415560, 1.0572252 140 ); 141 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 142 vec3 sqrtF0 = sqrt( fresnel0 ); 143 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 144 } 145 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 146 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 147 } 148 float IorToFresnel0( float transmittedIor, float incidentIor ) { 149 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 150 } 151 vec3 evalSensitivity( float OPD, vec3 shift ) { 152 float phase = 2.0 * PI * OPD * 1.0e-9; 153 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 154 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 155 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 156 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 157 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 158 xyz /= 1.0685e-7; 159 vec3 rgb = XYZ_TO_REC709 * xyz; 160 return rgb; 161 } 162 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 163 vec3 I; 164 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 165 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 166 float cosTheta2Sq = 1.0 - sinTheta2Sq; 167 if ( cosTheta2Sq < 0.0 ) { 168 return vec3( 1.0 ); 169 } 170 float cosTheta2 = sqrt( cosTheta2Sq ); 171 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 172 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173 float T121 = 1.0 - R12; 174 float phi12 = 0.0; 175 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 176 float phi21 = PI - phi12; 177 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 178 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 179 vec3 phi23 = vec3( 0.0 ); 180 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 181 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 182 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 183 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 184 vec3 phi = vec3( phi21 ) + phi23; 185 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 186 vec3 r123 = sqrt( R123 ); 187 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 188 vec3 C0 = R12 + Rs; 189 I = C0; 190 vec3 Cm = Rs - T121; 191 for ( int m = 1; m <= 2; ++ m ) { 192 Cm *= r123; 193 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 194 I += Cm * Sm; 195 } 196 return max( I, vec3( 0.0 ) ); 197 } 198#endif`,cu=`#ifdef USE_BUMPMAP 199 uniform sampler2D bumpMap; 200 uniform float bumpScale; 201 vec2 dHdxy_fwd() { 202 vec2 dSTdx = dFdx( vBumpMapUv ); 203 vec2 dSTdy = dFdy( vBumpMapUv ); 204 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 205 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 206 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 207 return vec2( dBx, dBy ); 208 } 209 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 210 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 211 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 212 vec3 vN = surf_norm; 213 vec3 R1 = cross( vSigmaY, vN ); 214 vec3 R2 = cross( vN, vSigmaX ); 215 float fDet = dot( vSigmaX, R1 ) * faceDirection; 216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 217 return normalize( abs( fDet ) * surf_norm - vGrad ); 218 } 219#endif`,uu=`#if NUM_CLIPPING_PLANES > 0 220 vec4 plane; 221 #ifdef ALPHA_TO_COVERAGE 222 float distanceToPlane, distanceGradient; 223 float clipOpacity = 1.0; 224 #pragma unroll_loop_start 225 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 226 plane = clippingPlanes[ i ]; 227 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 228 distanceGradient = fwidth( distanceToPlane ) / 2.0; 229 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 230 if ( clipOpacity == 0.0 ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 float unionClipOpacity = 1.0; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 239 distanceGradient = fwidth( distanceToPlane ) / 2.0; 240 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 241 } 242 #pragma unroll_loop_end 243 clipOpacity *= 1.0 - unionClipOpacity; 244 #endif 245 diffuseColor.a *= clipOpacity; 246 if ( diffuseColor.a == 0.0 ) discard; 247 #else 248 #pragma unroll_loop_start 249 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 250 plane = clippingPlanes[ i ]; 251 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 252 } 253 #pragma unroll_loop_end 254 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 255 bool clipped = true; 256 #pragma unroll_loop_start 257 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 258 plane = clippingPlanes[ i ]; 259 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 260 } 261 #pragma unroll_loop_end 262 if ( clipped ) discard; 263 #endif 264 #endif 265#endif`,fu=`#if NUM_CLIPPING_PLANES > 0 266 varying vec3 vClipPosition; 267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 268#endif`,hu=`#if NUM_CLIPPING_PLANES > 0 269 varying vec3 vClipPosition; 270#endif`,du=`#if NUM_CLIPPING_PLANES > 0 271 vClipPosition = - mvPosition.xyz; 272#endif`,pu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 273 diffuseColor *= vColor; 274#endif`,mu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 275 varying vec4 vColor; 276#endif`,gu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 277 varying vec4 vColor; 278#endif`,_u=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 279 vColor = vec4( 1.0 ); 280#endif 281#ifdef USE_COLOR_ALPHA 282 vColor *= color; 283#elif defined( USE_COLOR ) 284 vColor.rgb *= color; 285#endif 286#ifdef USE_INSTANCING_COLOR 287 vColor.rgb *= instanceColor.rgb; 288#endif 289#ifdef USE_BATCHING_COLOR 290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 291#endif`,xu=`#define PI 3.141592653589793 292#define PI2 6.283185307179586 293#define PI_HALF 1.5707963267948966 294#define RECIPROCAL_PI 0.3183098861837907 295#define RECIPROCAL_PI2 0.15915494309189535 296#define EPSILON 1e-6 297#ifndef saturate 298#define saturate( a ) clamp( a, 0.0, 1.0 ) 299#endif 300#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 301float pow2( const in float x ) { return x*x; } 302vec3 pow2( const in vec3 x ) { return x*x; } 303float pow3( const in float x ) { return x*x*x; } 304float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 307highp float rand( const in vec2 uv ) { 308 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 309 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 310 return fract( sin( sn ) * c ); 311} 312#ifdef HIGH_PRECISION 313 float precisionSafeLength( vec3 v ) { return length( v ); } 314#else 315 float precisionSafeLength( vec3 v ) { 316 float maxComponent = max3( abs( v ) ); 317 return length( v / maxComponent ) * maxComponent; 318 } 319#endif 320struct IncidentLight { 321 vec3 color; 322 vec3 direction; 323 bool visible; 324}; 325struct ReflectedLight { 326 vec3 directDiffuse; 327 vec3 directSpecular; 328 vec3 indirectDiffuse; 329 vec3 indirectSpecular; 330}; 331#ifdef USE_ALPHAHASH 332 varying vec3 vPosition; 333#endif 334vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 335 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 336} 337#define inverseTransformDirection transformDirectionByInverseViewMatrix 338vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { 339 return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); 340} 341vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { 342 return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); 343} 344bool isPerspectiveMatrix( mat4 m ) { 345 return m[ 2 ][ 3 ] == - 1.0; 346} 347vec2 equirectUv( in vec3 dir ) { 348 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 349 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 350 return vec2( u, v ); 351}
352vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 353 return RECIPROCAL_PI * diffuseColor; 354} 355vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 356 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 357 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 358} 359float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 360 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 361 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 362} // validated`,vu=`#ifdef ENVMAP_TYPE_CUBE_UV 363 #define cubeUV_minMipLevel 4.0 364 #define cubeUV_minTileSize 16.0 365 float getFace( vec3 direction ) { 366 vec3 absDirection = abs( direction ); 367 float face = - 1.0; 368 if ( absDirection.x > absDirection.z ) { 369 if ( absDirection.x > absDirection.y ) 370 face = direction.x > 0.0 ? 0.0 : 3.0; 371 else 372 face = direction.y > 0.0 ? 1.0 : 4.0; 373 } else { 374 if ( absDirection.z > absDirection.y ) 375 face = direction.z > 0.0 ? 2.0 : 5.0; 376 else 377 face = direction.y > 0.0 ? 1.0 : 4.0; 378 } 379 return face; 380 } 381 vec2 getUV( vec3 direction, float face ) { 382 vec2 uv; 383 if ( face == 0.0 ) { 384 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 385 } else if ( face == 1.0 ) { 386 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 387 } else if ( face == 2.0 ) { 388 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 389 } else if ( face == 3.0 ) { 390 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 391 } else if ( face == 4.0 ) { 392 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 393 } else { 394 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 395 } 396 return 0.5 * ( uv + 1.0 ); 397 } 398 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 399 float face = getFace( direction ); 400 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 401 mipInt = max( mipInt, cubeUV_minMipLevel ); 402 float faceSize = exp2( mipInt ); 403 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 404 if ( face > 2.0 ) { 405 uv.y += faceSize; 406 face -= 3.0; 407 } 408 uv.x += face * faceSize; 409 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 410 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 411 uv.x *= CUBEUV_TEXEL_WIDTH; 412 uv.y *= CUBEUV_TEXEL_HEIGHT; 413 #ifdef texture2DGradEXT 414 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 415 #else 416 return texture2D( envMap, uv ).rgb; 417 #endif 418 } 419 #define cubeUV_r0 1.0 420 #define cubeUV_m0 - 2.0 421 #define cubeUV_r1 0.8 422 #define cubeUV_m1 - 1.0 423 #define cubeUV_r4 0.4 424 #define cubeUV_m4 2.0 425 #define cubeUV_r5 0.305 426 #define cubeUV_m5 3.0 427 #define cubeUV_r6 0.21 428 #define cubeUV_m6 4.0 429 float roughnessToMip( float roughness ) { 430 float mip = 0.0; 431 if ( roughness >= cubeUV_r1 ) { 432 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 433 } else if ( roughness >= cubeUV_r4 ) { 434 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 435 } else if ( roughness >= cubeUV_r5 ) { 436 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 437 } else if ( roughness >= cubeUV_r6 ) { 438 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 439 } else { 440 mip = - 2.0 * log2( 1.16 * roughness ); } 441 return mip; 442 } 443 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 444 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 445 float mipF = fract( mip ); 446 float mipInt = floor( mip ); 447 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 448 if ( mipF == 0.0 ) { 449 return vec4( color0, 1.0 ); 450 } else { 451 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 452 return vec4( mix( color0, color1, mipF ), 1.0 ); 453 } 454 } 455#endif`,Mu=`vec3 transformedNormal = objectNormal; 456#ifdef USE_TANGENT 457 vec3 transformedTangent = objectTangent; 458#endif 459#ifdef USE_BATCHING 460 mat3 bm = mat3( batchingMatrix ); 461 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 462 transformedNormal = bm * transformedNormal; 463 #ifdef USE_TANGENT 464 transformedTangent = bm * transformedTangent; 465 #endif 466#endif 467#ifdef USE_INSTANCING 468 mat3 im = mat3( instanceMatrix ); 469 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 470 transformedNormal = im * transformedNormal; 471 #ifdef USE_TANGENT 472 transformedTangent = im * transformedTangent; 473 #endif 474#endif 475transformedNormal = normalMatrix * transformedNormal; 476#ifdef FLIP_SIDED 477 transformedNormal = - transformedNormal; 478#endif 479#ifdef USE_TANGENT 480 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 481#endif`,Su=`#ifdef USE_DISPLACEMENTMAP 482 uniform sampler2D displacementMap; 483 uniform float displacementScale; 484 uniform float displacementBias; 485#endif`,Eu=`#ifdef USE_DISPLACEMENTMAP 486 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
486placementBias ); 487#endif`,yu=`#ifdef USE_EMISSIVEMAP 488 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 489 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 490 emissiveColor = sRGBTransferEOTF( emissiveColor ); 491 #endif 492 totalEmissiveRadiance *= emissiveColor.rgb; 493#endif`,Tu=`#ifdef USE_EMISSIVEMAP 494 uniform sampler2D emissiveMap; 495#endif`,bu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Au=`vec4 LinearTransferOETF( in vec4 value ) { 496 return value; 497} 498vec4 sRGBTransferEOTF( in vec4 value ) { 499 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 ); 500} 501vec4 sRGBTransferOETF( in vec4 value ) { 502 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 ); 503}`,Ru=`#ifdef USE_ENVMAP 504 #ifdef ENV_WORLDPOS 505 vec3 cameraToFrag; 506 if ( isOrthographic ) { 507 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 508 } else { 509 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 510 } 511 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 512 #ifdef ENVMAP_MODE_REFLECTION 513 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 514 #else 515 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 516 #endif 517 #else 518 vec3 reflectVec = vReflect; 519 #endif 520 #ifdef ENVMAP_TYPE_CUBE 521 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); 522 #ifdef ENVMAP_BLENDING_MULTIPLY 523 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 524 #elif defined( ENVMAP_BLENDING_MIX ) 525 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 526 #elif defined( ENVMAP_BLENDING_ADD ) 527 outgoingLight += envColor.xyz * specularStrength * reflectivity; 528 #endif 529 #endif 530#endif`,wu=`#ifdef USE_ENVMAP 531 uniform float envMapIntensity; 532 uniform mat3 envMapRotation; 533 #ifdef ENVMAP_TYPE_CUBE 534 uniform samplerCube envMap; 535 #else 536 uniform sampler2D envMap; 537 #endif 538#endif`,Cu=`#ifdef USE_ENVMAP 539 uniform float reflectivity; 540 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 541 #define ENV_WORLDPOS 542 #endif 543 #ifdef ENV_WORLDPOS 544 varying vec3 vWorldPosition; 545 uniform float refractionRatio; 546 #else 547 varying vec3 vReflect; 548 #endif 549#endif`,Pu=`#ifdef USE_ENVMAP 550 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 551 #define ENV_WORLDPOS 552 #endif 553 #ifdef ENV_WORLDPOS 554 555 varying vec3 vWorldPosition; 556 #else 557 varying vec3 vReflect; 558 uniform float refractionRatio; 559 #endif 560#endif`,Du=`#ifdef USE_ENVMAP 561 #ifdef ENV_WORLDPOS 562 vWorldPosition = worldPosition.xyz; 563 #else 564 vec3 cameraToVertex; 565 if ( isOrthographic ) { 566 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 567 } else {
568 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 569 } 570 vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 571 #ifdef ENVMAP_MODE_REFLECTION 572 vReflect = reflect( cameraToVertex, worldNormal ); 573 #else 574 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 575 #endif 576 #endif 577#endif`,Lu=`#ifdef USE_FOG 578 vFogDepth = - mvPosition.z; 579#endif`,Iu=`#ifdef USE_FOG 580 varying float vFogDepth; 581#endif`,Uu=`#ifdef USE_FOG 582 #ifdef FOG_EXP2 583 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 584 #else 585 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 586 #endif 587 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 588#endif`,Nu=`#ifdef USE_FOG 589 uniform vec3 fogColor; 590 varying float vFogDepth; 591 #ifdef FOG_EXP2 592 uniform float fogDensity; 593 #else 594 uniform float fogNear; 595 uniform float fogFar; 596 #endif 597#endif`,Fu=`#ifdef USE_GRADIENTMAP 598 uniform sampler2D gradientMap; 599#endif 600vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 601 float dotNL = dot( normal, lightDirection ); 602 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 603 #ifdef USE_GRADIENTMAP 604 return vec3( texture2D( gradientMap, coord ).r ); 605 #else 606 vec2 fw = fwidth( coord ) * 0.5; 607 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 608 #endif 609}`,Ou=`#ifdef USE_LIGHTMAP 610 uniform sampler2D lightMap; 611 uniform float lightMapIntensity; 612#endif`,Bu=`LambertMaterial material; 613material.diffuseColor = diffuseColor.rgb; 614material.specularStrength = specularStrength;`,zu=`varying vec3 vViewPosition; 615struct LambertMaterial { 616 vec3 diffuseColor; 617 float specularStrength; 618}; 619void 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 ) { 620 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 621 vec3 irradiance = dotNL * directLight.color; 622 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 623} 624void 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 ) { 625 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 626} 627#define RE_Direct RE_Direct_Lambert 628#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Gu=`uniform bool receiveShadow; 629uniform vec3 ambientLightColor; 630#if defined( USE_LIGHT_PROBES ) 631 uniform vec3 lightProbe[ 9 ]; 632#endif 633vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 634 float x = normal.x, y = normal.y, z = normal.z; 635 vec3 result = shCoefficients[ 0 ] * 0.886227; 636 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 637 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 638 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 639 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 640 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 641 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 642 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 643 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 644 return result; 645} 646vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 647 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 648 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 649 return irradiance; 650} 651vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 652 vec3 irradiance = ambientLightColor; 653 return irradiance; 654} 655float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 656 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 657 if ( cutoffDistance > 0.0 ) { 658 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 659 } 660 return distanceFalloff; 661} 662float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 663 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 664} 665#if NUM_DIR_LIGHTS > 0 666 struct DirectionalLight { 667 vec3 direction; 668 vec3 color; 669 }; 670 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 671 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 672 light.color = directionalLight.color; 673 light.direction = directionalLight.direction; 674 light.visible = true; 675 } 676#endif 677#if NUM_POINT_LIGHTS > 0 678 struct PointLight { 679 vec3 position; 680 vec3 color; 681 float distance; 682 float decay; 683 }; 684 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 685 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 686 vec3 lVector = pointLight.position - geometryPosition; 687 light.direction = normalize( lVector ); 688 float lightDistance = length( lVector ); 689 light.color = pointLight.color; 690 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 691 light.visible = ( light.color != vec3( 0.0 ) ); 692 } 693#endif
694#if NUM_SPOT_LIGHTS > 0 695 struct SpotLight { 696 vec3 position; 697 vec3 direction; 698 vec3 color; 699 float distance; 700 float decay; 701 float coneCos; 702 float penumbraCos; 703 }; 704 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 705 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 706 vec3 lVector = spotLight.position - geometryPosition; 707 light.direction = normalize( lVector ); 708 float angleCos = dot( light.direction, spotLight.direction ); 709 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 710 if ( spotAttenuation > 0.0 ) { 711 float lightDistance = length( lVector ); 712 light.color = spotLight.color * spotAttenuation; 713 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 714 light.visible = ( light.color != vec3( 0.0 ) ); 715 } else { 716 light.color = vec3( 0.0 ); 717 light.visible = false; 718 } 719 } 720#endif 721#if NUM_RECT_AREA_LIGHTS > 0 722 struct RectAreaLight { 723 vec3 color; 724 vec3 position; 725 vec3 halfWidth; 726 vec3 halfHeight; 727 }; 728 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 729 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 730#endif 731#if NUM_HEMI_LIGHTS > 0 732 struct HemisphereLight { 733 vec3 direction; 734 vec3 skyColor; 735 vec3 groundColor; 736 }; 737 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 738 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 739 float dotNL = dot( normal, hemiLight.direction ); 740 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 741 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 742 return irradiance; 743 } 744#endif 745#include <lightprobes_pars_fragment>`,Vu=`#ifdef USE_ENVMAP 746 vec3 getIBLIrradiance( const in vec3 normal ) { 747 #ifdef ENVMAP_TYPE_CUBE_UV 748 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 749 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 750 return PI * envMapColor.rgb * envMapIntensity; 751 #else 752 return vec3( 0.0 ); 753 #endif 754 } 755 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 756 #ifdef ENVMAP_TYPE_CUBE_UV 757 vec3 reflectVec = reflect( - viewDir, normal ); 758 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 759 reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); 760 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 761 return envMapColor.rgb * envMapIntensity; 762 #else 763 return vec3( 0.0 ); 764 #endif 765 } 766 #ifdef USE_ANISOTROPY 767 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 768 #ifdef ENVMAP_TYPE_CUBE_UV 769 vec3 bentNormal = cross( bitangent, viewDir ); 770 bentNormal = normalize( cross( bentNormal, bitangent ) ); 771 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 772 return getIBLRadiance( viewDir, bentNormal, roughness ); 773 #else 774 return vec3( 0.0 ); 775 #endif 776 } 777 #endif 778#endif`,Hu=`ToonMaterial material; 779material.diffuseColor = diffuseColor.rgb;`,ku=`varying vec3 vViewPosition; 780struct ToonMaterial { 781 vec3 diffuseColor; 782}; 783void 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 ) { 784 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 785 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 786} 787void 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 ) { 788 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 789} 790#define RE_Direct RE_Direct_Toon 791#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Wu=`BlinnPhongMaterial material; 792material.diffuseColor = diffuseColor.rgb; 793material.specularColor = specular; 794material.specularShininess = shininess; 795material.specularStrength = specularStrength;`,Xu=`varying vec3 vViewPosition; 796struct BlinnPhongMaterial { 797 vec3 diffuseColor; 798 vec3 specularColor; 799 float specularShininess; 800 float specularStrength; 801}; 802void 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 ) {
803 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 804 vec3 irradiance = dotNL * directLight.color; 805 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 806 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 807} 808void 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 ) { 809 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 810} 811#define RE_Direct RE_Direct_BlinnPhong 812#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,qu=`PhysicalMaterial material; 813material.diffuseColor = diffuseColor.rgb; 814material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 815material.metalness = metalnessFactor; 816vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 817float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 818material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 819material.roughness = min( material.roughness, 1.0 ); 820#ifdef IOR 821 material.ior = ior; 822 #ifdef USE_SPECULAR 823 float specularIntensityFactor = specularIntensity; 824 vec3 specularColorFactor = specularColor; 825 #ifdef USE_SPECULAR_COLORMAP 826 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 827 #endif 828 #ifdef USE_SPECULAR_INTENSITYMAP 829 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 830 #endif 831 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 832 #else 833 float specularIntensityFactor = 1.0; 834 vec3 specularColorFactor = vec3( 1.0 ); 835 material.specularF90 = 1.0; 836 #endif 837 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 838 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 839#else 840 material.specularColor = vec3( 0.04 ); 841 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 842 material.specularF90 = 1.0; 843#endif 844#ifdef USE_CLEARCOAT 845 material.clearcoat = clearcoat; 846 material.clearcoatRoughness = clearcoatRoughness; 847 material.clearcoatF0 = vec3( 0.04 ); 848 material.clearcoatF90 = 1.0; 849 #ifdef USE_CLEARCOATMAP 850 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 851 #endif 852 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 853 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 854 #endif 855 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 856 material.clearcoatRoughness += geometryRoughness; 857 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 858#endif 859#ifdef USE_DISPERSION 860 material.dispersion = dispersion; 861#endif 862#ifdef USE_IRIDESCENCE 863 material.iridescence = iridescence; 864 material.iridescenceIOR = iridescenceIOR; 865 #ifdef USE_IRIDESCENCEMAP 866 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 867 #endif 868 #ifdef USE_IRIDESCENCE_THICKNESSMAP 869 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 870 #else 871 material.iridescenceThickness = iridescenceThicknessMaximum; 872 #endif 873#endif 874#ifdef USE_SHEEN 875 material.sheenColor = sheenColor; 876 #ifdef USE_SHEEN_COLORMAP 877 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 878 #endif 879 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 880 #ifdef USE_SHEEN_ROUGHNESSMAP 881 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 882 #endif 883#endif 884#ifdef USE_ANISOTROPY 885 #ifdef USE_ANISOTROPYMAP 886 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 887 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 888 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 889 #else 890 vec2 anisotropyV = anisotropyVector; 891 #endif 892 material.anisotropy = length( anisotropyV ); 893 if( material.anisotropy == 0.0 ) { 894 anisotropyV = vec2( 1.0, 0.0 ); 895 } else { 896 anisotropyV /= material.anisotropy; 897 material.anisotropy = saturate( material.anisotropy ); 898 } 899 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
900 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 901 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 902#endif`,Yu=`uniform sampler2D dfgLUT; 903struct PhysicalMaterial { 904 vec3 diffuseColor; 905 vec3 diffuseContribution; 906 vec3 specularColor; 907 vec3 specularColorBlended; 908 float roughness; 909 float metalness; 910 float specularF90; 911 float dispersion; 912 #ifdef USE_CLEARCOAT 913 float clearcoat; 914 float clearcoatRoughness; 915 vec3 clearcoatF0; 916 float clearcoatF90; 917 #endif 918 #ifdef USE_IRIDESCENCE 919 float iridescence; 920 float iridescenceIOR; 921 float iridescenceThickness; 922 vec3 iridescenceFresnel; 923 vec3 iridescenceF0; 924 vec3 iridescenceFresnelDielectric; 925 vec3 iridescenceFresnelMetallic; 926 #endif 927 #ifdef USE_SHEEN 928 vec3 sheenColor; 929 float sheenRoughness; 930 #endif 931 #ifdef IOR 932 float ior; 933 #endif 934 #ifdef USE_TRANSMISSION 935 float transmission; 936 float transmissionAlpha; 937 float thickness; 938 float attenuationDistance; 939 vec3 attenuationColor; 940 #endif 941 #ifdef USE_ANISOTROPY 942 float anisotropy; 943 float alphaT; 944 vec3 anisotropyT; 945 vec3 anisotropyB; 946 #endif 947}; 948vec3 clearcoatSpecularDirect = vec3( 0.0 ); 949vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 950vec3 sheenSpecularDirect = vec3( 0.0 ); 951vec3 sheenSpecularIndirect = vec3(0.0 ); 952vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 953 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 954 float x2 = x * x; 955 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 956 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 957} 958float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 959 float a2 = pow2( alpha ); 960 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 961 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 962 return 0.5 / max( gv + gl, EPSILON ); 963} 964float D_GGX( const in float alpha, const in float dotNH ) { 965 float a2 = pow2( alpha ); 966 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 967 return RECIPROCAL_PI * a2 / pow2( denom ); 968} 969#ifdef USE_ANISOTROPY 970 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 ) { 971 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 972 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 973 return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 973-1132
973; 974 } 975 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 976 float a2 = alphaT * alphaB; 977 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 978 highp float v2 = dot( v, v ); 979 float w2 = a2 / v2; 980 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 981 } 982#endif 983#ifdef USE_CLEARCOAT 984 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 985 vec3 f0 = material.clearcoatF0; 986 float f90 = material.clearcoatF90; 987 float roughness = material.clearcoatRoughness; 988 float alpha = pow2( roughness ); 989 vec3 halfDir = normalize( lightDir + viewDir ); 990 float dotNL = saturate( dot( normal, lightDir ) ); 991 float dotNV = saturate( dot( normal, viewDir ) ); 992 float dotNH = saturate( dot( normal, halfDir ) ); 993 float dotVH = saturate( dot( viewDir, halfDir ) ); 994 vec3 F = F_Schlick( f0, f90, dotVH ); 995 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 996 float D = D_GGX( alpha, dotNH ); 997 return F * ( V * D ); 998 } 999#endif 1000vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1001 vec3 f0 = material.specularColorBlended; 1002 float f90 = material.specularF90; 1003 float roughness = material.roughness; 1004 float alpha = pow2( roughness ); 1005 vec3 halfDir = normalize( lightDir + viewDir ); 1006 float dotNL = saturate( dot( normal, lightDir ) ); 1007 float dotNV = saturate( dot( normal, viewDir ) ); 1008 float dotNH = saturate( dot( normal, halfDir ) ); 1009 float dotVH = saturate( dot( viewDir, halfDir ) ); 1010 vec3 F = F_Schlick( f0, f90, dotVH ); 1011 #ifdef USE_IRIDESCENCE 1012 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1013 #endif 1014 #ifdef USE_ANISOTROPY 1015 float dotTL = dot( material.anisotropyT, lightDir ); 1016 float dotTV = dot( material.anisotropyT, viewDir ); 1017 float dotTH = dot( material.anisotropyT, halfDir ); 1018 float dotBL = dot( material.anisotropyB, lightDir ); 1019 float dotBV = dot( material.anisotropyB, viewDir ); 1020 float dotBH = dot( material.anisotropyB, halfDir ); 1021 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1022 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1023 #else 1024 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1025 float D = D_GGX( alpha, dotNH ); 1026 #endif 1027 return F * ( V * D ); 1028} 1029vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1030 const float LUT_SIZE = 64.0; 1031 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1032 const float LUT_BIAS = 0.5 / LUT_SIZE; 1033 float dotNV = saturate( dot( N, V ) ); 1034 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1035 uv = uv * LUT_SCALE + LUT_BIAS; 1036 return uv; 1037} 1038float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1039 float l = length( f ); 1040 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1041} 1042vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1043 float x = dot( v1, v2 ); 1044 float y = abs( x ); 1045 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1046 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1047 float v = a / b; 1048 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1049 return cross( v1, v2 ) * theta_sintheta; 1050} 1051vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1052 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1053 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1054 vec3 lightNormal = cross( v1, v2 ); 1055 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1056 vec3 T1, T2; 1057 T1 = normalize( V - N * dot( V, N ) ); 1058 T2 = - cross( N, T1 ); 1059 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1060 vec3 coords[ 4 ]; 1061 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1062 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1063 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1064 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1065 coords[ 0 ] = normalize( coords[ 0 ] ); 1066 coords[ 1 ] = normalize( coords[ 1 ] ); 1067 coords[ 2 ] = normalize( coords[ 2 ] ); 1068 coords[ 3 ] = normalize( coords[ 3 ] ); 1069 vec3 vectorFormFactor = vec3( 0.0 ); 1070 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1071 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1072 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1073 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1074 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1075 return vec3( result ); 1076} 1077#if defined( USE_SHEEN ) 1078float D_Charlie( float roughness, float dotNH ) { 1079 float alpha = pow2( roughness ); 1080 float invAlpha = 1.0 / alpha; 1081 float cos2h = dotNH * dotNH; 1082 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1083 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1084} 1085float V_Neubelt( float dotNV, float dotNL ) { 1086 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1087} 1088vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1089 vec3 halfDir = normalize( lightDir + viewDir ); 1090 float dotNL = saturate( dot( normal, lightDir ) ); 1091 float dotNV = saturate( dot( normal, viewDir ) ); 1092 float dotNH = saturate( dot( normal, halfDir ) ); 1093 float D = D_Charlie( sheenRoughness, dotNH ); 1094 float V = V_Neubelt( dotNV, dotNL ); 1095 return sheenColor * ( D * V ); 1096} 1097#endif 1098float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1099 float dotNV = saturate( dot( normal, viewDir ) ); 1100 float r2 = roughness * roughness; 1101 float rInv = 1.0 / ( roughness + 0.1 ); 1102 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1103 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1104 float DG = exp( a * dotNV + b ); 1105 return saturate( DG ); 1106} 1107vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1108 float dotNV = saturate( dot( normal, viewDir ) ); 1109 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1110 return specularColor * fab.x + specularF90 * fab.y; 1111} 1112#ifdef USE_IRIDESCENCE 1113void 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 ) { 1114#else 1115void 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 ) { 1116#endif 1117 float dotNV = saturate( dot( normal, viewDir ) ); 1118 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1119 #ifdef USE_IRIDESCENCE 1120 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1121 #else 1122 vec3 Fr = specularColor; 1123 #endif 1124 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1125 float Ess = fab.x + fab.y; 1126 float Ems = 1.0 - Ess; 1127 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1128 singleScatter += FssEss; 1129 multiScatter += Fms * Ems; 1130} 1131vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1132 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1133-1262
1133 float dotNL = saturate( dot( normal, lightDir ) ); 1134 float dotNV = saturate( dot( normal, viewDir ) ); 1135 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1136 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1137 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1138 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1139 float Ess_V = dfgV.x + dfgV.y; 1140 float Ess_L = dfgL.x + dfgL.y; 1141 float Ems_V = 1.0 - Ess_V; 1142 float Ems_L = 1.0 - Ess_L; 1143 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1144 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1145 float compensationFactor = Ems_V * Ems_L; 1146 vec3 multiScatter = Fms * compensationFactor; 1147 return singleScatter + multiScatter; 1148} 1149#if NUM_RECT_AREA_LIGHTS > 0 1150 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 ) { 1151 vec3 normal = geometryNormal; 1152 vec3 viewDir = geometryViewDir; 1153 vec3 position = geometryPosition; 1154 vec3 lightPos = rectAreaLight.position; 1155 vec3 halfWidth = rectAreaLight.halfWidth; 1156 vec3 halfHeight = rectAreaLight.halfHeight; 1157 vec3 lightColor = rectAreaLight.color; 1158 float roughness = material.roughness; 1159 vec3 rectCoords[ 4 ]; 1160 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1161 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1162 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1163 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1164 vec4 t1 = texture2D( ltc_1, uv ); 1165 vec4 t2 = texture2D( ltc_2, uv ); 1166 mat3 mInv = mat3( 1167 vec3( t1.x, 0, t1.y ), 1168 vec3( 0, 1, 0 ), 1169 vec3( t1.z, 0, t1.w ) 1170 ); 1171 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1172 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1173 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1174 #ifdef USE_CLEARCOAT 1175 vec3 Ncc = geometryClearcoatNormal; 1176 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1177 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1178 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1179 mat3 mInvClearcoat = mat3( 1180 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1181 vec3( 0, 1, 0 ), 1182 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1183 ); 1184 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1185 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1186 #endif 1187 } 1188#endif 1189void 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 ) { 1190 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1191 vec3 irradiance = dotNL * directLight.color; 1192 #ifdef USE_CLEARCOAT 1193 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1194 vec3 ccIrradiance = dotNLcc * directLight.color; 1195 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1196 #endif 1197 #ifdef USE_SHEEN 1198 1199 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1200 1201 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1202 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1203 1204 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1205 1206 irradiance *= sheenEnergyComp; 1207 1208 #endif 1209 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1210 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1211} 1212void 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 ) { 1213 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1214 #ifdef USE_SHEEN 1215 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1216 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1217 diffuse *= sheenEnergyComp; 1218 #endif 1219 reflectedLight.indirectDiffuse += diffuse; 1220} 1221void 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) { 1222 #ifdef USE_CLEARCOAT 1223 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1224 #endif 1225 #ifdef USE_SHEEN 1226 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1227 #endif 1228 vec3 singleScatteringDielectric = vec3( 0.0 ); 1229 vec3 multiScatteringDielectric = vec3( 0.0 ); 1230 vec3 singleScatteringMetallic = vec3( 0.0 ); 1231 vec3 multiScatteringMetallic = vec3( 0.0 ); 1232 #ifdef USE_IRIDESCENCE 1233 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1237 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1238 #endif 1239 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1240 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1241 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1242 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1243 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1244 vec3 indirectSpecular = radiance * singleScattering; 1245 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1246 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1247 #ifdef USE_SHEEN 1248 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1249 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1250 indirectSpecular *= sheenEnergyComp; 1251 indirectDiffuse *= sheenEnergyComp; 1252 #endif 1253 reflectedLight.indirectSpecular += indirectSpecular; 1254 reflectedLight.indirectDiffuse += indirectDiffuse; 1255} 1256#define RE_Direct RE_Direct_Physical 1257#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1258#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1259#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1260float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1261 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1262}`,
1262Ku=` 1263vec3 geometryPosition = - vViewPosition; 1264vec3 geometryNormal = normal; 1265vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1266vec3 geometryClearcoatNormal = vec3( 0.0 ); 1267#ifdef USE_CLEARCOAT 1268 geometryClearcoatNormal = clearcoatNormal; 1269#endif 1270#ifdef USE_IRIDESCENCE 1271 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1272 if ( material.iridescenceThickness == 0.0 ) { 1273 material.iridescence = 0.0; 1274 } else { 1275 material.iridescence = saturate( material.iridescence ); 1276 } 1277 if ( material.iridescence > 0.0 ) { 1278 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1279 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1280 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1281 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1282 } 1283#endif 1284IncidentLight directLight; 1285#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1286 PointLight pointLight; 1287 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1288 PointLightShadow pointLightShadow; 1289 #endif 1290 #pragma unroll_loop_start 1291 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1292 pointLight = pointLights[ i ]; 1293 getPointLightInfo( pointLight, geometryPosition, directLight ); 1294 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1295 pointLightShadow = pointLightShadows[ i ]; 1296 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1297 #endif 1298 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1299 } 1300 #pragma unroll_loop_end 1301#endif 1302#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1303 SpotLight spotLight; 1304 vec4 spotColor; 1305 vec3 spotLightCoord; 1306 bool inSpotLightMap; 1307 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1308 SpotLightShadow spotLightShadow; 1309 #endif 1310 #pragma unroll_loop_start 1311 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1312 spotLight = spotLights[ i ]; 1313 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1314 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1315 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1316 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1317 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1318 #else 1319 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1320 #endif 1321 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1322 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1323 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1324 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1325 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1326 #endif 1327 #undef SPOT_LIGHT_MAP_INDEX 1328 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1329 spotLightShadow = spotLightShadows[ i ]; 1330 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1331 #endif 1332 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1333 } 1334 #pragma unroll_loop_end 1335#endif 1336#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1337 DirectionalLight directionalLight; 1338 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1339 DirectionalLightShadow directionalLightShadow; 1340 #endif 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1343 directionalLight = directionalLights[ i ]; 1344 getDirectionalLightInfo( directionalLight, directLight ); 1345 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1346 directionalLightShadow = directionalLightShadows[ i ]; 1347 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1348 #endif 1349 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1350 } 1351 #pragma unroll_loop_end 1352#endif 1353#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1354 RectAreaLight rectAreaLight; 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1357 rectAreaLight = rectAreaLights[ i ]; 1358 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1359 } 1360 #pragma unroll_loop_end 1361#endif 1362#if defined( RE_IndirectDiffuse ) 1363 vec3 iblIrradiance = vec3( 0.0 ); 1364 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1365 #if defined( USE_LIGHT_PROBES ) 1366 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1367 #endif 1368 #if ( NUM_HEMI_LIGHTS > 0 ) 1369 #pragma unroll_loop_start 1370 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1371 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1372 } 1373 #pragma unroll_loop_end 1374 #endif 1375 #ifdef USE_LIGHT_PROBES_GRID 1376 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 1377 vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); 1378 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 1379 #endif 1380#endif 1381#if defined( RE_IndirectSpecular ) 1382 vec3 radiance = vec3( 0.0 ); 1383 vec3 clearcoatRadiance = vec3( 0.0 ); 1384#endif`,Zu=`#if defined( RE_IndirectDiffuse ) 1385 #ifdef USE_LIGHTMAP 1386 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1387 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1388 irradiance += lightMapIrradiance; 1389 #endif 1390 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1391 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1392 iblIrradiance += getIBLIrradiance( geometryNormal ); 1393 #endif 1394 #endif 1395#endif 1396#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1397 #ifdef USE_ANISOTROPY 1398 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1399 #else 1400 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1401 #endif 1402 #ifdef USE_CLEARCOAT 1403 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1404 #endif 1405#endif`,$u=`#if defined( RE_IndirectDiffuse ) 1406 #if defined( LAMBERT ) || defined( PHONG ) 1407 irradiance += iblIrradiance; 1408 #endif 1409 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1410#endif 1411#if defined( RE_IndirectSpecular ) 1412 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1413#endif`,Ju=`#ifdef USE_LIGHT_PROBES_GRID 1414uniform highp sampler3D probesSH; 1415uniform vec3 probesMin; 1416uniform vec3 probesMax; 1417uniform vec3 probesResolution; 1418vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 1419 vec3 res = probesResolution; 1420 vec3 gridRange = probesMax - probesMin; 1421 vec3 resMinusOne = res - 1.0; 1422 vec3 probeSpacing = gridRange / resMinusOne; 1423 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 1424 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 1425 uvw = uvw * resMinusOne / res + 0.5 / res; 1426 float nz = res.z; 1427 float paddedSlices = nz + 2.0; 1428 float atlasDepth = 7.0 * paddedSlices; 1429 float uvZBase = uvw.z * nz + 1.0; 1430 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 1431 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 1432 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 1433 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 1434 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 1435 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 1436 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 1437 vec3 c0 = s0.xyz; 1438 vec3 c1 = vec3( s0.w, s1.xy ); 1439 vec3 c2 = vec3( s1.zw, s2.x ); 1440 vec3 c3 = s2.yzw; 1441 vec3 c4 = s3.xyz; 1442 vec3 c5 = vec3( s3.w, s4.xy ); 1443 vec3 c6 = vec3( s4.zw, s5.x ); 1444 vec3 c7 = s5.yzw; 1445 vec3 c8 = s6.xyz; 1446 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 1447 vec3 result = c0 * 0.886227; 1448 result += c1 * 2.0 * 0.511664 * y; 1449 result += c2 * 2.0 * 0.511664 * z; 1450 result += c3 * 2.0 * 0.511664 * x; 1451 result += c4 * 2.0 * 0.429043 * x * y; 1452 result += c5 * 2.0 * 0.429043 * y * z; 1453 result += c6 * ( 0.743125 * z * z - 0.247708 ); 1454 result += c7 * 2.0 * 0.429043 * x * z; 1455 result += c8 * 0.429043 * ( x * x - y * y ); 1456 return max( result, vec3( 0.0 ) ); 1457} 1458#endif`,Qu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1459 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1460#endif`,ju=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1461 uniform float logDepthBufFC; 1462 varying float vFragDepth; 1463 varying float vIsPerspective; 1464#endif`,ef=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1465 varying float vFragDepth; 1466 varying float vIsPerspective; 1467#endif`,tf=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1468 vFragDepth = 1.0 + gl_Position.w; 1469 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1470#endif`,nf=`#ifdef USE_MAP 1471 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1472 #ifdef DECODE_VIDEO_TEXTURE 1473 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1474 #endif 1475 diffuseColor *= sampledDiffuseColor; 1476#endif`,rf=`#ifdef USE_MAP 1477 uniform sampler2D map; 1478#endif`,sf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1479 #if defined( USE_POINTS_UV ) 1480 vec2 uv = vUv; 1481 #else 1482 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1483 #endif 1484#endif 1485#ifdef USE_MAP 1486 diffuseColor *= texture2D( map, uv ); 1487#endif 1488#ifdef USE_ALPHAMAP 1489 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1490#endif`,af=`#if defined( USE_POINTS_UV ) 1491 varying vec2 vUv; 1492#else 1493 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1494 uniform mat3 uvTransform; 1495 #endif 1496#endif 1497#ifdef USE_MAP 1498 uniform sampler2D map; 1499#endif 1500#ifdef USE_ALPHAMAP 1501 uniform sampler2D alphaMap; 1502#endif`,of=`float metalnessFactor = metalness; 1503#ifdef USE_METALNESSMAP 1504 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1505 metalnessFactor *= texelMetalness.b; 1506#endif`,lf=`#ifdef USE_METALNESSMAP 1507 uniform sampler2D metalnessMap; 1508#endif`,cf=`#ifdef USE_INSTANCING_MORPH 1509 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1510 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1511 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1512 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1513 } 1514#endif`,uf=`#if defined( USE_MORPHCOLORS ) 1515 vColor *= morphTargetBaseInfluence; 1516 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1517 #if defined( USE_COLOR_ALPHA ) 1518 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1519 #elif defined( USE_COLOR ) 1520 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1521 #endif 1522 } 1523#endif`,ff=`#ifdef USE_MORPHNORMALS 1524 objectNormal *= morphTargetBaseInfluence; 1525 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1526 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1527 } 1528#endif`,hf=`#ifdef USE_MORPHTARGETS 1529 #ifndef USE_INSTANCING_MORPH 1530 uniform float morphTargetBaseInfluence; 1531 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1532 #endif 1533 uniform sampler2DArray morphTargetsTexture; 1534 uniform ivec2 morphTargetsTextureSize; 1535 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1536 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1537 int y = texelIndex / morphTargetsTextureSize.x; 1538 int x = texelIndex - y * morphTargetsTextureSize.x; 1539 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1540 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1541 } 1542#endif`,df=`#ifdef USE_MORPHTARGETS 1543 transformed *= morphTargetBaseInfluence; 1544 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1545 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1546 } 1547#endif`,pf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1548#ifdef FLAT_SHADED 1549 vec3 fdx = dFdx( vViewPosition ); 1550 vec3 fdy = dFdy( vViewPosition ); 1551 vec3 normal = normalize( cross( fdx, fdy ) ); 1552#else 1553 vec3 normal = normalize( vNormal ); 1554 #ifdef DOUBLE_SIDED 1555 normal *= faceDirection; 1556 #endif 1557#endif 1558#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1559 #ifdef USE_TANGENT 1560 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1561 #else 1562 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1563 #if defined( USE_NORMALMAP ) 1564 vNormalMapUv 1565 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1566 vClearcoatNormalMapUv 1567 #else 1568 vUv 1569 #endif 1570 ); 1571 #endif 1572 #ifdef DOUBLE_SIDED 1573 tbn[0] *= faceDirection; 1574 tbn[1] *= faceDirection; 1575 #endif 1576#endif 1577#ifdef USE_CLEARCOAT_NORMALMAP 1578 #ifdef USE_TANGENT 1579 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1580 #else 1581 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1582 #endif 1583 #ifdef DOUBLE_SIDED 1584 tbn2[0] *= faceDirection; 1585 tbn2[1] *= faceDirection; 1586 #endif 1587#endif 1588vec3 nonPerturbedNormal = normal;`,mf=`#ifdef USE_NORMALMAP_OBJECTSPACE 1589 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1590 #ifdef FLIP_SIDED 1591 normal = - normal; 1592 #endif 1593 #ifdef DOUBLE_SIDED 1594 normal = normal * faceDirection; 1595 #endif 1596 normal = normalize( normalMatrix * normal ); 1597#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1598 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1599 #if defined( USE_PACKED_NORMALMAP ) 1600 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 1601 #endif 1602 mapN.xy *= normalScale; 1603 normal = normalize( tbn * mapN ); 1604#elif defined( USE_BUMPMAP )
1605 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1606#endif`,gf=`#ifndef FLAT_SHADED 1607 varying vec3 vNormal; 1608 #ifdef USE_TANGENT 1609 varying vec3 vTangent; 1610 varying vec3 vBitangent; 1611 #endif 1612#endif`,_f=`#ifndef FLAT_SHADED 1613 varying vec3 vNormal; 1614 #ifdef USE_TANGENT 1615 varying vec3 vTangent; 1616 varying vec3 vBitangent; 1617 #endif 1618#endif`,xf=`#ifndef FLAT_SHADED 1619 vNormal = normalize( transformedNormal ); 1620 #ifdef USE_TANGENT 1621 vTangent = normalize( transformedTangent ); 1622 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1623 #ifdef FLIP_SIDED 1624 vBitangent = - vBitangent; 1625 #endif 1626 #endif 1627#endif`,vf=`#ifdef USE_NORMALMAP 1628 uniform sampler2D normalMap; 1629 uniform vec2 normalScale; 1630#endif 1631#ifdef USE_NORMALMAP_OBJECTSPACE 1632 uniform mat3 normalMatrix; 1633#endif 1634#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1635 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1636 vec3 q0 = dFdx( eye_pos.xyz ); 1637 vec3 q1 = dFdy( eye_pos.xyz ); 1638 vec2 st0 = dFdx( uv.st ); 1639 vec2 st1 = dFdy( uv.st ); 1640 vec3 N = surf_norm; 1641 vec3 q1perp = cross( q1, N ); 1642 vec3 q0perp = cross( N, q0 ); 1643 vec3 T = q1perp * st0.x + q0perp * st1.x; 1644 vec3 B = q1perp * st0.y + q0perp * st1.y; 1645 float det = max( dot( T, T ), dot( B, B ) ); 1646 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1647 return mat3( T * scale, B * scale, N ); 1648 } 1649#endif`,Mf=`#ifdef USE_CLEARCOAT 1650 vec3 clearcoatNormal = nonPerturbedNormal; 1651#endif`,Sf=`#ifdef USE_CLEARCOAT_NORMALMAP 1652 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1653 clearcoatMapN.xy *= clearcoatNormalScale; 1654 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1655#endif`,Ef=`#ifdef USE_CLEARCOATMAP 1656 uniform sampler2D clearcoatMap; 1657#endif 1658#ifdef USE_CLEARCOAT_NORMALMAP 1659 uniform sampler2D clearcoatNormalMap; 1660 uniform vec2 clearcoatNormalScale; 1661#endif 1662#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1663 uniform sampler2D clearcoatRoughnessMap; 1664#endif`,yf=`#ifdef USE_IRIDESCENCEMAP 1665 uniform sampler2D iridescenceMap; 1666#endif 1667#ifdef USE_IRIDESCENCE_THICKNESSMAP 1668 uniform sampler2D iridescenceThicknessMap; 1669#endif`,Tf=`#ifdef OPAQUE 1670diffuseColor.a = 1.0; 1671#endif 1672#ifdef USE_TRANSMISSION 1673diffuseColor.a *= material.transmissionAlpha; 1674#endif 1675gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,bf=`vec3 packNormalToRGB( const in vec3 normal ) { 1676 return normalize( normal ) * 0.5 + 0.5; 1677} 1678vec3 unpackRGBToNormal( const in vec3 rgb ) { 1679 return 2.0 * rgb.xyz - 1.0; 1680} 1681const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1682const float Inv255 = 1. / 255.; 1683const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1684const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1685const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1686const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1687vec4 packDepthToRGBA( const in float v ) { 1688 if( v <= 0.0 ) 1689 return vec4( 0., 0., 0., 0. ); 1690 if( v >= 1.0 ) 1691 return vec4( 1., 1., 1., 1. ); 1692 float vuf; 1693 float af = modf( v * PackFactors.a, vuf ); 1694 float bf = modf( vuf * ShiftRight8, vuf ); 1695 float gf = modf( vuf * ShiftRight8, vuf ); 1696 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1697} 1698vec3 packDepthToRGB( const in float v ) { 1699 if( v <= 0.0 ) 1700 return vec3( 0., 0., 0. ); 1701 if( v >= 1.0 ) 1702 return vec3( 1., 1., 1. ); 1703 float vuf; 1704 float bf = modf( v * PackFactors.b, vuf ); 1705 float gf = modf( vuf * ShiftRight8, vuf ); 1706 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1707} 1708vec2 packDepthToRG( const in float v ) { 1709 if( v <= 0.0 ) 1710 return vec2( 0., 0. ); 1711 if( v >= 1.0 ) 1712 return vec2( 1., 1. ); 1713 float vuf; 1714 float gf = modf( v * 256., vuf ); 1715 return vec2( vuf * Inv255, gf ); 1716} 1717float unpackRGBAToDepth( const in vec4 v ) { 1718 return dot( v, UnpackFactors4 ); 1719} 1720float unpackRGBToDepth( const in vec3 v ) { 1721 return dot( v, UnpackFactors3 ); 1722} 1723float unpackRGToDepth( const in vec2 v ) { 1724 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1725} 1726vec4 pack2HalfToRGBA( const in vec2 v ) {
1727 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1728 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1729} 1730vec2 unpackRGBATo2Half( const in vec4 v ) { 1731 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1732} 1733float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1734 return ( viewZ + near ) / ( near - far ); 1735} 1736float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1737 #ifdef USE_REVERSED_DEPTH_BUFFER 1738 1739 return depth * ( far - near ) - far; 1740 #else 1741 return depth * ( near - far ) - near; 1742 #endif 1743} 1744float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1745 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1746} 1747float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1748 1749 #ifdef USE_REVERSED_DEPTH_BUFFER 1750 return ( near * far ) / ( ( near - far ) * depth - near ); 1751 #else 1752 return ( near * far ) / ( ( far - near ) * depth - far ); 1753 #endif 1754}`,Af=`#ifdef PREMULTIPLIED_ALPHA 1755 gl_FragColor.rgb *= gl_FragColor.a; 1756#endif`,Rf=`vec4 mvPosition = vec4( transformed, 1.0 ); 1757#ifdef USE_BATCHING 1758 mvPosition = batchingMatrix * mvPosition; 1759#endif 1760#ifdef USE_INSTANCING 1761 mvPosition = instanceMatrix * mvPosition; 1762#endif 1763mvPosition = modelViewMatrix * mvPosition; 1764gl_Position = projectionMatrix * mvPosition;`,wf=`#ifdef DITHERING 1765 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1766#endif`,Cf=`#ifdef DITHERING 1767 vec3 dithering( vec3 color ) { 1768 float grid_position = rand( gl_FragCoord.xy ); 1769 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1770 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1771 return color + dither_shift_RGB; 1772 } 1773#endif`,Pf=`float roughnessFactor = roughness; 1774#ifdef USE_ROUGHNESSMAP 1775 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1776 roughnessFactor *= texelRoughness.g; 1777#endif`,Df=`#ifdef USE_ROUGHNESSMAP 1778 uniform sampler2D roughnessMap; 1779#endif`,Lf=`#if NUM_SPOT_LIGHT_COORDS > 0 1780 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1781#endif 1782#if NUM_SPOT_LIGHT_MAPS > 0 1783 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1784#endif 1785#ifdef USE_SHADOWMAP 1786 #if NUM_DIR_LIGHT_SHADOWS > 0 1787 #if defined( SHADOWMAP_TYPE_PCF ) 1788 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1789 #else 1790 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1791 #endif 1792 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1793 struct DirectionalLightShadow { 1794 float shadowIntensity; 1795 float shadowBias; 1796 float shadowNormalBias; 1797 float shadowRadius; 1798 vec2 shadowMapSize; 1799 }; 1800 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1801 #endif 1802 #if NUM_SPOT_LIGHT_SHADOWS > 0 1803 #if defined( SHADOWMAP_TYPE_PCF ) 1804 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1805 #else 1806 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1807 #endif 1808 struct SpotLightShadow { 1809 float shadowIntensity; 1810 float shadowBias; 1811 float shadowNormalBias; 1812 float shadowRadius; 1813 vec2 shadowMapSize; 1814 }; 1815 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1816 #endif 1817 #if NUM_POINT_LIGHT_SHADOWS > 0 1818 #if defined( SHADOWMAP_TYPE_PCF ) 1819 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1820 #elif defined( SHADOWMAP_TYPE_BASIC ) 1821 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1822 #endif 1823 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1824 struct PointLightShadow { 1825 float shadowIntensity; 1826 float shadowBias; 1827 float shadowNormalBias; 1828 float shadowRadius; 1829 vec2 shadowMapSize; 1830 float shadowCameraNear; 1831 float shadowCameraFar; 1832 }; 1833 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1834 #endif 1835 #if defined( SHADOWMAP_TYPE_PCF ) 1836 float interleavedGradientNoise( vec2 position ) { 1837 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1838 } 1839 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1840 const float goldenAngle = 2.399963229728653; 1841 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1842 float theta = float( sampleIndex ) * goldenAngle + phi; 1843 return vec2( cos( theta ), sin( theta ) ) * r; 1844 } 1845 #endif 1846 #if defined( SHADOWMAP_TYPE_PCF ) 1847 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1848 float shadow = 1.0; 1849 shadowCoord.xyz /= shadowCoord.w; 1850 shadowCoord.z += shadowBias; 1851 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1852 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1853 if ( frustumTest ) { 1854 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1855 float radius = shadowRadius * texelSize.x; 1856 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1857 shadow = ( 1858 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1859 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1860 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1861 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1862 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1863 ) * 0.2; 1864 } 1865 return mix( 1.0, shadow, shadowIntensity ); 1866 } 1867 #elif defined( SHADOWMAP_TYPE_VSM ) 1868 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1869 float shadow = 1.0; 1870 shadowCoord.xyz /= shadowCoord.w; 1871 #ifdef USE_REVERSED_DEPTH_BUFFER 1872 shadowCoord.z -= shadowBias; 1873 #else 1874 shadowCoord.z += shadowBias; 1875 #endif 1876 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1877 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1878 if ( frustumTest ) { 1879 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1880 float mean = distribution.x; 1881 float variance = distribution.y * distribution.y; 1882 #ifdef USE_REVERSED_DEPTH_BUFFER 1883 float hard_shadow = step( mean, shadowCoord.z ); 1884 #else 1885 float hard_shadow = step( shadowCoord.z, mean ); 1886 #endif 1887 1888 if ( hard_shadow == 1.0 ) { 1889 shadow = 1.0; 1890 } else { 1891 variance = max( variance, 0.0000001 ); 1892 float d = shadowCoord.z - mean; 1893 float p_max = variance / ( variance + d * d ); 1894 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1895 shadow = max( hard_shadow, p_max ); 1896 } 1897 } 1898 return mix( 1.0, shadow, shadowIntensity ); 1899 } 1900 #else 1901 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1902 float shadow = 1.0; 1903 shadowCoord.xyz /= shadowCoord.w; 1904 #ifdef USE_REVERSED_DEPTH_BUFFER 1905 shadowCoord.z -= shadowBias; 1906 #else 1907 shadowCoord.z += shadowBias; 1908 #endif 1909 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1910 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1911 if ( frustumTest ) { 1912 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1913 #ifdef USE_REVERSED_DEPTH_BUFFER 1914 shadow = step( depth, shadowCoord.z ); 1915 #else 1916 shadow = step( shadowCoord.z, depth ); 1917 #endif 1918 } 1919 return mix( 1.0, shadow, shadowIntensity ); 1920 } 1921 #endif 1922 #if NUM_POINT_LIGHT_SHADOWS > 0 1923 #if defined( SHADOWMAP_TYPE_PCF ) 1924 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1925 float shadow = 1.0; 1926 vec3 lightToPosition = shadowCoord.xyz; 1927 vec3 bd3D = normalize( lightToPosition ); 1928 vec3 absVec = abs( lightToPosition ); 1929 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1930 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1931 #ifdef USE_REVERSED_DEPTH_BUFFER 1932 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1933 dp -= shadowBias; 1934 #else 1935 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1936 dp += shadowBias; 1937 #endif 1938 float texelSize = shadowRadius / shadowMapSize.x; 1939 vec3 absDir = abs( bd3D ); 1940 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1941 tangent = normalize( cross( bd3D, tangent ) ); 1942 vec3 bitangent = cross( bd3D, tangent ); 1943 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1944 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1945 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1946 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1947 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1948 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1949 shadow = ( 1950 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1951 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1952 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1953 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1954 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1955 ) * 0.2; 1956 } 1957 return mix( 1.0, shadow, shadowIntensity ); 1958 } 1959 #elif defined( SHADOWMAP_TYPE_BASIC ) 1960 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1961 float shadow = 1.0; 1962 vec3 lightToPosition = shadowCoord.xyz; 1963 vec3 absVec = abs( lightToPosition ); 1964 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1965 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1966 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1967 dp += shadowBias; 1968 vec3 bd3D = normalize( lightToPosition ); 1969 float depth = textureCube( shadowMap, bd3D ).r; 1970 #ifdef USE_REVERSED_DEPTH_BUFFER 1971 depth = 1.0 - depth; 1972 #endif 1973 shadow = step( dp, depth ); 1974 } 1975 return mix( 1.0, shadow, shadowIntensity ); 1976 } 1977 #endif 1978 #endif 1979#endif`,If=`#if NUM_SPOT_LIGHT_COORDS > 0 1980 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1981 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1982#endif 1983#ifdef USE_SHADOWMAP 1984 #if NUM_DIR_LIGHT_SHADOWS > 0 1985 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1986 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1987 struct DirectionalLightShadow { 1988 float shadowIntensity; 1989 float shadowBias; 1990 float shadowNormalBias; 1991 float shadowRadius; 1992 vec2 shadowMapSize; 1993 }; 1994 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1995 #endif 1996 #if NUM_SPOT_LIGHT_SHADOWS > 0 1997 struct SpotLightShadow { 1998 float shadowIntensity; 1999 float shadowBias; 2000 float shadowNormalBias; 2001 float shadowRadius; 2002 vec2 shadowMapSize; 2003 }; 2004 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2005 #endif 2006 #if NUM_POINT_LIGHT_SHADOWS > 0 2007 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2008 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2009 struct PointLightShadow { 2010 float shadowIntensity; 2011 float shadowBias; 2012 float shadowNormalBias; 2013 float shadowRadius; 2014 vec2 shadowMapSize; 2015 float shadowCameraNear; 2016 float shadowCameraFar; 2017 }; 2018 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2019 #endif 2020#endif`,Uf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2021 #ifdef HAS_NORMAL 2022 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 2023 #else 2024 vec3 shadowWorldNormal = vec3( 0.0 ); 2025 #endif 2026 vec4 shadowWorldPosition; 2027#endif 2028#if defined( USE_SHADOWMAP ) 2029 #if NUM_DIR_LIGHT_SHADOWS > 0 2030 #pragma unroll_loop_start 2031 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2032 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2033 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2034 } 2035 #pragma unroll_loop_end 2036 #endif 2037 #if NUM_POINT_LIGHT_SHADOWS > 0 2038 #pragma unroll_loop_start 2039 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2040 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2041 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2042 } 2043 #pragma unroll_loop_end 2044 #endif 2045#endif
2046#if NUM_SPOT_LIGHT_COORDS > 0 2047 #pragma unroll_loop_start 2048 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2049 shadowWorldPosition = worldPosition; 2050 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2051 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2052 #endif 2053 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2054 } 2055 #pragma unroll_loop_end 2056#endif`,Nf=`float getShadowMask() { 2057 float shadow = 1.0; 2058 #ifdef USE_SHADOWMAP 2059 #if NUM_DIR_LIGHT_SHADOWS > 0 2060 DirectionalLightShadow directionalLight; 2061 #pragma unroll_loop_start 2062 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2063 directionalLight = directionalLightShadows[ i ]; 2064 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2065 } 2066 #pragma unroll_loop_end 2067 #endif 2068 #if NUM_SPOT_LIGHT_SHADOWS > 0 2069 SpotLightShadow spotLight; 2070 #pragma unroll_loop_start 2071 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2072 spotLight = spotLightShadows[ i ]; 2073 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2074 } 2075 #pragma unroll_loop_end 2076 #endif 2077 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2078 PointLightShadow pointLight; 2079 #pragma unroll_loop_start 2080 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2081 pointLight = pointLightShadows[ i ]; 2082 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2083 } 2084 #pragma unroll_loop_end 2085 #endif 2086 #endif 2087 return shadow; 2088}`,Ff=`#ifdef USE_SKINNING 2089 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2090 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2091 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2092 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2093#endif`,Of=`#ifdef USE_SKINNING 2094 uniform mat4 bindMatrix; 2095 uniform mat4 bindMatrixInverse; 2096 uniform highp sampler2D boneTexture; 2097 mat4 getBoneMatrix( const in float i ) { 2098 int size = textureSize( boneTexture, 0 ).x; 2099 int j = int( i ) * 4; 2100 int x = j % size; 2101 int y = j / size; 2102 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2103 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2104 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2105 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2106 return mat4( v1, v2, v3, v4 ); 2107 } 2108#endif`,Bf=`#ifdef USE_SKINNING 2109 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2110 vec4 skinned = vec4( 0.0 ); 2111 skinned += boneMatX * skinVertex * skinWeight.x; 2112 skinned += boneMatY * skinVertex * skinWeight.y; 2113 skinned += boneMatZ * skinVertex * skinWeight.z; 2114 skinned += boneMatW * skinVertex * skinWeight.w; 2115 transformed = ( bindMatrixInverse * skinned ).xyz; 2116#endif`,zf=`#ifdef USE_SKINNING 2117 mat4 skinMatrix = mat4( 0.0 ); 2118 skinMatrix += skinWeight.x * boneMatX; 2119 skinMatrix += skinWeight.y * boneMatY; 2120 skinMatrix += skinWeight.z * boneMatZ; 2121 skinMatrix += skinWeight.w * boneMatW; 2122 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2123 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2124 #ifdef USE_TANGENT 2125 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2126 #endif 2127#endif`,Gf=`float specularStrength; 2128#ifdef USE_SPECULARMAP 2129 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2130 specularStrength = texelSpecular.r; 2131#else 2132 specularStrength = 1.0; 2133#endif`,Vf=`#ifdef USE_SPECULARMAP 2134 uniform sampler2D specularMap; 2135#endif`,Hf=`#if defined( TONE_MAPPING ) 2136 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2137#endif`,kf=`#ifndef saturate 2138#define saturate( a ) clamp( a, 0.0, 1.0 ) 2139#endif 2140uniform float toneMappingExposure; 2141vec3 LinearToneMapping( vec3 color ) { 2142 return saturate( toneMappingExposure * color ); 2143} 2144vec3 ReinhardToneMapping( vec3 color ) { 2145 color *= toneMappingExposure; 2146 return saturate( color / ( vec3( 1.0 ) + color ) ); 2147} 2148vec3 CineonToneMapping( vec3 color ) { 2149 color *= toneMappingExposure; 2150 color = max( vec3( 0.0 ), color - 0.004 ); 2151 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2152} 2153vec3 RRTAndODTFit( vec3 v ) { 2154 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2155 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2156 return a / b; 2157} 2158vec3 ACESFilmicToneMapping( vec3 color ) { 2159 const mat3 ACESInputMat = mat3( 2160 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2161 vec3( 0.04823, 0.01566, 0.83777 ) 2162 ); 2163 const mat3 ACESOutputMat = mat3( 2164 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2165 vec3( -0.07367, -0.00605, 1.07602 ) 2166 ); 2167 color *= toneMappingExposure / 0.6; 2168 color = ACESInputMat * color; 2169 color = RRTAndODTFit( color ); 2170 color = ACESOutputMat * color; 2171 return saturate( color ); 2172} 2173const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2174 vec3( 1.6605, - 0.1246, - 0.0182 ), 2175 vec3( - 0.5876, 1.1329, - 0.1006 ), 2176 vec3( - 0.0728, - 0.0083, 1.1187 ) 2177); 2178const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2179 vec3( 0.6274, 0.0691, 0.0164 ), 2180 vec3( 0.3293, 0.9195, 0.0880 ), 2181 vec3( 0.0433, 0.0113, 0.8956 ) 2182); 2183vec3 agxDefaultContrastApprox( vec3 x ) { 2184 vec3 x2 = x * x; 2185 vec3 x4 = x2 * x2; 2186 return + 15.5 * x4 * x2 2187 - 40.14 * x4 * x 2188 + 31.96 * x4 2189 - 6.868 * x2 * x 2190 + 0.4298 * x2 2191 + 0.1191 * x 2192 - 0.00232; 2193} 2194vec3 AgXToneMapping( vec3 color ) { 2195 const mat3 AgXInsetMatrix = mat3( 2196 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2197 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2198 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2199 );
2200 const mat3 AgXOutsetMatrix = mat3( 2201 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2202 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2203 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2204 ); 2205 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2206 color *= toneMappingExposure; 2207 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2208 color = AgXInsetMatrix * color; 2209 color = max( color, 1e-10 ); color = log2( color ); 2210 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2211 color = clamp( color, 0.0, 1.0 ); 2212 color = agxDefaultContrastApprox( color ); 2213 color = AgXOutsetMatrix * color; 2214 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2215 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2216 color = clamp( color, 0.0, 1.0 ); 2217 return color; 2218} 2219vec3 NeutralToneMapping( vec3 color ) { 2220 const float StartCompression = 0.8 - 0.04; 2221 const float Desaturation = 0.15; 2222 color *= toneMappingExposure; 2223 float x = min( color.r, min( color.g, color.b ) ); 2224 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2225 color -= offset; 2226 float peak = max( color.r, max( color.g, color.b ) ); 2227 if ( peak < StartCompression ) return color; 2228 float d = 1. - StartCompression; 2229 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2230 color *= newPeak / peak; 2231 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2232 return mix( color, vec3( newPeak ), g ); 2233} 2234vec3 CustomToneMapping( vec3 color ) { return color; }`,Wf=`#ifdef USE_TRANSMISSION 2235 material.transmission = transmission; 2236 material.transmissionAlpha = 1.0; 2237 material.thickness = thickness; 2238 material.attenuationDistance = attenuationDistance; 2239 material.attenuationColor = attenuationColor; 2240 #ifdef USE_TRANSMISSIONMAP 2241 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2242 #endif 2243 #ifdef USE_THICKNESSMAP 2244 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2245 #endif 2246 vec3 pos = vWorldPosition; 2247 vec3 v = normalize( cameraPosition - pos ); 2248 vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix ); 2249 vec4 transmitted = getIBLVolumeRefraction( 2250 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2251 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2252 material.attenuationColor, material.attenuationDistance ); 2253 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2254 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2255#endif`,Xf=`#ifdef USE_TRANSMISSION 2256 uniform float transmission; 2257 uniform float thickness; 2258 uniform float attenuationDistance; 2259 uniform vec3 attenuationColor; 2260 #ifdef USE_TRANSMISSIONMAP 2261 uniform sampler2D transmissionMap; 2262 #endif 2263 #ifdef USE_THICKNESSMAP 2264 uniform sampler2D thicknessMap; 2265 #endif 2266 uniform vec2 transmissionSamplerSize; 2267 uniform sampler2D transmissionSamplerMap; 2268 uniform mat4 modelMatrix; 2269 uniform mat4 projectionMatrix; 2270 varying vec3 vWorldPosition; 2271 float w0( float a ) { 2272 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2273 } 2274 float w1( float a ) { 2275 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2276 } 2277 float w2( float a ){ 2278 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2279 } 2280 float w3( float a ) { 2281 return ( 1.0 / 6.0 ) * ( a * a * a ); 2282 } 2283 float g0( float a ) { 2284 return w0( a ) + w1( a ); 2285 } 2286 float g1( float a ) { 2287 return w2( a ) + w3( a ); 2288 } 2289 float h0( float a ) { 2290 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2291 } 2292 float h1( float a ) { 2293 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2294 } 2295 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2296 uv = uv * texelSize.zw + 0.5; 2297 vec2 iuv = floor( uv ); 2298 vec2 fuv = fract( uv ); 2299 float g0x = g0( fuv.x ); 2300 float g1x = g1( fuv.x ); 2301 float h0x = h0( fuv.x ); 2302 float h1x = h1( fuv.x ); 2303 float h0y = h0( fuv.y ); 2304 float h1y = h1( fuv.y ); 2305 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2306 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2307 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2308 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2309 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2310 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2311 } 2312 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2313 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2314 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2315 vec2 fLodSizeInv = 1.0 / fLodSize; 2316 vec2 cLodSizeInv = 1.0 / cLodSize; 2317 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2318 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2319 return mix( fSample, cSample, fract( lod ) ); 2320 } 2321 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2322 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2323 vec3 modelScale; 2324 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2325 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2326 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2327 return normalize( refractionVector ) * thickness * modelScale; 2328 } 2329 float applyIorToRoughness( const in float roughness, const in float ior ) { 2330 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2331 } 2332 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2333 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2334 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2335 } 2336 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2337 if ( isinf( attenuationDistance ) ) { 2338 return vec3( 1.0 ); 2339 } else { 2340 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2341 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2342 } 2343 } 2344 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2345 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2346 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2347 const in vec3 attenuationColor, const in float attenuationDistance ) { 2348 vec4 transmittedLight; 2349 vec3 transmittance; 2350 #ifdef USE_DISPERSION 2351 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2352 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2353 for ( int i = 0; i < 3; i ++ ) { 2354 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2355 vec3 refractedRayExit = position + transmissionRay; 2356 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2357 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2358 refractionCoords += 1.0; 2359 refractionCoords /= 2.0; 2360 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2361 transmittedLight[ i ] = transmissionSample[ i ]; 2362 transmittedLight.a += transmissionSample.a; 2363 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2364 } 2365 transmittedLight.a /= 3.0; 2366 #else 2367 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2368 vec3 refractedRayExit = position + transmissionRay; 2369 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2370 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2371 refractionCoords += 1.0; 2372 refractionCoords /= 2.0; 2373 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2374 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2375 #endif 2376 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2377 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2378 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2379 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2380 } 2381#endif`,qf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2382 varying vec2 vUv; 2383#endif 2384#ifdef USE_MAP 2385 varying vec2 vMapUv; 2386#endif 2387#ifdef USE_ALPHAMAP
2388 varying vec2 vAlphaMapUv; 2389#endif 2390#ifdef USE_LIGHTMAP 2391 varying vec2 vLightMapUv; 2392#endif 2393#ifdef USE_AOMAP 2394 varying vec2 vAoMapUv; 2395#endif 2396#ifdef USE_BUMPMAP 2397 varying vec2 vBumpMapUv; 2398#endif 2399#ifdef USE_NORMALMAP 2400 varying vec2 vNormalMapUv; 2401#endif 2402#ifdef USE_EMISSIVEMAP 2403 varying vec2 vEmissiveMapUv; 2404#endif 2405#ifdef USE_METALNESSMAP 2406 varying vec2 vMetalnessMapUv; 2407#endif 2408#ifdef USE_ROUGHNESSMAP 2409 varying vec2 vRoughnessMapUv; 2410#endif 2411#ifdef USE_ANISOTROPYMAP 2412 varying vec2 vAnisotropyMapUv; 2413#endif 2414#ifdef USE_CLEARCOATMAP 2415 varying vec2 vClearcoatMapUv; 2416#endif 2417#ifdef USE_CLEARCOAT_NORMALMAP 2418 varying vec2 vClearcoatNormalMapUv; 2419#endif 2420#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2421 varying vec2 vClearcoatRoughnessMapUv; 2422#endif 2423#ifdef USE_IRIDESCENCEMAP 2424 varying vec2 vIridescenceMapUv; 2425#endif 2426#ifdef USE_IRIDESCENCE_THICKNESSMAP 2427 varying vec2 vIridescenceThicknessMapUv; 2428#endif 2429#ifdef USE_SHEEN_COLORMAP 2430 varying vec2 vSheenColorMapUv; 2431#endif 2432#ifdef USE_SHEEN_ROUGHNESSMAP 2433 varying vec2 vSheenRoughnessMapUv; 2434#endif 2435#ifdef USE_SPECULARMAP 2436 varying vec2 vSpecularMapUv; 2437#endif 2438#ifdef USE_SPECULAR_COLORMAP 2439 varying vec2 vSpecularColorMapUv; 2440#endif 2441#ifdef USE_SPECULAR_INTENSITYMAP 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`,Yf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2452 varying vec2 vUv; 2453#endif 2454#ifdef USE_MAP 2455 uniform mat3 mapTransform; 2456 varying vec2 vMapUv; 2457#endif 2458#ifdef USE_ALPHAMAP 2459 uniform mat3 alphaMapTransform; 2460 varying vec2 vAlphaMapUv; 2461#endif 2462#ifdef USE_LIGHTMAP 2463 uniform mat3 lightMapTransform; 2464 varying vec2 vLightMapUv; 2465#endif 2466#ifdef USE_AOMAP 2467 uniform mat3 aoMapTransform; 2468 varying vec2 vAoMapUv; 2469#endif 2470#ifdef USE_BUMPMAP 2471 uniform mat3 bumpMapTransform; 2472 varying vec2 vBumpMapUv; 2473#endif 2474#ifdef USE_NORMALMAP 2475 uniform mat3 normalMapTransform; 2476 varying vec2 vNormalMapUv; 2477#endif 2478#ifdef USE_DISPLACEMENTMAP 2479 uniform mat3 displacementMapTransform; 2480 varying vec2 vDisplacementMapUv; 2481#endif 2482#ifdef USE_EMISSIVEMAP 2483 uniform mat3 emissiveMapTransform; 2484 varying vec2 vEmissiveMapUv; 2485#endif 2486#ifdef USE_METALNESSMAP 2487 uniform mat3 metalnessMapTransform; 2488 varying vec2 vMetalnessMapUv; 2489#endif 2490#ifdef USE_ROUGHNESSMAP 2491 uniform mat3 roughnessMapTransform; 2492 varying vec2 vRoughnessMapUv; 2493#endif 2494#ifdef USE_ANISOTROPYMAP 2495 uniform mat3 anisotropyMapTransform; 2496 varying vec2 vAnisotropyMapUv; 2497#endif 2498#ifdef USE_CLEARCOATMAP 2499 uniform mat3 clearcoatMapTransform; 2500 varying vec2 vClearcoatMapUv; 2501#endif 2502#ifdef USE_CLEARCOAT_NORMALMAP 2503 uniform mat3 clearcoatNormalMapTransform; 2504 varying vec2 vClearcoatNormalMapUv; 2505#endif 2506#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2507 uniform mat3 clearcoatRoughnessMapTransform; 2508 varying vec2 vClearcoatRoughnessMapUv; 2509#endif 2510#ifdef USE_SHEEN_COLORMAP 2511 uniform mat3 sheenColorMapTransform; 2512 varying vec2 vSheenColorMapUv; 2513#endif 2514#ifdef USE_SHEEN_ROUGHNESSMAP 2515 uniform mat3 sheenRoughnessMapTransform; 2516 varying vec2 vSheenRoughnessMapUv; 2517#endif 2518#ifdef USE_IRIDESCENCEMAP 2519 uniform mat3 iridescenceMapTransform; 2520 varying vec2 vIridescenceMapUv; 2521#endif 2522#ifdef USE_IRIDESCENCE_THICKNESSMAP 2523 uniform mat3 iridescenceThicknessMapTransform; 2524 varying vec2 vIridescenceThicknessMapUv; 2525#endif 2526#ifdef USE_SPECULARMAP 2527 uniform mat3 specularMapTransform; 2528 varying vec2 vSpecularMapUv; 2529#endif 2530#ifdef USE_SPECULAR_COLORMAP 2531 uniform mat3 specularColorMapTransform; 2532 varying vec2 vSpecularColorMapUv; 2533#endif 2534#ifdef USE_SPECULAR_INTENSITYMAP 2535 uniform mat3 specularIntensityMapTransform; 2536 varying vec2 vSpecularIntensityMapUv; 2537#endif 2538#ifdef USE_TRANSMISSIONMAP 2539 uniform mat3 transmissionMapTransform; 2540 varying vec2 vTransmissionMapUv; 2541#endif 2542#ifdef USE_THICKNESSMAP 2543 uniform mat3 thicknessMapTransform; 2544 varying vec2 vThicknessMapUv; 2545#endif`,Kf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2546 vUv = vec3( uv, 1 ).xy; 2547#endif 2548#ifdef USE_MAP 2549 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2550#endif 2551#ifdef USE_ALPHAMAP 2552 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2553#endif 2554#ifdef USE_LIGHTMAP 2555 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2556#endif 2557#ifdef USE_AOMAP 2558 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2559#endif 2560#ifdef USE_BUMPMAP 2561 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2562#endif 2563#ifdef USE_NORMALMAP 2564 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2565#endif 2566#ifdef USE_DISPLACEMENTMAP 2567 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2568#endif 2569#ifdef USE_EMISSIVEMAP 2570 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2571#endif 2572#ifdef USE_METALNESSMAP 2573 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2574#endif 2575#ifdef USE_ROUGHNESSMAP 2576 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2577#endif 2578#ifdef USE_ANISOTROPYMAP 2579 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2580#endif 2581#ifdef USE_CLEARCOATMAP 2582 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2583#endif 2584#ifdef USE_CLEARCOAT_NORMALMAP 2585 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2586#endif 2587#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2588 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2589#endif
2590#ifdef USE_IRIDESCENCEMAP 2591 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2592#endif 2593#ifdef USE_IRIDESCENCE_THICKNESSMAP 2594 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2595#endif 2596#ifdef USE_SHEEN_COLORMAP 2597 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2598#endif 2599#ifdef USE_SHEEN_ROUGHNESSMAP 2600 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2601#endif 2602#ifdef USE_SPECULARMAP 2603 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2604#endif 2605#ifdef USE_SPECULAR_COLORMAP 2606 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2607#endif 2608#ifdef USE_SPECULAR_INTENSITYMAP 2609 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2610#endif 2611#ifdef USE_TRANSMISSIONMAP 2612 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2613#endif 2614#ifdef USE_THICKNESSMAP 2615 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2616#endif`,Zf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2617 vec4 worldPosition = vec4( transformed, 1.0 ); 2618 #ifdef USE_BATCHING 2619 worldPosition = batchingMatrix * worldPosition; 2620 #endif 2621 #ifdef USE_INSTANCING 2622 worldPosition = instanceMatrix * worldPosition; 2623 #endif 2624 worldPosition = modelMatrix * worldPosition; 2625#endif`;const $f=`varying vec2 vUv; 2626uniform mat3 uvTransform; 2627void main() { 2628 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2629 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2630}`,Jf=`uniform sampler2D t2D; 2631uniform float backgroundIntensity; 2632varying vec2 vUv; 2633void main() { 2634 vec4 texColor = texture2D( t2D, vUv ); 2635 #ifdef DECODE_VIDEO_TEXTURE 2636 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 ); 2637 #endif 2638 texColor.rgb *= backgroundIntensity; 2639 gl_FragColor = texColor; 2640 #include <tonemapping_fragment> 2641 #include <colorspace_fragment> 2642}`,Qf=`varying vec3 vWorldDirection; 2643#include <common> 2644void main() { 2645 vWorldDirection = transformDirection( position, modelMatrix ); 2646 #include <begin_vertex> 2647 #include <project_vertex> 2648 gl_Position.z = gl_Position.w; 2649}`,jf=`#ifdef ENVMAP_TYPE_CUBE 2650 uniform samplerCube envMap; 2651#elif defined( ENVMAP_TYPE_CUBE_UV ) 2652 uniform sampler2D envMap; 2653#endif 2654uniform float backgroundBlurriness; 2655uniform float backgroundIntensity; 2656uniform mat3 backgroundRotation; 2657varying vec3 vWorldDirection; 2658#include <cube_uv_reflection_fragment> 2659void main() { 2660 #ifdef ENVMAP_TYPE_CUBE 2661 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 2662 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2663 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2664 #else 2665 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2666 #endif 2667 texColor.rgb *= backgroundIntensity; 2668 gl_FragColor = texColor; 2669 #include <tonemapping_fragment> 2670 #include <colorspace_fragment> 2671}`,eh=`varying vec3 vWorldDirection; 2672#include <common> 2673void main() { 2674 vWorldDirection = transformDirection( position, modelMatrix ); 2675 #include <begin_vertex> 2676 #include <project_vertex> 2677 gl_Position.z = gl_Position.w; 2678}`,th=`uniform samplerCube tCube; 2679uniform float tFlip; 2680uniform float opacity; 2681varying vec3 vWorldDirection; 2682void main() { 2683 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2684 gl_FragColor = texColor; 2685 gl_FragColor.a *= opacity; 2686 #include <tonemapping_fragment> 2687 #include <colorspace_fragment> 2688}`,nh=`#include <common> 2689#include <batching_pars_vertex> 2690#include <uv_pars_vertex> 2691#include <displacementmap_pars_vertex> 2692#include <morphtarget_pars_vertex> 2693#include <skinning_pars_vertex> 2694#include <logdepthbuf_pars_vertex> 2695#include <clipping_planes_pars_vertex> 2696varying vec2 vHighPrecisionZW; 2697void main() { 2698 #include <uv_vertex> 2699 #include <batching_vertex> 2700 #include <skinbase_vertex> 2701 #include <morphinstance_vertex> 2702 #ifdef USE_DISPLACEMENTMAP 2703 #include <beginnormal_vertex> 2704 #include <morphnormal_vertex> 2705 #include <skinnormal_vertex> 2706 #endif 2707 #include <begin_vertex> 2708 #include <morphtarget_vertex> 2709 #include <skinning_vertex> 2710 #include <displacementmap_vertex> 2711 #include <project_vertex> 2712 #include <logdepthbuf_vertex> 2713 #include <clipping_planes_vertex> 2714 vHighPrecisionZW = gl_Position.zw; 2715}`,ih=`#if DEPTH_PACKING == 3200 2716 uniform float opacity; 2717#endif 2718#include <common> 2719#include <packing> 2720#include <uv_pars_fragment> 2721#include <map_pars_fragment> 2722#include <alphamap_pars_fragment> 2723#include <alphatest_pars_fragment> 2724#include <alphahash_pars_fragment> 2725#include <logdepthbuf_pars_fragment> 2726#include <clipping_planes_pars_fragment> 2727varying vec2 vHighPrecisionZW; 2728void main() { 2729 vec4 diffuseColor = vec4( 1.0 ); 2730 #include <clipping_planes_fragment> 2731 #if DEPTH_PACKING == 3200 2732 diffuseColor.a = opacity; 2733 #endif 2734 #include <map_fragment> 2735 #include <alphamap_fragment> 2736 #include <alphatest_fragment> 2737 #include <alphahash_fragment> 2738 #include <logdepthbuf_fragment> 2739 #ifdef USE_REVERSED_DEPTH_BUFFER 2740 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2741 #else 2742 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2743 #endif 2744 #if DEPTH_PACKING == 3200 2745 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2746 #elif DEPTH_PACKING == 3201 2747 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2748 #elif DEPTH_PACKING == 3202 2749 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2750 #elif DEPTH_PACKING == 3203 2751 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2752 #endif 2753}`,rh=`#define DISTANCE 2754varying vec3 vWorldPosition; 2755#include <common> 2756#include <batching_pars_vertex> 2757#include <uv_pars_vertex> 2758#include <displacementmap_pars_vertex> 2759#include <morphtarget_pars_vertex> 2760#include <skinning_pars_vertex> 2761#include <clipping_planes_pars_vertex> 2762void main() { 2763 #include <uv_vertex> 2764 #include <batching_vertex> 2765 #include <skinbase_vertex> 2766 #include <morphinstance_vertex> 2767 #ifdef USE_DISPLACEMENTMAP 2768 #include <beginnormal_vertex> 2769 #include <morphnormal_vertex> 2770 #include <skinnormal_vertex> 2771 #endif 2772 #include <begin_vertex> 2773 #include <morphtarget_vertex> 2774 #include <skinning_vertex> 2775 #include <displacementmap_vertex> 2776 #include <project_vertex> 2777 #include <worldpos_vertex> 2778 #include <clipping_planes_vertex> 2779 vWorldPosition = worldPosition.xyz; 2780}`,sh=`#define DISTANCE 2781uniform vec3 referencePosition; 2782uniform float nearDistance; 2783uniform float farDistance; 2784varying vec3 vWorldPosition; 2785#include <common> 2786#include <uv_pars_fragment> 2787#include <map_pars_fragment> 2788#include <alphamap_pars_fragment> 2789#include <alphatest_pars_fragment> 2790#include <alphahash_pars_fragment> 2791#include <clipping_planes_pars_fragment> 2792void main() { 2793 vec4 diffuseColor = vec4( 1.0 ); 2794 #include <clipping_planes_fragment> 2795 #include <map_fragment> 2796 #include <alphamap_fragment> 2797 #include <alphatest_fragment> 2798 #include <alphahash_fragment> 2799 float dist = length( vWorldPosition - referencePosition ); 2800 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2801 dist = saturate( dist ); 2802 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2803}`,ah=`varying vec3 vWorldDirection; 2804#include <common> 2805void main() { 2806 vWorldDirection = transformDirection( position, modelMatrix ); 2807 #include <begin_vertex> 2808 #include <project_vertex> 2809}`,oh=`uniform sampler2D tEquirect; 2810varying vec3 vWorldDirection; 2811#include <common> 2812void main() { 2813 vec3 direction = normalize( vWorldDirection ); 2814 vec2 sampleUV = equirectUv( direction ); 2815 gl_FragColor = texture2D( tEquirect, sampleUV ); 2816 #include <tonemapping_fragment> 2817 #include <colorspace_fragment> 2818}`,lh=`uniform float scale; 2819attribute float lineDistance; 2820varying float vLineDistance; 2821#include <common> 2822#include <uv_pars_vertex> 2823#include <color_pars_vertex> 2824#include <fog_pars_vertex> 2825#include <morphtarget_pars_vertex> 2826#include <logdepthbuf_pars_vertex> 2827#include <clipping_planes_pars_vertex> 2828void main() { 2829 vLineDistance = scale * lineDistance; 2830 #include <uv_vertex> 2831 #include <color_vertex> 2832 #include <morphinstance_vertex> 2833 #include <morphcolor_vertex> 2834 #include <begin_vertex> 2835 #include <morphtarget_vertex> 2836 #include <project_vertex> 2837 #include <logdepthbuf_vertex> 2838 #include <clipping_planes_vertex> 2839 #include <fog_vertex> 2840}`,ch=`uniform vec3 diffuse; 2841uniform float opacity; 2842uniform float dashSize; 2843uniform float totalSize; 2844varying float vLineDistance; 2845#include <common> 2846#include <color_pars_fragment> 2847#include <uv_pars_fragment> 2848#include <map_pars_fragment> 2849#include <fog_pars_fragment> 2850#include <logdepthbuf_pars_fragment> 2851#include <clipping_planes_pars_fragment> 2852void main() { 2853 vec4 diffuseColor = vec4( diffuse, opacity ); 2854 #include <clipping_planes_fragment> 2855 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2856 discard; 2857 } 2858 vec3 outgoingLight = vec3( 0.0 ); 2859 #include <logdepthbuf_fragment> 2860 #include <map_fragment> 2861 #include <color_fragment> 2862 outgoingLight = diffuseColor.rgb; 2863 #include <opaque_fragment> 2864 #include <tonemapping_fragment> 2865 #include <colorspace_fragment> 2866 #include <fog_fragment> 2867 #include <premultiplied_alpha_fragment> 2868}`,uh=`#include <common> 2869#include <batching_pars_vertex> 2870#include <uv_pars_vertex> 2871#include <envmap_pars_vertex> 2872#include <color_pars_vertex> 2873#include <fog_pars_vertex> 2874#include <morphtarget_pars_vertex> 2875#include <skinning_pars_vertex> 2876#include <logdepthbuf_pars_vertex> 2877#include <clipping_planes_pars_vertex> 2878void main() { 2879 #include <uv_vertex> 2880 #include <color_vertex> 2881 #include <morphinstance_vertex> 2882 #include <morphcolor_vertex> 2883 #include <batching_vertex> 2884 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2885 #include <beginnormal_vertex> 2886 #include <morphnormal_vertex> 2887 #include <skinbase_vertex> 2888 #include <skinnormal_vertex> 2889 #include <defaultnormal_vertex> 2890 #endif 2891 #include <begin_vertex> 2892 #include <morphtarget_vertex> 2893 #include <skinning_vertex> 2894 #include <project_vertex> 2895 #include <logdepthbuf_vertex> 2896 #include <clipping_planes_vertex> 2897 #include <worldpos_vertex> 2898 #include <envmap_vertex> 2899 #include <fog_vertex> 2900}`,fh=`uniform vec3 diffuse; 2901uniform float opacity; 2902#ifndef FLAT_SHADED 2903 varying vec3 vNormal; 2904#endif 2905#include <common> 2906#include <dithering_pars_fragment> 2907#include <color_pars_fragment> 2908#include <uv_pars_fragment> 2909#include <map_pars_fragment> 2910#include <alphamap_pars_fragment> 2911#include <alphatest_pars_fragment> 2912#include <alphahash_pars_fragment> 2913#include <aomap_pars_fragment> 2914#include <lightmap_pars_fragment> 2915#include <envmap_common_pars_fragment> 2916#include <envmap_pars_fragment> 2917#include <fog_pars_fragment> 2918#include <specularmap_pars_fragment> 2919#include <logdepthbuf_pars_fragment> 2920#include <clipping_planes_pars_fragment> 2921void main() { 2922 vec4 diffuseColor = vec4( diffuse, opacity ); 2923 #include <clipping_planes_fragment> 2924 #include <logdepthbuf_fragment> 2925 #include <map_fragment> 2926 #include <color_fragment> 2927 #include <alphamap_fragment> 2928 #include <alphatest_fragment> 2929 #include <alphahash_fragment> 2930 #include <specularmap_fragment> 2931 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2932 #ifdef USE_LIGHTMAP 2933 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2934 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2935 #else 2936 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2937 #endif 2938 #include <aomap_fragment> 2939 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2940 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2941 #include <envmap_fragment> 2942 #include <opaque_fragment> 2943 #include <tonemapping_fragment> 2944 #include <colorspace_fragment> 2945 #include <fog_fragment> 2946 #include <premultiplied_alpha_fragment> 2947 #include <dithering_fragment> 2948}`,hh=`#define LAMBERT 2949varying vec3 vViewPosition; 2950#include <common> 2951#include <batching_pars_vertex> 2952#include <uv_pars_vertex> 2953#include <displacementmap_pars_vertex> 2954#include <envmap_pars_vertex> 2955#include <color_pars_vertex> 2956#include <fog_pars_vertex> 2957#include <normal_pars_vertex> 2958#include <morphtarget_pars_vertex> 2959#include <skinning_pars_vertex> 2960#include <shadowmap_pars_vertex> 2961#include <logdepthbuf_pars_vertex> 2962#include <clipping_planes_pars_vertex> 2963void main() { 2964 #include <uv_vertex> 2965 #include <color_vertex> 2966 #include <morphinstance_vertex> 2967 #include <morphcolor_vertex> 2968 #include <batching_vertex> 2969 #include <beginnormal_vertex> 2970 #include <morphnormal_vertex> 2971 #include <skinbase_vertex> 2972 #include <skinnormal_vertex> 2973 #include <defaultnormal_vertex> 2974 #include <normal_vertex> 2975 #include <begin_vertex> 2976 #include <morphtarget_vertex> 2977 #include <skinning_vertex> 2978 #include <displacementmap_vertex> 2979 #include <project_vertex> 2980 #include <logdepthbuf_vertex> 2981 #include <clipping_planes_vertex> 2982 vViewPosition = - mvPosition.xyz; 2983 #include <worldpos_vertex> 2984 #include <envmap_vertex> 2985 #include <shadowmap_vertex> 2986 #include <fog_vertex> 2987}`,dh=`#define LAMBERT 2988uniform vec3 diffuse; 2989uniform vec3 emissive; 2990uniform float opacity; 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 <aomap_pars_fragment> 3000#include <lightmap_pars_fragment> 3001#include <emissivemap_pars_fragment> 3002#include <cube_uv_reflection_fragment> 3003#include <envmap_common_pars_fragment> 3004#include <envmap_pars_fragment> 3005#include <envmap_physical_pars_fragment> 3006#include <fog_pars_fragment> 3007#include <bsdfs> 3008#include <lights_pars_begin> 3009#include <normal_pars_fragment> 3010#include <lights_lambert_pars_fragment> 3011#include <shadowmap_pars_fragment> 3012#include <bumpmap_pars_fragment> 3013#include <normalmap_pars_fragment> 3014#include <specularmap_pars_fragment> 3015#include <logdepthbuf_pars_fragment> 3016#include <clipping_planes_pars_fragment> 3017void main() { 3018 vec4 diffuseColor = vec4( diffuse, opacity ); 3019 #include <clipping_planes_fragment> 3020 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3021 vec3 totalEmissiveRadiance = emissive; 3022 #include <logdepthbuf_fragment> 3023 #include <map_fragment> 3024 #include <color_fragment> 3025 #include <alphamap_fragment> 3026 #include <alphatest_fragment> 3027 #include <alphahash_fragment> 3028 #include <specularmap_fragment> 3029 #include <normal_fragment_begin> 3030 #include <normal_fragment_maps> 3031 #include <emissivemap_fragment> 3032 #include <lights_lambert_fragment> 3033 #include <lights_fragment_begin> 3034 #include <lights_fragment_maps> 3035 #include <lights_fragment_end> 3036 #include <aomap_fragment> 3037 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3038 #include <envmap_fragment> 3039 #include <opaque_fragment> 3040 #include <tonemapping_fragment> 3041 #include <colorspace_fragment> 3042 #include <fog_fragment> 3043 #include <premultiplied_alpha_fragment> 3044 #include <dithering_fragment> 3045}`,ph=`#define MATCAP 3046varying vec3 vViewPosition; 3047#include <common> 3048#include <batching_pars_vertex> 3049#include <uv_pars_vertex> 3050#include <color_pars_vertex> 3051#include <displacementmap_pars_vertex> 3052#include <fog_pars_vertex> 3053#include <normal_pars_vertex> 3054#include <morphtarget_pars_vertex> 3055#include <skinning_pars_vertex> 3056#include <logdepthbuf_pars_vertex> 3057#include <clipping_planes_pars_vertex> 3058void main() { 3059 #include <uv_vertex> 3060 #include <color_vertex> 3061 #include <morphinstance_vertex> 3062 #include <morphcolor_vertex> 3063 #include <batching_vertex> 3064 #include <beginnormal_vertex> 3065 #include <morphnormal_vertex> 3066 #include <skinbase_vertex> 3067 #include <skinnormal_vertex> 3068 #include <defaultnormal_vertex> 3069 #include <normal_vertex> 3070 #include <begin_vertex> 3071 #include <morphtarget_vertex> 3072 #include <skinning_vertex> 3073 #include <displacementmap_vertex> 3074 #include <project_vertex> 3075 #include <logdepthbuf_vertex> 3076 #include <clipping_planes_vertex> 3077 #include <fog_vertex> 3078 vViewPosition = - mvPosition.xyz; 3079}`,mh=`#define MATCAP 3080uniform vec3 diffuse; 3081uniform float opacity; 3082uniform sampler2D matcap; 3083varying vec3 vViewPosition; 3084#include <common> 3085#include <dithering_pars_fragment> 3086#include <color_pars_fragment> 3087#include <uv_pars_fragment> 3088#include <map_pars_fragment> 3089#include <alphamap_pars_fragment> 3090#include <alphatest_pars_fragment> 3091#include <alphahash_pars_fragment> 3092#include <fog_pars_fragment> 3093#include <normal_pars_fragment> 3094#include <bumpmap_pars_fragment> 3095#include <normalmap_pars_fragmen
3095t> 3096#include <logdepthbuf_pars_fragment> 3097#include <clipping_planes_pars_fragment> 3098void main() { 3099 vec4 diffuseColor = vec4( diffuse, opacity ); 3100 #include <clipping_planes_fragment> 3101 #include <logdepthbuf_fragment> 3102 #include <map_fragment> 3103 #include <color_fragment> 3104 #include <alphamap_fragment> 3105 #include <alphatest_fragment> 3106 #include <alphahash_fragment> 3107 #include <normal_fragment_begin> 3108 #include <normal_fragment_maps> 3109 vec3 viewDir = normalize( vViewPosition ); 3110 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3111 vec3 y = cross( viewDir, x ); 3112 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3113 #ifdef USE_MATCAP 3114 vec4 matcapColor = texture2D( matcap, uv ); 3115 #else 3116 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3117 #endif 3118 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3119 #include <opaque_fragment> 3120 #include <tonemapping_fragment> 3121 #include <colorspace_fragment> 3122 #include <fog_fragment> 3123 #include <premultiplied_alpha_fragment> 3124 #include <dithering_fragment> 3125}`,gh=`#define NORMAL 3126#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3127 varying vec3 vViewPosition; 3128#endif 3129#include <common> 3130#include <batching_pars_vertex> 3131#include <uv_pars_vertex> 3132#include <displacementmap_pars_vertex> 3133#include <normal_pars_vertex> 3134#include <morphtarget_pars_vertex> 3135#include <skinning_pars_vertex> 3136#include <logdepthbuf_pars_vertex> 3137#include <clipping_planes_pars_vertex> 3138void main() { 3139 #include <uv_vertex> 3140 #include <batching_vertex> 3141 #include <beginnormal_vertex> 3142 #include <morphinstance_vertex> 3143 #include <morphnormal_vertex> 3144 #include <skinbase_vertex> 3145 #include <skinnormal_vertex> 3146 #include <defaultnormal_vertex> 3147 #include <normal_vertex> 3148 #include <begin_vertex> 3149 #include <morphtarget_vertex> 3150 #include <skinning_vertex> 3151 #include <displacementmap_vertex> 3152 #include <project_vertex> 3153 #include <logdepthbuf_vertex> 3154 #include <clipping_planes_vertex> 3155#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3156 vViewPosition = - mvPosition.xyz; 3157#endif 3158}`,_h=`#define NORMAL 3159uniform float opacity; 3160#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3161 varying vec3 vViewPosition; 3162#endif 3163#include <uv_pars_fragment> 3164#include <normal_pars_fragment> 3165#include <bumpmap_pars_fragment> 3166#include <normalmap_pars_fragment> 3167#include <logdepthbuf_pars_fragment> 3168#include <clipping_planes_pars_fragment> 3169void main() { 3170 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3171 #include <clipping_planes_fragment> 3172 #include <logdepthbuf_fragment> 3173 #include <normal_fragment_begin> 3174 #include <normal_fragment_maps> 3175 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3176 #ifdef OPAQUE 3177 gl_FragColor.a = 1.0; 3178 #endif 3179}`,xh=`#define PHONG 3180varying vec3 vViewPosition; 3181#include <common> 3182#include <batching_pars_vertex> 3183#include <uv_pars_vertex> 3184#include <displacementmap_pars_vertex> 3185#include <envmap_pars_vertex> 3186#include <color_pars_vertex> 3187#include <fog_pars_vertex> 3188#include <normal_pars_vertex> 3189#include <morphtarget_pars_vertex> 3190#include <skinning_pars_vertex> 3191#include <shadowmap_pars_vertex> 3192#include <logdepthbuf_pars_vertex> 3193#include <clipping_planes_pars_vertex> 3194void main() { 3195 #include <uv_vertex> 3196 #include <color_vertex> 3197 #include <morphcolor_vertex> 3198 #include <batching_vertex> 3199 #include <beginnormal_vertex> 3200 #include <morphinstance_vertex> 3201 #include <morphnormal_vertex> 3202 #include <skinbase_vertex> 3203 #include <skinnormal_vertex> 3204 #include <defaultnormal_vertex> 3205 #include <normal_vertex> 3206 #include <begin_vertex> 3207 #include <morphtarget_vertex> 3208 #include <skinning_vertex> 3209 #include <displacementmap_vertex> 3210 #include <project_vertex> 3211 #include <logdepthbuf_vertex> 3212 #include <clipping_planes_vertex> 3213 vViewPosition = - mvPosition.xyz; 3214 #include <worldpos_vertex> 3215 #include <envmap_vertex> 3216 #include <shadowmap_vertex> 3217 #include <fog_vertex> 3218}`,vh=`#define PHONG 3219uniform vec3 diffuse; 3220uniform vec3 emissive; 3221uniform vec3 specular; 3222uniform float shininess; 3223uniform float opacity; 3224#include <common> 3225#include <dithering_pars_fragment> 3226#include <color_pars_fragment> 3227#include <uv_pars_fragment> 3228#include <map_pars_fragment> 3229#include <alphamap_pars_fragment> 3230#include <alphatest_pars_fragment> 3231#include <alphahash_pars_fragment> 3232#include <aomap_pars_fragment> 3233#include <lightmap_pars_fragment> 3234#include <emissivemap_pars_fragment> 3235#include <cube_uv_reflection_fragment> 3236#include <envmap_common_pars_fragment> 3237#include <envmap_pars_fragment> 3238#include <envmap_physical_pars_fragment> 3239#include <fog_pars_fragment> 3240#include <bsdfs> 3241#include <lights_pars_begin> 3242#include <normal_pars_fragment> 3243#include <lights_phong_pars_fragment> 3244#include <shadowmap_pars_fragment> 3245#include <bumpmap_pars_fragment> 3246#include <normalmap_pars_fragment> 3247#include <specularmap_pars_fragment> 3248#include <logdepthbuf_pars_fragment> 3249#include <clipping_planes_pars_fragment> 3250void main() { 3251 vec4 diffuseColor = vec4( diffuse, opacity ); 3252 #include <clipping_planes_fragment> 3253 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3254 vec3 totalEmissiveRadiance = emissive; 3255 #include <logdepthbuf_fragment> 3256 #include <map_fragment> 3257 #include <color_fragment> 3258 #include <alphamap_fragment> 3259 #include <alphatest_fragment> 3260 #include <alphahash_fragment> 3261 #include <specularmap_fragment> 3262 #include <normal_fragment_begin> 3263 #include <normal_fragment_maps> 3264 #include <emissivemap_fragment> 3265 #include <lights_phong_fragment> 3266 #include <lights_fragment_begin> 3267 #include <lights_fragment_maps> 3268 #include <lights_fragment_end> 3269 #include <aomap_fragment> 3270 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3271 #include <envmap_fragment> 3272 #include <opaque_fragment> 3273 #include <tonemapping_fragment> 3274 #include <colorspace_fragment> 3275 #include <fog_fragment> 3276 #include <premultiplied_alpha_fragment> 3277 #include <dithering_fragment> 3278}`,Mh=`#define STANDARD 3279varying vec3 vViewPosition; 3280#ifdef USE_TRANSMISSION 3281 varying vec3 vWorldPosition; 3282#endif 3283#include <common> 3284#include <batching_pars_vertex> 3285#include <uv_pars_vertex> 3286#include <displacementmap_pars_vertex> 3287#include <color_pars_vertex> 3288#include <fog_pars_vertex> 3289#include <normal_pars_vertex> 3290#include <morphtarget_pars_vertex> 3291#include <skinning_pars_vertex> 3292#include <shadowmap_pars_vertex> 3293#include <logdepthbuf_pars_vertex> 3294#include <clipping_planes_pars_vertex> 3295void main() { 3296 #include <uv_vertex> 3297 #include <color_vertex> 3298 #include <morphinstance_vertex> 3299 #include <morphcolor_vertex> 3300 #include <batching_vertex> 3301 #include <beginnormal_vertex> 3302 #include <morphnormal_vertex> 3303 #include <skinbase_vertex> 3304 #include <skinnormal_vertex> 3305 #include <defaultnormal_vertex> 3306 #include <normal_vertex> 3307 #include <begin_vertex> 3308 #include <morphtarget_vertex> 3309 #include <skinning_vertex> 3310 #include <displacementmap_vertex> 3311 #include <project_vertex> 3312 #include <logdepthbuf_vertex> 3313 #include <clipping_planes_vertex> 3314 vViewPosition = - mvPosition.xyz; 3315 #include <worldpos_vertex> 3316 #include <shadowmap_vertex> 3317 #include <fog_vertex> 3318#ifdef USE_TRANSMISSION 3319 vWorldPosition = worldPosition.xyz; 3320#endif 3321}`,Sh=`#define STANDARD 3322#ifdef PHYSICAL 3323 #define IOR 3324 #define USE_SPECULAR 3325#endif 3326uniform vec3 diffuse; 3327uniform vec3 emissive; 3328uniform float roughness; 3329uniform float metalness; 3330uniform float opacity; 3331#ifdef IOR 3332 uniform float ior; 3333#endif 3334#ifdef USE_SPECULAR 3335 uniform float specularIntensity; 3336 uniform vec3 specularColor; 3337 #ifdef USE_SPECULAR_COLORMAP 3338 uniform sampler2D specularColorMap; 3339 #endif 3340 #ifdef USE_SPECULAR_INTENSITYMAP 3341 uniform sampler2D specularIntensityMap; 3342 #endif 3343#endif 3344#ifdef USE_CLEARCOAT 3345 uniform float clearcoat; 3346 uniform float clearcoatRoughness; 3347#endif 3348#ifdef USE_DISPERSION 3349 uniform float dispersion; 3350#endif
3351#ifdef USE_IRIDESCENCE 3352 uniform float iridescence; 3353 uniform float iridescenceIOR; 3354 uniform float iridescenceThicknessMinimum; 3355 uniform float iridescenceThicknessMaximum; 3356#endif 3357#ifdef USE_SHEEN 3358 uniform vec3 sheenColor; 3359 uniform float sheenRoughness; 3360 #ifdef USE_SHEEN_COLORMAP 3361 uniform sampler2D sheenColorMap; 3362 #endif 3363 #ifdef USE_SHEEN_ROUGHNESSMAP 3364 uniform sampler2D sheenRoughnessMap; 3365 #endif 3366#endif 3367#ifdef USE_ANISOTROPY 3368 uniform vec2 anisotropyVector; 3369 #ifdef USE_ANISOTROPYMAP 3370 uniform sampler2D anisotropyMap; 3371 #endif 3372#endif 3373varying vec3 vViewPosition; 3374#include <common> 3375#include <dithering_pars_fragment> 3376#include <color_pars_fragment> 3377#include <uv_pars_fragment> 3378#include <map_pars_fragment> 3379#include <alphamap_pars_fragment> 3380#include <alphatest_pars_fragment> 3381#include <alphahash_pars_fragment> 3382#include <aomap_pars_fragment> 3383#include <lightmap_pars_fragment> 3384#include <emissivemap_pars_fragment> 3385#include <iridescence_fragment> 3386#include <cube_uv_reflection_fragment> 3387#include <envmap_common_pars_fragment> 3388#include <envmap_physical_pars_fragment> 3389#include <fog_pars_fragment> 3390#include <lights_pars_begin> 3391#include <normal_pars_fragment> 3392#include <lights_physical_pars_fragment> 3393#include <transmission_pars_fragment> 3394#include <shadowmap_pars_fragment> 3395#include <bumpmap_pars_fragment> 3396#include <normalmap_pars_fragment> 3397#include <clearcoat_pars_fragment> 3398#include <iridescence_pars_fragment> 3399#include <roughnessmap_pars_fragment> 3400#include <metalnessmap_pars_fragment> 3401#include <logdepthbuf_pars_fragment> 3402#include <clipping_planes_pars_fragment> 3403void main() { 3404 vec4 diffuseColor = vec4( diffuse, opacity ); 3405 #include <clipping_planes_fragment> 3406 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3407 vec3 totalEmissiveRadiance = emissive; 3408 #include <logdepthbuf_fragment> 3409 #include <map_fragment> 3410 #include <color_fragment> 3411 #include <alphamap_fragment> 3412 #include <alphatest_fragment> 3413 #include <alphahash_fragment> 3414 #include <roughnessmap_fragment> 3415 #include <metalnessmap_fragment> 3416 #include <normal_fragment_begin> 3417 #include <normal_fragment_maps> 3418 #include <clearcoat_normal_fragment_begin> 3419 #include <clearcoat_normal_fragment_maps> 3420 #include <emissivemap_fragment> 3421 #include <lights_physical_fragment> 3422 #include <lights_fragment_begin> 3423 #include <lights_fragment_maps> 3424 #include <lights_fragment_end> 3425 #include <aomap_fragment> 3426 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3427 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3428 #include <transmission_fragment> 3429 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3430 #ifdef USE_SHEEN 3431 3432 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3433 3434 #endif 3435 #ifdef USE_CLEARCOAT 3436 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3437 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3438 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3439 #endif 3440 #include <opaque_fragment> 3441 #include <tonemapping_fragment> 3442 #include <colorspace_fragment> 3443 #include <fog_fragment> 3444 #include <premultiplied_alpha_fragment> 3445 #include <dithering_fragment> 3446}`,Eh=`#define TOON 3447varying vec3 vViewPosition; 3448#include <common> 3449#include <batching_pars_vertex> 3450#include <uv_pars_vertex> 3451#include <displacementmap_pars_vertex> 3452#include <color_pars_vertex> 3453#include <fog_pars_vertex> 3454#include <normal_pars_vertex> 3455#include <morphtarget_pars_vertex> 3456#include <skinning_pars_vertex> 3457#include <shadowmap_pars_vertex> 3458#include <logdepthbuf_pars_vertex> 3459#include <clipping_planes_pars_vertex> 3460void main() { 3461 #include <uv_vertex> 3462 #include <color_vertex> 3463 #include <morphinstance_vertex> 3464 #include <morphcolor_vertex> 3465 #include <batching_vertex> 3466 #include <beginnormal_vertex> 3467 #include <morphnormal_vertex> 3468 #include <skinbase_vertex> 3469 #include <skinnormal_vertex> 3470 #include <defaultnormal_vertex> 3471 #include <normal_vertex> 3472 #include <begin_vertex> 3473 #include <morphtarget_vertex> 3474 #include <skinning_vertex> 3475 #include <displacementmap_vertex> 3476 #include <project_vertex> 3477 #include <logdepthbuf_vertex> 3478 #include <clipping_planes_vertex> 3479 vViewPosition = - mvPosition.xyz; 3480 #include <worldpos_vertex> 3481 #include <shadowmap_vertex> 3482 #include <fog_vertex> 3483}
3483`,yh=`#define TOON 3484uniform vec3 diffuse; 3485uniform vec3 emissive; 3486uniform float opacity; 3487#include <common> 3488#include <dithering_pars_fragment> 3489#include <color_pars_fragment> 3490#include <uv_pars_fragment> 3491#include <map_pars_fragment> 3492#include <alphamap_pars_fragment> 3493#include <alphatest_pars_fragment> 3494#include <alphahash_pars_fragment> 3495#include <aomap_pars_fragment> 3496#include <lightmap_pars_fragment> 3497#include <emissivemap_pars_fragment> 3498#include <gradientmap_pars_fragment> 3499#include <fog_pars_fragment> 3500#include <bsdfs> 3501#include <lights_pars_begin> 3502#include <normal_pars_fragment> 3503#include <lights_toon_pars_fragment> 3504#include <shadowmap_pars_fragment> 3505#include <bumpmap_pars_fragment> 3506#include <normalmap_pars_fragment> 3507#include <logdepthbuf_pars_fragment> 3508#include <clipping_planes_pars_fragment> 3509void main() { 3510 vec4 diffuseColor = vec4( diffuse, opacity ); 3511 #include <clipping_planes_fragment> 3512 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3513 vec3 totalEmissiveRadiance = emissive; 3514 #include <logdepthbuf_fragment> 3515 #include <map_fragment> 3516 #include <color_fragment> 3517 #include <alphamap_fragment> 3518 #include <alphatest_fragment> 3519 #include <alphahash_fragment> 3520 #include <normal_fragment_begin> 3521 #include <normal_fragment_maps> 3522 #include <emissivemap_fragment> 3523 #include <lights_toon_fragment> 3524 #include <lights_fragment_begin> 3525 #include <lights_fragment_maps> 3526 #include <lights_fragment_end> 3527 #include <aomap_fragment> 3528 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3529 #include <opaque_fragment> 3530 #include <tonemapping_fragment> 3531 #include <colorspace_fragment> 3532 #include <fog_fragment> 3533 #include <premultiplied_alpha_fragment> 3534 #include <dithering_fragment> 3535}`,Th=`uniform float size; 3536uniform float scale; 3537#include <common> 3538#include <color_pars_vertex> 3539#include <fog_pars_vertex> 3540#include <morphtarget_pars_vertex> 3541#include <logdepthbuf_pars_vertex> 3542#include <clipping_planes_pars_vertex> 3543#ifdef USE_POINTS_UV 3544 varying vec2 vUv; 3545 uniform mat3 uvTransform; 3546#endif 3547void main() { 3548 #ifdef USE_POINTS_UV 3549 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3550 #endif 3551 #include <color_vertex> 3552 #include <morphinstance_vertex> 3553 #include <morphcolor_vertex> 3554 #include <begin_vertex> 3555 #include <morphtarget_vertex> 3556 #include <project_vertex> 3557 gl_PointSize = size; 3558 #ifdef USE_SIZEATTENUATION 3559 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3560 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3561 #endif 3562 #include <logdepthbuf_vertex> 3563 #include <clipping_planes_vertex> 3564 #include <worldpos_vertex> 3565 #include <fog_vertex> 3566}`,bh=`uniform vec3 diffuse; 3567uniform float opacity; 3568#include <common> 3569#include <color_pars_fragment> 3570#include <map_particle_pars_fragment> 3571#include <alphatest_pars_fragment> 3572#include <alphahash_pars_fragment> 3573#include <fog_pars_fragment> 3574#include <logdepthbuf_pars_fragment> 3575#include <clipping_planes_pars_fragment> 3576void main() { 3577 vec4 diffuseColor = vec4( diffuse, opacity ); 3578 #include <clipping_planes_fragment> 3579 vec3 outgoingLight = vec3( 0.0 ); 3580 #include <logdepthbuf_fragment> 3581 #include <map_particle_fragment> 3582 #include <color_fragment> 3583 #include <alphatest_fragment> 3584 #include <alphahash_fragment> 3585 outgoingLight = diffuseColor.rgb; 3586 #include <opaque_fragment> 3587 #include <tonemapping_fragment> 3588 #include <colorspace_fragment> 3589 #include <fog_fragment> 3590 #include <premultiplied_alpha_fragment> 3591}`,Ah=`#include <common> 3592#include <batching_pars_vertex> 3593#include <fog_pars_vertex> 3594#include <morphtarget_pars_vertex> 3595#include <skinning_pars_vertex> 3596#include <logdepthbuf_pars_vertex> 3597#include <shadowmap_pars_vertex> 3598void main() { 3599 #include <batching_vertex> 3600 #include <beginnormal_vertex> 3601 #include <morphinstance_vertex> 3602 #include <morphnormal_vertex> 3603 #include <skinbase_vertex> 3604 #include <skinnormal_vertex> 3605 #include <defaultnormal_vertex> 3606 #include <begin_vertex> 3607 #include <morphtarget_vertex> 3608 #include <skinning_vertex> 3609 #include <project_vertex> 3610 #include <logdepthbuf_vertex> 3611 #include <worldpos_vertex> 3612 #include <shadowmap_vertex> 3613 #include <fog_vertex> 3614}`,Rh=`uniform vec3 color; 3615uniform float opacity; 3616#include <common> 3617#include <fog_pars_fragment> 3618#include <bsdfs> 3619#include <lights_pars_begin> 3620#include <logdepthbuf_pars_fragment> 3621#include <shadowmap_pars_fragment> 3622#include <shadowmask_pars_fragment> 3623void main() { 3624 #include <logdepthbuf_fragment> 3625 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3626 #include <tonemapping_fragment> 3627 #include <colorspace_fragment> 3628 #include <fog_fragment> 3629 #include <premultiplied_alpha_fragment> 3630}`,wh=`uniform float rotation; 3631uniform vec2 center; 3632#include <common> 3633#include <uv_pars_vertex> 3634#include <fog_pars_vertex> 3635#include <logdepthbuf_pars_vertex> 3636#include <clipping_planes_pars_vertex> 3637void main() { 3638 #include <uv_vertex> 3639 vec4 mvPosition = modelViewMatrix[ 3 ]; 3640 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3641 #ifndef USE_SIZEATTENUATION 3642 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3643 if ( isPerspective ) scale *= - mvPosition.z; 3644 #endif 3645 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3646 vec2 rotatedPosition; 3647 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3648 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3649 mvPosition.xy += rotatedPosition; 3650 gl_Position = projectionMatrix * mvPosition; 3651 #include <logdepthbuf_vertex> 3652 #include <clipping_planes_vertex> 3653 #include <fog_vertex> 3654}`,Ch=`uniform vec3 diffuse; 3655uniform float opacity; 3656#include <common> 3657#include <uv_pars_fragment> 3658#include <map_pars_fragment> 3659#include <alphamap_pars_fragment> 3660#include <alphatest_pars_fragment> 3661#include <alphahash_pars_fragment> 3662#include <fog_pars_fragment> 3663#include <logdepthbuf_pars_fragment> 3664#include <clipping_planes_pars_fragment> 3665void main() { 3666 vec4 diffuseColor = vec4( diffuse, opacity ); 3667 #include <clipping_planes_fragment> 3668 vec3 outgoingLight = vec3( 0.0 ); 3669 #include <logdepthbuf_fragment> 3670 #include <map_fragment> 3671 #include <alphamap_fragment> 3672 #include <alphatest_fragment> 3673 #include <alphahash_fragment> 3674 outgoingLight = diffuseColor.rgb; 3675 #include <opaque_fragment> 3676 #include <tonemapping_fragment> 3677 #include <colorspace_fragment> 3678 #include <fog_fragment> 3679}`,Ie={alphahash_fragment:Zc,alphahash_pars_fragment:$c,alphamap_fragment:Jc,alphamap_pars_fragment:Qc,alphatest_fragment:jc,alphatest_pars_fragment:eu,aomap_fragment:tu,aomap_pars_fragment:nu,batching_pars_vertex:iu,batching_vertex:ru,begin_vertex:su,beginnormal_vertex:au,bsdfs:ou,iridescence_fragment:lu,bumpmap_pars_fragment:cu,clipping_planes_fragment:uu,clipping_planes_pars_fragment:fu,clipping_planes_pars_vertex:hu,clipping_planes_vertex:du,color_fragment:pu,color_pars_fragment:mu,color_pars_vertex:gu,color_vertex:_u,common:xu,cube_uv_reflection_fragment:vu,defaultnormal_vertex:Mu,displacementmap_pars_vertex:Su,displacementmap_vertex:Eu,emissivemap_fragment:yu,emissivemap_pars_fragment:Tu,colorspace_fragment:bu,colorspace_pars_fragment:Au,envmap_fragment:Ru,envmap_common_pars_fragment:wu,envmap_pars_fragment:Cu,envmap_pars_vertex:Pu,envmap_physical_pars_fragment:Vu,envmap_vertex:Du,fog_vertex:Lu,fog_pars_vertex:Iu,fog_fragment:Uu,fog_pars_fragment:Nu,gradientmap_pars_fragment:Fu,lightmap_pars_fragment:Ou,lights_lambert_fragment:Bu,lights_lambert_pars_fragment:zu,lights_pars_begin:Gu,lights_toon_fragment:Hu,lights_toon_pars_fragment:ku,lights_phong_fragment:Wu,lights_phong_pars_fragment:Xu,lights_physical_fragment:qu,lights_physical_pars_fragment:Yu,lights_fragment_begin:Ku,lights_fragment_maps:Zu,lights_fragment_end:$u,lightprobes_pars_fragment:Ju,logdepthbuf_fragment:Qu,logdepthbuf_pars_fragment:ju,logdepthbuf_pars_vertex:ef,logdepthbuf_vertex:tf,map_fragment:nf,map_pars_fragment:rf,map_particle_fragment:sf,map_particle_pars_fragment:af,metalnessmap_fragment:of,metalnessmap_pars_fragment:lf,morphinstance_vertex:cf,morphcolor_vertex:uf,morphnormal_vertex:ff,morphtarget_pars_vertex:hf,morphtarget_vertex:df,normal_fragment_begin:pf,normal_fragment_maps:mf,normal_pars_fragment:gf,normal_pars_vertex:_f,normal_vertex:xf,normalmap_pars_fragment:vf,clearcoat_normal_fragment_begin:Mf,clearcoat_normal_fragment_maps:Sf,clearcoat_pars_fragment:Ef,iridescence_pars_fragment:yf,opaque_fragment:Tf,packing:bf,premultiplied_alpha_fragment:Af,project_vertex:Rf,dithering_fragment:wf,dithering_pars_fragment:Cf,roughnessmap_fragment:Pf,roughnessmap_pars_fragment:Df,shadowmap_pars_fragment:Lf,shadowmap_pars_vertex:If,shadowmap_vertex:Uf,shadowmask_pars_fragment:Nf,skinbase_vertex:Ff,skinning_pars_vertex:Of,skinning_vertex:Bf,skinnormal_vertex:zf,specularmap_fragment:Gf,specularmap_pars_fragment:Vf,tonemapping_fragment:Hf,tonemapping_pars_fragment:kf,transmission_fragment:Wf,transmission_pars_fragment:Xf,uv_pars_fragment:qf,uv_pars_vertex:Yf,uv_vertex:Kf,worldpos_vertex:Zf,background_vert:$f,background_frag:Jf,backgroundCube_vert:Qf,backgroundCube_frag:jf,cube_vert:eh,cube_frag:th,depth_vert:nh,depth_frag:ih,distance_vert:rh,distance_frag:sh,equirect_vert:ah,equirect_frag:oh,linedashed_vert:lh,linedashed_frag:ch,meshbasic_vert:uh,meshbasic_frag:fh,meshlambert_vert:hh,meshlambert_frag:dh,meshmatcap_vert:ph,meshmatcap_frag:mh,meshnormal_vert:gh,meshnormal_frag:_h,meshphong_vert:xh,meshphong_frag:vh,meshphysical_vert:Mh,meshphysical_frag:Sh,meshtoon_vert:Eh,meshtoon_frag:yh,points_vert:Th,points_frag:bh,shadow_vert:Ah,shadow_frag:Rh,sprite_vert:wh,sprite_frag:Ch},ce={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ce}},envmap:{envMap:{value:null},envMapRotation:{value:new Ce},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ce}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ce}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ce},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ce},normalScale:{value:new Be(1,1)}}
vendor: 6,842 bytes, line 3679
3679,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ce},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ce}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ce}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ce}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new U},probesMax:{value:new U},probesResolution:{value:new U}},points:{diffuse:{value:new He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0},uvTransform:{value:new Ce}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}}},Zt={basic:{uniforms:yt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:Ie.meshbasic_vert,fragmentShader:Ie.meshbasic_frag},lambert:{uniforms:yt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new He(0)},envMapIntensity:{value:1}}]),vertexShader:Ie.meshlambert_vert,fragmentShader:Ie.meshlambert_frag},phong:{uniforms:yt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ie.meshphong_vert,fragmentShader:Ie.meshphong_frag},standard:{uniforms:yt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ie.meshphysical_vert,fragmentShader:Ie.meshphysical_frag},toon:{uniforms:yt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new He(0)}}]),vertexShader:Ie.meshtoon_vert,fragmentShader:Ie.meshtoon_frag},matcap:{uniforms:yt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:Ie.meshmatcap_vert,fragmentShader:Ie.meshmatcap_frag},points:{uniforms:yt([ce.points,ce.fog]),vertexShader:Ie.points_vert,fragmentShader:Ie.points_frag},dashed:{uniforms:yt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ie.linedashed_vert,fragmentShader:Ie.linedashed_frag},depth:{uniforms:yt([ce.common,ce.displacementmap]),vertexShader:Ie.depth_vert,fragmentShader:Ie.depth_frag},normal:{uniforms:yt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:Ie.meshnormal_vert,fragmentShader:Ie.meshnormal_frag},sprite:{uniforms:yt([ce.sprite,ce.fog]),vertexShader:Ie.sprite_vert,fragmentShader:Ie.sprite_frag},background:{uniforms:{uvTransform:{value:new Ce},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ie.background_vert,fragmentShader:Ie.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ce}},vertexShader:Ie.backgroundCube_vert,fragmentShader:Ie.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ie.cube_vert,fragmentShader:Ie.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ie.equirect_vert,fragmentShader:Ie.equirect_frag},distance:{uniforms:yt([ce.common,ce.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ie.distance_vert,fragmentShader:Ie.distance_frag},shadow:{uniforms:yt([ce.lights,ce.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:Ie.shadow_vert,fragmentShader:Ie.shadow_frag}};Zt.physical={uniforms:yt([Zt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ce},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ce},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ce},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ce},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ce},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ce},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ce},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ce},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ce},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ce},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ce},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ce}}]),vertexShader:Ie.meshphysical_vert,fragmentShader:Ie.meshphysical_frag};const or={r:0,b:0,g:0},Ph=new st,hl=new Ce;hl.set(-1,0,0,0,1,0,0,0,1);
vendor: 15,037 bytes, line 3679
3679function Dh(i,e,t,n,r,s){const a=new He(0);let o=r===!0?0:1,c,l,d=null,m=0,u=null;function g(b){let A=b.isScene===!0?b.background:null;if(A&&A.isTexture){const M=b.backgroundBlurriness>0;A=e.get(A,M)}return A}function x(b){let A=!1;const M=g(b);M===null?p(a,o):M&&M.isColor&&(p(M,1),A=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||A)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(b,A){const M=g(A);M&&(M.isCubeTexture||M.mapping===Ar)?(l===void 0&&(l=new mn(new Pi(1,1,1),new nn({name:"BackgroundCubeMaterial",uniforms:ui(Zt.backgroundCube.uniforms),vertexShader:Zt.backgroundCube.vertexShader,fragmentShader:Zt.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(R,y,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Ph.makeRotationFromEuler(A.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(hl),l.material.toneMapped=Fe.getTransfer(M.colorSpace)!==Ye,(d!==M||m!==M.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,d=M,m=M.version,u=i.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new mn(new Rr(2,2),new nn({name:"BackgroundMaterial",uniforms:ui(Zt.background.uniforms),vertexShader:Zt.background.vertexShader,fragmentShader:Zt.background.fragmentShader,side:Rn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=Fe.getTransfer(M.colorSpace)!==Ye,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||m!==M.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,d=M,m=M.version,u=i.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function p(b,A){b.getRGB(or,ll(i)),t.buffers.color.setClear(or.r,or.g,or.b,A,s)}function f(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,A=1){a.set(b),o=A,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(b){o=b,p(a,o)},render:x,addToRenderList:S,dispose:f}}function Lh(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(D,F,Y,Z,G){let X=!1;const H=m(D,Z,Y,F);s!==H&&(s=H,l(s.object)),X=g(D,Z,Y,G),X&&x(D,Z,Y,G),G!==null&&e.update(G,i.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,M(D,F,Y,Z),G!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function c(){return i.createVertexArray()}function l(D){return i.bindVertexArray(D)}function d(D){return i.deleteVertexArray(D)}function m(D,F,Y,Z){const G=Z.wireframe===!0;let X=n[F.id];X===void 0&&(X={},n[F.id]=X);const H=D.isInstancedMesh===!0?D.id:0;let J=X[H];J===void 0&&(J={},X[H]=J);let j=J[Y.id];j===void 0&&(j={},J[Y.id]=j);let ue=j[G];return ue===void 0&&(ue=u(c()),j[G]=ue),ue}function u(D){const F=[],Y=[],Z=[];for(let G=0;G<t;G++)F[G]=0,Y[G]=0,Z[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:Y,attributeDivisors:Z,object:D,attributes:{},index:null}}function g(D,F,Y,Z){const G=s.attributes,X=F.attributes;let H=0;const J=Y.getAttributes();for(const j in J)if(J[j].location>=0){const pe=G[j];let _e=X[j];if(_e===void 0&&(j==="instanceMatrix"&&D.instanceMatrix&&(_e=D.instanceMatrix),j==="instanceColor"&&D.instanceColor&&(_e=D.instanceColor)),pe===void 0||pe.attribute!==_e||_e&&pe.data!==_e.data)return!0;H++}return s.attributesNum!==H||s.index!==Z}function x(D,F,Y,Z){const G={},X=F.attributes;let H=0;const J=Y.getAttributes();for(const j in J)if(J[j].location>=0){let pe=X[j];pe===void 0&&(j==="instanceMatrix"&&D.instanceMatrix&&(pe=D.instanceMatrix),j==="instanceColor"&&D.instanceColor&&(pe=D.instanceColor));const _e={};_e.attribute=pe,pe&&pe.data&&(_e.data=pe.data),G[j]=_e,H++}s.attributes=G,s.attributesNum=H,s.index=Z}function S(){const D=s.newAttributes;for(let F=0,Y=D.length;F<Y;F++)D[F]=0}function p(D){f(D,0)}function f(D,F){const Y=s.newAttributes,Z=s.enabledAttributes,G=s.attributeDivisors;Y[D]=1,Z[D]===0&&(i.enableVertexAttribArray(D),Z[D]=1),G[D]!==F&&(i.vertexAttribDivisor(D,F),G[D]=F)}function b(){const D=s.newAttributes,F=s.enabledAttributes;for(let Y=0,Z=F.length;Y<Z;Y++)F[Y]!==D[Y]&&(i.disableVertexAttribArray(Y),F[Y]=0)}function A(D,F,Y,Z,G,X,H){H===!0?i.vertexAttribIPointer(D,F,Y,G,X):i.vertexAttribPointer(D,F,Y,Z,G,X)}function M(D,F,Y,Z){S();const G=Z.attributes,X=Y.getAttributes(),H=F.defaultAttributeValues;for(const J in X){const j=X[J];if(j.location>=0){let ue=G[J];if(ue===void 0&&(J==="instanceMatrix"&&D.instanceMatrix&&(ue=D.instanceMatrix),J==="instanceColor"&&D.instanceColor&&(ue=D.instanceColor)),ue!==void 0){const pe=ue.normalized,_e=ue.itemSize,ke=e.get(ue);if(ke===void 0)continue;const et=ke.buffer,We=ke.type,$=ke.bytesPerElement,ie=We===i.INT||We===i.UNSIGNED_INT||ue.gpuType===sa;if(ue.isInterleavedBufferAttribute){const ee=ue.data,we=ee.stride,Pe=ue.offset;if(ee.isInstancedInterleavedBuffer){for(let be=0;be<j.locationSize;be++)f(j.location+be,ee.meshPerAttribute);D.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let be=0;be<j.locationSize;be++)p(j.location+be);i.bindBuffer(i.ARRAY_BUFFER,et);for(let be=0;be<j.locationSize;be++)A(j.location+be,_e/j.locationSize,We,pe,we*$,(Pe+_e/j.locationSize*be)*$,ie)}else{if(ue.isInstancedBufferAttribute){for(let ee=0;ee<j.locationSize;ee++)f(j.location+ee,ue.meshPerAttribute);D.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let ee=0;ee<j.locationSize;ee++)p(j.location+ee);i.bindBuffer(i.ARRAY_BUFFER,et);for(let ee=0;ee<j.locationSize;ee++)A(j.location+ee,_e/j.locationSize,We,pe,_e*$,_e/j.locationSize*ee*$,ie)}}else if(H!==void 0){const pe=H[J];if(pe!==void 0)switch(pe.length){case 2:i.vertexAttrib2fv(j.location,pe);break;case 3:i.vertexAttrib3fv(j.location,pe);break;case 4:i.vertexAttrib4fv(j.location,pe);break;default:i.vertexAttrib1fv(j.location,pe)}}}}b()}function R(){T();for(const D in n){const F=n[D];for(const Y in F){const Z=F[Y];for(const G in Z){const X=Z[G];for(const H in X)d(X[H].object),delete X[H];delete Z[G]}}delete n[D]}}function y(D){if(n[D.id]===void 0)return;const F=n[D.id];for(const Y in F){const Z=F[Y];for(const G in Z){const X=Z[G];for(const H in X)d(X[H].object),delete X[H];delete Z[G]}}delete n[D.id]}function w(D){for(const F in n){const Y=n[F];for(const Z in Y){const G=Y[Z];if(G[D.id]===void 0)continue;const X=G[D.id];for(const H in X)d(X[H].object),delete X[H];delete G[D.id]}}}function _(D){for(const F in n){const Y=n[F],Z=D.isInstancedMesh===!0?D.id:0,G=Y[Z];if(G!==void 0){for(const X in G){const H=G[X];for(const J in H)d(H[J].object),delete H[J];delete G[X]}delete Y[Z],Object.keys(Y).length===0&&delete n[F]}}}function T(){C(),a=!0,s!==r&&(s=r,l(s.object))}function C(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:T,resetDefaultState:C,dispose:R,releaseStatesOfGeometry:y,releaseStatesOfObject:_,releaseStatesOfProgram:w,initAttributes:S,enableAttribute:p,disableUnusedAttributes:b}}function Ih(i,e,t){let n;function r(c){n=c}function s(c,l){i.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,d){d!==0&&(i.drawArraysInstanced(n,c,l,d),t.update(l,n,d))}function o(c,l,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,d);let u=0;for(let g=0;g<d;g++)u+=l[g];t.update(u,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Uh(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==kt&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const _=w===dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Bt&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==$t&&!_)}function c(w){if(w==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const d=c(l);d!==l&&(Re("WebGLRenderer:",l,"not supported, using",d,"instead."),l=d);const m=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Re("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const g=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),R=i.getParameter(i.MAX_SAMPLES),y=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:m,reversedDepthBuffer:u,maxTextures:g,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:b,maxVaryings:A,maxFragmentUniforms:M,maxSamples:R,samples:y}}function Nh(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new In,o=new Ce,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,u){const g=m.length!==0||u||n!==0||r;return r=u,n=m.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,u){t=d(m,u,0)},this.setState=function(m,u,g){const x=m.clippingPlanes,S=m.clipIntersection,p=m.clipShadows,f=i.get(m);if(!r||x===null||x.length===0||s&&!p)s?d(null):l();else{const b=s?0:n,A=b*4;let M=f.clippingState||null;c.value=M,M=d(x,u,A,g);for(let R=0;R!==A;++R)M[R]=t[R];f.clippingState=M,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=b}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(m,u,g,x){const S=m!==null?m.length:0;let p=null;if(S!==0){if(p=c.value,x!==!0||p===null){const f=g+S*4,b=u.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length<f)&&(p=new Float32Array(f));for(let A=0,M=g;A!==S;++A,M+=4)a.copy(m[A]).applyMatrix4(b,o),a.normal.toArray(p,M),p[M+3]=a.constant}c.value=p,c.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,p}}const An=4,fo=[.125,.215,.35,.446,.526,.582],Nn=20,Fh=256,Mi=new ul,ho=new He;let as=null,os=0,ls=0,cs=!1;const Oh=new U;class po{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=Oh}=s;as=this._renderer.getRenderTarget(),os=this._renderer.getActiveCubeFace(),ls=this._renderer.getActiveMipmapLevel(),cs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,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=_o(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=go(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(as,os,ls),this._renderer.xr.enabled=cs,e.scissorTest=!1,ii(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Bn||e.mapping===li?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),as=this._renderer.getRenderTarget(),os=this._renderer.getActiveCubeFace(),ls=this._renderer.getActiveMipmapLevel(),cs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Et,minFilter:Et,generateMipmaps:!1,type:dn,format:kt,colorSpace:vr,depthBuffer:!1},r=mo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mo(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Bh(s)),this._blurMaterial=Gh(s,e,t),this._ggxMaterial=zh(s,e,t)}return r}_compileMaterial(e){const t=new mn(new It,e);this._renderer.compile(t,Mi)}_sceneToCubeUV(e,t,n,r,s){const c=new Ot(90,1,t,n),l=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],m=this._renderer,u=m.autoClear,g=m.toneMapping;m.getClearColor(ho),m.toneMapping=Qt,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(r),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new mn(new Pi,new nl({name:"PMREM.Backgroun
3679d",side:Ct,depthWrite:!1,depthTest:!1})));const S=this._backgroundBox,p=S.material;let f=!1;const b=e.background;b?b.isColor&&(p.color.copy(b),e.background=null,f=!0):(p.color.copy(ho),f=!0);for(let A=0;A<6;A++){const M=A%3;M===0?(c.up.set(0,l[A],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+d[A],s.y,s.z)):M===1?(c.up.set(0,0,l[A]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+d[A],s.z)):(c.up.set(0,l[A],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+d[A]));const R=this._cubeSize;ii(r,M*R,A>2?R:0,R,R),m.setRenderTarget(r),f&&m.render(S,c),m.render(e,c)}m.toneMapping=g,m.autoClear=u,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Bn||e.mapping===li;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_o()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=go());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;ii(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Mi)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),m=Math.sqrt(l*l-d*d),u=0+l*1.25,g=m*u,{_lodMax:x}=this,S=this._sizeLods[n],p=3*S*(n>x-An?n-x+An:0),f=4*(this._cubeSize-S);c.envMap.value=e.texture,c.roughness.value=g,c.mipInt.value=x-t,ii(s,p,f,3*S,2*S),r.setRenderTarget(s),r.render(o,Mi),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=x-n,ii(e,p,f,3*S,2*S),r.setRenderTarget(e),r.render(o,Mi)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ve("blur direction must be either latitudinal or longitudinal!");const d=3,m=this._lodMeshes[r];m.material=l;const u=l.uniforms,g=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Nn-1),S=s/x,p=isFinite(s)?1+Math.floor(d*S):Nn;p>Nn&&Re(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Nn}`);const f=[];let b=0;for(let w=0;w<Nn;++w){const _=w/S,T=Math.exp(-_*_/2);f.push(T),w===0?b+=T:w<p&&(b+=2*T)}for(let w=0;w<f.length;w++)f[w]=f[w]/b;u.envMap.value=e.texture,u.samples.value=p,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:A}=this;u.dTheta.value=x,u.mipInt.value=A-n;const M=this._sizeLods[r],R=3*M*(r>A-An?r-A+An:0),y=4*(this._cubeSize-M);ii(t,R,y,3*M,2*M),c.setRenderTarget(t),c.render(m,Mi)}}function Bh(i){const e=[],t=[],n=[];let r=i;const s=i-An+1+fo.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let c=1/o;a>i-An?c=fo[a-i+An-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),d=-l,m=1+l,u=[d,d,m,d,m,m,d,d,m,m,d,m],g=6,x=6,S=3,p=2,f=1,b=new Float32Array(S*x*g),A=new Float32Array(p*x*g),M=new Float32Array(f*x*g);for(let y=0;y<g;y++){const w=y%3*2/3-1,_=y>2?0:-1,T=[w,_,0,w+2/3,_,0,w+2/3,_+1,0,w,_,0,w+2/3,_+1,0,w,_+1,0];b.set(T,S*x*y),A.set(u,p*x*y);const C=[y,y,y,y,y,y];M.set(C,f*x*y)}const R=new It;R.setAttribute("position",new en(b,S)),R.setAttribute("uv",new en(A,p)),R.setAttribute("faceIndex",new en(M,f)),n.push(new mn(R,null)),r>An&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function mo(i,e,t){const n=new jt(i,e,t);return n.texture.mapping=Ar,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ii(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zh(i,e,t){return new nn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Fh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:wr(),fragmentShader:` 3680 3681 precision highp float; 3682 precision highp int; 3683 3684 varying vec3 vOutputDirection; 3685 3686 uniform sampler2D envMap; 3687 uniform float roughness; 3688 uniform float mipInt; 3689 3690 #define ENVMAP_TYPE_CUBE_UV 3691 #include <cube_uv_reflection_fragment> 3692 3693 #define PI 3.14159265359 3694 3695 // Van der Corput radical inverse 3696 float radicalInverse_VdC(uint bits) { 3697 bits = (bits << 16u) | (bits >> 16u); 3698 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3699 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3700 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3701 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3702 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3703 } 3704 3705 // Hammersley sequence 3706 vec2 hammersley(uint i, uint N) { 3707 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3708 } 3709 3710 // GGX VNDF importance sampling (Eric Heitz 2018) 3711 // "Sampling the GGX Distribution of Visible Normals" 3712 // https://jcgt.org/published/0007/04/01/ 3713 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3714 float alpha = roughness * roughness; 3715 3716 // Section 4.1: Orthonormal basis 3717 vec3 T1 = vec3(1.0, 0.0, 0.0); 3718 vec3 T2 = cross(V, T1); 3719 3720 // Section 4.2: Parameterization of projected area 3721 float r = sqrt(Xi.x); 3722 float phi = 2.0 * PI * Xi.y; 3723 float t1 = r * cos(phi); 3724 float t2 = r * sin(phi); 3725 float s = 0.5 * (1.0 + V.z); 3726 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3727 3728 // Section 4.3: Reprojection onto hemisphere 3729 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3730 3731 // Section 3.4: Transform back to ellipsoid configuration 3732 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3733 } 3734 3735 void main() { 3736 vec3 N = normalize(vOutputDirection); 3737 vec3 V = N; // Assume view direction equals normal for pre-filtering 3738 3739 vec3 prefilteredColor = vec3(0.0); 3740 float totalWeight = 0.0; 3741 3742 // For very low roughness, just sample the environment directly 3743 if (roughness < 0.001) { 3744 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3745 return; 3746 } 3747 3748 // Tangent space basis for VNDF sampling 3749 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3750 vec3 tangent = normalize(cross(up, N)); 3751 vec3 bitangent = cross(N, tangent); 3752
3753 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3754 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3755 3756 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3757 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3758 3759 // Transform H back to world space 3760 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3761 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3762 3763 float NdotL = max(dot(N, L), 0.0); 3764 3765 if(NdotL > 0.0) { 3766 // Sample environment at fixed mip level 3767 // VNDF importance sampling handles the distribution filtering 3768 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3769 3770 // Weight by NdotL for the split-sum approximation 3771 // VNDF PDF naturally accounts for the visible microfacet distribution 3772 prefilteredColor += sampleColor * NdotL; 3773 totalWeight += NdotL; 3774 } 3775 } 3776 3777 if (totalWeight > 0.0) { 3778 prefilteredColor = prefilteredColor / totalWeight; 3779 } 3780 3781 gl_FragColor = vec4(prefilteredColor, 1.0); 3782 } 3783 `,blending:fn,depthTest:!1,depthWrite:!1})}function Gh(i,e,t){const n=new Float32Array(Nn),r=new U(0,1,0);return new nn({name:"SphericalGaussianBlur",defines:{n:Nn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:wr(),fragmentShader:` 3784 3785 precision mediump float; 3786 precision mediump int; 3787 3788 varying vec3 vOutputDirection; 3789 3790 uniform sampler2D envMap; 3791 uniform int samples; 3792 uniform float weights[ n ]; 3793 uniform bool latitudinal; 3794 uniform float dTheta; 3795 uniform float mipInt; 3796 uniform vec3 poleAxis; 3797 3798 #define ENVMAP_TYPE_CUBE_UV 3799 #include <cube_uv_reflection_fragment> 3800 3801 vec3 getSample( float theta, vec3 axis ) { 3802 3803 float cosTheta = cos( theta ); 3804 // Rodrigues' axis-angle rotation 3805 vec3 sampleDirection = vOutputDirection * cosTheta 3806 + cross( axis, vOutputDirection ) * sin( theta ) 3807 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3808 3809 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3810 3811 } 3812 3813 void main() { 3814 3815 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3816 3817 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3818 3819 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3820 3821 } 3822 3823 axis = normalize( axis ); 3824 3825 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3826 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3827 3828 for ( int i = 1; i < n; i++ ) { 3829 3830 if ( i >= samples ) { 3831 3832 break; 3833 3834 } 3835 3836 float theta = dTheta * float( i ); 3837 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3838 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3839 3840 } 3841 3842 } 3843 `,blending:fn,depthTest:!1,depthWrite:!1})}function go(){return new nn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:wr(),fragmentShader:` 3844 3845 precision mediump float; 3846 precision mediump int; 3847 3848 varying vec3 vOutputDirection; 3849 3850 uniform sampler2D envMap; 3851 3852 #include <common> 3853 3854 void main() { 3855 3856 vec3 outputDirection = normalize( vOutputDirection ); 3857 vec2 uv = equirectUv( outputDirection ); 3858 3859 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3860 3861 } 3862 `,blending:fn,depthTest:!1,depthWrite:!1})}function _o(){return new nn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:wr(),fragmentShader:` 3863 3864 precision mediump float; 3865 precision mediump int; 3866 3867 uniform float flipEnvMap; 3868 3869 varying vec3 vOutputDirection; 3870 3871 uniform samplerCube envMap; 3872 3873 void main() { 3874 3875 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3876 3877 } 3878 `,blending:fn,depthTest:!1,depthWrite:!1})}function wr(){return` 3879 3880 precision mediump float; 3881 precision mediump int; 3882 3883 attribute float faceIndex; 3884 3885 varying vec3 vOutputDirection; 3886 3887 // RH coordinate system; PMREM face-indexing convention 3888 vec3 getDirection( vec2 uv, float face ) { 3889 3890 uv = 2.0 * uv - 1.0; 3891 3892 vec3 direction = vec3( uv, 1.0 ); 3893 3894 if ( face == 0.0 ) { 3895 3896 direction = direction.zyx; // ( 1, v, u ) pos x 3897 3898 } else if ( face == 1.0 ) { 3899 3900 direction = direction.xzy; 3901 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3902 3903 } else if ( face == 2.0 ) { 3904 3905 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3906 3907 } else if ( face == 3.0 ) { 3908 3909 direction = direction.zyx; 3910 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3911 3912 } else if ( face == 4.0 ) { 3913 3914 direction = direction.xzy; 3915 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3916 3917 } else if ( face == 5.0 ) { 3918 3919 direction.z *= -1.0; // ( u, v, -1 ) neg z 3920 3921 } 3922 3923 return direction; 3924 3925 } 3926 3927 void main() { 3928 3929 vOutputDirection = getDirection( uv, faceIndex ); 3930 gl_Position = vec4( position, 1.0 ); 3931 3932 } 3933 `}class dl extends jt{constructor(e=1,t={}
vendor: 21,082 bytes, lines 3933-4021
3933){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new al(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 3934 3935 varying vec3 vWorldDirection; 3936 3937 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3938 3939 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3940 3941 } 3942 3943 void main() { 3944 3945 vWorldDirection = transformDirection( position, modelMatrix ); 3946 3947 #include <begin_vertex> 3948 #include <project_vertex> 3949 3950 } 3951 `,fragmentShader:` 3952 3953 uniform sampler2D tEquirect; 3954 3955 varying vec3 vWorldDirection; 3956 3957 #include <common> 3958 3959 void main() { 3960 3961 vec3 direction = normalize( vWorldDirection ); 3962 3963 vec2 sampleUV = equirectUv( direction ); 3964 3965 gl_FragColor = texture2D( tEquirect, sampleUV ); 3966 3967 } 3968 `},r=new Pi(5,5,5),s=new nn({name:"CubemapFromEquirect",uniforms:ui(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ct,blending:fn});s.uniforms.tEquirect.value=t;const a=new mn(r,s),o=t.minFilter;return t.minFilter===Fn&&(t.minFilter=Et),new Xc(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function Vh(i){let e=new WeakMap,t=new WeakMap,n=null;function r(u,g=!1){return u==null?null:g?a(u):s(u)}function s(u){if(u&&u.isTexture){const g=u.mapping;if(g===Lr||g===Ir)if(e.has(u)){const x=e.get(u).texture;return o(x,u.mapping)}else{const x=u.image;if(x&&x.height>0){const S=new dl(x.height);return S.fromEquirectangularTexture(i,u),e.set(u,S),u.addEventListener("dispose",l),o(S.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const g=u.mapping,x=g===Lr||g===Ir,S=g===Bn||g===li;if(x||S){let p=t.get(u);const f=p!==void 0?p.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new po(i)),p=x?n.fromEquirectangular(u,p):n.fromCubemap(u,p),p.texture.pmremVersion=u.pmremVersion,t.set(u,p),p.texture;if(p!==void 0)return p.texture;{const b=u.image;return x&&b&&b.height>0||S&&b&&c(b)?(n===null&&(n=new po(i)),p=x?n.fromEquirectangular(u):n.fromCubemap(u),p.texture.pmremVersion=u.pmremVersion,t.set(u,p),u.addEventListener("dispose",d),p.texture):null}}}return u}function o(u,g){return g===Lr?u.mapping=Bn:g===Ir&&(u.mapping=li),u}function c(u){let g=0;const x=6;for(let S=0;S<x;S++)u[S]!==void 0&&g++;return g===x}function l(u){const g=u.target;g.removeEventListener("dispose",l);const x=e.get(g);x!==void 0&&(e.delete(g),x.dispose())}function d(u){const g=u.target;g.removeEventListener("dispose",d);const x=t.get(g);x!==void 0&&(t.delete(g),x.dispose())}function m(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:m}}function Hh(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&si("WebGLRenderer: "+n+" extension not supported."),r}}}function kh(i,e,t,n){const r={},s=new WeakMap;function a(m){const u=m.target;u.index!==null&&e.remove(u.index);for(const x in u.attributes)e.remove(u.attributes[x]);u.removeEventListener("dispose",a),delete r[u.id];const g=s.get(u);g&&(e.remove(g),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(m,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function c(m){const u=m.attributes;for(const g in u)e.update(u[g],i.ARRAY_BUFFER)}function l(m){const u=[],g=m.index,x=m.attributes.position;let S=0;if(x===void 0)return;if(g!==null){const b=g.array;S=g.version;for(let A=0,M=b.length;A<M;A+=3){const R=b[A+0],y=b[A+1],w=b[A+2];u.push(R,y,y,w,w,R)}}else{const b=x.array;S=x.version;for(let A=0,M=b.length/3-1;A<M;A+=3){const R=A+0,y=A+1,w=A+2;u.push(R,y,y,w,w,R)}}const p=new(x.count>=65535?tl:el)(u,1);p.version=S;const f=s.get(m);f&&e.remove(f),s.set(m,p)}function d(m){const u=s.get(m);if(u){const g=m.index;g!==null&&u.version<g.version&&l(m)}else l(m);return s.get(m)}return{get:o,update:c,getWireframeAttribute:d}}function Wh(i,e,t){let n;function r(m){n=m}let s,a;function o(m){s=m.type,a=m.bytesPerElement}function c(m,u){i.drawElements(n,u,s,m*a),t.update(u,n,1)}function l(m,u,g){g!==0&&(i.drawElementsInstanced(n,u,s,m*a,g),t.update(u,n,g))}function d(m,u,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,u,0,s,m,0,g);let S=0;for(let p=0;p<g;p++)S+=u[p];t.update(S,n,1)}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=d}function Xh(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:Ve("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function qh(i,e,t){const n=new WeakMap,r=new rt;function s(a,o,c){const l=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,m=d!==void 0?d.length:0;let u=n.get(o);if(u===void 0||u.count!==m){let T=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",T)};u!==void 0&&u.texture.dispose();const g=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,S=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let A=0;g===!0&&(A=1),x===!0&&(A=2),S===!0&&(A=3);let M=o.attributes.position.count*A,R=1;M>e.maxTextureSize&&(R=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const y=new Float32Array(M*R*4*m),w=new Jo(y,M,R,m);w.type=$t,w.needsUpdate=!0;const _=A*4;for(let C=0;C<m;C++){const D=p[C],F=f[C],Y=b[C],Z=M*R*4*C;for(let G=0;G<D.count;G++){const X=G*_;g===!0&&(r.fromBufferAttribute(D,G),y[Z+X+0]=r.x,y[Z+X+1]=r.y,y[Z+X+2]=r.z,y[Z+X+3]=0),x===!0&&(r.fromBufferAttribute(F,G),y[Z+X+4]=r.x,y[Z+X+5]=r.y,y[Z+X+6]=r.z,y[Z+X+7]=0),S===!0&&(r.fromBufferAttribute(Y,G),y[Z+X+8]=r.x,y[Z+X+9]=r.y,y[Z+X+10]=r.z,y[Z+X+11]=Y.itemSize===4?r.w:1)}}u={count:m,texture:w,size:new Be(M,R)},n.set(o,u),o.addEventListener("dispose",T)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let g=0;for(let S=0;S<l.length;S++)g+=l[S];const x=o.morphTargetsRelative?1:1-g;c.getUniforms().setValue(i,"morphTargetBaseInfluence",x),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function Yh(i,e,t,n,r){let s=new WeakMap;function a(l){const d=r.render.frame,m=l.geometry,u=e.get(l,m);if(s.get(u)!==d&&(e.update(u),s.set(u,d)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),s.get(l)!==d&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),s.set(l,d))),l.isSkinnedMesh){const g=l.skeleton;s.get(g)!==d&&(g.update(),s.set(g,d))}return u}function o(){s=new WeakMap}function c(l){const d=l.target;d.removeEventListener("dispose",c),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const Kh={[Fo]:"LINEAR_TONE_MAPPING",[Oo]:"REINHARD_TONE_MAPPING",[Bo]:"CINEON_TONE_MAPPING",[ra]:"ACES_FILMIC_TONE_MAPPING",[Go]:"AGX_TONE_MAPPING",[Vo]:"NEUTRAL_TONE_MAPPING",[zo]:"CUSTOM_TONE_MAPPING"};function Zh(i,e,t,n,r,s){const a=new jt(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new ci(e,t):void 0}),o=new jt(e,t,{type:dn,depthBuffer:!1,stencilBuffer:!1}),c=new It;c.setAttribute("position",new At([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new At([0,2,0,0,2,0],2));const l=new Hc({uniforms:{tDiffuse:{value:null}},vertexShader:` 3969 precision highp float; 3970 3971 uniform mat4 modelViewMatrix; 3972 uniform mat4 projectionMatrix; 3973 3974 attribute vec3 position; 3975 attribute vec2 uv; 3976 3977 varying vec2 vUv; 3978 3979 void main() { 3980 vUv = uv; 3981 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3982 }`,fragmentShader:` 3983 precision highp float; 3984 3985 uniform sampler2D tDiffuse; 3986 3987 varying vec2 vUv; 3988 3989 #include <tonemapping_pars_fragment> 3990 #include <colorspace_pars_fragment> 3991 3992 void main() { 3993 gl_FragColor = texture2D( tDiffuse, vUv ); 3994 3995 #ifdef LINEAR_TONE_MAPPING 3996 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3997 #elif defined( REINHARD_TONE_MAPPING ) 3998 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3999 #elif defined( CINEON_TONE_MAPPING ) 4000 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 4001 #elif defined( ACES_FILMIC_TONE_MAPPING ) 4002 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 4003 #elif defined( AGX_TONE_MAPPING ) 4004 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4005 #elif defined( NEUTRAL_TONE_MAPPING ) 4006 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4007 #elif defined( CUSTOM_TONE_MAPPING ) 4008 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4009 #endif 4010 4011 #ifdef SRGB_TRANSFER 4012 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4013 #endif 4014 }`,depthTest:!1,depthWrite:!1}),d=new mn(c,l),m=new ul(-1,1,1,-1,0,1);let u=null,g=null,x=!1,S,p=null,f=[],b=!1;this.setSize=function(A,M){a.setSize(A,M),o.setSize(A,M);for(let R=0;R<f.length;R++){const y=f[R];y.setSize&&y.setSize(A,M)}},this.setEffects=function(A){f=A,b=f.length>0&&f[0].isRenderPass===!0;const M=a.width,R=a.height;for(let y=0;y<f.length;y++){const w=f[y];w.setSize&&w.setSize(M,R)}},this.begin=function(A,M){if(x||A.toneMapping===Qt&&f.length===0)return!1;if(p=M,M!==null){const R=M.width,y=M.height;(a.width!==R||a.height!==y)&&this.setSize(R,y)}return b===!1&&A.setRenderTarget(a),S=A.toneMapping,A.toneMapping=Qt,!0},this.hasRenderPass=function(){return b},this.end=function(A,M){A.toneMapping=S,x=!0;let R=a,y=o;for(let w=0;w<f.length;w++){const _=f[w];if(_.enabled!==!1&&(_.render(A,y,R,M),_.needsSwap!==!1)){const T=R;R=y,y=T}}if(u!==A.outputColorSpace||g!==A.toneMapping){u=A.outputColorSpace,g=A.toneMapping,l.defines={},Fe.getTransfer(u)===Ye&&(l.defines.SRGB_TRANSFER="");const w=Kh[g];w&&(l.defines[w]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=R.texture,A.setRenderTarget(p),A.render(d,m),p=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),c.dispose(),l.dispose()}}const pl=new Tt,ta=new ci(1,1),ml=new Jo,gl=new mc,_l=new al,xo=[],vo=[],Mo=new Float32Array(16),So=new Float32Array(9),Eo=new Float32Array(4);function di(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=xo[r];if(s===void 0&&(s=new Float32Array(r),xo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function dt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function pt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Cr(i,e){let t=vo[e];t===void 0&&(t=new Int32Array(e),vo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function $h(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Jh(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2fv(this.addr,e),pt(t,e)}}function Qh(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(dt(t,e))return;i.uniform3fv(this.addr,e),pt(t,e)}}function jh(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4fv(this.addr,e),pt(t,e)}}function ed(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;Eo.set(n),i.uniformMatrix2fv(this.addr,!1,Eo),pt(t,n)}}function td(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;So.set(n),i.uniformMatrix3fv(this.addr,!1,So),pt(t,n)}}function nd(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;Mo.set(n),i.uniformMatrix4fv(this.addr,!1,Mo),pt(t,n)}}function id(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function rd(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2iv(this.addr,e),pt(t,e)}}function sd(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(dt(t,e))return;i.uniform3iv(this.addr,e),pt(t,e)}}function ad(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4iv(this.addr,e),pt(t,e)}}function od(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function ld(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2uiv(this.addr,e),pt(t,e)}}function cd(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(dt(t,e))return;i.uniform3uiv(this.addr,e),pt(t,e)}}function ud(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4uiv(this.addr,e),pt(t,e)}}function fd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(ta.compareFunction=t.isReversedDepthBuffer()?ha:fa,s=ta):s=pl,t.setTexture2D(e||s,r)}function hd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||gl,r)}function dd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||_l,r)}function pd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||ml,r)}function md(i){switch(i){case 5126:return $h;case 35664:return Jh;case 35665:return Qh;case 35666:return jh;case 35674:return ed;case 35675:return td;case 35676:return nd;case 5124:case 35670:return id;case 35667:case 35671:return rd;case 35668:case 35672:return sd;case 35669:case 35673:return ad;case 5125:return od;case 36294:return ld;case 36295:return cd;case 36296:return ud;case 35678:case 36198:case 36298:case 36306:case 35682:return fd;case 35679:case 36299:case 36307:return hd;case 35680:case 36300:case 36308:case 36293:return dd;case 36289:case 36303:case 36311:case 36292:return pd}}function gd(i,e){i.uniform1fv(this.addr,e)}function _d(i,e){const t=di(e,this.size,2);i.uniform2fv(this.addr,t)}function xd(i,e){const t=di(e,this.size,3);i.uniform3fv(this.addr,t)}function vd(i,e){const t=di(e,this.size,4);i.uniform4fv(this.addr,t)}function Md(i,e){const t=di(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Sd(i,e){const t=di(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Ed(i,e){const t=di(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function yd(i,e){i.uniform1iv(this.addr,e)}function Td(i,e){i.uniform2iv(this.addr,e)}function bd(i,e){i.uniform3iv(this.addr,e)}function Ad(i,e){i.uniform4iv(this.addr,e)}function Rd(i,e){i.uniform1uiv(this.addr,e)}function wd(i,e){i.uniform2uiv(this.addr,e)}function Cd(i,e){i.uniform3uiv(this.addr,e)}function Pd(i,e){i.uniform4uiv(this.addr,e)}function Dd(i,e,t){const n=this.cache,r=e.length,s=Cr(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=ta:a=pl;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Ld(i,e,t){const n=this.cache,r=e.length,s=Cr(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||gl,s[a])}function Id(i,e,t){const n=this.cache,r=e.length,s=Cr(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||_l,s[a])}function Ud(i,e,t){const n=this.cache,r=e.length,s=Cr(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||ml,s[a])}function Nd(i){switch(i){case 5126:return gd;case 35664:return _d;case 35665:return xd;case 35666:return vd;case 35674:return Md;case 35675:return Sd;case 35676:return Ed;case 5124:case 35670:return yd;case 35667:case 35671:return Td;case 35668:case 35672:return bd;case 35669:case 35673:return Ad;case 5125:return Rd;case 36294:return wd;case 36295:return Cd;case 36296:return Pd;case 35678:case 36198:case 36298:case 36306:case 35682:return Dd;case 35679:case 36299:case 36307:return Ld;case 35680:case 36300:case 36308:case 36293:return Id;case 36289:case 36303:case 36311:case 36292:return Ud}}class Fd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=md(t.type)}}class Od{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Nd(t.type)}}class Bd{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const us=/(\w+)(\])?(\[|\.)?/g;function yo(i,e){i.seq.push(e),i.map[e.id]=e}function zd(i,e,t){const n=i.name,r=n.length;for(us.lastIndex=0;;){const s=us.exec(n),a=us.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){yo(t,l===void 0?new Fd(o,i,e):new Od(o,i,e));break}else{let m=t.map[o];m===void 0&&(m=new Bd(o),yo(t,m)),t=m}}}class mr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);zd(o,c,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function To(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Gd=37297;let Vd=0;function Hd(i,e){const t=i.split(` 4015`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 4016`)}const bo=new Ce;function kd(i){Fe._getMatrix(bo,Fe.workingColorSpace,i);const e=`mat3( ${bo.elements.map(t=>t.toFixed(4))} )`;switch(Fe.getTransfer(i)){case Mr:return[e,"LinearTransferOETF"];case Ye:return[e,"sRGBTransferOETF"];default:return Re("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Ao(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 4017 4018`+s+` 4019 4020`+Hd(i.getShaderSource(e),o)}else return s}function Wd(i,e){const t=kd(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 4021`)}const Xd={[Fo]:"Linear",[Oo]:"Reinhard",[Bo]:"Cineon",[ra]:"ACESFilmic",[Go]:"AgX",[Vo]:"Neutral",[zo]:"Custom"};function qd(i,e){const t=Xd[e];return t===void 0?(Re("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}
vendor: 1,827 bytes, lines 4021-4024
4021const lr=new U;function Yd(){Fe.getLuminanceCoefficients(lr);const i=lr.x.toFixed(4),e=lr.y.toFixed(4),t=lr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 4022`)}function Kd(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ti).join(` 4023`)}function Zd(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 4024`)}function $d(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Ti(i){return i!==""}function Ro(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function wo(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Jd=/^[ \t]*#include +<([\w\d./]+)>/gm;function na(i){return i.replace(Jd,jd)}const Qd=new Map;
vendor: 9,446 bytes, lines 4024-4051
4024function jd(i,e){let t=Ie[e];if(t===void 0){const n=Qd.get(e);if(n!==void 0)t=Ie[n],Re('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return na(t)}const ep=/#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 Co(i){return i.replace(ep,tp)}function tp(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Po(i){let e=`precision ${i.precision} float; 4025 precision ${i.precision} int; 4026 precision ${i.precision} sampler2D; 4027 precision ${i.precision} samplerCube; 4028 precision ${i.precision} sampler3D; 4029 precision ${i.precision} sampler2DArray; 4030 precision ${i.precision} sampler2DShadow; 4031 precision ${i.precision} samplerCubeShadow; 4032 precision ${i.precision} sampler2DArrayShadow; 4033 precision ${i.precision} isampler2D; 4034 precision ${i.precision} isampler3D; 4035 precision ${i.precision} isamplerCube; 4036 precision ${i.precision} isampler2DArray; 4037 precision ${i.precision} usampler2D; 4038 precision ${i.precision} usampler3D; 4039 precision ${i.precision} usamplerCube; 4040 precision ${i.precision} usampler2DArray; 4041 `;return i.precision==="highp"?e+=` 4042#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 4043#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 4044#define LOW_PRECISION`),e}const np={[cr]:"SHADOWMAP_TYPE_PCF",[Ei]:"SHADOWMAP_TYPE_VSM"};function ip(i){return np[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const rp={[Bn]:"ENVMAP_TYPE_CUBE",[li]:"ENVMAP_TYPE_CUBE",[Ar]:"ENVMAP_TYPE_CUBE_UV"};function sp(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":rp[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const ap={[li]:"ENVMAP_MODE_REFRACTION"};function op(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":ap[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const lp={[No]:"ENVMAP_BLENDING_MULTIPLY",[Kl]:"ENVMAP_BLENDING_MIX",[Zl]:"ENVMAP_BLENDING_ADD"};function cp(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":lp[i.combine]||"ENVMAP_BLENDING_NONE"}function up(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function fp(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=ip(t),l=sp(t),d=op(t),m=cp(t),u=up(t),g=Kd(t),x=Zd(s),S=r.createProgram();let p,f,b=t.glslVersion?"#version "+t.glslVersion+` 4045`:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Ti).join(` 4046`),p.length>0&&(p+=` 4047`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Ti).join(` 4048`),f.length>0&&(f+=` 4049`)):(p=[Po(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+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",` 4050`].filter(Ti).join(` 4051`),f=[Po(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+d:"",t.envMap?"#define "+m:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4051IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qt?"#define TONE_MAPPING":"",t.toneMapping!==Qt?Ie.tonemapping_pars_fragment:"",t.toneMapping!==Qt?qd("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ie.colorspace_pars_fragment,Wd("linearToOutputTexel",t.outputColorSpace),Yd(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 4052`].filter(Ti).join(` 4053`)),a=na(a),a=Ro(a,t),a=wo(a,t),o=na(o),o=Ro(o,t),o=wo(o,t),a=Co(a),o=Co(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es 4054`,p=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(` 4055`)+` 4056`+p,f=["#define varying in",t.glslVersion===Oa?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Oa?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 4057`)+` 4058`+f);const A=b+p+a,M=b+f+o,R=To(r,r.VERTEX_SHADER,A),y=To(r,r.FRAGMENT_SHADER,M);r.attachShader(S,R),r.attachShader(S,y),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S);function w(D){if(i.debug.checkShaderErrors){const F=r.getProgramInfoLog(S)||"",Y=r.getShaderInfoLog(R)||"",Z=r.getShaderInfoLog(y)||"",G=F.trim(),X=Y.trim(),H=Z.trim();let J=!0,j=!0;if(r.getProgramParameter(S,r.LINK_STATUS)===!1)if(J=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,S,R,y);else{const ue=Ao(r,R,"vertex"),pe=Ao(r,y,"fragment");Ve("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,r.VALIDATE_STATUS)+` 4059 4060Material Name: `+D.name+` 4061Material Type: `+D.type+` 4062 4063Program Info Log: `+G+` 4064`+ue+` 4065`+pe)}else G!==""?Re("WebGLProgram: Program Info Log:",G):(X===""||H==="")&&(j=!1);j&&(D.diagnostics={runnable:J,programLog:G,vertexShader:{log:X,prefix:p},fragmentShader:{log:H,prefix:f}})}r.deleteShader(R),r.deleteShader(y),_=new mr(r,S),T=$d(r,S)}let _;this.getUniforms=function(){return _===void 0&&w(this),_};let T;this.getAttributes=function(){return T===void 0&&w(this),T};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=r.getProgramParameter(S,Gd)),C},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Vd++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=R,this.fragmentShader=y,this}let hp=0;class dp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new pp(e),t.set(e,n)),n}}class pp{constructor(e){this.id=hp++,this.code=e,this.usedTimes=0}}function mp(i){return i===zn||i===_r||i===xr}
vendor: 6,760 bytes, line 4065
4065function gp(i,e,t,n,r,s){const a=new Qo,o=new dp,c=new Set,l=[],d=new Map,m=n.logarithmicDepthBuffer;let u=n.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(_){return c.add(_),_===0?"uv":`uv${_}`}function S(_,T,C,D,F,Y){const Z=D.fog,G=F.geometry,X=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?D.environment:null,H=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,J=e.get(_.envMap||X,H),j=J&&J.mapping===Ar?J.image.height:null,ue=g[_.type];_.precision!==null&&(u=n.getMaxPrecision(_.precision),u!==_.precision&&Re("WebGLProgram.getParameters:",_.precision,"not supported, using",u,"instead."));const pe=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,_e=pe!==void 0?pe.length:0;let ke=0;G.morphAttributes.position!==void 0&&(ke=1),G.morphAttributes.normal!==void 0&&(ke=2),G.morphAttributes.color!==void 0&&(ke=3);let et,We,$,ie;if(ue){const xe=Zt[ue];et=xe.vertexShader,We=xe.fragmentShader}else{et=_.vertexShader,We=_.fragmentShader;const xe=o.getVertexShaderStage(_),nt=o.getFragmentShaderStage(_);o.update(_,xe,nt),$=xe.id,ie=nt.id}const ee=i.getRenderTarget(),we=i.state.buffers.depth.getReversed(),Pe=F.isInstancedMesh===!0,be=F.isBatchedMesh===!0,at=!!_.map,Ne=!!_.matcap,Ze=!!J,Xe=!!_.aoMap,ze=!!_.lightMap,ct=!!_.bumpMap&&_.wireframe===!1,ht=!!_.normalMap,mt=!!_.displacementMap,_t=!!_.emissiveMap,tt=!!_.metalnessMap,ut=!!_.roughnessMap,L=_.anisotropy>0,Rt=_.clearcoat>0,qe=_.dispersion>0,E=_.iridescence>0,h=_.sheen>0,N=_.transmission>0,z=L&&!!_.anisotropyMap,k=Rt&&!!_.clearcoatMap,te=Rt&&!!_.clearcoatNormalMap,re=Rt&&!!_.clearcoatRoughnessMap,W=E&&!!_.iridescenceMap,K=E&&!!_.iridescenceThicknessMap,se=h&&!!_.sheenColorMap,Se=h&&!!_.sheenRoughnessMap,le=!!_.specularMap,ae=!!_.specularColorMap,Te=!!_.specularIntensityMap,Ae=N&&!!_.transmissionMap,De=N&&!!_.thicknessMap,P=!!_.gradientMap,ne=!!_.alphaMap,q=_.alphaTest>0,oe=!!_.alphaHash,de=!!_.extensions;let Q=Qt;_.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(Q=i.toneMapping);const Me={shaderID:ue,shaderType:_.type,shaderName:_.name,vertexShader:et,fragmentShader:We,defines:_.defines,customVertexShaderID:$,customFragmentShaderID:ie,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:u,batching:be,batchingColor:be&&F._colorsTexture!==null,instancing:Pe,instancingColor:Pe&&F.instanceColor!==null,instancingMorph:Pe&&F.morphTexture!==null,outputColorSpace:ee===null?i.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:Fe.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:at,matcap:Ne,envMap:Ze,envMapMode:Ze&&J.mapping,envMapCubeUVHeight:j,aoMap:Xe,lightMap:ze,bumpMap:ct,normalMap:ht,displacementMap:mt,emissiveMap:_t,normalMapObjectSpace:ht&&_.normalMapType===Ql,normalMapTangentSpace:ht&&_.normalMapType===Ua,packedNormalMap:ht&&_.normalMapType===Ua&&mp(_.normalMap.format),metalnessMap:tt,roughnessMap:ut,anisotropy:L,anisotropyMap:z,clearcoat:Rt,clearcoatMap:k,clearcoatNormalMap:te,clearcoatRoughnessMap:re,dispersion:qe,iridescence:E,iridescenceMap:W,iridescenceThicknessMap:K,sheen:h,sheenColorMap:se,sheenRoughnessMap:Se,specularMap:le,specularColorMap:ae,specularIntensityMap:Te,transmission:N,transmissionMap:Ae,thicknessMap:De,gradientMap:P,opaque:_.transparent===!1&&_.blending===ri&&_.alphaToCoverage===!1,alphaMap:ne,alphaTest:q,alphaHash:oe,combine:_.combine,mapUv:at&&x(_.map.channel),aoMapUv:Xe&&x(_.aoMap.channel),lightMapUv:ze&&x(_.lightMap.channel),bumpMapUv:ct&&x(_.bumpMap.channel),normalMapUv:ht&&x(_.normalMap.channel),displacementMapUv:mt&&x(_.displacementMap.channel),emissiveMapUv:_t&&x(_.emissiveMap.channel),metalnessMapUv:tt&&x(_.metalnessMap.channel),roughnessMapUv:ut&&x(_.roughnessMap.channel),anisotropyMapUv:z&&x(_.anisotropyMap.channel),clearcoatMapUv:k&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:te&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:re&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:K&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:se&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:Se&&x(_.sheenRoughnessMap.channel),specularMapUv:le&&x(_.specularMap.channel),specularColorMapUv:ae&&x(_.specularColorMap.channel),specularIntensityMapUv:Te&&x(_.specularIntensityMap.channel),transmissionMapUv:Ae&&x(_.transmissionMap.channel),thicknessMapUv:De&&x(_.thicknessMap.channel),alphaMapUv:ne&&x(_.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(ht||L),vertexNormals:!!G.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!G.attributes.uv&&(at||ne),fog:!!Z,useFog:_.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||G.attributes.normal===void 0&&ht===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:we,skinning:F.isSkinnedMesh===!0,hasPositionAttribute:G.attributes.position!==void 0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:ke,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:Y.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:Q,decodeVideoTexture:at&&_.map.isVideoTexture===!0&&Fe.getTransfer(_.map.colorSpace)===Ye,decodeVideoTextureEmissive:_t&&_.emissiveMap.isVideoTexture===!0&&Fe.getTransfer(_.emissiveMap.colorSpace)===Ye,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===cn,flipSided:_.side===Ct,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionCl
vendor: 11,883 bytes, line 4065
4065ipCullDistance:de&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(de&&_.extensions.multiDraw===!0||be)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Me.vertexUv1s=c.has(1),Me.vertexUv2s=c.has(2),Me.vertexUv3s=c.has(3),c.clear(),Me}function p(_){const T=[];if(_.shaderID?T.push(_.shaderID):(T.push(_.customVertexShaderID),T.push(_.customFragmentShaderID)),_.defines!==void 0)for(const C in _.defines)T.push(C),T.push(_.defines[C]);return _.isRawShaderMaterial===!1&&(f(T,_),b(T,_),T.push(i.outputColorSpace)),T.push(_.customProgramCacheKey),T.join()}function f(_,T){_.push(T.precision),_.push(T.outputColorSpace),_.push(T.envMapMode),_.push(T.envMapCubeUVHeight),_.push(T.mapUv),_.push(T.alphaMapUv),_.push(T.lightMapUv),_.push(T.aoMapUv),_.push(T.bumpMapUv),_.push(T.normalMapUv),_.push(T.displacementMapUv),_.push(T.emissiveMapUv),_.push(T.metalnessMapUv),_.push(T.roughnessMapUv),_.push(T.anisotropyMapUv),_.push(T.clearcoatMapUv),_.push(T.clearcoatNormalMapUv),_.push(T.clearcoatRoughnessMapUv),_.push(T.iridescenceMapUv),_.push(T.iridescenceThicknessMapUv),_.push(T.sheenColorMapUv),_.push(T.sheenRoughnessMapUv),_.push(T.specularMapUv),_.push(T.specularColorMapUv),_.push(T.specularIntensityMapUv),_.push(T.transmissionMapUv),_.push(T.thicknessMapUv),_.push(T.combine),_.push(T.fogExp2),_.push(T.sizeAttenuation),_.push(T.morphTargetsCount),_.push(T.morphAttributeCount),_.push(T.numDirLights),_.push(T.numPointLights),_.push(T.numSpotLights),_.push(T.numSpotLightMaps),_.push(T.numHemiLights),_.push(T.numRectAreaLights),_.push(T.numDirLightShadows),_.push(T.numPointLightShadows),_.push(T.numSpotLightShadows),_.push(T.numSpotLightShadowsWithMaps),_.push(T.numLightProbes),_.push(T.shadowMapType),_.push(T.toneMapping),_.push(T.numClippingPlanes),_.push(T.numClipIntersection),_.push(T.depthPacking)}function b(_,T){a.disableAll(),T.instancing&&a.enable(0),T.instancingColor&&a.enable(1),T.instancingMorph&&a.enable(2),T.matcap&&a.enable(3),T.envMap&&a.enable(4),T.normalMapObjectSpace&&a.enable(5),T.normalMapTangentSpace&&a.enable(6),T.clearcoat&&a.enable(7),T.iridescence&&a.enable(8),T.alphaTest&&a.enable(9),T.vertexColors&&a.enable(10),T.vertexAlphas&&a.enable(11),T.vertexUv1s&&a.enable(12),T.vertexUv2s&&a.enable(13),T.vertexUv3s&&a.enable(14),T.vertexTangents&&a.enable(15),T.anisotropy&&a.enable(16),T.alphaHash&&a.enable(17),T.batching&&a.enable(18),T.dispersion&&a.enable(19),T.batchingColor&&a.enable(20),T.gradientMap&&a.enable(21),T.packedNormalMap&&a.enable(22),T.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.reversedDepthBuffer&&a.enable(4),T.skinning&&a.enable(5),T.morphTargets&&a.enable(6),T.morphNormals&&a.enable(7),T.morphColors&&a.enable(8),T.premultipliedAlpha&&a.enable(9),T.shadowMapEnabled&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),T.decodeVideoTexture&&a.enable(19),T.decodeVideoTextureEmissive&&a.enable(20),T.alphaToCoverage&&a.enable(21),T.numLightProbeGrids>0&&a.enable(22),T.hasPositionAttribute&&a.enable(23),_.push(a.mask)}function A(_){const T=g[_.type];let C;if(T){const D=Zt[T];C=zc.clone(D.uniforms)}else C=_.uniforms;return C}function M(_,T){let C=d.get(T);return C!==void 0?++C.usedTimes:(C=new fp(i,T,_,r),l.push(C),d.set(T,C)),C}function R(_){if(--_.usedTimes===0){const T=l.indexOf(_);l[T]=l[l.length-1],l.pop(),d.delete(_.cacheKey),_.destroy()}}function y(_){o.remove(_)}function w(){o.dispose()}return{getParameters:S,getProgramCacheKey:p,getUniforms:A,acquireProgram:M,releaseProgram:R,releaseShaderCache:y,programs:l,dispose:w}}function _p(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,c){i.get(a)[o]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function xp(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function Do(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Lo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u){let g=0;return u.isInstancedMesh&&(g+=2),u.isSkinnedMesh&&(g+=1),g}function o(u,g,x,S,p,f){let b=i[e];return b===void 0?(b={id:u.id,object:u,geometry:g,material:x,materialVariant:a(u),groupOrder:S,renderOrder:u.renderOrder,z:p,group:f},i[e]=b):(b.id=u.id,b.object=u,b.geometry=g,b.material=x,b.materialVariant=a(u),b.groupOrder=S,b.renderOrder=u.renderOrder,b.z=p,b.group=f),e++,b}function c(u,g,x,S,p,f){const b=o(u,g,x,S,p,f);x.transmission>0?n.push(b):x.transparent===!0?r.push(b):t.push(b)}function l(u,g,x,S,p,f){const b=o(u,g,x,S,p,f);x.transmission>0?n.unshift(b):x.transparent===!0?r.unshift(b):t.unshift(b)}function d(u,g,x){t.length>1&&t.sort(u||xp),n.length>1&&n.sort(g||Do),r.length>1&&r.sort(g||Do),x&&(t.reverse(),n.reverse(),r.reverse())}function m(){for(let u=e,g=i.length;u<g;u++){const x=i[u];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:c,unshift:l,finish:m,sort:d}}function vp(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Lo,i.set(n,[a])):r>=s.length?(a=new Lo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Mp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new He};break;case"SpotLight":t={position:new U,direction:new U,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function Sp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Ep=0;function yp(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Tp(i){const e=new Mp,t=Sp(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new U);const r=new U,s=new st,a=new st;function o(l){let d=0,m=0,u=0;for(let T=0;T<9;T++)n.probe[T].set(0,0,0);let g=0,x=0,S=0,p=0,f=0,b=0,A=0,M=0,R=0,y=0,w=0;l.sort(yp);for(let T=0,C=l.length;T<C;T++){const D=l[T],F=D.color,Y=D.intensity,Z=D.distance;let G=null;if(D.shadow&&D.shadow.map&&(D.shadow.map.texture.format===zn?G=D.shadow.map.texture:G=D.shadow.map.depthTexture||D.shadow.map.texture),D.isAmbientLight)d+=F.r*Y,m+=F.g*Y,u+=F.b*Y;else if(D.isLightProbe){for(let X=0;X<9;X++)n.probe[X].addScaledVector(D.sh.coefficients[X],Y);w++}else if(D.isDirectionalLight){const X=e.get(D);if(X.color.copy(D.color).multiplyScalar(D.intensity),D.castShadow){const H=D.shadow,J=t.get(D);J.shadowIntensity=H.intensity,J.shadowBias=H.bias,J.shadowNormalBias=H.normalBias,J.shadowRadius=H.radius,J.shadowMapSize=H.mapSize,n.directionalShadow[g]=J,n.directionalShadowMap[g]=G,n.directionalShadowMatrix[g]=D.shadow.matrix,b++}n.directional[g]=X,g++}else if(D.isSpotLight){const X=e.get(D);X.position.setFromMatrixPosition(D.matrixWorld),X.color.copy(F).multiplyScalar(Y),X.distance=Z,X.coneCos=Math.cos(D.angle),X.penumbraCos=Math.cos(D.angle*(1-D.penumbra)),X.decay=D.decay,n.spot[S]=X;const H=D.shadow;if(D.map&&(n.spotLightMap[R]=D.map,R++,H.updateMatrices(D),D.castShadow&&y++),n.spotLightMatrix[S]=H.matrix,D.castShadow){const J=t.get(D);J.shadowIntensity=H.intensity,J.shadowBias=H.bias,J.shadowNormalBias=H.normalBias,J.shadowRadius=H.radius,J.shadowMapSize=H.mapSize,n.spotShadow[S]=J,n.spotShadowMap[S]=G,M++}S++}else if(D.isRectAreaLight){const X=e.get(D);X.color.copy(F).multiplyScalar(Y),X.halfWidth.set(D.width*.5,0,0),X.halfHeight.set(0,D.height*.5,0),n.rectArea[p]=X,p++}else if(D.isPointLight){const X=e.get(D);if(X.color.copy(D.color).multiplyScalar(D.intensity),X.distance=D.distance,X.decay=D.decay,D.castShadow){const H=D.shadow,J=t.get(D);J.shadowIntensity=H.intensity,J.shadowBias=H.bias,J.shadowNormalBias=H.normalBias,J.shadowRadius=H.radius,J.shadowMapSize=H.mapSize,J.shadowCameraNear=H.camera.near,J.shadowCameraFar=H.camera.far,n.pointShadow[x]=J,n.pointShadowMap[x]=G,n.pointShadowMatrix[x]=D.shadow.matrix,A++}n.point[x]=X,x++}else if(D.isHemisphereLight){const X=e.get(D);X.skyColor.copy(D.color).multiplyScalar(Y),X.groundColor.copy(D.groundColor).multiplyScalar(Y),n.hemi[f]=X,f++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ce.LTC_FLOAT_1,n.rectAreaLTC2=ce.LTC_FLOAT_2):(n.rectAreaLTC1=ce.LTC_HALF_1,n.rectAreaLTC2=ce.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=m,n.ambient[2]=u;const _=n.hash;(_.directionalLength!==g||_.pointLength!==x||_.spotLength!==S||_.rectAreaLength!==p||_.hemiLength!==f||_.numDirectionalShadows!==b||_.numPointShadows!==A||_.numSpotShadows!==M||_.numSpotMaps!==R||_.numLightProbes!==w)&&(n.directional.length=g,n.spot.length=S,n.rectArea.length=p,n.point.length=x,n.hemi.length=f,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=A,n.spotLightMatrix.length=M+R-y,n.spotLightMap.length=R,n.numSpotLightShadowsWithMaps=y,n.numLightProbes=w,_.directionalLength=g,_.pointLength=x,_.spotLength=S,_.rectAreaLength=p,_.hemiLength=f,_.numDirectionalShadows=b,_.numPointShadows=A,_.numSpotShadows=M,_.numSpotMaps=R,_.numLightProbes=w,n.version=Ep++)}function c(l,d){let m=0,u=0,g=0,x=0,S=0;const p=d.matrixWorldInverse;for(let f=0,b=l.length;f<b;f++){const A=l[f];if(A.isDirectionalLight){const M=n.directional[m];M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(p),m++}else if(A.isSpotLight){const M=n.spot[g];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(p),g++}else if(A.isRectAreaLight){const M=n.rectArea[x];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),a.identity(),s.copy(A.matrixWorld),s.premultiply(
vendor: 5,135 bytes, lines 4065-4092
4065p),a.extractRotation(s),M.halfWidth.set(A.width*.5,0,0),M.halfHeight.set(0,A.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(A.isPointLight){const M=n.point[u];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),u++}else if(A.isHemisphereLight){const M=n.hemi[S];M.direction.setFromMatrixPosition(A.matrixWorld),M.direction.transformDirection(p),S++}}}return{setup:o,setupView:c,state:n}}function Io(i){const e=new Tp(i),t=[],n=[],r=[];function s(u){m.camera=u,t.length=0,n.length=0,r.length=0}function a(u){t.push(u)}function o(u){n.push(u)}function c(u){r.push(u)}function l(){e.setup(t)}function d(u){e.setupView(t,u)}const m={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:m,setupLights:l,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function bp(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Io(i),e.set(r,[o])):s>=a.length?(o=new Io(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Ap=`void main() { 4066 gl_Position = vec4( position, 1.0 ); 4067}`,Rp=`uniform sampler2D shadow_pass; 4068uniform vec2 resolution; 4069uniform float radius; 4070void main() { 4071 const float samples = float( VSM_SAMPLES ); 4072 float mean = 0.0; 4073 float squared_mean = 0.0; 4074 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4075 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4076 for ( float i = 0.0; i < samples; i ++ ) { 4077 float uvOffset = uvStart + i * uvStride; 4078 #ifdef HORIZONTAL_PASS 4079 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4080 mean += distribution.x; 4081 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4082 #else 4083 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4084 mean += depth; 4085 squared_mean += depth * depth; 4086 #endif 4087 } 4088 mean = mean / samples; 4089 squared_mean = squared_mean / samples; 4090 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4091 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4092}`,wp=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],Cp=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Uo=new st,Si=new U,fs=new U;function Pp(i,e,t){let n=new il;const r=new Be,s=new Be,a=new rt,o=new kc,c=new Wc,l={},d=t.maxTextureSize,m={[Rn]:Ct,[Ct]:Rn,[cn]:cn},u=new nn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:Ap,fragmentShader:Rp}),g=u.clone();g.defines.HORIZONTAL_PASS=1;const x=new It;x.setAttribute("position",new en(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new mn(x,u),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=cr;let f=this.type;this.render=function(y,w,_){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||y.length===0)return;this.type===Cl&&(Re("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=cr);const T=i.getRenderTarget(),C=i.getActiveCubeFace(),D=i.getActiveMipmapLevel(),F=i.state;F.setBlending(fn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const Y=f!==this.type;Y&&w.traverse(function(Z){Z.material&&(Array.isArray(Z.material)?Z.material.forEach(G=>G.needsUpdate=!0):Z.material.needsUpdate=!0)});for(let Z=0,G=y.length;Z<G;Z++){const X=y[Z],H=X.shadow;if(H===void 0){Re("WebGLShadowMap:",X,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;r.copy(H.mapSize);const J=H.getFrameExtents();r.multiply(J),s.copy(H.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/J.x),r.x=s.x*J.x,H.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/J.y),r.y=s.y*J.y,H.mapSize.y=s.y));const j=i.state.buffers.depth.getReversed();if(H.camera._reversedDepth=j,H.map===null||Y===!0){if(H.map!==null&&(H.map.depthTexture!==null&&(H.map.depthTexture.dispose(),H.map.depthTexture=null),H.map.dispose()),this.type===Ei){if(X.isPointLight){Re("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}H.map=new jt(r.x,r.y,{format:zn,type:dn,minFilter:Et,magFilter:Et,generateMipmaps:!1}),H.map.texture.name=X.name+".shadowMap",H.map.depthTexture=new ci(r.x,r.y,$t),H.map.depthTexture.name=X.name+".shadowMapDepth",H.map.depthTexture.format=pn,H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=xt,H.map.depthTexture.magFilter=xt}else X.isPointLight?(H.map=new dl(r.x),H.map.depthTexture=new Fc(r.x,tn)):(H.map=new jt(r.x,r.y),H.map.depthTexture=new ci(r.x,r.y,tn)),H.map.depthTexture.name=X.name+".shadowMap",H.map.depthTexture.format=pn,this.type===cr?(H.map.depthTexture.compareFunction=j?ha:fa,H.map.depthTexture.minFilter=Et,H.map.depthTexture.magFilter=Et):(H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=xt,H.map.depthTexture.magFilter=xt);H.camera.updateProjectionMatrix()}
vendor: 9,241 bytes, line 4092
4092const ue=H.map.isWebGLCubeRenderTarget?6:1;for(let pe=0;pe<ue;pe++){if(H.map.isWebGLCubeRenderTarget)i.setRenderTarget(H.map,pe),i.clear();else{pe===0&&(i.setRenderTarget(H.map),i.clear());const _e=H.getViewport(pe);a.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),F.viewport(a)}if(X.isPointLight){const _e=H.camera,ke=H.matrix,et=X.distance||_e.far;et!==_e.far&&(_e.far=et,_e.updateProjectionMatrix()),Si.setFromMatrixPosition(X.matrixWorld),_e.position.copy(Si),fs.copy(_e.position),fs.add(wp[pe]),_e.up.copy(Cp[pe]),_e.lookAt(fs),_e.updateMatrixWorld(),ke.makeTranslation(-Si.x,-Si.y,-Si.z),Uo.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),H._frustum.setFromProjectionMatrix(Uo,_e.coordinateSystem,_e.reversedDepth)}else H.updateMatrices(X);n=H.getFrustum(),M(w,_,H.camera,X,this.type)}H.isPointLightShadow!==!0&&this.type===Ei&&b(H,_),H.needsUpdate=!1}f=this.type,p.needsUpdate=!1,i.setRenderTarget(T,C,D)};function b(y,w){const _=e.update(S);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,g.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,g.needsUpdate=!0),y.mapPass===null&&(y.mapPass=new jt(r.x,r.y,{format:zn,type:dn})),u.uniforms.shadow_pass.value=y.map.depthTexture,u.uniforms.resolution.value=y.mapSize,u.uniforms.radius.value=y.radius,i.setRenderTarget(y.mapPass),i.clear(),i.renderBufferDirect(w,null,_,u,S,null),g.uniforms.shadow_pass.value=y.mapPass.texture,g.uniforms.resolution.value=y.mapSize,g.uniforms.radius.value=y.radius,i.setRenderTarget(y.map),i.clear(),i.renderBufferDirect(w,null,_,g,S,null)}function A(y,w,_,T){let C=null;const D=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(D!==void 0)C=D;else if(C=_.isPointLight===!0?c:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){const F=C.uuid,Y=w.uuid;let Z=l[F];Z===void 0&&(Z={},l[F]=Z);let G=Z[Y];G===void 0&&(G=C.clone(),Z[Y]=G,w.addEventListener("dispose",R)),C=G}if(C.visible=w.visible,C.wireframe=w.wireframe,T===Ei?C.side=w.shadowSide!==null?w.shadowSide:w.side:C.side=w.shadowSide!==null?w.shadowSide:m[w.side],C.alphaMap=w.alphaMap,C.alphaTest=w.alphaToCoverage===!0?.5:w.alphaTest,C.map=w.map,C.clipShadows=w.clipShadows,C.clippingPlanes=w.clippingPlanes,C.clipIntersection=w.clipIntersection,C.displacementMap=w.displacementMap,C.displacementScale=w.displacementScale,C.displacementBias=w.displacementBias,C.wireframeLinewidth=w.wireframeLinewidth,C.linewidth=w.linewidth,_.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const F=i.properties.get(C);F.light=_}return C}function M(y,w,_,T,C){if(y.visible===!1)return;if(y.layers.test(w.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&C===Ei)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,y.matrixWorld);const Y=e.update(y),Z=y.material;if(Array.isArray(Z)){const G=Y.groups;for(let X=0,H=G.length;X<H;X++){const J=G[X],j=Z[J.materialIndex];if(j&&j.visible){const ue=A(y,j,T,C);y.onBeforeShadow(i,y,w,_,Y,ue,J),i.renderBufferDirect(_,null,Y,ue,y,J),y.onAfterShadow(i,y,w,_,Y,ue,J)}}}else if(Z.visible){const G=A(y,Z,T,C);y.onBeforeShadow(i,y,w,_,Y,G,null),i.renderBufferDirect(_,null,Y,G,y,null),y.onAfterShadow(i,y,w,_,Y,G,null)}}const F=y.children;for(let Y=0,Z=F.length;Y<Z;Y++)M(F[Y],w,_,T,C)}function R(y){y.target.removeEventListener("dispose",R);for(const _ in l){const T=l[_],C=y.target.uuid;C in T&&(T[C].dispose(),delete T[C])}}}function Dp(i,e){function t(){let P=!1;const ne=new rt;let q=null;const oe=new rt(0,0,0,0);return{setMask:function(de){q!==de&&!P&&(i.colorMask(de,de,de,de),q=de)},setLocked:function(de){P=de},setClear:function(de,Q,Me,xe,nt){nt===!0&&(de*=xe,Q*=xe,Me*=xe),ne.set(de,Q,Me,xe),oe.equals(ne)===!1&&(i.clearColor(de,Q,Me,xe),oe.copy(ne))},reset:function(){P=!1,q=null,oe.set(-1,0,0,0)}}}function n(){let P=!1,ne=!1,q=null,oe=null,de=null;return{setReversed:function(Q){if(ne!==Q){const Me=e.get("EXT_clip_control");Q?Me.clipControlEXT(Me.LOWER_LEFT_EXT,Me.ZERO_TO_ONE_EXT):Me.clipControlEXT(Me.LOWER_LEFT_EXT,Me.NEGATIVE_ONE_TO_ONE_EXT),ne=Q;const xe=de;de=null,this.setClear(xe)}},getReversed:function(){return ne},setTest:function(Q){Q?ee(i.DEPTH_TEST):we(i.DEPTH_TEST)},setMask:function(Q){q!==Q&&!P&&(i.depthMask(Q),q=Q)},setFunc:function(Q){if(ne&&(Q=lc[Q]),oe!==Q){switch(Q){case ps:i.depthFunc(i.NEVER);break;case ms:i.depthFunc(i.ALWAYS);break;case gs:i.depthFunc(i.LESS);break;case oi:i.depthFunc(i.LEQUAL);break;case _s:i.depthFunc(i.EQUAL);break;case xs:i.depthFunc(i.GEQUAL);break;case vs:i.depthFunc(i.GREATER);break;case Ms:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}oe=Q}},setLocked:function(Q){P=Q},setClear:function(Q){de!==Q&&(de=Q,ne&&(Q=1-Q),i.clearDepth(Q))},reset:function(){P=!1,q=null,oe=null,de=null,ne=!1}}}function r(){let P=!1,ne=null,q=null,oe=null,de=null,Q=null,Me=null,xe=null,nt=null;return{setTest:function(Qe){P||(Qe?ee(i.STENCIL_TEST):we(i.STENCIL_TEST))},setMask:function(Qe){ne!==Qe&&!P&&(i.stencilMask(Qe),ne=Qe)},setFunc:function(Qe,Wt,Xt){(q!==Qe||oe!==Wt||de!==Xt)&&(i.stencilFunc(Qe,Wt,Xt),q=Qe,oe=Wt,de=Xt)},setOp:function(Qe,Wt,Xt){(Q!==Qe||Me!==Wt||xe!==Xt)&&(i.stencilOp(Qe,Wt,Xt),Q=Qe,Me=Wt,xe=Xt)},setLocked:function(Qe){P=Qe},setClear:function(Qe){nt!==Qe&&(i.clearStencil(Qe),nt=Qe)},reset:function(){P=!1,ne=null,q=null,oe=null,de=null,Q=null,Me=null,xe=null,nt=null}}}const s=new t,a=new n,o=new r,c=new WeakMap,l=new WeakMap;let d={},m={},u={},g=new WeakMap,x=[],S=null,p=!1,f=null,b=null,A=null,M=null,R=null,y=null,w=null,_=new He(0,0,0),T=0,C=!1,D=null,F=null,Y=null,Z=null,G=null;const X=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,J=0;const j=i.getParameter(i.VERSION);j.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(j)[1]),H=J>=1):j.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),H=J>=2);let ue=null,pe={};const _e=i.getParameter(i.SCISSOR_BOX),ke=i.getParameter(i.VIEWPORT),et=new rt().fromArray(_e),We=new rt().fromArray(ke);function $(P,ne,q,oe){const de=new Uint8Array(4),Q=i.createTexture();i.bindTexture(P,Q),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Me=0;Me<q;Me++)P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY?i.texImage3D(ne,0,i.RGBA,1,1,oe,0,i.RGBA,i.UNSIGNED_BYTE,de):i.texImage2D(ne+Me,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,de);return Q}const ie={};ie[i.TEXTURE_2D]=$(i.TEXTURE_2D,i.TEXTURE_2D,1),ie[i.TEXTURE_CUBE_MAP]=$(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[i.TEXTURE_2D_ARRAY]=$(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ie[i.TEXTURE_3D]=$(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ee(i.DEPTH_TEST),a.setFunc(oi),ct(!1),ht(Da),ee(i.CULL_FACE),Xe(fn);function ee(P){d[P]!==!0&&(i.enable(P),d[P]=!0)}function we(P){d[P]!==!1&&(i.disable(P),d[P]=!1)}function Pe(P,ne){return u[P]!==ne?(i.bindFramebuffer(P,ne),u[P]=ne,P===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ne),P===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ne),!0):!1}function be(P,ne){let q=x,oe=!1;if(P){q=g.get(ne),q===void 0&&(q=[],g.set(ne,q));const de=P.textures;if(q.length!==de.length||q[0]!==i.COLOR_ATTACHMENT0){for(let Q=0,Me=de.length;Q<Me;Q++)q[Q]=i.COLOR_ATTACHMENT0+Q;q.length=de.length,oe=!0}}else q[0]!==i.BACK&&(q[0]=i.BACK,oe=!0);oe&&i.drawBuffers(q)}function at(P){return S!==P?(i.useProgram(P),S=P,!0):!1}const Ne={[Un]:i.FUNC_ADD,[Dl]:i.FUNC_SUBTRACT,[Ll]:i.FUNC_REVERSE_SUBTRACT};Ne[Il]=i.MIN,Ne[Ul]=i.MAX;const Ze={[Nl]:i.ZERO,[Fl]:i.ONE,[Ol]:i.SRC_COLOR,[hs]:i.SRC_ALPHA,[kl]:i.SRC_ALPHA_SATURATE,[Vl]:i.DST_COLOR,[zl]:i.DST_ALPHA,[Bl]:i.ONE_MINUS_SRC_COLOR,[ds]:i.ONE_MINUS_SRC_ALPHA,[Hl]:i.ONE_MINUS_DST_COLOR,[Gl]:i.ONE_MINUS_DST_ALPHA,[Wl]:i.CONSTANT_COLOR,[Xl]:i.ONE_MINUS_CONSTANT_COLOR,[ql]:i.CONSTANT_ALPHA,[Yl]:i.ONE_MINUS_CONSTANT_ALPHA};function Xe(P,ne,q,oe,de,Q,Me,xe,nt,Qe){if(P===fn){p===!0&&(we(i.BLEND),p=!1);return}if(p===!1&&(ee(i.BLEND),p=!0),P!==Pl){if(P!==f||Qe!==C){if((b!==Un||R!==Un)&&(i.blendEquation(i.FUNC_ADD),b=Un,R=Un),Qe)switch(P){case ri:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case gr:i.blendFunc(i.ONE,i.ONE);break;case La:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ia:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ve("WebGLState: Invalid blending: ",P);break}else switch(P){case ri:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case gr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case La:Ve("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Ia:Ve("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ve("WebGLState: Invalid blending: ",P);break}A=null,M=null,y=null,w=null,_.set(0,0,0),T=0,f=P,C=Qe}return}de=de||ne,Q=Q||q,Me=Me||oe,(ne!==b||de!==R)&&(i.blendEquationSeparate(Ne[ne],Ne[de]),b=ne,R=de),(q!==A||oe!==M||Q!==y||Me!==w)&&(i.blendFuncSeparate(Ze[q],Ze[oe],Ze[Q],Ze[Me]),A=q,M=oe,y=Q,w=Me),(xe.equals(_)===!1||nt!==T)&&(i.blendColor
vendor: 3,348 bytes, line 4092
4092(xe.r,xe.g,xe.b,nt),_.copy(xe),T=nt),f=P,C=!1}function ze(P,ne){P.side===cn?we(i.CULL_FACE):ee(i.CULL_FACE);let q=P.side===Ct;ne&&(q=!q),ct(q),P.blending===ri&&P.transparent===!1?Xe(fn):Xe(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),s.setMask(P.colorWrite);const oe=P.stencilWrite;o.setTest(oe),oe&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),_t(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?ee(i.SAMPLE_ALPHA_TO_COVERAGE):we(i.SAMPLE_ALPHA_TO_COVERAGE)}function ct(P){D!==P&&(P?i.frontFace(i.CW):i.frontFace(i.CCW),D=P)}function ht(P){P!==Rl?(ee(i.CULL_FACE),P!==F&&(P===Da?i.cullFace(i.BACK):P===wl?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):we(i.CULL_FACE),F=P}function mt(P){P!==Y&&(H&&i.lineWidth(P),Y=P)}function _t(P,ne,q){P?(ee(i.POLYGON_OFFSET_FILL),(Z!==ne||G!==q)&&(Z=ne,G=q,a.getReversed()&&(ne=-ne),i.polygonOffset(ne,q))):we(i.POLYGON_OFFSET_FILL)}function tt(P){P?ee(i.SCISSOR_TEST):we(i.SCISSOR_TEST)}function ut(P){P===void 0&&(P=i.TEXTURE0+X-1),ue!==P&&(i.activeTexture(P),ue=P)}function L(P,ne,q){q===void 0&&(ue===null?q=i.TEXTURE0+X-1:q=ue);let oe=pe[q];oe===void 0&&(oe={type:void 0,texture:void 0},pe[q]=oe),(oe.type!==P||oe.texture!==ne)&&(ue!==q&&(i.activeTexture(q),ue=q),i.bindTexture(P,ne||ie[P]),oe.type=P,oe.texture=ne)}function Rt(){const P=pe[ue];P!==void 0&&P.type!==void 0&&(i.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function qe(){try{i.compressedTexImage2D(...arguments)}catch(P){Ve("WebGLState:",P)}}function E(){try{i.compressedTexImage3D(...arguments)}catch(P){Ve("WebGLState:",P)}}function h(){try{i.texSubImage2D(...arguments)}catch(P){Ve("WebGLState:",P)}}function N(){try{i.texSubImage3D(...arguments)}catch(P){Ve("WebGLState:",P)}}function z(){try{i.compressedTexSubImage2D(...arguments)}catch(P){Ve("WebGLState:",P)}}function k(){try{i.compressedTexSubImage3D(...arguments)}catch(P){Ve("WebGLState:",P)}}function te(){try{i.texStorage2D(...arguments)}catch(P){Ve("WebGLState:",P)}}function re(){try{i.texStorage3D(...arguments)}catch(P){Ve("WebGLState:",P)}}function W(){try{i.texImage2D(...arguments)}catch(P){Ve("WebGLState:",P)}}function K(){try{i.texImage3D(...arguments)}catch(P){Ve("WebGLState:",P)}}function se(P){return m[P]!==void 0?m[P]:i.getParameter(P)}function Se(P,ne){m[P]!==ne&&(i.pixelStorei(P,ne),m[P]=ne)}function le(P){et.equals(P)===!1&&(i.scissor(P.x,P.y,P.z,P.w),et.copy(P))}function ae(P){We.equals(P)===!1&&(i.viewport(P.x,P.y,P.z,P.w),We.copy(P))}function Te(P,ne){let q=l.get(ne);q===void 0&&(q=new WeakMap,l.set(ne,q));let oe=q.get(P);oe===void 0&&(oe=i.getUniformBlockIndex(ne,P.name),q.set(P,oe))}function Ae(P,ne){const oe=l.get(ne).get(P);c.get(ne)!==oe&&(i.uniformBlockBinding(ne,oe,P.__bindingPointIndex),c.set(ne,oe))}function De(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor
vendor: 3,253 bytes, line 4092
4092(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),d={},m={},ue=null,pe={},u={},g=new WeakMap,x=[],S=null,p=!1,f=null,b=null,A=null,M=null,R=null,y=null,w=null,_=new He(0,0,0),T=0,C=!1,D=null,F=null,Y=null,Z=null,G=null,et.set(0,0,i.canvas.width,i.canvas.height),We.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ee,disable:we,bindFramebuffer:Pe,drawBuffers:be,useProgram:at,setBlending:Xe,setMaterial:ze,setFlipSided:ct,setCullFace:ht,setLineWidth:mt,setPolygonOffset:_t,setScissorTest:tt,activeTexture:ut,bindTexture:L,unbindTexture:Rt,compressedTexImage2D:qe,compressedTexImage3D:E,texImage2D:W,texImage3D:K,pixelStorei:Se,getParameter:se,updateUBOMapping:Te,uniformBlockBinding:Ae,texStorage2D:te,texStorage3D:re,texSubImage2D:h,texSubImage3D:N,compressedTexSubImage2D:z,compressedTexSubImage3D:k,scissor:le,viewport:ae,reset:De}}function Lp(i,e,t,n,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 Be,d=new WeakMap,m=new Set;let u;const g=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(E,h){return x?new OffscreenCanvas(E,h):Er("canvas")}function p(E,h,N){let z=1;const k=qe(E);if((k.width>N||k.height>N)&&(z=N/Math.max(k.width,k.height)),z<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const te=Math.floor(z*k.width),re=Math.floor(z*k.height);u===void 0&&(u=S(te,re));const W=h?S(te,re):u;return W.width=te,W.height=re,W.getContext("2d").drawImage(E,0,0,te,re),Re("WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+te+"x"+re+")."),W}else return"data"in E&&Re("WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),E;return E}function f(E){return E.generateMipmaps}function b(E){i.generateMipmap(E)}function A(E){return E.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:E.isWebG
vendor: 4,112 bytes, line 4092
4092L3DRenderTarget?i.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(E,h,N,z,k,te=!1){if(E!==null){if(i[E]!==void 0)return i[E];Re("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let re;z&&(re=e.get("EXT_texture_norm16"),re||Re("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=h;if(h===i.RED&&(N===i.FLOAT&&(W=i.R32F),N===i.HALF_FLOAT&&(W=i.R16F),N===i.UNSIGNED_BYTE&&(W=i.R8),N===i.UNSIGNED_SHORT&&re&&(W=re.R16_EXT),N===i.SHORT&&re&&(W=re.R16_SNORM_EXT)),h===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.R8UI),N===i.UNSIGNED_SHORT&&(W=i.R16UI),N===i.UNSIGNED_INT&&(W=i.R32UI),N===i.BYTE&&(W=i.R8I),N===i.SHORT&&(W=i.R16I),N===i.INT&&(W=i.R32I)),h===i.RG&&(N===i.FLOAT&&(W=i.RG32F),N===i.HALF_FLOAT&&(W=i.RG16F),N===i.UNSIGNED_BYTE&&(W=i.RG8),N===i.UNSIGNED_SHORT&&re&&(W=re.RG16_EXT),N===i.SHORT&&re&&(W=re.RG16_SNORM_EXT)),h===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RG8UI),N===i.UNSIGNED_SHORT&&(W=i.RG16UI),N===i.UNSIGNED_INT&&(W=i.RG32UI),N===i.BYTE&&(W=i.RG8I),N===i.SHORT&&(W=i.RG16I),N===i.INT&&(W=i.RG32I)),h===i.RGB_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RGB8UI),N===i.UNSIGNED_SHORT&&(W=i.RGB16UI),N===i.UNSIGNED_INT&&(W=i.RGB32UI),N===i.BYTE&&(W=i.RGB8I),N===i.SHORT&&(W=i.RGB16I),N===i.INT&&(W=i.RGB32I)),h===i.RGBA_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RGBA8UI),N===i.UNSIGNED_SHORT&&(W=i.RGBA16UI),N===i.UNSIGNED_INT&&(W=i.RGBA32UI),N===i.BYTE&&(W=i.RGBA8I),N===i.SHORT&&(W=i.RGBA16I),N===i.INT&&(W=i.RGBA32I)),h===i.RGB&&(N===i.UNSIGNED_SHORT&&re&&(W=re.RGB16_EXT),N===i.SHORT&&re&&(W=re.RGB16_SNORM_EXT),N===i.UNSIGNED_INT_5_9_9_9_REV&&(W=i.RGB9_E5),N===i.UNSIGNED_INT_10F_11F_11F_REV&&(W=i.R11F_G11F_B10F)),h===i.RGBA){const K=te?Mr:Fe.getTransfer(k);N===i.FLOAT&&(W=i.RGBA32F),N===i.HALF_FLOAT&&(W=i.RGBA16F),N===i.UNSIGNED_BYTE&&(W=K===Ye?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT&&re&&(W=re.RGBA16_EXT),N===i.SHORT&&re&&(W=re.RGBA16_SNORM_EXT),N===i.UNSIGNED_SHORT_4_4_4_4&&(W=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(W=i.RGB5_A1)}return(W===i.R16F||W===i.R32F||W===i.RG16F||W===i.RG32F||W===i.RGBA16F||W===i.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function R(E,h){let N;return E?h===null||h===tn||h===Ai?N=i.DEPTH24_STENCIL8:h===$t?N=i.DEPTH32F_STENCIL8:h===bi&&(N=i.DEPTH24_STENCIL8,Re("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):h===null||h===tn||h===Ai?N=i.DEPTH_COMPONENT24:h===$t?N=i.DEPTH_COMPONENT32F:h===bi&&(N=i.DEPTH_COMPONENT16),N}function y(E,h){return f(E)===!0||E.isFramebufferTexture&&E.minFilter!==xt&&E.minFilter!==Et?Math.log2(Math.max(h.width,h.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?h.mipmaps.length:1}function w(E){const h=E.target;h.removeEventListener("dispose",w),T(h),h.isVideoTexture&&d.delete(h),h.isHTMLTexture&&m.delete(h)}function _(E){const h=E.target;h.removeEventListener("dispose",_),D(h)}function T(E){const h=n.get(E);if(h.__webglInit===void 0)return;const N=E.source,z=g.get(N);if(z){const k=z[h.__cacheKey];k.usedTimes--,k.usedTimes===0&&C(E),Object.keys(z).length===0&&g.delete(N)}n.remove(E)}function C(E){const h=n.get(E);i.deleteTexture(h.__webglTexture);const N=E.source,z=g.get(N);delete z[h.__cacheKey],a.memory.textures--}function D(E){const h=n.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),n.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let z=0;z<6;z++){if(Array.isArray(h.__webglFramebuffer[z]))for(let k=0;k<h.__webglFramebuffer[z].length;k++)i.deleteFramebuffer(h.__webglFramebuffer[z][k]);else i.deleteFramebuffer(h.__webglFramebuffer[z]);h.__webglDepthbuffer&&i.deleteRenderbuffer(h.__webglDepthbuffer[z])}else{if(Array.isArray(h.__webglFramebuffer))for(let z=0;z<h.__webglFramebuffer.length;z++)i.deleteFramebuffer(h.__webglFramebuffer[z]);else i.deleteFramebuffer(h.__webglFramebuffer);if(h.__webglDepthbuffer&&i.deleteRenderbuffer(h.__webglDepthbuffer),h.__webglMultisampledFramebuffer&&i.deleteFramebuffer(h.__webglMultisampledFramebuffer),h.__webglColorRen
vendor: 5,605 bytes, line 4092
4092derbuffer)for(let z=0;z<h.__webglColorRenderbuffer.length;z++)h.__webglColorRenderbuffer[z]&&i.deleteRenderbuffer(h.__webglColorRenderbuffer[z]);h.__webglDepthRenderbuffer&&i.deleteRenderbuffer(h.__webglDepthRenderbuffer)}const N=E.textures;for(let z=0,k=N.length;z<k;z++){const te=n.get(N[z]);te.__webglTexture&&(i.deleteTexture(te.__webglTexture),a.memory.textures--),n.remove(N[z])}n.remove(E)}let F=0;function Y(){F=0}function Z(){return F}function G(E){F=E}function X(){const E=F;return E>=r.maxTextures&&Re("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),F+=1,E}function H(E){const h=[];return h.push(E.wrapS),h.push(E.wrapT),h.push(E.wrapR||0),h.push(E.magFilter),h.push(E.minFilter),h.push(E.anisotropy),h.push(E.internalFormat),h.push(E.format),h.push(E.type),h.push(E.generateMipmaps),h.push(E.premultiplyAlpha),h.push(E.flipY),h.push(E.unpackAlignment),h.push(E.colorSpace),h.join()}function J(E,h){const N=n.get(E);if(E.isVideoTexture&&L(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&N.__version!==E.version){const z=E.image;if(z===null)Re("WebGLRenderer: Texture marked for update but no image data found.");else if(z.complete===!1)Re("WebGLRenderer: Texture marked for update but image is incomplete");else{we(N,E,h);return}}else E.isExternalTexture&&(N.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+h)}function j(E,h){const N=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&N.__version!==E.version){we(N,E,h);return}else E.isExternalTexture&&(N.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+h)}function ue(E,h){const N=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&N.__version!==E.version){we(N,E,h);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+h)}function pe(E,h){const N=n.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&N.__version!==E.version){Pe(N,E,h);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+h)}const _e={[Ss]:i.REPEAT,[un]:i.CLAMP_TO_EDGE,[Es]:i.MIRRORED_REPEAT},ke={[xt]:i.NEAREST,[$l]:i.NEAREST_MIPMAP_NEAREST,[Ui]:i.NEAREST_MIPMAP_LINEAR,[Et]:i.LINEAR,[Ur]:i.LINEAR_MIPMAP_NEAREST,[Fn]:i.LINEAR_MIPMAP_LINEAR},et={[jl]:i.NEVER,[rc]:i.ALWAYS,[ec]:i.LESS,[fa]:i.LEQUAL,[tc]:i.EQUAL,[ha]:i.GEQUAL,[nc]:i.GREATER,[ic]:i.NOTEQUAL};function We(E,h){if(h.type===$t&&e.has("OES_texture_float_linear")===!1&&(h.magFilter===Et||h.magFilter===Ur||h.magFilter===Ui||h.magFilter===Fn||h.minFilter===Et||h.minFilter===Ur||h.minFilter===Ui||h.minFilter===Fn)&&Re("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(E,i.TEXTURE_WRAP_S,_e[h.wrapS]),i.texParameteri(E,i.TEXTURE_WRAP_T,_e[h.wrapT]),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,_e[h.wrapR]),i.texParameteri(E,i.TEXTURE_MAG_FILTER,ke[h.magFilter]),i.texParameteri(E,i.TEXTURE_MIN_FILTER,ke[h.minFilter]),h.compareFunction&&(i.texParameteri(E,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(E,i.TEXTURE_COMPARE_FUNC,et[h.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(h.magFilter===xt||h.minFilter!==Ui&&h.minFilter!==Fn||h.type===$t&&e.has("OES_texture_float_linear")===!1)return;if(h.anisotropy>1||n.get(h).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");i.texParameterf(E,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(h.anisotropy,r.getMaxAnisotropy())),n.get(h).__currentAnisotropy=h.anisotropy}}}function $(E,h){let N=!1;E.__webglInit===void 0&&(E.__webglInit=!0,h.addEventListener("dispose",w));const z=h.source;let k=g.get(z);k===void 0&&(k={},g.set(z,k));const te=H(h);if(te!==E.__cacheKey){k[te]===void 0&&(k[te]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),k[te].usedTimes++;const re=k[E.__cacheKey];re!==void 0&&(k[E.__cacheKey].usedTimes--,re.usedTimes===0&&C(h)),E.__cacheKey=te,E.__webglTexture=k[te].texture}return N}function ie(E,h,N){return Math.floor(Math.floor(E/N)/h)}function ee(E,h,N,z){const te=E.updateRanges;if(te.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,h.width,h.height,N,z,h.data);else{te.sort((Se,le)=>Se.start-le.start);let re=0;for(let Se=1;Se<te.length;Se++){const le=te[re],ae=te[Se],Te=le.start+le.count,Ae=ie(ae.start,h.width,4),De=ie(le.start,h.width,4);ae.start<=Te+1&&Ae===De&&ie(ae.start+ae.count-1,h.width,4)===Ae?le.count=Math.max(le.count,ae.start+ae.count-le.start):(++re,te[re]=ae)}te.length=re+1;const W=t.getParameter(i.UNPACK_ROW_LENGTH),K=t.getParameter(i.UNPACK_SKIP_PIXELS),se=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,h.width);for(let Se=0,le=te.length;Se<le;Se++){const ae=te[Se],Te=Math.floor(ae.start/4),Ae=Math.ceil(ae.count/4),De=Te%h.width,P=Math.floor(Te/h.width),ne=Ae,q=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,De),t.pixelStorei(i.UNPACK_SKIP_ROWS,P),t.texSubImage2D(i.TEXTURE_2D,0,De,P,ne,q,N,z,h.data)}E.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,W),t.pixelStorei(i.UNPACK_SKIP_PIXELS,K),t.pixelStorei(i.UNPACK_SKIP_ROWS,se)}}function we(E,h,N){let z=i.TEXTURE_2D;(h.isDataArrayTexture||h.isCompressedArrayTexture)&&(z=i.TEXTURE_2D_ARRAY),h.isData3DTexture&&(z=i.TEXTURE_3D);const k=$(E,h),te=h.source;t.bindTexture(z,E.__webglTexture,i.TEXTURE0+N);const re=n.get(te);if(te.version!==re.__version||k===!0){if(t.activeTexture(i.TEXTURE0+N),(typeof ImageBitmap<"u"&&h.image instanceof ImageBitmap)===!1){const q=Fe.getPrimaries(Fe.workingColorSpace),oe=h.colorSpace
vendor: 4,536 bytes, line 4092
4092===bn?null:Fe.getPrimaries(h.colorSpace),de=h.colorSpace===bn||q===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,h.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,de)}t.pixelStorei(i.UNPACK_ALIGNMENT,h.unpackAlignment);let K=p(h.image,!1,r.maxTextureSize);K=Rt(h,K);const se=s.convert(h.format,h.colorSpace),Se=s.convert(h.type);let le=M(h.internalFormat,se,Se,h.normalized,h.colorSpace,h.isVideoTexture);We(z,h);let ae;const Te=h.mipmaps,Ae=h.isVideoTexture!==!0,De=re.__version===void 0||k===!0,P=te.dataReady,ne=y(h,K);if(h.isDepthTexture)le=R(h.format===On,h.type),De&&(Ae?t.texStorage2D(i.TEXTURE_2D,1,le,K.width,K.height):t.texImage2D(i.TEXTURE_2D,0,le,K.width,K.height,0,se,Se,null));else if(h.isDataTexture)if(Te.length>0){Ae&&De&&t.texStorage2D(i.TEXTURE_2D,ne,le,Te[0].width,Te[0].height);for(let q=0,oe=Te.length;q<oe;q++)ae=Te[q],Ae?P&&t.texSubImage2D(i.TEXTURE_2D,q,0,0,ae.width,ae.height,se,Se,ae.data):t.texImage2D(i.TEXTURE_2D,q,le,ae.width,ae.height,0,se,Se,ae.data);h.generateMipmaps=!1}else Ae?(De&&t.texStorage2D(i.TEXTURE_2D,ne,le,K.width,K.height),P&&ee(h,K,se,Se)):t.texImage2D(i.TEXTURE_2D,0,le,K.width,K.height,0,se,Se,K.data);else if(h.isCompressedTexture)if(h.isCompressedArrayTexture){Ae&&De&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,le,Te[0].width,Te[0].height,K.depth);for(let q=0,oe=Te.length;q<oe;q++)if(ae=Te[q],h.format!==kt)if(se!==null)if(Ae){if(P)if(h.layerUpdates.size>0){const de=uo(ae.width,ae.height,h.format,h.type);for(const Q of h.layerUpdates){const Me=ae.data.subarray(Q*de/ae.data.BYTES_PER_ELEMENT,(Q+1)*de/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,q,0,0,Q,ae.width,ae.height,1,se,Me)}h.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,q,0,0,0,ae.width,ae.height,K.depth,se,ae.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,q,le,ae.width,ae.height,K.depth,0,ae.data,0,0);else Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ae?P&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,q,0,0,0,ae.width,ae.height,K.depth,se,Se,ae.data):t.texImage3D(i.TEXTURE_2D_ARRAY,q,le,ae.width,ae.height,K.depth,0,se,Se,ae.data)}else{Ae&&De&&t.texStorage2D(i.TEXTURE_2D,ne,le,Te[0].width,Te[0].height);for(let q=0,oe=Te.length;q<oe;q++)ae=Te[q],h.format!==kt?se!==null?Ae?P&&t.compressedTexSubImage2D(i.TEXTURE_2D,q,0,0,ae.width,ae.height,se,ae.data):t.compressedTexImage2D(i.TEXTURE_2D,q,le,ae.width,ae.height,0,ae.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ae?P&&t.texSubImage2D(i.TEXTURE_2D,q,0,0,ae.width,ae.height,se,Se,ae.data):t.texImage2D(i.TEXTURE_2D,q,le,ae.width,ae.height,0,se,Se,ae.data)}else if(h.isDataArrayTexture)if(Ae){if(De&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,le,K.width,K.height,K.depth),P)if(h.layerUpdates.size>0){const q=uo(K.width,K.height,h.format,h.type);for(const oe of h.layerUpdates){const de=K.data.subarray(oe*q/K.data.BYTES_PER_ELEMENT,(oe+1)*q/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,oe,K.width,K.height,1,se,Se,de)}h.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,se,Se,K.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,le,K.width,K.height,K.depth,0,se,Se,K.data);else if(h.isData3DTexture)Ae?(De&&t.texStorage3D(i.TEXTURE_3D,ne,le,K.width,K.height,K.depth),P&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,se,Se,K.data)):t.texImage3D(i.TEXTURE_3D,0,le,K.width,K.height,K.depth,0,se,Se,K.data);else if(h.isFramebufferTexture){if(De)if(Ae)t.texStorage2D(i.TEXTURE_2D,ne,le,K.width,K.height);else{let q=K.width,oe=K.height;for(let de=0;de<ne;de++)t.texImage2D(i.TEXTURE_2D,de,le,q,oe,0,se,Se,null),q>>=1,oe>>=1}}else if(h.isHTMLTexture){if("texElementImage2D"in i){const q=i.canvas;if(q.hasAttribute("layoutsubtree")||q.setAttribute("layoutsubtree","true"),K.parentNode!==q){q.appendChild(K),m.add(h),q.onpaint=oe=>{const de=oe.changedElements;for(const Q of m)de.includes(Q.image)&&(Q.needsUpdate=!0)},q.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,K);else{const de=i.RGBA,Q=i.RGBA,Me=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,de,Q,Me,K)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Te.length>0){if(Ae&&De){const q=qe(Te[0]);
vendor: 44,061 bytes, lines 4092-4116
4092t.texStorage2D(i.TEXTURE_2D,ne,le,q.width,q.height)}for(let q=0,oe=Te.length;q<oe;q++)ae=Te[q],Ae?P&&t.texSubImage2D(i.TEXTURE_2D,q,0,0,se,Se,ae):t.texImage2D(i.TEXTURE_2D,q,le,se,Se,ae);h.generateMipmaps=!1}else if(Ae){if(De){const q=qe(K);t.texStorage2D(i.TEXTURE_2D,ne,le,q.width,q.height)}P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,se,Se,K)}else t.texImage2D(i.TEXTURE_2D,0,le,se,Se,K);f(h)&&b(z),re.__version=te.version,h.onUpdate&&h.onUpdate(h)}E.__version=h.version}function Pe(E,h,N){if(h.image.length!==6)return;const z=$(E,h),k=h.source;t.bindTexture(i.TEXTURE_CUBE_MAP,E.__webglTexture,i.TEXTURE0+N);const te=n.get(k);if(k.version!==te.__version||z===!0){t.activeTexture(i.TEXTURE0+N);const re=Fe.getPrimaries(Fe.workingColorSpace),W=h.colorSpace===bn?null:Fe.getPrimaries(h.colorSpace),K=h.colorSpace===bn||re===W?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,h.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,h.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,K);const se=h.isCompressedTexture||h.image[0].isCompressedTexture,Se=h.image[0]&&h.image[0].isDataTexture,le=[];for(let Q=0;Q<6;Q++)!se&&!Se?le[Q]=p(h.image[Q],!0,r.maxCubemapSize):le[Q]=Se?h.image[Q].image:h.image[Q],le[Q]=Rt(h,le[Q]);const ae=le[0],Te=s.convert(h.format,h.colorSpace),Ae=s.convert(h.type),De=M(h.internalFormat,Te,Ae,h.normalized,h.colorSpace),P=h.isVideoTexture!==!0,ne=te.__version===void 0||z===!0,q=k.dataReady;let oe=y(h,ae);We(i.TEXTURE_CUBE_MAP,h);let de;if(se){P&&ne&&t.texStorage2D(i.TEXTURE_CUBE_MAP,oe,De,ae.width,ae.height);for(let Q=0;Q<6;Q++){de=le[Q].mipmaps;for(let Me=0;Me<de.length;Me++){const xe=de[Me];h.format!==kt?Te!==null?P?q&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me,0,0,xe.width,xe.height,Te,xe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me,De,xe.width,xe.height,0,xe.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me,0,0,xe.width,xe.height,Te,Ae,xe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me,De,xe.width,xe.height,0,Te,Ae,xe.data)}}}else{if(de=h.mipmaps,P&&ne){de.length>0&&oe++;const Q=qe(le[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,oe,De,Q.width,Q.height)}for(let Q=0;Q<6;Q++)if(Se){P?q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,le[Q].width,le[Q].height,Te,Ae,le[Q].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,De,le[Q].width,le[Q].height,0,Te,Ae,le[Q].data);for(let Me=0;Me<de.length;Me++){const nt=de[Me].image[Q].image;P?q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me+1,0,0,nt.width,nt.height,Te,Ae,nt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me+1,De,nt.width,nt.height,0,Te,Ae,nt.data)}}else{P?q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,Te,Ae,le[Q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,De,Te,Ae,le[Q]);for(let Me=0;Me<de.length;Me++){const xe=de[Me];P?q&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me+1,0,0,Te,Ae,xe.image[Q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Me+1,De,Te,Ae,xe.image[Q])}}}f(h)&&b(i.TEXTURE_CUBE_MAP),te.__version=k.version,h.onUpdate&&h.onUpdate(h)}E.__version=h.version}function be(E,h,N,z,k,te){const re=s.convert(N.format,N.colorSpace),W=s.convert(N.type),K=M(N.internalFormat,re,W,N.normalized,N.colorSpace),se=n.get(h),Se=n.get(N);if(Se.__renderTarget=h,!se.__hasExternalTextures){const le=Math.max(1,h.width>>te),ae=Math.max(1,h.height>>te);k===i.TEXTURE_3D||k===i.TEXTURE_2D_ARRAY?t.texImage3D(k,te,K,le,ae,h.depth,0,re,W,null):t.texImage2D(k,te,K,le,ae,0,re,W,null)}t.bindFramebuffer(i.FRAMEBUFFER,E),ut(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,z,k,Se.__webglTexture,0,tt(h)):(k===i.TEXTURE_2D||k>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&k<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,z,k,Se.__webglTexture,te),t.bindFramebuffer(i.FRAMEBUFFER,null)}function at(E,h,N){if(i.bindRenderbuffer(i.RENDERBUFFER,E),h.depthBuffer){const z=h.depthTexture,k=z&&z.isDepthTexture?z.type:null,te=R(h.stencilBuffer,k),re=h.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;ut(h)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tt(h),te,h.width,h.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,tt(h),te,h.width,h.height):i.renderbufferStorage(i.RENDERBUFFER,te,h.width,h.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,re,i.RENDERBUFFER,E)}else{const z=h.textures;for(let k=0;k<z.length;k++){const te=z[k],re=s.convert(te.format,te.colorSpace),W=s.convert(te.type),K=M(te.internalFormat,re,W,te.normalized,te.colorSpace);ut(h)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tt(h),K,h.width,h.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,tt(h),K,h.width,h.height):i.renderbufferStorage(i.RENDERBUFFER,K,h.width,h.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ne(E,h,N){const z=h.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,E),!(h.depthTexture&&h.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const k=n.get(h.depthTexture);if(k.__renderTarget=h,(!k.__webglTexture||h.depthTexture.image.width!==h.width||h.depthTexture.image.height!==h.height)&&(h.depthTexture.image.width=h.width,h.depthTexture.image.height=h.height,h.depthTexture.needsUpdate=!0),z){if(k.__webglInit===void 0&&(k.__webglInit=!0,h.depthTexture.addEventListener("dispose",w)),k.__webglTexture===void 0){k.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,k.__webglTexture),We(i.TEXTURE_CUBE_MAP,h.depthTexture);const se=s.convert(h.depthTexture.format),Se=s.convert(h.depthTexture.type);let le;h.depthTexture.format===pn?le=i.DEPTH_COMPONENT24:h.depthTexture.format===On&&(le=i.DEPTH24_STENCIL8);for(let ae=0;ae<6;ae++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,le,h.width,h.height,0,se,Se,null)}}else J(h.depthTexture,0);const te=k.__webglTexture,re=tt(h),W=z?i.TEXTURE_CUBE_MAP_POSITIVE_X+N:i.TEXTURE_2D,K=h.depthTexture.format===On?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(h.depthTexture.format===pn)ut(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,K,W,te,0,re):i.framebufferTexture2D(i.FRAMEBUFFER,K,W,te,0);else if(h.depthTexture.format===On)ut(h)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,K,W,te,0,re):i.framebufferTexture2D(i.FRAMEBUFFER,K,W,te,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ze(E){const h=n.get(E),N=E.isWebGLCubeRenderTarget===!0;if(h.__boundDepthTexture!==E.depthTexture){const z=E.depthTexture;if(h.__depthDisposeCallback&&h.__depthDisposeCallback(),z){const k=()=>{delete h.__boundDepthTexture,delete h.__depthDisposeCallback,z.removeEventListener("dispose",k)};z.addEventListener("dispose",k),h.__depthDisposeCallback=k}h.__boundDepthTexture=z}if(E.depthTexture&&!h.__autoAllocateDepthBuffer)if(N)for(let z=0;z<6;z++)Ne(h.__webglFramebuffer[z],E,z);else{const z=E.texture.mipmaps;z&&z.length>0?Ne(h.__webglFramebuffer[0],E,0):Ne(h.__webglFramebuffer,E,0)}else if(N){h.__webglDepthbuffer=[];for(let z=0;z<6;z++)if(t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer[z]),h.__webglDepthbuffer[z]===void 0)h.__webglDepthbuffer[z]=i.createRenderbuffer(),at(h.__webglDepthbuffer[z],E,!1);else{const k=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=h.__webglDepthbuffer[z];i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,k,i.RENDERBUFFER,te)}}else{const z=E.texture.mipmaps;if(z&&z.length>0?t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,h.__webglFramebuffer),h.__webglDepthbuffer===void 0)h.__webglDepthbuffer=i.createRenderbuffer(),at(h.__webglDepthbuffer,E,!1);else{const k=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=h.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,k,i.RENDERBUFFER,te)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Xe(E,h,N){const z=n.get(E);h!==void 0&&be(z.__webglFramebuffer,E,E.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&Ze(E)}function ze(E){const h=E.texture,N=n.get(E),z=n.get(h);E.addEventListener("dispose",_);const k=E.textures,te=E.isWebGLCubeRenderTarget===!0,re=k.length>1;if(re||(z.__webglTexture===void 0&&(z.__webglTexture=i.createTexture()),z.__version=h.version,a.memory.textures++),te){N.__webglFramebuffer=[];for(let W=0;W<6;W++)if(h.mipmaps&&h.mipmaps.length>0){N.__webglFramebuffer[W]=[];for(let K=0;K<h.mipmaps.length;K++)N.__webglFramebuffer[W][K]=i.createFramebuffer()}else N.__webglFramebuffer[W]=i.createFramebuffer()}else{if(h.mipmaps&&h.mipmaps.length>0){N.__webglFramebuffer=[];for(let W=0;W<h.mipmaps.length;W++)N.__webglFramebuffer[W]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(re)for(let W=0,K=k.length;W<K;W++){const se=n.get(k[W]);se.__webglTexture===void 0&&(se.__webglTexture=i.createTexture(),a.memory.textures++)}if(E.samples>0&&ut(E)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let W=0;W<k.length;W++){const K=k[W];N.__webglColorRenderbuffer[W]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[W]);const se=s.convert(K.format,K.colorSpace),Se=s.convert(K.type),le=M(K.internalFormat,se,Se,K.normalized,K.colorSpace,E.isXRRenderTarget===!0),ae=tt(E);i.renderbufferStorageMultisample(i.RENDERBUFFER,ae,le,E.width,E.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+W,i.RENDERBUFFER,N.__webglColorRenderbuffer[W])}i.bindRenderbuffer(i.RENDERBUFFER,null),E.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),at(N.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(te){t.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture),We(i.TEXTURE_CUBE_MAP,h);for(let W=0;W<6;W++)if(h.mipmaps&&h.mipmaps.length>0)for(let K=0;K<h.mipmaps.length;K++)be(N.__webglFramebuffer[W][K],E,h,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,K);else be(N.__webglFramebuffer[W],E,h,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);f(h)&&b(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(re){for(let W=0,K=k.length;W<K;W++){const se=k[W],Se=n.get(se);let le=i.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(le=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(le,Se.__webglTexture),We(le,se),be(N.__webglFramebuffer,E,se,i.COLOR_ATTACHMENT0+W,le,0),f(se)&&b(le)}t.unbindTexture()}else{let W=i.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(W=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(W,z.__webglTexture),We(W,h),h.mipmaps&&h.mipmaps.length>0)for(let K=0;K<h.mipmaps.length;K++)be(N.__webglFramebuffer[K],E,h,i.COLOR_ATTACHMENT0,W,K);else be(N.__webglFramebuffer,E,h,i.COLOR_ATTACHMENT0,W,0);f(h)&&b(W),t.unbindTexture()}E.depthBuffer&&Ze(E)}function ct(E){const h=E.textures;for(let N=0,z=h.length;N<z;N++){const k=h[N];if(f(k)){const te=A(E),re=n.get(k).__webglTexture;t.bindTexture(te,re),b(te),t.unbindTexture()}}}const ht=[],mt=[];function _t(E){if(E.samples>0){if(ut(E)===!1){const h=E.textures,N=E.width,z=E.height;let k=i.COLOR_BUFFER_BIT;const te=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(E),W=h.length>1;if(W)for(let se=0;se<h.length;se++)t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer);const K=E.texture.mipmaps;K&&K.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let se=0;se<h.length;se++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(k|=i.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(k|=i.STENCIL_BUFFER_BIT)),W){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[se]);const Se=n.get(h[se]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Se,0)}i.blitFramebuffer(0,0,N,z,0,0,N,z,k,i.NEAREST),c===!0&&(ht.length=0,mt.length=0,ht.push(i.COLOR_ATTACHMENT0+se),E.depthBuffer&&E.resolveDepthBuffer===!1&&(ht.push(te),mt.push(te),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,mt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ht))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),W)for(let se=0;se<h.length;se++){t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,re.__webglColorRenderbuffer[se]);const Se=n.get(h[se]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,Se,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&c){const h=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[h])}}}function tt(E){return Math.min(r.maxSamples,E.samples)}function ut(E){const h=n.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&h.__useRenderToTexture!==!1}function L(E){const h=a.render.frame;d.get(E)!==h&&(d.set(E,h),E.update())}function Rt(E,h){const N=E.colorSpace,z=E.format,k=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||N!==vr&&N!==bn&&(Fe.getTransfer(N)===Ye?(z!==kt||k!==Bt)&&Re("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ve("WebGLTextures: Unsupported texture color space:",N)),h}function qe(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(l.width=E.naturalWidth||E.width,l.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(l.width=E.displayWidth,l.height=E.displayHeight):(l.width=E.width,l.height=E.height),l}this.allocateTextureUnit=X,this.resetTextureUnits=Y,this.getTextureUnits=Z,this.setTextureUnits=G,this.setTexture2D=J,this.setTexture2DArray=j,this.setTexture3D=ue,this.setTextureCube=pe,this.rebindTextures=Xe,this.setupRenderTarget=ze,this.updateRenderTargetMipmap=ct,this.updateMultisampleRenderTarget=_t,this.setupDepthRenderbuffer=Ze,this.setupFrameBufferTexture=be,this.useMultisampledRTT=ut,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Ip(i,e){function t(n,r=bn){let s;const a=Fe.getTransfer(r);if(n===Bt)return i.UNSIGNED_BYTE;if(n===aa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===oa)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Xo)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===qo)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===ko)return i.BYTE;if(n===Wo)return i.SHORT;if(n===bi)return i.UNSIGNED_SHORT;if(n===sa)return i.INT;if(n===tn)return i.UNSIGNED_INT;if(n===$t)return i.FLOAT;if(n===dn)return i.HALF_FLOAT;if(n===Yo)return i.ALPHA;if(n===Ko)return i.RGB;if(n===kt)return i.RGBA;if(n===pn)return i.DEPTH_COMPONENT;if(n===On)return i.DEPTH_STENCIL;if(n===Zo)return i.RED;if(n===la)return i.RED_INTEGER;if(n===zn)return i.RG;if(n===ca)return i.RG_INTEGER;if(n===ua)return i.RGBA_INTEGER;if(n===ur||n===fr||n===hr||n===dr)if(a===Ye)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ur)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===fr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===dr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===ur)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===fr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===dr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ys||n===Ts||n===bs||n===As)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ys)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ts)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===bs)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===As)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Rs||n===ws||n===Cs||n===Ps||n===Ds||n===_r||n===Ls)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Rs||n===ws)return a===Ye?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Cs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ps)return s.COMPRESSED_R11_EAC;if(n===Ds)return s.COMPRESSED_SIGNED_R11_EAC;if(n===_r)return s.COMPRESSED_RG11_EAC;if(n===Ls)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Is||n===Us||n===Ns||n===Fs||n===Os||n===Bs||n===zs||n===Gs||n===Vs||n===Hs||n===ks||n===Ws||n===Xs||n===qs)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Is)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Us)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ns)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Fs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Os)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Bs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===zs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Gs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Vs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Hs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ks)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ws)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Xs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===qs)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ys||n===Ks||n===Zs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ys)return a===Ye?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ks)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Zs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===$s||n===Js||n===xr||n===Qs)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===$s)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Js)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xr)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Qs)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ai?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Up=` 4093void main() { 4094 4095 gl_Position = vec4( position, 1.0 ); 4096 4097}`,Np=` 4098uniform sampler2DArray depthColor; 4099uniform float depthWidth; 4100uniform float depthHeight; 4101 4102void main() { 4103 4104 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4105 4106 if ( coord.x >= 1.0 ) { 4107 4108 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4109 4110 } else { 4111 4112 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4113 4114 } 4115 4116}`;class Fp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ol(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new nn({vertexShader:Up,fragmentShader:Np,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mn(new Rr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Op extends Vn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,d=null,m=null,u=null,g=null,x=null;const S=typeof XRWebGLBinding<"u",p=new Fp,f={},b=t.getContextAttributes();let A=null,M=null;const R=[],y=[],w=new Be;let _=null;const T=new Ot;T.viewport=new rt;const C=new Ot;C.viewport=new rt;const D=[T,C],F=new qc;let Y=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let ie=R[$];return ie===void 0&&(ie=new Vr,R[$]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function($){let ie=R[$];return ie===void 0&&(ie=new Vr,R[$]=ie),ie.getGripSpace()},this.getHand=function($){let ie=R[$];return ie===void 0&&(ie=new Vr,R[$]=ie),ie.getHandSpace()};function G($){const ie=y.indexOf($.inputSource);if(ie===-1)return;const ee=R[ie];ee!==void 0&&(ee.update($.inputSource,$.frame,l||a),ee.dispatchEvent({type:$.type,data:$.inputSource}))}function X(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",X),r.removeEventListener("inputsourceschange",H);for(let $=0;$<R.length;$++){const ie=y[$];ie!==null&&(y[$]=null,R[$].disconnect(ie))}Y=null,Z=null,p.reset();for(const $ in f)delete f[$];e.setRenderTarget(A),g=null,u=null,m=null,r=null,M=null,We.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(w.width,w.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function($){s=$,n.isPresenting===!0&&Re("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function($){o=$,n.isPresenting===!0&&Re("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function($){l=$},this.getBaseLayer=function(){return u!==null?u:g},this.getBinding=function(){return m===null&&S&&(m=new XRWebGLBinding(r,t)),m},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function($){if(r=$,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",G),r.addEventListener("selectstart",G),r.addEventListener("selectend",G),r.addEventListener("squeeze",G),r.addEventListener("squeezestart",G),r.addEventListener("squeezeend",G),r.addEventListener("end",X),r.addEventListener("inputsourceschange",H),b.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(w),S&&"createProjectionLayer"in XRWebGLBinding.prototype){let ee=null,we=null,Pe=null;b.depth&&(Pe=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ee=b.stencil?On:pn,we=b.stencil?Ai:tn);const be={colorFormat:t.RGBA8,depthFormat:Pe,scaleFactor:s};m=this.getBinding(),u=m.createProjectionLayer(be),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new jt(u.textureWidth,u.textureHeight,{format:kt,type:Bt,depthTexture:new ci(u.textureWidth,u.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const ee={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(r,t,ee),r.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),M=new jt(g.framebufferWidth,g.framebufferHeight,{format:kt,type:Bt,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),We.setContext(r),We.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};function H($){for(let ie=0;ie<$.removed.length;ie++){const ee=$.removed[ie],we=y.indexOf(ee);we>=0&&(y[we]=null,R[we].disconnect(ee))}for(let ie=0;ie<$.added.length;ie++){const ee=$.added[ie];let we=y.indexOf(ee);if(we===-1){for(let be=0;be<R.length;be++)if(be>=y.length){y.push(ee),we=be;break}else if(y[be]===null){y[be]=ee,we=be;break}if(we===-1)break}const Pe=R[we];Pe&&Pe.connect(ee)}}const J=new U,j=new U;function ue($,ie,ee){J.setFromMatrixPosition(ie.matrixWorld),j.setFromMatrixPosition(ee.matrixWorld);const we=J.distanceTo(j),Pe=ie.projectionMatrix.elements,be=ee.projectionMatrix.elements,at=Pe[14]/(Pe[10]-1),Ne=Pe[14]/(Pe[10]+1),Ze=(Pe[9]+1)/Pe[5],Xe=(Pe[9]-1)/Pe[5],ze=(Pe[8]-1)/Pe[0],ct=(be[8]+1)/be[0],ht=at*ze,mt=at*ct,_t=we/(-ze+ct),tt=_t*-ze;if(ie.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(tt),$.translateZ(_t),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),Pe[10]===-1)$.projectionMatrix.copy(ie.projectionMatrix),$.projectionMatrixInverse.copy(ie.projectionMatrixInverse);else{const ut=at+_t,L=Ne+_t,Rt=ht-tt,qe=mt+(we-tt),E=Ze*Ne/L*ut,h=Xe*Ne/L*ut;$.projectionMatrix.makePerspective(Rt,qe,E,h,ut,L),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function pe($,ie){ie===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(ie.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let ie=$.near,ee=$.far;p.texture!==null&&(p.depthNear>0&&(ie=p.depthNear),p.depthFar>0&&(ee=p.depthFar)),F.near=C.near=T.near=ie,F.far=C.far=T.far=ee,(Y!==F.near||Z!==F.far)&&(r.updateRenderState({depthNear:F.near,depthFar:F.far}),Y=F.near,Z=F.far),F.layers.mask=$.layers.mask|6,T.layers.mask=F.layers.mask&-5,C.layers.mask=F.layers.mask&-3;const we=$.parent,Pe=F.cameras;pe(F,we);for(let be=0;be<Pe.length;be++)pe(Pe[be],we);Pe.length===2?ue(F,T,C):F.projectionMatrix.copy(T.projectionMatrix),_e($,F,we)};function _e($,ie,ee){ee===null?$.matrix.copy(ie.matrixWorld):($.matrix.copy(ee.matrixWorld),$.matrix.invert(),$.matrix.multiply(ie.matrixWorld)),$.matrix.decompose($.position,$.quaternion,$.scale),$.updateMatrixWorld(!0),$.projectionMatrix.copy(ie.projectionMatrix),$.projectionMatrixInverse.copy(ie.projectionMatrixInverse),$.isPerspectiveCamera&&($.fov=js*2*Math.atan(1/$.projectionMatrix.elements[5]),$.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(u===null&&g===null))return c},this.setFoveation=function($){c=$,u!==null&&(u.fixedFoveation=$),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=$)},this.hasDepthSensing=function(){return p.texture!==null},this.getDepthSensingMesh=function(){return p.getMesh(F)},this.getCameraTexture=function($){return f[$]};let ke=null;function et($,ie){if(d=ie.getViewerPose(l||a),x=ie,d!==null){const ee=d.views;g!==null&&(e.setRenderTargetFramebuffer(M,g.framebuffer),e.setRenderTarget(M));let we=!1;ee.length!==F.cameras.length&&(F.cameras.length=0,we=!0);for(let Ne=0;Ne<ee.length;Ne++){const Ze=ee[Ne];let Xe=null;if(g!==null)Xe=g.getViewport(Ze);else{const ct=m.getViewSubImage(u,Ze);Xe=ct.viewport,Ne===0&&(e.setRenderTargetTextures(M,ct.colorTexture,ct.depthStencilTexture),e.setRenderTarget(M))}let ze=D[Ne];ze===void 0&&(ze=new Ot,ze.layers.enable(Ne),ze.viewport=new rt,D[Ne]=ze),ze.matrix.fromArray(Ze.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(Ze.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),Ne===0&&(F.matrix.copy(ze.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),we===!0&&F.cameras.push(ze)}const Pe=r.enabledFeatures;if(Pe&&Pe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&S){m=n.getBinding();const Ne=m.getDepthInformation(ee[0]);Ne&&Ne.isValid&&Ne.texture&&p.init(Ne,r.renderState)}if(Pe&&Pe.includes("camera-access")&&S){e.state.unbindTexture(),m=n.getBinding();for(let Ne=0;Ne<ee.length;Ne++){const Ze=ee[Ne].camera;if(Ze){let Xe=f[Ze];Xe||(Xe=new ol,f[Ze]=Xe);const ze=m.getCameraImage(Ze);Xe.sourceTexture=ze}}}}for(let ee=0;ee<R.length;ee++){const we=y[ee],Pe=R[ee];we!==null&&Pe!==void 0&&Pe.update(we,ie,l||a)}ke&&ke($,ie),ie.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ie}),x=null}const We=new fl;We.setAnimationLoop(et),this.setAnimationLoop=function($){ke=$},this.dispose=function(){}}}const Bp=new st,xl=new Ce;xl.set(-1,0,0,0,1,0,0,0,1);function zp(i,e){function t(p,f){p.matrixAutoUpdate===!0&&p.updateMatrix(),f.value.copy(p.matrix)}function n(p,f){f.color.getRGB(p.fogColor.value,ll(i)),f.isFog?(p.fogNear.value=f.near,p.fogFar.value=f.far):f.isFogExp2&&(p.fogDensity.value=f.density)}function r(p,f,b,A,M){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(p,f):f.isMeshLambertMaterial?(s(p,f),f.envMap&&(p.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(p,f),m(p,f)):f.isMeshPhongMaterial?(s(p,f),d(p,f),f.envMap&&(p.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(p,f),u(p,f),f.isMeshPhysicalMaterial&&g(p,f,M)):f.isMeshMatcapMaterial?(s(p,f),x(p,f)):f.isMeshDepthMaterial?s(p,f):f.isMeshDistanceMaterial?(s(p,f),S(p,f)):f.isMeshNormalMaterial?s(p,f):f.isLineBasicMaterial?(a(p,f),f.isLineDashedMaterial&&o(p,f)):f.isPointsMaterial?c(p,f,b,A):f.isSpriteMaterial?l(p,f):f.isShadowMaterial?(p.color.value.copy(f.color),p.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(p,f){p.opacity.value=f.opacity,f.color&&p.diffuse.value.copy(f.color),f.emissive&&p.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(p.map.value=f.map,t(f.map,p.mapTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.bumpMap&&(p.bumpMap.value=f.bumpMap,t(f.bumpMap,p.bumpMapTransform),p.bumpScale.value=f.bumpScale,f.side===Ct&&(p.bumpScale.value*=-1)),f.normalMap&&(p.normalMap.value=f.normalMap,t(f.normalMap,p.normalMapTransform),p.normalScale.value.copy(f.normalScale),f.side===Ct&&p.normalScale.value.negate()),f.displacementMap&&(p.displacementMap.value=f.displacementMap,t(f.displacementMap,p.displacementMapTransform),p.displacementScale.value=f.displacementScale,p.displacementBias.value=f.displacementBias),f.emissiveMap&&(p.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,p.emissiveMapTransform)),f.specularMap&&(p.specularMap.value=f.specularMap,t(f.specularMap,p.specularMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest);const b=e.get(f),A=b.envMap,M=b.envMapRotation;A&&(p.envMap.value=A,p.envMapRotation.value.setFromMatrix4(Bp.makeRotationFromEuler(M)).transpose(),A.isCubeTexture&&A.isRenderTargetTexture===!1&&p.envMapRotation.value.premultiply(xl),p.reflectivity.value=f.reflectivity,p.ior.value=f.ior,p.refractionRatio.value=f.refractionRatio),f.lightMap&&(p.lightMap.value=f.lightMap,p.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,p.lightMapTransform)),f.aoMap&&(p.aoMap.value=f.aoMap,p.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,p.aoMapTransform))}function a(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform))}function o(p,f){p.dashSize.value=f.dashSize,p.totalSize.value=f.dashSize+f.gapSize,p.scale.value=f.scale}function c(p,f,b,A){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.size.value=f.size*b,p.scale.value=A*.5,f.map&&(p.map.value=f.map,t(f.map,p.uvTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function l(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.rotation.value=f.rotation,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function d(p,f){p.specular.value.copy(f.specular),p.shininess.value=Math.max(f.shininess,1e-4)}function m(p,f){f.gradientMap&&(p.gradientMap.value=f.gradientMap)}function u(p,f){p.metalness.value=f.metalness,f.metalnessMap&&(p.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,p.metalnessMapTransform)),p.roughness.value=f.roughness,f.roughnessMap&&(p.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,p.roughnessMapTransform)),f.envMap&&(p.envMapIntensity.value=f.envMapIntensity)}function g(p,f,b){p.ior.value=f.ior,f.sheen>0&&(p.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),p.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(p.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,p.sheenColorMapTransform)),f.sheenRoughnessMap&&(p.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,p.sheenRoughnessMapTransform))),f.clearcoat>0&&(p.clearcoat.value=f.clearcoat,p.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(p.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,p.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(p.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ct&&p.clearcoatNormalScale.value.negate())),f.dispersion>0&&(p.dispersion.value=f.dispersion),f.iridescence>0&&(p.iridescence.value=f.iridescence,p.iridescenceIOR.value=f.iridescenceIOR,p.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(p.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,p.iridescenceMapTransform)),f.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),f.transmission>0&&(p.transmission.value=f.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(p.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,p.transmissionMapTransform)),p.thickness.value=f.thickness,f.thicknessMap&&(p.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=f.attenuationDistance,p.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(p.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(p.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=f.specularIntensity,p.specularColor.value.copy(f.specularColor),f.specularColorMap&&(p.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,p.specularColorMapTransform)),f.specularIntensityMap&&(p.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,p.specularIntensityMapTransform))}function x(p,f){f.matcap&&(p.matcap.value=f.matcap)}function S(p,f){const b=e.get(f).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Gp(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,R){const y=R.program;n.uniformBlockBinding(M,y)}function l(M,R){let y=r[M.id];y===void 0&&(p(M),y=d(M),r[M.id]=y,M.addEventListener("dispose",b));const w=R.program;n.updateUBOMapping(M,w);const _=e.render.frame;s[M.id]!==_&&(u(M),s[M.id]=_)}function d(M){const R=m();M.__bindingPointIndex=R;const y=i.createBuffer(),w=M.__size,_=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,w,_),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,R,y),y}function m(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return Ve("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(M){const R=r[M.id],y=M.uniforms,w=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,R);for(let _=0,T=y.length;_<T;_++){const C=y[_];if(Array.isArray(C))for(let D=0,F=C.length;D<F;D++)g(C[D],_,D,w);else g(C,_,0,w)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function g(M,R,y,w){if(S(M,R,y,w)===!0){const _=M.__offset,T=M.value;if(Array.isArray(T)){let C=0;for(let D=0;D<T.length;D++){const F=T[D],Y=f(F);x(F,M.__data,C),typeof F!="number"&&typeof F!="boolean"&&!F.isMatrix3&&!ArrayBuffer.isView(F)&&(C+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(T,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,_,M.__data)}}function x(M,R,y){typeof M=="number"||typeof M=="boolean"?R[0]=M:M.isMatrix3?(R[0]=M.elements[0],R[1]=M.elements[1],R[2]=M.elements[2],R[3]=0,R[4]=M.elements[3],R[5]=M.elements[4],R[6]=M.elements[5],R[7]=0,R[8]=M.elements[6],R[9]=M.elements[7],R[10]=M.elements[8],R[11]=0):ArrayBuffer.isView(M)?R.set(new M.constructor(M.buffer,M.byteOffset,R.length)):M.toArray(R,y)}function S(M,R,y,w){const _=M.value,T=R+"_"+y;if(w[T]===void 0)return typeof _=="number"||typeof _=="boolean"?w[T]=_:ArrayBuffer.isView(_)?w[T]=_.slice():w[T]=_.clone(),!0;{const C=w[T];if(typeof _=="number"||typeof _=="boolean"){if(C!==_)return w[T]=_,!0}else{if(ArrayBuffer.isView(_))return!0;if(C.equals(_)===!1)return C.copy(_),!0}}return!1}function p(M){const R=M.uniforms;let y=0;const w=16;for(let T=0,C=R.length;T<C;T++){const D=Array.isArray(R[T])?R[T]:[R[T]];for(let F=0,Y=D.length;F<Y;F++){const Z=D[F],G=Array.isArray(Z.value)?Z.value:[Z.value];for(let X=0,H=G.length;X<H;X++){const J=G[X],j=f(J),ue=y%w,pe=ue%j.boundary,_e=ue+pe;y+=pe,_e!==0&&w-_e<j.storage&&(y+=w-_e),Z.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),Z.__offset=y,y+=j.storage}}}const _=y%w;return _>0&&(y+=w-_),M.__size=y,M.__cache={},this}function f(M){const R={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(R.boundary=4,R.storage=4):M.isVector2?(R.boundary=8,R.storage=8):M.isVector3||M.isColor?(R.boundary=16,R.storage=12):M.isVector4?(R.boundary=16,R.storage=16):M.isMatrix3?(R.boundary=48,R.storage=48):M.isMatrix4?(R.boundary=64,R.storage=64):M.isTexture?Re("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(R.boundary=16,R.storage=M.byteLength):Re("WebGLRenderer: Unsupported uniform value type.",M),R}function b(M){const R=M.target;R.removeEventListener("dispose",b);const y=a.indexOf(R.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[R.id]),delete r[R.id],delete s[R.id]}function A(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:c,update:l,dispose:A}}const Vp=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Kt=null;function Hp(){return Kt===null&&(Kt=new Cc(Vp,16,16,zn,dn),Kt.name="DFG_LUT",Kt.minFilter=Et,Kt.magFilter=Et,Kt.wrapS=un,Kt.wrapT=un,Kt.generateMipmaps=!1,Kt.needsUpdate=!0),Kt}class kp{constructor(e={}){const{canvas:t=ac(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:u=!1,outputBufferType:g=Bt}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;const S=g,p=new Set([ua,ca,la]),f=new Set([Bt,tn,bi,Ai,aa,oa]),b=new Uint32Array(4),A=new Int32Array(4),M=new U;let R=null,y=null;const w=[],_=[];let T=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Qt,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const C=this;let D=!1,F=null,Y=null,Z=null,G=null;this._outputColorSpace=Ft;let X=0,H=0,J=null,j=-1,ue=null;const pe=new rt,_e=new rt;let ke=null;const et=new He(0);let We=0,$=t.width,ie=t.height,ee=1,we=null,Pe=null;const be=new rt(0,0,$,ie),at=new rt(0,0,$,ie);let Ne=!1;const Ze=new il;let Xe=!1,ze=!1;const ct=new st,ht=new U,mt=new rt,_t={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let tt=!1;function ut(){return J===null?ee:1}let L=n;function Rt(v,I){return t.getContext(v,I)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:d,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ia}`),t.addEventListener("webglcontextlost",nt,!1),t.addEventListener("webglcontextrestored",Qe,!1),t.addEventListener("webglcontextcreationerror",Wt,!1),L===null){const I="webgl2";if(L=Rt(I,v),L===null)throw Rt(I)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(v){throw Ve("WebGLRenderer: "+v.message),v}let qe,E,h,N,z,k,te,re,W,K,se,Se,le,ae,Te,Ae,De,P,ne,q,oe,de,Q;
vendor: 4,589 bytes, line 4116
4116function Me(){qe=new Hh(L),qe.init(),oe=new Ip(L,qe),E=new Uh(L,qe,e,oe),h=new Dp(L,qe),E.reversedDepthBuffer&&u&&h.buffers.depth.setReversed(!0),Y=L.createFramebuffer(),Z=L.createFramebuffer(),G=L.createFramebuffer(),N=new Xh(L),z=new _p,k=new Lp(L,qe,h,z,E,oe,N),te=new Vh(C),re=new Kc(L),de=new Lh(L,re),W=new kh(L,re,N,de),K=new Yh(L,W,re,de,N),P=new qh(L,E,k),Te=new Nh(z),se=new gp(C,te,qe,E,de,Te),Se=new zp(C,z),le=new vp,ae=new bp(qe),De=new Dh(C,te,h,K,x,c),Ae=new Pp(C,K,E),Q=new Gp(L,N,E,h),ne=new Ih(L,qe,N),q=new Wh(L,qe,N),N.programs=se.programs,C.capabilities=E,C.extensions=qe,C.properties=z,C.renderLists=le,C.shadowMap=Ae,C.state=h,C.info=N}Me(),S!==Bt&&(T=new Zh(S,t.width,t.height,o,r,s));const xe=new Op(C,L);this.xr=xe,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const v=qe.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=qe.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(v){v!==void 0&&(ee=v,this.setSize($,ie,!1))},this.getSize=function(v){return v.set($,ie)},this.setSize=function(v,I,V=!0){if(xe.isPresenting){Re("WebGLRenderer: Can't change size while VR device is presenting.");return}$=v,ie=I,t.width=Math.floor(v*ee),t.height=Math.floor(I*ee),V===!0&&(t.style.width=v+"px",t.style.height=I+"px"),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,v,I)},this.getDrawingBufferSize=function(v){return v.set($*ee,ie*ee).floor()},this.setDrawingBufferSize=function(v,I,V){$=v,ie=I,ee=V,t.width=Math.floor(v*V),t.height=Math.floor(I*V),this.setViewport(0,0,v,I)},this.setEffects=function(v){if(S===Bt){Ve("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let I=0;I<v.length;I++)if(v[I].isOutputPass===!0){Re("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(pe)},this.getViewport=function(v){return v.copy(be)},this.setViewport=function(v,I,V,O){v.isVector4?be.set(v.x,v.y,v.z,v.w):be.set(v,I,V,O),h.viewport(pe.copy(be).multiplyScalar(ee).round())},this.getScissor=function(v){return v.copy(at)},this.setScissor=function(v,I,V,O){v.isVector4?at.set(v.x,v.y,v.z,v.w):at.set(v,I,V,O),h.scissor(_e.copy(at).multiplyScalar(ee).round())},this.getScissorTest=function(){return Ne},this.setScissorTest=function(v){h.setScissorTest(Ne=v)},this.setOpaqueSort=function(v){we=v},this.setTransparentSort=function(v){Pe=v},this.getClearColor=function(v){return v.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(v=!0,I=!0,V=!0){let O=0;if(v){let B=!1;if(J!==null){const he=J.texture.format;B=p.has(he)}if(B){const he=J.texture.type,ge=f.has(he),fe=De.getClearColor(),ve=De.getClearAlpha(),Ee=fe.r,Le=fe.g,Ue=fe.b;ge?(b[0]=Ee,b[1]=Le,b[2]=Ue,b[3]=ve,L.clearBufferuiv(L.COLOR,0,b)):(A[0]=Ee,A[1]=Le,A[2]=Ue,A[3]=ve,L.clearBufferiv(L.COLOR,0,A))}else O|=L.COLOR_BUFFER_BIT}I&&(O|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),V&&(O|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O!==0&&L.clear(O)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),F=v},this.dispose=function(){t.removeEventListener("webglcontextlost",nt,!1),t.removeEventListener("webglcontextrestored",Qe,!1),t.removeEventListener("webglcontextcreationerror",Wt,!1),De.dispose(),le.dispose(),ae.dispose(),z.dispose(),te.dispose(),K.dispose(),de.dispose(),Q.dispose(),se.dispose(),xe.dispose(),xe.removeEventListener("sessionstart",ya),xe.removeEventListener("sessionend",Ta),wn.stop()};function nt(v){v.preventDefault(),za("WebGLRenderer: Context Lost."),D=!0}function Qe(){za("WebGLRenderer: Context Restored."),D=!1;const v=N.autoReset,I=Ae.enabled,V=Ae.autoUpdate,O=Ae.needsUpdate,B=Ae.type;Me(),N.autoReset=v,Ae.enabled=I,Ae.autoUpdate=V,Ae.needsUpdate=O,Ae.type=B}function Wt(v){Ve("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Xt(v){const I=v.target;I.removeEventListener("dispose",Xt),vl(I)}function vl(v){Ml(v),z.remove(v)}function Ml(v){const I=z.get(v).programs;
vendor: 10,140 bytes, line 4116
4116I!==void 0&&(I.forEach(function(V){se.releaseProgram(V)}),v.isShaderMaterial&&se.releaseShaderCache(v))}this.renderBufferDirect=function(v,I,V,O,B,he){I===null&&(I=_t);const ge=B.isMesh&&B.matrixWorld.determinantAffine()<0,fe=yl(v,I,V,O,B);h.setMaterial(O,ge);let ve=V.index,Ee=1;if(O.wireframe===!0){if(ve=W.getWireframeAttribute(V),ve===void 0)return;Ee=2}const Le=V.drawRange,Ue=V.attributes.position;let ye=Le.start*Ee,Ke=(Le.start+Le.count)*Ee;he!==null&&(ye=Math.max(ye,he.start*Ee),Ke=Math.min(Ke,(he.start+he.count)*Ee)),ve!==null?(ye=Math.max(ye,0),Ke=Math.min(Ke,ve.count)):Ue!=null&&(ye=Math.max(ye,0),Ke=Math.min(Ke,Ue.count));const ot=Ke-ye;if(ot<0||ot===1/0)return;de.setup(B,O,fe,V,ve);let it,$e=ne;if(ve!==null&&(it=re.get(ve),$e=q,$e.setIndex(it)),B.isMesh)O.wireframe===!0?(h.setLineWidth(O.wireframeLinewidth*ut()),$e.setMode(L.LINES)):$e.setMode(L.TRIANGLES);else if(B.isLine){let vt=O.linewidth;vt===void 0&&(vt=1),h.setLineWidth(vt*ut()),B.isLineSegments?$e.setMode(L.LINES):B.isLineLoop?$e.setMode(L.LINE_LOOP):$e.setMode(L.LINE_STRIP)}else B.isPoints?$e.setMode(L.POINTS):B.isSprite&&$e.setMode(L.TRIANGLES);if(B.isBatchedMesh)if(qe.get("WEBGL_multi_draw"))$e.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else{const vt=B._multiDrawStarts,me=B._multiDrawCounts,Pt=B._multiDrawCount,Ge=ve?re.get(ve).bytesPerElement:1,Ut=z.get(O).currentProgram.getUniforms();for(let qt=0;qt<Pt;qt++)Ut.setValue(L,"_gl_DrawID",qt),$e.render(vt[qt]/Ge,me[qt])}else if(B.isInstancedMesh)$e.renderInstances(ye,ot,B.count);else if(V.isInstancedBufferGeometry){const vt=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,me=Math.min(V.instanceCount,vt);$e.renderInstances(ye,ot,me)}else $e.render(ye,ot)};function Ea(v,I,V){v.transparent===!0&&v.side===cn&&v.forceSinglePass===!1?(v.side=Ct,v.needsUpdate=!0,Li(v,I,V),v.side=Rn,v.needsUpdate=!0,Li(v,I,V),v.side=cn):Li(v,I,V)}this.compile=function(v,I,V=null){V===null&&(V=v),y=ae.get(V),y.init(I),_.push(y),V.traverseVisible(function(B){B.isLight&&B.layers.test(I.layers)&&(y.pushLight(B),B.castShadow&&y.pushShadow(B))}),v!==V&&v.traverseVisible(function(B){B.isLight&&B.layers.test(I.layers)&&(y.pushLight(B),B.castShadow&&y.pushShadow(B))}),y.setupLights();const O=new Set;return v.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;const he=B.material;if(he)if(Array.isArray(he))for(let ge=0;ge<he.length;ge++){const fe=he[ge];Ea(fe,V,B),O.add(fe)}else Ea(he,V,B),O.add(he)}),y=_.pop(),O},this.compileAsync=function(v,I,V=null){const O=this.compile(v,I,V);return new Promise(B=>{function he(){if(O.forEach(function(ge){z.get(ge).currentProgram.isReady()&&O.delete(ge)}),O.size===0){B(v);return}setTimeout(he,10)}qe.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let Pr=null;function Sl(v){Pr&&Pr(v)}function ya(){wn.stop()}function Ta(){wn.start()}const wn=new fl;wn.setAnimationLoop(Sl),typeof self<"u"&&wn.setContext(self),this.setAnimationLoop=function(v){Pr=v,xe.setAnimationLoop(v),v===null?wn.stop():wn.start()},xe.addEventListener("sessionstart",ya),xe.addEventListener("sessionend",Ta),this.render=function(v,I){if(I!==void 0&&I.isCamera!==!0){Ve("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;F!==null&&F.renderStart(v,I);const V=xe.enabled===!0&&xe.isPresenting===!0,O=T!==null&&(J===null||V)&&T.begin(C,J);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),xe.enabled===!0&&xe.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(xe.cameraAutoUpdate===!0&&xe.updateCamera(I),I=xe.getCamera()),v.isScene===!0&&v.onBeforeRender(C,v,I,J),y=ae.get(v,_.length),y.init(I),y.state.textureUnits=k.getTextureUnits(),_.push(y),ct.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),Ze.setFromProjectionMatrix(ct,Jt,I.reversedDepth),ze=this.localClippingEnabled,Xe=Te.init(this.clippingPlanes,ze),R=le.get(v,w.length),R.init(),w.push(R),xe.enabled===!0&&xe.isPresenting===!0){const ge=C.xr.getDepthSensingMesh();ge!==null&&Dr(ge,I,-1/0,C.sortObjects)}Dr(v,I,0,C.sortObjects),R.finish(),C.sortObjects===!0&&R.sort(we,Pe,I.reversedDepth),tt=xe.enabled===!1||xe.isPresenting===!1||xe.hasDepthSensing()===!1,tt&&De.addToRenderList(R,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Xe===!0&&Te.beginShadows();const B=y.state.shadowsArray;if(Ae.render(B,v,I),Xe===!0&&Te.endShadows(),(O&&T.hasRenderPass())===!1){const ge=R.opaque,fe=R.transmissive;if(y.setupLights(),I.isArrayCamera){const ve=I.cameras;if(fe.length>0)for(let Ee=0,Le=ve.length;Ee<Le;Ee++){const Ue=ve[Ee];Aa(ge,fe,v,Ue)}tt&&De.render(v);for(let Ee=0,Le=ve.length;Ee<Le;Ee++){const Ue=ve[Ee];ba(R,v,Ue,Ue.viewport)}}else fe.length>0&&Aa(ge,fe,v,I),tt&&De.render(v),ba(R,v,I)}J!==null&&H===0&&(k.updateMultisampleRenderTarget(J),k.updateRenderTargetMipmap(J)),O&&T.end(C),v.isScene===!0&&v.onAfterRender(C,v,I),de.resetDefaultState(),j=-1,ue=null,_.pop(),_.length>0?(y=_[_.length-1],k.setTextureUnits(y.state.textureUnits),Xe===!0&&Te.setGlobalState(C.clippingPlanes,y.state.camera)):y=null,w.pop(),w.length>0?R=w[w.length-1]:R=null,F!==null&&F.renderEnd()};function Dr(v,I,V,O){if(v.visible===!1)return;if(v.layers.test(I.layers)){if(v.isGroup)V=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(I);else if(v.isLightProbeGrid)y.pushLightProbeGrid(v);else if(v.isLight)y.pushLight(v),v.castShadow&&y.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Ze.intersectsSprite(v)){O&&mt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ct);const ge=K.update(v),fe=v.material;fe.visible&&R.push(v,ge,fe,V,mt.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Ze.intersectsObject(v))){const ge=K.update(v),fe=v.material;if(O&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),mt.copy(v.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),mt.copy(ge.boundingSphere.center)),mt.applyMatrix4(v.matrixWorld).applyMatrix4(ct)),Array.isArray(fe)){const ve=ge.groups;for(let Ee=0,Le=ve.length;Ee<Le;Ee++){const Ue=ve[Ee],ye=fe[Ue.materialIndex];ye&&ye.visible&&R.push(v,ge,ye,V,mt.z,Ue)}}else fe.visible&&R.push(v,ge,fe,V,mt.z,null)}}const he=v.children;for(let ge=0,fe=he.length;ge<fe;ge++)Dr(he[ge],I,V,O)}function ba(v,I,V,O){const{opaque:B,transmissive:he,transparent:ge}=v;y.setupLightsView(V),Xe===!0&&Te.setGlobalState(C.clippingPlanes,V),O&&h.viewport(pe.copy(O)),B.length>0&&Di(B,I,V),he.length>0&&Di(he,I,V),ge.length>0&&Di(ge,I,V),h.buffers.depth.setTest(!0),h.buffers.depth.setMask(!0),h.buffers.color.setMask(!0),h.setPolygonOffset(!1)}function Aa(v,I,V,O){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;if(y.state.transmissionRenderTarget[O.id]===void 0){const ye=qe.has("EXT_color_buffer_half_float")||qe.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[O.id]=new jt(1,1,{generateMipmaps:!0,type:ye?dn:Bt,minFilter:Fn,samples:Math.max(4,E.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Fe.workingColorSpace})}const he=y.state.transmissionRenderTarget[O.id],ge=O.viewport||pe;he.setSize(ge.z*C.transmissionResolutionScale,ge.w*C.transmissionResolutionScale);const fe=C.getRenderTarget(),ve=C.getActiveCubeFace(),Ee=C.getActiveMipmapLevel();C.setRenderTarget(he),C.getClearColor(et),We=C.getClearAlpha(),We<1&&C.setClearColor(16777215,.5),C.clear(),tt&&De.render(V);const Le=C.toneMapping;C.toneMapping=Qt;const Ue=O.viewport;if(O.viewport!==void 0&&(O.viewport=void 0),y.setupLightsView(O),Xe===!0&&Te.setGlobalState(C.clippingPlanes,O),Di(v,V,O),k.updateMultisampleRenderTarget(he),k.updateRenderTargetMipmap(he),qe.has("WEBGL_multisampled_render_to_texture")===!1){let ye=!1;for(let Ke=0,ot=I.length;Ke<ot;Ke++){const it=I[Ke],{object:$e,geometry:vt,material:me,group:Pt}=it;if(me.side===cn&&$e.layers.test(O.layers)){const Ge=me.side;me.side=Ct,me.needsUpdate=!0,Ra($e,V,O,vt,me,Pt),me.side=Ge,me.needsUpdate=!0,ye=!0}}ye===!0&&(k.updateMultisampleRenderTarget(he),k.updateRenderTargetMipmap(he))}C.setRenderTarget(fe,ve,Ee),C.setClearColor(et,We),Ue!==void 0&&(O.viewport=Ue),C.toneMapping=Le}function Di(v,I,V){const O=I.isScene===!0?I.overrideMaterial:null;for(let B=0,he=v.length;B<he;B++){const ge=v[B],{object:fe,geometry:ve,group:Ee}=ge;let Le=ge.material;Le.allowOverride===!0&&O!==null&&(Le=O),fe.layers.test(V.layers)&&Ra(fe,I,V,ve,Le,Ee)}}function Ra(v,I,V,O,B,he){v.onBeforeRender(C,I,V,O,B,he),v.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),B.onBeforeRender(C,I,V,O,v,he),B.transparent===!0&&B.side===cn&&B.forceSinglePass===!1?(B.side=Ct,B.needsUpdate=!0,C.renderBufferDirect(V,I,O,B,v,he),B.side=Rn,B.needsUpdate=!0,C.renderBufferDirect(V,I,O,B,v,he),B.side=cn):C.renderBufferDirect(V,I,O,B,v,he),v.onAfterRender(C,I,V,O,B,he)}function Li(v,I,V){I.isScene!==!0&&(I=_t);const O=z.get(v),B=y.state.lights,he=y.state.shadowsArray,ge=B.state.version,fe=se.getParameters(v,B.state,he,I,V,y.state.lightProbeGridArray),ve=se.getProgramCacheKey(fe);let Ee=O.programs;O.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?I.environment:null,O.fog=I.fog;const Le=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;O.envMap=te.get(v.envMap||O.environment,Le),O.envMapRotation=O.environment!==null&&v.envMap===null?I.environmentRotation:v.envMapRotation,Ee===void 0&&(v.addEventListener("dispose",Xt),Ee=new Map,O.programs=Ee);let Ue=Ee.get(ve);if(Ue!==void 0){if(O.currentProgram===Ue&&O.lightsStateVersion===ge)return Ca(v,fe),Ue}else fe.uniforms=se.getUniforms(v),F!==null&&v.isNodeMaterial&&F.build(v,V,fe),v.onBeforeCompile(fe,C),Ue=se.acquireProgram(fe,ve),Ee.set(ve,Ue),O.uniforms=fe.uniforms;const ye=O.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(ye.clippingPlanes=Te.uniform),Ca(v,fe),O.needsLights=bl(v),O.lightsStateVersion=ge,O.needsLights&&(ye.ambientLightColor.value=B.state.ambient,ye.lightProbe.value=B.state.probe,ye.directionalLights.value=
vendor: 8,911 bytes, line 4116
4116B.state.directional,ye.directionalLightShadows.value=B.state.directionalShadow,ye.spotLights.value=B.state.spot,ye.spotLightShadows.value=B.state.spotShadow,ye.rectAreaLights.value=B.state.rectArea,ye.ltc_1.value=B.state.rectAreaLTC1,ye.ltc_2.value=B.state.rectAreaLTC2,ye.pointLights.value=B.state.point,ye.pointLightShadows.value=B.state.pointShadow,ye.hemisphereLights.value=B.state.hemi,ye.directionalShadowMatrix.value=B.state.directionalShadowMatrix,ye.spotLightMatrix.value=B.state.spotLightMatrix,ye.spotLightMap.value=B.state.spotLightMap,ye.pointShadowMatrix.value=B.state.pointShadowMatrix),O.lightProbeGrid=y.state.lightProbeGridArray.length>0,O.currentProgram=Ue,O.uniformsList=null,Ue}function wa(v){if(v.uniformsList===null){const I=v.currentProgram.getUniforms();v.uniformsList=mr.seqWithValue(I.seq,v.uniforms)}return v.uniformsList}function Ca(v,I){const V=z.get(v);V.outputColorSpace=I.outputColorSpace,V.batching=I.batching,V.batchingColor=I.batchingColor,V.instancing=I.instancing,V.instancingColor=I.instancingColor,V.instancingMorph=I.instancingMorph,V.skinning=I.skinning,V.morphTargets=I.morphTargets,V.morphNormals=I.morphNormals,V.morphColors=I.morphColors,V.morphTargetsCount=I.morphTargetsCount,V.numClippingPlanes=I.numClippingPlanes,V.numIntersection=I.numClipIntersection,V.vertexAlphas=I.vertexAlphas,V.vertexTangents=I.vertexTangents,V.toneMapping=I.toneMapping}function El(v,I){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(I.matrixWorld);for(let V=0,O=v.length;V<O;V++){const B=v[V];if(B.texture!==null&&B.boundingBox.containsPoint(M))return B}return null}function yl(v,I,V,O,B){I.isScene!==!0&&(I=_t),k.resetTextureUnits();const he=I.fog,ge=O.isMeshStandardMaterial||O.isMeshLambertMaterial||O.isMeshPhongMaterial?I.environment:null,fe=J===null?C.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:Fe.workingColorSpace,ve=O.isMeshStandardMaterial||O.isMeshLambertMaterial&&!O.envMap||O.isMeshPhongMaterial&&!O.envMap,Ee=te.get(O.envMap||ge,ve),Le=O.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,Ue=!!V.attributes.tangent&&(!!O.normalMap||O.anisotropy>0),ye=!!V.morphAttributes.position,Ke=!!V.morphAttributes.normal,ot=!!V.morphAttributes.color;let it=Qt;O.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(it=C.toneMapping);const $e=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,vt=$e!==void 0?$e.length:0,me=z.get(O),Pt=y.state.lights;if(Xe===!0&&(ze===!0||v!==ue)){const je=v===ue&&O.id===j;Te.setState(O,v,je)}let Ge=!1;O.version===me.__version?(me.needsLights&&me.lightsStateVersion!==Pt.state.version||me.outputColorSpace!==fe||B.isBatchedMesh&&me.batching===!1||!B.isBatchedMesh&&me.batching===!0||B.isBatchedMesh&&me.batchingColor===!0&&B.colorTexture===null||B.isBatchedMesh&&me.batchingColor===!1&&B.colorTexture!==null||B.isInstancedMesh&&me.instancing===!1||!B.isInstancedMesh&&me.instancing===!0||B.isSkinnedMesh&&me.skinning===!1||!B.isSkinnedMesh&&me.skinning===!0||B.isInstancedMesh&&me.instancingColor===!0&&B.instanceColor===null||B.isInstancedMesh&&me.instancingColor===!1&&B.instanceColor!==null||B.isInstancedMesh&&me.instancingMorph===!0&&B.morphTexture===null||B.isInstancedMesh&&me.instancingMorph===!1&&B.morphTexture!==null||me.envMap!==Ee||O.fog===!0&&me.fog!==he||me.numClippingPlanes!==void 0&&(me.numClippingPlanes!==Te.numPlanes||me.numIntersection!==Te.numIntersection)||me.vertexAlphas!==Le||me.vertexTangents!==Ue||me.morphTargets!==ye||me.morphNormals!==Ke||me.morphColors!==ot||me.toneMapping!==it||me.morphTargetsCount!==vt||!!me.lightProbeGrid!=y.state.lightProbeGridArray.length>0)&&(Ge=!0):(Ge=!0,me.__version=O.version);let Ut=me.currentProgram;Ge===!0&&(Ut=Li(O,I,B),F&&O.isNodeMaterial&&F.onUpdateProgram(O,Ut,me));let qt=!1,gn=!1,Hn=!1;const Je=Ut.getUniforms(),lt=me.uniforms;if(h.useProgram(Ut.program)&&(qt=!0,gn=!0,Hn=!0),O.id!==j&&(j=O.id,gn=!0),me.needsLights){const je=El(y.state.lightProbeGridArray,B);me.lightProbeGrid!==je&&(me.lightProbeGrid=je,gn=!0)}if(qt||ue!==v){h.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),Je.setValue(L,"projectionMatrix",v.projectionMatrix),Je.setValue(L,"viewMatrix",v.matrixWorldInverse);const xn=Je.map.cameraPosition;xn!==void 0&&xn.setValue(L,ht.setFromMatrixPosition(v.matrixWorld)),E.logarithmicDepthBuffer&&Je.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&&Je.setValue(L,"isOrthographic",v.isOrthographicCamera===!0),ue!==v&&(ue=v,gn=!0,Hn=!0)}if(me.needsLights&&(Pt.state.directionalShadowMap.length>0&&Je.setValue(L,"directionalShadowMap",Pt.state.directionalShadowMap,k),Pt.state.spotShadowMap.length>0&&Je.setValue(L,"spotShadowMap",Pt.state.spotShadowMap,k),Pt.state.pointShadowMap.length>0&&Je.setValue(L,"pointShadowMap",Pt.state.pointShadowMap,k)),B.isSkinnedMesh){Je.setOptional(L,B,"bindMatrix"),Je.setOptional(L,B,"bindMatrixInverse");const je=B.skeleton;je&&(je.boneTexture===null&&je.computeBoneTexture(),Je.setValue(L,"boneTexture",je.boneTexture,k))}B.isBatchedMesh&&(Je.setOptional(L,B,"batchingTexture"),Je.setValue(L,"batchingTexture",B._matricesTexture,k),Je.setOptional(L,B,"batchingIdTexture"),Je.setValue(L,"batchingIdTexture",B._indirectTexture,k),Je.setOptional(L,B,"batchingColorTexture"),B._colorsTexture!==null&&Je.setValue(L,"batchingColorTexture",B._colorsTexture,k));const _n=V.morphAttributes;if((_n.position!==void 0||_n.normal!==void 0||_n.color!==void 0)&&P.update(B,V,Ut),(gn||me.receiveShadow!==B.receiveShadow)&&(me.receiveShadow=B.receiveShadow,Je.setValue(L,"receiveShadow",B.receiveShadow)),(O.isMeshStandardMaterial||O.isMeshLambertMaterial||O.isMeshPhongMaterial)&&O.envMap===null&&I.environment!==null&&(lt.envMapIntensity.value=I.environmentIntensity),lt.dfgLUT!==void 0&&(lt.dfgLUT.value=Hp()),gn){if(Je.setValue(L,"toneMappingExposure",C.toneMappingExposure),me.needsLights&&Tl(lt,Hn),he&&O.fog===!0&&Se.refreshFogUniforms(lt,he),Se.refreshMaterialUniforms(lt,O,ee,ie,y.state.transmissionRenderTarget[v.id]),me.needsLights&&me.lightProbeGrid){const je=me.lightProbeGrid;lt.probesSH.value=je.texture,lt.probesMin.value.copy(je.boundingBox.min),lt.probesMax.value.copy(je.boundingBox.max),lt.probesResolution.value.copy(je.resolution)}mr.upload(L,wa(me),lt,k)}if(O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(mr.upload(L,wa(me),lt,k),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&&Je.setValue(L,"center",B.center),Je.setValue(L,"modelViewMatrix",B.modelViewMatrix),Je.setValue(L,"normalMatrix",B.normalMatrix),Je.setValue(L,"modelMatrix",B.matrixWorld),O.uniformsGroups!==void 0){const je=O.uniformsGroups;for(let xn=0,kn=je.length;xn<kn;xn++){const Pa=je[xn];Q.update(Pa,Ut),Q.bind(Pa,Ut)}}return Ut}function Tl(v,I){v.ambientLightColor.needsUpdate=I,v.lightProbe.needsUpdate=I,v.directionalLights.needsUpdate=I,v.directionalLightShadows.needsUpdate=I,v.pointLights.needsUpdate=I,v.pointLightShadows.needsUpdate=I,v.spotLights.needsUpdate=I,v.spotLightShadows.needsUpdate=I,v.rectAreaLights.needsUpdate=I,v.hemisphereLights.needsUpdate=I}function bl(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return X},this.getActiveMipmapLevel=function(){return H},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(v,I,V){const O=z.get(v);O.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,O.__autoAllocateDepthBuffer===!1&&(O.__useRenderToTexture=!1),z.get(v.texture).__webglTexture=I,z.get(v.depthTexture).__webglTexture=O.__autoAllocateDepthBuffer?void 0:V,O.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,I){const V=z.get(v);V.__webglFramebuffer=I,V.__useDefaultFramebuffer=I===void 0},this.setRenderTarget=function(v,I=0,V=0){J=v,X=I,H=V;let O=null,B=!1,he=!1;if(v){const fe=z.get(v);if(fe.__useDefaultFramebuffer!==void 0){h.bindFramebuffer(L.FRAMEBUFFER,fe.__webglFramebuffer),pe.copy(v.viewport),_e.copy(v.scissor),ke=v.scissorTest,h.viewport(pe),h.scissor(_e),h.setScissorTest(ke),j=-1;return}else if(fe.__webglFramebuffer===void 0)k.setupRenderTarget(v);else if(fe.__hasExternalTextures)k.rebindTextures(v,z.get(v.texture).__webglTexture,z.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Le=v.depthTexture;if(fe.__boundDepthTexture!==Le){if(Le!==null&&z.has(Le)&&(v.width!==Le.image.width||v.height!==Le.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");k.setupDepthRenderbuffer(v)}}const ve=v.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(he=!0);const Ee=z.get(v).__webglFramebuffer;
vendor: 4,077 bytes, line 4116
4116v.isWebGLCubeRenderTarget?(Array.isArray(Ee[I])?O=Ee[I][V]:O=Ee[I],B=!0):v.samples>0&&k.useMultisampledRTT(v)===!1?O=z.get(v).__webglMultisampledFramebuffer:Array.isArray(Ee)?O=Ee[V]:O=Ee,pe.copy(v.viewport),_e.copy(v.scissor),ke=v.scissorTest}else pe.copy(be).multiplyScalar(ee).floor(),_e.copy(at).multiplyScalar(ee).floor(),ke=Ne;if(V!==0&&(O=Y),h.bindFramebuffer(L.FRAMEBUFFER,O)&&h.drawBuffers(v,O),h.viewport(pe),h.scissor(_e),h.setScissorTest(ke),B){const fe=z.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+I,fe.__webglTexture,V)}else if(he){const fe=I;for(let ve=0;ve<v.textures.length;ve++){const Ee=z.get(v.textures[ve]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+ve,Ee.__webglTexture,V,fe)}}else if(v!==null&&V!==0){const fe=z.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,fe.__webglTexture,V)}j=-1},this.readRenderTargetPixels=function(v,I,V,O,B,he,ge,fe=0){if(!(v&&v.isWebGLRenderTarget)){Ve("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=z.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve){h.bindFramebuffer(L.FRAMEBUFFER,ve);try{const Ee=v.textures[fe],Le=Ee.format,Ue=Ee.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+fe),!E.textureFormatReadable(Le)){Ve("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!E.textureTypeReadable(Ue)){Ve("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=v.width-O&&V>=0&&V<=v.height-B&&L.readPixels(I,V,O,B,oe.convert(Le),oe.convert(Ue),he)}finally{const Ee=J!==null?z.get(J).__webglFramebuffer:null;h.bindFramebuffer(L.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(v,I,V,O,B,he,ge,fe=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=z.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve)if(I>=0&&I<=v.width-O&&V>=0&&V<=v.height-B){h.bindFramebuffer(L.FRAMEBUFFER,ve);const Ee=v.textures[fe],Le=Ee.format,Ue=Ee.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+fe),!E.textureFormatReadable(Le))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!E.textureTypeReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ye=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,ye),L.bufferData(L.PIXEL_PACK_BUFFER,he.byteLength,L.STREAM_READ),L.readPixels(I,V,O,B,oe.convert(Le),oe.convert(Ue),0);const Ke=J!==null?z.get(J).__webglFramebuffer:null;h.bindFramebuffer(L.FRAMEBUFFER,Ke);const ot=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await oc(L,ot,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,ye),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,he),L.deleteBuffer(ye),L.deleteSync(ot),he}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,I=null,V=0){const O=Math.pow(2,-V),B=Math.floor(v.image.width*O),he=Math.floor(v.image.height*O),ge=I!==null?I.x:0,fe=I!==null?I.y:0;k.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,V,0,0,ge,fe,B,he),h.unbindTexture()},this.copyTextureToTexture=function(v,I,V=null,O=null,B=0,he=0){let ge,fe,ve,Ee,Le,Ue,ye,Ke,ot;const it=v.isCompressedTexture?v.mipmaps[he]:v.image;if(V!==null)ge=V.max.x-V.min.x,fe=V.max.y-V.min.y,ve=V.isBox3?V.max.z-V.min.z:1,Ee=V.min.x,Le=V.min.y,Ue=V.isBox3?V.min.z:0;else{const lt=Math.pow(2,-B);ge=Math.floor(it.width*lt),fe=Math.floor(it.height*lt),v.isDataArrayTexture?ve=it.depth:v.isData3DTexture?ve=Math.floor(it.depth*lt):ve=1,Ee=0,Le=0,Ue=0}O!==null?(ye=O.x,Ke=O.y,ot=O.z):(ye=0,Ke=0,ot=0);const $e=oe.convert(I.format),vt=oe.convert(I.type);let me;
4116I.isData3DTexture?(k.setTexture3D(I,0),me=L.TEXTURE_3D):I.isDataArrayTexture||I.isCompressedArrayTexture?(k.setTexture2DArray(I,0),me=L.TEXTURE_2D_ARRAY):(k.setTexture2D(I,0),me=L.TEXTURE_2D),h.activeTexture(L.TEXTURE0),h.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,I.flipY),h.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),h.pixelStorei(L.UNPACK_ALIGNMENT,I.unpackAlignment);const Pt=h.getParameter(L.UNPACK_ROW_LENGTH),Ge=h.getParameter(L.UNPACK_IMAGE_HEIGHT),Ut=h.getParameter(L.UNPACK_SKIP_PIXELS),qt=h.getParameter(L.UNPACK_SKIP_ROWS),gn=h.getParameter(L.UNPACK_SKIP_IMAGES);h.pixelStorei(L.UNPACK_ROW_LENGTH,it.width),h.pixelStorei(L.UNPACK_IMAGE_HEIGHT,it.height),h.pixelStorei(L.UNPACK_SKIP_PIXELS,Ee),h.pixelStorei(L.UNPACK_SKIP_ROWS,Le),h.pixelStorei(L.UNPACK_SKIP_IMAGES,Ue);const Hn=v.isDataArrayTexture||v.isData3DTexture,Je=I.isDataArrayTexture||I.isData3DTexture;if(v.isDepthTexture){const lt=z.get(v),_n=z.get(I),je=z.get(lt.__renderTarget),xn=z.get(_n.__renderTarget);h.bindFramebuffer(L.READ_FRAMEBUFFER,je.__webglFramebuffer),h.bindFramebuffer(L.DRAW_FRAMEBUFFER,xn.__webglFramebuffer);for(let kn=0;kn<ve;kn++)Hn&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,z.get(v).__webglTexture,B,Ue+kn),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,z.get(I).__webglTexture,he,ot+kn)),L.blitFramebuffer(Ee,Le,ge,fe,ye,Ke,ge,fe,L.DEPTH_BUFFER_BIT,L.NEAREST);h.bindFramebuffer(L.READ_FRAMEBUFFER,null),h.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(B!==0||v.isRenderTargetTexture||z.has(v)){const lt=z.get(v),_n=z.get(I);h.bindFramebuffer(L.READ_FRAMEBUFFER,Z),h.bindFramebuffer(L.DRAW_FRAMEBUFFER,G);for(let je=0;je<ve;je++)Hn?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,lt.__webglTexture,B,Ue+je):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,lt.__webglTexture,B),Je?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,_n.__webglTexture,he,ot+je):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,_n.__webglTexture,he),B!==0?L.blitFramebuffer(Ee,Le,ge,fe,ye,Ke,ge,fe,L.COLOR_BUFFER_BIT,L.NEAREST):Je?L.copyTexSubImage3D(me,he,ye,Ke,ot+je,Ee,Le,ge,fe):L.copyTexSubImage2D(me,he,ye,Ke,Ee,Le,ge,fe);h.bindFramebuffer(L.READ_FRAMEBUFFER,null),h.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else Je?v.isDataTexture||v.isData3DTexture?L.texSubImage3D(me,he,ye,Ke,ot,ge,fe,ve,$e,vt,it.data):I.isCompressedArrayTexture?L.compressedTexSubImage3D(me,he,ye,Ke,ot,ge,fe,ve,$e,it.data):L.texSubImage3D(me,he,ye,Ke,ot,ge,fe,ve,$e,vt,it):v.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,he,ye,Ke,ge,fe,$e,vt,it.data):v.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,he,ye,Ke,it.width,it.height,$e,it.data):L.texSubImage2D(L.TEXTURE_2D,he,ye,Ke,ge,fe,$e,vt,it);h.pixelStorei(L.UNPACK_ROW_LENGTH,Pt),h.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ge),h.pixelStorei(L.UNPACK_SKIP_PIXELS,Ut),h.pixelStorei(L.UNPACK_SKIP_ROWS,qt),h.pixelStorei(L.UNPACK_SKIP_IMAGES,gn),he===0&&I.generateMipmaps&&L.generateMipmap(me),h.unbindTexture()},this.initRenderTarget=function(v){z.get(v).__webglFramebuffer===void 0&&k.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?k.setTextureCube(v,0):v.isData3DTexture?k.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?k.setTexture2DArray(v,0):k.setTexture2D(v,0),h.unbindTexture()},this.resetState=function(){X=0,H=0,J=null,h.reset(),de.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=Fe._getDrawingBufferColorSpace(e),t.unpackColorSpace=Fe._getUnpackColorSpace()}}function Wp(){const i=new yc,e=new Ot(50,1,.1,1e3);e.position.z=6;const t=new yi;t.position.set(1.4,.2,0),t.scale.setScalar(1.15),i.add(t);const n=new ga(2.6,4),r=new Oc(n),s=new rl({color:"#ff2e63",transparent:!0,opacity:.34,blending:gr,depthWrite:!1}),a=new sl({color:"#ff86a8",size:.055,sizeAttenuation:!0,transparent:!0,opacity:.9,blending:gr,depthTest:!1,depthWrite:!1}),o=new Uc(r,s),c=new Nc(n,a);return o.renderOrder=1,c.renderOrder=2,t.add(o,c),{scene:i,camera:e,group:t,dispose:()=>{n.dispose(),r.dispose(),s.dispose(),a.dispose()}}}function Xp(i,e){const t=new kp({canvas:i,context:e,antialias:!0,alpha:!0,stencil:!1});return t.toneMapping=ra,t.setClearColor(0,0),t}function Yp({onUnavailable:i,onReady:e}){const t=Ii.useRef(null),n=Ii.useRef(i);n.current=i;const r=Ii.useRef(e);return r.current=e,Ii.useEffect(()=>{const s=document.createElement("canvas");s.className="hero-3d",s.style.cssText="display:block;width:100%;height:100%";let a;try{const A=s.getContext("webgl2",{antialias:!0,alpha:!0,powerPreference:"low-power",stencil:!1});if(!A){n.current();return}a=Xp(s,A)}catch{n.current();return}t.current.appendChild(s);const{scene:o,camera:c,group:l,dispose:d}=Wp();a.setPixelRatio(Math.min(window.devicePixelRatio,1.5));let m=!1,u=0,g=0;const x=new ResizeObserver(([A])=>{const{width:M,height:R}=A.contentRect;!M||!R||(c.aspect=M/R,c.updateProjectionMatrix(),a.setSize(M,R,!1))});x.observe(s);const S=A=>{if(!m||document.hidden||(g=requestAnimationFrame(S),A-u<1e3/30))return;const M=s.dataset.ready&&u?Math.min((A-u)/1e3,.1):0;u=A,l.rotation.y+=M*.09,l.rotation.x+=M*.025,a.render(o,c),s.dataset.ready||(s.dataset.ready="true",r.current())},p=()=>{cancelAnimationFrame(g),u=0,m&&!document.hidden&&(g=requestAnimationFrame(S))},f=new IntersectionObserver(([A])=>{m=A.isIntersecting,p()});f.observe(s),document.addEventListener("visibilitychange",p);const b=A=>{A.preventDefault(),n.current()};return s.addEventListener("webglcontextlost",b),()=>{cancelAnimationFrame(g),x.disconnect(),f.disconnect(),document.removeEventListener("visibilitychange",p),s.removeEventListener("webglcontextlost",b),d(),a.dispose(),a.forceContextLoss(),s.remove()}},[]),Al.jsx("div",{ref:t,"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-[4] hidden w-[62%] md:block"})}export{Yp as Hero3D};
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.