vendor: 5,389 bytes, lines 1-5
1import{b as at}from"./NextApp-BNvw9GYf.js";import"./index-DrpGsEZX.js";/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Vs="169",nl=0,la=1,il=2,uo=1,rl=2,Jt=3,mn=0,St=1,Qt=2,nn=0,qn=1,Yn=2,ca=3,ua=4,sl=5,An=100,al=101,ol=102,ll=103,cl=104,ul=200,hl=201,fl=202,dl=203,es=204,ts=205,pl=206,ml=207,gl=208,_l=209,vl=210,xl=211,Ml=212,Sl=213,El=214,ns=0,is=1,rs=2,Zn=3,ss=4,as=5,os=6,ls=7,ho=0,yl=1,Tl=2,pn=0,fo=1,po=2,mo=3,go=4,Al=5,_o=6,vo=7,xo=300,jn=301,Jn=302,cs=303,us=304,dr=306,hs=1e3,wn=1001,fs=1002,Lt=1003,bl=1004,Ai=1005,Ft=1006,Er=1007,Rn=1008,sn=1009,Mo=1010,So=1011,gi=1012,ks=1013,Cn=1014,en=1015,rn=1016,Ws=1017,Xs=1018,Qn=1020,Eo=35902,yo=1021,To=1022,Bt=1023,Ao=1024,bo=1025,Kn=1026,ei=1027,wo=1028,qs=1029,Ro=1030,Ys=1031,Ks=1033,Ji=33776,Qi=33777,er=33778,tr=33779,ds=35840,ps=35841,ms=35842,gs=35843,_s=36196,vs=37492,xs=37496,Ms=37808,Ss=37809,Es=37810,ys=37811,Ts=37812,As=37813,bs=37814,ws=37815,Rs=37816,Cs=37817,Ps=37818,Ls=37819,Ds=37820,Us=37821,nr=36492,Is=36494,Ns=36495,Co=36283,Fs=36284,Os=36285,Bs=36286,wl=3200,Rl=3201,Cl=0,Pl=1,dn="",Vt="srgb",Wt="srgb-linear",$s="display-p3",pr="display-p3-linear",sr="linear",Je="srgb",ar="rec709",or="p3",Ln=7680,ha=519,Ll=512,Dl=513,Ul=514,Po=515,Il=516,Nl=517,Fl=518,Ol=519,fa=35044,da="300 es",tn=2e3,lr=2001;class ii{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const pt=["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"],yr=Math.PI/180,zs=180/Math.PI;function vi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(pt[i&255]+pt[i>>8&255]+pt[i>>16&255]+pt[i>>24&255]+"-"+pt[e&255]+pt[e>>8&255]+"-"+pt[e>>16&15|64]+pt[e>>24&255]+"-"+pt[t&63|128]+pt[t>>8&255]+"-"+pt[t>>16&255]+pt[t>>24&255]+pt[n&255]+pt[n>>8&255]+pt[n>>16&255]+pt[n>>24&255]).toLowerCase()}function Mt(i,e,t){return Math.max(e,Math.min(t,i))}function Bl(i,e){return(i%e+e)%e}function Tr(i,e,t){return(1-t)*i+t*e}function oi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class He{constructor(e=0,t=0){He.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 4,215 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}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(Mt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ne{constructor(e,t,n,r,s,a,o,l,c){Ne.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=n,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],d=n[4],u=n[7],p=n[2],m=n[5],v=n[8],E=r[0],h=r[3],f=r[6],T=r[1],x=r[4],y=r[7],C=r[2],w=r[5],b=r[8];return s[0]=a*E+o*T+l*C,s[3]=a*h+o*x+l*w,s[6]=a*f+o*y+l*b,s[1]=c*E+d*T+u*C,s[4]=c*h+d*x+u*w,s[7]=c*f+d*y+u*b,s[2]=p*E+m*T+v*C,s[5]=p*h+m*x+v*w,s[8]=p*f+m*y+v*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-n*s*d+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=d*a-o*c,p=o*l-d*s,m=c*s-a*l,v=t*u+n*p+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/v;
5return e[0]=u*E,e[1]=(r*c-d*n)*E,e[2]=(o*n-r*a)*E,e[3]=p*E,e[4]=(d*t-r*l)*E,e[5]=(r*s-o*t)*E,e[6]=m*E,e[7]=(n*l-c*t)*E,e[8]=(a*t-n*s)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Ar.makeScale(e,t)),this}rotate(e){return this.premultiply(Ar.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ar.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ar=new Ne;function Lo(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function cr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function zl(){const i=cr("canvas");return i.style.display="block",i}const pa={};function ir(i){i in pa||(pa[i]=!0,console.warn(i))}function Hl(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Gl(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Vl(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const ma=new Ne().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ga=new Ne().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),li={[Wt]:{transfer:sr,primaries:ar,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[Vt]:{transfer:Je,primaries:ar,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[pr]:{transfer:sr,primaries:or,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(ga),fromReference:i=>i.applyMatrix3(ma)},[$s]:{transfer:Je,primaries:or,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(ga),fromReference:i=>i.applyMatrix3(ma).convertLinearToSRGB()}},kl=new Set([Wt,pr]),qe={enabled:!0,_workingColorSpace:Wt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!kl.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=li[e].toReference,r=li[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return li[i].primaries},getTransfer:function(i){return i===dn?sr:li[i].transfer},getLuminanceCoefficients:function(i,e=this._workingColorSpace){return i.fromArray(li[e].luminanceCoefficients)}};function $n(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function br(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Dn;class Wl{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Dn===void 0&&(Dn=cr("canvas")),Dn.width=e.width,Dn.height=e.height;const n=Dn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Dn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=$n(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($n(t[n]/255)*255):t[n]=$n(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Xl=0;class Do{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xl++}),this.uuid=vi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(wr(r[a].image)):s.push(wr(r[a]))}else s=wr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function wr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Wl.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ql=0;class Et extends ii{constructor(e=Et.DEFAULT_IMAGE,t=Et.DEFAULT_MAPPING,n=wn,r=wn,s=Ft,a=Rn,o=Bt,l=sn,c=Et.DEFAULT_ANISOTROPY,d=dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ql++}),this.uuid=vi(),this.name="",this.source=new Do(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new He(0,0),this.repeat=new He(1,1),this.center=new He(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ne,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace
vendor: 20,221 bytes, line 5
5=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==xo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case hs:e.x=e.x-Math.floor(e.x);break;case wn:e.x=e.x<0?0:1;break;case fs: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 hs:e.y=e.y-Math.floor(e.y);break;case wn:e.y=e.y<0?0:1;break;case fs: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++}}Et.DEFAULT_IMAGE=null;Et.DEFAULT_MAPPING=xo;Et.DEFAULT_ANISOTROPY=1;class it{constructor(e=0,t=0,n=0,r=1){it.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],d=l[4],u=l[8],p=l[1],m=l[5],v=l[9],E=l[2],h=l[6],f=l[10];if(Math.abs(d-p)<.01&&Math.abs(u-E)<.01&&Math.abs(v-h)<.01){if(Math.abs(d+p)<.1&&Math.abs(u+E)<.1&&Math.abs(v+h)<.1&&Math.abs(c+m+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,y=(m+1)/2,C=(f+1)/2,w=(d+p)/4,b=(u+E)/4,I=(v+h)/4;return x>y&&x>C?x<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(x),r=w/n,s=b/n):y>C?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=w/r,s=I/r):C<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),n=b/s,r=I/s),this.set(n,r,s,t),this}let T=Math.sqrt((h-v)*(h-v)+(u-E)*(u-E)+(p-d)*(p-d));return Math.abs(T)<.001&&(T=1),this.x=(h-v)/T,this.y=(u-E)/T,this.z=(p-d)/T,this.w=Math.acos((c+m+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Yl extends ii{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new it(0,0,e,t),this.scissorTest=!1,this.viewport=new it(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ft,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Et(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Do(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ht extends Yl{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Uo extends Et{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=Lt,this.minFilter=Lt,this.wrapR=wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Kl extends Et{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=Lt,this.minFilter=Lt,this.wrapR=wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],d=n[r+2],u=n[r+3];const p=s[a+0],m=s[a+1],v=s[a+2],E=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=p,e[t+1]=m,e[t+2]=v,e[t+3]=E;return}if(u!==E||l!==p||c!==m||d!==v){let h=1-o;const f=l*p+c*m+d*v+u*E,T=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const C=Math.sqrt(x),w=Math.atan2(C,f*T);h=Math.sin(h*w)/C,o=Math.sin(o*w)/C}const y=o*T;if(l=l*h+p*y,c=c*h+m*y,d=d*h+v*y,u=u*h+E*y,h===1-o){const C=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=C,c*=C,d*=C,u*=C}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],d=n[r+3],u=s[a],p=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+d*u+l*m-c*p,e[t+1]=l*v+d*p+c*u-o*m,e[t+2]=c*v+d*m+o*p-l*u,e[t+3]=d*v-o*u-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),d=o(r/2),u=o(s/2),p=l(n/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=p*d*u+c*m*v,this._y=c*m*u-p*d*v,this._z=c*d*v+p*m*u,this._w=c*d*u-p*m*v;break;case"YXZ":this._x=p*d*u+c*m*v,this._y=c*m*u-p*d*v,this._z=c*d*v-p*m*u,this._w=c*d*u+p*m*v;break;case"ZXY":this._x=p*d*u-c*m*v,this._y=c*m*u+p*d*v,this._z=c*d*v+p*m*u,this._w=c*d*u-p*m*v;break;case"ZYX":this._x=p*d*u-c*m*v,this._y=c*m*u+p*d*v,this._z=c*d*v-p*m*u,this._w=c*d*u+p*m*v;break;case"YZX":this._x=p*d*u+c*m*v,this._y=c*m*u+p*d*v,this._z=c*d*v-p*m*u,this._w=c*d*u-p*m*v;break;case"XZY":this._x=p*d*u-c*m*v,this._y=c*m*u-p*d*v,this._z=c*d*v+p*m*u,this._w=c*d*u+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],u=t[10],p=n+o+u;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>u){const m=2*Math.sqrt(1+n-o-u);this._w=(d-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>u){const m=2*Math.sqrt(1+o-n-u);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+d)/m}else{const m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Mt(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,l=t._y,c=t._z,d=t._w;return this._x=n*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-n*c,this._z=s*d+a*c+n*l-r*o,this._w=a*d-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),u=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=r*u+this._y*p,this._z=s*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(_a.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(_a.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),d=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*d,this.y=n+l*d+o*c-s*u,this.z=r+l*u+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}
vendor: 5,724 bytes, line 5
5roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Rr.copy(this).projectOnVector(e),this.sub(Rr)}reflect(e){return this.sub(Rr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Mt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Rr=new N,_a=new xi;class Mi{constructor(e=new N(1/0,1/0,1/0),t=new N(-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(Ut.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ut.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=Ut.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,Ut):Ut.fromBufferAttribute(s,a),Ut.applyMatrix4(e.matrixWorld),this.expandByPoint(Ut);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,Ut),Ut.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 21,520 bytes, line 5
5s}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(ci),wi.subVectors(this.max,ci),Un.subVectors(e.a,ci),In.subVectors(e.b,ci),Nn.subVectors(e.c,ci),on.subVectors(In,Un),ln.subVectors(Nn,In),_n.subVectors(Un,Nn);let t=[0,-on.z,on.y,0,-ln.z,ln.y,0,-_n.z,_n.y,on.z,0,-on.x,ln.z,0,-ln.x,_n.z,0,-_n.x,-on.y,on.x,0,-ln.y,ln.x,0,-_n.y,_n.x,0];return!Cr(t,Un,In,Nn,wi)||(t=[1,0,0,0,1,0,0,0,1],!Cr(t,Un,In,Nn,wi))?!1:(Ri.crossVectors(on,ln),t=[Ri.x,Ri.y,Ri.z],Cr(t,Un,In,Nn,wi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ut).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ut).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:(Yt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Yt=[new N,new N,new N,new N,new N,new N,new N,new N],Ut=new N,bi=new Mi,Un=new N,In=new N,Nn=new N,on=new N,ln=new N,_n=new N,ci=new N,wi=new N,Ri=new N,vn=new N;function Cr(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){vn.fromArray(i,s);const o=r.x*Math.abs(vn.x)+r.y*Math.abs(vn.y)+r.z*Math.abs(vn.z),l=e.dot(vn),c=t.dot(vn),d=n.dot(vn);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const $l=new Mi,ui=new N,Pr=new N;class Si{constructor(e=new N,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):$l.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;ui.subVectors(e,this.center);const t=ui.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ui,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):(Pr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ui.copy(e.center).add(Pr)),this.expandByPoint(ui.copy(e.center).sub(Pr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Kt=new N,Lr=new N,Ci=new N,cn=new N,Dr=new N,Pi=new N,Ur=new N;class Zs{constructor(e=new N,t=new N(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,Kt)),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=Kt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kt.copy(this.origin).addScaledVector(this.direction,t),Kt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Lr.copy(e).add(t).multiplyScalar(.5),Ci.copy(t).sub(e).normalize(),cn.copy(this.origin).sub(Lr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ci),o=cn.dot(this.direction),l=-cn.dot(Ci),c=cn.lengthSq(),d=Math.abs(1-a*a);let u,p,m,v;if(d>0)if(u=a*l-o,p=a*o-l,v=s*d,u>=0)if(p>=-v)if(p<=v){const E=1/d;u*=E,p*=E,m=u*(u+a*p+2*o)+p*(a*u+p+2*l)+c}else p=s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p=-s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p<=-v?(u=Math.max(0,-(-a*s+o)),p=u>0?-s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c):p<=v?(u=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(u=Math.max(0,-(a*s+o)),p=u>0?s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c);else p=a>0?-s:s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Lr).addScaledVector(Ci,p),m}intersectSphere(e,t){Kt.subVectors(e.center,this.origin);const n=Kt.dot(this.direction),r=Kt.dot(Kt)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-p.z)*u,l=(e.max.z-p.z)*u):(o=(e.max.z-p.z)*u,l=(e.min.z-p.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Kt)!==null}intersectTriangle(e,t,n,r,s){Dr.subVectors(t,e),Pi.subVectors(n,e),Ur.crossVectors(Dr,Pi);let a=this.direction.dot(Ur),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;cn.subVectors(this.origin,e);const l=o*this.direction.dot(Pi.crossVectors(cn,Pi));if(l<0)return null;const c=o*this.direction.dot(Dr.cross(cn));if(c<0||l+c>a)return null;const d=-o*cn.dot(Ur);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 tt{constructor(e,t,n,r,s,a,o,l,c,d,u,p,m,v,E,h){tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,d,u,p,m,v,E,h)}set(e,t,n,r,s,a,o,l,c,d,u,p,m,v,E,h){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]=l,f[2]=c,f[6]=d,f[10]=u,f[14]=p,f[3]=m,f[7]=v,f[11]=E,f[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new tt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/Fn.setFromMatrixColumn(e,0).length(),s=1/Fn.setFromMatrixColumn(e,1).length(),a=1/Fn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const p=a*d,m=a*u,v=o*d,E=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=m+v*c,t[5]=p-E*c,t[9]=-o*l,t[2]=E-p*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const p=l*d,m=l*u,v=c*d,E=c*u;t[0]=p+E*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=m*o-v,t[6]=E+p*o,t[10]=a*l}else if(e.order==="ZXY"){const p=l*d,m=l*u,v=c*d,E=c*u;t[0]=p-E*o,t[4]=-a*u,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*d,t[9]=E-p*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const p=a*d,m=a*u,v=o*d,E=o*u;t[0]=l*d,t[4]=v*c-m,t[8]=p*c+E,t[1]=l*u,t[5]=E*c+p,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const p=a*l,m=a*c,v=o*l,E=o*c;t[0]=l*d,t[4]=E-p*u,t[8]=v*u+m,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=m*u+v,t[10]=p-E*u}else if(e.order==="XZY"){const p=a*l,m=a*c,v=o*l,E=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=p*u+E,t[5]=a*d,t[9]=m*u-v,t[2]=v*u-m,t[6]=o*d,t[10]=E*u+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Zl,e,jl)}lookAt(e,t,n){const r=this.elements;return At.subVectors(e,t),At.lengthSq()===0&&(At.z=1),At.normalize(),un.crossVectors(n,At),un.lengthSq()===0&&(Math.abs(n.z)===1?At.x+=1e-4:At.z+=1e-4,At.normalize(),un.crossVectors(n,At)),un.normalize(),Li.crossVectors(At,un),r[0]=un.x,r[4]=Li.x,r[8]=At.x,r[1]=un.y,r[5]=Li.y,r[9]=At.y,r[2]=un.z,r[6]=Li.z,r[10]=At.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],d=n[1],u=n[5],p=n[9],m=n[13],v=n[2],E=n[6],h=n[10],f=n[14],T=n[3],x=n[7],y=n[11],C=n[15],w=r[0],b=r[4],I=r[8],K=r[12],g=r[1],S=r[5],O=r[9],H=r[13],k=r[2],j=r[6],z=r[10],X=r[14],D=r[3],$=r[7],te=r[11],Q=r[15];return s[0]=a*w+o*g+l*k+c*D,s[4]=a*b+o*S+l*j+c*$,s[8]=a*I+o*O+l*z+c*te,s[12]=a*K+o*H+l*X+c*Q,s[1]=d*w+u*g+p*k+m*D,s[5]=d*b+u*S+p*j+m*$,s[9]=d*I+u*O+p*z+m*te,s[13]=d*K+u*H+p*X+m*Q,s[2]=v*w+E*g+h*k+f*D,s[6]=v*b+E*S+h*j+f*$,s[10]=v*I+E*O+h*z+f*te,s[14]=v*K+E*H+h*X+f*Q,s[3]=T*w+x*g+y*k+C*D,s[7]=T*b+x*S+y*j+C*$,s[11]=T*I+x*O+y*z+C*te,s[15]=T*K+x*H+y*X+C*Q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],u=e[6],p=e[10],m=e[14],v=e[3],E=e[7],h=e[11],f=e[15];return v*(+s*l*u-r*c*u-s*o*p+n*c*p+r*o*m-n*l*m)+E*(+t*l*m-t*c*p+s*a*p-r*a*m+r*c*d-s*l*d)+h*(+t*c*u-t*o*m-s*a*u+n*a*m+s*o*d-n*c*d)+f*(-r*o*d-t*l*u+t*o*p+r*a*u-n*a*p+n*l*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=e[9],p=e[10],m=e[11],v=e[12],E=e[13],h=e[14],f=e[15],T=u*h*c-E*p*c+E*l*m-o*h*m-u*l*f+o*p*f,x=v*p*c-d*h*c-v*l*m+a*h*m+d*l*f-a*p*f,y=d*E*c-v*u*c+v*o*m-a*E*m-d*o*f+a*u*f,C=v*u*l-d*E*l-v*o*p+a*E*p+d*o*h-a*u*h,w=t*T+n*x+r*y+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/w;return e[0]=T*b,e[1]=(E*p*s-u*h*s-E*r*m+n*h*m+u*r*f-n*p*f)*b,e[2]=(o*h*s-E*l*s+E*r*c-n*h*c-o*r*f+n*l*f)*b,e[3]=(u*l*s-o*p*s-u*r*c+n*p*c+o*r*m-n*l*m)*b,e[4]=x*b,e[5]=(d*h*s-v*p*s+v*r*m-t*h*m-d*r*f+t*p*f)*b,e[6]=(v*l*s-a*h*s-v*r*c+t*h*c+a*r*f-t*l*f)*b,e[7]=(a*p*s-d*l*s+d*r*c-t*p*c-a*r*m+t*l*m)*b,e[8]=y*b,e[9]=(v*u*s-d*E*s-v*n*m+t*E*m+d*n*f-t*u*f)*b,e[10]=(a*E*s-v*o*s+v*n*c-t*E*c-a*n*f+t*o*f)*b,e[11]=(d*o*s-a*u*s-d*n*c+t*u*c+a*n*m-t*o*m)*b,e[12]=C*b,e[13]=(d*E*r-v*u*r+v*n*p-t*E*p-d*n*h+t*u*h)*b,e[14]=(v*o*r-a*E*r-v*n*l+t*E*l+a*n*h-t*o*h)*b,e[15]=(a*u*r-d*o*r+d*n*l-t*u*l-a*n*p+t*o*p)*b,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+n,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,u=o+o,p=s*c,m=s*d,v=s*u,E=a*d,h=a*u,f=o*u,T=l*c,x=l*d,y=l*u,C=n.x,w=n.y,b=n.z;return r[0]=(1-(E+f))*C,r[1]=(m+y)*C,r[2]=(v-x)*C,r[3]=0,r[4]=(m-y)*w,r[5]=(1-(p+f))*w,r[6]=(h+T)*w,r[7]=0,r[8]=(v+x)*b,r[9]=(h-T)*b,r[10]=(1-(p+E))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=Fn.set(r[0],r[1],r[2]).length();const a=Fn.set(r[4],r[5],r[6]).length(),o=Fn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],It.copy(this);const c=1/s,d=1/a,u=1/o;return It.elements[0]*=c,It.elements[1]*=c,It.elements[2]*=c,It.elements[4]*=d,It.elements[5]*=d,It.elements[6]*=d,It.elements[8]*=u,It.elements[9]*=u,It.elements[10]*=u,t.setFromRotationMatrix(It),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=tn){const l=this.elements,c=2*s/(t-e),d=2*s/(n-r),u=(t+e)/(t-e),p=(n+r)/(n-r);let m,v;if(o===tn)m=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===lr)m=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=tn){const l=this.elements,c=1/(t-e),d=1/(n-r),u=1/(a-s),p=(t+e)*c,m=(n+r)*d;let v,E;if(o===tn)v=(a+s)*u,E=-2*u;else if(o===lr)v=s*u,E=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=E,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Fn=new N,It=new tt,Zl=new N(0,0,0),jl=new N(1,1,1),un=new N,Li=new N,At=new N,va=new tt,xa=new xi;class Xt{constructor(e=0,t=0,n=0,r=Xt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],u=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Mt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Mt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Mt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Mt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Mt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-Mt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return va.makeRotationFromQuaternion(e),this.setFromRotationMatrix(va,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xa.setFromEuler(this),this.setFromQuaternion(xa,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}}Xt.DEFAULT_ORDER="XYZ";class Io{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 Jl=0;const Ma=new N,On=new xi,$t=new tt,Di=new N,hi=new N,Ql=new N,ec=new xi,Sa=new N(1,0,0),Ea=new N(0,1,0),ya=new N(0,0,1),Ta={type:"added"},tc={type:"removed"},Bn={type:"childadded",child:null},Ir={type:"childremoved",child:null};class _t extends ii{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jl++}),this.uuid=vi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_t.DEFAULT_UP.clone();const e=new N,t=new Xt,n=new xi,r=new N(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 tt},normalMatrix:{value:new Ne}}),this.matrix=new tt,this.matrixWorld=new tt,this.matrixAutoUpdate=_t.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Io,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,289 bytes, line 5
5setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return On.setFromAxisAngle(e,t),this.quaternion.multiply(On),this}rotateOnWorldAxis(e,t){return On.setFromAxisAngle(e,t),this.quaternion.premultiply(On),this}rotateX(e){return this.rotateOnAxis(Sa,e)}rotateY(e){return this.rotateOnAxis(Ea,e)}rotateZ(e){return this.rotateOnAxis(ya,e)}translateOnAxis(e,t){return Ma.copy(e).applyQuaternion(this.quaternion),this.position.add(Ma.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Sa,e)}translateY(e){return this.translateOnAxis(Ea,e)}translateZ(e){return this.translateOnAxis(ya,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($t.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Di.copy(e):Di.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),hi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$t.lookAt(hi,Di,this.up):$t.lookAt(Di,hi,this.up),this.quaternion.setFromRotationMatrix($t),r&&($t.extractRotation(r.matrixWorld),On.setFromRotationMatrix($t),this.quaternion.premultiply(On.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ta),Bn.child=e,this.dispatchEvent(Bn),Bn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tc),Ir.child=e,this.dispatchEvent(Ir),Ir.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),$t.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$t.multiply(e.parent.matrixWorld)),e.applyMatrix4($t),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ta),Bn.child=e,this.dispatchEvent(Bn),Bn.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(hi,e,Ql),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(hi,ec,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 4,802 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),u=a(e.shapes),p=a(e.skeletons),m=a(e.animations),v=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),d.length>0&&(n.images=d),u.length>0&&(n.shapes=u),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=r,n;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}_t.DEFAULT_UP=new N(0,1,0);_t.DEFAULT_MATRIX_AUTO_UPDATE=!0;_t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;
vendor: 10,189 bytes, line 5
5const Nt=new N,Zt=new N,Nr=new N,jt=new N,zn=new N,Hn=new N,Aa=new N,Fr=new N,Or=new N,Br=new N,zr=new it,Hr=new it,Gr=new it;class Ot{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Nt.subVectors(e,t),r.cross(Nt);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){Nt.subVectors(r,t),Zt.subVectors(n,t),Nr.subVectors(e,t);const a=Nt.dot(Nt),o=Nt.dot(Zt),l=Nt.dot(Nr),c=Zt.dot(Zt),d=Zt.dot(Nr),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const p=1/u,m=(c*l-o*d)*p,v=(a*d-o*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,jt)===null?!1:jt.x>=0&&jt.y>=0&&jt.x+jt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,jt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,jt.x),l.addScaledVector(a,jt.y),l.addScaledVector(o,jt.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return zr.setScalar(0),Hr.setScalar(0),Gr.setScalar(0),zr.fromBufferAttribute(e,t),Hr.fromBufferAttribute(e,n),Gr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(zr,s.x),a.addScaledVector(Hr,s.y),a.addScaledVector(Gr,s.z),a}static isFrontFacing(e,t,n,r){return Nt.subVectors(n,t),Zt.subVectors(e,t),Nt.cross(Zt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Nt.subVectors(this.c,this.b),Zt.subVectors(this.a,this.b),Nt.cross(Zt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ot.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ot.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Ot.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Ot.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ot.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),Hn.subVectors(s,n),Fr.subVectors(e,n);const l=zn.dot(Fr),c=Hn.dot(Fr);if(l<=0&&c<=0)return t.copy(n);Or.subVectors(e,r);const d=zn.dot(Or),u=Hn.dot(Or);if(d>=0&&u<=d)return t.copy(r);const p=l*u-d*c;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(n).addScaledVector(zn,a);Br.subVectors(e,s);const m=zn.dot(Br),v=Hn.dot(Br);if(v>=0&&m<=v)return t.copy(s);const E=m*c-l*v;if(E<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(n).addScaledVector(Hn,o);const h=d*v-m*u;if(h<=0&&u-d>=0&&m-v>=0)return Aa.subVectors(s,r),o=(u-d)/(u-d+(m-v)),t.copy(r).addScaledVector(Aa,o);const f=1/(h+E+p);return a=E*f,o=p*f,t.copy(n).addScaledVector(zn,a).addScaledVector(Hn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const No={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},hn={h:0,s:0,l:0},Ui={h:0,s:0,l:0};function Vr(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 We{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=Vt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qe.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,qe.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=qe.workingColorSpace){if(e=Bl(e,1),t=Mt(t,0,1),n=Mt(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=Vr(a,s,e+1/3),this.g=Vr(a,s,e),this.b=Vr(a,s,e-1/3)}return qe.toWorkingColorSpace(this,r),this}setStyle(e,t=Vt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Vt){const n=No[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$n(e.r),this.g=$n(e.g),this.b=$n(e.b),this}copyLinearToSRGB(e){return this.r=br(e.r),this.g=br(e.g),this.b=br(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Vt){return qe.fromWorkingColorSpace(mt.copy(this),e),Math.round(Mt(mt.r*255,0,255))*65536+Math.round(Mt(mt.g*255,0,255))*256+Math.round(Mt(mt.b*255,0,255))}getHexString(e=Vt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qe.workingColorSpace){qe.fromWorkingColorSpace(mt.copy(this),t);const n=mt.r,r=mt.g,s=mt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=d<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=qe.workingColorSpace){return qe.fromWorkingColorSpace(mt.copy(this),t),e.r=mt.r,e.g=mt.g,e.b=mt.b,e}getStyle(e=Vt){qe.fromWorkingColorSpace(mt.copy(this),e);const t=mt.r,n=mt.g,r=mt.b;return e!==Vt?`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(hn),this.setHSL(hn.h+e,hn.s+t,hn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 2,633 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(hn),e.getHSL(Ui);const n=Tr(hn.h,Ui.h,t),r=Tr(hn.s,Ui.s,t),s=Tr(hn.l,Ui.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 mt=new We;We.NAMES=No;let nc=0;class ri extends ii{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nc++}),this.uuid=vi(),this.name="",this.type="Material",this.blending=qn,this.side=mn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=es,this.blendDst=ts,this.blendEquation=An,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new We(0,0,0),this.blendAlpha=0,this.depthFunc=Zn,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ha,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ln,this.stencilZFail=Ln,this.stencilZPass=Ln,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 8,832 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qn&&(n.blending=this.blending),this.side!==mn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==es&&(n.blendSrc=this.blendSrc),this.blendDst!==ts&&(n.blendDst=this.blendDst),this.blendEquation!==An&&(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!==Zn&&(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!==ha&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ln&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ln&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ln&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,710 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class js extends ri{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new We(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 Xt,this.combine=ho,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 ot=new N,Ii=new He;class et{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=fa,this.updateRanges=[],this.gpuType=en,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.applyMatrix3(e),this.setXY(t,Ii.x,Ii.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyMatrix3(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyMatrix4(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyNormalMatrix(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.transformDirection(e),this.setXYZ(t,ot.x,ot.y,ot.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=oi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=xt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=oi(t,this.array)),t}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=oi(t,this.array)),t}setY(e,t){return this.normalized&&(t=xt(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=oi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xt(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=oi(t,this.array)),t}setW(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(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=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}
vendor: 13,247 bytes, line 5
5setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array),s=xt(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}}class Fo extends et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Oo extends et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Gt extends et{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ic=0;const Ct=new tt,kr=new _t,Gn=new N,bt=new Mi,fi=new Mi,ut=new N;class wt extends ii{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ic++}),this.uuid=vi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Lo(e)?Oo:Fo)(e,1):this.index=e,this}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 Ne().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ct.makeRotationFromQuaternion(e),this.applyMatrix4(Ct),this}rotateX(e){return Ct.makeRotationX(e),this.applyMatrix4(Ct),this}rotateY(e){return Ct.makeRotationY(e),this.applyMatrix4(Ct),this}rotateZ(e){return Ct.makeRotationZ(e),this.applyMatrix4(Ct),this}translate(e,t,n){return Ct.makeTranslation(e,t,n),this.applyMatrix4(Ct),this}scale(e,t,n){return Ct.makeScale(e,t,n),this.applyMatrix4(Ct),this}lookAt(e){return kr.lookAt(e),kr.updateMatrix(),this.applyMatrix4(kr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gn).negate(),this.translate(Gn.x,Gn.y,Gn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Gt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Mi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(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];bt.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,bt.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,bt.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(bt.min),this.boundingBox.expandByPoint(bt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Si);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){const n=this.boundingSphere.center;if(bt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];fi.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(bt.min,fi.min),bt.expandByPoint(ut),ut.addVectors(bt.max,fi.max),bt.expandByPoint(ut)):(bt.expandByPoint(fi.min),bt.expandByPoint(fi.max))}bt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)ut.fromBufferAttribute(o,c),l&&(Gn.fromBufferAttribute(e,c),ut.add(Gn)),r=Math.max(r,n.distanceToSquared(ut))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new et(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let I=0;I<n.count;I++)o[I]=new N,l[I]=new N;const c=new N,d=new N,u=new N,p=new He,m=new He,v=new He,E=new N,h=new N;function f(I,K,g){c.fromBufferAttribute(n,I),d.fromBufferAttribute(n,K),u.fromBufferAttribute(n,g),p.fromBufferAttribute(s,I),m.fromBufferAttribute(s,K),v.fromBufferAttribute(s,g),d.sub(c),u.sub(c),m.sub(p),v.sub(p);const S=1/(m.x*v.y-v.x*m.y);isFinite(S)&&(E.copy(d).multiplyScalar(v.y).addScaledVector(u,-m.y).multiplyScalar(S),h.copy(u).multiplyScalar(m.x).addScaledVector(d,-v.x).multiplyScalar(S),o[I].add(E),o[K].add(E),o[g].add(E),l[I].add(h),l[K].add(h),l[g].add(h))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let I=0,K=T.length;I<K;++I){const g=T[I],S=g.start,O=g.count;for(let H=S,k=S+O;H<k;H+=3)f(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const x=new N,y=new N,C=new N,w=new N;function b(I){C.fromBufferAttribute(r,I),w.copy(C);const K=o[I];x.copy(K),x.sub(C.multiplyScalar(C.dot(K))).normalize(),y.crossVectors(w,K);const S=y.dot(l[I])<0?-1:1;a.setXYZW(I,x.x,x.y,x.z,S)}for(let I=0,K=T.length;I<K;++I){const g=T[I],S=g.start,O=g.count;for(let H=S,k=S+O;H<k;H+=3)b(e.getX(H+0)),b(e.getX(H+1)),b(e.getX(H+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,m=n.count;p<m;p++)n.setXYZ(p,0,0,0);const r=new N,s=new N,a=new N,o=new N,l=new N,c=new N,d=new N,u=new N;if(e)for(let p=0,m=e.count;p<m;p+=3){const v=e.getX(p+0),E=e.getX(p+1),h=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,E),a.fromBufferAttribute(t,h),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),o.fromBufferAttribute(n,v),l.fromBufferAttribute(n,E),c.fromBufferAttribute(n,h),o.add(d),l.add(d),c.add(d),n.setXYZ(v,o.x,o.y,o.z),n.setXYZ(E,l.x,l.y,l.z),n.setXYZ(h,c.x,c.y,c.z)}else for(let p=0,m=t.count;p<m;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),n.setXYZ(p+0,d.x,d.y,d.z),n.setXYZ(p+1,d.x,d.y,d.z),n.setXYZ(p+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++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,u=o.normalized,p=new c.constructor(l.length*d);let m=0,v=0;for(let E=0,h=l.length;E<h;E++){o.isInterleavedBufferAttribute?m=l[E]*o.data.stride+o.offset:m=l[E]*d;for(let f=0;f<d;f++)p[v++]=c[m++]}return new et(p,d,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new wt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,u=c.length;d<u;d++){const p=c[d],m=e(p,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let u=0,p=c.length;u<p;u++){const m=c[u];d.push(m.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],u=s[c];for(let p=0,m=u.length;p<m;p++)d.push(u[p].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ba=new tt,xn=new Zs,Ni=new Si,wa=new N,Fi=new N,Oi=new N,Bi=new N,Wr=new N,zi=new N,Ra=new N,Hi=new N;class zt extends _t{constructor(e=new wt,t=new js){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){zi.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],u=s[l];d!==0&&(Wr.fromBufferAttribute(u,e),a?zi.addScaledVector(Wr,d):zi.addScaledVector(Wr.sub(t),d))}t.add(zi)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ni.copy(n.boundingSphere),Ni.applyMatrix4(s),xn.copy(e.ray).recast(e.near),!(Ni.containsPoint(xn.origin)===!1&&(xn.intersectSphere(Ni,wa)===null||xn.origin.distanceToSquared(wa)>(e.far-e.near)**2))&&(ba.copy(s).invert(),xn.copy(e.ray).applyMatrix4(ba),!(n.boundingBox!==null&&xn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,xn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,u=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,E=p.length;v<E;v++){const h=p[v],f=a[h.materialIndex],T=Math.max(h.start,m.start),x=Math.min(o.count,Math.min(h.start+h.count,m.start+m.count));for(let y=T,C=x;y<C;y+=3){const w=o.getX(y),b=o.getX(y+1),I=o.getX(y+2);r=Gi(this,f,e,n,c,d,u,w,b,I),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=h.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),E=Math.min(o.count,m.start+m.count);for(let h=v,f=E;h<f;h+=3){const T=o.getX(h),x=o.getX(h+1),y=o.getX(h+2);r=Gi(this,a,e,n,c,d,u,T,x,y),r&&(r.faceIndex=Math.floor(h/3),t.pu
vendor: 7,004 bytes, lines 5-9
5sh(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,E=p.length;v<E;v++){const h=p[v],f=a[h.materialIndex],T=Math.max(h.start,m.start),x=Math.min(l.count,Math.min(h.start+h.count,m.start+m.count));for(let y=T,C=x;y<C;y+=3){const w=y,b=y+1,I=y+2;r=Gi(this,f,e,n,c,d,u,w,b,I),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=h.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),E=Math.min(l.count,m.start+m.count);for(let h=v,f=E;h<f;h+=3){const T=h,x=h+1,y=h+2;r=Gi(this,a,e,n,c,d,u,T,x,y),r&&(r.faceIndex=Math.floor(h/3),t.push(r))}}}}function rc(i,e,t,n,r,s,a,o){let l;if(e.side===St?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===mn,o),l===null)return null;Hi.copy(o),Hi.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Hi);return c<t.near||c>t.far?null:{distance:c,point:Hi.clone(),object:i}}function Gi(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Fi),i.getVertexPosition(l,Oi),i.getVertexPosition(c,Bi);const d=rc(i,e,t,n,Fi,Oi,Bi,Ra);if(d){const u=new N;Ot.getBarycoord(Ra,Fi,Oi,Bi,u),r&&(d.uv=Ot.getInterpolatedAttribute(r,o,l,c,u,new He)),s&&(d.uv1=Ot.getInterpolatedAttribute(s,o,l,c,u,new He)),a&&(d.normal=Ot.getInterpolatedAttribute(a,o,l,c,u,new N),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new N,materialIndex:0};Ot.getNormal(Fi,Oi,Bi,p.normal),d.face=p,d.barycoord=u}return d}class Ei extends wt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],u=[];let p=0,m=0;v("z","y","x",-1,-1,n,t,e,a,s,0),v("z","y","x",1,-1,n,t,-e,a,s,1),v("x","z","y",1,1,e,n,t,r,a,2),v("x","z","y",1,-1,e,n,-t,r,a,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Gt(c,3)),this.setAttribute("normal",new Gt(d,3)),this.setAttribute("uv",new Gt(u,2));function v(E,h,f,T,x,y,C,w,b,I,K){const g=y/b,S=C/I,O=y/2,H=C/2,k=w/2,j=b+1,z=I+1;let X=0,D=0;const $=new N;for(let te=0;te<z;te++){const Q=te*S-H;for(let xe=0;xe<j;xe++){const Se=xe*g-O;$[E]=Se*T,$[h]=Q*x,$[f]=k,c.push($.x,$.y,$.z),$[E]=0,$[h]=0,$[f]=w>0?1:-1,d.push($.x,$.y,$.z),u.push(xe/b),u.push(1-te/I),X+=1}}for(let te=0;te<I;te++)for(let Q=0;Q<b;Q++){const xe=p+Q+j*te,Se=p+Q+j*(te+1),F=p+(Q+1)+j*(te+1),J=p+(Q+1)+j*te;l.push(xe,Se,J),l.push(Se,F,J),D+=6}o.addGroup(m,D,K),m+=D,p+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ei(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ti(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function gt(i){const e={};for(let t=0;t<i.length;t++){const n=ti(i[t]);for(const r in n)e[r]=n[r]}return e}function sc(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Bo(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:qe.workingColorSpace}const _i={clone:ti,merge:gt};var ac=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,oc=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class ht extends ri{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ac,this.fragmentShader=oc,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=ti(e.uniforms),this.uniformsGroups=sc(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class zo extends _t{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tt,this.projectionMatrix=new tt,this.projectionMatrixInverse=new tt,this.coordinateSystem=tn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const fn=new N,Ca=new He,Pa=new He;class Pt extends zo{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=zs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(yr*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,387 bytes, line 9
9getEffectiveFOV(){return zs*2*Math.atan(Math.tan(yr*.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){fn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(fn.x,fn.y).multiplyScalar(-e/fn.z),fn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(fn.x,fn.y).multiplyScalar(-e/fn.z)}getViewSize(e,t){return this.getViewBounds(e,Ca,Pa),t.subVectors(Pa,Ca)}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(yr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Vn=-90,kn=1;class lc extends _t{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Pt(Vn,kn,e,t);r.layers=this.layers,this.add(r);const s=new Pt(Vn,kn,e,t);s.layers=this.layers,this.add(s);const a=new Pt(Vn,kn,e,t);a.layers=this.layers,this.add(a);const o=new Pt(Vn,kn,e,t);o.layers=this.layers,this.add(o);const l=new Pt(Vn,kn,e,t);l.layers=this.layers,this.add(l);const c=new Pt(Vn,kn,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===tn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,u=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,r),e.render(t,d),e.setRenderTarget(u,p,m),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}}class Ho extends Et{constructor(e,t,n,r,s,a,o,l,c,d){e=e!==void 0?e:[],t=t!==void 0?t:jn,super(e,t,n,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class cc extends Ht{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ho(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ft}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 12,245 bytes, lines 9-157
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new Ei(5,5,5),s=new ht({name:"CubemapFromEquirect",uniforms:ti(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:St,blending:nn});s.uniforms.tEquirect.value=t;const a=new zt(r,s),o=t.minFilter;return t.minFilter===Rn&&(t.minFilter=Ft),new lc(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const Xr=new N,uc=new N,hc=new Ne;class yn{constructor(e=new N(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=Xr.subVectors(n,t).cross(uc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Xr),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||hc.getNormalMatrix(e),r=this.coplanarPoint(Xr).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 Mn=new Si,Vi=new N;class Go{constructor(e=new yn,t=new yn,n=new yn,r=new yn,s=new yn,a=new yn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=tn){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],d=r[5],u=r[6],p=r[7],m=r[8],v=r[9],E=r[10],h=r[11],f=r[12],T=r[13],x=r[14],y=r[15];if(n[0].setComponents(l-s,p-c,h-m,y-f).normalize(),n[1].setComponents(l+s,p+c,h+m,y+f).normalize(),n[2].setComponents(l+a,p+d,h+v,y+T).normalize(),n[3].setComponents(l-a,p-d,h-v,y-T).normalize(),n[4].setComponents(l-o,p-u,h-E,y-x).normalize(),t===tn)n[5].setComponents(l+o,p+u,h+E,y+x).normalize();else if(t===lr)n[5].setComponents(o,u,E,x).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(),Mn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Mn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Mn)}intersectsSprite(e){return Mn.center.set(0,0,0),Mn.radius=.7071067811865476,Mn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Mn)}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(Vi.x=r.normal.x>0?e.max.x:e.min.x,Vi.y=r.normal.y>0?e.max.y:e.min.y,Vi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Vi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Vo(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function fc(i){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,u=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,d),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const d=l.array,u=l.updateRanges;if(i.bindBuffer(c,o),u.length===0)i.bufferSubData(c,0,d);else{u.sort((m,v)=>m.start-v.start);let p=0;for(let m=1;m<u.length;m++){const v=u[p],E=u[m];E.start<=v.start+v.count+1?v.count=Math.max(v.count,E.start+E.count-v.start):(++p,u[p]=E)}u.length=p+1;for(let m=0,v=u.length;m<v;m++){const E=u[m];i.bufferSubData(c,E.start*d.BYTES_PER_ELEMENT,d,E.start,E.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class mr extends wt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,d=l+1,u=e/o,p=t/l,m=[],v=[],E=[],h=[];for(let f=0;f<d;f++){const T=f*p-a;for(let x=0;x<c;x++){const y=x*u-s;v.push(y,-T,0),E.push(0,0,1),h.push(x/o),h.push(1-f/l)}}for(let f=0;f<l;f++)for(let T=0;T<o;T++){const x=T+c*f,y=T+c*(f+1),C=T+1+c*(f+1),w=T+1+c*f;m.push(x,y,w),m.push(y,C,w)}this.setIndex(m),this.setAttribute("position",new Gt(v,3)),this.setAttribute("normal",new Gt(E,3)),this.setAttribute("uv",new Gt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mr(e.width,e.height,e.widthSegments,e.heightSegments)}}var dc=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,pc=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,mc=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,gc=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,_c=`#ifdef USE_ALPHATEST 86 #ifdef ALPHA_TO_COVERAGE 87 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 88 if ( diffuseColor.a == 0.0 ) discard; 89 #else 90 if ( diffuseColor.a < alphaTest ) discard; 91 #endif 92#endif`,vc=`#ifdef USE_ALPHATEST 93 uniform float alphaTest; 94#endif`,xc=`#ifdef USE_AOMAP 95 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 96 reflectedLight.indirectDiffuse *= ambientOcclusion; 97 #if defined( USE_CLEARCOAT ) 98 clearcoatSpecularIndirect *= ambientOcclusion; 99 #endif 100 #if defined( USE_SHEEN ) 101 sheenSpecularIndirect *= ambientOcclusion; 102 #endif 103 #if defined( USE_ENVMAP ) && defined( STANDARD ) 104 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 105 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 106 #endif 107#endif`,Mc=`#ifdef USE_AOMAP 108 uniform sampler2D aoMap; 109 uniform float aoMapIntensity; 110#endif`,Sc=`#ifdef USE_BATCHING 111 #if ! defined( GL_ANGLE_multi_draw ) 112 #define gl_DrawID _gl_DrawID 113 uniform int _gl_DrawID; 114 #endif 115 uniform highp sampler2D batchingTexture; 116 uniform highp usampler2D batchingIdTexture; 117 mat4 getBatchingMatrix( const in float i ) { 118 int size = textureSize( batchingTexture, 0 ).x; 119 int j = int( i ) * 4; 120 int x = j % size; 121 int y = j / size; 122 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 123 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 124 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 125 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 126 return mat4( v1, v2, v3, v4 ); 127 } 128 float getIndirectIndex( const in int i ) { 129 int size = textureSize( batchingIdTexture, 0 ).x; 130 int x = i % size; 131 int y = i / size; 132 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 133 } 134#endif 135#ifdef USE_BATCHING_COLOR 136 uniform sampler2D batchingColorTexture; 137 vec3 getBatchingColor( const in float i ) { 138 int size = textureSize( batchingColorTexture, 0 ).x; 139 int j = int( i ); 140 int x = j % size; 141 int y = j / size; 142 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 143 } 144#endif`,Ec=`#ifdef USE_BATCHING 145 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 146#endif`,yc=`vec3 transformed = vec3( position ); 147#ifdef USE_ALPHAHASH 148 vPosition = vec3( position ); 149#endif`,Tc=`vec3 objectNormal = vec3( normal ); 150#ifdef USE_TANGENT 151 vec3 objectTangent = vec3( tangent.xyz ); 152#endif`,Ac=`float G_BlinnPhong_Implicit( ) { 153 return 0.25; 154} 155float D_BlinnPhong( const in float shininess, const in float dotNH ) { 156 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 157}
158vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 159 vec3 halfDir = normalize( lightDir + viewDir ); 160 float dotNH = saturate( dot( normal, halfDir ) ); 161 float dotVH = saturate( dot( viewDir, halfDir ) ); 162 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 163 float G = G_BlinnPhong_Implicit( ); 164 float D = D_BlinnPhong( shininess, dotNH ); 165 return F * ( G * D ); 166} // validated`,bc=`#ifdef USE_IRIDESCENCE 167 const mat3 XYZ_TO_REC709 = mat3( 168 3.2404542, -0.9692660, 0.0556434, 169 -1.5371385, 1.8760108, -0.2040259, 170 -0.4985314, 0.0415560, 1.0572252 171 ); 172 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 173 vec3 sqrtF0 = sqrt( fresnel0 ); 174 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 175 } 176 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 177 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 178 } 179 float IorToFresnel0( float transmittedIor, float incidentIor ) { 180 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 181 } 182 vec3 evalSensitivity( float OPD, vec3 shift ) { 183 float phase = 2.0 * PI * OPD * 1.0e-9; 184 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 185 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 186 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 187 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 188 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 189 xyz /= 1.0685e-7; 190 vec3 rgb = XYZ_TO_REC709 * xyz; 191 return rgb; 192 } 193 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 194 vec3 I; 195 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 196 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 197 float cosTheta2Sq = 1.0 - sinTheta2Sq; 198 if ( cosTheta2Sq < 0.0 ) { 199 return vec3( 1.0 ); 200 } 201 float cosTheta2 = sqrt( cosTheta2Sq ); 202 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 203 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
204 float T121 = 1.0 - R12; 205 float phi12 = 0.0; 206 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 207 float phi21 = PI - phi12; 208 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 209 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 210 vec3 phi23 = vec3( 0.0 ); 211 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 212 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 213 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 214 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 215 vec3 phi = vec3( phi21 ) + phi23; 216 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 217 vec3 r123 = sqrt( R123 ); 218 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 219 vec3 C0 = R12 + Rs; 220 I = C0; 221 vec3 Cm = Rs - T121; 222 for ( int m = 1; m <= 2; ++ m ) { 223 Cm *= r123; 224 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 225 I += Cm * Sm; 226 } 227 return max( I, vec3( 0.0 ) ); 228 } 229#endif`,wc=`#ifdef USE_BUMPMAP 230 uniform sampler2D bumpMap; 231 uniform float bumpScale; 232 vec2 dHdxy_fwd() { 233 vec2 dSTdx = dFdx( vBumpMapUv ); 234 vec2 dSTdy = dFdy( vBumpMapUv ); 235 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 236 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 237 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 238 return vec2( dBx, dBy ); 239 } 240 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 241 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 242 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 243 vec3 vN = surf_norm; 244 vec3 R1 = cross( vSigmaY, vN ); 245 vec3 R2 = cross( vN, vSigmaX ); 246 float fDet = dot( vSigmaX, R1 ) * faceDirection; 247 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 248 return normalize( abs( fDet ) * surf_norm - vGrad ); 249 } 250#endif`,Rc=`#if NUM_CLIPPING_PLANES > 0 251 vec4 plane; 252 #ifdef ALPHA_TO_COVERAGE 253 float distanceToPlane, distanceGradient; 254 float clipOpacity = 1.0; 255 #pragma unroll_loop_start 256 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 257 plane = clippingPlanes[ i ]; 258 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 259 distanceGradient = fwidth( distanceToPlane ) / 2.0; 260 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 261 if ( clipOpacity == 0.0 ) discard; 262 } 263 #pragma unroll_loop_end 264 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 265 float unionClipOpacity = 1.0; 266 #pragma unroll_loop_start 267 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 268 plane = clippingPlanes[ i ]; 269 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 270 distanceGradient = fwidth( distanceToPlane ) / 2.0; 271 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 272 } 273 #pragma unroll_loop_end 274 clipOpacity *= 1.0 - unionClipOpacity; 275 #endif 276 diffuseColor.a *= clipOpacity; 277 if ( diffuseColor.a == 0.0 ) discard; 278 #else 279 #pragma unroll_loop_start 280 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 281 plane = clippingPlanes[ i ]; 282 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 283 } 284 #pragma unroll_loop_end 285 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 286 bool clipped = true; 287 #pragma unroll_loop_start 288 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 289 plane = clippingPlanes[ i ]; 290 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 291 } 292 #pragma unroll_loop_end 293 if ( clipped ) discard; 294 #endif 295 #endif 296#endif`,Cc=`#if NUM_CLIPPING_PLANES > 0 297 varying vec3 vClipPosition; 298 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 299#endif`,Pc=`#if NUM_CLIPPING_PLANES > 0 300 varying vec3 vClipPosition; 301#endif`,Lc=`#if NUM_CLIPPING_PLANES > 0 302 vClipPosition = - mvPosition.xyz; 303#endif`,Dc=`#if defined( USE_COLOR_ALPHA ) 304 diffuseColor *= vColor; 305#elif defined( USE_COLOR ) 306 diffuseColor.rgb *= vColor; 307#endif`,Uc=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) 310 varying vec3 vColor; 311#endif`,Ic=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 varying vec3 vColor; 315#endif`,Nc=`#if defined( USE_COLOR_ALPHA ) 316 vColor = vec4( 1.0 ); 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 vColor = vec3( 1.0 ); 319#endif 320#ifdef USE_COLOR 321 vColor *= color; 322#endif 323#ifdef USE_INSTANCING_COLOR 324 vColor.xyz *= instanceColor.xyz; 325#endif 326#ifdef USE_BATCHING_COLOR 327 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 328 vColor.xyz *= batchingColor.xyz; 329#endif`,Fc=`#define PI 3.141592653589793 330#define PI2 6.283185307179586 331#define PI_HALF 1.5707963267948966 332#define RECIPROCAL_PI 0.3183098861837907 333#define RECIPROCAL_PI2 0.15915494309189535 334#define EPSILON 1e-6 335#ifndef saturate 336#define saturate( a ) clamp( a, 0.0, 1.0 ) 337#endif 338#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 339float pow2( const in float x ) { return x*x; } 340vec3 pow2( const in vec3 x ) { return x*x; } 341float pow3( const in float x ) { return x*x*x; } 342float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 343float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 344float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 345highp float rand( const in vec2 uv ) { 346 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 347 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 348 return fract( sin( sn ) * c ); 349} 350#ifdef HIGH_PRECISION 351 float precisionSafeLength( vec3 v ) { return length( v ); } 352#else 353 float precisionSafeLength( vec3 v ) { 354 float maxComponent = max3( abs( v ) ); 355 return length( v / maxComponent ) * maxComponent; 356 } 357#endif 358struct IncidentLight { 359 vec3 color; 360 vec3 direction; 361 bool visible; 362}; 363struct ReflectedLight { 364 vec3 directDiffuse; 365 vec3 directSpecular; 366 vec3 indirectDiffuse; 367 vec3 indirectSpecular; 368}; 369#ifdef USE_ALPHAHASH 370 varying vec3 vPosition; 371#endif 372vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 373 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 374} 375vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 376 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 377} 378mat3 transposeMat3( const in mat3 m ) { 379 mat3 tmp; 380 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 381 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 382 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 383 return tmp; 384} 385bool isPerspectiveMatrix( mat4 m ) { 386 return m[ 2 ][ 3 ] == - 1.0; 387} 388vec2 equirectUv( in vec3 dir ) { 389 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 390 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 391 return vec2( u, v ); 392}
393vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 394 return RECIPROCAL_PI * diffuseColor; 395} 396vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 397 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 398 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 399} 400float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} // validated`,Oc=`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt ); 444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_m0 - 2.0 462 #define cubeUV_r1 0.8 463 #define cubeUV_m1 - 1.0 464 #define cubeUV_r4 0.4 465 #define cubeUV_m4 2.0 466 #define cubeUV_r5 0.305 467 #define cubeUV_m5 3.0 468 #define cubeUV_r6 0.21 469 #define cubeUV_m6 4.0 470 float roughnessToMip( float roughness ) { 471 float mip = 0.0; 472 if ( roughness >= cubeUV_r1 ) { 473 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 474 } else if ( roughness >= cubeUV_r4 ) { 475 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 476 } else if ( roughness >= cubeUV_r5 ) { 477 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 478 } else if ( roughness >= cubeUV_r6 ) { 479 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 480 } else { 481 mip = - 2.0 * log2( 1.16 * roughness ); } 482 return mip; 483 } 484 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 485 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 486 float mipF = fract( mip ); 487 float mipInt = floor( mip ); 488 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 489 if ( mipF == 0.0 ) { 490 return vec4( color0, 1.0 ); 491 } else { 492 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 493 return vec4( mix( color0, color1, mipF ), 1.0 ); 494 } 495 } 496#endif`,Bc=`vec3 transformedNormal = objectNormal; 497#ifdef USE_TANGENT 498 vec3 transformedTangent = objectTangent; 499#endif 500#ifdef USE_BATCHING 501 mat3 bm = mat3( batchingMatrix ); 502 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 503 transformedNormal = bm * transformedNormal; 504 #ifdef USE_TANGENT 505 transformedTangent = bm * transformedTangent; 506 #endif 507#endif 508#ifdef USE_INSTANCING 509 mat3 im = mat3( instanceMatrix ); 510 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 511 transformedNormal = im * transformedNormal; 512 #ifdef USE_TANGENT 513 transformedTangent = im * transformedTangent; 514 #endif 515#endif 516transformedNormal = normalMatrix * transformedNormal; 517#ifdef FLIP_SIDED 518 transformedNormal = - transformedNormal; 519#endif 520#ifdef USE_TANGENT 521 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 522 #ifdef FLIP_SIDED 523 transformedTangent = - transformedTangent; 524 #endif 525#endif`,zc=`#ifdef USE_DISPLACEMENTMAP 526 uniform sampler2D displacementMap; 527 uniform float displacementScale; 528 uniform float displacementBias; 529#endif`,Hc=`#ifdef USE_DISPLACEMENTMAP 530 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
530placementBias ); 531#endif`,Gc=`#ifdef USE_EMISSIVEMAP 532 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 533 totalEmissiveRadiance *= emissiveColor.rgb; 534#endif`,Vc=`#ifdef USE_EMISSIVEMAP 535 uniform sampler2D emissiveMap; 536#endif`,kc="gl_FragColor = linearToOutputTexel( gl_FragColor );",Wc=` 537const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 538 vec3( 0.8224621, 0.177538, 0.0 ), 539 vec3( 0.0331941, 0.9668058, 0.0 ), 540 vec3( 0.0170827, 0.0723974, 0.9105199 ) 541); 542const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 543 vec3( 1.2249401, - 0.2249404, 0.0 ), 544 vec3( - 0.0420569, 1.0420571, 0.0 ), 545 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 546); 547vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 548 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 549} 550vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 551 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 552} 553vec4 LinearTransferOETF( in vec4 value ) { 554 return value; 555} 556vec4 sRGBTransferOETF( in vec4 value ) { 557 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 ); 558}`,Xc=`#ifdef USE_ENVMAP 559 #ifdef ENV_WORLDPOS 560 vec3 cameraToFrag; 561 if ( isOrthographic ) { 562 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 563 } else { 564 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 565 } 566 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 567 #ifdef ENVMAP_MODE_REFLECTION 568 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 569 #else 570 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 571 #endif 572 #else 573 vec3 reflectVec = vReflect; 574 #endif 575 #ifdef ENVMAP_TYPE_CUBE 576 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 577 #else 578 vec4 envColor = vec4( 0.0 ); 579 #endif 580 #ifdef ENVMAP_BLENDING_MULTIPLY 581 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 582 #elif defined( ENVMAP_BLENDING_MIX ) 583 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 584 #elif defined( ENVMAP_BLENDING_ADD ) 585 outgoingLight += envColor.xyz * specularStrength * reflectivity; 586 #endif 587#endif`,qc=`#ifdef USE_ENVMAP 588 uniform float envMapIntensity; 589 uniform float flipEnvMap; 590 uniform mat3 envMapRotation; 591 #ifdef ENVMAP_TYPE_CUBE 592 uniform samplerCube envMap; 593 #else 594 uniform sampler2D envMap; 595 #endif 596 597#endif`,Yc=`#ifdef USE_ENVMAP 598 uniform float reflectivity; 599 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 600 #define ENV_WORLDPOS 601 #endif 602 #ifdef ENV_WORLDPOS 603 varying vec3 vWorldPosition; 604 uniform float refractionRatio; 605 #else 606 varying vec3 vReflect; 607 #endif 608#endif`,Kc=`#ifdef USE_ENVMAP 609 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 610 #define ENV_WORLDPOS 611 #endif 612 #ifdef ENV_WORLDPOS 613 614 varying vec3 vWorldPosition; 615 #else 616 varying vec3 vReflect; 617 uniform float refractionRatio; 618 #endif 619#endif`,$c=`#ifdef USE_ENVMAP 620 #ifdef ENV_WORLDPOS 621 vWorldPosition = worldPosition.xyz; 622 #else 623 vec3 cameraToVertex; 624 if ( isOrthographic ) { 625 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 626 } else {
627 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 628 } 629 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 630 #ifdef ENVMAP_MODE_REFLECTION 631 vReflect = reflect( cameraToVertex, worldNormal ); 632 #else 633 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 634 #endif 635 #endif 636#endif`,Zc=`#ifdef USE_FOG 637 vFogDepth = - mvPosition.z; 638#endif`,jc=`#ifdef USE_FOG 639 varying float vFogDepth; 640#endif`,Jc=`#ifdef USE_FOG 641 #ifdef FOG_EXP2 642 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 643 #else 644 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 645 #endif 646 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 647#endif`,Qc=`#ifdef USE_FOG 648 uniform vec3 fogColor; 649 varying float vFogDepth; 650 #ifdef FOG_EXP2 651 uniform float fogDensity; 652 #else 653 uniform float fogNear; 654 uniform float fogFar; 655 #endif 656#endif`,eu=`#ifdef USE_GRADIENTMAP 657 uniform sampler2D gradientMap; 658#endif 659vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 660 float dotNL = dot( normal, lightDirection ); 661 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 662 #ifdef USE_GRADIENTMAP 663 return vec3( texture2D( gradientMap, coord ).r ); 664 #else 665 vec2 fw = fwidth( coord ) * 0.5; 666 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 667 #endif 668}`,tu=`#ifdef USE_LIGHTMAP 669 uniform sampler2D lightMap; 670 uniform float lightMapIntensity; 671#endif`,nu=`LambertMaterial material; 672material.diffuseColor = diffuseColor.rgb; 673material.specularStrength = specularStrength;`,iu=`varying vec3 vViewPosition; 674struct LambertMaterial { 675 vec3 diffuseColor; 676 float specularStrength; 677}; 678void 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 ) { 679 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 680 vec3 irradiance = dotNL * directLight.color; 681 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 682} 683void 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 ) { 684 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 685} 686#define RE_Direct RE_Direct_Lambert 687#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,ru=`uniform bool receiveShadow; 688uniform vec3 ambientLightColor; 689#if defined( USE_LIGHT_PROBES ) 690 uniform vec3 lightProbe[ 9 ]; 691#endif 692vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 693 float x = normal.x, y = normal.y, z = normal.z; 694 vec3 result = shCoefficients[ 0 ] * 0.886227; 695 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 696 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 697 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 698 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 699 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 700 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 701 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 702 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 703 return result; 704} 705vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 706 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 707 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 708 return irradiance; 709} 710vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 711 vec3 irradiance = ambientLightColor; 712 return irradiance; 713} 714float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 715 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 716 if ( cutoffDistance > 0.0 ) { 717 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 718 } 719 return distanceFalloff; 720} 721float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 722 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 723} 724#if NUM_DIR_LIGHTS > 0 725 struct DirectionalLight { 726 vec3 direction; 727 vec3 color; 728 }; 729 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 730 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 731 light.color = directionalLight.color; 732 light.direction = directionalLight.direction; 733 light.visible = true; 734 } 735#endif 736#if NUM_POINT_LIGHTS > 0 737 struct PointLight { 738 vec3 position; 739 vec3 color; 740 float distance; 741 float decay; 742 }; 743 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 744 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 745 vec3 lVector = pointLight.position - geometryPosition; 746 light.direction = normalize( lVector ); 747 float lightDistance = length( lVector ); 748 light.color = pointLight.color; 749 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 750 light.visible = ( light.color != vec3( 0.0 ) ); 751 } 752#endif
753#if NUM_SPOT_LIGHTS > 0 754 struct SpotLight { 755 vec3 position; 756 vec3 direction; 757 vec3 color; 758 float distance; 759 float decay; 760 float coneCos; 761 float penumbraCos; 762 }; 763 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 764 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 765 vec3 lVector = spotLight.position - geometryPosition; 766 light.direction = normalize( lVector ); 767 float angleCos = dot( light.direction, spotLight.direction ); 768 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 769 if ( spotAttenuation > 0.0 ) { 770 float lightDistance = length( lVector ); 771 light.color = spotLight.color * spotAttenuation; 772 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 773 light.visible = ( light.color != vec3( 0.0 ) ); 774 } else { 775 light.color = vec3( 0.0 ); 776 light.visible = false; 777 } 778 } 779#endif 780#if NUM_RECT_AREA_LIGHTS > 0 781 struct RectAreaLight { 782 vec3 color; 783 vec3 position; 784 vec3 halfWidth; 785 vec3 halfHeight; 786 }; 787 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 788 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 789#endif 790#if NUM_HEMI_LIGHTS > 0 791 struct HemisphereLight { 792 vec3 direction; 793 vec3 skyColor; 794 vec3 groundColor; 795 }; 796 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 797 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 798 float dotNL = dot( normal, hemiLight.direction ); 799 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 800 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 801 return irradiance; 802 } 803#endif`,su=`#ifdef USE_ENVMAP 804 vec3 getIBLIrradiance( const in vec3 normal ) { 805 #ifdef ENVMAP_TYPE_CUBE_UV 806 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 807 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 808 return PI * envMapColor.rgb * envMapIntensity; 809 #else 810 return vec3( 0.0 ); 811 #endif 812 } 813 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 814 #ifdef ENVMAP_TYPE_CUBE_UV 815 vec3 reflectVec = reflect( - viewDir, normal ); 816 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 817 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 818 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 819 return envMapColor.rgb * envMapIntensity; 820 #else 821 return vec3( 0.0 ); 822 #endif 823 } 824 #ifdef USE_ANISOTROPY 825 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 826 #ifdef ENVMAP_TYPE_CUBE_UV 827 vec3 bentNormal = cross( bitangent, viewDir ); 828 bentNormal = normalize( cross( bentNormal, bitangent ) ); 829 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 830 return getIBLRadiance( viewDir, bentNormal, roughness ); 831 #else 832 return vec3( 0.0 ); 833 #endif 834 } 835 #endif 836#endif`,au=`ToonMaterial material; 837material.diffuseColor = diffuseColor.rgb;`,ou=`varying vec3 vViewPosition; 838struct ToonMaterial { 839 vec3 diffuseColor; 840}; 841void 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 ) { 842 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 843 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 844} 845void 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 ) { 846 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 847} 848#define RE_Direct RE_Direct_Toon 849#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lu=`BlinnPhongMaterial material; 850material.diffuseColor = diffuseColor.rgb; 851material.specularColor = specular; 852material.specularShininess = shininess; 853material.specularStrength = specularStrength;`,cu=`varying vec3 vViewPosition; 854struct BlinnPhongMaterial { 855 vec3 diffuseColor; 856 vec3 specularColor; 857 float specularShininess; 858 float specularStrength; 859}; 860void 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 ) {
861 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 862 vec3 irradiance = dotNL * directLight.color; 863 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 864 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 865} 866void 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 ) { 867 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 868} 869#define RE_Direct RE_Direct_BlinnPhong 870#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,uu=`PhysicalMaterial material; 871material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 872vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 873float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 874material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 875material.roughness = min( material.roughness, 1.0 ); 876#ifdef IOR 877 material.ior = ior; 878 #ifdef USE_SPECULAR 879 float specularIntensityFactor = specularIntensity; 880 vec3 specularColorFactor = specularColor; 881 #ifdef USE_SPECULAR_COLORMAP 882 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 883 #endif 884 #ifdef USE_SPECULAR_INTENSITYMAP 885 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 886 #endif 887 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 888 #else 889 float specularIntensityFactor = 1.0; 890 vec3 specularColorFactor = vec3( 1.0 ); 891 material.specularF90 = 1.0; 892 #endif 893 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 894#else 895 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 896 material.specularF90 = 1.0; 897#endif 898#ifdef USE_CLEARCOAT 899 material.clearcoat = clearcoat; 900 material.clearcoatRoughness = clearcoatRoughness; 901 material.clearcoatF0 = vec3( 0.04 ); 902 material.clearcoatF90 = 1.0; 903 #ifdef USE_CLEARCOATMAP 904 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 905 #endif 906 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 907 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 908 #endif 909 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 910 material.clearcoatRoughness += geometryRoughness; 911 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 912#endif 913#ifdef USE_DISPERSION 914 material.dispersion = dispersion; 915#endif 916#ifdef USE_IRIDESCENCE 917 material.iridescence = iridescence; 918 material.iridescenceIOR = iridescenceIOR; 919 #ifdef USE_IRIDESCENCEMAP 920 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 921 #endif 922 #ifdef USE_IRIDESCENCE_THICKNESSMAP 923 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 924 #else 925 material.iridescenceThickness = iridescenceThicknessMaximum; 926 #endif 927#endif 928#ifdef USE_SHEEN 929 material.sheenColor = sheenColor; 930 #ifdef USE_SHEEN_COLORMAP 931 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 932 #endif 933 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 934 #ifdef USE_SHEEN_ROUGHNESSMAP 935 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 936 #endif 937#endif 938#ifdef USE_ANISOTROPY 939 #ifdef USE_ANISOTROPYMAP 940 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 941 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 942 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 943 #else 944 vec2 anisotropyV = anisotropyVector; 945 #endif 946 material.anisotropy = length( anisotropyV ); 947 if( material.anisotropy == 0.0 ) { 948 anisotropyV = vec2( 1.0, 0.0 ); 949 } else { 950 anisotropyV /= material.anisotropy; 951 material.anisotropy = saturate( material.anisotropy ); 952 } 953 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
954 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 955 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 956#endif`,hu
vendor: 14,687 bytes, lines 956-1257
956=`struct PhysicalMaterial { 957 vec3 diffuseColor; 958 float roughness; 959 vec3 specularColor; 960 float specularF90; 961 float dispersion; 962 #ifdef USE_CLEARCOAT 963 float clearcoat; 964 float clearcoatRoughness; 965 vec3 clearcoatF0; 966 float clearcoatF90; 967 #endif 968 #ifdef USE_IRIDESCENCE 969 float iridescence; 970 float iridescenceIOR; 971 float iridescenceThickness; 972 vec3 iridescenceFresnel; 973 vec3 iridescenceF0; 974 #endif 975 #ifdef USE_SHEEN 976 vec3 sheenColor; 977 float sheenRoughness; 978 #endif 979 #ifdef IOR 980 float ior; 981 #endif 982 #ifdef USE_TRANSMISSION 983 float transmission; 984 float transmissionAlpha; 985 float thickness; 986 float attenuationDistance; 987 vec3 attenuationColor; 988 #endif 989 #ifdef USE_ANISOTROPY 990 float anisotropy; 991 float alphaT; 992 vec3 anisotropyT; 993 vec3 anisotropyB; 994 #endif 995}; 996vec3 clearcoatSpecularDirect = vec3( 0.0 ); 997vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 998vec3 sheenSpecularDirect = vec3( 0.0 ); 999vec3 sheenSpecularIndirect = vec3(0.0 ); 1000vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1001 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1002 float x2 = x * x; 1003 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1004 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1005} 1006float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1007 float a2 = pow2( alpha ); 1008 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1009 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1010 return 0.5 / max( gv + gl, EPSILON ); 1011} 1012float D_GGX( const in float alpha, const in float dotNH ) { 1013 float a2 = pow2( alpha ); 1014 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1015 return RECIPROCAL_PI * a2 / pow2( denom ); 1016} 1017#ifdef USE_ANISOTROPY 1018 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 ) { 1019 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1020 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1021 float v = 0.5 / ( gv + gl ); 1022 return saturate(v); 1023 } 1024 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1025 float a2 = alphaT * alphaB; 1026 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1027 highp float v2 = dot( v, v ); 1028 float w2 = a2 / v2; 1029 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1030 } 1031#endif 1032#ifdef USE_CLEARCOAT 1033 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1034 vec3 f0 = material.clearcoatF0; 1035 float f90 = material.clearcoatF90; 1036 float roughness = material.clearcoatRoughness; 1037 float alpha = pow2( roughness ); 1038 vec3 halfDir = normalize( lightDir + viewDir ); 1039 float dotNL = saturate( dot( normal, lightDir ) ); 1040 float dotNV = saturate( dot( normal, viewDir ) ); 1041 float dotNH = saturate( dot( normal, halfDir ) ); 1042 float dotVH = saturate( dot( viewDir, halfDir ) ); 1043 vec3 F = F_Schlick( f0, f90, dotVH ); 1044 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1045 float D = D_GGX( alpha, dotNH ); 1046 return F * ( V * D ); 1047 } 1048#endif 1049vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1050 vec3 f0 = material.specularColor; 1051 float f90 = material.specularF90; 1052 float roughness = material.roughness; 1053 float alpha = pow2( roughness ); 1054 vec3 halfDir = normalize( lightDir + viewDir ); 1055 float dotNL = saturate( dot( normal, lightDir ) ); 1056 float dotNV = saturate( dot( normal, viewDir ) ); 1057 float dotNH = saturate( dot( normal, halfDir ) ); 1058 float dotVH = saturate( dot( viewDir, halfDir ) ); 1059 vec3 F = F_Schlick( f0, f90, dotVH ); 1060 #ifdef USE_IRIDESCENCE 1061 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1062 #endif 1063 #ifdef USE_ANISOTROPY 1064 float dotTL = dot( material.anisotropyT, lightDir ); 1065 float dotTV = dot( material.anisotropyT, viewDir ); 1066 float dotTH = dot( material.anisotropyT, halfDir ); 1067 float dotBL = dot( material.anisotropyB, lightDir ); 1068 float dotBV = dot( material.anisotropyB, viewDir ); 1069 float dotBH = dot( material.anisotropyB, halfDir ); 1070 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1071 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1072 #else 1073 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1074 float D = D_GGX( alpha, dotNH ); 1075 #endif 1076 return F * ( V * D ); 1077} 1078vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1079 const float LUT_SIZE = 64.0; 1080 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1081 const float LUT_BIAS = 0.5 / LUT_SIZE; 1082 float dotNV = saturate( dot( N, V ) ); 1083 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1084 uv = uv * LUT_SCALE + LUT_BIAS; 1085 return uv; 1086} 1087float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1088 float l = length( f ); 1089 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1090} 1091vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1092 float x = dot( v1, v2 ); 1093 float y = abs( x ); 1094 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1095 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1096 float v = a / b; 1097 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1098 return cross( v1, v2 ) * theta_sintheta; 1099} 1100vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1101 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1102 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1103 vec3 lightNormal = cross( v1, v2 ); 1104 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1105 vec3 T1, T2; 1106 T1 = normalize( V - N * dot( V, N ) ); 1107 T2 = - cross( N, T1 ); 1108 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1109 vec3 coords[ 4 ]; 1110 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1111 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1112 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1113 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1114 coords[ 0 ] = normalize( coords[ 0 ] ); 1115 coords[ 1 ] = normalize( coords[ 1 ] ); 1116 coords[ 2 ] = normalize( coords[ 2 ] ); 1117 coords[ 3 ] = normalize( coords[ 3 ] ); 1118 vec3 vectorFormFactor = vec3( 0.0 ); 1119 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1120 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1121 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1122 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1123 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1124 return vec3( result ); 1125} 1126#if defined( USE_SHEEN ) 1127float D_Charlie( float roughness, float dotNH ) { 1128 float alpha = pow2( roughness ); 1129 float invAlpha = 1.0 / alpha; 1130 float cos2h = dotNH * dotNH; 1131 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1132 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1133} 1134float V_Neubelt( float dotNV, float dotNL ) { 1135 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1136} 1137vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1138 vec3 halfDir = normalize( lightDir + viewDir ); 1139 float dotNL = saturate( dot( normal, lightDir ) ); 1140 float dotNV = saturate( dot( normal, viewDir ) ); 1141 float dotNH = saturate( dot( normal, halfDir ) ); 1142 float D = D_Charlie( sheenRoughness, dotNH ); 1143 float V = V_Neubelt( dotNV, dotNL ); 1144 return sheenColor * ( D * V ); 1145} 1146#endif 1147float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1148 float dotNV = saturate( dot( normal, viewDir ) ); 1149 float r2 = roughness * roughness; 1150 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1151 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1152 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1153 return saturate( DG * RECIPROCAL_PI ); 1154} 1155vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1156 float dotNV = saturate( dot( normal, viewDir ) ); 1157 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1158 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1159 vec4 r = roughness * c0 + c1; 1160 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1161 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1162 return fab; 1163} 1164vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1165 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1166 return specularColor * fab.x + specularF90 * fab.y; 1167} 1168#ifdef USE_IRIDESCENCE 1169void 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 ) { 1170#else 1171void 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 ) { 1172#endif 1173 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1174 #ifdef USE_IRIDESCENCE 1175 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1176 #else 1177 vec3 Fr = specularColor; 1178 #endif 1179 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1180 float Ess = fab.x + fab.y; 1181 float Ems = 1.0 - Ess; 1182 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1183 singleScatter += FssEss; 1184 multiScatter += Fms * Ems; 1185} 1186#if NUM_RECT_AREA_LIGHTS > 0 1187 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 ) { 1188 vec3 normal = geometryNormal; 1189 vec3 viewDir = geometryViewDir; 1190 vec3 position = geometryPosition; 1191 vec3 lightPos = rectAreaLight.position; 1192 vec3 halfWidth = rectAreaLight.halfWidth; 1193 vec3 halfHeight = rectAreaLight.halfHeight; 1194 vec3 lightColor = rectAreaLight.color; 1195 float roughness = material.roughness; 1196 vec3 rectCoords[ 4 ]; 1197 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1198 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1199 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1200 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1201 vec4 t1 = texture2D( ltc_1, uv ); 1202 vec4 t2 = texture2D( ltc_2, uv ); 1203 mat3 mInv = mat3( 1204 vec3( t1.x, 0, t1.y ), 1205 vec3( 0, 1, 0 ), 1206 vec3( t1.z, 0, t1.w ) 1207 ); 1208 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1209 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1210 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1211 } 1212#endif 1213void 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 ) { 1214 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1215 vec3 irradiance = dotNL * directLight.color; 1216 #ifdef USE_CLEARCOAT 1217 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1218 vec3 ccIrradiance = dotNLcc * directLight.color; 1219 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1220 #endif 1221 #ifdef USE_SHEEN 1222 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1223 #endif 1224 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1225 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1226} 1227void 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 ) { 1228 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1229} 1230void 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) { 1231 #ifdef USE_CLEARCOAT 1232 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1233 #endif 1234 #ifdef USE_SHEEN 1235 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1236 #endif 1237 vec3 singleScattering = vec3( 0.0 ); 1238 vec3 multiScattering = vec3( 0.0 ); 1239 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1240 #ifdef USE_IRIDESCENCE 1241 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1242 #else 1243 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1244 #endif 1245 vec3 totalScattering = singleScattering + multiScattering; 1246 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1247 reflectedLight.indirectSpecular += radiance * singleScattering; 1248 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1249 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1250} 1251#define RE_Direct RE_Direct_Physical 1252#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1253#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1254#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1255float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1256 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1257}`,
1257fu=` 1258vec3 geometryPosition = - vViewPosition; 1259vec3 geometryNormal = normal; 1260vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1261vec3 geometryClearcoatNormal = vec3( 0.0 ); 1262#ifdef USE_CLEARCOAT 1263 geometryClearcoatNormal = clearcoatNormal; 1264#endif 1265#ifdef USE_IRIDESCENCE 1266 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1267 if ( material.iridescenceThickness == 0.0 ) { 1268 material.iridescence = 0.0; 1269 } else { 1270 material.iridescence = saturate( material.iridescence ); 1271 } 1272 if ( material.iridescence > 0.0 ) { 1273 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1274 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1275 } 1276#endif 1277IncidentLight directLight; 1278#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1279 PointLight pointLight; 1280 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1281 PointLightShadow pointLightShadow; 1282 #endif 1283 #pragma unroll_loop_start 1284 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1285 pointLight = pointLights[ i ]; 1286 getPointLightInfo( pointLight, geometryPosition, directLight ); 1287 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1288 pointLightShadow = pointLightShadows[ i ]; 1289 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1290 #endif 1291 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1292 } 1293 #pragma unroll_loop_end 1294#endif 1295#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1296 SpotLight spotLight; 1297 vec4 spotColor; 1298 vec3 spotLightCoord; 1299 bool inSpotLightMap; 1300 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1301 SpotLightShadow spotLightShadow; 1302 #endif 1303 #pragma unroll_loop_start 1304 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1305 spotLight = spotLights[ i ]; 1306 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1307 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1308 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1309 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1310 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1311 #else 1312 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1313 #endif 1314 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1315 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1316 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1317 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1318 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1319 #endif 1320 #undef SPOT_LIGHT_MAP_INDEX 1321 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1322 spotLightShadow = spotLightShadows[ i ]; 1323 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1324 #endif 1325 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1326 } 1327 #pragma unroll_loop_end 1328#endif 1329#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1330 DirectionalLight directionalLight; 1331 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1332 DirectionalLightShadow directionalLightShadow; 1333 #endif 1334 #pragma unroll_loop_start 1335 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1336 directionalLight = directionalLights[ i ]; 1337 getDirectionalLightInfo( directionalLight, directLight ); 1338 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1339 directionalLightShadow = directionalLightShadows[ i ]; 1340 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1341 #endif 1342 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1343 } 1344 #pragma unroll_loop_end 1345#endif 1346#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1347 RectAreaLight rectAreaLight; 1348 #pragma unroll_loop_start 1349 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1350 rectAreaLight = rectAreaLights[ i ]; 1351 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1352 } 1353 #pragma unroll_loop_end 1354#endif 1355#if defined( RE_IndirectDiffuse ) 1356 vec3 iblIrradiance = vec3( 0.0 ); 1357 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1358 #if defined( USE_LIGHT_PROBES ) 1359 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1360 #endif 1361 #if ( NUM_HEMI_LIGHTS > 0 ) 1362 #pragma unroll_loop_start 1363 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1364 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1365 } 1366 #pragma unroll_loop_end 1367 #endif 1368#endif 1369#if defined( RE_IndirectSpecular ) 1370 vec3 radiance = vec3( 0.0 ); 1371 vec3 clearcoatRadiance = vec3( 0.0 ); 1372#endif`,du=`#if defined( RE_IndirectDiffuse ) 1373 #ifdef USE_LIGHTMAP 1374 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1375 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1376 irradiance += lightMapIrradiance; 1377 #endif 1378 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1379 iblIrradiance += getIBLIrradiance( geometryNormal ); 1380 #endif 1381#endif 1382#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1383 #ifdef USE_ANISOTROPY 1384 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1385 #else 1386 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1387 #endif 1388 #ifdef USE_CLEARCOAT 1389 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1390 #endif 1391#endif`,pu=`#if defined( RE_IndirectDiffuse ) 1392 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1393#endif 1394#if defined( RE_IndirectSpecular ) 1395 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1396#endif`,mu=`#if defined( USE_LOGDEPTHBUF ) 1397 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1398#endif`,gu=`#if defined( USE_LOGDEPTHBUF ) 1399 uniform float logDepthBufFC; 1400 varying float vFragDepth; 1401 varying float vIsPerspective; 1402#endif`,_u=`#ifdef USE_LOGDEPTHBUF 1403 varying float vFragDepth; 1404 varying float vIsPerspective; 1405#endif`,vu=`#ifdef USE_LOGDEPTHBUF 1406 vFragDepth = 1.0 + gl_Position.w; 1407 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1408#endif`,xu=`#ifdef USE_MAP 1409 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1410 #ifdef DECODE_VIDEO_TEXTURE 1411 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1412 1413 #endif 1414 diffuseColor *= sampledDiffuseColor; 1415#endif`,Mu=`#ifdef USE_MAP 1416 uniform sampler2D map; 1417#endif`,Su=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1418 #if defined( USE_POINTS_UV ) 1419 vec2 uv = vUv; 1420 #else 1421 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1422 #endif 1423#endif 1424#ifdef USE_MAP 1425 diffuseColor *= texture2D( map, uv ); 1426#endif 1427#ifdef USE_ALPHAMAP 1428 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1429#endif`,Eu=`#if defined( USE_POINTS_UV ) 1430 varying vec2 vUv; 1431#else 1432 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1433 uniform mat3 uvTransform; 1434 #endif 1435#endif 1436#ifdef USE_MAP 1437 uniform sampler2D map; 1438#endif 1439#ifdef USE_ALPHAMAP 1440 uniform sampler2D alphaMap; 1441#endif`,yu=`float metalnessFactor = metalness; 1442#ifdef USE_METALNESSMAP 1443 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1444 metalnessFactor *= texelMetalness.b; 1445#endif`,Tu=`#ifdef USE_METALNESSMAP 1446 uniform sampler2D metalnessMap; 1447#endif`,Au=`#ifdef USE_INSTANCING_MORPH 1448 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1449 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1450 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1451 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1452 } 1453#endif`,bu=`#if defined( USE_MORPHCOLORS ) 1454 vColor *= morphTargetBaseInfluence; 1455 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1456 #if defined( USE_COLOR_ALPHA ) 1457 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1458 #elif defined( USE_COLOR ) 1459 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1460 #endif 1461 } 1462#endif`,wu=`#ifdef USE_MORPHNORMALS 1463 objectNormal *= morphTargetBaseInfluence; 1464 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1465 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1466 } 1467#endif`,Ru=`#ifdef USE_MORPHTARGETS 1468 #ifndef USE_INSTANCING_MORPH 1469 uniform float morphTargetBaseInfluence; 1470 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1471 #endif 1472 uniform sampler2DArray morphTargetsTexture; 1473 uniform ivec2 morphTargetsTextureSize; 1474 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1475 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1476 int y = texelIndex / morphTargetsTextureSize.x; 1477 int x = texelIndex - y * morphTargetsTextureSize.x; 1478 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1479 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1480 } 1481#endif`,Cu=`#ifdef USE_MORPHTARGETS 1482 transformed *= morphTargetBaseInfluence; 1483 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1484 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1485 } 1486#endif`,Pu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1487#ifdef FLAT_SHADED 1488 vec3 fdx = dFdx( vViewPosition ); 1489 vec3 fdy = dFdy( vViewPosition ); 1490 vec3 normal = normalize( cross( fdx, fdy ) ); 1491#else 1492 vec3 normal = normalize( vNormal ); 1493 #ifdef DOUBLE_SIDED 1494 normal *= faceDirection; 1495 #endif 1496#endif 1497#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1498 #ifdef USE_TANGENT 1499 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1500 #else 1501 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1502 #if defined( USE_NORMALMAP ) 1503 vNormalMapUv 1504 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1505 vClearcoatNormalMapUv 1506 #else 1507 vUv 1508 #endif 1509 ); 1510 #endif 1511 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1512 tbn[0] *= faceDirection; 1513 tbn[1] *= faceDirection; 1514 #endif 1515#endif 1516#ifdef USE_CLEARCOAT_NORMALMAP 1517 #ifdef USE_TANGENT 1518 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1519 #else 1520 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1521 #endif 1522 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1523 tbn2[0] *= faceDirection; 1524 tbn2[1] *= faceDirection; 1525 #endif 1526#endif 1527vec3 nonPerturbedNormal = normal;`,Lu=`#ifdef USE_NORMALMAP_OBJECTSPACE 1528 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1529 #ifdef FLIP_SIDED 1530 normal = - normal; 1531 #endif 1532 #ifdef DOUBLE_SIDED 1533 normal = normal * faceDirection; 1534 #endif 1535 normal = normalize( normalMatrix * normal ); 1536#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1537 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1538 mapN.xy *= normalScale; 1539 normal = normalize( tbn * mapN ); 1540#elif defined( USE_BUMPMAP )
1541 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1542#endif`,Du=`#ifndef FLAT_SHADED 1543 varying vec3 vNormal; 1544 #ifdef USE_TANGENT 1545 varying vec3 vTangent; 1546 varying vec3 vBitangent; 1547 #endif 1548#endif`,Uu=`#ifndef FLAT_SHADED 1549 varying vec3 vNormal; 1550 #ifdef USE_TANGENT 1551 varying vec3 vTangent; 1552 varying vec3 vBitangent; 1553 #endif 1554#endif`,Iu=`#ifndef FLAT_SHADED 1555 vNormal = normalize( transformedNormal ); 1556 #ifdef USE_TANGENT 1557 vTangent = normalize( transformedTangent ); 1558 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1559 #endif 1560#endif`,Nu=`#ifdef USE_NORMALMAP 1561 uniform sampler2D normalMap; 1562 uniform vec2 normalScale; 1563#endif 1564#ifdef USE_NORMALMAP_OBJECTSPACE 1565 uniform mat3 normalMatrix; 1566#endif 1567#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1568 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1569 vec3 q0 = dFdx( eye_pos.xyz ); 1570 vec3 q1 = dFdy( eye_pos.xyz ); 1571 vec2 st0 = dFdx( uv.st ); 1572 vec2 st1 = dFdy( uv.st ); 1573 vec3 N = surf_norm; 1574 vec3 q1perp = cross( q1, N ); 1575 vec3 q0perp = cross( N, q0 ); 1576 vec3 T = q1perp * st0.x + q0perp * st1.x; 1577 vec3 B = q1perp * st0.y + q0perp * st1.y; 1578 float det = max( dot( T, T ), dot( B, B ) ); 1579 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1580 return mat3( T * scale, B * scale, N ); 1581 } 1582#endif`,Fu=`#ifdef USE_CLEARCOAT 1583 vec3 clearcoatNormal = nonPerturbedNormal; 1584#endif`,Ou=`#ifdef USE_CLEARCOAT_NORMALMAP 1585 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1586 clearcoatMapN.xy *= clearcoatNormalScale; 1587 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1588#endif`,Bu=`#ifdef USE_CLEARCOATMAP 1589 uniform sampler2D clearcoatMap; 1590#endif 1591#ifdef USE_CLEARCOAT_NORMALMAP 1592 uniform sampler2D clearcoatNormalMap; 1593 uniform vec2 clearcoatNormalScale; 1594#endif 1595#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1596 uniform sampler2D clearcoatRoughnessMap; 1597#endif`,zu=`#ifdef USE_IRIDESCENCEMAP 1598 uniform sampler2D iridescenceMap; 1599#endif 1600#ifdef USE_IRIDESCENCE_THICKNESSMAP 1601 uniform sampler2D iridescenceThicknessMap; 1602#endif`,Hu=`#ifdef OPAQUE 1603diffuseColor.a = 1.0; 1604#endif 1605#ifdef USE_TRANSMISSION 1606diffuseColor.a *= material.transmissionAlpha; 1607#endif 1608gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Gu=`vec3 packNormalToRGB( const in vec3 normal ) { 1609 return normalize( normal ) * 0.5 + 0.5; 1610} 1611vec3 unpackRGBToNormal( const in vec3 rgb ) { 1612 return 2.0 * rgb.xyz - 1.0; 1613} 1614const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1615const float Inv255 = 1. / 255.; 1616const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1617const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1618const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1619const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1620vec4 packDepthToRGBA( const in float v ) { 1621 if( v <= 0.0 ) 1622 return vec4( 0., 0., 0., 0. ); 1623 if( v >= 1.0 ) 1624 return vec4( 1., 1., 1., 1. ); 1625 float vuf; 1626 float af = modf( v * PackFactors.a, vuf ); 1627 float bf = modf( vuf * ShiftRight8, vuf ); 1628 float gf = modf( vuf * ShiftRight8, vuf ); 1629 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1630} 1631vec3 packDepthToRGB( const in float v ) { 1632 if( v <= 0.0 ) 1633 return vec3( 0., 0., 0. ); 1634 if( v >= 1.0 ) 1635 return vec3( 1., 1., 1. ); 1636 float vuf; 1637 float bf = modf( v * PackFactors.b, vuf ); 1638 float gf = modf( vuf * ShiftRight8, vuf ); 1639 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1640} 1641vec2 packDepthToRG( const in float v ) { 1642 if( v <= 0.0 ) 1643 return vec2( 0., 0. ); 1644 if( v >= 1.0 ) 1645 return vec2( 1., 1. ); 1646 float vuf; 1647 float gf = modf( v * 256., vuf ); 1648 return vec2( vuf * Inv255, gf ); 1649} 1650float unpackRGBAToDepth( const in vec4 v ) { 1651 return dot( v, UnpackFactors4 ); 1652} 1653float unpackRGBToDepth( const in vec3 v ) { 1654 return dot( v, UnpackFactors3 ); 1655} 1656float unpackRGToDepth( const in vec2 v ) { 1657 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1658} 1659vec4 pack2HalfToRGBA( const in vec2 v ) {
1660 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1661 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1662} 1663vec2 unpackRGBATo2Half( const in vec4 v ) { 1664 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1665} 1666float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1667 return ( viewZ + near ) / ( near - far ); 1668} 1669float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1670 return depth * ( near - far ) - near; 1671} 1672float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1673 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1674} 1675float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1676 return ( near * far ) / ( ( far - near ) * depth - far ); 1677}`,Vu=`#ifdef PREMULTIPLIED_ALPHA 1678 gl_FragColor.rgb *= gl_FragColor.a; 1679#endif`,ku=`vec4 mvPosition = vec4( transformed, 1.0 ); 1680#ifdef USE_BATCHING 1681 mvPosition = batchingMatrix * mvPosition; 1682#endif 1683#ifdef USE_INSTANCING 1684 mvPosition = instanceMatrix * mvPosition; 1685#endif 1686mvPosition = modelViewMatrix * mvPosition; 1687gl_Position = projectionMatrix * mvPosition;`,Wu=`#ifdef DITHERING 1688 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1689#endif`,Xu=`#ifdef DITHERING 1690 vec3 dithering( vec3 color ) { 1691 float grid_position = rand( gl_FragCoord.xy ); 1692 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1693 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1694 return color + dither_shift_RGB; 1695 } 1696#endif`,qu=`float roughnessFactor = roughness; 1697#ifdef USE_ROUGHNESSMAP 1698 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1699 roughnessFactor *= texelRoughness.g; 1700#endif`,Yu=`#ifdef USE_ROUGHNESSMAP 1701 uniform sampler2D roughnessMap; 1702#endif`,Ku=
vendor: 8,887 bytes, lines 1702-1888
1702`#if NUM_SPOT_LIGHT_COORDS > 0 1703 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1704#endif 1705#if NUM_SPOT_LIGHT_MAPS > 0 1706 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1707#endif 1708#ifdef USE_SHADOWMAP 1709 #if NUM_DIR_LIGHT_SHADOWS > 0 1710 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1711 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1712 struct DirectionalLightShadow { 1713 float shadowIntensity; 1714 float shadowBias; 1715 float shadowNormalBias; 1716 float shadowRadius; 1717 vec2 shadowMapSize; 1718 }; 1719 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1720 #endif 1721 #if NUM_SPOT_LIGHT_SHADOWS > 0 1722 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 struct SpotLightShadow { 1724 float shadowIntensity; 1725 float shadowBias; 1726 float shadowNormalBias; 1727 float shadowRadius; 1728 vec2 shadowMapSize; 1729 }; 1730 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1731 #endif 1732 #if NUM_POINT_LIGHT_SHADOWS > 0 1733 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1734 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1735 struct PointLightShadow { 1736 float shadowIntensity; 1737 float shadowBias; 1738 float shadowNormalBias; 1739 float shadowRadius; 1740 vec2 shadowMapSize; 1741 float shadowCameraNear; 1742 float shadowCameraFar; 1743 }; 1744 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1745 #endif 1746 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1747 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1748 } 1749 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1750 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1751 } 1752 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1753 float occlusion = 1.0; 1754 vec2 distribution = texture2DDistribution( shadow, uv ); 1755 float hard_shadow = step( compare , distribution.x ); 1756 if (hard_shadow != 1.0 ) { 1757 float distance = compare - distribution.x ; 1758 float variance = max( 0.00000, distribution.y * distribution.y ); 1759 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1760 } 1761 return occlusion; 1762 } 1763 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1764 float shadow = 1.0; 1765 shadowCoord.xyz /= shadowCoord.w; 1766 shadowCoord.z += shadowBias; 1767 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1768 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1769 if ( frustumTest ) { 1770 #if defined( SHADOWMAP_TYPE_PCF ) 1771 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1772 float dx0 = - texelSize.x * shadowRadius; 1773 float dy0 = - texelSize.y * shadowRadius; 1774 float dx1 = + texelSize.x * shadowRadius; 1775 float dy1 = + texelSize.y * shadowRadius; 1776 float dx2 = dx0 / 2.0; 1777 float dy2 = dy0 / 2.0; 1778 float dx3 = dx1 / 2.0; 1779 float dy3 = dy1 / 2.0; 1780 shadow = ( 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1791 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1792 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1793 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1794 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1795 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1796 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1798 ) * ( 1.0 / 17.0 ); 1799 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1800 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1801 float dx = texelSize.x; 1802 float dy = texelSize.y; 1803 vec2 uv = shadowCoord.xy; 1804 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1805 uv -= f * texelSize; 1806 shadow = ( 1807 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1808 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1809 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1810 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1811 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1812 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1813 f.x ) + 1814 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1815 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1816 f.x ) + 1817 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1818 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1819 f.y ) + 1820 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1821 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1822 f.y ) + 1823 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1824 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1825 f.x ), 1826 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1827 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1828 f.x ), 1829 f.y ) 1830 ) * ( 1.0 / 9.0 ); 1831 #elif defined( SHADOWMAP_TYPE_VSM ) 1832 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1833 #else 1834 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1835 #endif 1836 } 1837 return mix( 1.0, shadow, shadowIntensity ); 1838 } 1839 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1840 vec3 absV = abs( v ); 1841 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1842 absV *= scaleToCube; 1843 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1844 vec2 planar = v.xy; 1845 float almostATexel = 1.5 * texelSizeY; 1846 float almostOne = 1.0 - almostATexel; 1847 if ( absV.z >= almostOne ) { 1848 if ( v.z > 0.0 ) 1849 planar.x = 4.0 - v.x; 1850 } else if ( absV.x >= almostOne ) { 1851 float signX = sign( v.x ); 1852 planar.x = v.z * signX + 2.0 * signX; 1853 } else if ( absV.y >= almostOne ) { 1854 float signY = sign( v.y ); 1855 planar.x = v.x + 2.0 * signY + 2.0; 1856 planar.y = v.z * signY - 2.0; 1857 } 1858 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1859 } 1860 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1861 float shadow = 1.0; 1862 vec3 lightToPosition = shadowCoord.xyz; 1863 1864 float lightToPositionLength = length( lightToPosition ); 1865 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1866 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1867 vec3 bd3D = normalize( lightToPosition ); 1868 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1869 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1870 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1871 shadow = ( 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1874 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1875 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1876 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1877 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1878 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1879 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1880 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1881 ) * ( 1.0 / 9.0 ); 1882 #else 1883 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1884 #endif 1885 } 1886 return mix( 1.0, shadow, shadowIntensity ); 1887 } 1888#endif`,
1888$u=`#if NUM_SPOT_LIGHT_COORDS > 0 1889 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1890 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1891#endif 1892#ifdef USE_SHADOWMAP 1893 #if NUM_DIR_LIGHT_SHADOWS > 0 1894 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1895 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1896 struct DirectionalLightShadow { 1897 float shadowIntensity; 1898 float shadowBias; 1899 float shadowNormalBias; 1900 float shadowRadius; 1901 vec2 shadowMapSize; 1902 }; 1903 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1904 #endif 1905 #if NUM_SPOT_LIGHT_SHADOWS > 0 1906 struct SpotLightShadow { 1907 float shadowIntensity; 1908 float shadowBias; 1909 float shadowNormalBias; 1910 float shadowRadius; 1911 vec2 shadowMapSize; 1912 }; 1913 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1914 #endif 1915 #if NUM_POINT_LIGHT_SHADOWS > 0 1916 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1917 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1918 struct PointLightShadow { 1919 float shadowIntensity; 1920 float shadowBias; 1921 float shadowNormalBias; 1922 float shadowRadius; 1923 vec2 shadowMapSize; 1924 float shadowCameraNear; 1925 float shadowCameraFar; 1926 }; 1927 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1928 #endif 1929#endif`,Zu=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1930 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1931 vec4 shadowWorldPosition; 1932#endif 1933#if defined( USE_SHADOWMAP ) 1934 #if NUM_DIR_LIGHT_SHADOWS > 0 1935 #pragma unroll_loop_start 1936 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1937 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1938 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1939 } 1940 #pragma unroll_loop_end 1941 #endif 1942 #if NUM_POINT_LIGHT_SHADOWS > 0 1943 #pragma unroll_loop_start 1944 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1945 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1946 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1947 } 1948 #pragma unroll_loop_end 1949 #endif 1950#endif 1951#if NUM_SPOT_LIGHT_COORDS > 0 1952 #pragma unroll_loop_start 1953 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1954 shadowWorldPosition = worldPosition; 1955 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1956 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1957 #endif 1958 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1959 } 1960 #pragma unroll_loop_end 1961#endif`,ju=`float getShadowMask() { 1962 float shadow = 1.0; 1963 #ifdef USE_SHADOWMAP 1964 #if NUM_DIR_LIGHT_SHADOWS > 0 1965 DirectionalLightShadow directionalLight; 1966 #pragma unroll_loop_start 1967 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1968 directionalLight = directionalLightShadows[ i ]; 1969 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1970 } 1971 #pragma unroll_loop_end 1972 #endif 1973 #if NUM_SPOT_LIGHT_SHADOWS > 0 1974 SpotLightShadow spotLight; 1975 #pragma unroll_loop_start 1976 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1977 spotLight = spotLightShadows[ i ]; 1978 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1979 } 1980 #pragma unroll_loop_end 1981 #endif 1982 #if NUM_POINT_LIGHT_SHADOWS > 0 1983 PointLightShadow pointLight; 1984 #pragma unroll_loop_start 1985 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1986 pointLight = pointLightShadows[ i ]; 1987 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1988 } 1989 #pragma unroll_loop_end 1990 #endif 1991 #endif 1992 return shadow; 1993}`,Ju=`#ifdef USE_SKINNING 1994 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1995 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1996 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1997 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1998#endif`,Qu=`#ifdef USE_SKINNING 1999 uniform mat4 bindMatrix; 2000 uniform mat4 bindMatrixInverse; 2001 uniform highp sampler2D boneTexture; 2002 mat4 getBoneMatrix( const in float i ) { 2003 int size = textureSize( boneTexture, 0 ).x; 2004 int j = int( i ) * 4; 2005 int x = j % size; 2006 int y = j / size; 2007 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2008 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2009 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2010 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2011 return mat4( v1, v2, v3, v4 ); 2012 } 2013#endif`,eh=`#ifdef USE_SKINNING 2014 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2015 vec4 skinned = vec4( 0.0 ); 2016 skinned += boneMatX * skinVertex * skinWeight.x; 2017 skinned += boneMatY * skinVertex * skinWeight.y; 2018 skinned += boneMatZ * skinVertex * skinWeight.z; 2019 skinned += boneMatW * skinVertex * skinWeight.w; 2020 transformed = ( bindMatrixInverse * skinned ).xyz; 2021#endif`,th=`#ifdef USE_SKINNING 2022 mat4 skinMatrix = mat4( 0.0 ); 2023 skinMatrix += skinWeight.x * boneMatX; 2024 skinMatrix += skinWeight.y * boneMatY; 2025 skinMatrix += skinWeight.z * boneMatZ; 2026 skinMatrix += skinWeight.w * boneMatW; 2027 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2028 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2029 #ifdef USE_TANGENT 2030 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2031 #endif 2032#endif`,nh=`float specularStrength; 2033#ifdef USE_SPECULARMAP 2034 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2035 specularStrength = texelSpecular.r; 2036#else 2037 specularStrength = 1.0; 2038#endif`,ih=`#ifdef USE_SPECULARMAP 2039 uniform sampler2D specularMap; 2040#endif`,rh=`#if defined( TONE_MAPPING ) 2041 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2042#endif`,sh=`#ifndef saturate 2043#define saturate( a ) clamp( a, 0.0, 1.0 ) 2044#endif 2045uniform float toneMappingExposure; 2046vec3 LinearToneMapping( vec3 color ) { 2047 return saturate( toneMappingExposure * color ); 2048} 2049vec3 ReinhardToneMapping( vec3 color ) { 2050 color *= toneMappingExposure; 2051 return saturate( color / ( vec3( 1.0 ) + color ) ); 2052} 2053vec3 CineonToneMapping( vec3 color ) { 2054 color *= toneMappingExposure; 2055 color = max( vec3( 0.0 ), color - 0.004 ); 2056 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2057} 2058vec3 RRTAndODTFit( vec3 v ) { 2059 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2060 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2061 return a / b; 2062} 2063vec3 ACESFilmicToneMapping( vec3 color ) { 2064 const mat3 ACESInputMat = mat3( 2065 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2066 vec3( 0.04823, 0.01566, 0.83777 ) 2067 ); 2068 const mat3 ACESOutputMat = mat3( 2069 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2070 vec3( -0.07367, -0.00605, 1.07602 ) 2071 ); 2072 color *= toneMappingExposure / 0.6; 2073 color = ACESInputMat * color; 2074 color = RRTAndODTFit( color ); 2075 color = ACESOutputMat * color; 2076 return saturate( color ); 2077} 2078const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2079 vec3( 1.6605, - 0.1246, - 0.0182 ), 2080 vec3( - 0.5876, 1.1329, - 0.1006 ), 2081 vec3( - 0.0728, - 0.0083, 1.1187 ) 2082); 2083const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2084 vec3( 0.6274, 0.0691, 0.0164 ), 2085 vec3( 0.3293, 0.9195, 0.0880 ), 2086 vec3( 0.0433, 0.0113, 0.8956 ) 2087); 2088vec3 agxDefaultContrastApprox( vec3 x ) { 2089 vec3 x2 = x * x; 2090 vec3 x4 = x2 * x2; 2091 return + 15.5 * x4 * x2 2092 - 40.14 * x4 * x 2093 + 31.96 * x4 2094 - 6.868 * x2 * x 2095 + 0.4298 * x2 2096 + 0.1191 * x 2097 - 0.00232; 2098} 2099vec3 AgXToneMapping( vec3 color ) { 2100 const mat3 AgXInsetMatrix = mat3( 2101 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2102 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2103 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2104 );
2105 const mat3 AgXOutsetMatrix = mat3( 2106 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2107 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2108 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2109 ); 2110 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2111 color *= toneMappingExposure; 2112 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2113 color = AgXInsetMatrix * color; 2114 color = max( color, 1e-10 ); color = log2( color ); 2115 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2116 color = clamp( color, 0.0, 1.0 ); 2117 color = agxDefaultContrastApprox( color ); 2118 color = AgXOutsetMatrix * color; 2119 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2120 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2121 color = clamp( color, 0.0, 1.0 ); 2122 return color; 2123} 2124vec3 NeutralToneMapping( vec3 color ) { 2125 const float StartCompression = 0.8 - 0.04; 2126 const float Desaturation = 0.15; 2127 color *= toneMappingExposure; 2128 float x = min( color.r, min( color.g, color.b ) ); 2129 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2130 color -= offset; 2131 float peak = max( color.r, max( color.g, color.b ) ); 2132 if ( peak < StartCompression ) return color; 2133 float d = 1. - StartCompression; 2134 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2135 color *= newPeak / peak; 2136 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2137 return mix( color, vec3( newPeak ), g ); 2138} 2139vec3 CustomToneMapping( vec3 color ) { return color; }`,ah=`#ifdef USE_TRANSMISSION 2140 material.transmission = transmission; 2141 material.transmissionAlpha = 1.0; 2142 material.thickness = thickness; 2143 material.attenuationDistance = attenuationDistance; 2144 material.attenuationColor = attenuationColor; 2145 #ifdef USE_TRANSMISSIONMAP 2146 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2147 #endif 2148 #ifdef USE_THICKNESSMAP 2149 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2150 #endif 2151 vec3 pos = vWorldPosition; 2152 vec3 v = normalize( cameraPosition - pos ); 2153 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2154 vec4 transmitted = getIBLVolumeRefraction( 2155 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2156 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2157 material.attenuationColor, material.attenuationDistance ); 2158 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2159 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2160#endif`,oh=`#ifdef USE_TRANSMISSION 2161 uniform float transmission; 2162 uniform float thickness; 2163 uniform float attenuationDistance; 2164 uniform vec3 attenuationColor; 2165 #ifdef USE_TRANSMISSIONMAP 2166 uniform sampler2D transmissionMap; 2167 #endif 2168 #ifdef USE_THICKNESSMAP 2169 uniform sampler2D thicknessMap; 2170 #endif 2171 uniform vec2 transmissionSamplerSize; 2172 uniform sampler2D transmissionSamplerMap; 2173 uniform mat4 modelMatrix; 2174 uniform mat4 projectionMatrix; 2175 varying vec3 vWorldPosition; 2176 float w0( float a ) { 2177 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2178 } 2179 float w1( float a ) { 2180 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2181 } 2182 float w2( float a ){ 2183 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2184 } 2185 float w3( float a ) { 2186 return ( 1.0 / 6.0 ) * ( a * a * a ); 2187 } 2188 float g0( float a ) { 2189 return w0( a ) + w1( a ); 2190 } 2191 float g1( float a ) { 2192 return w2( a ) + w3( a ); 2193 } 2194 float h0( float a ) { 2195 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2196 } 2197 float h1( float a ) { 2198 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2199 } 2200 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2201 uv = uv * texelSize.zw + 0.5; 2202 vec2 iuv = floor( uv ); 2203 vec2 fuv = fract( uv ); 2204 float g0x = g0( fuv.x ); 2205 float g1x = g1( fuv.x ); 2206 float h0x = h0( fuv.x ); 2207 float h1x = h1( fuv.x ); 2208 float h0y = h0( fuv.y ); 2209 float h1y = h1( fuv.y ); 2210 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2211 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2212 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2213 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2214 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2215 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2216 } 2217 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2218 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2219 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2220 vec2 fLodSizeInv = 1.0 / fLodSize; 2221 vec2 cLodSizeInv = 1.0 / cLodSize; 2222 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2223 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2224 return mix( fSample, cSample, fract( lod ) ); 2225 } 2226 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2227 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2228 vec3 modelScale; 2229 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2230 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2231 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2232 return normalize( refractionVector ) * thickness * modelScale; 2233 } 2234 float applyIorToRoughness( const in float roughness, const in float ior ) { 2235 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2236 } 2237 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2238 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2239 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2240 } 2241 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2242 if ( isinf( attenuationDistance ) ) { 2243 return vec3( 1.0 ); 2244 } else { 2245 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2246 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2247 } 2248 } 2249 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2250 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2251 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2252 const in vec3 attenuationColor, const in float attenuationDistance ) { 2253 vec4 transmittedLight; 2254 vec3 transmittance; 2255 #ifdef USE_DISPERSION 2256 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2257 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2258 for ( int i = 0; i < 3; i ++ ) { 2259 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2260 vec3 refractedRayExit = position + transmissionRay; 2261 2262 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2263 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2264 refractionCoords += 1.0; 2265 refractionCoords /= 2.0; 2266 2267 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2268 transmittedLight[ i ] = transmissionSample[ i ]; 2269 transmittedLight.a += transmissionSample.a; 2270 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2271 } 2272 transmittedLight.a /= 3.0; 2273 2274 #else 2275 2276 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2277 vec3 refractedRayExit = position + transmissionRay; 2278 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2279 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2280 refractionCoords += 1.0; 2281 refractionCoords /= 2.0; 2282 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2283 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2284 2285 #endif 2286 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2287 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2288 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2289 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2290 } 2291#endif`,lh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2292 varying vec2 vUv; 2293#endif 2294#ifdef USE_MAP 2295 varying vec2 vMapUv; 2296#endif 2297#ifdef USE_ALPHAMAP
2298 varying vec2 vAlphaMapUv; 2299#endif 2300#ifdef USE_LIGHTMAP 2301 varying vec2 vLightMapUv; 2302#endif 2303#ifdef USE_AOMAP 2304 varying vec2 vAoMapUv; 2305#endif 2306#ifdef USE_BUMPMAP 2307 varying vec2 vBumpMapUv; 2308#endif 2309#ifdef USE_NORMALMAP 2310 varying vec2 vNormalMapUv; 2311#endif 2312#ifdef USE_EMISSIVEMAP 2313 varying vec2 vEmissiveMapUv; 2314#endif 2315#ifdef USE_METALNESSMAP 2316 varying vec2 vMetalnessMapUv; 2317#endif 2318#ifdef USE_ROUGHNESSMAP 2319 varying vec2 vRoughnessMapUv; 2320#endif 2321#ifdef USE_ANISOTROPYMAP 2322 varying vec2 vAnisotropyMapUv; 2323#endif 2324#ifdef USE_CLEARCOATMAP 2325 varying vec2 vClearcoatMapUv; 2326#endif 2327#ifdef USE_CLEARCOAT_NORMALMAP 2328 varying vec2 vClearcoatNormalMapUv; 2329#endif 2330#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2331 varying vec2 vClearcoatRoughnessMapUv; 2332#endif 2333#ifdef USE_IRIDESCENCEMAP 2334 varying vec2 vIridescenceMapUv; 2335#endif 2336#ifdef USE_IRIDESCENCE_THICKNESSMAP 2337 varying vec2 vIridescenceThicknessMapUv; 2338#endif 2339#ifdef USE_SHEEN_COLORMAP 2340 varying vec2 vSheenColorMapUv; 2341#endif 2342#ifdef USE_SHEEN_ROUGHNESSMAP 2343 varying vec2 vSheenRoughnessMapUv; 2344#endif 2345#ifdef USE_SPECULARMAP 2346 varying vec2 vSpecularMapUv; 2347#endif 2348#ifdef USE_SPECULAR_COLORMAP 2349 varying vec2 vSpecularColorMapUv; 2350#endif 2351#ifdef USE_SPECULAR_INTENSITYMAP 2352 varying vec2 vSpecularIntensityMapUv; 2353#endif 2354#ifdef USE_TRANSMISSIONMAP 2355 uniform mat3 transmissionMapTransform; 2356 varying vec2 vTransmissionMapUv; 2357#endif 2358#ifdef USE_THICKNESSMAP 2359 uniform mat3 thicknessMapTransform; 2360 varying vec2 vThicknessMapUv; 2361#endif`,ch=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2362 varying vec2 vUv; 2363#endif 2364#ifdef USE_MAP 2365 uniform mat3 mapTransform; 2366 varying vec2 vMapUv; 2367#endif 2368#ifdef USE_ALPHAMAP 2369 uniform mat3 alphaMapTransform; 2370 varying vec2 vAlphaMapUv; 2371#endif 2372#ifdef USE_LIGHTMAP 2373 uniform mat3 lightMapTransform; 2374 varying vec2 vLightMapUv; 2375#endif 2376#ifdef USE_AOMAP 2377 uniform mat3 aoMapTransform; 2378 varying vec2 vAoMapUv; 2379#endif 2380#ifdef USE_BUMPMAP 2381 uniform mat3 bumpMapTransform; 2382 varying vec2 vBumpMapUv; 2383#endif 2384#ifdef USE_NORMALMAP 2385 uniform mat3 normalMapTransform; 2386 varying vec2 vNormalMapUv; 2387#endif 2388#ifdef USE_DISPLACEMENTMAP 2389 uniform mat3 displacementMapTransform; 2390 varying vec2 vDisplacementMapUv; 2391#endif 2392#ifdef USE_EMISSIVEMAP 2393 uniform mat3 emissiveMapTransform; 2394 varying vec2 vEmissiveMapUv; 2395#endif 2396#ifdef USE_METALNESSMAP 2397 uniform mat3 metalnessMapTransform; 2398 varying vec2 vMetalnessMapUv; 2399#endif 2400#ifdef USE_ROUGHNESSMAP 2401 uniform mat3 roughnessMapTransform; 2402 varying vec2 vRoughnessMapUv; 2403#endif 2404#ifdef USE_ANISOTROPYMAP 2405 uniform mat3 anisotropyMapTransform; 2406 varying vec2 vAnisotropyMapUv; 2407#endif 2408#ifdef USE_CLEARCOATMAP 2409 uniform mat3 clearcoatMapTransform; 2410 varying vec2 vClearcoatMapUv; 2411#endif 2412#ifdef USE_CLEARCOAT_NORMALMAP 2413 uniform mat3 clearcoatNormalMapTransform; 2414 varying vec2 vClearcoatNormalMapUv; 2415#endif 2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2417 uniform mat3 clearcoatRoughnessMapTransform; 2418 varying vec2 vClearcoatRoughnessMapUv; 2419#endif 2420#ifdef USE_SHEEN_COLORMAP 2421 uniform mat3 sheenColorMapTransform; 2422 varying vec2 vSheenColorMapUv; 2423#endif 2424#ifdef USE_SHEEN_ROUGHNESSMAP 2425 uniform mat3 sheenRoughnessMapTransform; 2426 varying vec2 vSheenRoughnessMapUv; 2427#endif 2428#ifdef USE_IRIDESCENCEMAP 2429 uniform mat3 iridescenceMapTransform; 2430 varying vec2 vIridescenceMapUv; 2431#endif 2432#ifdef USE_IRIDESCENCE_THICKNESSMAP 2433 uniform mat3 iridescenceThicknessMapTransform; 2434 varying vec2 vIridescenceThicknessMapUv; 2435#endif 2436#ifdef USE_SPECULARMAP 2437 uniform mat3 specularMapTransform; 2438 varying vec2 vSpecularMapUv; 2439#endif 2440#ifdef USE_SPECULAR_COLORMAP 2441 uniform mat3 specularColorMapTransform; 2442 varying vec2 vSpecularColorMapUv; 2443#endif 2444#ifdef USE_SPECULAR_INTENSITYMAP 2445 uniform mat3 specularIntensityMapTransform; 2446 varying vec2 vSpecularIntensityMapUv; 2447#endif 2448#ifdef USE_TRANSMISSIONMAP 2449 uniform mat3 transmissionMapTransform; 2450 varying vec2 vTransmissionMapUv; 2451#endif 2452#ifdef USE_THICKNESSMAP 2453 uniform mat3 thicknessMapTransform; 2454 varying vec2 vThicknessMapUv; 2455#endif`,uh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2456 vUv = vec3( uv, 1 ).xy; 2457#endif 2458#ifdef USE_MAP 2459 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2460#endif 2461#ifdef USE_ALPHAMAP 2462 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2463#endif 2464#ifdef USE_LIGHTMAP 2465 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2466#endif 2467#ifdef USE_AOMAP 2468 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2469#endif 2470#ifdef USE_BUMPMAP 2471 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2472#endif 2473#ifdef USE_NORMALMAP 2474 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2475#endif 2476#ifdef USE_DISPLACEMENTMAP 2477 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2478#endif 2479#ifdef USE_EMISSIVEMAP 2480 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2481#endif 2482#ifdef USE_METALNESSMAP 2483 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2484#endif 2485#ifdef USE_ROUGHNESSMAP 2486 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2487#endif 2488#ifdef USE_ANISOTROPYMAP 2489 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_CLEARCOATMAP 2492 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_CLEARCOAT_NORMALMAP 2495 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2498 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2499#endif
2500#ifdef USE_IRIDESCENCEMAP 2501 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_IRIDESCENCE_THICKNESSMAP 2504 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_SHEEN_COLORMAP 2507 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_SHEEN_ROUGHNESSMAP 2510 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_SPECULARMAP 2513 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2514#endif 2515#ifdef USE_SPECULAR_COLORMAP 2516 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2517#endif 2518#ifdef USE_SPECULAR_INTENSITYMAP 2519 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2520#endif 2521#ifdef USE_TRANSMISSIONMAP 2522 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2523#endif 2524#ifdef USE_THICKNESSMAP 2525 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2526#endif`,hh=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2527 vec4 worldPosition = vec4( transformed, 1.0 ); 2528 #ifdef USE_BATCHING 2529 worldPosition = batchingMatrix * worldPosition; 2530 #endif 2531 #ifdef USE_INSTANCING 2532 worldPosition = instanceMatrix * worldPosition; 2533 #endif 2534 worldPosition = modelMatrix * worldPosition; 2535#endif`;const fh=`varying vec2 vUv; 2536uniform mat3 uvTransform; 2537void main() { 2538 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2539 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2540}`,dh=`uniform sampler2D t2D; 2541uniform float backgroundIntensity; 2542varying vec2 vUv; 2543void main() { 2544 vec4 texColor = texture2D( t2D, vUv ); 2545 #ifdef DECODE_VIDEO_TEXTURE 2546 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 ); 2547 #endif 2548 texColor.rgb *= backgroundIntensity; 2549 gl_FragColor = texColor; 2550 #include <tonemapping_fragment> 2551 #include <colorspace_fragment> 2552}`,ph=`varying vec3 vWorldDirection; 2553#include <common> 2554void main() { 2555 vWorldDirection = transformDirection( position, modelMatrix ); 2556 #include <begin_vertex> 2557 #include <project_vertex> 2558 gl_Position.z = gl_Position.w; 2559}`,mh=`#ifdef ENVMAP_TYPE_CUBE 2560 uniform samplerCube envMap; 2561#elif defined( ENVMAP_TYPE_CUBE_UV ) 2562 uniform sampler2D envMap; 2563#endif 2564uniform float flipEnvMap; 2565uniform float backgroundBlurriness; 2566uniform float backgroundIntensity; 2567uniform mat3 backgroundRotation; 2568varying vec3 vWorldDirection; 2569#include <cube_uv_reflection_fragment> 2570void main() { 2571 #ifdef ENVMAP_TYPE_CUBE 2572 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2573 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2574 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2575 #else 2576 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2577 #endif 2578 texColor.rgb *= backgroundIntensity; 2579 gl_FragColor = texColor; 2580 #include <tonemapping_fragment> 2581 #include <colorspace_fragment> 2582}`,gh=`varying vec3 vWorldDirection; 2583#include <common> 2584void main() { 2585 vWorldDirection = transformDirection( position, modelMatrix ); 2586 #include <begin_vertex> 2587 #include <project_vertex> 2588 gl_Position.z = gl_Position.w; 2589}`,_h=`uniform samplerCube tCube; 2590uniform float tFlip; 2591uniform float opacity; 2592varying vec3 vWorldDirection; 2593void main() { 2594 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2595 gl_FragColor = texColor; 2596 gl_FragColor.a *= opacity; 2597 #include <tonemapping_fragment> 2598 #include <colorspace_fragment> 2599}`,vh=`#include <common> 2600#include <batching_pars_vertex> 2601#include <uv_pars_vertex> 2602#include <displacementmap_pars_vertex> 2603#include <morphtarget_pars_vertex> 2604#include <skinning_pars_vertex> 2605#include <logdepthbuf_pars_vertex> 2606#include <clipping_planes_pars_vertex> 2607varying vec2 vHighPrecisionZW; 2608void main() { 2609 #include <uv_vertex> 2610 #include <batching_vertex> 2611 #include <skinbase_vertex> 2612 #include <morphinstance_vertex> 2613 #ifdef USE_DISPLACEMENTMAP 2614 #include <beginnormal_vertex> 2615 #include <morphnormal_vertex> 2616 #include <skinnormal_vertex> 2617 #endif 2618 #include <begin_vertex> 2619 #include <morphtarget_vertex> 2620 #include <skinning_vertex> 2621 #include <displacementmap_vertex> 2622 #include <project_vertex> 2623 #include <logdepthbuf_vertex> 2624 #include <clipping_planes_vertex> 2625 vHighPrecisionZW = gl_Position.zw; 2626}`,xh=`#if DEPTH_PACKING == 3200 2627 uniform float opacity; 2628#endif 2629#include <common> 2630#include <packing> 2631#include <uv_pars_fragment> 2632#include <map_pars_fragment> 2633#include <alphamap_pars_fragment> 2634#include <alphatest_pars_fragment> 2635#include <alphahash_pars_fragment> 2636#include <logdepthbuf_pars_fragment> 2637#include <clipping_planes_pars_fragment> 2638varying vec2 vHighPrecisionZW; 2639void main() { 2640 vec4 diffuseColor = vec4( 1.0 ); 2641 #include <clipping_planes_fragment> 2642 #if DEPTH_PACKING == 3200 2643 diffuseColor.a = opacity; 2644 #endif 2645 #include <map_fragment> 2646 #include <alphamap_fragment> 2647 #include <alphatest_fragment> 2648 #include <alphahash_fragment> 2649 #include <logdepthbuf_fragment> 2650 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2651 #if DEPTH_PACKING == 3200 2652 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2653 #elif DEPTH_PACKING == 3201 2654 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2655 #elif DEPTH_PACKING == 3202 2656 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2657 #elif DEPTH_PACKING == 3203 2658 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2659 #endif 2660}`,Mh=`#define DISTANCE 2661varying vec3 vWorldPosition; 2662#include <common> 2663#include <batching_pars_vertex> 2664#include <uv_pars_vertex> 2665#include <displacementmap_pars_vertex> 2666#include <morphtarget_pars_vertex> 2667#include <skinning_pars_vertex> 2668#include <clipping_planes_pars_vertex> 2669void main() { 2670 #include <uv_vertex> 2671 #include <batching_vertex> 2672 #include <skinbase_vertex> 2673 #include <morphinstance_vertex> 2674 #ifdef USE_DISPLACEMENTMAP 2675 #include <beginnormal_vertex> 2676 #include <morphnormal_vertex> 2677 #include <skinnormal_vertex> 2678 #endif 2679 #include <begin_vertex> 2680 #include <morphtarget_vertex> 2681 #include <skinning_vertex> 2682 #include <displacementmap_vertex> 2683 #include <project_vertex> 2684 #include <worldpos_vertex> 2685 #include <clipping_planes_vertex> 2686 vWorldPosition = worldPosition.xyz; 2687}`,Sh=`#define DISTANCE 2688uniform vec3 referencePosition; 2689uniform float nearDistance; 2690uniform float farDistance; 2691varying vec3 vWorldPosition; 2692#include <common> 2693#include <packing> 2694#include <uv_pars_fragment> 2695#include <map_pars_fragment> 2696#include <alphamap_pars_fragment> 2697#include <alphatest_pars_fragment> 2698#include <alphahash_pars_fragment> 2699#include <clipping_planes_pars_fragment> 2700void main () { 2701 vec4 diffuseColor = vec4( 1.0 ); 2702 #include <clipping_planes_fragment> 2703 #include <map_fragment> 2704 #include <alphamap_fragment> 2705 #include <alphatest_fragment> 2706 #include <alphahash_fragment> 2707 float dist = length( vWorldPosition - referencePosition ); 2708 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2709 dist = saturate( dist ); 2710 gl_FragColor = packDepthToRGBA( dist ); 2711}`,Eh=`varying vec3 vWorldDirection; 2712#include <common> 2713void main() { 2714 vWorldDirection = transformDirection( position, modelMatrix ); 2715 #include <begin_vertex> 2716 #include <project_vertex> 2717}
2717`,yh=`uniform sampler2D tEquirect; 2718varying vec3 vWorldDirection; 2719#include <common> 2720void main() { 2721 vec3 direction = normalize( vWorldDirection ); 2722 vec2 sampleUV = equirectUv( direction ); 2723 gl_FragColor = texture2D( tEquirect, sampleUV ); 2724 #include <tonemapping_fragment> 2725 #include <colorspace_fragment> 2726}`,Th=`uniform float scale; 2727attribute float lineDistance; 2728varying float vLineDistance; 2729#include <common> 2730#include <uv_pars_vertex> 2731#include <color_pars_vertex> 2732#include <fog_pars_vertex> 2733#include <morphtarget_pars_vertex> 2734#include <logdepthbuf_pars_vertex> 2735#include <clipping_planes_pars_vertex> 2736void main() { 2737 vLineDistance = scale * lineDistance; 2738 #include <uv_vertex> 2739 #include <color_vertex> 2740 #include <morphinstance_vertex> 2741 #include <morphcolor_vertex> 2742 #include <begin_vertex> 2743 #include <morphtarget_vertex> 2744 #include <project_vertex> 2745 #include <logdepthbuf_vertex> 2746 #include <clipping_planes_vertex> 2747 #include <fog_vertex> 2748}`,Ah=`uniform vec3 diffuse; 2749uniform float opacity; 2750uniform float dashSize; 2751uniform float totalSize; 2752varying float vLineDistance; 2753#include <common> 2754#include <color_pars_fragment> 2755#include <uv_pars_fragment> 2756#include <map_pars_fragment> 2757#include <fog_pars_fragment> 2758#include <logdepthbuf_pars_fragment> 2759#include <clipping_planes_pars_fragment> 2760void main() { 2761 vec4 diffuseColor = vec4( diffuse, opacity ); 2762 #include <clipping_planes_fragment> 2763 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2764 discard; 2765 } 2766 vec3 outgoingLight = vec3( 0.0 ); 2767 #include <logdepthbuf_fragment> 2768 #include <map_fragment> 2769 #include <color_fragment> 2770 outgoingLight = diffuseColor.rgb; 2771 #include <opaque_fragment> 2772 #include <tonemapping_fragment> 2773 #include <colorspace_fragment> 2774 #include <fog_fragment> 2775 #include <premultiplied_alpha_fragment> 2776}`,bh=`#include <common> 2777#include <batching_pars_vertex> 2778#include <uv_pars_vertex> 2779#include <envmap_pars_vertex> 2780#include <color_pars_vertex> 2781#include <fog_pars_vertex> 2782#include <morphtarget_pars_vertex> 2783#include <skinning_pars_vertex> 2784#include <logdepthbuf_pars_vertex> 2785#include <clipping_planes_pars_vertex> 2786void main() { 2787 #include <uv_vertex> 2788 #include <color_vertex> 2789 #include <morphinstance_vertex> 2790 #include <morphcolor_vertex> 2791 #include <batching_vertex> 2792 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2793 #include <beginnormal_vertex> 2794 #include <morphnormal_vertex> 2795 #include <skinbase_vertex> 2796 #include <skinnormal_vertex> 2797 #include <defaultnormal_vertex> 2798 #endif 2799 #include <begin_vertex> 2800 #include <morphtarget_vertex> 2801 #include <skinning_vertex> 2802 #include <project_vertex> 2803 #include <logdepthbuf_vertex> 2804 #include <clipping_planes_vertex> 2805 #include <worldpos_vertex> 2806 #include <envmap_vertex> 2807 #include <fog_vertex> 2808}`,wh=`uniform vec3 diffuse; 2809uniform float opacity; 2810#ifndef FLAT_SHADED 2811 varying vec3 vNormal; 2812#endif 2813#include <common> 2814#include <dithering_pars_fragment> 2815#include <color_pars_fragment> 2816#include <uv_pars_fragment> 2817#include <map_pars_fragment> 2818#include <alphamap_pars_fragment> 2819#include <alphatest_pars_fragment> 2820#include <alphahash_pars_fragment> 2821#include <aomap_pars_fragment> 2822#include <lightmap_pars_fragment> 2823#include <envmap_common_pars_fragment> 2824#include <envmap_pars_fragment> 2825#include <fog_pars_fragment> 2826#include <specularmap_pars_fragment> 2827#include <logdepthbuf_pars_fragment> 2828#include <clipping_planes_pars_fragment> 2829void main() { 2830 vec4 diffuseColor = vec4( diffuse, opacity ); 2831 #include <clipping_planes_fragment> 2832 #include <logdepthbuf_fragment> 2833 #include <map_fragment> 2834 #include <color_fragment> 2835 #include <alphamap_fragment> 2836 #include <alphatest_fragment> 2837 #include <alphahash_fragment> 2838 #include <specularmap_fragment> 2839 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2840 #ifdef USE_LIGHTMAP 2841 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2842 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2843 #else 2844 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2845 #endif 2846 #include <aomap_fragment> 2847 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2848 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2849 #include <envmap_fragment> 2850 #include <opaque_fragment> 2851 #include <tonemapping_fragment> 2852 #include <colorspace_fragment> 2853 #include <fog_fragment> 2854 #include <premultiplied_alpha_fragment> 2855 #include <dithering_fragment> 2856}`,Rh=`#define LAMBERT 2857varying vec3 vViewPosition; 2858#include <common> 2859#include <batching_pars_vertex> 2860#include <uv_pars_vertex> 2861#include <displacementmap_pars_vertex> 2862#include <envmap_pars_vertex> 2863#include <color_pars_vertex> 2864#include <fog_pars_vertex> 2865#include <normal_pars_vertex> 2866#include <morphtarget_pars_vertex> 2867#include <skinning_pars_vertex> 2868#include <shadowmap_pars_vertex> 2869#include <logdepthbuf_pars_vertex> 2870#include <clipping_planes_pars_vertex> 2871void main() { 2872 #include <uv_vertex> 2873 #include <color_vertex> 2874 #include <morphinstance_vertex> 2875 #include <morphcolor_vertex> 2876 #include <batching_vertex> 2877 #include <beginnormal_vertex> 2878 #include <morphnormal_vertex> 2879 #include <skinbase_vertex> 2880 #include <skinnormal_vertex> 2881 #include <defaultnormal_vertex> 2882 #include <normal_vertex> 2883 #include <begin_vertex> 2884 #include <morphtarget_vertex> 2885 #include <skinning_vertex> 2886 #include <displacementmap_vertex> 2887 #include <project_vertex> 2888 #include <logdepthbuf_vertex> 2889 #include <clipping_planes_vertex> 2890 vViewPosition = - mvPosition.xyz; 2891 #include <worldpos_vertex> 2892 #include <envmap_vertex> 2893 #include <shadowmap_vertex> 2894 #include <fog_vertex> 2895}`,Ch=`#define LAMBERT 2896uniform vec3 diffuse; 2897uniform vec3 emissive; 2898uniform float opacity; 2899#include <common> 2900#include <packing> 2901#include <dithering_pars_fragment> 2902#include <color_pars_fragment> 2903#include <uv_pars_fragment> 2904#include <map_pars_fragment> 2905#include <alphamap_pars_fragment> 2906#include <alphatest_pars_fragment> 2907#include <alphahash_pars_fragment> 2908#include <aomap_pars_fragment> 2909#include <lightmap_pars_fragment> 2910#include <emissivemap_pars_fragment> 2911#include <envmap_common_pars_fragment> 2912#include <envmap_pars_fragment> 2913#include <fog_pars_fragment> 2914#include <bsdfs> 2915#include <lights_pars_begin> 2916#include <normal_pars_fragment> 2917#include <lights_lambert_pars_fragment> 2918#include <shadowmap_pars_fragment> 2919#include <bumpmap_pars_fragment> 2920#include <normalmap_pars_fragment> 2921#include <specularmap_pars_fragment> 2922#include <logdepthbuf_pars_fragment> 2923#include <clipping_planes_pars_fragment> 2924void main() { 2925 vec4 diffuseColor = vec4( diffuse, opacity ); 2926 #include <clipping_planes_fragment> 2927 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2928 vec3 totalEmissiveRadiance = emissive; 2929 #include <logdepthbuf_fragment> 2930 #include <map_fragment> 2931 #include <color_fragment> 2932 #include <alphamap_fragment> 2933 #include <alphatest_fragment> 2934 #include <alphahash_fragment> 2935 #include <specularmap_fragment> 2936 #include <normal_fragment_begin> 2937 #include <normal_fragment_maps> 2938 #include <emissivemap_fragment> 2939 #include <lights_lambert_fragment> 2940 #include <lights_fragment_begin> 2941 #include <lights_fragment_maps> 2942 #include <lights_fragment_end> 2943 #include <aomap_fragment> 2944 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2945 #include <envmap_fragment> 2946 #include <opaque_fragment> 2947 #include <tonemapping_fragment> 2948 #include <colorspace_fragment> 2949 #include <fog_fragment> 2950 #include <premultiplied_alpha_fragment> 2951 #include <dithering_fragment> 2952}`,Ph=`#define MATCAP 2953varying vec3 vViewPosition; 2954#include <common> 2955#include <batching_pars_vertex> 2956#include <uv_pars_vertex> 2957#include <color_pars_vertex> 2958#include <displacementmap_pars_vertex> 2959#include <fog_pars_vertex> 2960#include <normal_pars_vertex> 2961#include <morphtarget_pars_vertex> 2962#include <skinning_pars_vertex> 2963#include <logdepthbuf_pars_vertex> 2964#include <clipping_planes_pars_vertex> 2965void main() { 2966 #include <uv_vertex> 2967 #include <color_vertex> 2968 #include <morphinstance_vertex> 2969 #include <morphcolor_vertex> 2970 #include <batching_vertex> 2971 #include <beginnormal_vertex> 2972 #include <morphnormal_vertex> 2973 #include <skinbase_vertex> 2974 #include <skinnormal_vertex> 2975 #include <defaultnormal_vertex> 2976 #include <normal_vertex> 2977 #include <begin_vertex> 2978 #include <morphtarget_vertex> 2979 #include <skinning_vertex> 2980 #include <displacementmap_vertex> 2981 #include <project_vertex> 2982 #include <logdepthbuf_vertex> 2983 #include <clipping_planes_vertex> 2984 #include <fog_vertex> 2985 vViewPosition = - mvPosition.xyz; 2986}`,Lh=`#define MATCAP 2987uniform vec3 diffuse; 2988uniform float opacity; 2989uniform sampler2D matcap; 2990varying vec3 vViewPosition; 2991#include <common> 2992#include <dithering_pars_fragment> 2993#include <color_pars_fragment> 2994#include <uv_pars_fragment> 2995#include <map_pars_fragment> 2996#include <alphamap_pars_fragment> 2997#include <alphatest_pars_fragment> 2998#include <alphahash_pars_fragment> 2999#include <fog_pars_fragment> 3000#include <normal_pars_fragment> 3001#include <bumpmap_pars_fragment> 3002#include <normalmap_pars_fragment> 3003#include <logdepthbuf_pars_fragment> 3004#include <clipping_planes_pars_fragment> 3005void main() { 3006 vec4 diffuseColor = vec4( diffuse, opacity ); 3007 #include <clipping_planes_fragment> 3008 #include <logdepthbuf_fragment> 3009 #include <map_fragment> 3010 #include <color_fragment> 3011 #include <alphamap_fragment> 3012 #include <alphatest_fragment> 3013 #include <alphahash_fragment> 3014 #include <normal_fragment_begin> 3015 #include <normal_fragment_maps> 3016 vec3 viewDir = normalize( vViewPosition ); 3017 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3018 vec3 y = cross( viewDir, x ); 3019 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3020 #ifdef USE_MATCAP
3021 vec4 matcapColor = texture2D( matcap, uv ); 3022 #else 3023 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3024 #endif 3025 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3026 #include <opaque_fragment> 3027 #include <tonemapping_fragment> 3028 #include <colorspace_fragment> 3029 #include <fog_fragment> 3030 #include <premultiplied_alpha_fragment> 3031 #include <dithering_fragment> 3032}`,Dh=`#define NORMAL 3033#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3034 varying vec3 vViewPosition; 3035#endif 3036#include <common> 3037#include <batching_pars_vertex> 3038#include <uv_pars_vertex> 3039#include <displacementmap_pars_vertex> 3040#include <normal_pars_vertex> 3041#include <morphtarget_pars_vertex> 3042#include <skinning_pars_vertex> 3043#include <logdepthbuf_pars_vertex> 3044#include <clipping_planes_pars_vertex> 3045void main() { 3046 #include <uv_vertex> 3047 #include <batching_vertex> 3048 #include <beginnormal_vertex> 3049 #include <morphinstance_vertex> 3050 #include <morphnormal_vertex> 3051 #include <skinbase_vertex> 3052 #include <skinnormal_vertex> 3053 #include <defaultnormal_vertex> 3054 #include <normal_vertex> 3055 #include <begin_vertex> 3056 #include <morphtarget_vertex> 3057 #include <skinning_vertex> 3058 #include <displacementmap_vertex> 3059 #include <project_vertex> 3060 #include <logdepthbuf_vertex> 3061 #include <clipping_planes_vertex> 3062#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3063 vViewPosition = - mvPosition.xyz; 3064#endif 3065}`,Uh=`#define NORMAL 3066uniform float opacity; 3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3068 varying vec3 vViewPosition; 3069#endif 3070#include <packing> 3071#include <uv_pars_fragment> 3072#include <normal_pars_fragment> 3073#include <bumpmap_pars_fragment> 3074#include <normalmap_pars_fragment> 3075#include <logdepthbuf_pars_fragment> 3076#include <clipping_planes_pars_fragment> 3077void main() { 3078 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3079 #include <clipping_planes_fragment> 3080 #include <logdepthbuf_fragment> 3081 #include <normal_fragment_begin> 3082 #include <normal_fragment_maps> 3083 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3084 #ifdef OPAQUE 3085 gl_FragColor.a = 1.0; 3086 #endif 3087}`,Ih=`#define PHONG 3088varying vec3 vViewPosition; 3089#include <common> 3090#include <batching_pars_vertex> 3091#include <uv_pars_vertex> 3092#include <displacementmap_pars_vertex> 3093#include <envmap_pars_vertex> 3094#include <color_pars_vertex> 3095#include <fog_pars_vertex> 3096#include <normal_pars_vertex> 3097#include <morphtarget_pars_vertex> 3098#include <skinning_pars_vertex> 3099#include <shadowmap_pars_vertex> 3100#include <logdepthbuf_pars_vertex> 3101#include <clipping_planes_pars_vertex> 3102void main() { 3103 #include <uv_vertex> 3104 #include <color_vertex> 3105 #include <morphcolor_vertex> 3106 #include <batching_vertex> 3107 #include <beginnormal_vertex> 3108 #include <morphinstance_vertex> 3109 #include <morphnormal_vertex> 3110 #include <skinbase_vertex> 3111 #include <skinnormal_vertex> 3112 #include <defaultnormal_vertex> 3113 #include <normal_vertex> 3114 #include <begin_vertex> 3115 #include <morphtarget_vertex> 3116 #include <skinning_vertex> 3117 #include <displacementmap_vertex> 3118 #include <project_vertex> 3119 #include <logdepthbuf_vertex> 3120 #include <clipping_planes_vertex> 3121 vViewPosition = - mvPosition.xyz; 3122 #include <worldpos_vertex> 3123 #include <envmap_vertex> 3124 #include <shadowmap_vertex> 3125 #include <fog_vertex> 3126}`,Nh=`#define PHONG 3127uniform vec3 diffuse; 3128uniform vec3 emissive; 3129uniform vec3 specular; 3130uniform float shininess; 3131uniform float opacity; 3132#include <common> 3133#include <packing> 3134#include <dithering_pars_fragment> 3135#include <color_pars_fragment> 3136#include <uv_pars_fragment> 3137#include <map_pars_fragment> 3138#include <alphamap_pars_fragment> 3139#include <alphatest_pars_fragment> 3140#include <alphahash_pars_fragment> 3141#include <aomap_pars_fragment> 3142#include <lightmap_pars_fragment> 3143#include <emissivemap_pars_fragment> 3144#include <envmap_common_pars_fragment> 3145#include <envmap_pars_fragment> 3146#include <fog_pars_fragment> 3147#include <bsdfs> 3148#include <lights_pars_begin> 3149#include <normal_pars_fragment> 3150#include <lights_phong_pars_fragment> 3151#include <shadowmap_pars_fragment> 3152#include <bumpmap_pars_fragment> 3153#include <normalmap_pars_fragment> 3154#include <specularmap_pars_fragment> 3155#include <logdepthbuf_pars_fragment> 3156#include <clipping_planes_pars_fragment> 3157void main() { 3158 vec4 diffuseColor = vec4( diffuse, opacity ); 3159 #include <clipping_planes_fragment> 3160 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3161 vec3 totalEmissiveRadiance = emissive; 3162 #include <logdepthbuf_fragment> 3163 #include <map_fragment> 3164 #include <color_fragment> 3165 #include <alphamap_fragment> 3166 #include <alphatest_fragment> 3167 #include <alphahash_fragment> 3168 #include <specularmap_fragment> 3169 #include <normal_fragment_begin> 3170 #include <normal_fragment_maps> 3171 #include <emissivemap_fragment> 3172 #include <lights_phong_fragment> 3173 #include <lights_fragment_begin> 3174 #include <lights_fragment_maps> 3175 #include <lights_fragment_end> 3176 #include <aomap_fragment> 3177 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3178 #include <envmap_fragment> 3179 #include <opaque_fragment> 3180 #include <tonemapping_fragment> 3181 #include <colorspace_fragment> 3182 #include <fog_fragment> 3183 #include <premultiplied_alpha_fragment> 3184 #include <dithering_fragment> 3185}`,Fh=`#define STANDARD 3186varying vec3 vViewPosition; 3187#ifdef USE_TRANSMISSION 3188 varying vec3 vWorldPosition; 3189#endif 3190#include <common> 3191#include <batching_pars_vertex> 3192#include <uv_pars_vertex> 3193#include <displacementmap_pars_vertex> 3194#include <color_pars_vertex> 3195#include <fog_pars_vertex> 3196#include <normal_pars_vertex> 3197#include <morphtarget_pars_vertex> 3198#include <skinning_pars_vertex> 3199#include <shadowmap_pars_vertex> 3200#include <logdepthbuf_pars_vertex> 3201#include <clipping_planes_pars_vertex> 3202void main() { 3203 #include <uv_vertex> 3204 #include <color_vertex> 3205 #include <morphinstance_vertex> 3206 #include <morphcolor_vertex> 3207 #include <batching_vertex> 3208 #include <beginnormal_vertex> 3209 #include <morphnormal_vertex> 3210 #include <skinbase_vertex> 3211 #include <skinnormal_vertex> 3212 #include <defaultnormal_vertex> 3213 #include <normal_vertex> 3214 #include <begin_vertex> 3215 #include <morphtarget_vertex> 3216 #include <skinning_vertex> 3217 #include <displacementmap_vertex> 3218 #include <project_vertex> 3219 #include <logdepthbuf_vertex> 3220 #include <clipping_planes_vertex> 3221 vViewPosition = - mvPosition.xyz; 3222 #include <worldpos_vertex> 3223 #include <shadowmap_vertex> 3224 #include <fog_vertex> 3225#ifdef USE_TRANSMISSION 3226 vWorldPosition = worldPosition.xyz; 3227#endif 3228}`,Oh=`#define STANDARD 3229#ifdef PHYSICAL 3230 #define IOR 3231 #define USE_SPECULAR 3232#endif 3233uniform vec3 diffuse; 3234uniform vec3 emissive; 3235uniform float roughness; 3236uniform float metalness; 3237uniform float opacity; 3238#ifdef IOR 3239 uniform float ior; 3240#endif 3241#ifdef USE_SPECULAR 3242 uniform float specularIntensity; 3243 uniform vec3 specularColor; 3244 #ifdef USE_SPECULAR_COLORMAP 3245 uniform sampler2D specularColorMap; 3246 #endif 3247 #ifdef USE_SPECULAR_INTENSITYMAP 3248 uniform sampler2D specularIntensityMap; 3249 #endif 3250#endif 3251#ifdef USE_CLEARCOAT 3252 uniform float clearcoat; 3253 uniform float clearcoatRoughness; 3254#endif 3255#ifdef USE_DISPERSION 3256 uniform float dispersion; 3257#endif
3258#ifdef USE_IRIDESCENCE 3259 uniform float iridescence; 3260 uniform float iridescenceIOR; 3261 uniform float iridescenceThicknessMinimum; 3262 uniform float iridescenceThicknessMaximum; 3263#endif 3264#ifdef USE_SHEEN 3265 uniform vec3 sheenColor; 3266 uniform float sheenRoughness; 3267 #ifdef USE_SHEEN_COLORMAP 3268 uniform sampler2D sheenColorMap; 3269 #endif 3270 #ifdef USE_SHEEN_ROUGHNESSMAP 3271 uniform sampler2D sheenRoughnessMap; 3272 #endif 3273#endif 3274#ifdef USE_ANISOTROPY 3275 uniform vec2 anisotropyVector; 3276 #ifdef USE_ANISOTROPYMAP 3277 uniform sampler2D anisotropyMap; 3278 #endif 3279#endif 3280varying vec3 vViewPosition; 3281#include <common> 3282#include <packing> 3283#include <dithering_pars_fragment> 3284#include <color_pars_fragment> 3285#include <uv_pars_fragment> 3286#include <map_pars_fragment> 3287#include <alphamap_pars_fragment> 3288#include <alphatest_pars_fragment> 3289#include <alphahash_pars_fragment> 3290#include <aomap_pars_fragment> 3291#include <lightmap_pars_fragment> 3292#include <emissivemap_pars_fragment> 3293#include <iridescence_fragment> 3294#include <cube_uv_reflection_fragment> 3295#include <envmap_common_pars_fragment> 3296#include <envmap_physical_pars_fragment> 3297#include <fog_pars_fragment> 3298#include <lights_pars_begin> 3299#include <normal_pars_fragment> 3300#include <lights_physical_pars_fragment> 3301#include <transmission_pars_fragment> 3302#include <shadowmap_pars_fragment> 3303#include <bumpmap_pars_fragment> 3304#include <normalmap_pars_fragment> 3305#include <clearcoat_pars_fragment> 3306#include <iridescence_pars_fragment> 3307#include <roughnessmap_pars_fragment> 3308#include <metalnessmap_pars_fragment> 3309#include <logdepthbuf_pars_fragment> 3310#include <clipping_planes_pars_fragment> 3311void main() { 3312 vec4 diffuseColor = vec4( diffuse, opacity ); 3313 #include <clipping_planes_fragment> 3314 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3315 vec3 totalEmissiveRadiance = emissive; 3316 #include <logdepthbuf_fragment> 3317 #include <map_fragment> 3318 #include <color_fragment> 3319 #include <alphamap_fragment> 3320 #include <alphatest_fragment> 3321 #include <alphahash_fragment> 3322 #include <roughnessmap_fragment> 3323 #include <metalnessmap_fragment> 3324 #include <normal_fragment_begin> 3325 #include <normal_fragment_maps> 3326 #include <clearcoat_normal_fragment_begin> 3327 #include <clearcoat_normal_fragment_maps> 3328 #include <emissivemap_fragment> 3329 #include <lights_physical_fragment> 3330 #include <lights_fragment_begin> 3331 #include <lights_fragment_maps> 3332 #include <lights_fragment_end> 3333 #include <aomap_fragment> 3334 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3335 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3336 #include <transmission_fragment> 3337 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3338 #ifdef USE_SHEEN 3339 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3340 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3341 #endif 3342 #ifdef USE_CLEARCOAT 3343 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3344 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3345 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3346 #endif 3347 #include <opaque_fragment> 3348 #include <tonemapping_fragment> 3349 #include <colorspace_fragment> 3350 #include <fog_fragment> 3351 #include <premultiplied_alpha_fragment> 3352 #include <dithering_fragment> 3353}`,Bh=`#define TOON 3354varying vec3 vViewPosition; 3355#include <common> 3356#include <batching_pars_vertex> 3357#include <uv_pars_vertex> 3358#include <displacementmap_pars_vertex> 3359#include <color_pars_vertex> 3360#include <fog_pars_vertex> 3361#include <normal_pars_vertex> 3362#include <morphtarget_pars_vertex> 3363#include <skinning_pars_vertex> 3364#include <shadowmap_pars_vertex> 3365#include <logdepthbuf_pars_vertex> 3366#include <clipping_planes_pars_vertex> 3367void main() { 3368 #include <uv_vertex> 3369 #include <color_vertex> 3370 #include <morphinstance_vertex> 3371 #include <morphcolor_vertex> 3372 #include <batching_vertex> 3373 #include <beginnormal_vertex> 3374 #include <morphnormal_vertex> 3375 #include <skinbase_vertex> 3376 #include <skinnormal_vertex> 3377 #include <defaultnormal_vertex> 3378 #include <normal_vertex> 3379 #include <begin_vertex> 3380 #include <morphtarget_vertex> 3381 #include <skinning_vertex> 3382 #include <displacementmap_vertex> 3383 #include <project_vertex> 3384 #include <logdepthbuf_vertex> 3385 #include <clipping_planes_vertex> 3386 vViewPosition = - mvPosition.xyz; 3387 #include <worldpos_vertex> 3388 #include <shadowmap_vertex> 3389 #include <fog_vertex> 3390}`,zh=`#define TOON 3391uniform vec3 diffuse; 3392uniform vec3 emissive; 3393uniform float opacity; 3394#include <common> 3395#include <packing> 3396#include <dithering_pars_fragment> 3397#include <color_pars_fragment> 3398#include <uv_pars_fragment> 3399#include <map_pars_fragment> 3400#include <alphamap_pars_fragment> 3401#include <alphatest_pars_fragment> 3402#include <alphahash_pars_fragment> 3403#include <aomap_pars_fragment> 3404#include <lightmap_pars_fragment> 3405#include <emissivemap_pars_fragment> 3406#include <gradientmap_pars_fragment> 3407#include <fog_pars_fragment> 3408#include <bsdfs> 3409#include <lights_pars_begin> 3410#include <normal_pars_fragment> 3411#include <lights_toon_pars_fragment> 3412#include <shadowmap_pars_fragment> 3413#include <bumpmap_pars_fragment> 3414#include <normalmap_pars_fragment> 3415#include <logdepthbuf_pars_fragment> 3416#include <clipping_planes_pars_fragment> 3417void main() { 3418 vec4 diffuseColor = vec4( diffuse, opacity ); 3419 #include <clipping_planes_fragment> 3420 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3421 vec3 totalEmissiveRadiance = emissive; 3422 #include <logdepthbuf_fragment> 3423 #include <map_fragment> 3424 #include <color_fragment> 3425 #include <alphamap_fragment> 3426 #include <alphatest_fragment> 3427 #include <alphahash_fragment> 3428 #include <normal_fragment_begin> 3429 #include <normal_fragment_maps> 3430 #include <emissivemap_fragment> 3431 #include <lights_toon_fragment> 3432 #include <lights_fragment_begin> 3433 #include <lights_fragment_maps> 3434 #include <lights_fragment_end> 3435 #include <aomap_fragment> 3436 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3437 #include <opaque_fragment> 3438 #include <tonemapping_fragment> 3439 #include <colorspace_fragment> 3440 #include <fog_fragment> 3441 #include <premultiplied_alpha_fragment> 3442 #include <dithering_fragment> 3443}`,Hh=`uniform float size; 3444uniform float scale; 3445#include <common> 3446#include <color_pars_vertex> 3447#include <fog_pars_vertex> 3448#include <morphtarget_pars_vertex> 3449#include <logdepthbuf_pars_vertex> 3450#include <clipping_planes_pars_vertex> 3451#ifdef USE_POINTS_UV 3452 varying vec2 vUv; 3453 uniform mat3 uvTransform; 3454#endif 3455void main() { 3456 #ifdef USE_POINTS_UV 3457 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3458 #endif 3459 #include <color_vertex> 3460 #include <morphinstance_vertex> 3461 #include <morphcolor_vertex> 3462 #include <begin_vertex> 3463 #include <morphtarget_vertex> 3464 #include <project_vertex> 3465 gl_PointSize = size; 3466 #ifdef USE_SIZEATTENUATION 3467 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3468 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3469 #endif 3470 #include <logdepthbuf_vertex> 3471 #include <clipping_planes_vertex> 3472 #include <worldpos_vertex> 3473 #include <fog_vertex> 3474}`,Gh=`uniform vec3 diffuse; 3475uniform float opacity; 3476#include <common> 3477#include <color_pars_fragment> 3478#include <map_particle_pars_fragment> 3479#include <alphatest_pars_fragment> 3480#include <alphahash_pars_fragment> 3481#include <fog_pars_fragment> 3482#include <logdepthbuf_pars_fragment> 3483#include <clipping_planes_pars_fragment> 3484void main() { 3485 vec4 diffuseColor = vec4( diffuse, opacity ); 3486 #include <clipping_planes_fragment> 3487 vec3 outgoingLight = vec3( 0.0 ); 3488 #include <logdepthbuf_fragment> 3489 #include <map_particle_fragment> 3490 #include <color_fragment> 3491 #include <alphatest_fragment> 3492 #include <alphahash_fragment> 3493 outgoingLight = diffuseColor.rgb; 3494 #include <opaque_fragment> 3495 #include <tonemapping_fragment> 3496 #include <colorspace_fragment> 3497 #include <fog_fragment> 3498 #include <premultiplied_alpha_fragment> 3499}`,Vh=`#include <common> 3500#include <batching_pars_vertex> 3501#include <fog_pars_vertex> 3502#include <morphtarget_pars_vertex> 3503#include <skinning_pars_vertex> 3504#include <logdepthbuf_pars_vertex> 3505#include <shadowmap_pars_vertex> 3506void main() { 3507 #include <batching_vertex> 3508 #include <beginnormal_vertex> 3509 #include <morphinstance_vertex> 3510 #include <morphnormal_vertex> 3511 #include <skinbase_vertex> 3512 #include <skinnormal_vertex> 3513 #include <defaultnormal_vertex> 3514 #include <begin_vertex> 3515 #include <morphtarget_vertex> 3516 #include <skinning_vertex> 3517 #include <project_vertex> 3518 #include <logdepthbuf_vertex> 3519 #include <worldpos_vertex> 3520 #include <shadowmap_vertex> 3521 #include <fog_vertex> 3522}`,kh=`uniform vec3 color; 3523uniform float opacity; 3524#include <common> 3525#include <packing> 3526#include <fog_pars_fragment> 3527#include <bsdfs> 3528#include <lights_pars_begin> 3529#include <logdepthbuf_pars_fragment> 3530#include <shadowmap_pars_fragment> 3531#include <shadowmask_pars_fragment> 3532void main() { 3533 #include <logdepthbuf_fragment> 3534 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3535 #include <tonemapping_fragment> 3536 #include <colorspace_fragment> 3537 #include <fog_fragment> 3538}`,Wh=`uniform float rotation; 3539uniform vec2 center; 3540#include <common> 3541#include <uv_pars_vertex> 3542#include <fog_pars_vertex> 3543#include <logdepthbuf_pars_vertex> 3544#include <clipping_planes_pars_vertex> 3545void main() { 3546 #include <uv_vertex> 3547 vec4 mvPosition = modelViewMatrix[ 3 ]; 3548 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3549 #ifndef USE_SIZEATTENUATION 3550 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3551 if ( isPerspective ) scale *= - mvPosition.z; 3552 #endif 3553 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3554 vec2 rotatedPosition; 3555 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3556 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3557 mvPosition.xy += rotatedPosition; 3558 gl_Position = projectionMatrix * mvPosition; 3559 #include <logdepthbuf_vertex> 3560 #include <clipping_planes_vertex> 3561 #include <fog_vertex> 3562}`,Xh=`uniform vec3 diffuse; 3563uniform float opacity; 3564#include <common> 3565#include <uv_pars_fragment> 3566#include <map_pars_fragment> 3567#include <alphamap_pars_fragment> 3568#include <alphatest_pars_fragment> 3569#include <alphahash_pars_fragment> 3570#include <fog_pars_fragment> 3571#include <logdepthbuf_pars_fragment> 3572#include <clipping_planes_pars_fragment> 3573void main() { 3574 vec4 diffuseColor = vec4( diffuse, opacity ); 3575 #include <clipping_planes_fragment> 3576 vec3 outgoingLight = vec3( 0.0 ); 3577 #include <logdepthbuf_fragment> 3578 #include <map_fragment> 3579 #include <alphamap_fragment> 3580 #include <alphatest_fragment> 3581 #include <alphahash_fragment> 3582 outgoingLight = diffuseColor.rgb; 3583 #include <opaque_fragment> 3584 #include <tonemapping_fragment> 3585 #include <colorspace_fragment> 3586 #include <fog_fragment> 3587}`,Oe={alphahash_fragment:dc,alphahash_pars_fragment:pc,alphamap_fragment:mc,alphamap_pars_fragment:gc,alphatest_fragment:_c,alphatest_pars_fragment:vc,aomap_fragment:xc,aomap_pars_fragment:Mc,batching_pars_vertex:Sc,batching_vertex:Ec,begin_vertex:yc,beginnormal_vertex:Tc,bsdfs:Ac,iridescence_fragment:bc,bumpmap_pars_fragment:wc,clipping_planes_fragment:Rc,clipping_planes_pars_fragment:Cc,clipping_planes_pars_vertex:Pc,clipping_planes_vertex:Lc,color_fragment:Dc,color_pars_fragment:Uc,color_pars_vertex:Ic,color_vertex:Nc,common:Fc,cube_uv_reflection_fragment:Oc,defaultnormal_vertex:Bc,displacementmap_pars_vertex:zc,displacementmap_vertex:Hc,emissivemap_fragment:Gc,emissivemap_pars_fragment:Vc,colorspace_fragment:kc,colorspace_pars_fragment:W
vendor: 6,654 bytes, line 3587
3587c,envmap_fragment:Xc,envmap_common_pars_fragment:qc,envmap_pars_fragment:Yc,envmap_pars_vertex:Kc,envmap_physical_pars_fragment:su,envmap_vertex:$c,fog_vertex:Zc,fog_pars_vertex:jc,fog_fragment:Jc,fog_pars_fragment:Qc,gradientmap_pars_fragment:eu,lightmap_pars_fragment:tu,lights_lambert_fragment:nu,lights_lambert_pars_fragment:iu,lights_pars_begin:ru,lights_toon_fragment:au,lights_toon_pars_fragment:ou,lights_phong_fragment:lu,lights_phong_pars_fragment:cu,lights_physical_fragment:uu,lights_physical_pars_fragment:hu,lights_fragment_begin:fu,lights_fragment_maps:du,lights_fragment_end:pu,logdepthbuf_fragment:mu,logdepthbuf_pars_fragment:gu,logdepthbuf_pars_vertex:_u,logdepthbuf_vertex:vu,map_fragment:xu,map_pars_fragment:Mu,map_particle_fragment:Su,map_particle_pars_fragment:Eu,metalnessmap_fragment:yu,metalnessmap_pars_fragment:Tu,morphinstance_vertex:Au,morphcolor_vertex:bu,morphnormal_vertex:wu,morphtarget_pars_vertex:Ru,morphtarget_vertex:Cu,normal_fragment_begin:Pu,normal_fragment_maps:Lu,normal_pars_fragment:Du,normal_pars_vertex:Uu,normal_vertex:Iu,normalmap_pars_fragment:Nu,clearcoat_normal_fragment_begin:Fu,clearcoat_normal_fragment_maps:Ou,clearcoat_pars_fragment:Bu,iridescence_pars_fragment:zu,opaque_fragment:Hu,packing:Gu,premultiplied_alpha_fragment:Vu,project_vertex:ku,dithering_fragment:Wu,dithering_pars_fragment:Xu,roughnessmap_fragment:qu,roughnessmap_pars_fragment:Yu,shadowmap_pars_fragment:Ku,shadowmap_pars_vertex:$u,shadowmap_vertex:Zu,shadowmask_pars_fragment:ju,skinbase_vertex:Ju,skinning_pars_vertex:Qu,skinning_vertex:eh,skinnormal_vertex:th,specularmap_fragment:nh,specularmap_pars_fragment:ih,tonemapping_fragment:rh,tonemapping_pars_fragment:sh,transmission_fragment:ah,transmission_pars_fragment:oh,uv_pars_fragment:lh,uv_pars_vertex:ch,uv_vertex:uh,worldpos_vertex:hh,background_vert:fh,background_frag:dh,backgroundCube_vert:ph,backgroundCube_frag:mh,cube_vert:gh,cube_frag:_h,depth_vert:vh,depth_frag:xh,distanceRGBA_vert:Mh,distanceRGBA_frag:Sh,equirect_vert:Eh,equirect_frag:yh,linedashed_vert:Th,linedashed_frag:Ah,meshbasic_vert:bh,meshbasic_frag:wh,meshlambert_vert:Rh,meshlambert_frag:Ch,meshmatcap_vert:Ph,meshmatcap_frag:Lh,meshnormal_vert:Dh,meshnormal_frag:Uh,meshphong_vert:Ih,meshphong_frag:Nh,meshphysical_vert:Fh,meshphysical_frag:Oh,meshtoon_vert:Bh,meshtoon_frag:zh,points_vert:Hh,points_frag:Gh,shadow_vert:Vh,shadow_frag:kh,sprite_vert:Wh,sprite_frag:Xh},se={common:{diffuse:{value:new We(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ne},alphaMap:{value:null},alphaMapTransform:{value:new Ne},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ne}},envmap:{envMap:{value:null},envMapRotation:{value:new Ne},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ne}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ne}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ne},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ne},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ne},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ne}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ne}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ne}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new We(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new We(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ne},alphaTest:{value:0},uvTransform:{value:new Ne}},sprite:{diffuse:{value:new We(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ne},alphaMap:{value:null},alphaMapTransform:{value:new Ne},alphaTest:{value:0}}},kt={basic:{uniforms:gt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:gt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.fog,se.lights,{emissive:{value:new We(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:gt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.fog,se.lights,{emissive:{value:new We(0)},specular:{value:new We(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:gt([se.common,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.roughnessmap,se.metalnessmap,se.fog,se.lights,{emissive:{value:new We(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:gt([se.common,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.gradientmap,se.fog,se.lights,{emissive:{value:new We(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:gt([se.common,se.bumpmap,se.normalmap,se.displacementmap,se.fog,{matc
vendor: 5,064 bytes, line 3587
3587ap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:gt([se.points,se.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:gt([se.common,se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:gt([se.common,se.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:gt([se.common,se.bumpmap,se.normalmap,se.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:gt([se.sprite,se.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Ne},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ne}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:gt([se.common,se.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:gt([se.lights,se.fog,{color:{value:new We(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};kt.physical={uniforms:gt([kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ne},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ne},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ne},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ne},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ne},sheen:{value:0},sheenColor:{value:new We(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ne},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ne},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ne},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ne},attenuationDistance:{value:0},attenuationColor:{value:new We(0)},specularColor:{value:new We(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ne},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ne},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ne}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const ki={r:0,b:0,g:0},Sn=new Xt,qh=new tt;function Yh(i,e,t,n,r,s,a){const o=new We(0);let l=s===!0?0:1,c,d,u=null,p=0,m=null;function v(T){let x=T.isScene===!0?T.background:null;return x&&x.isTexture&&(x=(T.backgroundBlurriness>0?t:e).get(x)),x}function E(T){let x=!1;const y=v(T);y===null?f(o,l):y&&y.isColor&&(f(y,1),x=!0);const C=i.xr.getEnvironmentBlendMode();C==="additive"?n.buffers.color.setClear(0,0,0,1,a):C==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function h(T,x){const y=v(x);y&&(y.isCubeTexture||y.mapping===dr)?(d===void 0&&(d=new zt(new Ei(1,1,1),new ht({name:"BackgroundCubeMaterial",uniforms:ti(kt.backgroundCube.uniforms),vertexShader:kt.backgroundCube.vertexShader,fragmentShader:kt.backgroundCube.fragmentShader,side:St,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(C,w,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),Sn.copy(x.backgroundRotation),Sn.x*=-1,Sn.y*=-1,Sn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Sn.y*=-1,Sn.z*=-1),d.material.uniforms.envMap.value=y,d.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(qh.makeRotationFromEuler(Sn)),d.material.toneMapped=qe.getTransfer(y.colorSpace)!==Je,(u!==y||p!==y.version||m!==i.toneMapping)&&(
vendor: 5,103 bytes, line 3587
3587d.material.needsUpdate=!0,u=y,p=y.version,m=i.toneMapping),d.layers.enableAll(),T.unshift(d,d.geometry,d.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new zt(new mr(2,2),new ht({name:"BackgroundMaterial",uniforms:ti(kt.background.uniforms),vertexShader:kt.background.vertexShader,fragmentShader:kt.background.fragmentShader,side:mn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=qe.getTransfer(y.colorSpace)!==Je,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(u!==y||p!==y.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,u=y,p=y.version,m=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function f(T,x){T.getRGB(ki,Bo(i)),n.buffers.color.setClear(ki.r,ki.g,ki.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(T,x=1){o.set(T),l=x,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,f(o,l)},render:E,addToRenderList:h}}function Kh(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,a=!1;function o(g,S,O,H,k){let j=!1;const z=u(H,O,S);s!==z&&(s=z,c(s.object)),j=m(g,H,O,k),j&&v(g,H,O,k),k!==null&&e.update(k,i.ELEMENT_ARRAY_BUFFER),(j||a)&&(a=!1,y(g,S,O,H),k!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(k).buffer))}function l(){return i.createVertexArray()}function c(g){return i.bindVertexArray(g)}function d(g){return i.deleteVertexArray(g)}function u(g,S,O){const H=O.wireframe===!0;let k=n[g.id];k===void 0&&(k={},n[g.id]=k);let j=k[S.id];j===void 0&&(j={},k[S.id]=j);let z=j[H];return z===void 0&&(z=p(l()),j[H]=z),z}function p(g){const S=[],O=[],H=[];for(let k=0;k<t;k++)S[k]=0,O[k]=0,H[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:S,enabledAttributes:O,attributeDivisors:H,object:g,attributes:{},index:null}}function m(g,S,O,H){const k=s.attributes,j=S.attributes;let z=0;const X=O.getAttributes();for(const D in X)if(X[D].location>=0){const te=k[D];let Q=j[D];if(Q===void 0&&(D==="instanceMatrix"&&g.instanceMatrix&&(Q=g.instanceMatrix),D==="instanceColor"&&g.instanceColor&&(Q=g.instanceColor)),te===void 0||te.attribute!==Q||Q&&te.data!==Q.data)return!0;z++}return s.attributesNum!==z||s.index!==H}function v(g,S,O,H){const k={},j=S.attributes;let z=0;const X=O.getAttributes();for(const D in X)if(X[D].location>=0){let te=j[D];te===void 0&&(D==="instanceMatrix"&&g.instanceMatrix&&(te=g.instanceMatrix),D==="instanceColor"&&g.instanceColor&&(te=g.instanceColor));const Q={};Q.attribute=te,te&&te.data&&(Q.data=te.data),k[D]=Q,z++}s.attributes=k,s.attributesNum=z,s.index=H}function E(){const g=s.newAttributes;for(let S=0,O=g.length;S<O;S++)g[S]=0}function h(g){f(g,0)}function f(g,S){const O=s.newAttributes,H=s.enabledAttributes,k=s.attributeDivisors;O[g]=1,H[g]===0&&(i.enableVertexAttribArray(g),H[g]=1),k[g]!==S&&(i.vertexAttribDivisor(g,S),k[g]=S)}function T(){const g=s.newAttributes,S=s.enabledAttributes;for(let O=0,H=S.length;O<H;O++)S[O]!==g[O]&&(i.disableVertexAttribArray(O),S[O]=0)}function x(g,S,O,H,k,j,z){z===!0?i.vertexAttribIPointer(g,S,O,k,j):i.vertexAttribPointer(g,S,O,H,k,j)}function y(g,S,O,H){E();const k=H.attributes,j=O.getAttributes(),z=S.defaultAttributeValues;for(const X in j){const D=j[X];if(D.location>=0){let $=k[X];if($===void 0&&(X==="instanceMatrix"&&g.instanceMatrix&&($=g.instanceMatrix),X==="instanceColor"&&g.instanceColor&&($=g.instanceColor)),$!==void 0){const te=$.normalized,Q=$.itemSize,xe=e.get($);if(xe===void 0)continue;const Se=xe.buffer,F=xe.type,J=xe.bytesPerElement,re=F===i.INT||F===i.UNSIGNED_INT||$.gpuType===ks;if($.isInterleavedBufferAttribute){const oe=$.data,Ce=oe.stride,ye=$.offset;if(oe.isInstancedInterleavedBuffer){for(let Ge=0;Ge<D.locationSize;Ge++)f(D.location+Ge,oe.meshPerAttribute);g.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ge=0;Ge<D.locationSize;Ge++)h(D.location+Ge);i.bindBuffer(i.ARRAY_BUFFER,Se);for(let Ge=0;Ge<D.locationSize;Ge++)x(D.location+Ge,Q/D.locationSize,F,te,Ce*J,(ye+Q/D.locationSize*Ge)*J,re)}else{if($.isInstancedBufferAttribute){for(let oe=0;oe<D.locationSize;oe++)f(D.location+oe,$.meshPerAttribute);g.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let oe=0;oe<D.locationSize;oe++)h(D.location+oe);i.bindBuffer(i.ARRAY_BUFFER,Se);for(let oe=0;oe<D.locationSize;oe++)x(D.location+oe,Q/D.locationSize,F,te,Q*J,Q/D.locationSize*oe*J,re)}}else if(z!==void 0){const te=z[X];if(te!==void 0)switch(te.length){case 2:i.vertexAttrib2fv(D.location,te);break;case 3:i.vertexAttrib3fv(D.location,te);break;case 4:i.vertexAttrib4fv(D.location,te);break;default:i.vertexAttrib1fv(D.location,te)}}}}T()}function C(){I();for(const g in n){const S=n[g];for(const O in S){const H=S[O];for(const k in H)d(H[k].object),delete H[k];delete S[O]}
vendor: 5,146 bytes, line 3587
3587delete n[g]}}function w(g){if(n[g.id]===void 0)return;const S=n[g.id];for(const O in S){const H=S[O];for(const k in H)d(H[k].object),delete H[k];delete S[O]}delete n[g.id]}function b(g){for(const S in n){const O=n[S];if(O[g.id]===void 0)continue;const H=O[g.id];for(const k in H)d(H[k].object),delete H[k];delete O[g.id]}}function I(){K(),a=!0,s!==r&&(s=r,c(s.object))}function K(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:I,resetDefaultState:K,dispose:C,releaseStatesOfGeometry:w,releaseStatesOfProgram:b,initAttributes:E,enableAttribute:h,disableUnusedAttributes:T}}function $h(i,e,t){let n;function r(c){n=c}function s(c,d){i.drawArrays(n,c,d),t.update(d,n,1)}function a(c,d,u){u!==0&&(i.drawArraysInstanced(n,c,d,u),t.update(d,n,u))}function o(c,d,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,d,0,u);let m=0;for(let v=0;v<u;v++)m+=d[v];t.update(m,n,1)}function l(c,d,u,p){if(u===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<c.length;v++)a(c[v],d[v],p[v]);else{m.multiDrawArraysInstancedWEBGL(n,c,0,d,0,p,0,u);let v=0;for(let E=0;E<u;E++)v+=d[E];for(let E=0;E<p.length;E++)t.update(v,n,p[E])}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Zh(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const b=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(b){return!(b!==Bt&&n.convert(b)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(b){const I=b===rn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(b!==sn&&n.convert(b)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&b!==en&&!I)}function l(b){if(b==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const u=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const b=e.get("EXT_clip_control");b.clipControlEXT(b.LOWER_LEFT_EXT,b.ZERO_TO_ONE_EXT)}const m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),T=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),x=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),C=v>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:p,maxTextures:m,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:T,maxVaryings:x,maxFragmentUniforms:y,vertexTextures:C,maxSamples:w}}function jh(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new yn,o=new Ne,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,p){const m=u.length!==0||p||n!==0||r;return r=p,n=u.length,m},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,p){t=d(u,p,0)},this.setState=function(u,p,m){const v=u.clippingPlanes,E=u.clipIntersection,h=u.clipShadows,f=i.get(u);if(!r||v===null||v.length===0||s&&!h)s?d(null):c();else{const T=s?0:n,x=T*4;let y=f.clippingState||null;l.value=y,y=d(v,p,x,m);for(let C=0;C!==x;++C)y[C]=t[C];f.clippingState=y,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(u,p,m,v){const E=u!==null?u.length:0;let h=null;if(E!==0){if(h=l.value,v!==!0||h===null){const f=m+E*4,T=p.matrixWorldInverse;o.getNormalMatrix(T),(h===null||h.length<f)&&(h=new Float32Array(f));for(let x=0,y=m;x!==E;++x,y+=4)a.copy(u[x]).applyMatrix4(T,o),a.normal.toArray(h,y),h[y+3]=a.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=E,e.numIntersection=0,h}}function Jh(i){let e=new WeakMap;function t(a,o){return o===cs?a.mapping=jn:o===us&&(a.mapping=Jn),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===cs||o===us)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new cc(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ko extends zo{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
3587phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Xn=4,La=[.125,.215,.35,.446,.526,.582],bn=20,qr=new ko,Da=new We;let Yr=null,Kr=0,$r=0,Zr=!1;const Tn=(1+Math.sqrt(5))/2,Wn=1/Tn,Ua=[new N(-Tn,Wn,0),new N(Tn,Wn,0),new N(-Wn,0,Tn),new N(Wn,0,Tn),new N(0,Tn,-Wn),new N(0,Tn,Wn),new N(-1,1,-1),new N(1,1,-1),new N(-1,1,1),new N(1,1,1)];class Ia{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){Yr=this._renderer.getRenderTarget(),Kr=this._renderer.getActiveCubeFace(),$r=this._renderer.getActiveMipmapLevel(),Zr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Oa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Yr,Kr,$r),this._renderer.xr.enabled=Zr,e.scissorTest=!1,Wi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===jn||e.mapping===Jn?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Yr=this._renderer.getRenderTarget(),Kr=this._renderer.getActiveCubeFace(),$r=this._renderer.getActiveMipmapLevel(),Zr=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:Ft,minFilter:Ft,generateMipmaps:!1,type:rn,format:Bt,colorSpace:Wt,depthBuffer:!1}
vendor: 6,044 bytes, lines 3587-3662
3587,r=Na(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Na(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Qh(s)),this._blurMaterial=ef(s,e,t)}return r}_compileMaterial(e){const t=new zt(this._lodPlanes[0],e);this._renderer.compile(t,qr)}_sceneToCubeUV(e,t,n,r){const o=new Pt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,p=d.toneMapping;d.getClearColor(Da),d.toneMapping=pn,d.autoClear=!1;const m=new js({name:"PMREM.Background",side:St,depthWrite:!1,depthTest:!1}),v=new zt(new Ei,m);let E=!1;const h=e.background;h?h.isColor&&(m.color.copy(h),e.background=null,E=!0):(m.color.copy(Da),E=!0);for(let f=0;f<6;f++){const T=f%3;T===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):T===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));const x=this._cubeSize;Wi(r,T*x,f>2?x:0,x,x),d.setRenderTarget(r),E&&d.render(v,o),d.render(e,o)}v.geometry.dispose(),v.material.dispose(),d.toneMapping=p,d.autoClear=u,e.background=h}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===jn||e.mapping===Jn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Oa()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fa());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new zt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Wi(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,qr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Ua[(r-s-1)%Ua.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,u=new zt(this._lodPlanes[r],c),p=c.uniforms,m=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*bn-1),E=s/v,h=isFinite(s)?1+Math.floor(d*E):bn;h>bn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${bn}`);const f=[];let T=0;for(let b=0;b<bn;++b){const I=b/E,K=Math.exp(-I*I/2);f.push(K),b===0?T+=K:b<h&&(T+=2*K)}for(let b=0;b<f.length;b++)f[b]=f[b]/T;p.envMap.value=e.texture,p.samples.value=h,p.weights.value=f,p.latitudinal.value=a==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:x}=this;p.dTheta.value=v,p.mipInt.value=x-n;const y=this._sizeLods[r],C=3*y*(r>x-Xn?r-x+Xn:0),w=4*(this._cubeSize-y);Wi(t,C,w,3*y,2*y),l.setRenderTarget(t),l.render(u,qr)}}function Qh(i){const e=[],t=[],n=[];let r=i;const s=i-Xn+1+La.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-Xn?l=La[a-i+Xn-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,u=1+c,p=[d,d,u,d,u,u,d,d,u,u,d,u],m=6,v=6,E=3,h=2,f=1,T=new Float32Array(E*v*m),x=new Float32Array(h*v*m),y=new Float32Array(f*v*m);for(let w=0;w<m;w++){const b=w%3*2/3-1,I=w>2?0:-1,K=[b,I,0,b+2/3,I,0,b+2/3,I+1,0,b,I,0,b+2/3,I+1,0,b,I+1,0];T.set(K,E*v*w),x.set(p,h*v*w);const g=[w,w,w,w,w,w];y.set(g,f*v*w)}const C=new wt;C.setAttribute("position",new et(T,E)),C.setAttribute("uv",new et(x,h)),C.setAttribute("faceIndex",new et(y,f)),e.push(C),r>Xn&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Na(i,e,t){const n=new Ht(i,e,t);return n.texture.mapping=dr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Wi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function ef(i,e,t){const n=new Float32Array(bn),r=new N(0,1,0);return new ht({name:"SphericalGaussianBlur",defines:{n:bn,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:Js(),fragmentShader:` 3588 3589 precision mediump float; 3590 precision mediump int; 3591 3592 varying vec3 vOutputDirection; 3593 3594 uniform sampler2D envMap; 3595 uniform int samples; 3596 uniform float weights[ n ]; 3597 uniform bool latitudinal; 3598 uniform float dTheta; 3599 uniform float mipInt; 3600 uniform vec3 poleAxis; 3601 3602 #define ENVMAP_TYPE_CUBE_UV 3603 #include <cube_uv_reflection_fragment> 3604 3605 vec3 getSample( float theta, vec3 axis ) { 3606 3607 float cosTheta = cos( theta ); 3608 // Rodrigues' axis-angle rotation 3609 vec3 sampleDirection = vOutputDirection * cosTheta 3610 + cross( axis, vOutputDirection ) * sin( theta ) 3611 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3612 3613 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3614 3615 } 3616 3617 void main() { 3618 3619 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3620 3621 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3622 3623 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3624 3625 } 3626 3627 axis = normalize( axis ); 3628 3629 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3630 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3631 3632 for ( int i = 1; i < n; i++ ) { 3633 3634 if ( i >= samples ) { 3635 3636 break; 3637 3638 } 3639 3640 float theta = dTheta * float( i ); 3641 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3642 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3643 3644 } 3645 3646 } 3647 `,blending:nn,depthTest:!1,depthWrite:!1})}function Fa(){return new ht({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Js(),fragmentShader:` 3648 3649 precision mediump float; 3650 precision mediump int; 3651 3652 varying vec3 vOutputDirection; 3653 3654 uniform sampler2D envMap; 3655 3656 #include <common> 3657 3658 void main() { 3659 3660 vec3 outputDirection = normalize( vOutputDirection ); 3661 vec2 uv = equirectUv( outputDirection ); 3662
3663 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3664 3665 } 3666 `,blending:nn,depthTest:!1,depthWrite:!1})}function Oa(){return new ht({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Js(),fragmentShader:` 3667 3668 precision mediump float; 3669 precision mediump int; 3670 3671 uniform float flipEnvMap; 3672 3673 varying vec3 vOutputDirection; 3674 3675 uniform samplerCube envMap; 3676 3677 void main() { 3678 3679 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3680 3681 } 3682 `,blending:nn,depthTest:!1,depthWrite:!1})}function Js(){return` 3683 3684 precision mediump float; 3685 precision mediump int; 3686 3687 attribute float faceIndex; 3688 3689 varying vec3 vOutputDirection; 3690 3691 // RH coordinate system; PMREM face-indexing convention 3692 vec3 getDirection( vec2 uv, float face ) { 3693 3694 uv = 2.0 * uv - 1.0; 3695 3696 vec3 direction = vec3( uv, 1.0 ); 3697 3698 if ( face == 0.0 ) { 3699 3700 direction = direction.zyx; // ( 1, v, u ) pos x 3701 3702 } else if ( face == 1.0 ) { 3703 3704 direction = direction.xzy; 3705 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3706 3707 } else if ( face == 2.0 ) { 3708 3709 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3710 3711 } else if ( face == 3.0 ) { 3712 3713 direction = direction.zyx; 3714 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3715 3716 } else if ( face == 4.0 ) { 3717 3718 direction = direction.xzy; 3719 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3720 3721 } else if ( face == 5.0 ) { 3722 3723 direction.z *= -1.0; // ( u, v, -1 ) neg z 3724 3725 } 3726 3727 return direction; 3728 3729 } 3730 3731 void main() { 3732 3733 vOutputDirection = getDirection( uv, faceIndex ); 3734 gl_Position = vec4( position, 1.0 ); 3735 3736 } 3737 `}function tf(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===cs||l===us,d=l===jn||l===Jn;if(c||d){let u=e.get(o);const p=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return t===null&&(t=new Ia(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const m=o.image;return c&&m&&m.height>0||d&&m&&r(m)?(t===null&&(t=new Ia(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let d=0;d<c;d++)o[d]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function nf(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&ir("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function rf(i,e,t,n){const r={},s=new WeakMap;function a(u){const p=u.target;p.index!==null&&e.remove(p.index);for(const v in p.attributes)e.remove(p.attributes[v]);for(const v in p.morphAttributes){const E=p.morphAttributes[v];for(let h=0,f=E.length;h<f;h++)e.remove(E[h])}p.removeEventListener("dispose",a),delete r[p.id];const m=s.get(p);m&&(e.remove(m),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function o(u,p){return r[p.id]===!0||(p.addEventListener("dispose",a),r[p.id]=!0,t.memory.geometries++),p}function l(u){const p=u.attributes;for(const v in p)e.update(p[v],i.ARRAY_BUFFER);const m=u.morphAttributes;for(const v in m){const E=m[v];for(let h=0,f=E.length;h<f;h++)e.update(E[h],i.ARRAY_BUFFER)}}function c(u){const p=[],m=u.index,v=u.attributes.position;let E=0;if(m!==null){const T=m.array;E=m.version;for(let x=0,y=T.length;x<y;x+=3){const C=T[x+0],w=T[x+1],b=T[x+2];p.push(C,w,w,b,b,C)}}else if(v!==void 0){const T=v.array;E=v.version;for(let x=0,y=T.length/3-1;x<y;x+=3){const C=x+0,w=x+1,b=x+2;p.push(C,w,w,b,b,C)}}else return;const h=new(Lo(p)?Oo:Fo)(p,1);h.version=E;const f=s.get(u);f&&e.remove(f),s.set(u,h)}function d(u){const p=s.get(u);if(p){const m=u.index;m!==null&&p.version<m.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:d}}function sf(i,e,t){let n;function r(p){n=p}let s,a;function o(p){s=p.type,a=p.bytesPerElement}function l(p,m){i.drawElements(n,m,s,p*a),t.update(m,n,1)}function c(p,m,v){v!==0&&(i.drawElementsInstanced(n,m,s,p*a,v),t.update(m,n,v))}function d(p,m,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,s,p,0,v);let h=0;for(let f=0;f<v;f++)h+=m[f];t.update(h,n,1)}function u(p,m,v,E){if(v===0)return;const h=e.get("WEBGL_multi_draw");if(h===null)for(let f=0;f<p.length;f++)c(p[f]/a,m[f],E[f]);
vendor: 11,924 bytes, line 3737
3737else{h.multiDrawElementsInstancedWEBGL(n,m,0,s,p,0,E,0,v);let f=0;for(let T=0;T<v;T++)f+=m[T];for(let T=0;T<E.length;T++)t.update(f,n,E[T])}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=u}function af(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function of(i,e,t){const n=new WeakMap,r=new it;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=d!==void 0?d.length:0;let p=n.get(o);if(p===void 0||p.count!==u){let K=function(){b.dispose(),n.delete(o),o.removeEventListener("dispose",K)};p!==void 0&&p.texture.dispose();const m=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,E=o.morphAttributes.color!==void 0,h=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],T=o.morphAttributes.color||[];let x=0;m===!0&&(x=1),v===!0&&(x=2),E===!0&&(x=3);let y=o.attributes.position.count*x,C=1;y>e.maxTextureSize&&(C=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*C*4*u),b=new Uo(w,y,C,u);b.type=en,b.needsUpdate=!0;const I=x*4;for(let g=0;g<u;g++){const S=h[g],O=f[g],H=T[g],k=y*C*4*g;for(let j=0;j<S.count;j++){const z=j*I;m===!0&&(r.fromBufferAttribute(S,j),w[k+z+0]=r.x,w[k+z+1]=r.y,w[k+z+2]=r.z,w[k+z+3]=0),v===!0&&(r.fromBufferAttribute(O,j),w[k+z+4]=r.x,w[k+z+5]=r.y,w[k+z+6]=r.z,w[k+z+7]=0),E===!0&&(r.fromBufferAttribute(H,j),w[k+z+8]=r.x,w[k+z+9]=r.y,w[k+z+10]=r.z,w[k+z+11]=H.itemSize===4?r.w:1)}}p={count:u,texture:b,size:new He(y,C)},n.set(o,p),o.addEventListener("dispose",K)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let m=0;for(let E=0;E<c.length;E++)m+=c[E];const v=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",p.size)}return{update:s}}function lf(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,d=l.geometry,u=e.get(l,d);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const p=l.skeleton;r.get(p)!==c&&(p.update(),r.set(p,c))}return u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class Wo extends Et{constructor(e,t,n,r,s,a,o,l,c,d=Kn){if(d!==Kn&&d!==ei)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===Kn&&(n=Cn),n===void 0&&d===ei&&(n=Qn),super(null,r,s,a,o,l,d,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Lt,this.minFilter=l!==void 0?l:Lt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const Xo=new Et,Ba=new Wo(1,1),qo=new Uo,Yo=new Kl,Ko=new Ho,za=[],Ha=[],Ga=new Float32Array(16),Va=new Float32Array(9),ka=new Float32Array(4);function si(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=za[r];if(s===void 0&&(s=new Float32Array(r),za[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 lt(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 ct(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function gr(i,e){let t=Ha[e];t===void 0&&(t=new Int32Array(e),Ha[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function cf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function uf(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(lt(t,e))return;i.uniform2fv(this.addr,e),ct(t,e)}}function hf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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(lt(t,e))return;i.uniform3fv(this.addr,e),ct(t,e)}}function ff(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||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(lt(t,e))return;i.uniform4fv(this.addr,e),ct(t,e)}}function df(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;ka.set(n),i.uniformMatrix2fv(this.addr,!1,ka),ct(t,n)}}function pf(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;Va.set(n),i.uniformMatrix3fv(this.addr,!1,Va),ct(t,n)}}function mf(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;Ga.set(n),i.uniformMatrix4fv(this.addr,!1,Ga),ct(t,n)}}function gf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function _f(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(lt(t,e))return;i.uniform2iv(this.addr,e),ct(t,e)}}function vf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lt(t,e))return;i.uniform3iv(this.addr,e),ct(t,e)}}function xf(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(lt(t,e))return;i.uniform4iv(this.addr,e),ct(t,e)}}function Mf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Sf(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(lt(t,e))return;i.uniform2uiv(this.addr,e),ct(t,e)}}function Ef(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(lt(t,e))return;i.uniform3uiv(this.addr,e),ct(t,e)}}function yf(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(lt(t,e))return;i.uniform4uiv(this.addr,e),ct(t,e)}}function Tf(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?(Ba.compareFunction=Po,s=Ba):s=Xo,t.setTexture2D(e||s,r)}function Af(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Yo,r)}function bf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Ko,r)}function wf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||qo,r)}function Rf(i){switch(i){case 5126:return cf;case 35664:return uf;case 35665:return hf;case 35666:return ff;case 35674:return df;case 35675:return pf;case 35676:return mf;case 5124:case 35670:return gf;case 35667:case 35671:return _f;case 35668:case 35672:return vf;case 35669:case 35673:return xf;case 5125:return Mf;case 36294:return Sf;case 36295:return Ef;case 36296:return yf;case 35678:case 36198:case 36298:case 36306:case 35682:return Tf;case 35679:case 36299:case 36307:return Af;case 35680:case 36300:case 36308:case 36293:return bf;case 36289:case 36303:case 36311:case 36292:return wf}}function Cf(i,e){i.uniform1fv(this.addr,e)}function Pf(i,e){const t=si(e,this.size,2);i.uniform2fv(this.addr,t)}function Lf(i,e){const t=si(e,this.size,3);i.uniform3fv(this.addr,t)}function Df(i,e){const t=si(e,this.size,4);i.uniform4fv(this.addr,t)}function Uf(i,e){const t=si(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function If(i,e){const t=si(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Nf(i,e){const t=si(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Ff(i,e){i.uniform1iv(this.addr,e)}function Of(i,e){i.uniform2iv(this.addr,e)}function Bf(i,e){i.uniform3iv(this.addr,e)}function zf(i,e){i.uniform4iv(this.addr,e)}function Hf(i,e){i.uniform1uiv(this.addr,e)}function Gf(i,e){i.uniform2uiv(this.addr,e)}function Vf(i,e){i.uniform3uiv(this.addr,e)}function kf(i,e){i.uniform4uiv(this.addr,e)}function Wf(i,e,t){const n=this.cache,r=e.length,s=gr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Xo,s[a])}function Xf(i,e,t){const n=this.cache,r=e.length,s=gr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Yo,s[a])}function qf(i,e,t){const n=this.cache,r=e.length,s=gr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Ko,s[a])}function Yf(i,e,t){const n=this.cache,r=e.length,s=gr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||qo,s[a])}function Kf(i){switch(i){case 5126:return Cf;case 35664:return Pf;case 35665:return Lf;case 35666:return Df;case 35674:return Uf;case 35675:return If;case 35676:return Nf;case 5124:case 35670:return Ff;case 35667:case 35671:return Of;case 35668:case 35672:return Bf;case 35669:case 35673:return zf;case 5125:return Hf;case 36294:return Gf;case 36295:return Vf;case 36296:return kf;case 35678:case 36198:case 36298:case 36306:case 35682:return Wf;case 35679:case 36299:case 36307:return Xf;case 35680:case 36300:case 36308:case 36293:return qf;case 36289:case 36303:case 36311:case 36292:return Yf}}class $f{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Rf(t.type)}}class Zf{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Kf(t.type)}}class jf{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 jr=/(\w+)(\])?(\[|\.)?/g;function Wa(i,e){i.seq.push(e),i.map[e.id]=e}function Jf(i,e,t){const n=i.name,r=n.length;for(jr.lastIndex=0;;){const s=jr.exec(n),a=jr.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Wa(t,c===void 0?new $f(o,i,e):new Zf(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new jf(o),Wa(t,u)),t=u}}}class rr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Jf(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}
vendor: 6,170 bytes, lines 3737-3771
3737function Xa(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Qf=37297;let ed=0;function td(i,e){const t=i.split(` 3738`),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(` 3739`)}function nd(i){const e=qe.getPrimaries(qe.workingColorSpace),t=qe.getPrimaries(i);let n;switch(e===t?n="":e===or&&t===ar?n="LinearDisplayP3ToLinearSRGB":e===ar&&t===or&&(n="LinearSRGBToLinearDisplayP3"),i){case Wt:case pr:return[n,"LinearTransferOETF"];case Vt:case $s:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function qa(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3740 3741`+r+` 3742 3743`+td(i.getShaderSource(e),a)}else return r}function id(i,e){const t=nd(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function rd(i,e){let t;switch(e){case fo:t="Linear";break;case po:t="Reinhard";break;case mo:t="Cineon";break;case go:t="ACESFilmic";break;case _o:t="AgX";break;case vo:t="Neutral";break;case Al:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Xi=new N;function sd(){qe.getLuminanceCoefficients(Xi);const i=Xi.x.toFixed(4),e=Xi.y.toFixed(4),t=Xi.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3744`)}function ad(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(mi).join(` 3745`)}function od(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3746`)}function ld(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 mi(i){return i!==""}function Ya(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 Ka(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cd=/^[ \t]*#include +<([\w\d./]+)>/gm;function Hs(i){return i.replace(cd,hd)}const ud=new Map;function hd(i,e){let t=Oe[e];if(t===void 0){const n=ud.get(e);if(n!==void 0)t=Oe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Hs(t)}const fd=/#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 $a(i){return i.replace(fd,dd)}function dd(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Za(i){let e=`precision ${i.precision} float; 3747 precision ${i.precision} int; 3748 precision ${i.precision} sampler2D; 3749 precision ${i.precision} samplerCube; 3750 precision ${i.precision} sampler3D; 3751 precision ${i.precision} sampler2DArray; 3752 precision ${i.precision} sampler2DShadow; 3753 precision ${i.precision} samplerCubeShadow; 3754 precision ${i.precision} sampler2DArrayShadow; 3755 precision ${i.precision} isampler2D; 3756 precision ${i.precision} isampler3D; 3757 precision ${i.precision} isamplerCube; 3758 precision ${i.precision} isampler2DArray; 3759 precision ${i.precision} usampler2D; 3760 precision ${i.precision} usampler3D; 3761 precision ${i.precision} usamplerCube; 3762 precision ${i.precision} usampler2DArray; 3763 `;return i.precision==="highp"?e+=` 3764#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3765#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3766#define LOW_PRECISION`),e}function pd(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===uo?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===rl?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Jt&&(e="SHADOWMAP_TYPE_VSM"),e}function md(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case jn:case Jn:e="ENVMAP_TYPE_CUBE";break;case dr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function gd(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Jn:e="ENVMAP_MODE_REFRACTION";break}return e}function _d(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case ho:e="ENVMAP_BLENDING_MULTIPLY";break;case yl:e="ENVMAP_BLENDING_MIX";break;case Tl:e="ENVMAP_BLENDING_ADD";break}return e}function vd(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),7*16)),texelHeight:n,maxMip:t}}function xd(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=pd(t),c=md(t),d=gd(t),u=_d(t),p=vd(t),m=ad(t),v=od(s),E=r.createProgram();let h,f,T=t.glslVersion?"#version "+t.glslVersion+` 3767`:"";t.isRawShaderMaterial?(h=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(mi).join(` 3768`),h.length>0&&(h+=` 3769`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(mi).join(` 3770`),f.length>0&&(f+=` 3771`)):(h=[Za(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 6,454 bytes, lines 3771-3773
3771ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3772`].filter(mi).join(` 3773`),f=[Za(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+u:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3773IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==pn?"#define TONE_MAPPING":"",t.toneMapping!==pn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==pn?rd("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,id("linearToOutputTexel",t.outputColorSpace),sd(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3774`].filter(mi).join(` 3775`)),a=Hs(a),a=Ya(a,t),a=Ka(a,t),o=Hs(o),o=Ya(o,t),o=Ka(o,t),a=$a(a),o=$a(o),t.isRawShaderMaterial!==!0&&(T=`#version 300 es 3776`,h=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3777`)+` 3778`+h,f=["#define varying in",t.glslVersion===da?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===da?"":"#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(` 3779`)+` 3780`+f);const x=T+h+a,y=T+f+o,C=Xa(r,r.VERTEX_SHADER,x),w=Xa(r,r.FRAGMENT_SHADER,y);r.attachShader(E,C),r.attachShader(E,w),t.index0AttributeName!==void 0?r.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(E,0,"position"),r.linkProgram(E);function b(S){if(i.debug.checkShaderErrors){const O=r.getProgramInfoLog(E).trim(),H=r.getShaderInfoLog(C).trim(),k=r.getShaderInfoLog(w).trim();let j=!0,z=!0;if(r.getProgramParameter(E,r.LINK_STATUS)===!1)if(j=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,E,C,w);else{const X=qa(r,C,"vertex"),D=qa(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(E,r.VALIDATE_STATUS)+` 3781 3782Material Name: `+S.name+` 3783Material Type: `+S.type+` 3784 3785Program Info Log: `+O+` 3786`+X+` 3787`+D)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(H===""||k==="")&&(z=!1);z&&(S.diagnostics={runnable:j,programLog:O,vertexShader:{log:H,prefix:h},fragmentShader:{log:k,prefix:f}})}r.deleteShader(C),r.deleteShader(w),I=new rr(r,E),K=ld(r,E)}let I;this.getUniforms=function(){return I===void 0&&b(this),I};let K;this.getAttributes=function(){return K===void 0&&b(this),K};let g=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(E,Qf)),g},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ed++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=w,this}let Md=0;class Sd{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Ed(e),t.set(e,n)),n}}class Ed{constructor(e){this.id=Md++,this.code=e,this.usedTimes=0}}function yd(i,e,t,n,r,s,a){const o=new Io,l=new Sd,c=new Set,d=[],u=r.logarithmicDepthBuffer,p=r.reverseDepthBuffer,m=r.vertexTextures;let v=r.precision;const E={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function h(g){return c.add(g),g===0?"uv":`uv${g}`}function f(g,S,O,H,k){const j=H.fog,z=k.geometry,X=g.isMeshStandardMaterial?H.environment:null,D=(g.isMeshStandardMaterial?t:e).get(g.envMap||X),$=D&&D.mapping===dr?D.image.height:null,te=E[g.type];g.precision!==null&&(v=r.getMaxPrecision(g.precision),v!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",v,"instead."));const Q=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,xe=Q!==void 0?Q.length:0;let Se=0;z.morphAttributes.position!==void 0&&(Se=1),z.morphAttributes.normal!==void 0&&(Se=2),z.morphAttributes.color!==void 0&&(Se=3);let F,J,re,oe;if(te){const vt=kt[te];F=vt.vertexShader,J=vt.fragmentShader}else F=g.vertexShader,J=g.fragmentShader,l.update(g),re=l.getVertexShaderID(g),oe=l.getFragmentShaderID(g);const Ce=i.getRenderTarget(),ye=k.isInstancedMesh===!0,Ge=k.isBatchedMesh===!0,Pe=!!g.map,Ue=!!g.matcap,R=!!D,rt=!!g.aoMap,Ie=!!g.lightMap,ke=!!g.bumpMap,Ae=!!g.normalMap,Ye=!!g.displacementMap,be=!!g.emissiveMap,A=!!g.metalnessMap,_=!!g.roughnessMap,B=g.anisotropy>0,Y=g.clearcoat>0,ee=g.dispersion>0,q=g.iridescence>0,ge=g.sheen>0,ae=g.transmission>0,de=B&&!!g.anisotropyMap,Be=Y&&!!g.clearcoatMap,ne=Y&&!!g.clearcoatNormalMap,pe=Y&&!!g.clearcoatRoughnessMap,we=q&&!!g.iridescenceMap,Te=q&&!!g.iridescenceThicknessMap,me=ge&&!!g.sheenColorMap,ze=ge&&!!g.sheenRoughnessMap,Le=!!g.specularMap,Ze=!!g.specularColorMap,P=!!g.specularIntensityMap,ue=ae&&!!g.transmissionMap,W=ae&&!!g.thicknessMap,Z=!!g.gradientMap,le=!!g.alphaMap,ce=g.alphaTest>0,Ve=!!g.alphaHash,fe=!!g.extensions;let Fe=pn;g.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(Fe=i.toneMapping);const Xe={shaderID:te,shaderType:g.type,shaderName:g.name,vertexShader:F,fragmentShader:J,defines:g.defines,customVertexShaderID:re,customFragmentShaderID:oe,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:v,batching:Ge,batchingColor:Ge&&k._colorsTexture!==null,instancing:ye,instancingColor:ye&&k.instanceColor!==null,instancingMorph:ye&&k.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ce===null?i.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:Wt,alphaToCoverage:!!g.alphaToCoverage,map:Pe,matcap:Ue,envMap:R,envMapMode:R&&D.mapping,envMapCubeUVHeight:$,aoMap:rt,lightMap:Ie,bumpMap:ke,normalMap:Ae,displacementMap:m&&Ye,emissiveMap:be,normalMapObjectSpace:Ae&&g.normalMapType===Pl,normalMapTangentSpace:Ae&&g.normalMapType===Cl,metalnessMap:A,roughnessMap:_,anisotropy:B,anisotropyMap:de,clearcoat:Y,clearcoatMap:Be,clearcoatNormalMap:ne,clearcoatRoughnessMap:pe,dispersion:ee,iridescence:q,iridescenceMap:we,iridescenceThicknessMap:Te,sheen:ge,sheenColorMap:me,sheenRoughnessMap:ze,specularMap:Le,specularColorMap:Ze,specularIntensityMap:P,transmission:ae,transmissionMap:ue,thicknessMap:W,gradientMap:Z,opaque:g.transparent===!1&&g.blending===qn&&g.alphaToCoverage===!1,alphaMap:le,alphaTest:ce,alphaHash:Ve,combine:g.combine,mapUv:Pe&&h(g.map.channel),aoMapUv:rt&&h(g.aoMap.channel),lightMapUv:Ie&&h(g.lightMap.channel),bumpMapUv:ke&&h(g.bumpMap.channel),normalMapUv:Ae&&h(g.normalMap.channel),displacementMapUv:Ye&&h(g.displacementMap.channel),emissiveMapUv:be&&h(g.emissiveMap.channel),metalnessMapUv:A&&h(g.metalnessMap.channel),roughnessMapUv:_&&h(g.roughnessMap.channel),anisotropyMapUv:de&&h(g.anisotropyMap.channel),clearcoatMapUv:Be&&h(g.clearcoatMap.channel),clearcoatNormalMapUv:ne&&h(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pe&&h(g.clearcoatRoughnessMap.channel),iridescenceMapUv:we&&h(g.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&h(g.iridescenceThicknessMap.channel),sheenColorMapUv:me&&h(g.sheenColorMap.channel),sheenRoughnessMapUv:ze&&h(g.sheenRoughnessMap.channel),specularMapUv:Le&&h(g.specularMap.channel),specularColorMapUv:Ze&&h(g.specularColorMap.channel),specularIntensityMapUv:P&&h(g.specularIntensityMap.channel),transmissionMapUv:ue&&h(g.transmissionMap.channel),thicknessMapUv:W&&h(g.thicknessMap.channel),alphaMapUv:le&&h(g.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(Ae||B),vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!z.attributes.uv&&(Pe||le),fog:!!j,useFog:g.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:g.flatShading===!0,sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:p,skinning:k.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:xe,morphTextureStride:Se,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&O.length>0,shadowMapType:i.shadowMap.type,toneMapping:Fe,decodeVideoTexture:Pe&&g.map.isVideoTexture===!0&&qe.getTransfer(g.map.colorSpace)===Je,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===Qt,flipSided:g.side===St,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionCl
vendor: 13,642 bytes, lines 3787-3793
3787ipCullDistance:fe&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(fe&&g.extensions.multiDraw===!0||Ge)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return Xe.vertexUv1s=c.has(1),Xe.vertexUv2s=c.has(2),Xe.vertexUv3s=c.has(3),c.clear(),Xe}function T(g){const S=[];if(g.shaderID?S.push(g.shaderID):(S.push(g.customVertexShaderID),S.push(g.customFragmentShaderID)),g.defines!==void 0)for(const O in g.defines)S.push(O),S.push(g.defines[O]);return g.isRawShaderMaterial===!1&&(x(S,g),y(S,g),S.push(i.outputColorSpace)),S.push(g.customProgramCacheKey),S.join()}function x(g,S){g.push(S.precision),g.push(S.outputColorSpace),g.push(S.envMapMode),g.push(S.envMapCubeUVHeight),g.push(S.mapUv),g.push(S.alphaMapUv),g.push(S.lightMapUv),g.push(S.aoMapUv),g.push(S.bumpMapUv),g.push(S.normalMapUv),g.push(S.displacementMapUv),g.push(S.emissiveMapUv),g.push(S.metalnessMapUv),g.push(S.roughnessMapUv),g.push(S.anisotropyMapUv),g.push(S.clearcoatMapUv),g.push(S.clearcoatNormalMapUv),g.push(S.clearcoatRoughnessMapUv),g.push(S.iridescenceMapUv),g.push(S.iridescenceThicknessMapUv),g.push(S.sheenColorMapUv),g.push(S.sheenRoughnessMapUv),g.push(S.specularMapUv),g.push(S.specularColorMapUv),g.push(S.specularIntensityMapUv),g.push(S.transmissionMapUv),g.push(S.thicknessMapUv),g.push(S.combine),g.push(S.fogExp2),g.push(S.sizeAttenuation),g.push(S.morphTargetsCount),g.push(S.morphAttributeCount),g.push(S.numDirLights),g.push(S.numPointLights),g.push(S.numSpotLights),g.push(S.numSpotLightMaps),g.push(S.numHemiLights),g.push(S.numRectAreaLights),g.push(S.numDirLightShadows),g.push(S.numPointLightShadows),g.push(S.numSpotLightShadows),g.push(S.numSpotLightShadowsWithMaps),g.push(S.numLightProbes),g.push(S.shadowMapType),g.push(S.toneMapping),g.push(S.numClippingPlanes),g.push(S.numClipIntersection),g.push(S.depthPacking)}function y(g,S){o.disableAll(),S.supportsVertexTextures&&o.enable(0),S.instancing&&o.enable(1),S.instancingColor&&o.enable(2),S.instancingMorph&&o.enable(3),S.matcap&&o.enable(4),S.envMap&&o.enable(5),S.normalMapObjectSpace&&o.enable(6),S.normalMapTangentSpace&&o.enable(7),S.clearcoat&&o.enable(8),S.iridescence&&o.enable(9),S.alphaTest&&o.enable(10),S.vertexColors&&o.enable(11),S.vertexAlphas&&o.enable(12),S.vertexUv1s&&o.enable(13),S.vertexUv2s&&o.enable(14),S.vertexUv3s&&o.enable(15),S.vertexTangents&&o.enable(16),S.anisotropy&&o.enable(17),S.alphaHash&&o.enable(18),S.batching&&o.enable(19),S.dispersion&&o.enable(20),S.batchingColor&&o.enable(21),g.push(o.mask),o.disableAll(),S.fog&&o.enable(0),S.useFog&&o.enable(1),S.flatShading&&o.enable(2),S.logarithmicDepthBuffer&&o.enable(3),S.reverseDepthBuffer&&o.enable(4),S.skinning&&o.enable(5),S.morphTargets&&o.enable(6),S.morphNormals&&o.enable(7),S.morphColors&&o.enable(8),S.premultipliedAlpha&&o.enable(9),S.shadowMapEnabled&&o.enable(10),S.doubleSided&&o.enable(11),S.flipSided&&o.enable(12),S.useDepthPacking&&o.enable(13),S.dithering&&o.enable(14),S.transmission&&o.enable(15),S.sheen&&o.enable(16),S.opaque&&o.enable(17),S.pointsUvs&&o.enable(18),S.decodeVideoTexture&&o.enable(19),S.alphaToCoverage&&o.enable(20),g.push(o.mask)}function C(g){const S=E[g.type];let O;if(S){const H=kt[S];O=_i.clone(H.uniforms)}else O=g.uniforms;return O}function w(g,S){let O;for(let H=0,k=d.length;H<k;H++){const j=d[H];if(j.cacheKey===S){O=j,++O.usedTimes;break}}return O===void 0&&(O=new xd(i,S,g,s),d.push(O)),O}function b(g){if(--g.usedTimes===0){const S=d.indexOf(g);d[S]=d[d.length-1],d.pop(),g.destroy()}}function I(g){l.remove(g)}function K(){l.dispose()}return{getParameters:f,getProgramCacheKey:T,getUniforms:C,acquireProgram:w,releaseProgram:b,releaseShaderCache:I,programs:d,dispose:K}}function Td(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Ad(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function ja(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Ja(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,p,m,v,E,h){let f=i[e];return f===void 0?(f={id:u.id,object:u,geometry:p,material:m,groupOrder:v,renderOrder:u.renderOrder,z:E,group:h},i[e]=f):(f.id=u.id,f.object=u,f.geometry=p,f.material=m,f.groupOrder=v,f.renderOrder=u.renderOrder,f.z=E,f.group=h),e++,f}function o(u,p,m,v,E,h){const f=a(u,p,m,v,E,h);m.transmission>0?n.push(f):m.transparent===!0?r.push(f):t.push(f)}function l(u,p,m,v,E,h){const f=a(u,p,m,v,E,h);m.transmission>0?n.unshift(f):m.transparent===!0?r.unshift(f):t.unshift(f)}function c(u,p){t.length>1&&t.sort(u||Ad),n.length>1&&n.sort(p||ja),r.length>1&&r.sort(p||ja)}function d(){for(let u=e,p=i.length;u<p;u++){const m=i[u];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:d,sort:c}}function bd(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Ja,i.set(n,[a])):r>=s.length?(a=new Ja,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function wd(){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 N,color:new We};break;case"SpotLight":t={position:new N,direction:new N,color:new We,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new We,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new We,groundColor:new We};break;case"RectAreaLight":t={color:new We,position:new N,halfWidth:new N,halfHeight:new N};break}return i[e.id]=t,t}}}function Rd(){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 He};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Cd=0;function Pd(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Ld(i){const e=new wd,t=Rd(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new N);const r=new N,s=new tt,a=new tt;function o(c){let d=0,u=0,p=0;for(let K=0;K<9;K++)n.probe[K].set(0,0,0);let m=0,v=0,E=0,h=0,f=0,T=0,x=0,y=0,C=0,w=0,b=0;c.sort(Pd);for(let K=0,g=c.length;K<g;K++){const S=c[K],O=S.color,H=S.intensity,k=S.distance,j=S.shadow&&S.shadow.map?S.shadow.map.texture:null;if(S.isAmbientLight)d+=O.r*H,u+=O.g*H,p+=O.b*H;else if(S.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(S.sh.coefficients[z],H);b++}else if(S.isDirectionalLight){const z=e.get(S);if(z.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){const X=S.shadow,D=t.get(S);D.shadowIntensity=X.intensity,D.shadowBias=X.bias,D.shadowNormalBias=X.normalBias,D.shadowRadius=X.radius,D.shadowMapSize=X.mapSize,n.directionalShadow[m]=D,n.directionalShadowMap[m]=j,n.directionalShadowMatrix[m]=S.shadow.matrix,T++}n.directional[m]=z,m++}else if(S.isSpotLight){const z=e.get(S);z.position.setFromMatrixPosition(S.matrixWorld),z.color.copy(O).multiplyScalar(H),z.distance=k,z.coneCos=Math.cos(S.angle),z.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),z.decay=S.decay,n.spot[E]=z;const X=S.shadow;if(S.map&&(n.spotLightMap[C]=S.map,C++,X.updateMatrices(S),S.castShadow&&w++),n.spotLightMatrix[E]=X.matrix,S.castShadow){const D=t.get(S);D.shadowIntensity=X.intensity,D.shadowBias=X.bias,D.shadowNormalBias=X.normalBias,D.shadowRadius=X.radius,D.shadowMapSize=X.mapSize,n.spotShadow[E]=D,n.spotShadowMap[E]=j,y++}E++}else if(S.isRectAreaLight){const z=e.get(S);z.color.copy(O).multiplyScalar(H),z.halfWidth.set(S.width*.5,0,0),z.halfHeight.set(0,S.height*.5,0),n.rectArea[h]=z,h++}else if(S.isPointLight){const z=e.get(S);if(z.color.copy(S.color).multiplyScalar(S.intensity),z.distance=S.distance,z.decay=S.decay,S.castShadow){const X=S.shadow,D=t.get(S);D.shadowIntensity=X.intensity,D.shadowBias=X.bias,D.shadowNormalBias=X.normalBias,D.shadowRadius=X.radius,D.shadowMapSize=X.mapSize,D.shadowCameraNear=X.camera.near,D.shadowCameraFar=X.camera.far,n.pointShadow[v]=D,n.pointShadowMap[v]=j,n.pointShadowMatrix[v]=S.shadow.matrix,x++}n.point[v]=z,v++}else if(S.isHemisphereLight){const z=e.get(S);z.skyColor.copy(S.color).multiplyScalar(H),z.groundColor.copy(S.groundColor).multiplyScalar(H),n.hemi[f]=z,f++}}h>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=se.LTC_FLOAT_1,n.rectAreaLTC2=se.LTC_FLOAT_2):(n.rectAreaLTC1=se.LTC_HALF_1,n.rectAreaLTC2=se.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=u,n.ambient[2]=p;const I=n.hash;(I.directionalLength!==m||I.pointLength!==v||I.spotLength!==E||I.rectAreaLength!==h||I.hemiLength!==f||I.numDirectionalShadows!==T||I.numPointShadows!==x||I.numSpotShadows!==y||I.numSpotMaps!==C||I.numLightProbes!==b)&&(n.directional.length=m,n.spot.length=E,n.rectArea.length=h,n.point.length=v,n.hemi.length=f,n.directionalShadow.length=T,n.directionalShadowMap.length=T,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=T,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=y+C-w,n.spotLightMap.length=C,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=b,I.directionalLength=m,I.pointLength=v,I.spotLength=E,I.rectAreaLength=h,I.hemiLength=f,I.numDirectionalShadows=T,I.numPointShadows=x,I.numSpotShadows=y,I.numSpotMaps=C,I.numLightProbes=b,n.version=Cd++)}function l(c,d){let u=0,p=0,m=0,v=0,E=0;const h=d.matrixWorldInverse;for(let f=0,T=c.length;f<T;f++){const x=c[f];if(x.isDirectionalLight){const y=n.directional[u];y.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(h),u++}else if(x.isSpotLight){const y=n.spot[m];y.position.setFromMatrixPosition(x.matrixWorld),y.position.applyMatrix4(h),y.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(h),m++}else if(x.isRectAreaLight){const y=n.rectArea[v];y.position.setFromMatrixPosition(x.matrixWorld),y.position.applyMatrix4(h),a.identity(),s.copy(x.matrixWorld),s.premultiply(h),a.extractRotation(s),y.halfWidth.set(x.width*.5,0,0),y.halfHeight.set(0,x.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),v++}else if(x.isPointLight){const y=n.point[p];y.position.setFromMatrixPosition(x.matrixWorld),y.position.applyMatrix4(h),p++}else if(x.isHemisphereLight){const y=n.hemi[E];y.direction.setFromMatrixPosition(x.matrixWorld),y.direction.transformDirection(h),E++}}}return{setup:o,setupView:l,state:n}}function Qa(i){const e=new Ld(i),t=[],n=[];function r(d){c.camera=d,t.length=0,n.length=0}function s(d){t.push(d)}function a(d){n.push(d)}function o(){e.setup(t)}function l(d){e.setupView(t,d)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Dd(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Qa(i),e.set(r,[o])):s>=a.length?(o=new Qa(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Ud extends ri{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=wl,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 Id extends ri{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 Nd=`void main() { 3788 gl_Position = vec4( position, 1.0 ); 3789}`,Fd=`uniform sampler2D shadow_pass; 3790uniform vec2 resolution; 3791uniform float radius; 3792#include <packing> 3793void main() {
3794 const float samples = float( VSM_SAMPLES ); 3795 float mean = 0.0; 3796 float squared_mean = 0.0; 3797 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3798 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3799 for ( float i = 0.0; i < samples; i ++ ) { 3800 float uvOffset = uvStart + i * uvStride; 3801 #ifdef HORIZONTAL_PASS 3802 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3803 mean += distribution.x; 3804 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3805 #else 3806 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3807 mean += depth; 3808 squared_mean += depth * depth; 3809 #endif 3810 } 3811 mean = mean / samples; 3812 squared_mean = squared_mean / samples; 3813 float std_dev = sqrt( squared_mean - mean * mean ); 3814 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3815}`;function Od(i,e,t){let n=new Go;const r=new He,s=new He,a=new it,o=new Ud({depthPacking:Rl}),l=new Id,c={},d=t.maxTextureSize,u={[mn]:St,[St]:mn,[Qt]:Qt},p=new ht({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:Nd,fragmentShader:Fd}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new wt;v.setAttribute("position",new et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new zt(v,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=uo;let f=this.type;this.render=function(w,b,I){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||w.length===0)return;const K=i.getRenderTarget(),g=i.getActiveCubeFace(),S=i.getActiveMipmapLevel(),O=i.state;O.setBlending(nn),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const H=f!==Jt&&this.type===Jt,k=f===Jt&&this.type!==Jt;for(let j=0,z=w.length;j<z;j++){const X=w[j],D=X.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",X,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;r.copy(D.mapSize);const $=D.getFrameExtents();if(r.multiply($),s.copy(D.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/$.x),r.x=s.x*$.x,D.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/$.y),r.y=s.y*$.y,D.mapSize.y=s.y)),D.map===null||H===!0||k===!0){const Q=this.type!==Jt?{minFilter:Lt,magFilter:Lt}:{};D.map!==null&&D.map.dispose(),D.map=new Ht(r.x,r.y,Q),D.map.texture.name=X.name+".shadowMap",D.camera.updateProjectionMatrix()}i.setRenderTarget(D.map),i.clear();const te=D.getViewportCount();for(let Q=0;Q<te;Q++){const xe=D.getViewport(Q);a.set(s.x*xe.x,s.y*xe.y,s.x*xe.z,s.y*xe.w),O.viewport(a),D.updateMatrices(X,Q),n=D.getFrustum(),y(b,I,D.camera,X,this.type)}D.isPointLightShadow!==!0&&this.type===Jt&&T(D,I),D.needsUpdate=!1}f=this.type,h.needsUpdate=!1,i.setRenderTarget(K,g,S)};function T(w,b){const I=e.update(E);p.defines.VSM_SAMPLES!==w.blurSamples&&(p.defines.VSM_SAMPLES=w.blurSamples,m.defines.VSM_SAMPLES=w.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new Ht(r.x,r.y)),p.uniforms.shadow_pass.value=w.map.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(b,null,I,p,E,null),m.uniforms.shadow_pass.value=w.mapPass.texture,m.uniforms.resolution.value=w.mapSize,m.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(b,null,I,m,E,null)}function x(w,b,I,K){let g=null;const S=I.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(S!==void 0)g=S;else if(g=I.isPointLight===!0?l:o,i.localClippingEnabled&&b.clipShadows===!0&&Array.isArray(b.clippingPlanes)&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0||b.map&&b.alphaTest>0){const O=g.uuid,H=b.uuid;let k=c[O];k===void 0&&(k={},c[O]=k);let j=k[H];j===void 0&&(j=g.clone(),k[H]=j,b.addEventListener("dispose",C)),g=j}if(g.visible=b.visible,g.wireframe=b.wireframe,K===Jt?g.side=b.shadowSide!==null?b.shadowSide:b.side:g.side=b.shadowSide!==null?b.shadowSide:u[b.side],g.alphaMap=b.alphaMap,g.alphaTest=b.alphaTest,g.map=b.map,g.clipSh
vendor: 5,544 bytes, line 3815
3815adows=b.clipShadows,g.clippingPlanes=b.clippingPlanes,g.clipIntersection=b.clipIntersection,g.displacementMap=b.displacementMap,g.displacementScale=b.displacementScale,g.displacementBias=b.displacementBias,g.wireframeLinewidth=b.wireframeLinewidth,g.linewidth=b.linewidth,I.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const O=i.properties.get(g);O.light=I}return g}function y(w,b,I,K,g){if(w.visible===!1)return;if(w.layers.test(b.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&g===Jt)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,w.matrixWorld);const H=e.update(w),k=w.material;if(Array.isArray(k)){const j=H.groups;for(let z=0,X=j.length;z<X;z++){const D=j[z],$=k[D.materialIndex];if($&&$.visible){const te=x(w,$,K,g);w.onBeforeShadow(i,w,b,I,H,te,D),i.renderBufferDirect(I,null,H,te,w,D),w.onAfterShadow(i,w,b,I,H,te,D)}}}else if(k.visible){const j=x(w,k,K,g);w.onBeforeShadow(i,w,b,I,H,j,null),i.renderBufferDirect(I,null,H,j,w,null),w.onAfterShadow(i,w,b,I,H,j,null)}}const O=w.children;for(let H=0,k=O.length;H<k;H++)y(O[H],b,I,K,g)}function C(w){w.target.removeEventListener("dispose",C);for(const I in c){const K=c[I],g=w.target.uuid;g in K&&(K[g].dispose(),delete K[g])}}}const Bd={[ns]:is,[rs]:os,[ss]:ls,[Zn]:as,[is]:ns,[os]:rs,[ls]:ss,[as]:Zn};function zd(i){function e(){let P=!1;const ue=new it;let W=null;const Z=new it(0,0,0,0);return{setMask:function(le){W!==le&&!P&&(i.colorMask(le,le,le,le),W=le)},setLocked:function(le){P=le},setClear:function(le,ce,Ve,fe,Fe){Fe===!0&&(le*=fe,ce*=fe,Ve*=fe),ue.set(le,ce,Ve,fe),Z.equals(ue)===!1&&(i.clearColor(le,ce,Ve,fe),Z.copy(ue))},reset:function(){P=!1,W=null,Z.set(-1,0,0,0)}}}function t(){let P=!1,ue=!1,W=null,Z=null,le=null;return{setReversed:function(ce){ue=ce},setTest:function(ce){ce?re(i.DEPTH_TEST):oe(i.DEPTH_TEST)},setMask:function(ce){W!==ce&&!P&&(i.depthMask(ce),W=ce)},setFunc:function(ce){if(ue&&(ce=Bd[ce]),Z!==ce){switch(ce){case ns:i.depthFunc(i.NEVER);break;case is:i.depthFunc(i.ALWAYS);break;case rs:i.depthFunc(i.LESS);break;case Zn:i.depthFunc(i.LEQUAL);break;case ss:i.depthFunc(i.EQUAL);break;case as:i.depthFunc(i.GEQUAL);break;case os:i.depthFunc(i.GREATER);break;case ls:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Z=ce}},setLocked:function(ce){P=ce},setClear:function(ce){le!==ce&&(i.clearDepth(ce),le=ce)},reset:function(){P=!1,W=null,Z=null,le=null}}}function n(){let P=!1,ue=null,W=null,Z=null,le=null,ce=null,Ve=null,fe=null,Fe=null;return{setTest:function(Xe){P||(Xe?re(i.STENCIL_TEST):oe(i.STENCIL_TEST))},setMask:function(Xe){ue!==Xe&&!P&&(i.stencilMask(Xe),ue=Xe)},setFunc:function(Xe,vt,qt){(W!==Xe||Z!==vt||le!==qt)&&(i.stencilFunc(Xe,vt,qt),W=Xe,Z=vt,le=qt)},setOp:function(Xe,vt,qt){(ce!==Xe||Ve!==vt||fe!==qt)&&(i.stencilOp(Xe,vt,qt),ce=Xe,Ve=vt,fe=qt)},setLocked:function(Xe){P=Xe},setClear:function(Xe){Fe!==Xe&&(i.clearStencil(Xe),Fe=Xe)},reset:function(){P=!1,ue=null,W=null,Z=null,le=null,ce=null,Ve=null,fe=null,Fe=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},d={},u=new WeakMap,p=[],m=null,v=!1,E=null,h=null,f=null,T=null,x=null,y=null,C=null,w=new We(0,0,0),b=0,I=!1,K=null,g=null,S=null,O=null,H=null;const k=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let j=!1,z=0;const X=i.getParameter(i.VERSION);X.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL (\d)/.exec(X)[1]),j=z>=1):X.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),j=z>=2);let D=null,$={};const te=i.getParameter(i.SCISSOR_BOX),Q=i.getParameter(i.VIEWPORT),xe=new it().fromArray(te),Se=new it().fromArray(Q);function F(P,ue,W,Z){const le=new Uint8Array(4),ce=i.createTexture();i.bindTexture(P,ce),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ve=0;Ve<W;Ve++)P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY?i.texImage3D(ue,0,i.RGBA,1,1,Z,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(ue+Ve,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return ce}const J={};J[i.TEXTURE_2D]=F(i.TEXTURE_2D,i.TEXTURE_2D,1),J[i.TEXTURE_CUBE_MAP]=F(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[i.TEXTURE_2D_ARRAY]=F(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),J[i.TEXTURE_3D]=F(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),re(i.DEPTH_TEST),s.setFunc(Zn),Ie(!1),ke(la),re(i.CULL_FACE),R(nn);function re(P){c[P]!==!0&&(i.enable(P),c[P]=!0)}function oe(P){c[P]!==!1&&(i.disable(P),c[P]=!1)}function Ce(P,ue){return d[P]!==ue?(i.bindFramebuffer(P,ue),d[P]=ue,P===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=ue),P===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=ue),!0):!1}function ye(P,ue){let W=p,Z=!1;if(P){W=u.get(ue),W===void 0&&(W=[],u.set(ue,W));const le=P.textures;if(W.length!==le.length||W[0]!==i.COLOR_ATTACHMENT0){for(let ce=0,Ve=le.length;ce<Ve;ce++)W[ce]=i.COLOR_ATTACHMENT0+ce;W.length=le.length,Z=!0}}else W[0]!==i.BACK&&(W[0]=i.BACK,Z=!0);Z&&i.drawBuffers(W)}function Ge(P){return m!==P?(i.useProgram(P),m=P,!0):!1}const Pe={[An]:i.FUNC_ADD,[al]:i.FUNC_SUBTRACT,[ol]:i.FUNC_REVERSE_SUBTRACT};Pe[ll]=i.MIN,Pe[cl]=i.MAX;const Ue={[ul]:i.ZERO,[hl]:i.ONE,[fl]:i.SRC_COLOR,[es]:i.SRC_ALPHA,[vl]:i.SRC_ALPHA_SATURATE,[gl]:i.DST_COLOR,[pl]:i.DST_ALPHA,[dl]:i.ONE_MINUS_SRC_COLOR,[ts]:i.ONE_MINUS_SRC_ALPHA,[_l]:i.ONE_MINUS_DST_COLOR,[ml]:i.ONE_MINUS_DST_ALPHA,[xl]:i.CONSTANT_COLOR,[Ml]:i.ONE_MINUS_CONSTANT_COLOR,[Sl]:i.CONSTANT_ALPHA,[El]:i.ONE_MINUS_CONSTANT_ALPHA};function R(P,ue,W,Z,le,ce,Ve,fe,Fe,Xe){if(P===nn){v===!0&&(oe(i.BLEND),v=!1);return}
vendor: 4,524 bytes, line 3815
3815if(v===!1&&(re(i.BLEND),v=!0),P!==sl){if(P!==E||Xe!==I){if((h!==An||x!==An)&&(i.blendEquation(i.FUNC_ADD),h=An,x=An),Xe)switch(P){case qn:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Yn:i.blendFunc(i.ONE,i.ONE);break;case ca:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ua:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}else switch(P){case qn:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Yn:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case ca:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ua:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}f=null,T=null,y=null,C=null,w.set(0,0,0),b=0,E=P,I=Xe}return}le=le||ue,ce=ce||W,Ve=Ve||Z,(ue!==h||le!==x)&&(i.blendEquationSeparate(Pe[ue],Pe[le]),h=ue,x=le),(W!==f||Z!==T||ce!==y||Ve!==C)&&(i.blendFuncSeparate(Ue[W],Ue[Z],Ue[ce],Ue[Ve]),f=W,T=Z,y=ce,C=Ve),(fe.equals(w)===!1||Fe!==b)&&(i.blendColor(fe.r,fe.g,fe.b,Fe),w.copy(fe),b=Fe),E=P,I=!1}function rt(P,ue){P.side===Qt?oe(i.CULL_FACE):re(i.CULL_FACE);let W=P.side===St;ue&&(W=!W),Ie(W),P.blending===qn&&P.transparent===!1?R(nn):R(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),s.setFunc(P.depthFunc),s.setTest(P.depthTest),s.setMask(P.depthWrite),r.setMask(P.colorWrite);const Z=P.stencilWrite;a.setTest(Z),Z&&(a.setMask(P.stencilWriteMask),a.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),a.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),Ye(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?re(i.SAMPLE_ALPHA_TO_COVERAGE):oe(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ie(P){K!==P&&(P?i.frontFace(i.CW):i.frontFace(i.CCW),K=P)}function ke(P){P!==nl?(re(i.CULL_FACE),P!==g&&(P===la?i.cullFace(i.BACK):P===il?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):oe(i.CULL_FACE),g=P}function Ae(P){P!==S&&(j&&i.lineWidth(P),S=P)}function Ye(P,ue,W){P?(re(i.POLYGON_OFFSET_FILL),(O!==ue||H!==W)&&(i.polygonOffset(ue,W),O=ue,H=W)):oe(i.POLYGON_OFFSET_FILL)}function be(P){P?re(i.SCISSOR_TEST):oe(i.SCISSOR_TEST)}function A(P){P===void 0&&(P=i.TEXTURE0+k-1),D!==P&&(i.activeTexture(P),D=P)}function _(P,ue,W){W===void 0&&(D===null?W=i.TEXTURE0+k-1:W=D);let Z=$[W];Z===void 0&&(Z={type:void 0,texture:void 0},$[W]=Z),(Z.type!==P||Z.texture!==ue)&&(D!==W&&(i.activeTexture(W),D=W),i.bindTexture(P,ue||J[P]),Z.type=P,Z.texture=ue)}function B(){const P=$[D];P!==void 0&&P.type!==void 0&&(i.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function Y(){try{i.compressedTexImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ee(){try{i.compressedTexImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function q(){try{i.texSubImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ge(){try{i.texSubImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function de(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Be(){try{i.texStorage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ne(){try{i.texStorage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function pe(){try{i.texImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function we(){try{i.texImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Te(P){xe.equals(P)===!1&&(i.scissor(P.x,P.y,P.z,P.w),xe.copy(P))}function me(P){Se.equals(P)===!1&&(i.viewport(P.x,P.y,P.z,P.w),Se.copy(P))}function ze(P,ue){let W=l.get(ue);W===void 0&&(W=new WeakMap,l.set(ue,W));let Z=W.get(P);Z===void 0&&(Z=i.getUniformBlockIndex(ue,P.name),W.set(P,Z))}function Le(P,ue){const Z=l.get(ue).get(P);o.get(ue)!==Z&&(i.uniformBlockBinding(ue,Z,P.__bindingPointIndex),o.set(ue,Z))}function Ze(){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: 7,597 bytes, line 3815
3815(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},D=null,$={},d={},u=new WeakMap,p=[],m=null,v=!1,E=null,h=null,f=null,T=null,x=null,y=null,C=null,w=new We(0,0,0),b=0,I=!1,K=null,g=null,S=null,O=null,H=null,xe.set(0,0,i.canvas.width,i.canvas.height),Se.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:re,disable:oe,bindFramebuffer:Ce,drawBuffers:ye,useProgram:Ge,setBlending:R,setMaterial:rt,setFlipSided:Ie,setCullFace:ke,setLineWidth:Ae,setPolygonOffset:Ye,setScissorTest:be,activeTexture:A,bindTexture:_,unbindTexture:B,compressedTexImage2D:Y,compressedTexImage3D:ee,texImage2D:pe,texImage3D:we,updateUBOMapping:ze,uniformBlockBinding:Le,texStorage2D:Be,texStorage3D:ne,texSubImage2D:q,texSubImage3D:ge,compressedTexSubImage2D:ae,compressedTexSubImage3D:de,scissor:Te,viewport:me,reset:Ze}}function eo(i,e,t,n){const r=Hd(n);switch(t){case yo:return i*e;case Ao:return i*e;case bo:return i*e*2;case wo:return i*e/r.components*r.byteLength;case qs:return i*e/r.components*r.byteLength;case Ro:return i*e*2/r.components*r.byteLength;case Ys:return i*e*2/r.components*r.byteLength;case To:return i*e*3/r.components*r.byteLength;case Bt:return i*e*4/r.components*r.byteLength;case Ks:return i*e*4/r.components*r.byteLength;case Ji:case Qi:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case er:case tr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ps:case gs:return Math.max(i,16)*Math.max(e,8)/4;case ds:case ms:return Math.max(i,8)*Math.max(e,8)/2;case _s:case vs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case xs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ms:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ss:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Es:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case ys:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Ts:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case As:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case bs:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ws:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Rs:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Cs:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Ps:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Ls:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Ds:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Us:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case nr:case Is:case Ns:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Co:case Fs:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Os:case Bs:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Hd(i){switch(i){case sn:case Mo:return{byteLength:1,components:1};case gi:case So:case rn:return{byteLength:2,components:1};case Ws:case Xs:return{byteLength:2,components:4};case Cn:case ks:case en:return{byteLength:4,components:1};case Eo:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function Gd(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new He,d=new WeakMap;let u;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(A,_){return m?new OffscreenCanvas(A,_):cr("canvas")}function E(A,_,B){let Y=1;const ee=be(A);if((ee.width>B||ee.height>B)&&(Y=B/Math.max(ee.width,ee.height)),Y<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const q=Math.floor(Y*ee.width),ge=Math.floor(Y*ee.height);u===void 0&&(u=v(q,ge));const ae=_?v(q,ge):u;return ae.width=q,ae.height=ge,ae.getContext("2d").drawImage(A,0,0,q,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ee.width+"x"+ee.height+") to ("+q+"x"+ge+")."),ae}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ee.width+"x"+ee.height+")."),A;return A}function h(A){return A.generateMipmaps&&A.minFilter!==Lt&&A.minFilter!==Ft}function f(A){i.generateMipmap(A)}function T(A,_,B,Y,ee=!1){if(A!==null){if(i[A]!==void 0)return i[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let q=_;if(_===i.RED&&(B===i.FLOAT&&(q=i.R32F),B===i.HALF_FLOAT&&(q=i.R16F),B===i.UNSIGNED_BYTE&&(q=i.R8)),_===i.RED_INTEGER&&(B===i.UNSIGNED_BYTE&&(q=i.R8UI),B===i.UNSIGNED_SHORT&&(q=i.R16UI),B===i.UNSIGNED_INT&&(q=i.R32UI),B===i.BYTE&&(q=i.R8I),B===i.SHORT&&(q=i.R16I),B===i.INT&&(q=i.R32I)),_===i.RG&&(B===i.FLOAT&&(q=i.RG32F),B===i.HALF_FLOAT&&(q=i.RG16F),B===i.UNSIGNED_BYTE&&(q=i.RG8)),_===i.RG_INTEGER&&(B===i.UNSIGNED_BYTE&&(q=i.RG8UI),B===i.UNSIGNED_SHORT&&(q=i.RG16UI),B===i.UNSIGNED_INT&&(q=i.RG32UI),B===i.BYTE&&(q=i.RG8I),B===i.SHORT&&(q=i.RG16I),B===i.INT&&(q=i.RG32I)),_===i.RGB_INTEGER&&(B===i.UNSIGNED_BYTE&&(q=i.RGB8UI),B===i.UNSIGNED_SHORT&&(q=i.RGB16UI),B===i.UNSIGNED_INT&&(q=i.RGB32UI),B===i.BYTE&&(q=i.RGB8I),B===i.SHORT&&(q=i.RGB16I),B===i.INT&&(q=i.RGB32I)),_===i.RGBA_INTEGER&&(B===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),B===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),B===i.UNSIGNED_INT&&(q=i.RGBA32UI),B===i.BYTE&&(q=i.RGBA8I),B===i.SHORT&&(q=i.RGBA16I),B===i.INT&&(q=i.RGBA32I)),_===i.RGB&&B===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),_===i.RGBA){const ge=ee?sr:qe.getTransfer(Y);B===i.FLOAT&&(q=i.RGBA32F),B===i.HALF_FLOAT&&(q=i.RGBA16F),B===i.UNSIGNED_BYTE&&(q=ge===Je?i.SRGB8_ALPHA8:i.RGBA8),B===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),B===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function x(A,_){let B;return A?_===null||_===Cn||_===Qn?B=i.DEPTH24_STENCIL8:_===en?B=i.DEPTH32F_STENCIL8:_===gi&&(B=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Cn||_===Qn?B=i.DEPTH_COMPONENT24:_===en?B=i.DEPTH_COMPONENT32F:_===gi&&(B=i.DEPTH_COMPONENT16),B}function y(A,_){return h(A)===!0||A.isFramebufferTexture&&A.minFilter!==Lt&&A.minFilter!==Ft?Math.log2(Math.max(_.width,_.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?_.mipmaps.length:1}function C(A){const _=A.target;_.removeEventListener("dispose",C),b(_),_.isVideoTexture&&d.delete(_)}function w(A){const _=A.target;_.removeEventListener("dispose",w),K(_)}function b(A){const _=n.get(A);if(_.__webglInit===void 0)return;const B=A.source,Y=p.get(B);if(Y){const ee=Y[_.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&I(A),Object.keys(Y).length===0&&p.delete(B)}n.remove(A)}function I(A){const _=n.get(A);i.deleteTexture(_.__webglTexture);const B=A.source,Y=p.get(B);delete Y[_.__cacheKey],a.memory.textures--}function K(A){const _=n.get(A);
vendor: 4,558 bytes, line 3815
3815if(A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(_.__webglFramebuffer[Y]))for(let ee=0;ee<_.__webglFramebuffer[Y].length;ee++)i.deleteFramebuffer(_.__webglFramebuffer[Y][ee]);else i.deleteFramebuffer(_.__webglFramebuffer[Y]);_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer[Y])}else{if(Array.isArray(_.__webglFramebuffer))for(let Y=0;Y<_.__webglFramebuffer.length;Y++)i.deleteFramebuffer(_.__webglFramebuffer[Y]);else i.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&i.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let Y=0;Y<_.__webglColorRenderbuffer.length;Y++)_.__webglColorRenderbuffer[Y]&&i.deleteRenderbuffer(_.__webglColorRenderbuffer[Y]);_.__webglDepthRenderbuffer&&i.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const B=A.textures;for(let Y=0,ee=B.length;Y<ee;Y++){const q=n.get(B[Y]);q.__webglTexture&&(i.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(B[Y])}n.remove(A)}let g=0;function S(){g=0}function O(){const A=g;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),g+=1,A}function H(A){const _=[];return _.push(A.wrapS),_.push(A.wrapT),_.push(A.wrapR||0),_.push(A.magFilter),_.push(A.minFilter),_.push(A.anisotropy),_.push(A.internalFormat),_.push(A.format),_.push(A.type),_.push(A.generateMipmaps),_.push(A.premultiplyAlpha),_.push(A.flipY),_.push(A.unpackAlignment),_.push(A.colorSpace),_.join()}function k(A,_){const B=n.get(A);if(A.isVideoTexture&&Ae(A),A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){const Y=A.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Se(B,A,_);return}}t.bindTexture(i.TEXTURE_2D,B.__webglTexture,i.TEXTURE0+_)}function j(A,_){const B=n.get(A);if(A.version>0&&B.__version!==A.version){Se(B,A,_);return}t.bindTexture(i.TEXTURE_2D_ARRAY,B.__webglTexture,i.TEXTURE0+_)}function z(A,_){const B=n.get(A);if(A.version>0&&B.__version!==A.version){Se(B,A,_);return}t.bindTexture(i.TEXTURE_3D,B.__webglTexture,i.TEXTURE0+_)}function X(A,_){const B=n.get(A);if(A.version>0&&B.__version!==A.version){F(B,A,_);return}t.bindTexture(i.TEXTURE_CUBE_MAP,B.__webglTexture,i.TEXTURE0+_)}const D={[hs]:i.REPEAT,[wn]:i.CLAMP_TO_EDGE,[fs]:i.MIRRORED_REPEAT},$={[Lt]:i.NEAREST,[bl]:i.NEAREST_MIPMAP_NEAREST,[Ai]:i.NEAREST_MIPMAP_LINEAR,[Ft]:i.LINEAR,[Er]:i.LINEAR_MIPMAP_NEAREST,[Rn]:i.LINEAR_MIPMAP_LINEAR},te={[Ll]:i.NEVER,[Ol]:i.ALWAYS,[Dl]:i.LESS,[Po]:i.LEQUAL,[Ul]:i.EQUAL,[Fl]:i.GEQUAL,[Il]:i.GREATER,[Nl]:i.NOTEQUAL};function Q(A,_){if(_.type===en&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Ft||_.magFilter===Er||_.magFilter===Ai||_.magFilter===Rn||_.minFilter===Ft||_.minFilter===Er||_.minFilter===Ai||_.minFilter===Rn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(A,i.TEXTURE_WRAP_S,D[_.wrapS]),i.texParameteri(A,i.TEXTURE_WRAP_T,D[_.wrapT]),(A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY)&&i.texParameteri(A,i.TEXTURE_WRAP_R,D[_.wrapR]),i.texParameteri(A,i.TEXTURE_MAG_FILTER,$[_.magFilter]),i.texParameteri(A,i.TEXTURE_MIN_FILTER,$[_.minFilter]),_.compareFunction&&(i.texParameteri(A,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(A,i.TEXTURE_COMPARE_FUNC,te[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Lt||_.minFilter!==Ai&&_.minFilter!==Rn||_.type===en&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||n.get(_).__currentAnisotropy){const B=e.get("EXT_texture_filter_anisotropic");i.texParameterf(A,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy}}}function xe(A,_){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,_.addEventListener("dispose",C));const Y=_.source;let ee=p.get(Y);ee===void 0&&(ee={},p.set(Y,ee));const q=H(_);if(q!==A.__cacheKey){ee[q]===void 0&&(ee[q]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,B=!0),ee[q].usedTimes++;const ge=ee[A.__cacheKey];ge!==void 0&&(ee[A.__cacheKey].usedTimes--,ge.usedTimes===0&&I(_)),A.__cacheKey=q,A.__webglTexture=ee[q].texture}return B}function Se(A,_,B){let Y=i.TEXTURE_2D;
vendor: 5,011 bytes, line 3815
3815(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),_.isData3DTexture&&(Y=i.TEXTURE_3D);const ee=xe(A,_),q=_.source;t.bindTexture(Y,A.__webglTexture,i.TEXTURE0+B);const ge=n.get(q);if(q.version!==ge.__version||ee===!0){t.activeTexture(i.TEXTURE0+B);const ae=qe.getPrimaries(qe.workingColorSpace),de=_.colorSpace===dn?null:qe.getPrimaries(_.colorSpace),Be=_.colorSpace===dn||ae===de?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let ne=E(_.image,!1,r.maxTextureSize);ne=Ye(_,ne);const pe=s.convert(_.format,_.colorSpace),we=s.convert(_.type);let Te=T(_.internalFormat,pe,we,_.colorSpace,_.isVideoTexture);Q(Y,_);let me;const ze=_.mipmaps,Le=_.isVideoTexture!==!0,Ze=ge.__version===void 0||ee===!0,P=q.dataReady,ue=y(_,ne);if(_.isDepthTexture)Te=x(_.format===ei,_.type),Ze&&(Le?t.texStorage2D(i.TEXTURE_2D,1,Te,ne.width,ne.height):t.texImage2D(i.TEXTURE_2D,0,Te,ne.width,ne.height,0,pe,we,null));else if(_.isDataTexture)if(ze.length>0){Le&&Ze&&t.texStorage2D(i.TEXTURE_2D,ue,Te,ze[0].width,ze[0].height);for(let W=0,Z=ze.length;W<Z;W++)me=ze[W],Le?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,me.width,me.height,pe,we,me.data):t.texImage2D(i.TEXTURE_2D,W,Te,me.width,me.height,0,pe,we,me.data);_.generateMipmaps=!1}else Le?(Ze&&t.texStorage2D(i.TEXTURE_2D,ue,Te,ne.width,ne.height),P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ne.width,ne.height,pe,we,ne.data)):t.texImage2D(i.TEXTURE_2D,0,Te,ne.width,ne.height,0,pe,we,ne.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){Le&&Ze&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ue,Te,ze[0].width,ze[0].height,ne.depth);for(let W=0,Z=ze.length;W<Z;W++)if(me=ze[W],_.format!==Bt)if(pe!==null)if(Le){if(P)if(_.layerUpdates.size>0){const le=eo(me.width,me.height,_.format,_.type);for(const ce of _.layerUpdates){const Ve=me.data.subarray(ce*le/me.data.BYTES_PER_ELEMENT,(ce+1)*le/me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,ce,me.width,me.height,1,pe,Ve,0,0)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,me.width,me.height,ne.depth,pe,me.data,0,0)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,W,Te,me.width,me.height,ne.depth,0,me.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Le?P&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,me.width,me.height,ne.depth,pe,we,me.data):t.texImage3D(i.TEXTURE_2D_ARRAY,W,Te,me.width,me.height,ne.depth,0,pe,we,me.data)}else{Le&&Ze&&t.texStorage2D(i.TEXTURE_2D,ue,Te,ze[0].width,ze[0].height);for(let W=0,Z=ze.length;W<Z;W++)me=ze[W],_.format!==Bt?pe!==null?Le?P&&t.compressedTexSubImage2D(i.TEXTURE_2D,W,0,0,me.width,me.height,pe,me.data):t.compressedTexImage2D(i.TEXTURE_2D,W,Te,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Le?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,me.width,me.height,pe,we,me.data):t.texImage2D(i.TEXTURE_2D,W,Te,me.width,me.height,0,pe,we,me.data)}else if(_.isDataArrayTexture)if(Le){if(Ze&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ue,Te,ne.width,ne.height,ne.depth),P)if(_.layerUpdates.size>0){const W=eo(ne.width,ne.height,_.format,_.type);for(const Z of _.layerUpdates){const le=ne.data.subarray(Z*W/ne.data.BYTES_PER_ELEMENT,(Z+1)*W/ne.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Z,ne.width,ne.height,1,pe,we,le)}_.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ne.width,ne.height,ne.depth,pe,we,ne.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,ne.width,ne.height,ne.depth,0,pe,we,ne.data);else if(_.isData3DTexture)Le?(Ze&&t.texStorage3D(i.TEXTURE_3D,ue,Te,ne.width,ne.height,ne.depth),P&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ne.width,ne.height,ne.depth,pe,we,ne.data)):t.texImage3D(i.TEXTURE_3D,0,Te,ne.width,ne.height,ne.depth,0,pe,we,ne.data);else if(_.isFramebufferTexture){if(Ze)if(Le)t.texStorage2D(i.TEXTURE_2D,ue,Te,ne.width,ne.height);else{let W=ne.width,Z=ne.height;for(let le=0;le<ue;le++)t.texImage2D(i.TEXTURE_2D,le,Te,W,Z,0,pe,we,null),W>>=1,Z>>=1}}else if(ze.length>0){if(Le&&Ze){const W=be(ze[0]);t.texStorage2D(i.TEXTURE_2D,ue,Te,W.width,W.height)}for(let W=0,Z=ze.length;W<Z;W++)me=ze[W],Le?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,pe,we,me):t.texImage2D(i.TEXTURE_2D,W,Te,pe,we,me);_.generateMipmaps=!1}else if(Le){if(Ze){const W=be(ne);t.texStorage2D(i.TEXTURE_2D,ue,Te,W.width,W.height)}P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,pe,we,ne)}else t.texImage2D(i.TEXTURE_2D,0,Te,pe,we,ne);h(_)&&f(Y),ge.__version=q.version,_.onUpdate&&_.onUpdate(_)}A.__version=_.version}function F(A,_,B){if(_.image.length!==6)return;const Y=xe(A,_),ee=_.source;t.bindTexture(i.TEXTURE_CUBE_MAP,A.__webglTexture,i.TEXTURE0+B);const q=n.get(ee);if(ee.version!==q.__version||Y===!0){t.activeTexture(i.TEXTURE0+B);
vendor: 4,184 bytes, line 3815
3815const ge=qe.getPrimaries(qe.workingColorSpace),ae=_.colorSpace===dn?null:qe.getPrimaries(_.colorSpace),de=_.colorSpace===dn||ge===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,de);const Be=_.isCompressedTexture||_.image[0].isCompressedTexture,ne=_.image[0]&&_.image[0].isDataTexture,pe=[];for(let Z=0;Z<6;Z++)!Be&&!ne?pe[Z]=E(_.image[Z],!0,r.maxCubemapSize):pe[Z]=ne?_.image[Z].image:_.image[Z],pe[Z]=Ye(_,pe[Z]);const we=pe[0],Te=s.convert(_.format,_.colorSpace),me=s.convert(_.type),ze=T(_.internalFormat,Te,me,_.colorSpace),Le=_.isVideoTexture!==!0,Ze=q.__version===void 0||Y===!0,P=ee.dataReady;let ue=y(_,we);Q(i.TEXTURE_CUBE_MAP,_);let W;if(Be){Le&&Ze&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ue,ze,we.width,we.height);for(let Z=0;Z<6;Z++){W=pe[Z].mipmaps;for(let le=0;le<W.length;le++){const ce=W[le];_.format!==Bt?Te!==null?Le?P&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,ce.width,ce.height,Te,ce.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,ze,ce.width,ce.height,0,ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Le?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,ce.width,ce.height,Te,me,ce.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,ze,ce.width,ce.height,0,Te,me,ce.data)}}}else{if(W=_.mipmaps,Le&&Ze){W.length>0&&ue++;const Z=be(pe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ue,ze,Z.width,Z.height)}for(let Z=0;Z<6;Z++)if(ne){Le?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,pe[Z].width,pe[Z].height,Te,me,pe[Z].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,ze,pe[Z].width,pe[Z].height,0,Te,me,pe[Z].data);for(let le=0;le<W.length;le++){const Ve=W[le].image[Z].image;Le?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,Ve.width,Ve.height,Te,me,Ve.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,ze,Ve.width,Ve.height,0,Te,me,Ve.data)}}else{Le?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Te,me,pe[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,ze,Te,me,pe[Z]);for(let le=0;le<W.length;le++){const ce=W[le];Le?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,Te,me,ce.image[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,ze,Te,me,ce.image[Z])}}}h(_)&&f(i.TEXTURE_CUBE_MAP),q.__version=ee.version,_.onUpdate&&_.onUpdate(_)}A.__version=_.version}function J(A,_,B,Y,ee,q){const ge=s.convert(B.format,B.colorSpace),ae=s.convert(B.type),de=T(B.internalFormat,ge,ae,B.colorSpace);if(!n.get(_).__hasExternalTextures){const ne=Math.max(1,_.width>>q),pe=Math.max(1,_.height>>q);ee===i.TEXTURE_3D||ee===i.TEXTURE_2D_ARRAY?t.texImage3D(ee,q,de,ne,pe,_.depth,0,ge,ae,null):t.texImage2D(ee,q,de,ne,pe,0,ge,ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,A),ke(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,ee,n.get(B).__webglTexture,0,Ie(_)):(ee===i.TEXTURE_2D||ee>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,ee,n.get(B).__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function re(A,_,B){if(i.bindRenderbuffer(i.RENDERBUFFER,A),_.depthBuffer){const Y=_.depthTexture,ee=Y&&Y.isDepthTexture?Y.type:null,q=x(_.stencilBuffer,ee),ge=_.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=Ie(_);ke(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ae,q,_.width,_.height):B?i.renderbufferStorageMultisample(i.RENDERBUFFER,ae,q,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,q,_.width,_.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ge,i.RENDERBUFFER,A)}else{const Y=_.textures;for(let ee=0;ee<Y.length;ee++){const q=Y[ee],ge=s.convert(q.format,q.colorSpace),ae=s.convert(q.type),de=T(q.internalFormat,ge,ae,q.colorSpace),Be=Ie(_);B&&ke(_)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Be,de,_.width,_.height):ke(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Be,de,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,de,_.width,_.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}
vendor: 4,111 bytes, line 3815
3815function oe(A,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,A),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(_.depthTexture).__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),k(_.depthTexture,0);const Y=n.get(_.depthTexture).__webglTexture,ee=Ie(_);if(_.depthTexture.format===Kn)ke(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Y,0,ee):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Y,0);else if(_.depthTexture.format===ei)ke(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Y,0,ee):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Y,0);else throw new Error("Unknown depthTexture format")}function Ce(A){const _=n.get(A),B=A.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==A.depthTexture){const Y=A.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),Y){const ee=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,Y.removeEventListener("dispose",ee)};Y.addEventListener("dispose",ee),_.__depthDisposeCallback=ee}_.__boundDepthTexture=Y}if(A.depthTexture&&!_.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");oe(_.__webglFramebuffer,A)}else if(B){_.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[Y]),_.__webglDepthbuffer[Y]===void 0)_.__webglDepthbuffer[Y]=i.createRenderbuffer(),re(_.__webglDepthbuffer[Y],A,!1);else{const ee=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=_.__webglDepthbuffer[Y];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,ee,i.RENDERBUFFER,q)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=i.createRenderbuffer(),re(_.__webglDepthbuffer,A,!1);else{const Y=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ee=_.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Y,i.RENDERBUFFER,ee)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ye(A,_,B){const Y=n.get(A);_!==void 0&&J(Y.__webglFramebuffer,A,A.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),B!==void 0&&Ce(A)}function Ge(A){const _=A.texture,B=n.get(A),Y=n.get(_);A.addEventListener("dispose",w);const ee=A.textures,q=A.isWebGLCubeRenderTarget===!0,ge=ee.length>1;if(ge||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=_.version,a.memory.textures++),q){B.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0){B.__webglFramebuffer[ae]=[];for(let de=0;de<_.mipmaps.length;de++)B.__webglFramebuffer[ae][de]=i.createFramebuffer()}else B.__webglFramebuffer[ae]=i.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){B.__webglFramebuffer=[];for(let ae=0;ae<_.mipmaps.length;ae++)B.__webglFramebuffer[ae]=i.createFramebuffer()}else B.__webglFramebuffer=i.createFramebuffer();if(ge)for(let ae=0,de=ee.length;ae<de;ae++){const Be=n.get(ee[ae]);Be.__webglTexture===void 0&&(Be.__webglTexture=i.createTexture(),a.memory.textures++)}if(A.samples>0&&ke(A)===!1){B.__webglMultisampledFramebuffer=i.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let ae=0;ae<ee.length;ae++){const de=ee[ae];B.__webglColorRenderbuffer[ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,B.__webglColorRenderbuffer[ae]);const Be=s.convert(de.format,de.colorSpace),ne=s.convert(de.type),pe=T(de.internalFormat,Be,ne,de.colorSpace,A.isXRRenderTarget===!0),we=Ie(A);i.renderbufferStorageMultisample(i.RENDERBUFFER,we,pe,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ae,i.RENDERBUFFER,B.__webglColorRen
vendor: 1,104 bytes, line 3815
3815derbuffer[ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),A.depthBuffer&&(B.__webglDepthRenderbuffer=i.createRenderbuffer(),re(B.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(q){t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture),Q(i.TEXTURE_CUBE_MAP,_);for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0)for(let de=0;de<_.mipmaps.length;de++)J(B.__webglFramebuffer[ae][de],A,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,de);else J(B.__webglFramebuffer[ae],A,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);h(_)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ge){for(let ae=0,de=ee.length;ae<de;ae++){const Be=ee[ae],ne=n.get(Be);t.bindTexture(i.TEXTURE_2D,ne.__webglTexture),Q(i.TEXTURE_2D,Be),J(B.__webglFramebuffer,A,Be,i.COLOR_ATTACHMENT0+ae,i.TEXTURE_2D,0),h(Be)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let ae=i.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(ae=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ae,Y.__webglTexture),Q(ae,_),_.mipmaps&&_.mipmaps.length>0)for(let de=0;de<_.mipmaps.length;
vendor: 4,434 bytes, line 3815
3815de++)J(B.__webglFramebuffer[de],A,_,i.COLOR_ATTACHMENT0,ae,de);else J(B.__webglFramebuffer,A,_,i.COLOR_ATTACHMENT0,ae,0);h(_)&&f(ae),t.unbindTexture()}A.depthBuffer&&Ce(A)}function Pe(A){const _=A.textures;for(let B=0,Y=_.length;B<Y;B++){const ee=_[B];if(h(ee)){const q=A.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,ge=n.get(ee).__webglTexture;t.bindTexture(q,ge),f(q),t.unbindTexture()}}}const Ue=[],R=[];function rt(A){if(A.samples>0){if(ke(A)===!1){const _=A.textures,B=A.width,Y=A.height;let ee=i.COLOR_BUFFER_BIT;const q=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=n.get(A),ae=_.length>1;if(ae)for(let de=0;de<_.length;de++)t.bindFramebuffer(i.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ge.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let de=0;de<_.length;de++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(ee|=i.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(ee|=i.STENCIL_BUFFER_BIT)),ae){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ge.__webglColorRenderbuffer[de]);const Be=n.get(_[de]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Be,0)}i.blitFramebuffer(0,0,B,Y,0,0,B,Y,ee,i.NEAREST),l===!0&&(Ue.length=0,R.length=0,Ue.push(i.COLOR_ATTACHMENT0+de),A.depthBuffer&&A.resolveDepthBuffer===!1&&(Ue.push(q),R.push(q),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,R)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,Ue))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ae)for(let de=0;de<_.length;de++){t.bindFramebuffer(i.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.RENDERBUFFER,ge.__webglColorRenderbuffer[de]);const Be=n.get(_[de]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ge.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.TEXTURE_2D,Be,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&l){const _=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[_])}}}function Ie(A){return Math.min(r.maxSamples,A.samples)}function ke(A){const _=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function Ae(A){const _=a.render.frame;d.get(A)!==_&&(d.set(A,_),A.update())}function Ye(A,_){const B=A.colorSpace,Y=A.format,ee=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||B!==Wt&&B!==dn&&(qe.getTransfer(B)===Je?(Y!==Bt||ee!==sn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),_}function be(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=S,this.setTexture2D=k,this.setTexture2DArray=j,this.setTexture3D=z,this.setTextureCube=X,this.rebindTextures=ye,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Pe,this.updateMultisampleRenderTarget=rt,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=J,this.useMultisampledRTT=ke}function Vd(i,e){function t(n,r=dn){let s;const a=qe.getTransfer(r);if(n===sn)return i.UNSIGNED_BYTE;if(n===Ws)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Xs)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Eo)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Mo)return i.BYTE;if(n===So)return i.SHORT;if(n===gi)return i.UNSIGNED_SHORT;if(n===ks)return i.INT;if(n===Cn)return i.UNSIGNED_INT;if(n===en)return i.FLOAT;if(n===rn)return i.HALF_FLOAT;if(n===yo)return i.ALPHA;if(n===To)return i.RGB;if(n===Bt)return i.RGBA;if(n===Ao)return i.LUMINANCE;if(n===bo)return i.LUMINANCE_ALPHA;if(n===Kn)return i.DEPTH_COMPONENT;if(n===ei)return i.DEPTH_STENCIL;if(n===wo)return i.RED;if(n===qs)return i.RED_INTEGER;if(n===Ro)return i.RG;
vendor: 9,318 bytes, lines 3815-3839
3815if(n===Ys)return i.RG_INTEGER;if(n===Ks)return i.RGBA_INTEGER;if(n===Ji||n===Qi||n===er||n===tr)if(a===Je)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ji)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Qi)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===er)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ji)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Qi)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===er)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ds||n===ps||n===ms||n===gs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ds)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ps)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ms)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===gs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_s||n===vs||n===xs)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_s||n===vs)return a===Je?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===xs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Ms||n===Ss||n===Es||n===ys||n===Ts||n===As||n===bs||n===ws||n===Rs||n===Cs||n===Ps||n===Ls||n===Ds||n===Us)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Ms)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ss)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Es)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ys)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ts)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===As)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===bs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ws)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Rs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Cs)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ps)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ls)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ds)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Us)return a===Je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===nr||n===Is||n===Ns)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===nr)return a===Je?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Is)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ns)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Co||n===Fs||n===Os||n===Bs)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===nr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Fs)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Os)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bs)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Qn?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class kd extends Pt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class qi extends _t{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Wd={type:"move"};class Jr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new qi,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 qi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new qi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const E of e.hand.values()){const h=t.getJointPose(E,n),f=this._getHandJoint(c,E);h!==null&&(f.matrix.fromArray(h.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=h.radius),f.visible=h!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],p=d.position.distanceTo(u.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Wd)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new qi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Xd=` 3816void main() { 3817 3818 gl_Position = vec4( position, 1.0 ); 3819 3820}`,qd=` 3821uniform sampler2DArray depthColor; 3822uniform float depthWidth; 3823uniform float depthHeight; 3824 3825void main() { 3826 3827 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3828 3829 if ( coord.x >= 1.0 ) { 3830 3831 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3832 3833 } else { 3834 3835 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3836 3837 } 3838 3839}`;class Yd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Et,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ht({vertexShader:Xd,fragmentShader:qd,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new zt(new mr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Kd extends ii{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,u=null,p=null,m=null,v=null;const E=new Yd,h=t.getContextAttributes();let f=null,T=null;const x=[],y=[],C=new He;let w=null;const b=new Pt;b.layers.enable(1),b.viewport=new it;const I=new Pt;I.layers.enable(2),I.viewport=new it;const K=[b,I],g=new kd;g.layers.enable(1),g.layers.enable(2);let S=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let J=x[F];return J===void 0&&(J=new Jr,x[F]=J),J.getTargetRaySpace()},this.getControllerGrip=function(F){let J=x[F];return J===void 0&&(J=new Jr,x[F]=J),J.getGripSpace()},this.getHand=function(F){let J=x[F];return J===void 0&&(J=new Jr,x[F]=J),J.getHandSpace()};function H(F){const J=y.indexOf(F.inputSource);if(J===-1)return;const re=x[J];re!==void 0&&(re.update(F.inputSource,F.frame,c||a),re.dispatchEvent({type:F.type,data:F.inputSource}))}function k(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",k),r.removeEventListener("inputsourceschange",j);for(let F=0;F<x.length;
vendor: 7,098 bytes, line 3839
3839F++){const J=y[F];J!==null&&(y[F]=null,x[F].disconnect(J))}S=null,O=null,E.reset(),e.setRenderTarget(f),m=null,p=null,u=null,r=null,T=null,Se.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){s=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){o=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(F){c=F},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return u},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(F){if(r=F,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",k),r.addEventListener("inputsourceschange",j),h.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(C),r.renderState.layers===void 0){const J={antialias:h.antialias,alpha:!0,depth:h.depth,stencil:h.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,J),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),T=new Ht(m.framebufferWidth,m.framebufferHeight,{format:Bt,type:sn,colorSpace:e.outputColorSpace,stencilBuffer:h.stencil})}else{let J=null,re=null,oe=null;h.depth&&(oe=h.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,J=h.stencil?ei:Kn,re=h.stencil?Qn:Cn);const Ce={colorFormat:t.RGBA8,depthFormat:oe,scaleFactor:s};u=new XRWebGLBinding(r,t),p=u.createProjectionLayer(Ce),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),T=new Ht(p.textureWidth,p.textureHeight,{format:Bt,type:sn,depthTexture:new Wo(p.textureWidth,p.textureHeight,re,void 0,void 0,void 0,void 0,void 0,void 0,J),stencilBuffer:h.stencil,colorSpace:e.outputColorSpace,samples:h.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Se.setContext(r),Se.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return E.getDepthTexture()};function j(F){for(let J=0;J<F.removed.length;J++){const re=F.removed[J],oe=y.indexOf(re);oe>=0&&(y[oe]=null,x[oe].disconnect(re))}for(let J=0;J<F.added.length;J++){const re=F.added[J];let oe=y.indexOf(re);if(oe===-1){for(let ye=0;ye<x.length;ye++)if(ye>=y.length){y.push(re),oe=ye;break}else if(y[ye]===null){y[ye]=re,oe=ye;break}if(oe===-1)break}const Ce=x[oe];Ce&&Ce.connect(re)}}const z=new N,X=new N;function D(F,J,re){z.setFromMatrixPosition(J.matrixWorld),X.setFromMatrixPosition(re.matrixWorld);const oe=z.distanceTo(X),Ce=J.projectionMatrix.elements,ye=re.projectionMatrix.elements,Ge=Ce[14]/(Ce[10]-1),Pe=Ce[14]/(Ce[10]+1),Ue=(Ce[9]+1)/Ce[5],R=(Ce[9]-1)/Ce[5],rt=(Ce[8]-1)/Ce[0],Ie=(ye[8]+1)/ye[0],ke=Ge*rt,Ae=Ge*Ie,Ye=oe/(-rt+Ie),be=Ye*-rt;if(J.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(be),F.translateZ(Ye),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert(),Ce[10]===-1)F.projectionMatrix.copy(J.projectionMatrix),F.projectionMatrixInverse.copy(J.projectionMatrixInverse);else{const A=Ge+Ye,_=Pe+Ye,B=ke-be,Y=Ae+(oe-be),ee=Ue*Pe/_*A,q=R*Pe/_*A;F.projectionMatrix.makePerspective(B,Y,ee,q,A,_),F.projectionMatrixInverse.copy(F.projectionMatrix).invert()}}function $(F,J){J===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(J.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(r===null)return;let J=F.near,re=F.far;E.texture!==null&&(E.depthNear>0&&(J=E.depthNear),E.depthFar>0&&(re=E.depthFar)),g.near=I.near=b.near=J,g.far=I.far=b.far=re,(S!==g.near||O!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),S=g.near,O=g.far);const oe=F.parent,Ce=g.cameras;$(g,oe);for(let ye=0;ye<Ce.length;ye++)$(Ce[ye],oe);Ce.length===2?D(g,b,I):g.projectionMatrix.copy(b.projectionMatrix),te(F,g,oe)};function te(F,J,re){re===null?F.matrix.copy(J.matrixWorld):(F.matrix.copy(re.matrixWorld),F.matrix.invert(),F.matrix.multiply(J.matrixWorld)),F.matrix.decompose(F.position,F.quaternion,F.scale),F.updateMatrixWorld(!0),F.projectionMatrix.copy(J.projectionMatrix),F.projectionMatrixInverse.copy(J.projectionMatrixInverse),F.isPerspectiveCamera&&(F.fov=zs*2*Math.atan(1/F.projectionMatrix.elements[5]),F.zoom=1)}this.getCamera=function(){return g},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(F){l=F,p!==null&&(p.fixedFoveation=F),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=F)},this.hasDepthSensing=function(){return E.texture!==null},this.getDepthSensingMesh=function(){return E.getMesh(g)};let Q=null;function xe(F,J){if(d=J.getViewerPose(c||a),v=J,d!==null){const re=d.views;m!==null&&(e.setRenderTargetFramebuffer(T,m.framebuffer),e.setRenderTarget(T));let oe=!1;re.length!==g.cameras.length&&(g.cameras.length=0,oe=!0);for(let ye=0;ye<re.length;ye++){const Ge=re[ye];let Pe=null;if(m!==null)Pe=m.getViewport(Ge);else{const R=u.getViewSubImage(p,Ge);Pe=R.viewport,ye===0&&(e.setRenderTargetTextures(T,R.colorTexture,p.ignoreDepthValues?void 0:R.depthStencilTexture),e.setRenderTarget(T))}let Ue=K[ye];Ue===void 0&&(Ue=new Pt,Ue.layers.enable(ye),Ue.viewport=new it,K[ye]=Ue),Ue.matrix.fromArray(Ge.transform.matrix),Ue.matrix.decompose(Ue.position,Ue.quaternion,Ue.scale),Ue.projectionMatrix.fromArray(Ge.projectionMatrix),Ue.projectionMatrixInverse.copy(Ue.projectionMatrix).invert(),Ue.viewport.set(Pe.x,Pe.y,Pe.width,Pe.height),ye===0&&(g.matrix.copy(Ue.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale)),oe===!0&&g.cameras.push(Ue)}const Ce=r.enabledFeatures;if(Ce&&Ce.includes("depth-sensing")){const ye=u.getDepthInformation(re[0]);ye&&ye.isValid&&ye.texture&&E.init(e,ye,r.renderState)}}for(let re=0;re<x.length;re++){const oe=y[re],Ce=x[re];oe!==null&&Ce!==void 0&&Ce.update(oe,J,c||a)}Q&&Q(F,J),J.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:J}),v=null}const Se=new Vo;Se.setAnimationLoop(xe),this.setAnimationLoop=function(F){Q=F},this.dispose=function(){}}}const En=new Xt,$d=new tt;function Zd(i,e){function t(h,f){h.matrixAutoUpdate===!0&&h.updateMatrix(),f.value.copy(h.matrix)}function n(h,f){f.color.getRGB(h.fogColor.value,Bo(i)),f.isFog?(h.fogNear.value=f.near,h.fogFar.value=f.far):f.isFogExp2&&(h.fogDensity.value=f.density)}function r(h,f,T,x,y){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(h,f):f.isMeshToonMaterial?(s(h,f),u(h,f)):f.isMeshPhongMaterial?(s(h,f),d(h,f)):f.isMeshStandardMaterial?(s(h,f),p(h,f),f.isMeshPhysicalMaterial&&m(h,f,y)):f.isMeshMat
vendor: 11,650 bytes, line 3839
3839capMaterial?(s(h,f),v(h,f)):f.isMeshDepthMaterial?s(h,f):f.isMeshDistanceMaterial?(s(h,f),E(h,f)):f.isMeshNormalMaterial?s(h,f):f.isLineBasicMaterial?(a(h,f),f.isLineDashedMaterial&&o(h,f)):f.isPointsMaterial?l(h,f,T,x):f.isSpriteMaterial?c(h,f):f.isShadowMaterial?(h.color.value.copy(f.color),h.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(h,f){h.opacity.value=f.opacity,f.color&&h.diffuse.value.copy(f.color),f.emissive&&h.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(h.map.value=f.map,t(f.map,h.mapTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.bumpMap&&(h.bumpMap.value=f.bumpMap,t(f.bumpMap,h.bumpMapTransform),h.bumpScale.value=f.bumpScale,f.side===St&&(h.bumpScale.value*=-1)),f.normalMap&&(h.normalMap.value=f.normalMap,t(f.normalMap,h.normalMapTransform),h.normalScale.value.copy(f.normalScale),f.side===St&&h.normalScale.value.negate()),f.displacementMap&&(h.displacementMap.value=f.displacementMap,t(f.displacementMap,h.displacementMapTransform),h.displacementScale.value=f.displacementScale,h.displacementBias.value=f.displacementBias),f.emissiveMap&&(h.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,h.emissiveMapTransform)),f.specularMap&&(h.specularMap.value=f.specularMap,t(f.specularMap,h.specularMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest);const T=e.get(f),x=T.envMap,y=T.envMapRotation;x&&(h.envMap.value=x,En.copy(y),En.x*=-1,En.y*=-1,En.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(En.y*=-1,En.z*=-1),h.envMapRotation.value.setFromMatrix4($d.makeRotationFromEuler(En)),h.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=f.reflectivity,h.ior.value=f.ior,h.refractionRatio.value=f.refractionRatio),f.lightMap&&(h.lightMap.value=f.lightMap,h.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,h.lightMapTransform)),f.aoMap&&(h.aoMap.value=f.aoMap,h.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,h.aoMapTransform))}function a(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform))}function o(h,f){h.dashSize.value=f.dashSize,h.totalSize.value=f.dashSize+f.gapSize,h.scale.value=f.scale}function l(h,f,T,x){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.size.value=f.size*T,h.scale.value=x*.5,f.map&&(h.map.value=f.map,t(f.map,h.uvTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function c(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.rotation.value=f.rotation,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function d(h,f){h.specular.value.copy(f.specular),h.shininess.value=Math.max(f.shininess,1e-4)}function u(h,f){f.gradientMap&&(h.gradientMap.value=f.gradientMap)}function p(h,f){h.metalness.value=f.metalness,f.metalnessMap&&(h.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,h.metalnessMapTransform)),h.roughness.value=f.roughness,f.roughnessMap&&(h.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,h.roughnessMapTransform)),f.envMap&&(h.envMapIntensity.value=f.envMapIntensity)}function m(h,f,T){h.ior.value=f.ior,f.sheen>0&&(h.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),h.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(h.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,h.sheenColorMapTransform)),f.sheenRoughnessMap&&(h.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,h.sheenRoughnessMapTransform))),f.clearcoat>0&&(h.clearcoat.value=f.clearcoat,h.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(h.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,h.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(h.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===St&&h.clearcoatNormalScale.value.negate())),f.dispersion>0&&(h.dispersion.value=f.dispersion),f.iridescence>0&&(h.iridescence.value=f.iridescence,h.iridescenceIOR.value=f.iridescenceIOR,h.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(h.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,h.iridescenceMapTransform)),f.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),f.transmission>0&&(h.transmission.value=f.transmission,h.transmissionSamplerMap.value=T.texture,h.transmissionSamplerSize.value.set(T.width,T.height),f.transmissionMap&&(h.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,h.transmissionMapTransform)),h.thickness.value=f.thickness,f.thicknessMap&&(h.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=f.attenuationDistance,h.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(h.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(h.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=f.specularIntensity,h.specularColor.value.copy(f.specularColor),f.specularColorMap&&(h.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,h.specularColorMapTransform)),f.specularIntensityMap&&(h.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,h.specularIntensityMapTransform))}function v(h,f){f.matcap&&(h.matcap.value=f.matcap)}function E(h,f){const T=e.get(f).light;h.referencePosition.value.setFromMatrixPosition(T.matrixWorld),h.nearDistance.value=T.shadow.camera.near,h.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function jd(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,x){const y=x.program;n.uniformBlockBinding(T,y)}function c(T,x){let y=r[T.id];y===void 0&&(v(T),y=d(T),r[T.id]=y,T.addEventListener("dispose",h));const C=x.program;n.updateUBOMapping(T,C);const w=e.render.frame;s[T.id]!==w&&(p(T),s[T.id]=w)}function d(T){const x=u();T.__bindingPointIndex=x;const y=i.createBuffer(),C=T.__size,w=T.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,C,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,y),y}function u(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(T){const x=r[T.id],y=T.uniforms,C=T.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let w=0,b=y.length;w<b;w++){const I=Array.isArray(y[w])?y[w]:[y[w]];for(let K=0,g=I.length;K<g;K++){const S=I[K];if(m(S,w,K,C)===!0){const O=S.__offset,H=Array.isArray(S.value)?S.value:[S.value];let k=0;for(let j=0;j<H.length;j++){const z=H[j],X=E(z);typeof z=="number"||typeof z=="boolean"?(S.__data[0]=z,i.bufferSubData(i.UNIFORM_BUFFER,O+k,S.__data)):z.isMatrix3?(S.__data[0]=z.elements[0],S.__data[1]=z.elements[1],S.__data[2]=z.elements[2],S.__data[3]=0,S.__data[4]=z.elements[3],S.__data[5]=z.elements[4],S.__data[6]=z.elements[5],S.__data[7]=0,S.__data[8]=z.elements[6],S.__data[9]=z.elements[7],S.__data[10]=z.elements[8],S.__data[11]=0):(z.toArray(S.__data,k),k+=X.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,O,S.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(T,x,y,C){const w=T.value,b=x+"_"+y;if(C[b]===void 0)return typeof w=="number"||typeof w=="boolean"?C[b]=w:C[b]=w.clone(),!0;{const I=C[b];if(typeof w=="number"||typeof w=="boolean"){if(I!==w)return C[b]=w,!0}else if(I.equals(w)===!1)return I.copy(w),!0}return!1}function v(T){const x=T.uniforms;let y=0;const C=16;for(let b=0,I=x.length;b<I;b++){const K=Array.isArray(x[b])?x[b]:[x[b]];for(let g=0,S=K.length;g<S;g++){const O=K[g],H=Array.isArray(O.value)?O.value:[O.value];for(let k=0,j=H.length;k<j;k++){const z=H[k],X=E(z),D=y%C,$=D%X.boundary,te=D+$;y+=$,te!==0&&C-te<X.storage&&(y+=C-te),O.__data=new Float32Array(X.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=y,y+=X.storage}}}const w=y%C;return w>0&&(y+=C-w),T.__size=y,T.__cache={},this}function E(T){const x={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(x.boundary=4,x.storage=4):T.isVector2?(x.boundary=8,x.storage=8):T.isVector3||T.isColor?(x.boundary=16,x.storage=12):T.isVector4?(x.boundary=16,x.storage=16):T.isMatrix3?(x.boundary=48,x.storage=48):T.isMatrix4?(x.boundary=64,x.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),x}function h(T){const x=T.target;x.removeEventListener("dispose",h);const y=a.indexOf(x.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const T in r)i.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Jd{constructor(e={}){const{canvas:t=zl(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),v=new Int32Array(4);let E=null,h=null;const f=[],T=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Vt,this.toneMapping=pn,this.toneMappingExposure=1;const x=this;let y=!1,C=0,w=0,b=null,I=-1,K=null;const g=new it,S=new it;let O=null;const H=new We(0);let k=0,j=t.width,z=t.height,X=1,D=null,$=null;const te=new it(0,0,j,z),Q=new it(0,0,j,z);let xe=!1;const Se=new Go;let F=!1,J=!1;const re=new tt,oe=new tt,Ce=new N,ye=new it,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Pe=!1;function Ue(){return b===null?X:1}let R=n;function rt(M,L){return t.getContext(M,L)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vs}`),t.addEventListener("webglcontextlost",Z,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",ce,!1),R===null){const L="webgl2";if(R=rt(L,M),R===null)throw rt(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Ie,ke,Ae,Ye,be,A,_,B,Y,ee,q,ge,ae,de,Be,ne,pe,we,Te,me,ze,Le,Ze,P;function ue(){Ie=new nf(R),Ie.init(),Le=new Vd(R,Ie),ke=new Zh(R,Ie,e,Le),Ae=new zd(R),ke.reverseDepthBuffer&&Ae.buffers.depth.setReversed(!0),Ye=new af(R),be=new Td,A=new Gd(R,Ie,Ae,be,ke,Le,Ye),_=new Jh(x),B=new tf(x),Y=new fc(R),Ze=new Kh(R,Y),ee=new rf(R,Y,Ye,Ze),q=new lf(R,ee,Y,Ye),Te=new of(R,ke,A),ne=new jh(be),ge=new y
vendor: 2,545 bytes, line 3839
3839d(x,_,B,Ie,ke,Ze,ne),ae=new Zd(x,be),de=new bd,Be=new Dd(Ie),we=new Yh(x,_,B,Ae,q,p,l),pe=new Od(x,q,ke),P=new jd(R,Ye,ke,Ae),me=new $h(R,Ie,Ye),ze=new sf(R,Ie,Ye),Ye.programs=ge.programs,x.capabilities=ke,x.extensions=Ie,x.properties=be,x.renderLists=de,x.shadowMap=pe,x.state=Ae,x.info=Ye}ue();const W=new Kd(x,R);this.xr=W,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const M=Ie.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Ie.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(M){M!==void 0&&(X=M,this.setSize(j,z,!1))},this.getSize=function(M){return M.set(j,z)},this.setSize=function(M,L,G=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}j=M,z=L,t.width=Math.floor(M*X),t.height=Math.floor(L*X),G===!0&&(t.style.width=M+"px",t.style.height=L+"px"),this.setViewport(0,0,M,L)},this.getDrawingBufferSize=function(M){return M.set(j*X,z*X).floor()},this.setDrawingBufferSize=function(M,L,G){j=M,z=L,X=G,t.width=Math.floor(M*G),t.height=Math.floor(L*G),this.setViewport(0,0,M,L)},this.getCurrentViewport=function(M){return M.copy(g)},this.getViewport=function(M){return M.copy(te)},this.setViewport=function(M,L,G,V){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,L,G,V),Ae.viewport(g.copy(te).multiplyScalar(X).round())},this.getScissor=function(M){return M.copy(Q)},this.setScissor=function(M,L,G,V){M.isVector4?Q.set(M.x,M.y,M.z,M.w):Q.set(M,L,G,V),Ae.scissor(S.copy(Q).multiplyScalar(X).round())},this.getScissorTest=function(){return xe},this.setScissorTest=function(M){Ae.setScissorTest(xe=M)},this.setOpaqueSort=function(M){D=M},this.setTransparentSort=function(M){$=M},this.getClearColor=function(M){return M.copy(we.getClearColor())},this.setClearColor=function(){we.setClearColor.apply(we,arguments)},this.getClearAlpha=function(){return we.getClearAlpha()},this.setClearAlpha=function(){we.setClearAlpha.apply(we,arguments)},this.clear=function(M=!0,L=!0,G=!0){let V=0;if(M){let U=!1;if(b!==null){const ie=b.texture.format;U=ie===Ks||ie===Ys||ie===qs}if(U){const ie=b.texture.type,he=ie===sn||ie===Cn||ie===gi||ie===Qn||ie===Ws||ie===Xs,_e=we.getClearColor(),ve=we.getClearAlpha(),Re=_e.r,De=_e.g,Me=_e.b;he?(m[0]=Re,m[1]=De,m[2]=Me,m[3]=ve,R.clearBufferuiv(R.COLOR,0,m)):(v[0]=Re,v[1]=De,v[2]=Me,v[3]=ve,R.clearBufferiv(R.COLOR,0,v))}else V|=R.COLOR_BUFFER_BIT}
vendor: 23,067 bytes, line 3839
3839L&&(V|=R.DEPTH_BUFFER_BIT,R.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),G&&(V|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(V)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Z,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",ce,!1),de.dispose(),Be.dispose(),be.dispose(),_.dispose(),B.dispose(),q.dispose(),Ze.dispose(),P.dispose(),ge.dispose(),W.dispose(),W.removeEventListener("sessionstart",ea),W.removeEventListener("sessionend",ta),gn.stop()};function Z(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const M=Ye.autoReset,L=pe.enabled,G=pe.autoUpdate,V=pe.needsUpdate,U=pe.type;ue(),Ye.autoReset=M,pe.enabled=L,pe.autoUpdate=G,pe.needsUpdate=V,pe.type=U}function ce(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Ve(M){const L=M.target;L.removeEventListener("dispose",Ve),fe(L)}function fe(M){Fe(M),be.remove(M)}function Fe(M){const L=be.get(M).programs;L!==void 0&&(L.forEach(function(G){ge.releaseProgram(G)}),M.isShaderMaterial&&ge.releaseShaderCache(M))}this.renderBufferDirect=function(M,L,G,V,U,ie){L===null&&(L=Ge);const he=U.isMesh&&U.matrixWorld.determinant()<0,_e=Jo(M,L,G,V,U);Ae.setMaterial(V,he);let ve=G.index,Re=1;if(V.wireframe===!0){if(ve=ee.getWireframeAttribute(G),ve===void 0)return;Re=2}const De=G.drawRange,Me=G.attributes.position;let je=De.start*Re,Qe=(De.start+De.count)*Re;ie!==null&&(je=Math.max(je,ie.start*Re),Qe=Math.min(Qe,(ie.start+ie.count)*Re)),ve!==null?(je=Math.max(je,0),Qe=Math.min(Qe,ve.count)):Me!=null&&(je=Math.max(je,0),Qe=Math.min(Qe,Me.count));const nt=Qe-je;if(nt<0||nt===1/0)return;Ze.setup(U,V,_e,G,ve);let yt,Ke=me;if(ve!==null&&(yt=Y.get(ve),Ke=ze,Ke.setIndex(yt)),U.isMesh)V.wireframe===!0?(Ae.setLineWidth(V.wireframeLinewidth*Ue()),Ke.setMode(R.LINES)):Ke.setMode(R.TRIANGLES);else if(U.isLine){let Ee=V.linewidth;Ee===void 0&&(Ee=1),Ae.setLineWidth(Ee*Ue()),U.isLineSegments?Ke.setMode(R.LINES):U.isLineLoop?Ke.setMode(R.LINE_LOOP):Ke.setMode(R.LINE_STRIP)}else U.isPoints?Ke.setMode(R.POINTS):U.isSprite&&Ke.setMode(R.TRIANGLES);if(U.isBatchedMesh)if(U._multiDrawInstances!==null)Ke.renderMultiDrawInstances(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount,U._multiDrawInstances);else if(Ie.get("WEBGL_multi_draw"))Ke.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{const Ee=U._multiDrawStarts,ft=U._multiDrawCounts,$e=U._multiDrawCount,Dt=ve?Y.get(ve).bytesPerElement:1,Pn=be.get(V).currentProgram.getUniforms();for(let Tt=0;Tt<$e;Tt++)Pn.setValue(R,"_gl_DrawID",Tt),Ke.render(Ee[Tt]/Dt,ft[Tt])}else if(U.isInstancedMesh)Ke.renderInstances(je,nt,U.count);else if(G.isInstancedBufferGeometry){const Ee=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,ft=Math.min(G.instanceCount,Ee);Ke.renderInstances(je,nt,ft)}else Ke.render(je,nt)};function Xe(M,L,G){M.transparent===!0&&M.side===Qt&&M.forceSinglePass===!1?(M.side=St,M.needsUpdate=!0,Ti(M,L,G),M.side=mn,M.needsUpdate=!0,Ti(M,L,G),M.side=Qt):Ti(M,L,G)}this.compile=function(M,L,G=null){G===null&&(G=M),h=Be.get(G),h.init(L),T.push(h),G.traverseVisible(function(U){U.isLight&&U.layers.test(L.layers)&&(h.pushLight(U),U.castShadow&&h.pushShadow(U))}),M!==G&&M.traverseVisible(function(U){U.isLight&&U.layers.test(L.layers)&&(h.pushLight(U),U.castShadow&&h.pushShadow(U))}),h.setupLights();const V=new Set;return M.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;const ie=U.material;if(ie)if(Array.isArray(ie))for(let he=0;he<ie.length;he++){const _e=ie[he];Xe(_e,G,U),V.add(_e)}else Xe(ie,G,U),V.add(ie)}),T.pop(),h=null,V},this.compileAsync=function(M,L,G=null){const V=this.compile(M,L,G);return new Promise(U=>{function ie(){if(V.forEach(function(he){be.get(he).currentProgram.isReady()&&V.delete(he)}),V.size===0){U(M);return}setTimeout(ie,10)}Ie.get("KHR_parallel_shader_compile")!==null?ie():setTimeout(ie,10)})};let vt=null;function qt(M){vt&&vt(M)}function ea(){gn.stop()}function ta(){gn.start()}const gn=new Vo;gn.setAnimationLoop(qt),typeof self<"u"&&gn.setContext(self),this.setAnimationLoop=function(M){vt=M,W.setAnimationLoop(M),M===null?gn.stop():gn.start()},W.addEventListener("sessionstart",ea),W.addEventListener("sessionend",ta),this.render=function(M,L){if(L!==void 0&&L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(L),L=W.getCamera()),M.isScene===!0&&M.onBeforeRender(x,M,L,b),h=Be.get(M,T.length),h.init(L),T.push(h),oe.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),Se.setFromProjectionMatrix(oe),J=this.localClippingEnabled,F=ne.init(this.clippingPlanes,J),E=de.get(M,f.length),E.init(),f.push(E),W.enabled===!0&&W.isPresenting===!0){const ie=x.xr.getDepthSensingMesh();ie!==null&&vr(ie,L,-1/0,x.sortObjects)}vr(M,L,0,x.sortObjects),E.finish(),x.sortObjects===!0&&E.sort(D,$),Pe=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,Pe&&we.addToRenderList(E,M),this.info.render.frame++,F===!0&&ne.beginShadows();const G=h.state.shadowsArray;pe.render(G,M,L),F===!0&&ne.endShadows(),this.info.autoReset===!0&&this.info.reset();const V=E.opaque,U=E.transmissive;if(h.setupLights(),L.isArrayCamera){const ie=L.cameras;if(U.length>0)for(let he=0,_e=ie.length;he<_e;he++){const ve=ie[he];ia(V,U,M,ve)}Pe&&we.render(M);for(let he=0,_e=ie.length;he<_e;he++){const ve=ie[he];na(E,M,ve,ve.viewport)}}else U.length>0&&ia(V,U,M,L),Pe&&we.render(M),na(E,M,L);b!==null&&(A.updateMultisampleRenderTarget(b),A.updateRenderTargetMipmap(b)),M.isScene===!0&&M.onAfterRender(x,M,L),Ze.resetDefaultState(),I=-1,K=null,T.pop(),T.length>0?(h=T[T.length-1],F===!0&&ne.setGlobalState(x.clippingPlanes,h.state.camera)):h=null,f.pop(),f.length>0?E=f[f.length-1]:E=null};function vr(M,L,G,V){if(M.visible===!1)return;if(M.layers.test(L.layers)){if(M.isGroup)G=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(L);else if(M.isLight)h.pushLight(M),M.castShadow&&h.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Se.intersectsSprite(M)){V&&ye.setFromMatrixPosition(M.matrixWorld).applyMatrix4(oe);const he=q.update(M),_e=M.material;_e.visible&&E.push(M,he,_e,G,ye.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Se.intersectsObject(M))){const he=q.update(M),_e=M.material;if(V&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),ye.copy(M.boundingSphere.center)):(he.boundingSphere===null&&he.computeBoundingSphere(),ye.copy(he.boundingSphere.center)),ye.applyMatrix4(M.matrixWorld).applyMatrix4(oe)),Array.isArray(_e)){const ve=he.groups;for(let Re=0,De=ve.length;Re<De;Re++){const Me=ve[Re],je=_e[Me.materialIndex];je&&je.visible&&E.push(M,he,je,G,ye.z,Me)}}else _e.visible&&E.push(M,he,_e,G,ye.z,null)}}const ie=M.children;for(let he=0,_e=ie.length;he<_e;he++)vr(ie[he],L,G,V)}function na(M,L,G,V){const U=M.opaque,ie=M.transmissive,he=M.transparent;h.setupLightsView(G),F===!0&&ne.setGlobalState(x.clippingPlanes,G),V&&Ae.viewport(g.copy(V)),U.length>0&&yi(U,L,G),ie.length>0&&yi(ie,L,G),he.length>0&&yi(he,L,G),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function ia(M,L,G,V){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;h.state.transmissionRenderTarget[V.id]===void 0&&(h.state.transmissionRenderTarget[V.id]=new Ht(1,1,{generateMipmaps:!0,type:Ie.has("EXT_color_buffer_half_float")||Ie.has("EXT_color_buffer_float")?rn:sn,minFilter:Rn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qe.workingColorSpace}));const ie=h.state.transmissionRenderTarget[V.id],he=V.viewport||g;ie.setSize(he.z,he.w);const _e=x.getRenderTarget();x.setRenderTarget(ie),x.getClearColor(H),k=x.getClearAlpha(),k<1&&x.setClearColor(16777215,.5),x.clear(),Pe&&we.render(G);const ve=x.toneMapping;x.toneMapping=pn;const Re=V.viewport;if(V.viewport!==void 0&&(V.viewport=void 0),h.setupLightsView(V),F===!0&&ne.setGlobalState(x.clippingPlanes,V),yi(M,G,V),A.updateMultisampleRenderTarget(ie),A.updateRenderTargetMipmap(ie),Ie.has("WEBGL_multisampled_render_to_texture")===!1){let De=!1;for(let Me=0,je=L.length;Me<je;Me++){const Qe=L[Me],nt=Qe.object,yt=Qe.geometry,Ke=Qe.material,Ee=Qe.group;if(Ke.side===Qt&&nt.layers.test(V.layers)){const ft=Ke.side;Ke.side=St,Ke.needsUpdate=!0,ra(nt,G,V,yt,Ke,Ee),Ke.side=ft,Ke.needsUpdate=!0,De=!0}}De===!0&&(A.updateMultisampleRenderTarget(ie),A.updateRenderTargetMipmap(ie))}x.setRenderTarget(_e),x.setClearColor(H,k),Re!==void 0&&(V.viewport=Re),x.toneMapping=ve}function yi(M,L,G){const V=L.isScene===!0?L.overrideMaterial:null;for(let U=0,ie=M.length;U<ie;U++){const he=M[U],_e=he.object,ve=he.geometry,Re=V===null?he.material:V,De=he.group;_e.layers.test(G.layers)&&ra(_e,L,G,ve,Re,De)}}function ra(M,L,G,V,U,ie){M.onBeforeRender(x,L,G,V,U,ie),M.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),U.onBeforeRender(x,L,G,V,M,ie),U.transparent===!0&&U.side===Qt&&U.forceSinglePass===!1?(U.side=St,U.needsUpdate=!0,x.renderBufferDirect(G,L,V,U,M,ie),U.side=mn,U.needsUpdate=!0,x.renderBufferDirect(G,L,V,U,M,ie),U.side=Qt):x.renderBufferDirect(G,L,V,U,M,ie),M.onAfterRender(x,L,G,V,U,ie)}function Ti(M,L,G){L.isScene!==!0&&(L=Ge);const V=be.get(M),U=h.state.lights,ie=h.state.shadowsArray,he=U.state.version,_e=ge.getParameters(M,U.state,ie,L,G),ve=ge.getProgramCacheKey(_e);let Re=V.programs;V.environment=M.isMeshStandardMaterial?L.environment:null,V.fog=L.fog,V.envMap=(M.isMeshStandardMaterial?B:_).get(M.envMap||V.environment),V.envMapRotation=V.environment!==null&&M.envMap===null?L.environmentRotation:M.envMapRotation,Re===void 0&&(M.addEventListener("dispose",Ve),Re=new Map,V.programs=Re);let De=Re.get(ve);if(De!==void 0){if(V.currentProgram===De&&V.lightsStateVersion===he)return aa(M,_e),De}else _e.uniforms=ge.getUniforms(M),M.onBeforeCompile(_e,x),De=ge.acquireProgram(_e,ve),Re.set(ve,De),V.uniforms=_e.uniforms;const Me=V.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Me.clippingPlanes=ne.uniform),aa(M,_e),V.needsLights=el(M),V.lightsStateVersion=he,V.needsLights&&(Me.ambientLightColor.value=U.state.ambient,Me.lightProbe.value=U.state.probe,Me.directionalLights.value=U.state.directional,Me.directionalLightShadows.value=U.state.directionalShadow,Me.spotLights.value=U.state.spot,Me.spotLightShadows.value=U.state.spotShadow,Me.rectAreaLights.value=U.state.rectArea,Me.ltc_1.value=U.state.rectAreaLTC1,Me.ltc_2.value=U.state.rectAreaLTC2,Me.pointLights.value=U.state.point,Me.pointLightShadows.value=U.state.pointShadow,Me.hemisphereLights.value=U.state.hemi,Me.directionalShadowMap.value=U.state.directionalShadowMap,Me.directionalShadowMatrix.value=U.state.directionalShadowMatrix,Me.spotShadowMap.value=U.state.spotShadowMap,Me.spotLightMatrix.value=U.state.spotLightMatrix,Me.spotLightMap.value=U.state.spotLightMap,Me.pointShadowMap.value=U.state.pointShadowMap,Me.pointShadowMatrix.value=U.state.pointShadowMatrix),V.currentProgram=De,V.uniformsList=null,De}function sa(M){if(M.uniformsList===null){const L=M.currentProgram.getUniforms();M.uniformsList=rr.seqWithValue(L.seq,M.uniforms)}return M.uniformsList}function aa(M,L){const G=be.get(M);G.outputColorSpace=L.outputColorSpace,G.batching=L.batching,G.batchingColor=L.batchingColor,G.instancing=L.instancing,G.instancingColor=L.instancingColor,G.instancingMorph=L.instancingMorph,G.skinning=L.skinning,G.morphTargets=L.morphTargets,G.morphNormals=L.morphNormals,G.morphColors=L.morphColors,G.morphTargetsCount=L.morphTargetsCount,G.numClippingPlanes=L.numClippingPlanes,G.numIntersection=L.numClipIntersection,G.vertexAlphas=L.vertexAlphas,G.vertexTangents=L.vertexTangents,G.toneMapping=L.toneMapping}function Jo(M,L,G,V,U){L.isScene!==!0&&(L=Ge),A.resetTextureUnits();const ie=L.fog,he=V.isMeshStandardMaterial?L.environment:null,_e=b===null?x.outputColorSpace:b.isXRRenderTarget===!0?b.texture.colorSpace:Wt,ve=(V.isMeshStandardMaterial?B:_).get(V.envMap||he),Re=V.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,De=!!G.attributes.tangent&&(!!V.normalMap||V.anisotropy>0),Me=!!G.morphAttributes.position,je=!!G.morphAttributes.normal,Qe=!!G.morphAttributes.color;let nt=pn;V.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(nt=x.toneMapping);const yt=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Ke=yt!==void 0?yt.length:0,Ee=be.get(V),ft=h.state.lights;if(F===!0&&(J===!0||M!==K)){const Rt=M===K&&V.id===I;ne.setState(V,M,Rt)}let $e=!1;V.version===Ee.__version?(Ee.needsLights&&Ee.lightsStateVersion!==ft.state.version||Ee.outputColorSpace!==_e||U.isBatchedMesh&&Ee.batching===!1||!U.isBatchedMesh&&Ee.batching===!0||U.isBatchedMesh&&Ee.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&Ee.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&Ee.instancing===!1||!U.isInstancedMesh&&Ee.instancing===!0||U.isSkinnedMesh&&Ee.skinning===!1||!U.isSkinnedMesh&&Ee.skinning===!0||U.isInstancedMesh&&Ee.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Ee.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&Ee.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&Ee.instancingMorph===!1&&U.morphTexture!==null||Ee.envMap!==ve||V.fog===!0&&Ee.fog!==ie||Ee.numClippingPlanes!==void 0&&(Ee.numClippingPlanes!==ne.numPlanes||Ee.numIntersection!==ne.numIntersection)||Ee.vertexAlphas!==Re||Ee.vertexTangents!==De||Ee.morphTargets!==Me||Ee.morphNormals!==je||Ee.morphColors!==Qe||Ee.toneMapping!==nt||Ee.morphTargetsCount!==Ke)&&($e=!0):($e=!0,Ee.__version=V.version);let Dt=Ee.currentProgram;$e===!0&&(Dt=Ti(V,L,U));let Pn=!1,Tt=!1,xr=!1;const st=Dt.getUniforms(),an=Ee.uniforms;if(Ae.useProgram(Dt.program)&&(Pn=!0,Tt=!0,xr=!0),V.id!==I&&(I=V.id,Tt=!0),Pn||K!==M){ke.reverseDepthBuffer?(re.copy(M.projectionMatrix),Gl(re),Vl(re),st.setValue(R,"projectionMatrix",re)):st.setValue(R,"projectionMatrix",M.projectionMatrix),st.setValue(R,"viewMatrix",M.matrixWorldInverse);const Rt=st.map.cameraPosition;Rt!==void 0&&Rt.setValue(R,Ce.setFromMatrixPosition(M.matrixWorld)),ke.logarithmicDepthBuffer&&st.setValue(R,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&st.setValue(R,"isOrthographic",M.isOrthographicCamera===!0),K!==M&&(K=M,Tt=!0,xr=!0)}if(U.isSkinnedMesh){st.setOptional(R,U,"bindMatrix"),st.setOptional(R,U,"bindMatrixInverse");const Rt=U.skeleton;Rt&&(Rt.boneTexture===null&&Rt.computeBoneTexture(),st.setValue(R,"boneTexture",Rt.boneTexture,A))}U.isBatchedMesh&&(st.setOptional(R,U,"batchingTexture"),st.setValue(R,"batchingTexture",U._matricesTexture,A),st.setOptional(R,U,"batchingIdTexture"),st.setValue(R,"batchingIdTexture",U._indirectTexture,A),st.setOptional(R,U,"batchingColorTexture"),U._colorsTexture!==null&&st.setValue(R,"batchingColorTexture",U._colorsTexture,A));const Mr=G.morphAttributes;if((Mr.position!==void 0||Mr.normal!==void 0||Mr.color!==void 0)&&Te.update(U,G,Dt),(Tt||Ee.receiveShadow!==U.receiveShadow)&&(Ee.receiveShadow=U.receiveShadow,st.setValue(R,"receiveShadow",U.receiveShadow)),V.isMeshGouraudMaterial&&V.envMap!==null&&(an.envMap.value=ve,an.flipEnvMap.value=ve.isCubeTexture&&ve.isRenderTargetTexture===!1?-1:1),V.isMeshStandardMaterial&&V.envMap===null&&L.environment!==null&&(an.envMapIntensity.value=L.environmentIntensity),Tt&&(st.setValue(R,"toneMappingExposure",x.toneMappingExposure),Ee.needsLights&&Qo(an,xr),ie&&V.fog===!0&&ae.refreshFogUniforms(an,ie),ae.refreshMaterialUniforms(an,V,X,z,h.state.transmissionRenderTarget[M.id]),rr.upload(R,sa(Ee),an,A)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(rr.upload(R,sa(Ee),an,A),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&st.setValue(R,"center",U.center),st.setValue(R,"modelViewMatrix",U.modelViewMatrix),st.setValue(R,"normalMatrix",U.normalMatrix),st.setValue(R,"modelMatrix",U.matrixWorld),V.isShaderMaterial||V.isRawShaderMaterial){const Rt=V.uniformsGroups;for(let Sr=0,tl=Rt.length;Sr<tl;Sr++){const oa=Rt[Sr];P.update(oa,Dt),P.bind(oa,Dt)}}return Dt}function Qo(M,L){M.ambientLightColor.needsUpdate=L,M.lightProbe.needsUpdate=L,M.directionalLights.needsUpdate=L,M.directionalLightShadows.needsUpdate=L,M.pointLights.needsUpdate=L,M.pointLightShadows.needsUpdate=L,M.spotLights.needsUpdate=L,M.spotLightShadows.needsUpdate=L,M.rectAreaLights.needsUpdate=L,M.hemisphereLights.needsUpdate=L}function el(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(M,L,G){be.get(M.texture).__webglTexture=L,be.get(M.depthTexture).__webglTexture=G;const V=be.get(M);V.__hasExternalTextures=!0,V.__autoAllocateDepthBuffer=G===void 0,V.__autoAllocateDepthBuffer||Ie.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),V.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,L){const G=be.get(M);G.__webglFramebuffer=L,G.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(M,L=0,G=0){b=M,C=L,w=G;let V=!0,U=null,ie=!1,he=!1;if(M){const ve=be.get(M);if(ve.__useDefaultFramebuffer!==void 0)Ae.bindFramebuffer(R.FRAMEBUFFER,null),V=!1;else if(ve.__webglFramebuffer===void 0)A.setupRenderTarget(M);else if(ve.__hasExternalTextures)A.rebindTextures(M,be.get(M.texture).__webglTexture,be.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Me=M.depthTexture;if(ve.__boundDepthTexture!==Me){if(Me!==null&&be.has(Me)&&(M.width!==Me.image.width||M.height!==Me.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");A.setupDepthRenderbuffer(M)}}const Re=M.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&&(he=!0);const De=be.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(De[L])?U=De[L][G]:U=De[L],ie=!0):M.samples>0&&A.useMultisampledRTT(M)===!1?U=be.get(M).__webglMultisampledFramebuffer:Array.isArray(De)?U=De[G]:U=De,g.copy(M.viewport),S.copy(M.scissor),O=M.scissorTest}else g.copy(te).multiplyScalar(X).floor(),S.copy(Q).multiplyScalar(X).floor(),O=xe;if(Ae.bindFramebuffer(R.FRAMEBUFFER,U)&&V&&Ae.drawBuffers(M,U),Ae.viewport(g),Ae.scissor(S),Ae.setScissorTest(O),ie){const ve=be.get(M.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+L,ve.__webglTexture,G)}else if(he){const ve=be.get(M.texture),Re=L||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,ve.__webglTexture,G||0,Re)}I=-1},this.readRenderTargetPixels=function(M,L,G,V,U,ie,he){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _e=be.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&he!==void 0&&(_e=_e[he]),_e){Ae.bindFramebuffer(R.FRAMEBUFFER,_e);try{const ve=M.texture,Re=ve.format,De=ve.type;if(!ke.textureFormatReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ke.textureTypeReadable(De)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=M.width-V&&G>=0&&G<=M.height-U&&R.readPixels(L,G,V,U,Le.convert(Re),Le.convert(De),ie)}finally{const ve=b!==null?be.get(b).__webglFramebuffer:null;Ae.bindFramebuffer(R.FRAMEBUFFER,ve)}}},this.readRenderTargetPixelsAsync=async function(M,L,G,V,U,ie,he){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _e=be.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&he!==void 0&&(_e=_e[he]),_e){const ve=M.texture,Re=ve.format,De=ve.type;if(!ke.textureFormatReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ke.textureTypeReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(L>=0&&L<=M.width-V&&G>=0&&G<=M.height-U){Ae.bindFramebuffer(R.FRAMEBUFFER,_e);const Me=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Me),R.bufferData(R.PIXEL_PACK_BUFFER,ie.byteLength,R.STREAM_READ),R.readPixels(L,G,V,U,Le.convert(Re),Le.convert(De),0);const je=b!==null?be.get(b).__webglFramebuffer:null;Ae.bindFramebuffer(R.FRAMEBUFFER,je);const Qe=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Hl(R,Qe,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Me),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ie),R.deleteBuffer(Me),R.deleteSync(Qe),ie}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(M,L=null,G=0){M.isTexture!==!0&&(ir("WebGLRenderer: copyFramebufferToTexture function signature has changed."),L=arguments[0]||null,M=arguments[1]);const V=Math.pow(2,-G),U=Math.floor(M.image.width*V),ie=Math.floor(M.image.height*V),he=L!==null?L.x:0,_e=L!==null?L.y:0;A.setTexture2D(M,0),R.copyTexSubImage2D(R.TEXTURE_2D,G,0,0,he,_e,U,ie),Ae.unbindTexture()},this.copyTextureToTexture=function(M,L,G=null,V=null,U=0){M.isTexture!==!0&&(ir("WebGLRenderer: copyTextureToTexture function signature has changed."),V=arguments[0]||null,M=arguments[1],L=arguments[2],U=arguments[3]||0,G=null);let ie,he,_e,ve,Re,De;G!==null?(ie=G.max.x-G.min.x,he=G.max.y-G.min.y,_e=G.min.x,ve=G.min.y):(ie=M.image.width,he=M.image.height,_e=0,ve=0),V!==null?(Re=V.x,De=V.y):(Re=0,De=0);const Me=Le.convert(L.format),je=Le.convert(L.type);A.setTexture2D(L,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,L.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,L.unpackAlignment);const Qe=R.getParameter(R.UNPACK_ROW_LENGTH),nt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),yt=R.getParameter(R.UNPACK_SKIP_PIXELS),Ke=R.getParameter(R.UNPACK_SKIP_ROWS),Ee=R.getParameter(R.UNPACK_SKIP_IMAGES),ft=M.isCompressedTexture?M.mipmaps[U]:M.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,ft.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,ft.he
3839ight),R.pixelStorei(R.UNPACK_SKIP_PIXELS,_e),R.pixelStorei(R.UNPACK_SKIP_ROWS,ve),M.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,U,Re,De,ie,he,Me,je,ft.data):M.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,U,Re,De,ft.width,ft.height,Me,ft.data):R.texSubImage2D(R.TEXTURE_2D,U,Re,De,ie,he,Me,je,ft),R.pixelStorei(R.UNPACK_ROW_LENGTH,Qe),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,nt),R.pixelStorei(R.UNPACK_SKIP_PIXELS,yt),R.pixelStorei(R.UNPACK_SKIP_ROWS,Ke),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ee),U===0&&L.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Ae.unbindTexture()},this.copyTextureToTexture3D=function(M,L,G=null,V=null,U=0){M.isTexture!==!0&&(ir("WebGLRenderer: copyTextureToTexture3D function signature has changed."),G=arguments[0]||null,V=arguments[1]||null,M=arguments[2],L=arguments[3],U=arguments[4]||0);let ie,he,_e,ve,Re,De,Me,je,Qe;const nt=M.isCompressedTexture?M.mipmaps[U]:M.image;G!==null?(ie=G.max.x-G.min.x,he=G.max.y-G.min.y,_e=G.max.z-G.min.z,ve=G.min.x,Re=G.min.y,De=G.min.z):(ie=nt.width,he=nt.height,_e=nt.depth,ve=0,Re=0,De=0),V!==null?(Me=V.x,je=V.y,Qe=V.z):(Me=0,je=0,Qe=0);const yt=Le.convert(L.format),Ke=Le.convert(L.type);let Ee;if(L.isData3DTexture)A.setTexture3D(L,0),Ee=R.TEXTURE_3D;else if(L.isDataArrayTexture||L.isCompressedArrayTexture)A.setTexture2DArray(L,0),Ee=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,L.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,L.unpackAlignment);const ft=R.getParameter(R.UNPACK_ROW_LENGTH),$e=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Dt=R.getParameter(R.UNPACK_SKIP_PIXELS),Pn=R.getParameter(R.UNPACK_SKIP_ROWS),Tt=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,nt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,nt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,ve),R.pixelStorei(R.UNPACK_SKIP_ROWS,Re),R.pixelStorei(R.UNPACK_SKIP_IMAGES,De),M.isDataTexture||M.isData3DTexture?R.texSubImage3D(Ee,U,Me,je,Qe,ie,he,_e,yt,Ke,nt.data):L.isCompressedArrayTexture?R.compressedTexSubImage3D(Ee,U,Me,je,Qe,ie,he,_e,yt,nt.data):R.texSubImage3D(Ee,U,Me,je,Qe,ie,he,_e,yt,Ke,nt),R.pixelStorei(R.UNPACK_ROW_LENGTH,ft),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,$e),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Dt),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Tt),U===0&&L.generateMipmaps&&R.generateMipmap(Ee),Ae.unbindTexture()},this.initRenderTarget=function(M){be.get(M).__webglFramebuffer===void 0&&A.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?A.setTextureCube(M,0):M.isData3DTexture?A.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?A.setTexture2DArray(M,0):A.setTexture2D(M,0),Ae.unbindTexture()},this.resetState=function(){C=0,w=0,b=null,Ae.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===$s?"display-p3":"srgb",t.unpackColorSpace=qe.workingColorSpace===pr?"display-p3":"srgb"}}class Qd extends _t{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 Xt,this.environmentIntensity=1,this.environmentRotation=new Xt,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ep extends ri{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new We(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 ur=new N,hr=new N,to=new tt,di=new Zs,Yi=new Si,Qr=new N,no=new N;class tp extends _t{constructor(e=new wt,t=new ep){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}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++)ur.fromBufferAttribute(t,r-1),hr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ur.distanceTo(hr);e.setAttribute("lineDistance",new Gt(n,1))}else console.warn("THREE.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;
vendor: 18,437 bytes, lines 3839-3961
3839if(n.boundingSphere===null&&n.computeBoundingSphere(),Yi.copy(n.boundingSphere),Yi.applyMatrix4(r),Yi.radius+=s,e.ray.intersectsSphere(Yi)===!1)return;to.copy(r).invert(),di.copy(e.ray).applyMatrix4(to);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=n.index,p=n.attributes.position;if(d!==null){const m=Math.max(0,a.start),v=Math.min(d.count,a.start+a.count);for(let E=m,h=v-1;E<h;E+=c){const f=d.getX(E),T=d.getX(E+1),x=Ki(this,e,di,l,f,T);x&&t.push(x)}if(this.isLineLoop){const E=d.getX(v-1),h=d.getX(m),f=Ki(this,e,di,l,E,h);f&&t.push(f)}}else{const m=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count);for(let E=m,h=v-1;E<h;E+=c){const f=Ki(this,e,di,l,E,E+1);f&&t.push(f)}if(this.isLineLoop){const E=Ki(this,e,di,l,v-1,m);E&&t.push(E)}}}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 Ki(i,e,t,n,r,s){const a=i.geometry.attributes.position;if(ur.fromBufferAttribute(a,r),hr.fromBufferAttribute(a,s),t.distanceSqToSegment(ur,hr,Qr,no)>n)return;Qr.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Qr);if(!(l<e.near||l>e.far))return{distance:l,point:no.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const io=new N,ro=new N;class np extends tp{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)io.fromBufferAttribute(t,r),ro.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+io.distanceTo(ro);e.setAttribute("lineDistance",new Gt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ip extends ri{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new We(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 so=new tt,Gs=new Zs,$i=new Si,Zi=new N;class rp extends _t{constructor(e=new wt,t=new ip){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),$i.copy(n.boundingSphere),$i.applyMatrix4(r),$i.radius+=s,e.ray.intersectsSphere($i)===!1)return;so.copy(r).invert(),Gs.copy(e.ray).applyMatrix4(so);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const p=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let v=p,E=m;v<E;v++){const h=c.getX(v);Zi.fromBufferAttribute(u,h),ao(Zi,h,l,r,e,t,this)}}else{const p=Math.max(0,a.start),m=Math.min(u.count,a.start+a.count);for(let v=p,E=m;v<E;v++)Zi.fromBufferAttribute(u,v),ao(Zi,v,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function ao(i,e,t,n,r,s,a){const o=Gs.distanceSqToPoint(i);if(o<t){const l=new N;Gs.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class sp extends ht{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ap{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=oo();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function oo(){return performance.now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vs);const $o={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` 3840 3841 varying vec2 vUv; 3842 3843 void main() { 3844 3845 vUv = uv; 3846 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3847 3848 }`,fragmentShader:` 3849 3850 uniform float opacity; 3851 3852 uniform sampler2D tDiffuse; 3853 3854 varying vec2 vUv; 3855 3856 void main() { 3857 3858 vec4 texel = texture2D( tDiffuse, vUv ); 3859 gl_FragColor = opacity * texel; 3860 3861 3862 }`};class ai{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const op=new ko(-1,1,1,-1,0,1);class lp extends wt{constructor(){super(),this.setAttribute("position",new Gt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Gt([0,2,0,0,2,0],2))}}const cp=new lp;class Qs{constructor(e){this._mesh=new zt(cp,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,op)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Zo extends ai{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ht?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=_i.clone(e.uniforms),this.material=new ht({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Qs(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class lo extends ai{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(o),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class up extends ai{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class hp{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new He);this._width=n.width,this._height=n.height,t=new Ht(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:rn}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Zo($o),this.copyPass.material.blending=nn,this.clock=new ap}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}lo!==void 0&&(a instanceof lo?n=!0:a instanceof up&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new He);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}const fp={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:` 3863 precision highp float; 3864 3865 uniform mat4 modelViewMatrix; 3866 uniform mat4 projectionMatrix; 3867 3868 attribute vec3 position; 3869 attribute vec2 uv; 3870 3871 varying vec2 vUv; 3872 3873 void main() { 3874 3875 vUv = uv; 3876 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3877 3878 }`,fragmentShader:` 3879 3880 precision highp float; 3881 3882 uniform sampler2D tDiffuse; 3883 3884 #include <tonemapping_pars_fragment> 3885 #include <colorspace_pars_fragment> 3886 3887 varying vec2 vUv; 3888 3889 void main() { 3890 3891 gl_FragColor = texture2D( tDiffuse, vUv ); 3892 3893 // tone mapping 3894 3895 #ifdef LINEAR_TONE_MAPPING 3896 3897 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3898 3899 #elif defined( REINHARD_TONE_MAPPING ) 3900 3901 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3902 3903 #elif defined( CINEON_TONE_MAPPING ) 3904 3905 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3906 3907 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3908 3909 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3910 3911 #elif defined( AGX_TONE_MAPPING ) 3912 3913 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 3914 3915 #elif defined( NEUTRAL_TONE_MAPPING ) 3916 3917 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 3918 3919 #endif 3920 3921 // color space 3922 3923 #ifdef SRGB_TRANSFER 3924 3925 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 3926 3927 #endif 3928 3929 }`};class dp extends ai{constructor(){super();const e=fp;this.uniforms=_i.clone(e.uniforms),this.material=new sp({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new Qs(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},qe.getTransfer(this._outputColorSpace)===Je&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===fo?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===po?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===mo?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===go?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===_o?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===vo&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class pp extends ai{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new We}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}const mp={name:"LuminosityHighPassShader",shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new We(0)},defaultOpacity:{value:0}},vertexShader:` 3930 3931 varying vec2 vUv; 3932 3933 void main() { 3934 3935 vUv = uv; 3936 3937 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3938 3939 }`,fragmentShader:` 3940 3941 uniform sampler2D tDiffuse; 3942 uniform vec3 defaultColor; 3943 uniform float defaultOpacity; 3944 uniform float luminosityThreshold; 3945 uniform float smoothWidth; 3946 3947 varying vec2 vUv; 3948 3949 void main() { 3950 3951 vec4 texel = texture2D( tDiffuse, vUv ); 3952 3953 float v = luminance( texel.xyz ); 3954 3955 vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity ); 3956 3957 float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v ); 3958 3959 gl_FragColor = mix( outputColor, texel, alpha ); 3960 3961 }`};class ni extends ai{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new He(e.x,e.y):new He(256,256),this.clearColor=new We(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Ht(s,a,{type:rn}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let u=0;u<this.nMips;u++){const p=new Ht(s,a,{type:rn});p.texture.name="UnrealBloomPass.h"+u,p.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(p);const m=new Ht(s,a,{type:rn});m.texture.name="UnrealBloomPass.v"+u,m.texture.generateMipmaps=!1,this.renderTargetsVertical.push(m),s=Math.round(s/2),a=Math.round(a/2)}const o=mp;this.highPassUniforms=_i.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ht({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let u=0;u<this.nMips;u++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[u])),this.separableBlurMaterials[u].uniforms.invSize.value=new He(1/s,1/a),s=Math.round(s/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new N(1,1,1),new N(1,1,1),new N(1,1,1),new N(1,1,1),new N(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const d=$o;this.copyUniforms=_i.clone(d.uniforms),this.blendMaterial=new ht({uniforms:this.copyUniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,blending:Yn,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new We,this.oldClearAlpha=1,this.basic=new js,this.fsQuad=new Qs(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.invSize.value=new He(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}
vendor: 4,564 bytes, lines 3961-4010
3961render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=ni.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=ni.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new ht({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new He(.5,.5)},direction:{value:new He(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv; 3962 void main() { 3963 vUv = uv; 3964 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3965 }`,fragmentShader:`#include <common> 3966 varying vec2 vUv; 3967 uniform sampler2D colorTexture; 3968 uniform vec2 invSize; 3969 uniform vec2 direction; 3970 uniform float gaussianCoefficients[KERNEL_RADIUS]; 3971 3972 void main() { 3973 float weightSum = gaussianCoefficients[0]; 3974 vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum; 3975 for( int i = 1; i < KERNEL_RADIUS; i ++ ) { 3976 float x = float(i); 3977 float w = gaussianCoefficients[i]; 3978 vec2 uvOffset = direction * invSize * x; 3979 vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb; 3980 vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb; 3981 diffuseSum += (sample1 + sample2) * w; 3982 weightSum += 2.0 * w; 3983 } 3984 gl_FragColor = vec4(diffuseSum/weightSum, 1.0); 3985 }`})}getCompositeMaterial(e){return new ht({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv; 3986 void main() { 3987 vUv = uv; 3988 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3989 }`,fragmentShader:`varying vec2 vUv; 3990 uniform sampler2D blurTexture1; 3991 uniform sampler2D blurTexture2; 3992 uniform sampler2D blurTexture3; 3993 uniform sampler2D blurTexture4; 3994 uniform sampler2D blurTexture5; 3995 uniform float bloomStrength; 3996 uniform float bloomRadius; 3997 uniform float bloomFactors[NUM_MIPS]; 3998 uniform vec3 bloomTintColors[NUM_MIPS]; 3999 4000 float lerpBloomFactor(const in float factor) { 4001 float mirrorFactor = 1.2 - factor; 4002 return mix(factor, mirrorFactor, bloomRadius); 4003 } 4004 4005 void main() { 4006 gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + 4007 lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + 4008 lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + 4009 lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + 4010 lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0
4010) * texture2D(blurTexture5, vUv) ); 4011 }`})}}ni.BlurDirectionX=new He(1,0);ni.BlurDirectionY=new He(0,1);function gp(i){const e=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],t=Array.from({length:256},(a,o)=>o);for(let a=255;a>0;a--){const o=Math.floor(i()*(a+1));[t[a],t[o]]=[t[o],t[a]]}const n=new Uint8Array(512);for(let a=0;a<512;a++)n[a]=t[a&255];const r=1/3,s=1/6;return(a,o,l)=>{const c=(a+o+l)*r,d=Math.floor(a+c),u=Math.floor(o+c),p=Math.floor(l+c),m=(d+u+p)*s,v=a-d+m,E=o-u+m,h=l-p+m;let f,T,x,y,C,w;v>=E?E>=h?(f=1,T=0,x=0,y=1,C=1,w=0):v>=h?(f=1,T=0,x=0,y=1,C=0,w=1):(f=0,T=0,x=1,y=1,C=0,w=1):E<h?(f=0,T=0,x=1,y=0,C=1,w=1):v<h?(f=0,T=1,x=0,y=0,C=1,w=1):(f=0,T=1,x=0,y=1,C=1,w=0);const b=v-f+s,I=E-T+s,K=h-x+s,g=v-y+2*s,S=E-C+2*s,O=h-w+2*s,H=v-1+3*s,k=E-1+3*s,j=h-1+3*s,z=d&255,X=u&255,D=p&255,$=(te,Q,xe,Se)=>{let F=.6-te*te-Q*Q-xe*xe;if(F<0)return 0;F*=F;const J=e[Se%12];return F*F*(J[0]*te+J[1]*Q+J[2]*xe)};return 32*($(v,E,h,n[z+n[X+n[D]]])+$(b,I,K,n[z+f+n[X+T+n[D+x]]])+$(g,S,O,n[z+y+n[X+C+n[D+w]]])+$(H,k,j,n[z+1+n[X+1+n[D+1]]]))}}const fr=7,ji=i=>{const e=Math.hypot(i[0],i[1],i[2]);return[i[0]/e,i[1]/e,i[2]/e]};function _p(i){const e=gp(i),t=1.5,n=()=>{const T=i()*2-1,x=i()*Math.PI*2,y=Math.sqrt(1-T*T);return[y*Math.cos(x),T,y*Math.sin(x)]},r=T=>e(T[0]*3.2,T[1]*3.2,T[2]*3.2)+.36*e(T[0]*6.6+7,T[1]*6.6,T[2]*6.6),s=T=>{const x=T[2]>=0?1:-1,y=T[0]*1.02;let C=T[1]*.76,w=x*(Math.abs(T[2])*.62+.04);C*=1-.1*Math.max(0,T[0]),T[0]<-.55&&(w*=.9,C*=.95),C<-.28&&(C=-.28+(C+.28)*.35),T[1]<-.02&&T[0]>-.5&&T[0]<.6&&(w*=1.1,C-=.1*(1-Math.abs(T[0]-.05)));const b=r([y,C,w]),I=1+.05*(1-Math.min(1,Math.abs(b)*3));return[y*I*t,C*I*t+.1,w*I*t]},a=[[.66,.46,.6],[-.36,.7,.6],[.2,-.22,.95]].map(ji),o=[[[-.06,.2,.98],[.9,-.08,.42]],[[-.82,.22,.52],[.24,.9,.36]],[[-.52,-.1,.84],[.62,.02,.78]]].map(T=>T.map(ji)),l=a.map(s),c=o.map(T=>T.map(s)),d=(T,x)=>Math.hypot(T[0]-x[0],T[1]-x[1],T[2]-x[2]),u=[];l.forEach((T,x)=>c[x].forEach(y=>u.push({a:T,b:y,grp:x})));for(let T=0;T<20;T++)u.push({a:s(n()),b:s(n()),grp:-1});const p=()=>{const T=i();if(T<.87){let C=n(),w=!1;if(i()<.86)for(let O=0;O<140;O++){const H=s(C);if(Math.abs(r([H[0]/t,(H[1]-.1)/t,H[2]/t]))<.028){w=!0;break}C=n()}const b=s(C);let I=-1,K=0,g=0,S=9;return l.forEach((O,H)=>{const k=d(b,O),j=Math.min(...c[H].map(X=>d(b,X))),z=Math.min(k,j);z<S&&z<.4&&(S=z,I=H,K=Math.max(0,1-k/.36),g=Math.max(0,1-j/.3))}),{p:b,kind:w?1:0,hot:K,grp:I,glow:g}}if(T<.97){let C=n();for(let w=0;w<24&&Math.abs(Math.sin(C[1]*36))>.3;w++)C=n();return{p:[(-.74+C[0]*.3)*t,(-.44+C[1]*.2)*t+.1,C[2]*.5*t],kind:1,hot:0,grp:-1,glow:0}}const x=i(),y=i()*Math.PI*2;return{p:[(-.28-x*.1+Math.cos(y)*.075)*t,(-.36-x*.5)*t+.1,Math.sin(y)*.075*t],kind:0,hot:0,grp:-1,glow:0}},m=T=>{const x=[];for(let y=0;y<T;y++){const C=i()<.5?u[Math.floor(i()*6)]:u[6+Math.floor(i()*(u.length-6))],w=C.grp<0&&i()<.5,b=i();for(let I=0;I<fr;I++)x.push({p:w?C.b:C.a,to:w?C.a:C.b,kind:2,hot:0,grp:C.grp,glow:0,trail:I,phase:b})}return x},v=[...l.map((T,x)=>({p:T,n:a[x]})),...c.flatMap((T,x)=>T.map((y,C)=>({p:y,n:o[x][C]})))],E=(T,x)=>{const y=[],C=[],w=[];for(let b=0;b<=x;b++){const I=b/x*Math.PI;for(let K=0;K<=T;K++){const g=K/T*Math.PI*2,S=[Math.cos(g)*Math.sin(I),Math.cos(I),Math.sin(g)*Math.sin(I)],O=s(S);y.push(O[0],O[1],O[2]),C.push(1-Math.min(1,Math.abs(r([O[0]/t,(O[1]-.1)/t,O[2]/t]))*3))}}for(let b=0;b<x;b++)for(let I=0;I<T;I++){const K=b*(T+1)+I,g=K+T+1;w.push(K,g,K+1,g,g+1,K+1)}return{pos:new Float32Array(y),crown:new Float32Array(C),idx:w}},h=18;return{surface:p,comets:m,anchors:v,shell:E,fibres:T=>{const x=()=>(i()+i()+i()-1.5)/1.5,y=(X,D)=>{const te=[0,.32,(X[2]>=0?1:-1)*.5];return[te[0]+(X[0]-te[0])*D,te[1]+(X[1]-te[1])*D,te[2]+(X[2]-te[2])*D]},C=(X,D)=>ji([X[0]+x()*D,X[1]+x()*D,X[2]+x()*D]),w=(X,D)=>[X[0]+x()*D,X[1]+x()*D,X[2]+x()*D],b=[],I=X=>{let D=n();for(let $=0;$<60&&!X(D);$++)D=n();return D},K=Math.max(5,Math.round(T*.06/6));for(l.forEach((X,D)=>c[D].forEach($=>{for(let te=0;te<K;te++){const Q=w(X,.05),xe=w($,.05);b.push({c:[y(Q,.93),w(y(Q,.5),.03),w(y(xe,.5),.03),y(xe,.93)],grp:D,kind:3})}}));b.length<T;){const X=i(),D=8+Math.floor(i()*12);if(X<.42){const $=i()<.5?1:-1,te=i()<.55,Q=I(F=>F[2]*$>.15&&(!te||F[0]>.25)),xe=I(F=>F[2]*$>.15&&(te?F[0]<-.25:Math.hypot(F[0]-Q[0],F[1]-Q[1],F[2]-Q[2])>.5&&Math.hypot(F[0]-Q[0],F[1]-Q[1],F[2]-Q[2])<1.1)),Se=te?.42:.62;for(let F=0;F<D;F++){const J=s(C(Q,.07)),re=s(C(xe,.07));b.push({c:[y(J,.9),w(y(J,Se),.04),w(y(re,Se),.04),y(re,.9)],grp:-1,kind:0})}}else if(X<.7){const $=I(Q=>Q[2]>.2&&Q[1]>-.05&&Q[0]>-.75&&Q[0]<.8),te=Math.max(-.75,Math.min(.85,$[0]*.75));for(let Q=0;Q<D;Q++){const xe=s(C($,.08)),Se=C([$[0],$[1],-$[2]],.08),F=s([Se[0],Se[1],-Math.abs(Se[2])]),J=.42+x()*.05,re=te+x()*.06;b.push({c:[y(xe,.9),[re,J,.28+x()*.04],[re,J,-.28+x()*.04],y(F,.9)],grp:-1,kind:1})}}else if(X<.88){const $=i()<.5?1:-1,te=I(Q=>Q[2]*$>.1&&Q[1]>.15);for(let Q=0;Q<D;Q++){const xe=s(C(te,.08));b.push({c:[y(xe,.9),w(y(xe,.45),.04),[-.22+x()*.05,-.05+x()*.04,$*(.26+x()*.03)],[-.44+x()*.03,-.78+x()*.06,$*.05]],grp:-1,kind:2})}}else{const $=i()<.5?1:-1,te=I(xe=>xe[2]*$>.1),Q=C(te,.35);for(let xe=0;
4011xe<Math.ceil(D/2);xe++){const Se=s(C(te,.05)),F=s(C(Q,.05));b.push({c:[y(Se,.93),y(Se,.72),y(F,.72),y(F,.93)],grp:-1,kind:0})}}}b.length=Math.min(b.length,T);const g=b.length*(h+1),S=new Float32Array(g*3),O=new Float32Array(g*3),H=new Float32Array(g),k=new Float32Array(g*4),j=new Uint32Array(b.length*h*2),z=(X,D)=>{const $=1-D,te=$*$*$,Q=3*$*$*D,xe=3*$*D*D,Se=D*D*D;return[0,1,2].map(F=>te*X[0][F]+Q*X[1][F]+xe*X[2][F]+Se*X[3][F])};return b.forEach((X,D)=>{const $=i(),te=i(),Q=Array.from({length:h+1},(xe,Se)=>z(X.c,Se/h));Q.forEach((xe,Se)=>{const F=D*(h+1)+Se,J=Q[Math.max(0,Se-1)],re=Q[Math.min(h,Se+1)],oe=ji([re[0]-J[0]+1e-6,re[1]-J[1],re[2]-J[2]]);S.set(xe,F*3),O.set([Math.abs(oe[0]),Math.abs(oe[1]),Math.abs(oe[2])],F*3),H[F]=Se/h,k.set([$,X.grp,X.kind,te],F*4),Se<h&&j.set([F,F+1],(D*h+Se)*2)})}),{pos:S,tan:O,t:H,meta:k,idx:j}}}}function vp(i){return()=>{i|=0,i=i+1831565813|0;let e=Math.imul(i^i>>>15,1|i);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const co={wide:{closed:{fx:0,fy:-.02,s:2,pitch:.12,yaw:-.18},open:{fx:.235,fy:-.01,s:1.45,pitch:.4,yaw:-.52}},tall:{closed:{fx:0,fy:.03,s:1.4,pitch:.12,yaw:-.18},open:{fx:-.03,fy:.165,s:1.3,pitch:.4,yaw:-.4}}},pi=[1,1,0,.9,0],_r=.3,dt={cols:46,rows:34,gap:26,z:-46,rx:58*Math.PI/180,rz:-36*Math.PI/180};function xp(i){const e=vp(7),t=()=>(e()+e()+e()-1.5)/1.5,n=()=>{const x=e()*2-1,y=e()*Math.PI*2,C=Math.sqrt(1-x*x);return[C*Math.cos(y),x,C*Math.sin(y)]},r=new Float32Array(i*3),s=new Float32Array(i*3),a=new Float32Array(i*4),o=new Float32Array(i*2),l=new Float32Array(i*3),c=new Float32Array(i*4),d=new Float32Array(i*4),u=_p(e),p=Math.round(i*.1/fr),m=[...u.comets(p)];for(;m.length<i;)m.push(u.surface());const v=dt.cols*dt.rows,E=Math.cos(dt.rz),h=Math.sin(dt.rz),f=Math.cos(dt.rx),T=Math.sin(dt.rx);for(let x=0;x<i;x++){const y=m[x],C=x*3,w=y.kind===2?y.phase:e();r.set(y.p,C),s.set(y.to??y.p,C);const b=y.kind===2?3.3*(1-y.trail/fr*.55):y.kind===1?1.9+e()*.7:1.3+e()*.6;a.set([w,b+y.hot*1.2,y.hot,y.kind],x*4),o.set([y.grp,y.kind===2?y.trail:y.glow],x*2),l.set([e(),t()*(e()<.15?2.2:1),t()],C);const I=n(),K=e()<.75?.9+e()*.1:Math.cbrt(e());c.set([I[0]*K,I[1]*K,I[2]*K,x%6],x*4);const g=x%v,S=(g%dt.cols-(dt.cols-1)/2)*dt.gap,O=(Math.floor(g/dt.cols)-(dt.rows-1)/2)*dt.gap,H=S*E-O*h,k=S*h+O*E,j=dt.z,z=k*f-j*T,X=k*T+j*f,D=S/(dt.cols*dt.gap/2),$=O/(dt.rows*dt.gap/2),te=Math.max(0,1-Math.pow(Math.hypot(D,$*1.1),2.2));d.set([H,z,X,x<v?te:0],x*4)}return{pos:r,plate:s,meta:a,grp:o,river:l,silo:c,floor:d,anchors:u.anchors,brain:u}}const Mp=` 4012uniform float uTime, uStage, uOpen, uFocus, uFocusAmt, uScale, uPx, uClockA, uClockF, uLagP, uPxW, uSiloR, uPileH; 4013uniform mat3 uRot; 4014uniform vec3 uOffset, uLagA, uLagB, uStripA, uStripB, uFloorC; 4015attribute vec3 aPlate, aRiver; 4016attribute vec4 aMeta, aSilo, aFloor; 4017attribute vec2 aGrp; 4018varying vec3 vColor; 4019varying float vAlpha; 4020float e(float x) { x = clamp(x, 0.0, 1.0); return x * x * (3.0 - 2.0 * x); } 4021 4022const vec3 CYAN = vec3(0.110, 0.847, 0.871); 4023const vec3 LILAC = vec3(0.612, 0.514, 0.969); 4024const vec3 ICE = vec3(0.86, 1.0, 1.0); 4025 4026void main() { 4027 float phase = aMeta.x; 4028 float size = aMeta.y; 4029 float hot = aMeta.z; 4030 float kind = aMeta.w; 4031 float g = aGrp.x; 4032 float lag = phase * 0.3; 4033 float s = uStage; 4034 float mine = (1.0 - step(0.5, abs(g - uFocus))) * step(-0.5, uFocus) * uFocusAmt; // in the selected region 4035 float other = uFocusAmt * (1.0 - mine); 4036 4037 // ---------------- 0 brain ---------------- 4038 float isT = step(1.5, kind); 4039 float line = step(0.5, kind) * (1.0 - isT); 4040 vec3 a = position * (1.0 + 0.008 * sin(uTime * 1.1 + phase * 30.0)); 4041 // comets run their wire, arcing over the cortex; the selected region's comets run on their own, quicker clock 4042 float clock = mix(uClockA, uClockF, mine); 4043 float tt = fract(clock + phase) - aGrp.y * 0.011 * isT; 4044 float tc = clamp(tt, 0.0, 1.0); 4045 vec3 mid = normalize(position + aPlate + vec3(0.0001)); 4046 vec3 travel = mix(position, aPlate, tc) + mid * (0.22 + 0.12 * step(-0.5, g)) * sin(3.14159 * tc); 4047 a = mix(a, travel, isT); 4048 a.z += sign(a.z + 0.0001) * uOpen * ${_r.toFixed(2)}; 4049 float trailF = 1.0 - aGrp.y / ${fr.toFixed(1)}; 4050 float travelA = mix(1.0, smoothstep(0.0, 0.06, tt) * smoothstep(1.0, 0.9, tt) * trailF * trailF, isT); 4051 4052 vec3 ra = uRot * a; 4053 vec3 pBrain = ra * uScale + uOffset; 4054 // depth and rim: the far side recedes, the silhouette catches light 4055 float depth = smoothstep(-1.4, 1.2, ra.z); 4056 vec3 nrm = uRot * normalize(position / vec3(2.3, 1.25, 0.95)); 4057 float rim = pow(1.0 - abs(nrm.z), 3.0) * (1.0 - isT); 4058 float pulse = 0.78 + 0.22 * sin(uTime * 2.0 + phase * 6.0); 4059 float hotA = hot * pulse * (1.0 + 0.6 * mine) * (1.0 - 0.6 * other); 4060 float glow = (1.0 - isT) * aGrp.y * mine * (0.75 + 0.25 * sin(uTime * 3.0 + phase * 9.0)); 4061 float brainA = (0.11 + 0.85 * line + 0.55 * rim + 1.1 * hotA + 1.0 * glow + isT * (0.6 + 0.45 * mine) * (1.0 + uOpen * 0.1)) * travelA; 4062 brainA *= mix(0.4, 1.0, depth) * (1.0 - 0.35 * other * (1.0 - isT)) * (1.0 - 0.7 * other * isT); 4063 float grad = smoothstep(-1.5, 1.3, -position.x + 0.35 * position.y) * 0.85 + (fract(phase * 7.13) - 0.5) * 0.3; 4064 vec3 brainC = mix(CYAN, LILAC, clamp(grad, 0.0, 1.0)); 4065 brainC = mix(brainC, mix(LILAC, ICE, 0.45), rim * 0.55); 4066 brainC = mix(brainC, ICE, clamp(hotA * 0.8 + glow + isT * 0.55, 0.0, 1.0)); 4067 float brainS = size * (0.6 + 0.3 * uScale) * mix(0.72, 1.18, depth) * (1.0 + isT * mine * 0.35); 4068 4069 // ---------------- 1 river ---------------- 4070 float lead = max(uLagP, 0.015); 4071 float rs = fract(aRiver.x + uTime * 0.045); 4072 // signals slow down as they near the head and heap up there: nobody has decided yet 4073 float xf = lead * (1.0 - pow(1.0 - rs, 1.9)); 4074 float pile = smoothstep(0.4, 1.0, rs); 4075 float wave = sin(xf * 26.0 - uTime * 2.2 + aRiver.z) * 3.0 * (1.0 - pile); 4076 float hpx = aRiver.y * 6.0 * (1.0 - pile) + wave + abs(aRiver.y) * (6.0 + uPileH * uLagP) * pow(pile, 1.6); 4077 vec3 pRiver = mix(uLagA, uLagB, xf) + vec3(0.0, (hpx + 4.0) * uPxW, aRiver.z * 0.25); 4078 float riverOn = step(phase, 0.62); 4079 float riverA = riverOn * (0.75 + 1.0 * pile) * smoothstep(0.0, 0.04, rs) * (0.75 + 0.25 * sin(uTime * 3.0 + phase * 40.0)); 4080 vec3 riverC = mix(CYAN, ICE, pile * pile * 0.8); 4081 riverC = mix(riverC, LILAC, (1.0 - pile) * step(0.8, fract(phase * 13.7))); 4082 4083 // ---------------- 2 silos ---------------- 4084 float sa = uTime * 0.25 + aSilo.w; 4085 vec3 so = vec3(aSilo.x * cos(sa) - aSilo.z * sin(sa), aSilo.y, aSilo.x * sin(sa) + aSilo.z * cos(sa)); 4086 vec3 pSilo = mix(uStripA, uStripB, (aSilo.w + 0.5) / 6.0) + so * uSiloR; 4087 float siloA = step(phase, 0.5) * 0.8 * (0.6 + 0.4 * smoothstep(-1.0, 1.0, so.z)); 4088 vec3 siloC = mix(CYAN, LILAC, step(0.5, fract(aSilo.w * 0.5 + 0.25)) * 0.8); 4089 4090 // ---------------- 3 floor ---------------- 4091 vec3 pFloor = uFloorC + vec3(aFloor.x, -aFloor.y, aFloor.z) * uPxW; 4092 float floorA = aFloor.w * 1.1 * (0.7 + 0.3 * sin(uTime * 1.4 - aFloor.x * 0.012 - aFloor.y * 0.01)); 4093 vec3 floorC = mix(LILAC, CYAN, 0.55); 4094 4095 // ---------------- blend ---------------- 4096 float w1 = e(s * 1.3 - lag); 4097 float w2 = e((s - 1.0) * 1.3 - lag); 4098 float w3 = e((s - 2.0) * 1.3 - lag);
4099 vec3 p = mix(mix(mix(pBrain, pRiver, w1), pSilo, w2), pFloor, w3); 4100 float al = mix(mix(mix(brainA, riverA, w1), siloA, w2), floorA, w3); 4101 vec3 col = mix(mix(mix(brainC, riverC, w1), siloC, w2), floorC, w3); 4102 float sz = mix(mix(mix(brainS, 2.5 + pile * 1.2, w1), 1.9, w2), 3.4, w3); 4103 p += 0.01 * vec3(sin(uTime * (0.5 + phase) + phase * 20.0), cos(uTime * (0.4 + phase) + phase * 13.0), sin(uTime * 0.3 + phase * 7.0)) * (1.0 - w3); 4104 4105 vec4 mv = modelViewMatrix * vec4(p, 1.0); 4106 gl_Position = projectionMatrix * mv; 4107 gl_PointSize = sz * uPx / -mv.z; 4108 vColor = col; 4109 vAlpha = al; 4110} 4111`,Sp=` 4112uniform float uOpacity; 4113varying vec3 vColor; 4114varying float vAlpha; 4115void main() { 4116 vec2 c = gl_PointCoord - 0.5; 4117 float d = dot(c, c) * 4.0; 4118 if (d > 1.0) discard; 4119 float core = (1.0 - d); 4120 float a = clamp(vAlpha * uOpacity * core * core, 0.0, 1.0); 4121 gl_FragColor = vec4(vColor * a, a); 4122} 4123`,jo=` 4124uniform float uTime, uOpen, uScale, uFocus, uFocusAmt, uBrainA; 4125uniform mat3 uRot; 4126uniform vec3 uOffset; 4127const vec3 CYAN = vec3(0.110, 0.847, 0.871); 4128const vec3 LILAC = vec3(0.612, 0.514, 0.969); 4129const vec3 ICE = vec3(0.86, 1.0, 1.0); 4130`,Ep=`${jo} 4131attribute float aCrown; 4132varying vec3 vC; 4133varying float vA, vZ; 4134void main() { 4135 vec3 a = position; 4136 a.z += sign(a.z + 0.0001) * uOpen * ${_r.toFixed(2)}; 4137 vec3 ra = uRot * a; 4138 vec3 n = normalize(uRot * normal); 4139 float fres = pow(1.0 - abs(n.z), 2.4); 4140 float depth = smoothstep(-1.4, 1.2, ra.z); 4141 vA = (0.016 + 0.12 * fres) * (0.55 + 0.45 * aCrown) * mix(0.45, 1.0, depth) * uBrainA; 4142 vC = mix(CYAN, LILAC, clamp(smoothstep(-1.5, 1.3, -position.x + 0.35 * position.y), 0.0, 1.0)); 4143 vC = mix(vC, ICE, fres * 0.35); 4144 vZ = abs(position.z); 4145 gl_Position = projectionMatrix * modelViewMatrix * vec4(ra * uScale + uOffset, 1.0); 4146} 4147`,yp=` 4148varying vec3 vC; 4149varying float vA, vZ; 4150void main() { 4151 if (vZ < 0.075) discard; // no membrane across the fissure 4152 gl_FragColor = vec4(vC, vA); 4153} 4154`,Tp=`${jo} 4155attribute vec3 aTan; 4156attribute float aT; 4157attribute vec4 aFib; // phase, region, kind, speed 4158varying vec3 vC; 4159varying float vA; 4160void main() { 4161 vec3 a = position; 4162 a.z += clamp(a.z / 0.12, -1.0, 1.0) * uOpen * ${_r.toFixed(2)}; // the callosum stretches as the hemispheres part 4163 vec3 ra = uRot * a; 4164 float depth = smoothstep(-1.4, 1.2, ra.z); 4165 float g = aFib.y; 4166 float mine = (1.0 - step(0.5, abs(g - uFocus))) * step(-0.5, uFocus) * uFocusAmt; 4167 float other = uFocusAmt * (1.0 - mine); 4168 float link = step(-0.5, g); 4169 // a pulse of light travels each carrying fibre; the selected region's wires all carry, and faster 4170 float carries = max(step(0.5, fract(aFib.x * 7.31)), link); 4171 float head = fract(uTime * (0.07 + 0.07 * aFib.w + 0.16 * mine) + aFib.x); 4172 float d = aT - head; 4173 float pulse = exp(-d * d * 700.0) * carries; 4174 float tail = smoothstep(-0.22, 0.0, d) * (1.0 - step(0.0, d)) * carries; 4175 // direction colour, the DTI convention in the brand palette: front-back cyan, up-down lilac, left-right ice 4176 vec3 w = aTan / (aTan.x + aTan.y + aTan.z + 0.0001); 4177 vec3 col = CYAN * w.x + LILAC * w.y + ICE * w.z; 4178 col = mix(col, ICE, pulse * 0.7); 4179 float base = 0.05 + 0.05 * link; 4180 float A = base * (1.0 + 1.2 * mine) * (1.0 - 0.65 * other) 4181 + (pulse * 0.55 + tail * 0.08) * (0.7 + 0.5 * mine) * (1.0 - 0.75 * other); 4182 A *= mix(0.3, 1.0, depth) * smoothstep(0.0, 0.07, aT) * smoothstep(1.0, 0.93, aT) * uBrainA; 4183 vC = col; 4184 vA = A; 4185 gl_Position = projectionMatrix * modelViewMatrix * vec4(ra * uScale + uOffset, 1.0); 4186} 4187`,Ap=` 4188varying vec3 vC; 4189varying float vA; 4190void main() { gl_FragColor = vec4(vC, vA); } 4191`,bp={uniforms:{tDiffuse:{value:null},uRect:{value:new it(0,0,0,0)},uFeather:{value:60},uAmt:{value:0},uBg:{value:new N(8/255,8/255,16/255)}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }",fragmentShader:` 4192uniform sampler2D tDiffuse; 4193uniform vec4 uRect; 4194uniform float uFeather, uAmt; 4195uniform vec3 uBg; 4196varying vec2 vUv; 4197void main() { 4198 vec4 c = texture2D(tDiffuse, vUv); 4199 if (uAmt < 0.001) { gl_FragColor = vec4(c.rgb, 1.0); return; } 4200 vec2 ctr = (uRect.xy + uRect.zw) * 0.5; 4201 vec2 hb = max((uRect.zw - uRect.xy) * 0.5, vec2(1.0)); 4202 vec2 q = abs(gl_FragCoord.xy - ctr) - hb; 4203 float d = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0); 4204 float box = 1.0 - smoothstep(-uFeather * 0.4, uFeather, d); 4205 vec2 e = (gl_FragCoord.xy - ctr) / (hb + uFeather * 2.5); 4206 float halo = 1.0 - smoothstep(0.25, 1.0, length(e)); 4207 float dim = uAmt * max(box * 0.8, halo * 0.42); 4208 gl_FragColor = vec4(mix(c.rgb, uBg, dim), 1.0); 4209} 4210`};function Cp(i,{reduced:e,onSlow:t,onAnchors:n}){const r=window.innerWidth<760,a=xp(r?1e4:24e3),o=new Jd({canvas:i,antialias:!1,alpha:!1,powerPreference:"high-performance"});
4210o.outputColorSpace=Wt,o.setClearColor(new We().setRGB(8/255,8/255,16/255,Wt),1);const l=new Qd,c=new Pt(35,1,.1,100);c.position.set(0,0,11);const d=new wt;d.setAttribute("position",new et(a.pos,3)),d.setAttribute("aPlate",new et(a.plate,3)),d.setAttribute("aMeta",new et(a.meta,4)),d.setAttribute("aGrp",new et(a.grp,2)),d.setAttribute("aRiver",new et(a.river,3)),d.setAttribute("aSilo",new et(a.silo,4)),d.setAttribute("aFloor",new et(a.floor,4));const u={uTime:{value:6},uStage:{value:at.stage},uOpen:{value:at.open},uFocus:{value:-1},uFocusAmt:{value:0},uScale:{value:1},uPx:{value:11},uOpacity:{value:1},uClockA:{value:0},uClockF:{value:0},uLagP:{value:0},uPxW:{value:.01},uSiloR:{value:.3},uPileH:{value:58},uRot:{value:new Ne},uOffset:{value:new N},uLagA:{value:new N(-4,-2,0)},uLagB:{value:new N(4,-2,0)},uStripA:{value:new N(-4,0,0)},uStripB:{value:new N(4,0,0)},uFloorC:{value:new N(0,-.5,0)},uBrainA:{value:1}},p=new ht({vertexShader:Mp,fragmentShader:Sp,uniforms:u,transparent:!0,depthWrite:!1,depthTest:!1,blending:Yn}),m=new rp(d,p);m.frustumCulled=!1,m.renderOrder=2;const v={uTime:u.uTime,uOpen:u.uOpen,uScale:u.uScale,uFocus:u.uFocus,uFocusAmt:u.uFocusAmt,uRot:u.uRot,uOffset:u.uOffset,uBrainA:u.uBrainA},E=a.brain.shell(r?110:170,r?70:110),h=new wt;h.setAttribute("position",new et(E.pos,3)),h.setAttribute("aCrown",new et(E.crown,1)),h.setIndex(E.idx),h.computeVertexNormals();const f=new ht({vertexShader:Ep,fragmentShader:yp,uniforms:v,transparent:!0,depthWrite:!1,depthTest:!1,blending:Yn}),T=new zt(h,f);T.frustumCulled=!1;const x=a.brain.fibres(r?700:1600),y=new wt;y.setAttribute("position",new et(x.pos,3)),y.setAttribute("aTan",new et(x.tan,3)),y.setAttribute("aT",new et(x.t,1)),y.setAttribute("aFib",new et(x.meta,4)),y.setIndex(new et(x.idx,1));const C=new ht({vertexShader:Tp,fragmentShader:Ap,uniforms:v,transparent:!0,depthWrite:!1,depthTest:!1,blending:Yn}),w=new np(y,C);w.frustumCulled=!1,w.renderOrder=1,l.add(T,w,m);const b=new hp(o);b.addPass(new pp(l,c));const I=r?.5:.62,K=new ni(new He(256,256),I,.3,.3);b.addPass(K);const g=new Zo(bp);b.addPass(g),b.addPass(new dp);let S=1,O=1,H=1,k=1,j=r,z=1;const X=()=>{S=window.innerWidth,O=window.innerHeight,z=Math.min(window.devicePixelRatio,1.5),o.setPixelRatio(z),o.setSize(S,O,!1),b.setPixelRatio(z),b.setSize(S,O),c.aspect=S/O,j=S<760,c.position.z=Math.max(11,5.4/(.63*c.aspect)),c.updateProjectionMatrix(),k=2*c.position.z*Math.tan(35*Math.PI/360),H=k*c.aspect,u.uPx.value=z*c.position.z*(O/900),u.uPxW.value=k/O};X(),window.addEventListener("resize",X);const D=(_,B,Y)=>Y.set((_/S-.5)*H,-(B/O-.5)*k,0),$=new tt,te=new Xt,Q=new N,xe=new N,Se=document.createRange();let F=0,J=performance.now(),re=0,oe=0,Ce=0,ye=0,Ge=0,Pe=at.stage,Ue=at.open,R=at.lagP,rt=0,Ie=-1,ke=0,Ae=0,Ye=!1;const be=_=>{F=requestAnimationFrame(be);const B=Math.min(_-J,100);if(J=_,re<120&&(re++,B>34&&oe++,re===120&&oe>60))if(K.enabled)K.enabled=!1,re=0,oe=0;else return t();const Y=B/1e3,ee=e?u.uTime.value:u.uTime.value+Y;u.uTime.value=ee;const q=e?1:1-Math.pow(.002,Y);Pe+=(at.stage-Pe)*Math.min(1,q*1.6),Ue+=(at.open-Ue)*Math.min(1,q*1.4),R+=(at.lagP-R)*Math.min(1,q*2),Ce+=(at.mx-Ce)*Math.min(1,q),ye+=(at.my-ye)*Math.min(1,q),at.focus!==Ie?(rt+=(0-rt)*Math.min(1,q*3),(rt<.04||Ie<0)&&(Ie=at.focus,Ie<0&&(rt=0))):Ie>=0&&(rt+=(1-rt)*Math.min(1,q*2)),u.uStage.value=Pe,u.uOpen.value=Ue,u.uLagP.value=R,u.uFocus.value=Ie,u.uFocusAmt.value=rt;const ge=j?co.tall:co.wide,ae=Ue*Ue*(3-2*Ue),de=j?ge.open.s:Math.max(.95,Math.min(ge.open.s,.37*H/3.1)),Be=fe=>{const Fe=fe==="s"?de:ge.open[fe];return ge.closed[fe]+(Fe-ge.closed[fe])*ae},ne=Be("fx")*H,pe=Be("fy")*k,we=Be("s")*(e?1:1+.012*Math.sin(ee*.85));u.uOffset.value.set(ne,pe,0),u.uScale.value=we;const Te=Math.max(0,Math.min(pi.length-1,Math.floor(Pe))),me=Math.min(pi.length-1,Te+1),ze=Math.min(1,Math.max(0,Pe-Te));u.uOpacity.value=pi[Te]+(pi[me]-pi[Te])*ze*ze*(3-2*ze);const Le=1-Math.min(1,Math.max(0,Pe/.32));u.uBrainA.value=Le*Le*(3-2*Le),T.visible=w.visible=u.uBrainA.value>.002,K.strength=I*(1-.65*Math.min(1,Pe));const Ze=S/2+ne/H*S,P=O/2-pe/k*O,ue=(at.mx+1)/2*S,W=(at.my+1)/2*O,Z=Math.max(0,1-Math.hypot(ue-Ze,W-P)/(O*.42));Ge+=((Pe<.5?Z:0)-Ge)*Math.min(1,q),e||(ke+=Y*(.13+.06*Ge+.09*Ue),Ae+=Y*.34),u.uClockA.value=ke,u.uClockF.value=Ae;const le=e?0:.28*(1-Ue*.7);te.set(Be("pitch")+ye*.16+Math.sin(ee*.13)*.05*le,Be("yaw")+Math.sin(ee*.17)*le+Ce*.3,0),$.makeRotationFromEuler(te),u.uRot.value.setFromMatrix4($);const ce=at.els.title;let Ve=0;if(ce&&Pe<.6){Se.selectNodeContents(ce);const fe=Se.getBoundingClientRect();if(fe.bottom>-40&&fe.top<O+40&&fe.width>0){const Fe=10+fe.height*.04;g.uniforms.uRect.value.set((fe.left-Fe)*z,(O-fe.bottom-Fe)*z,(fe.right+Fe)*z,(O-fe.to
4210p+Fe)*z),g.uniforms.uFeather.value=Math.max(40,Math.min(90,fe.height*.22))*z,Ve=1-Math.min(1,Pe/.6)}}if(g.uniforms.uAmt.value=Ve,Pe>.2&&Pe<1.9&&at.els.bar){const fe=at.els.bar.getBoundingClientRect();D(fe.left,fe.top+fe.height/2,u.uLagA.value),D(fe.right,fe.top+fe.height/2,u.uLagB.value),u.uPileH.value=Math.max(22,Math.min(58,fe.width*.044))}if(Pe>1.1&&Pe<2.9&&at.els.strip){const fe=at.els.strip.getBoundingClientRect(),Fe=fe.width>=fe.height;D(Fe?fe.left:fe.left+fe.width/2,Fe?fe.top+fe.height/2:fe.top,u.uStripA.value),D(Fe?fe.right:fe.left+fe.width/2,Fe?fe.top+fe.height/2:fe.bottom,u.uStripB.value),u.uSiloR.value=Math.min(Fe?fe.width/6:fe.height/6,Fe?fe.height:fe.width)*.3*(k/O)}if(Pe>2.1&&Pe<3.95){const fe=at.els.floor;if(fe){const Fe=fe.getBoundingClientRect();D(Fe.left+Fe.width/2,Fe.top+Fe.height/2,u.uFloorC.value)}else D(S/2,O*.55,u.uFloorC.value)}if(n){const fe=Math.max(0,1-Pe*3);n(a.anchors.map(Fe=>(Q.set(Fe.p[0],Fe.p[1],Fe.p[2]+_r*Ue).applyMatrix4($).multiplyScalar(we).add(u.uOffset.value),xe.set(Fe.n[0],Fe.n[1],Fe.n[2]).applyMatrix4($),Q.project(c),{x:(Q.x+1)/2*S,y:(1-Q.y)/2*O,vis:fe*Math.min(1,Math.max(0,(xe.z+.1)*3)),cx:Ze,cy:P})))}if(u.uOpacity.value<.003){Ye||(i.style.visibility="hidden"),Ye=!0;return}Ye&&(i.style.visibility=""),Ye=!1,b.render(Y)},A=()=>{cancelAnimationFrame(F),document.hidden||(J=performance.now(),F=requestAnimationFrame(be))};return document.addEventListener("visibilitychange",A),F=requestAnimationFrame(be),{dispose(){cancelAnimationFrame(F),window.removeEventListener("resize",X),document.removeEventListener("visibilitychange",A),d.dispose(),p.dispose(),h.dispose(),f.dispose(),y.dispose(),C.dispose(),K.dispose(),b.dispose(),o.dispose()}}}export{Cp as createSignals};
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.