@deepseekcode/cli 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1057 -985
- package/package.json +31 -31
- package/web/dist/assets/{AutomationView-CPCd-Qhd.js → AutomationView-ClGqJM46.js} +1 -1
- package/web/dist/assets/{ChannelConfigView-D6JtjZyf.js → ChannelConfigView-BcGUdK94.js} +1 -1
- package/web/dist/assets/{ConnectorsView-BPPr7T9p.js → ConnectorsView-Dadj20jv.js} +1 -1
- package/web/dist/assets/{FileTreeView-CO8knuwu.js → FileTreeView-DLRQZmLP.js} +1 -1
- package/web/dist/assets/{HookConfigView-CYuzwf8u.js → HookConfigView-DE0NCrV9.js} +1 -1
- package/web/dist/assets/{ModelsView-Cji4mbXE.js → ModelsView-DVTuTql9.js} +1 -1
- package/web/dist/assets/{PluginsView-CKKnYKMP.js → PluginsView-DBF_BvKL.js} +1 -1
- package/web/dist/assets/SessionGrid-ByIAFTc2.js +38 -0
- package/web/dist/assets/SettingsPanel-CHRy0Xqj.js +4 -0
- package/web/dist/assets/{SkillsView-DmQGY9v0.js → SkillsView-BAorWQAI.js} +1 -1
- package/web/dist/assets/{TemplatesTab-_vSIuTZP.js → TemplatesTab-DEblm2pS.js} +1 -1
- package/web/dist/assets/{TerminalView-CTU0aA8o.js → TerminalView-Cnnipr8e.js} +1 -1
- package/web/dist/assets/ThreeScene-5Zi32o_j.js +2863 -0
- package/web/dist/assets/ThreeScene-DvOrMIoG.css +1 -0
- package/web/dist/assets/{ToolsView-DUEqePPo.js → ToolsView-lOHdaw4V.js} +1 -1
- package/web/dist/assets/{icons-qcawb7PZ.js → icons-DLsYqrD5.js} +144 -119
- package/web/dist/assets/index-Bht_ARrv.css +1 -0
- package/web/dist/assets/{index-DUpwXfa-.js → index-DEninW1j.js} +9 -9
- package/web/dist/assets/{markdown-yjmXQjrx.js → markdown-tZ6sw2sR.js} +1 -1
- package/web/dist/assets/{panels-CX_dYEv0.js → panels-wDJMsvra.js} +1 -1
- package/web/dist/assets/{react-vendor-CSlQceOk.js → react-vendor-BRkWBfPR.js} +1 -1
- package/web/dist/assets/{state-DOzZasIm.js → state-B80cA8v4.js} +1 -1
- package/web/dist/favicon.svg +38 -30
- package/web/dist/index.html +7 -7
- package/web/dist/logo.svg +38 -30
- package/web/dist/assets/SessionGrid-BOpVWUEK.js +0 -37
- package/web/dist/assets/SettingsPanel-R1fOoB25.js +0 -4
- package/web/dist/assets/index-DL2ULWxM.css +0 -1
|
@@ -0,0 +1,2863 @@
|
|
|
1
|
+
import{j as Yr}from"./markdown-tZ6sw2sR.js";import{a as mi}from"./icons-DLsYqrD5.js";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2010-2021 Three.js Authors
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/const $a="128",$o=0,Ns=1,Ko=2,Ka=1,el=2,Qn=3,er=0,Ze=1,tr=2,eo=1,ei=0,ti=1,Fs=2,Bs=3,zs=4,tl=5,Tn=100,nl=101,il=102,Os=103,Us=104,rl=200,sl=201,al=202,ol=203,to=204,no=205,ll=206,cl=207,hl=208,ul=209,dl=210,fl=0,pl=1,ml=2,Zr=3,gl=4,xl=5,vl=6,_l=7,nr=0,yl=1,Ml=2,ni=0,wl=1,bl=2,Sl=3,El=4,Tl=5,io=300,is=301,rs=302,Hs=303,Gs=304,ss=306,as=307,jr=1e3,Mt=1001,Jr=1002,rt=1003,Vs=1004,ks=1005,dt=1006,Al=1007,os=1008,ls=1009,Ll=1010,Rl=1011,Xi=1012,Cl=1013,qi=1014,qt=1015,Yi=1016,Pl=1017,Dl=1018,Il=1019,ii=1020,Nl=1021,sn=1022,wt=1023,Fl=1024,Bl=1025,Cn=1026,ai=1027,zl=1028,Ol=1029,Ul=1030,Hl=1031,Gl=1032,Vl=1033,Ws=33776,qs=33777,Xs=33778,Ys=33779,Zs=35840,js=35841,Js=35842,Qs=35843,kl=36196,$s=37492,Ks=37496,Wl=37808,ql=37809,Xl=37810,Yl=37811,Zl=37812,jl=37813,Jl=37814,Ql=37815,$l=37816,Kl=37817,ec=37818,tc=37819,nc=37820,ic=37821,rc=36492,sc=37840,ac=37841,oc=37842,lc=37843,cc=37844,hc=37845,uc=37846,dc=37847,fc=37848,pc=37849,mc=37850,gc=37851,xc=37852,vc=37853,_c=2200,yc=2201,Mc=2202,Zi=2300,ji=2301,ur=2302,An=2400,Ln=2401,Ji=2402,cs=2500,ro=2501,wc=0,di=3e3,so=3001,bc=3007,Sc=3002,Ec=3003,Tc=3004,Ac=3005,Lc=3006,Rc=3200,Cc=3201,In=0,Pc=1,dr=7680,Dc=519,oi=35044,Qi=35048,ea="300 es";class on{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 i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.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 i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const $e=[];for(let r=0;r<256;r++)$e[r]=(r<16?"0":"")+r.toString(16);const fr=Math.PI/180,Qr=180/Math.PI;function At(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return($e[r&255]+$e[r>>8&255]+$e[r>>16&255]+$e[r>>24&255]+"-"+$e[e&255]+$e[e>>8&255]+"-"+$e[e>>16&15|64]+$e[e>>24&255]+"-"+$e[t&63|128]+$e[t>>8&255]+"-"+$e[t>>16&255]+$e[t>>24&255]+$e[n&255]+$e[n>>8&255]+$e[n>>16&255]+$e[n>>24&255]).toUpperCase()}function ht(r,e,t){return Math.max(e,Math.min(t,r))}function Ic(r,e){return(r%e+e)%e}function pr(r,e,t){return(1-t)*r+t*e}function ta(r){return(r&r-1)===0&&r!==0}function Nc(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Fc(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}class X{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("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,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}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,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}X.prototype.isVector2=!0;class Ke{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],x=i[0],v=i[3],g=i[6],p=i[1],T=i[4],R=i[7],E=i[2],_=i[5],C=i[8];return s[0]=a*x+o*p+l*E,s[3]=a*v+o*T+l*_,s[6]=a*g+o*R+l*C,s[1]=c*x+h*p+u*E,s[4]=c*v+h*T+u*_,s[7]=c*g+h*R+u*C,s[2]=d*x+f*p+m*E,s[5]=d*v+f*T+m*_,s[8]=d*g+f*R+m*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=u*x,e[1]=(i*c-h*n)*x,e[2]=(o*n-i*a)*x,e[3]=d*x,e[4]=(h*t-i*l)*x,e[5]=(i*s-o*t)*x,e[6]=f*x,e[7]=(n*l-c*t)*x,e[8]=(a*t-n*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,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,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],c=i[4],h=i[7];return i[0]=t*s+n*l,i[3]=t*a+n*c,i[6]=t*o+n*h,i[1]=-n*s+t*l,i[4]=-n*a+t*c,i[7]=-n*o+t*h,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])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)}}Ke.prototype.isMatrix3=!0;let cn;class Nn{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{cn===void 0&&(cn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),cn.width=e.width,cn.height=e.height;const n=cn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=cn}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")}}let Bc=0;class et extends on{constructor(e=et.DEFAULT_IMAGE,t=et.DEFAULT_MAPPING,n=Mt,i=Mt,s=dt,a=os,o=wt,l=ls,c=1,h=di){super(),Object.defineProperty(this,"id",{value:Bc++}),this.uuid=At(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new X(0,0),this.repeat=new X(1,1),this.center=new X(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}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.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,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.encoding=e.encoding,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.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const i=this.image;if(i.uuid===void 0&&(i.uuid=At()),!t&&e.images[i.uuid]===void 0){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(mr(i[a].image)):s.push(mr(i[a]))}else s=mr(i);e.images[i.uuid]={uuid:i.uuid,url:s}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==io)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case jr:e.x=e.x-Math.floor(e.x);break;case Mt:e.x=e.x<0?0:1;break;case Jr: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 jr:e.y=e.y-Math.floor(e.y);break;case Mt:e.y=e.y<0?0:1;break;case Jr: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++}}et.DEFAULT_IMAGE=void 0;et.DEFAULT_MAPPING=io;et.prototype.isTexture=!0;function mr(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Nn.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class Ie{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+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,i,s;const l=e.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],x=l[2],v=l[6],g=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+f+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,R=(f+1)/2,E=(g+1)/2,_=(h+d)/4,C=(u+x)/4,N=(m+v)/4;return T>R&&T>E?T<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(T),i=_/n,s=C/n):R>E?R<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(R),n=_/i,s=N/i):E<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(E),n=C/s,i=N/s),this.set(n,i,s,t),this}let p=Math.sqrt((v-m)*(v-m)+(u-x)*(u-x)+(d-h)*(d-h));return Math.abs(p)<.001&&(p=1),this.x=(v-m)/p,this.y=(u-x)/p,this.z=(d-h)/p,this.w=Math.acos((c+f+g-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),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}}Ie.prototype.isVector4=!0;class an extends on{constructor(e,t,n){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new Ie(0,0,e,t),this.scissorTest=!1,this.viewport=new Ie(0,0,e,t),n=n||{},this.texture=new et(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:dt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.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){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}an.prototype.isWebGLRenderTarget=!0;class zc extends an{constructor(e,t,n){super(e,t,n),this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}}zc.prototype.isWebGLMultisampleRenderTarget=!0;class st{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],x=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=x;return}if(u!==x||l!==d||c!==f||h!==m){let v=1-o;const g=l*d+c*f+h*m+u*x,p=g>=0?1:-1,T=1-g*g;if(T>Number.EPSILON){const E=Math.sqrt(T),_=Math.atan2(E,g*p);v=Math.sin(v*_)/E,o=Math.sin(o*_)/E}const R=o*p;if(l=l*v+d*R,c=c*v+f*R,h=h*v+m*R,u=u*v+x*R,v===1-o){const E=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=E,c*=E,h*=E,u*=E}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return e[t]=o*m+h*u+l*f-c*d,e[t+1]=l*m+h*d+c*u-o*f,e[t+2]=c*m+h*f+o*d-l*u,e[t+3]=h*m-o*u-l*d-c*f,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,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}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(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-i*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,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*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=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}st.prototype.isQuaternion=!0;class b{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("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,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(na.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(na.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*i-o*n,h=l*n+o*t-s*i,u=l*i+s*n-a*t,d=-s*t-a*n-o*i;return this.x=c*l+d*-s+h*-o-u*-a,this.y=h*l+d*-a+u*-s-c*-o,this.z=u*l+d*-o+c*-a-h*-s,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,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*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 gr.copy(this).projectOnVector(e),this.sub(gr)}reflect(e){return this.sub(gr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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 i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),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}}b.prototype.isVector3=!0;const gr=new b,na=new st;class mt{constructor(e=new b(1/0,1/0,1/0),t=new b(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.length;l<c;l+=3){const h=e[l],u=e[l+1],d=e[l+2];h<t&&(t=h),u<n&&(n=u),d<i&&(i=d),h>s&&(s=h),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,i),this.max.set(s,a,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.count;l<c;l++){const h=e.getX(l),u=e.getY(l),d=e.getZ(l);h<t&&(t=h),u<n&&(n=u),d<i&&(i=d),h>s&&(s=h),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,i),this.max.set(s,a,o),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=Gn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}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 e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new b),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new b),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){e.updateWorldMatrix(!1,!1);const t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),xr.copy(t.boundingBox),xr.applyMatrix4(e.matrixWorld),this.union(xr));const n=e.children;for(let i=0,s=n.length;i<s;i++)this.expandByObject(n[i]);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===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new b),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,Gn),Gn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vn),gi.subVectors(this.max,Vn),hn.subVectors(e.a,Vn),un.subVectors(e.b,Vn),dn.subVectors(e.c,Vn),zt.subVectors(un,hn),Ot.subVectors(dn,un),nn.subVectors(hn,dn);let t=[0,-zt.z,zt.y,0,-Ot.z,Ot.y,0,-nn.z,nn.y,zt.z,0,-zt.x,Ot.z,0,-Ot.x,nn.z,0,-nn.x,-zt.y,zt.x,0,-Ot.y,Ot.x,0,-nn.y,nn.x,0];return!vr(t,hn,un,dn,gi)||(t=[1,0,0,0,1,0,0,0,1],!vr(t,hn,un,dn,gi))?!1:(xi.crossVectors(zt,Ot),t=[xi.x,xi.y,xi.z],vr(t,hn,un,dn,gi))}clampPoint(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new b),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Gn.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Gn).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:(Dt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Dt),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)}}mt.prototype.isBox3=!0;const Dt=[new b,new b,new b,new b,new b,new b,new b,new b],Gn=new b,xr=new mt,hn=new b,un=new b,dn=new b,zt=new b,Ot=new b,nn=new b,Vn=new b,gi=new b,xi=new b,rn=new b;function vr(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){rn.fromArray(r,s);const o=i.x*Math.abs(rn.x)+i.y*Math.abs(rn.y)+i.z*Math.abs(rn.z),l=e.dot(rn),c=t.dot(rn),h=n.dot(rn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Oc=new mt,ia=new b,_r=new b,yr=new b;class Fn{constructor(e=new b,t=-1){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):Oc.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),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===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new b),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new mt),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){yr.subVectors(e,this.center);const t=yr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(yr.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return _r.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(ia.copy(e.center).add(_r)),this.expandByPoint(ia.copy(e.center).sub(_r)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const It=new b,Mr=new b,vi=new b,Ut=new b,wr=new b,_i=new b,br=new b;class Bn{constructor(e=new b,t=new b(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===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new b),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,It)),this}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new b),t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=It.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(It.copy(this.direction).multiplyScalar(t).add(this.origin),It.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Mr.copy(e).add(t).multiplyScalar(.5),vi.copy(t).sub(e).normalize(),Ut.copy(this.origin).sub(Mr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(vi),o=Ut.dot(this.direction),l=-Ut.dot(vi),c=Ut.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const x=1/h;u*=x,d*=x,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(vi).multiplyScalar(d).add(Mr),f}intersectSphere(e,t){It.subVectors(e.center,this.origin);const n=It.dot(this.direction),i=It.dot(It)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return o<0&&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,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>i||((s>n||n!==n)&&(n=s),(a<i||i!==i)&&(i=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,It)!==null}intersectTriangle(e,t,n,i,s){wr.subVectors(t,e),_i.subVectors(n,e),br.crossVectors(wr,_i);let a=this.direction.dot(br),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ut.subVectors(this.origin,e);const l=o*this.direction.dot(_i.crossVectors(Ut,_i));if(l<0)return null;const c=o*this.direction.dot(wr.cross(Ut));if(c<0||l+c>a)return null;const h=-o*Ut.dot(br);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class he{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,a,o,l,c,h,u,d,f,m,x,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=a,g[9]=o,g[13]=l,g[2]=c,g[6]=h,g[10]=u,g[14]=d,g[3]=f,g[7]=m,g[11]=x,g[15]=v,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 he().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,i=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]*i,t[1]=n[1]*i,t[2]=n[2]*i,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){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=a*h,f=a*u,m=o*h,x=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=f+m*c,t[5]=d-x*c,t[9]=-o*l,t[2]=x-d*c,t[6]=m+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,f=l*u,m=c*h,x=c*u;t[0]=d+x*o,t[4]=m*o-f,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-m,t[6]=x+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,f=l*u,m=c*h,x=c*u;t[0]=d-x*o,t[4]=-a*u,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*h,t[9]=x-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,f=a*u,m=o*h,x=o*u;t[0]=l*h,t[4]=m*c-f,t[8]=d*c+x,t[1]=l*u,t[5]=x*c+d,t[9]=f*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=x-d*u,t[8]=m*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=f*u+m,t[10]=d-x*u}else if(e.order==="XZY"){const d=a*l,f=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+x,t[5]=a*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=o*h,t[10]=x*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Uc,e,Hc)}lookAt(e,t,n){const i=this.elements;return lt.subVectors(e,t),lt.lengthSq()===0&&(lt.z=1),lt.normalize(),Ht.crossVectors(n,lt),Ht.lengthSq()===0&&(Math.abs(n.z)===1?lt.x+=1e-4:lt.z+=1e-4,lt.normalize(),Ht.crossVectors(n,lt)),Ht.normalize(),yi.crossVectors(lt,Ht),i[0]=Ht.x,i[4]=yi.x,i[8]=lt.x,i[1]=Ht.y,i[5]=yi.y,i[9]=lt.y,i[2]=Ht.z,i[6]=yi.z,i[10]=lt.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],x=n[6],v=n[10],g=n[14],p=n[3],T=n[7],R=n[11],E=n[15],_=i[0],C=i[4],N=i[8],B=i[12],G=i[1],q=i[5],O=i[9],A=i[13],P=i[2],D=i[6],L=i[10],W=i[14],Q=i[3],Z=i[7],se=i[11],re=i[15];return s[0]=a*_+o*G+l*P+c*Q,s[4]=a*C+o*q+l*D+c*Z,s[8]=a*N+o*O+l*L+c*se,s[12]=a*B+o*A+l*W+c*re,s[1]=h*_+u*G+d*P+f*Q,s[5]=h*C+u*q+d*D+f*Z,s[9]=h*N+u*O+d*L+f*se,s[13]=h*B+u*A+d*W+f*re,s[2]=m*_+x*G+v*P+g*Q,s[6]=m*C+x*q+v*D+g*Z,s[10]=m*N+x*O+v*L+g*se,s[14]=m*B+x*A+v*W+g*re,s[3]=p*_+T*G+R*P+E*Q,s[7]=p*C+T*q+R*D+E*Z,s[11]=p*N+T*O+R*L+E*se,s[15]=p*B+T*A+R*W+E*re,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],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],x=e[7],v=e[11],g=e[15];return m*(+s*l*u-i*c*u-s*o*d+n*c*d+i*o*f-n*l*f)+x*(+t*l*f-t*c*d+s*a*d-i*a*f+i*c*h-s*l*h)+v*(+t*c*u-t*o*f-s*a*u+n*a*f+s*o*h-n*c*h)+g*(-i*o*h-t*l*u+t*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],x=e[13],v=e[14],g=e[15],p=u*v*c-x*d*c+x*l*f-o*v*f-u*l*g+o*d*g,T=m*d*c-h*v*c-m*l*f+a*v*f+h*l*g-a*d*g,R=h*x*c-m*u*c+m*o*f-a*x*f-h*o*g+a*u*g,E=m*u*l-h*x*l-m*o*d+a*x*d+h*o*v-a*u*v,_=t*p+n*T+i*R+s*E;if(_===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/_;return e[0]=p*C,e[1]=(x*d*s-u*v*s-x*i*f+n*v*f+u*i*g-n*d*g)*C,e[2]=(o*v*s-x*l*s+x*i*c-n*v*c-o*i*g+n*l*g)*C,e[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*C,e[4]=T*C,e[5]=(h*v*s-m*d*s+m*i*f-t*v*f-h*i*g+t*d*g)*C,e[6]=(m*l*s-a*v*s-m*i*c+t*v*c+a*i*g-t*l*g)*C,e[7]=(a*d*s-h*l*s+h*i*c-t*d*c-a*i*f+t*l*f)*C,e[8]=R*C,e[9]=(m*u*s-h*x*s-m*n*f+t*x*f+h*n*g-t*u*g)*C,e[10]=(a*x*s-m*o*s+m*n*c-t*x*c-a*n*g+t*o*g)*C,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*f-t*o*f)*C,e[12]=E*C,e[13]=(h*x*i-m*u*i+m*n*d-t*x*d-h*n*v+t*u*v)*C,e[14]=(m*o*i-a*x*i-m*n*l+t*x*l+a*n*v-t*o*v)*C,e[15]=(a*u*i-h*o*i+h*n*l-t*u*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return 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),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*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){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,d=s*c,f=s*h,m=s*u,x=a*h,v=a*u,g=o*u,p=l*c,T=l*h,R=l*u,E=n.x,_=n.y,C=n.z;return i[0]=(1-(x+g))*E,i[1]=(f+R)*E,i[2]=(m-T)*E,i[3]=0,i[4]=(f-R)*_,i[5]=(1-(d+g))*_,i[6]=(v+p)*_,i[7]=0,i[8]=(m+T)*C,i[9]=(v-p)*C,i[10]=(1-(d+x))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=fn.set(i[0],i[1],i[2]).length();const a=fn.set(i[4],i[5],i[6]).length(),o=fn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],xt.copy(this);const c=1/s,h=1/a,u=1/o;return xt.elements[0]*=c,xt.elements[1]*=c,xt.elements[2]*=c,xt.elements[4]*=h,xt.elements[5]*=h,xt.elements[6]*=h,xt.elements[8]*=u,xt.elements[9]*=u,xt.elements[10]*=u,t.setFromRotationMatrix(xt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,l=2*s/(t-e),c=2*s/(n-i),h=(t+e)/(t-e),u=(n+i)/(n-i),d=-(a+s)/(a-s),f=-2*a*s/(a-s);return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,a){const o=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-s),u=(t+e)*l,d=(n+i)*c,f=(a+s)*h;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])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}}he.prototype.isMatrix4=!0;const fn=new b,xt=new he,Uc=new b(0,0,0),Hc=new b(1,1,1),Ht=new b,yi=new b,lt=new b,ra=new he,sa=new st;class zn{constructor(e=0,t=0,n=0,i=zn.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}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,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,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,n){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t=t||this._order,t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ra.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ra,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return sa.setFromEuler(this),this.setFromQuaternion(sa,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}toVector3(e){return e?e.set(this._x,this._y,this._z):new b(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}zn.prototype.isEuler=!0;zn.DefaultOrder="XYZ";zn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Gc{constructor(){this.mask=1}set(e){this.mask=1<<e|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}}let Vc=0;const aa=new b,pn=new st,Nt=new he,Mi=new b,kn=new b,kc=new b,Wc=new st,oa=new b(1,0,0),la=new b(0,1,0),ca=new b(0,0,1),qc={type:"added"},ha={type:"removed"};class Re extends on{constructor(){super(),Object.defineProperty(this,"id",{value:Vc++}),this.uuid=At(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Re.DefaultUp.clone();const e=new b,t=new zn,n=new st,i=new b(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:i},modelViewMatrix:{value:new he},normalMatrix:{value:new Ke}}),this.matrix=new he,this.matrixWorld=new he,this.matrixAutoUpdate=Re.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Gc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return pn.setFromAxisAngle(e,t),this.quaternion.multiply(pn),this}rotateOnWorldAxis(e,t){return pn.setFromAxisAngle(e,t),this.quaternion.premultiply(pn),this}rotateX(e){return this.rotateOnAxis(oa,e)}rotateY(e){return this.rotateOnAxis(la,e)}rotateZ(e){return this.rotateOnAxis(ca,e)}translateOnAxis(e,t){return aa.copy(e).applyQuaternion(this.quaternion),this.position.add(aa.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(oa,e)}translateY(e){return this.translateOnAxis(la,e)}translateZ(e){return this.translateOnAxis(ca,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Nt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Mi.copy(e):Mi.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),kn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Nt.lookAt(kn,Mi,this.up):Nt.lookAt(Mi,kn,this.up),this.quaternion.setFromRotationMatrix(Nt),i&&(Nt.extractRotation(i.matrixWorld),pn.setFromRotationMatrix(Nt),this.quaternion.premultiply(pn.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.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(qc)):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(ha)),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(ha)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Nt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Nt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Nt),this.add(e),e.updateWorldMatrix(!1,!0),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,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getWorldPosition(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new b),this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new st),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(kn,e,kc),e}getWorldScale(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new b),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(kn,Wc,e),e}getWorldDirection(e){e===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new b),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,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;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.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,i=t.length;n<i;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.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.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]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Re.DefaultUp=new b(0,1,0);Re.DefaultMatrixAutoUpdate=!0;Re.prototype.isObject3D=!0;const Sr=new b,Xc=new b,Yc=new Ke;class Et{constructor(e=new b(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Sr.subVectors(n,t).cross(Xc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new b),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){t===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new b);const n=e.delta(Sr),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}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===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new b),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Yc.getNormalMatrix(e),i=this.coplanarPoint(Sr).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.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)}}Et.prototype.isPlane=!0;const vt=new b,Ft=new b,Er=new b,Bt=new b,mn=new b,gn=new b,ua=new b,Tr=new b,Ar=new b,Lr=new b;class Xe{constructor(e=new b,t=new b,n=new b){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new b),i.subVectors(n,t),vt.subVectors(e,t),i.cross(vt);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){vt.subVectors(i,t),Ft.subVectors(n,t),Er.subVectors(e,t);const a=vt.dot(vt),o=vt.dot(Ft),l=vt.dot(Er),c=Ft.dot(Ft),h=Ft.dot(Er),u=a*c-o*o;if(s===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),s=new b),u===0)return s.set(-2,-1,-1);const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Bt),Bt.x>=0&&Bt.y>=0&&Bt.x+Bt.y<=1}static getUV(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,Bt),l.set(0,0),l.addScaledVector(s,Bt.x),l.addScaledVector(a,Bt.y),l.addScaledVector(o,Bt.z),l}static isFrontFacing(e,t,n,i){return vt.subVectors(n,t),Ft.subVectors(e,t),vt.cross(Ft).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vt.subVectors(this.c,this.b),Ft.subVectors(this.a,this.b),vt.cross(Ft).length()*.5}getMidpoint(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new b),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xe.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Et),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Xe.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Xe.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Xe.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xe.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new b);const n=this.a,i=this.b,s=this.c;let a,o;mn.subVectors(i,n),gn.subVectors(s,n),Tr.subVectors(e,n);const l=mn.dot(Tr),c=gn.dot(Tr);if(l<=0&&c<=0)return t.copy(n);Ar.subVectors(e,i);const h=mn.dot(Ar),u=gn.dot(Ar);if(h>=0&&u<=h)return t.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(mn,a);Lr.subVectors(e,s);const f=mn.dot(Lr),m=gn.dot(Lr);if(m>=0&&f<=m)return t.copy(s);const x=f*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(n).addScaledVector(gn,o);const v=h*m-f*u;if(v<=0&&u-h>=0&&f-m>=0)return ua.subVectors(s,i),o=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(ua,o);const g=1/(v+x+d);return a=x*g,o=d*g,t.copy(n).addScaledVector(mn,a).addScaledVector(gn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Zc=0;function Qe(){Object.defineProperty(this,"id",{value:Zc++}),this.uuid=At(),this.name="",this.type="Material",this.fog=!0,this.blending=ti,this.side=er,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=to,this.blendDst=no,this.blendEquation=Tn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Zr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Dc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Qe.prototype=Object.assign(Object.create(on.prototype),{constructor:Qe,isMaterial:!0,onBuild:function(){},onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(r){if(r!==void 0)for(const e in r){const t=r[e];if(t===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if(e==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===eo;continue}const n=this[e];if(n===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}n&&n.isColor?n.set(t):n&&n.isVector3&&t&&t.isVector3?n.copy(t):this[e]=t}},toJSON:function(r){const e=r===void 0||typeof r=="string";e&&(r={textures:{},images:{}});const t={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(t.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(t.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearcoat!==void 0&&(t.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(t.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(t.clearcoatMap=this.clearcoatMap.toJSON(r).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(t.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(r).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(t.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(r).uuid,t.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(r).uuid),this.matcap&&this.matcap.isTexture&&(t.matcap=this.matcap.toJSON(r).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(r).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(r).uuid,t.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(t.aoMap=this.aoMap.toJSON(r).uuid,t.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(r).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(r).uuid,t.normalMapType=this.normalMapType,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(r).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(r).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(r).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(r).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(r).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(r).uuid,this.combine!==void 0&&(t.combine=this.combine)),this.envMapIntensity!==void 0&&(t.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(t.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(t.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(r).uuid),this.size!==void 0&&(t.size=this.size),this.shadowSide!==null&&(t.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==ti&&(t.blending=this.blending),this.side!==er&&(t.side=this.side),this.vertexColors&&(t.vertexColors=!0),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=this.transparent),t.depthFunc=this.depthFunc,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.colorWrite=this.colorWrite,t.stencilWrite=this.stencilWrite,t.stencilWriteMask=this.stencilWriteMask,t.stencilFunc=this.stencilFunc,t.stencilRef=this.stencilRef,t.stencilFuncMask=this.stencilFuncMask,t.stencilFail=this.stencilFail,t.stencilZFail=this.stencilZFail,t.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(t.rotation=this.rotation),this.polygonOffset===!0&&(t.polygonOffset=!0),this.polygonOffsetFactor!==0&&(t.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(t.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(t.linewidth=this.linewidth),this.dashSize!==void 0&&(t.dashSize=this.dashSize),this.gapSize!==void 0&&(t.gapSize=this.gapSize),this.scale!==void 0&&(t.scale=this.scale),this.dithering===!0&&(t.dithering=!0),this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(t.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(t.morphTargets=!0),this.morphNormals===!0&&(t.morphNormals=!0),this.skinning===!0&&(t.skinning=!0),this.flatShading===!0&&(t.flatShading=this.flatShading),this.visible===!1&&(t.visible=!1),this.toneMapped===!1&&(t.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(t.userData=this.userData);function n(i){const s=[];for(const a in i){const o=i[a];delete o.metadata,s.push(o)}return s}if(e){const i=n(r.textures),s=n(r.images);i.length>0&&(t.textures=i),s.length>0&&(t.images=s)}return t},clone:function(){return new this.constructor().copy(this)},copy:function(r){this.name=r.name,this.fog=r.fog,this.blending=r.blending,this.side=r.side,this.vertexColors=r.vertexColors,this.opacity=r.opacity,this.transparent=r.transparent,this.blendSrc=r.blendSrc,this.blendDst=r.blendDst,this.blendEquation=r.blendEquation,this.blendSrcAlpha=r.blendSrcAlpha,this.blendDstAlpha=r.blendDstAlpha,this.blendEquationAlpha=r.blendEquationAlpha,this.depthFunc=r.depthFunc,this.depthTest=r.depthTest,this.depthWrite=r.depthWrite,this.stencilWriteMask=r.stencilWriteMask,this.stencilFunc=r.stencilFunc,this.stencilRef=r.stencilRef,this.stencilFuncMask=r.stencilFuncMask,this.stencilFail=r.stencilFail,this.stencilZFail=r.stencilZFail,this.stencilZPass=r.stencilZPass,this.stencilWrite=r.stencilWrite;const e=r.clippingPlanes;let t=null;if(e!==null){const n=e.length;t=new Array(n);for(let i=0;i!==n;++i)t[i]=e[i].clone()}return this.clippingPlanes=t,this.clipIntersection=r.clipIntersection,this.clipShadows=r.clipShadows,this.shadowSide=r.shadowSide,this.colorWrite=r.colorWrite,this.precision=r.precision,this.polygonOffset=r.polygonOffset,this.polygonOffsetFactor=r.polygonOffsetFactor,this.polygonOffsetUnits=r.polygonOffsetUnits,this.dithering=r.dithering,this.alphaTest=r.alphaTest,this.alphaToCoverage=r.alphaToCoverage,this.premultipliedAlpha=r.premultipliedAlpha,this.visible=r.visible,this.toneMapped=r.toneMapped,this.userData=JSON.parse(JSON.stringify(r.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(Qe.prototype,"needsUpdate",{set:function(r){r===!0&&this.version++}});const ao={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},_t={h:0,s:0,l:0},wi={h:0,s:0,l:0};function Rr(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function Cr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Pr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}class ce{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Ic(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=Rr(s,i,e+1/3),this.g=Rr(s,i,e),this.b=Rr(s,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i;const s=n[1],a=n[2];switch(s){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const o=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(o,l,c)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],s=i.length;if(s===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=ao[e.toLowerCase()];return t!==void 0?this.setHex(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}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Cr(e.r),this.g=Cr(e.g),this.b=Cr(e.b),this}copyLinearToSRGB(e){return this.r=Pr(e.r),this.g=Pr(e.g),this.b=Pr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),a=Math.min(t,n,i);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const h=s-a;switch(l=c<=.5?h/(s+a):h/(2-s-a),s){case t:o=(n-i)/h+(n<i?6:0);break;case n:o=(i-t)/h+2;break;case i:o=(t-n)/h+4;break}o/=6}return e.h=o,e.s=l,e.l=c,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(_t),_t.h+=e,_t.s+=t,_t.l+=n,this.setHSL(_t.h,_t.s,_t.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,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(_t),e.getHSL(wi);const n=pr(_t.h,wi.h,t),i=pr(_t.s,wi.s,t),s=pr(_t.l,wi.l,t);return this.setHSL(n,i,s),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),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}ce.NAMES=ao;ce.prototype.isColor=!0;ce.prototype.r=1;ce.prototype.g=1;ce.prototype.b=1;class hs extends Qe{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new ce(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.combine=nr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,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.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this}}hs.prototype.isMeshBasicMaterial=!0;const ze=new b,bi=new X;class je{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=oi,this.updateRange={offset:0,count:-1},this.version=0,this.onUploadCallback=function(){}}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new ce),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new X),t[n++]=a.x,t[n++]=a.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new b),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new Ie),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)bi.fromBufferAttribute(this,t),bi.applyMatrix3(e),this.setXY(t,bi.x,bi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ze.fromBufferAttribute(this,t),ze.applyMatrix3(e),this.setXYZ(t,ze.x,ze.y,ze.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ze.x=this.getX(t),ze.y=this.getY(t),ze.z=this.getZ(t),ze.applyMatrix4(e),this.setXYZ(t,ze.x,ze.y,ze.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ze.x=this.getX(t),ze.y=this.getY(t),ze.z=this.getZ(t),ze.applyNormalMatrix(e),this.setXYZ(t,ze.x,ze.y,ze.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ze.x=this.getX(t),ze.y=this.getY(t),ze.z=this.getZ(t),ze.transformDirection(e),this.setXYZ(t,ze.x,ze.y,ze.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,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.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==oi&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}je.prototype.isBufferAttribute=!0;class oo extends je{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class lo extends je{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class jc extends je{constructor(e,t,n){super(new Uint16Array(e),t,n)}}jc.prototype.isFloat16BufferAttribute=!0;class Je extends je{constructor(e,t,n){super(new Float32Array(e),t,n)}}function co(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}let Jc=0;const St=new he,Dr=new Re,xn=new b,ct=new mt,Wn=new mt,Ye=new b;class Oe extends on{constructor(){super(),Object.defineProperty(this,"id",{value:Jc++}),this.uuid=At(),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(co(e)>65535?lo:oo)(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 Ke().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}rotateX(e){return St.makeRotationX(e),this.applyMatrix4(St),this}rotateY(e){return St.makeRotationY(e),this.applyMatrix4(St),this}rotateZ(e){return St.makeRotationZ(e),this.applyMatrix4(St),this}translate(e,t,n){return St.makeTranslation(e,t,n),this.applyMatrix4(St),this}scale(e,t,n){return St.makeScale(e,t,n),this.applyMatrix4(St),this}lookAt(e){return Dr.lookAt(e),Dr.updateMatrix(),this.applyMatrix4(Dr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xn).negate(),this.translate(xn.x,xn.y,xn.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Je(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new mt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new b(-1/0,-1/0,-1/0),new b(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];ct.setFromBufferAttribute(s),this.morphTargetsRelative?(Ye.addVectors(this.boundingBox.min,ct.min),this.boundingBox.expandByPoint(Ye),Ye.addVectors(this.boundingBox.max,ct.max),this.boundingBox.expandByPoint(Ye)):(this.boundingBox.expandByPoint(ct.min),this.boundingBox.expandByPoint(ct.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 Fn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new b,1/0);return}if(e){const n=this.boundingSphere.center;if(ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Wn.setFromBufferAttribute(o),this.morphTargetsRelative?(Ye.addVectors(ct.min,Wn.min),ct.expandByPoint(Ye),Ye.addVectors(ct.max,Wn.max),ct.expandByPoint(Ye)):(ct.expandByPoint(Wn.min),ct.expandByPoint(Wn.max))}ct.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Ye.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Ye));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Ye.fromBufferAttribute(o,c),l&&(xn.fromBufferAttribute(e,c),Ye.add(xn)),i=Math.max(i,n.distanceToSquared(Ye))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}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=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,o=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new je(new Float32Array(4*o),4));const l=t.tangent.array,c=[],h=[];for(let G=0;G<o;G++)c[G]=new b,h[G]=new b;const u=new b,d=new b,f=new b,m=new X,x=new X,v=new X,g=new b,p=new b;function T(G,q,O){u.fromArray(i,G*3),d.fromArray(i,q*3),f.fromArray(i,O*3),m.fromArray(a,G*2),x.fromArray(a,q*2),v.fromArray(a,O*2),d.sub(u),f.sub(u),x.sub(m),v.sub(m);const A=1/(x.x*v.y-v.x*x.y);isFinite(A)&&(g.copy(d).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(A),p.copy(f).multiplyScalar(x.x).addScaledVector(d,-v.x).multiplyScalar(A),c[G].add(g),c[q].add(g),c[O].add(g),h[G].add(p),h[q].add(p),h[O].add(p))}let R=this.groups;R.length===0&&(R=[{start:0,count:n.length}]);for(let G=0,q=R.length;G<q;++G){const O=R[G],A=O.start,P=O.count;for(let D=A,L=A+P;D<L;D+=3)T(n[D+0],n[D+1],n[D+2])}const E=new b,_=new b,C=new b,N=new b;function B(G){C.fromArray(s,G*3),N.copy(C);const q=c[G];E.copy(q),E.sub(C.multiplyScalar(C.dot(q))).normalize(),_.crossVectors(N,q);const A=_.dot(h[G])<0?-1:1;l[G*4]=E.x,l[G*4+1]=E.y,l[G*4+2]=E.z,l[G*4+3]=A}for(let G=0,q=R.length;G<q;++G){const O=R[G],A=O.start,P=O.count;for(let D=A,L=A+P;D<L;D+=3)B(n[D+0]),B(n[D+1]),B(n[D+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 je(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new b,s=new b,a=new b,o=new b,l=new b,c=new b,h=new b,u=new b;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),x=e.getX(d+1),v=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,v),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,v),o.add(h),l.add(h),c.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(e.attributes[i]===void 0)continue;const a=n[i].array,o=e.attributes[i],l=o.array,c=o.itemSize*t,h=Math.min(l.length,a.length-c);for(let u=0,d=c;u<h;u++,d++)a[d]=l[u]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ye.fromBufferAttribute(e,t),Ye.normalize(),e.setXYZ(t,Ye.x,Ye.y,Ye.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let x=0,v=l.length;x<v;x++){f=l[x]*h;for(let g=0;g<h;g++)d[m++]=c[f++]}return new je(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Oe,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=e(d,n);l.push(f)}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.5,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 i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,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 Oe().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 i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const 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"})}}Oe.prototype.isBufferGeometry=!0;const da=new he,vn=new Bn,Ir=new Fn,Gt=new b,Vt=new b,kt=new b,Nr=new b,Fr=new b,Br=new b,Si=new b,Ei=new b,Ti=new b,Ai=new X,Li=new X,Ri=new X,zr=new b,Ci=new b;class ft extends Re{constructor(e=new Oe,t=new hs){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Ir.copy(n.boundingSphere),Ir.applyMatrix4(s),e.ray.intersectsSphere(Ir)===!1)||(da.copy(s).invert(),vn.copy(e.ray).applyMatrix4(da),n.boundingBox!==null&&vn.intersectsBox(n.boundingBox)===!1))return;let a;if(n.isBufferGeometry){const o=n.index,l=n.attributes.position,c=n.morphAttributes.position,h=n.morphTargetsRelative,u=n.attributes.uv,d=n.attributes.uv2,f=n.groups,m=n.drawRange;if(o!==null)if(Array.isArray(i))for(let x=0,v=f.length;x<v;x++){const g=f[x],p=i[g.materialIndex],T=Math.max(g.start,m.start),R=Math.min(g.start+g.count,m.start+m.count);for(let E=T,_=R;E<_;E+=3){const C=o.getX(E),N=o.getX(E+1),B=o.getX(E+2);a=Pi(this,p,e,vn,l,c,h,u,d,C,N,B),a&&(a.faceIndex=Math.floor(E/3),a.face.materialIndex=g.materialIndex,t.push(a))}}else{const x=Math.max(0,m.start),v=Math.min(o.count,m.start+m.count);for(let g=x,p=v;g<p;g+=3){const T=o.getX(g),R=o.getX(g+1),E=o.getX(g+2);a=Pi(this,i,e,vn,l,c,h,u,d,T,R,E),a&&(a.faceIndex=Math.floor(g/3),t.push(a))}}else if(l!==void 0)if(Array.isArray(i))for(let x=0,v=f.length;x<v;x++){const g=f[x],p=i[g.materialIndex],T=Math.max(g.start,m.start),R=Math.min(g.start+g.count,m.start+m.count);for(let E=T,_=R;E<_;E+=3){const C=E,N=E+1,B=E+2;a=Pi(this,p,e,vn,l,c,h,u,d,C,N,B),a&&(a.faceIndex=Math.floor(E/3),a.face.materialIndex=g.materialIndex,t.push(a))}}else{const x=Math.max(0,m.start),v=Math.min(l.count,m.start+m.count);for(let g=x,p=v;g<p;g+=3){const T=g,R=g+1,E=g+2;a=Pi(this,i,e,vn,l,c,h,u,d,T,R,E),a&&(a.faceIndex=Math.floor(g/3),t.push(a))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}ft.prototype.isMesh=!0;function Qc(r,e,t,n,i,s,a,o){let l;if(e.side===Ze?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side!==tr,o),l===null)return null;Ci.copy(o),Ci.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Ci);return c<t.near||c>t.far?null:{distance:c,point:Ci.clone(),object:r}}function Pi(r,e,t,n,i,s,a,o,l,c,h,u){Gt.fromBufferAttribute(i,c),Vt.fromBufferAttribute(i,h),kt.fromBufferAttribute(i,u);const d=r.morphTargetInfluences;if(e.morphTargets&&s&&d){Si.set(0,0,0),Ei.set(0,0,0),Ti.set(0,0,0);for(let m=0,x=s.length;m<x;m++){const v=d[m],g=s[m];v!==0&&(Nr.fromBufferAttribute(g,c),Fr.fromBufferAttribute(g,h),Br.fromBufferAttribute(g,u),a?(Si.addScaledVector(Nr,v),Ei.addScaledVector(Fr,v),Ti.addScaledVector(Br,v)):(Si.addScaledVector(Nr.sub(Gt),v),Ei.addScaledVector(Fr.sub(Vt),v),Ti.addScaledVector(Br.sub(kt),v)))}Gt.add(Si),Vt.add(Ei),kt.add(Ti)}r.isSkinnedMesh&&e.skinning&&(r.boneTransform(c,Gt),r.boneTransform(h,Vt),r.boneTransform(u,kt));const f=Qc(r,e,t,n,Gt,Vt,kt,zr);if(f){o&&(Ai.fromBufferAttribute(o,c),Li.fromBufferAttribute(o,h),Ri.fromBufferAttribute(o,u),f.uv=Xe.getUV(zr,Gt,Vt,kt,Ai,Li,Ri,new X)),l&&(Ai.fromBufferAttribute(l,c),Li.fromBufferAttribute(l,h),Ri.fromBufferAttribute(l,u),f.uv2=Xe.getUV(zr,Gt,Vt,kt,Ai,Li,Ri,new X));const m={a:c,b:h,c:u,normal:new b,materialIndex:0};Xe.getNormal(Gt,Vt,kt,m.normal),f.face=m}return f}class us extends Oe{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,t,e,a,s,0),m("z","y","x",1,-1,n,t,-e,a,s,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Je(c,3)),this.setAttribute("normal",new Je(h,3)),this.setAttribute("uv",new Je(u,2));function m(x,v,g,p,T,R,E,_,C,N,B){const G=R/C,q=E/N,O=R/2,A=E/2,P=_/2,D=C+1,L=N+1;let W=0,Q=0;const Z=new b;for(let se=0;se<L;se++){const re=se*q-A;for(let ue=0;ue<D;ue++){const xe=ue*G-O;Z[x]=xe*p,Z[v]=re*T,Z[g]=P,c.push(Z.x,Z.y,Z.z),Z[x]=0,Z[v]=0,Z[g]=_>0?1:-1,h.push(Z.x,Z.y,Z.z),u.push(ue/C),u.push(1-se/N),W+=1}}for(let se=0;se<N;se++)for(let re=0;re<C;re++){const ue=d+re+D*se,xe=d+re+D*(se+1),U=d+(re+1)+D*(se+1),Fe=d+(re+1)+D*se;l.push(ue,xe,Fe),l.push(xe,U,Fe),Q+=6}o.addGroup(f,Q,B),f+=Q,d+=W}}}function Pn(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function tt(r){const e={};for(let t=0;t<r.length;t++){const n=Pn(r[t]);for(const i in n)e[i]=n[i]}return e}const $c={clone:Pn,merge:tt};var Kc=`void main() {
|
|
6
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
+
}`,eh=`void main() {
|
|
8
|
+
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
+
}`;class Zt extends Qe{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Kc,this.fragmentShader=eh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Pn(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,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 i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}Zt.prototype.isShaderMaterial=!0;class ds extends Re{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new he,this.projectionMatrix=new he,this.projectionMatrixInverse=new he}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new b),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}ds.prototype.isCamera=!0;class ut extends ds{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Qr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(fr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qr*2*Math.atan(Math.tan(fr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,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=i,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(fr*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),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}}ut.prototype.isPerspectiveCamera=!0;const _n=90,yn=1;class fs extends Re{constructor(e,t,n){if(super(),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;const i=new ut(_n,yn,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new b(1,0,0)),this.add(i);const s=new ut(_n,yn,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new b(-1,0,0)),this.add(s);const a=new ut(_n,yn,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new b(0,1,0)),this.add(a);const o=new ut(_n,yn,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new b(0,-1,0)),this.add(o);const l=new ut(_n,yn,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new b(0,0,1)),this.add(l);const c=new ut(_n,yn,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new b(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,a,o,l,c]=this.children,h=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=h}}class ir extends et{constructor(e,t,n,i,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:is,o=o!==void 0?o:sn,super(e,t,n,i,s,a,o,l,c,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}ir.prototype.isCubeTexture=!0;class ho extends an{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new ir(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:dt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=wt,this.texture.encoding=t.encoding,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
|
+
`},i=new us(5,5,5),s=new Zt({name:"CubemapFromEquirect",uniforms:Pn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ze,blending:ei});s.uniforms.tEquirect.value=t;const a=new ft(i,s),o=t.minFilter;return t.minFilter===os&&(t.minFilter=dt),new fs(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}ho.prototype.isWebGLCubeRenderTarget=!0;class uo extends et{constructor(e,t,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c!==void 0?c:rt,this.minFilter=h!==void 0?h:rt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}uo.prototype.isDataTexture=!0;const Mn=new Fn,Di=new b;class rr{constructor(e=new Et,t=new Et,n=new Et,i=new Et,s=new Et,a=new Et){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),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){const t=this.planes,n=e.elements,i=n[0],s=n[1],a=n[2],o=n[3],l=n[4],c=n[5],h=n[6],u=n[7],d=n[8],f=n[9],m=n[10],x=n[11],v=n[12],g=n[13],p=n[14],T=n[15];return t[0].setComponents(o-i,u-l,x-d,T-v).normalize(),t[1].setComponents(o+i,u+l,x+d,T+v).normalize(),t[2].setComponents(o+s,u+c,x+f,T+g).normalize(),t[3].setComponents(o-s,u-c,x-f,T-g).normalize(),t[4].setComponents(o-a,u-h,x-m,T-p).normalize(),t[5].setComponents(o+a,u+h,x+m,T+p).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Mn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),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,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Di.x=i.normal.x>0?e.max.x:e.min.x,Di.y=i.normal.y>0?e.max.y:e.min.y,Di.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Di)<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 fo(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function th(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,h){const u=c.array,d=c.usage,f=r.createBuffer();r.bindBuffer(h,f),r.bufferData(h,u,d),c.onUploadCallback();let m=5126;return u instanceof Float32Array?m=5126:u instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):u instanceof Uint16Array?c.isFloat16BufferAttribute?t?m=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):m=5123:u instanceof Int16Array?m=5122:u instanceof Uint32Array?m=5125:u instanceof Int32Array?m=5124:u instanceof Int8Array?m=5120:u instanceof Uint8Array&&(m=5121),{buffer:f,type:m,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version}}function s(c,h,u){const d=h.array,f=h.updateRange;r.bindBuffer(u,c),f.count===-1?r.bufferSubData(u,0,d):(t?r.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):r.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1)}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=n.get(c);h&&(r.deleteBuffer(h.buffer),n.delete(c))}function l(c,h){if(c.isGLBufferAttribute){const d=n.get(c);(!d||d.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u===void 0?n.set(c,i(c,h)):u.version<c.version&&(s(u.buffer,c,h),u.version=c.version)}return{get:a,remove:o,update:l}}class po extends Oe{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=e/o,d=t/l,f=[],m=[],x=[],v=[];for(let g=0;g<h;g++){const p=g*d-a;for(let T=0;T<c;T++){const R=T*u-s;m.push(R,-p,0),x.push(0,0,1),v.push(T/o),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let p=0;p<o;p++){const T=p+c*g,R=p+c*(g+1),E=p+1+c*(g+1),_=p+1+c*g;f.push(T,R,_),f.push(R,E,_)}this.setIndex(f),this.setAttribute("position",new Je(m,3)),this.setAttribute("normal",new Je(x,3)),this.setAttribute("uv",new Je(v,2))}}var nh=`#ifdef USE_ALPHAMAP
|
|
45
|
+
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
46
|
+
#endif`,ih=`#ifdef USE_ALPHAMAP
|
|
47
|
+
uniform sampler2D alphaMap;
|
|
48
|
+
#endif`,rh=`#ifdef ALPHATEST
|
|
49
|
+
if ( diffuseColor.a < ALPHATEST ) discard;
|
|
50
|
+
#endif`,sh=`#ifdef USE_AOMAP
|
|
51
|
+
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
52
|
+
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
53
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
54
|
+
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
55
|
+
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
|
|
56
|
+
#endif
|
|
57
|
+
#endif`,ah=`#ifdef USE_AOMAP
|
|
58
|
+
uniform sampler2D aoMap;
|
|
59
|
+
uniform float aoMapIntensity;
|
|
60
|
+
#endif`,oh="vec3 transformed = vec3( position );",lh=`vec3 objectNormal = vec3( normal );
|
|
61
|
+
#ifdef USE_TANGENT
|
|
62
|
+
vec3 objectTangent = vec3( tangent.xyz );
|
|
63
|
+
#endif`,ch=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
|
|
64
|
+
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
65
|
+
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
66
|
+
vec4 r = roughness * c0 + c1;
|
|
67
|
+
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
68
|
+
return vec2( -1.04, 1.04 ) * a004 + r.zw;
|
|
69
|
+
}
|
|
70
|
+
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
71
|
+
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
|
72
|
+
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
73
|
+
if( cutoffDistance > 0.0 ) {
|
|
74
|
+
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
75
|
+
}
|
|
76
|
+
return distanceFalloff;
|
|
77
|
+
#else
|
|
78
|
+
if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
79
|
+
return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
80
|
+
}
|
|
81
|
+
return 1.0;
|
|
82
|
+
#endif
|
|
83
|
+
}
|
|
84
|
+
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
|
|
85
|
+
return RECIPROCAL_PI * diffuseColor;
|
|
86
|
+
}
|
|
87
|
+
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
|
|
88
|
+
float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
|
|
89
|
+
return ( 1.0 - specularColor ) * fresnel + specularColor;
|
|
90
|
+
}
|
|
91
|
+
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
|
|
92
|
+
float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
|
|
93
|
+
vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
|
|
94
|
+
return Fr * fresnel + F0;
|
|
95
|
+
}
|
|
96
|
+
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
97
|
+
float a2 = pow2( alpha );
|
|
98
|
+
float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
99
|
+
float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
100
|
+
return 1.0 / ( gl * gv );
|
|
101
|
+
}
|
|
102
|
+
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
103
|
+
float a2 = pow2( alpha );
|
|
104
|
+
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
105
|
+
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
106
|
+
return 0.5 / max( gv + gl, EPSILON );
|
|
107
|
+
}
|
|
108
|
+
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
109
|
+
float a2 = pow2( alpha );
|
|
110
|
+
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
111
|
+
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
112
|
+
}
|
|
113
|
+
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
|
|
114
|
+
float alpha = pow2( roughness );
|
|
115
|
+
vec3 halfDir = normalize( incidentLight.direction + viewDir );
|
|
116
|
+
float dotNL = saturate( dot( normal, incidentLight.direction ) );
|
|
117
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
118
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
119
|
+
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
|
|
120
|
+
vec3 F = F_Schlick( specularColor, dotLH );
|
|
121
|
+
float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
122
|
+
float D = D_GGX( alpha, dotNH );
|
|
123
|
+
return F * ( G * D );
|
|
124
|
+
}
|
|
125
|
+
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
126
|
+
const float LUT_SIZE = 64.0;
|
|
127
|
+
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
128
|
+
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
129
|
+
float dotNV = saturate( dot( N, V ) );
|
|
130
|
+
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
131
|
+
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
132
|
+
return uv;
|
|
133
|
+
}
|
|
134
|
+
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
135
|
+
float l = length( f );
|
|
136
|
+
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
137
|
+
}
|
|
138
|
+
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
139
|
+
float x = dot( v1, v2 );
|
|
140
|
+
float y = abs( x );
|
|
141
|
+
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
142
|
+
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
143
|
+
float v = a / b;
|
|
144
|
+
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
145
|
+
return cross( v1, v2 ) * theta_sintheta;
|
|
146
|
+
}
|
|
147
|
+
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
148
|
+
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
149
|
+
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
150
|
+
vec3 lightNormal = cross( v1, v2 );
|
|
151
|
+
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
152
|
+
vec3 T1, T2;
|
|
153
|
+
T1 = normalize( V - N * dot( V, N ) );
|
|
154
|
+
T2 = - cross( N, T1 );
|
|
155
|
+
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
156
|
+
vec3 coords[ 4 ];
|
|
157
|
+
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
158
|
+
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
159
|
+
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
160
|
+
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
161
|
+
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
162
|
+
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
163
|
+
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
164
|
+
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
165
|
+
vec3 vectorFormFactor = vec3( 0.0 );
|
|
166
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
167
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
168
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
169
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
170
|
+
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
171
|
+
return vec3( result );
|
|
172
|
+
}
|
|
173
|
+
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
|
|
174
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
175
|
+
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
176
|
+
return specularColor * brdf.x + brdf.y;
|
|
177
|
+
}
|
|
178
|
+
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
179
|
+
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
180
|
+
vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
|
|
181
|
+
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
182
|
+
vec3 FssEss = F * brdf.x + brdf.y;
|
|
183
|
+
float Ess = brdf.x + brdf.y;
|
|
184
|
+
float Ems = 1.0 - Ess;
|
|
185
|
+
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
186
|
+
singleScatter += FssEss;
|
|
187
|
+
multiScatter += Fms * Ems;
|
|
188
|
+
}
|
|
189
|
+
float G_BlinnPhong_Implicit( ) {
|
|
190
|
+
return 0.25;
|
|
191
|
+
}
|
|
192
|
+
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
193
|
+
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
194
|
+
}
|
|
195
|
+
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
|
|
196
|
+
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
|
|
197
|
+
float dotNH = saturate( dot( geometry.normal, halfDir ) );
|
|
198
|
+
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
|
|
199
|
+
vec3 F = F_Schlick( specularColor, dotLH );
|
|
200
|
+
float G = G_BlinnPhong_Implicit( );
|
|
201
|
+
float D = D_BlinnPhong( shininess, dotNH );
|
|
202
|
+
return F * ( G * D );
|
|
203
|
+
}
|
|
204
|
+
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
|
|
205
|
+
return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
|
|
206
|
+
}
|
|
207
|
+
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
|
|
208
|
+
return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
|
|
209
|
+
}
|
|
210
|
+
#if defined( USE_SHEEN )
|
|
211
|
+
float D_Charlie(float roughness, float NoH) {
|
|
212
|
+
float invAlpha = 1.0 / roughness;
|
|
213
|
+
float cos2h = NoH * NoH;
|
|
214
|
+
float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
|
|
215
|
+
}
|
|
216
|
+
float V_Neubelt(float NoV, float NoL) {
|
|
217
|
+
return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
|
|
218
|
+
}
|
|
219
|
+
vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
|
|
220
|
+
vec3 N = geometry.normal;
|
|
221
|
+
vec3 V = geometry.viewDir;
|
|
222
|
+
vec3 H = normalize( V + L );
|
|
223
|
+
float dotNH = saturate( dot( N, H ) );
|
|
224
|
+
return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
|
|
225
|
+
}
|
|
226
|
+
#endif`,hh=`#ifdef USE_BUMPMAP
|
|
227
|
+
uniform sampler2D bumpMap;
|
|
228
|
+
uniform float bumpScale;
|
|
229
|
+
vec2 dHdxy_fwd() {
|
|
230
|
+
vec2 dSTdx = dFdx( vUv );
|
|
231
|
+
vec2 dSTdy = dFdy( vUv );
|
|
232
|
+
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
|
233
|
+
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
|
234
|
+
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
|
235
|
+
return vec2( dBx, dBy );
|
|
236
|
+
}
|
|
237
|
+
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
238
|
+
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
|
239
|
+
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
|
240
|
+
vec3 vN = surf_norm;
|
|
241
|
+
vec3 R1 = cross( vSigmaY, vN );
|
|
242
|
+
vec3 R2 = cross( vN, vSigmaX );
|
|
243
|
+
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
244
|
+
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
245
|
+
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
246
|
+
}
|
|
247
|
+
#endif`,uh=`#if NUM_CLIPPING_PLANES > 0
|
|
248
|
+
vec4 plane;
|
|
249
|
+
#pragma unroll_loop_start
|
|
250
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
251
|
+
plane = clippingPlanes[ i ];
|
|
252
|
+
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
253
|
+
}
|
|
254
|
+
#pragma unroll_loop_end
|
|
255
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
256
|
+
bool clipped = true;
|
|
257
|
+
#pragma unroll_loop_start
|
|
258
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
259
|
+
plane = clippingPlanes[ i ];
|
|
260
|
+
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
261
|
+
}
|
|
262
|
+
#pragma unroll_loop_end
|
|
263
|
+
if ( clipped ) discard;
|
|
264
|
+
#endif
|
|
265
|
+
#endif`,dh=`#if NUM_CLIPPING_PLANES > 0
|
|
266
|
+
varying vec3 vClipPosition;
|
|
267
|
+
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
268
|
+
#endif`,fh=`#if NUM_CLIPPING_PLANES > 0
|
|
269
|
+
varying vec3 vClipPosition;
|
|
270
|
+
#endif`,ph=`#if NUM_CLIPPING_PLANES > 0
|
|
271
|
+
vClipPosition = - mvPosition.xyz;
|
|
272
|
+
#endif`,mh=`#if defined( USE_COLOR_ALPHA )
|
|
273
|
+
diffuseColor *= vColor;
|
|
274
|
+
#elif defined( USE_COLOR )
|
|
275
|
+
diffuseColor.rgb *= vColor;
|
|
276
|
+
#endif`,gh=`#if defined( USE_COLOR_ALPHA )
|
|
277
|
+
varying vec4 vColor;
|
|
278
|
+
#elif defined( USE_COLOR )
|
|
279
|
+
varying vec3 vColor;
|
|
280
|
+
#endif`,xh=`#if defined( USE_COLOR_ALPHA )
|
|
281
|
+
varying vec4 vColor;
|
|
282
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
283
|
+
varying vec3 vColor;
|
|
284
|
+
#endif`,vh=`#if defined( USE_COLOR_ALPHA )
|
|
285
|
+
vColor = vec4( 1.0 );
|
|
286
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
287
|
+
vColor = vec3( 1.0 );
|
|
288
|
+
#endif
|
|
289
|
+
#ifdef USE_COLOR
|
|
290
|
+
vColor *= color;
|
|
291
|
+
#endif
|
|
292
|
+
#ifdef USE_INSTANCING_COLOR
|
|
293
|
+
vColor.xyz *= instanceColor.xyz;
|
|
294
|
+
#endif`,_h=`#define PI 3.141592653589793
|
|
295
|
+
#define PI2 6.283185307179586
|
|
296
|
+
#define PI_HALF 1.5707963267948966
|
|
297
|
+
#define RECIPROCAL_PI 0.3183098861837907
|
|
298
|
+
#define RECIPROCAL_PI2 0.15915494309189535
|
|
299
|
+
#define EPSILON 1e-6
|
|
300
|
+
#ifndef saturate
|
|
301
|
+
#define saturate(a) clamp( a, 0.0, 1.0 )
|
|
302
|
+
#endif
|
|
303
|
+
#define whiteComplement(a) ( 1.0 - saturate( a ) )
|
|
304
|
+
float pow2( const in float x ) { return x*x; }
|
|
305
|
+
float pow3( const in float x ) { return x*x*x; }
|
|
306
|
+
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
307
|
+
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
|
308
|
+
highp float rand( const in vec2 uv ) {
|
|
309
|
+
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
310
|
+
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
311
|
+
return fract(sin(sn) * c);
|
|
312
|
+
}
|
|
313
|
+
#ifdef HIGH_PRECISION
|
|
314
|
+
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
315
|
+
#else
|
|
316
|
+
float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
317
|
+
float precisionSafeLength( vec3 v ) {
|
|
318
|
+
float maxComponent = max3( abs( v ) );
|
|
319
|
+
return length( v / maxComponent ) * maxComponent;
|
|
320
|
+
}
|
|
321
|
+
#endif
|
|
322
|
+
struct IncidentLight {
|
|
323
|
+
vec3 color;
|
|
324
|
+
vec3 direction;
|
|
325
|
+
bool visible;
|
|
326
|
+
};
|
|
327
|
+
struct ReflectedLight {
|
|
328
|
+
vec3 directDiffuse;
|
|
329
|
+
vec3 directSpecular;
|
|
330
|
+
vec3 indirectDiffuse;
|
|
331
|
+
vec3 indirectSpecular;
|
|
332
|
+
};
|
|
333
|
+
struct GeometricContext {
|
|
334
|
+
vec3 position;
|
|
335
|
+
vec3 normal;
|
|
336
|
+
vec3 viewDir;
|
|
337
|
+
#ifdef CLEARCOAT
|
|
338
|
+
vec3 clearcoatNormal;
|
|
339
|
+
#endif
|
|
340
|
+
};
|
|
341
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
342
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
343
|
+
}
|
|
344
|
+
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
345
|
+
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
346
|
+
}
|
|
347
|
+
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
348
|
+
float distance = dot( planeNormal, point - pointOnPlane );
|
|
349
|
+
return - distance * planeNormal + point;
|
|
350
|
+
}
|
|
351
|
+
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
352
|
+
return sign( dot( point - pointOnPlane, planeNormal ) );
|
|
353
|
+
}
|
|
354
|
+
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
355
|
+
return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
|
|
356
|
+
}
|
|
357
|
+
mat3 transposeMat3( const in mat3 m ) {
|
|
358
|
+
mat3 tmp;
|
|
359
|
+
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
360
|
+
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
361
|
+
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
362
|
+
return tmp;
|
|
363
|
+
}
|
|
364
|
+
float linearToRelativeLuminance( const in vec3 color ) {
|
|
365
|
+
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
|
366
|
+
return dot( weights, color.rgb );
|
|
367
|
+
}
|
|
368
|
+
bool isPerspectiveMatrix( mat4 m ) {
|
|
369
|
+
return m[ 2 ][ 3 ] == - 1.0;
|
|
370
|
+
}
|
|
371
|
+
vec2 equirectUv( in vec3 dir ) {
|
|
372
|
+
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
373
|
+
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
374
|
+
return vec2( u, v );
|
|
375
|
+
}`,yh=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
376
|
+
#define cubeUV_maxMipLevel 8.0
|
|
377
|
+
#define cubeUV_minMipLevel 4.0
|
|
378
|
+
#define cubeUV_maxTileSize 256.0
|
|
379
|
+
#define cubeUV_minTileSize 16.0
|
|
380
|
+
float getFace( vec3 direction ) {
|
|
381
|
+
vec3 absDirection = abs( direction );
|
|
382
|
+
float face = - 1.0;
|
|
383
|
+
if ( absDirection.x > absDirection.z ) {
|
|
384
|
+
if ( absDirection.x > absDirection.y )
|
|
385
|
+
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
386
|
+
else
|
|
387
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
388
|
+
} else {
|
|
389
|
+
if ( absDirection.z > absDirection.y )
|
|
390
|
+
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
391
|
+
else
|
|
392
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
393
|
+
}
|
|
394
|
+
return face;
|
|
395
|
+
}
|
|
396
|
+
vec2 getUV( vec3 direction, float face ) {
|
|
397
|
+
vec2 uv;
|
|
398
|
+
if ( face == 0.0 ) {
|
|
399
|
+
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
400
|
+
} else if ( face == 1.0 ) {
|
|
401
|
+
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
402
|
+
} else if ( face == 2.0 ) {
|
|
403
|
+
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
404
|
+
} else if ( face == 3.0 ) {
|
|
405
|
+
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
406
|
+
} else if ( face == 4.0 ) {
|
|
407
|
+
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
408
|
+
} else {
|
|
409
|
+
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
410
|
+
}
|
|
411
|
+
return 0.5 * ( uv + 1.0 );
|
|
412
|
+
}
|
|
413
|
+
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
414
|
+
float face = getFace( direction );
|
|
415
|
+
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
416
|
+
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
417
|
+
float faceSize = exp2( mipInt );
|
|
418
|
+
float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
|
|
419
|
+
vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );
|
|
420
|
+
vec2 f = fract( uv );
|
|
421
|
+
uv += 0.5 - f;
|
|
422
|
+
if ( face > 2.0 ) {
|
|
423
|
+
uv.y += faceSize;
|
|
424
|
+
face -= 3.0;
|
|
425
|
+
}
|
|
426
|
+
uv.x += face * faceSize;
|
|
427
|
+
if ( mipInt < cubeUV_maxMipLevel ) {
|
|
428
|
+
uv.y += 2.0 * cubeUV_maxTileSize;
|
|
429
|
+
}
|
|
430
|
+
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
|
|
431
|
+
uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
|
|
432
|
+
uv *= texelSize;
|
|
433
|
+
vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
|
|
434
|
+
uv.x += texelSize;
|
|
435
|
+
vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
|
|
436
|
+
uv.y += texelSize;
|
|
437
|
+
vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
|
|
438
|
+
uv.x -= texelSize;
|
|
439
|
+
vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
|
|
440
|
+
vec3 tm = mix( tl, tr, f.x );
|
|
441
|
+
vec3 bm = mix( bl, br, f.x );
|
|
442
|
+
return mix( tm, bm, f.y );
|
|
443
|
+
}
|
|
444
|
+
#define r0 1.0
|
|
445
|
+
#define v0 0.339
|
|
446
|
+
#define m0 - 2.0
|
|
447
|
+
#define r1 0.8
|
|
448
|
+
#define v1 0.276
|
|
449
|
+
#define m1 - 1.0
|
|
450
|
+
#define r4 0.4
|
|
451
|
+
#define v4 0.046
|
|
452
|
+
#define m4 2.0
|
|
453
|
+
#define r5 0.305
|
|
454
|
+
#define v5 0.016
|
|
455
|
+
#define m5 3.0
|
|
456
|
+
#define r6 0.21
|
|
457
|
+
#define v6 0.0038
|
|
458
|
+
#define m6 4.0
|
|
459
|
+
float roughnessToMip( float roughness ) {
|
|
460
|
+
float mip = 0.0;
|
|
461
|
+
if ( roughness >= r1 ) {
|
|
462
|
+
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
|
|
463
|
+
} else if ( roughness >= r4 ) {
|
|
464
|
+
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
|
|
465
|
+
} else if ( roughness >= r5 ) {
|
|
466
|
+
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
|
|
467
|
+
} else if ( roughness >= r6 ) {
|
|
468
|
+
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
|
|
469
|
+
} else {
|
|
470
|
+
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
471
|
+
return mip;
|
|
472
|
+
}
|
|
473
|
+
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
474
|
+
float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
|
|
475
|
+
float mipF = fract( mip );
|
|
476
|
+
float mipInt = floor( mip );
|
|
477
|
+
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
478
|
+
if ( mipF == 0.0 ) {
|
|
479
|
+
return vec4( color0, 1.0 );
|
|
480
|
+
} else {
|
|
481
|
+
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
482
|
+
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
#endif`,Mh=`vec3 transformedNormal = objectNormal;
|
|
486
|
+
#ifdef USE_INSTANCING
|
|
487
|
+
mat3 m = mat3( instanceMatrix );
|
|
488
|
+
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
489
|
+
transformedNormal = m * transformedNormal;
|
|
490
|
+
#endif
|
|
491
|
+
transformedNormal = normalMatrix * transformedNormal;
|
|
492
|
+
#ifdef FLIP_SIDED
|
|
493
|
+
transformedNormal = - transformedNormal;
|
|
494
|
+
#endif
|
|
495
|
+
#ifdef USE_TANGENT
|
|
496
|
+
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
497
|
+
#ifdef FLIP_SIDED
|
|
498
|
+
transformedTangent = - transformedTangent;
|
|
499
|
+
#endif
|
|
500
|
+
#endif`,wh=`#ifdef USE_DISPLACEMENTMAP
|
|
501
|
+
uniform sampler2D displacementMap;
|
|
502
|
+
uniform float displacementScale;
|
|
503
|
+
uniform float displacementBias;
|
|
504
|
+
#endif`,bh=`#ifdef USE_DISPLACEMENTMAP
|
|
505
|
+
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
|
506
|
+
#endif`,Sh=`#ifdef USE_EMISSIVEMAP
|
|
507
|
+
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
|
508
|
+
emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
|
|
509
|
+
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
510
|
+
#endif`,Eh=`#ifdef USE_EMISSIVEMAP
|
|
511
|
+
uniform sampler2D emissiveMap;
|
|
512
|
+
#endif`,Th="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ah=`
|
|
513
|
+
vec4 LinearToLinear( in vec4 value ) {
|
|
514
|
+
return value;
|
|
515
|
+
}
|
|
516
|
+
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
|
|
517
|
+
return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
|
|
518
|
+
}
|
|
519
|
+
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
|
|
520
|
+
return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
|
|
521
|
+
}
|
|
522
|
+
vec4 sRGBToLinear( in vec4 value ) {
|
|
523
|
+
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
524
|
+
}
|
|
525
|
+
vec4 LinearTosRGB( in vec4 value ) {
|
|
526
|
+
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 );
|
|
527
|
+
}
|
|
528
|
+
vec4 RGBEToLinear( in vec4 value ) {
|
|
529
|
+
return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
|
|
530
|
+
}
|
|
531
|
+
vec4 LinearToRGBE( in vec4 value ) {
|
|
532
|
+
float maxComponent = max( max( value.r, value.g ), value.b );
|
|
533
|
+
float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
|
|
534
|
+
return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
|
|
535
|
+
}
|
|
536
|
+
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
|
|
537
|
+
return vec4( value.rgb * value.a * maxRange, 1.0 );
|
|
538
|
+
}
|
|
539
|
+
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
|
|
540
|
+
float maxRGB = max( value.r, max( value.g, value.b ) );
|
|
541
|
+
float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
|
|
542
|
+
M = ceil( M * 255.0 ) / 255.0;
|
|
543
|
+
return vec4( value.rgb / ( M * maxRange ), M );
|
|
544
|
+
}
|
|
545
|
+
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
|
|
546
|
+
return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
|
|
547
|
+
}
|
|
548
|
+
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
|
|
549
|
+
float maxRGB = max( value.r, max( value.g, value.b ) );
|
|
550
|
+
float D = max( maxRange / maxRGB, 1.0 );
|
|
551
|
+
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
|
|
552
|
+
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
|
|
553
|
+
}
|
|
554
|
+
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
|
|
555
|
+
vec4 LinearToLogLuv( in vec4 value ) {
|
|
556
|
+
vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
|
|
557
|
+
Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
|
|
558
|
+
vec4 vResult;
|
|
559
|
+
vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
|
|
560
|
+
float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
|
|
561
|
+
vResult.w = fract( Le );
|
|
562
|
+
vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
|
|
563
|
+
return vResult;
|
|
564
|
+
}
|
|
565
|
+
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
|
|
566
|
+
vec4 LogLuvToLinear( in vec4 value ) {
|
|
567
|
+
float Le = value.z * 255.0 + value.w;
|
|
568
|
+
vec3 Xp_Y_XYZp;
|
|
569
|
+
Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
|
|
570
|
+
Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
|
|
571
|
+
Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
|
|
572
|
+
vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
|
|
573
|
+
return vec4( max( vRGB, 0.0 ), 1.0 );
|
|
574
|
+
}`,Lh=`#ifdef USE_ENVMAP
|
|
575
|
+
#ifdef ENV_WORLDPOS
|
|
576
|
+
vec3 cameraToFrag;
|
|
577
|
+
if ( isOrthographic ) {
|
|
578
|
+
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
579
|
+
} else {
|
|
580
|
+
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
581
|
+
}
|
|
582
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
583
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
584
|
+
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
585
|
+
#else
|
|
586
|
+
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
587
|
+
#endif
|
|
588
|
+
#else
|
|
589
|
+
vec3 reflectVec = vReflect;
|
|
590
|
+
#endif
|
|
591
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
592
|
+
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
593
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
594
|
+
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
|
595
|
+
#else
|
|
596
|
+
vec4 envColor = vec4( 0.0 );
|
|
597
|
+
#endif
|
|
598
|
+
#ifndef ENVMAP_TYPE_CUBE_UV
|
|
599
|
+
envColor = envMapTexelToLinear( envColor );
|
|
600
|
+
#endif
|
|
601
|
+
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
602
|
+
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
603
|
+
#elif defined( ENVMAP_BLENDING_MIX )
|
|
604
|
+
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
605
|
+
#elif defined( ENVMAP_BLENDING_ADD )
|
|
606
|
+
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
607
|
+
#endif
|
|
608
|
+
#endif`,Rh=`#ifdef USE_ENVMAP
|
|
609
|
+
uniform float envMapIntensity;
|
|
610
|
+
uniform float flipEnvMap;
|
|
611
|
+
uniform int maxMipLevel;
|
|
612
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
613
|
+
uniform samplerCube envMap;
|
|
614
|
+
#else
|
|
615
|
+
uniform sampler2D envMap;
|
|
616
|
+
#endif
|
|
617
|
+
|
|
618
|
+
#endif`,Ch=`#ifdef USE_ENVMAP
|
|
619
|
+
uniform float reflectivity;
|
|
620
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
|
621
|
+
#define ENV_WORLDPOS
|
|
622
|
+
#endif
|
|
623
|
+
#ifdef ENV_WORLDPOS
|
|
624
|
+
varying vec3 vWorldPosition;
|
|
625
|
+
uniform float refractionRatio;
|
|
626
|
+
#else
|
|
627
|
+
varying vec3 vReflect;
|
|
628
|
+
#endif
|
|
629
|
+
#endif`,Ph=`#ifdef USE_ENVMAP
|
|
630
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
|
631
|
+
#define ENV_WORLDPOS
|
|
632
|
+
#endif
|
|
633
|
+
#ifdef ENV_WORLDPOS
|
|
634
|
+
|
|
635
|
+
varying vec3 vWorldPosition;
|
|
636
|
+
#else
|
|
637
|
+
varying vec3 vReflect;
|
|
638
|
+
uniform float refractionRatio;
|
|
639
|
+
#endif
|
|
640
|
+
#endif`,Dh=`#ifdef USE_ENVMAP
|
|
641
|
+
#ifdef ENV_WORLDPOS
|
|
642
|
+
vWorldPosition = worldPosition.xyz;
|
|
643
|
+
#else
|
|
644
|
+
vec3 cameraToVertex;
|
|
645
|
+
if ( isOrthographic ) {
|
|
646
|
+
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
647
|
+
} else {
|
|
648
|
+
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
649
|
+
}
|
|
650
|
+
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
651
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
652
|
+
vReflect = reflect( cameraToVertex, worldNormal );
|
|
653
|
+
#else
|
|
654
|
+
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
655
|
+
#endif
|
|
656
|
+
#endif
|
|
657
|
+
#endif`,Ih=`#ifdef USE_FOG
|
|
658
|
+
fogDepth = - mvPosition.z;
|
|
659
|
+
#endif`,Nh=`#ifdef USE_FOG
|
|
660
|
+
varying float fogDepth;
|
|
661
|
+
#endif`,Fh=`#ifdef USE_FOG
|
|
662
|
+
#ifdef FOG_EXP2
|
|
663
|
+
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
|
|
664
|
+
#else
|
|
665
|
+
float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
|
|
666
|
+
#endif
|
|
667
|
+
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
668
|
+
#endif`,Bh=`#ifdef USE_FOG
|
|
669
|
+
uniform vec3 fogColor;
|
|
670
|
+
varying float fogDepth;
|
|
671
|
+
#ifdef FOG_EXP2
|
|
672
|
+
uniform float fogDensity;
|
|
673
|
+
#else
|
|
674
|
+
uniform float fogNear;
|
|
675
|
+
uniform float fogFar;
|
|
676
|
+
#endif
|
|
677
|
+
#endif`,zh=`#ifdef USE_GRADIENTMAP
|
|
678
|
+
uniform sampler2D gradientMap;
|
|
679
|
+
#endif
|
|
680
|
+
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
681
|
+
float dotNL = dot( normal, lightDirection );
|
|
682
|
+
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
683
|
+
#ifdef USE_GRADIENTMAP
|
|
684
|
+
return texture2D( gradientMap, coord ).rgb;
|
|
685
|
+
#else
|
|
686
|
+
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
|
687
|
+
#endif
|
|
688
|
+
}`,Oh=`#ifdef USE_LIGHTMAP
|
|
689
|
+
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
690
|
+
reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
691
|
+
#endif`,Uh=`#ifdef USE_LIGHTMAP
|
|
692
|
+
uniform sampler2D lightMap;
|
|
693
|
+
uniform float lightMapIntensity;
|
|
694
|
+
#endif`,Hh=`vec3 diffuse = vec3( 1.0 );
|
|
695
|
+
GeometricContext geometry;
|
|
696
|
+
geometry.position = mvPosition.xyz;
|
|
697
|
+
geometry.normal = normalize( transformedNormal );
|
|
698
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
699
|
+
GeometricContext backGeometry;
|
|
700
|
+
backGeometry.position = geometry.position;
|
|
701
|
+
backGeometry.normal = -geometry.normal;
|
|
702
|
+
backGeometry.viewDir = geometry.viewDir;
|
|
703
|
+
vLightFront = vec3( 0.0 );
|
|
704
|
+
vIndirectFront = vec3( 0.0 );
|
|
705
|
+
#ifdef DOUBLE_SIDED
|
|
706
|
+
vLightBack = vec3( 0.0 );
|
|
707
|
+
vIndirectBack = vec3( 0.0 );
|
|
708
|
+
#endif
|
|
709
|
+
IncidentLight directLight;
|
|
710
|
+
float dotNL;
|
|
711
|
+
vec3 directLightColor_Diffuse;
|
|
712
|
+
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
713
|
+
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
|
|
714
|
+
#ifdef DOUBLE_SIDED
|
|
715
|
+
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
716
|
+
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
|
|
717
|
+
#endif
|
|
718
|
+
#if NUM_POINT_LIGHTS > 0
|
|
719
|
+
#pragma unroll_loop_start
|
|
720
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
721
|
+
getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
|
|
722
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
723
|
+
directLightColor_Diffuse = PI * directLight.color;
|
|
724
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
725
|
+
#ifdef DOUBLE_SIDED
|
|
726
|
+
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
727
|
+
#endif
|
|
728
|
+
}
|
|
729
|
+
#pragma unroll_loop_end
|
|
730
|
+
#endif
|
|
731
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
732
|
+
#pragma unroll_loop_start
|
|
733
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
734
|
+
getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
|
|
735
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
736
|
+
directLightColor_Diffuse = PI * directLight.color;
|
|
737
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
738
|
+
#ifdef DOUBLE_SIDED
|
|
739
|
+
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
740
|
+
#endif
|
|
741
|
+
}
|
|
742
|
+
#pragma unroll_loop_end
|
|
743
|
+
#endif
|
|
744
|
+
#if NUM_DIR_LIGHTS > 0
|
|
745
|
+
#pragma unroll_loop_start
|
|
746
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
747
|
+
getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
|
|
748
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
749
|
+
directLightColor_Diffuse = PI * directLight.color;
|
|
750
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
751
|
+
#ifdef DOUBLE_SIDED
|
|
752
|
+
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
753
|
+
#endif
|
|
754
|
+
}
|
|
755
|
+
#pragma unroll_loop_end
|
|
756
|
+
#endif
|
|
757
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
758
|
+
#pragma unroll_loop_start
|
|
759
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
760
|
+
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
761
|
+
#ifdef DOUBLE_SIDED
|
|
762
|
+
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
|
|
763
|
+
#endif
|
|
764
|
+
}
|
|
765
|
+
#pragma unroll_loop_end
|
|
766
|
+
#endif`,Gh=`uniform bool receiveShadow;
|
|
767
|
+
uniform vec3 ambientLightColor;
|
|
768
|
+
uniform vec3 lightProbe[ 9 ];
|
|
769
|
+
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
770
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
771
|
+
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
772
|
+
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
773
|
+
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
774
|
+
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
775
|
+
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
776
|
+
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
777
|
+
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
778
|
+
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
779
|
+
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
782
|
+
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
|
|
783
|
+
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
|
|
784
|
+
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
785
|
+
return irradiance;
|
|
786
|
+
}
|
|
787
|
+
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
788
|
+
vec3 irradiance = ambientLightColor;
|
|
789
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
790
|
+
irradiance *= PI;
|
|
791
|
+
#endif
|
|
792
|
+
return irradiance;
|
|
793
|
+
}
|
|
794
|
+
#if NUM_DIR_LIGHTS > 0
|
|
795
|
+
struct DirectionalLight {
|
|
796
|
+
vec3 direction;
|
|
797
|
+
vec3 color;
|
|
798
|
+
};
|
|
799
|
+
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
800
|
+
void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
801
|
+
directLight.color = directionalLight.color;
|
|
802
|
+
directLight.direction = directionalLight.direction;
|
|
803
|
+
directLight.visible = true;
|
|
804
|
+
}
|
|
805
|
+
#endif
|
|
806
|
+
#if NUM_POINT_LIGHTS > 0
|
|
807
|
+
struct PointLight {
|
|
808
|
+
vec3 position;
|
|
809
|
+
vec3 color;
|
|
810
|
+
float distance;
|
|
811
|
+
float decay;
|
|
812
|
+
};
|
|
813
|
+
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
814
|
+
void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
815
|
+
vec3 lVector = pointLight.position - geometry.position;
|
|
816
|
+
directLight.direction = normalize( lVector );
|
|
817
|
+
float lightDistance = length( lVector );
|
|
818
|
+
directLight.color = pointLight.color;
|
|
819
|
+
directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
|
|
820
|
+
directLight.visible = ( directLight.color != vec3( 0.0 ) );
|
|
821
|
+
}
|
|
822
|
+
#endif
|
|
823
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
824
|
+
struct SpotLight {
|
|
825
|
+
vec3 position;
|
|
826
|
+
vec3 direction;
|
|
827
|
+
vec3 color;
|
|
828
|
+
float distance;
|
|
829
|
+
float decay;
|
|
830
|
+
float coneCos;
|
|
831
|
+
float penumbraCos;
|
|
832
|
+
};
|
|
833
|
+
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
834
|
+
void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
835
|
+
vec3 lVector = spotLight.position - geometry.position;
|
|
836
|
+
directLight.direction = normalize( lVector );
|
|
837
|
+
float lightDistance = length( lVector );
|
|
838
|
+
float angleCos = dot( directLight.direction, spotLight.direction );
|
|
839
|
+
if ( angleCos > spotLight.coneCos ) {
|
|
840
|
+
float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
841
|
+
directLight.color = spotLight.color;
|
|
842
|
+
directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
|
|
843
|
+
directLight.visible = true;
|
|
844
|
+
} else {
|
|
845
|
+
directLight.color = vec3( 0.0 );
|
|
846
|
+
directLight.visible = false;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
#endif
|
|
850
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
851
|
+
struct RectAreaLight {
|
|
852
|
+
vec3 color;
|
|
853
|
+
vec3 position;
|
|
854
|
+
vec3 halfWidth;
|
|
855
|
+
vec3 halfHeight;
|
|
856
|
+
};
|
|
857
|
+
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
858
|
+
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
859
|
+
#endif
|
|
860
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
861
|
+
struct HemisphereLight {
|
|
862
|
+
vec3 direction;
|
|
863
|
+
vec3 skyColor;
|
|
864
|
+
vec3 groundColor;
|
|
865
|
+
};
|
|
866
|
+
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
867
|
+
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
|
|
868
|
+
float dotNL = dot( geometry.normal, hemiLight.direction );
|
|
869
|
+
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
870
|
+
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
871
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
872
|
+
irradiance *= PI;
|
|
873
|
+
#endif
|
|
874
|
+
return irradiance;
|
|
875
|
+
}
|
|
876
|
+
#endif`,Vh=`#if defined( USE_ENVMAP )
|
|
877
|
+
#ifdef ENVMAP_MODE_REFRACTION
|
|
878
|
+
uniform float refractionRatio;
|
|
879
|
+
#endif
|
|
880
|
+
vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
|
|
881
|
+
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
|
|
882
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
883
|
+
vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
|
|
884
|
+
#ifdef TEXTURE_LOD_EXT
|
|
885
|
+
vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
|
|
886
|
+
#else
|
|
887
|
+
vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
|
|
888
|
+
#endif
|
|
889
|
+
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
890
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
891
|
+
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|
892
|
+
#else
|
|
893
|
+
vec4 envMapColor = vec4( 0.0 );
|
|
894
|
+
#endif
|
|
895
|
+
return PI * envMapColor.rgb * envMapIntensity;
|
|
896
|
+
}
|
|
897
|
+
float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
|
|
898
|
+
float maxMIPLevelScalar = float( maxMIPLevel );
|
|
899
|
+
float sigma = PI * roughness * roughness / ( 1.0 + roughness );
|
|
900
|
+
float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
|
|
901
|
+
return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
|
|
902
|
+
}
|
|
903
|
+
vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
|
|
904
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
905
|
+
vec3 reflectVec = reflect( -viewDir, normal );
|
|
906
|
+
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
907
|
+
#else
|
|
908
|
+
vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
|
|
909
|
+
#endif
|
|
910
|
+
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
911
|
+
float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
|
|
912
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
913
|
+
vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
|
|
914
|
+
#ifdef TEXTURE_LOD_EXT
|
|
915
|
+
vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
|
|
916
|
+
#else
|
|
917
|
+
vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
|
|
918
|
+
#endif
|
|
919
|
+
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
920
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
921
|
+
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|
922
|
+
#endif
|
|
923
|
+
return envMapColor.rgb * envMapIntensity;
|
|
924
|
+
}
|
|
925
|
+
#endif`,kh=`ToonMaterial material;
|
|
926
|
+
material.diffuseColor = diffuseColor.rgb;`,Wh=`varying vec3 vViewPosition;
|
|
927
|
+
#ifndef FLAT_SHADED
|
|
928
|
+
varying vec3 vNormal;
|
|
929
|
+
#endif
|
|
930
|
+
struct ToonMaterial {
|
|
931
|
+
vec3 diffuseColor;
|
|
932
|
+
};
|
|
933
|
+
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
934
|
+
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
|
935
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
936
|
+
irradiance *= PI;
|
|
937
|
+
#endif
|
|
938
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
939
|
+
}
|
|
940
|
+
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
941
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
942
|
+
}
|
|
943
|
+
#define RE_Direct RE_Direct_Toon
|
|
944
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
945
|
+
#define Material_LightProbeLOD( material ) (0)`,qh=`BlinnPhongMaterial material;
|
|
946
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
947
|
+
material.specularColor = specular;
|
|
948
|
+
material.specularShininess = shininess;
|
|
949
|
+
material.specularStrength = specularStrength;`,Xh=`varying vec3 vViewPosition;
|
|
950
|
+
#ifndef FLAT_SHADED
|
|
951
|
+
varying vec3 vNormal;
|
|
952
|
+
#endif
|
|
953
|
+
struct BlinnPhongMaterial {
|
|
954
|
+
vec3 diffuseColor;
|
|
955
|
+
vec3 specularColor;
|
|
956
|
+
float specularShininess;
|
|
957
|
+
float specularStrength;
|
|
958
|
+
};
|
|
959
|
+
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
960
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
961
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
962
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
963
|
+
irradiance *= PI;
|
|
964
|
+
#endif
|
|
965
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
966
|
+
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
967
|
+
}
|
|
968
|
+
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
969
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
970
|
+
}
|
|
971
|
+
#define RE_Direct RE_Direct_BlinnPhong
|
|
972
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
973
|
+
#define Material_LightProbeLOD( material ) (0)`,Yh=`PhysicalMaterial material;
|
|
974
|
+
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
975
|
+
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
|
976
|
+
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
977
|
+
material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
|
|
978
|
+
material.specularRoughness = min( material.specularRoughness, 1.0 );
|
|
979
|
+
#ifdef REFLECTIVITY
|
|
980
|
+
material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
|
|
981
|
+
#else
|
|
982
|
+
material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
|
|
983
|
+
#endif
|
|
984
|
+
#ifdef CLEARCOAT
|
|
985
|
+
material.clearcoat = clearcoat;
|
|
986
|
+
material.clearcoatRoughness = clearcoatRoughness;
|
|
987
|
+
#ifdef USE_CLEARCOATMAP
|
|
988
|
+
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
|
989
|
+
#endif
|
|
990
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
991
|
+
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
|
992
|
+
#endif
|
|
993
|
+
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
994
|
+
material.clearcoatRoughness += geometryRoughness;
|
|
995
|
+
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
996
|
+
#endif
|
|
997
|
+
#ifdef USE_SHEEN
|
|
998
|
+
material.sheenColor = sheen;
|
|
999
|
+
#endif`,Zh=`struct PhysicalMaterial {
|
|
1000
|
+
vec3 diffuseColor;
|
|
1001
|
+
float specularRoughness;
|
|
1002
|
+
vec3 specularColor;
|
|
1003
|
+
#ifdef CLEARCOAT
|
|
1004
|
+
float clearcoat;
|
|
1005
|
+
float clearcoatRoughness;
|
|
1006
|
+
#endif
|
|
1007
|
+
#ifdef USE_SHEEN
|
|
1008
|
+
vec3 sheenColor;
|
|
1009
|
+
#endif
|
|
1010
|
+
};
|
|
1011
|
+
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
|
|
1012
|
+
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
|
|
1013
|
+
float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
|
|
1014
|
+
return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
|
|
1015
|
+
}
|
|
1016
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1017
|
+
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1018
|
+
vec3 normal = geometry.normal;
|
|
1019
|
+
vec3 viewDir = geometry.viewDir;
|
|
1020
|
+
vec3 position = geometry.position;
|
|
1021
|
+
vec3 lightPos = rectAreaLight.position;
|
|
1022
|
+
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
1023
|
+
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
1024
|
+
vec3 lightColor = rectAreaLight.color;
|
|
1025
|
+
float roughness = material.specularRoughness;
|
|
1026
|
+
vec3 rectCoords[ 4 ];
|
|
1027
|
+
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
1028
|
+
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
1029
|
+
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
1030
|
+
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
1031
|
+
vec4 t1 = texture2D( ltc_1, uv );
|
|
1032
|
+
vec4 t2 = texture2D( ltc_2, uv );
|
|
1033
|
+
mat3 mInv = mat3(
|
|
1034
|
+
vec3( t1.x, 0, t1.y ),
|
|
1035
|
+
vec3( 0, 1, 0 ),
|
|
1036
|
+
vec3( t1.z, 0, t1.w )
|
|
1037
|
+
);
|
|
1038
|
+
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
1039
|
+
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
1040
|
+
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
1041
|
+
}
|
|
1042
|
+
#endif
|
|
1043
|
+
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1044
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
1045
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
1046
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1047
|
+
irradiance *= PI;
|
|
1048
|
+
#endif
|
|
1049
|
+
#ifdef CLEARCOAT
|
|
1050
|
+
float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
|
1051
|
+
vec3 ccIrradiance = ccDotNL * directLight.color;
|
|
1052
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1053
|
+
ccIrradiance *= PI;
|
|
1054
|
+
#endif
|
|
1055
|
+
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
|
|
1056
|
+
reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
|
|
1057
|
+
#else
|
|
1058
|
+
float clearcoatDHR = 0.0;
|
|
1059
|
+
#endif
|
|
1060
|
+
#ifdef USE_SHEEN
|
|
1061
|
+
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
|
|
1062
|
+
material.specularRoughness,
|
|
1063
|
+
directLight.direction,
|
|
1064
|
+
geometry,
|
|
1065
|
+
material.sheenColor
|
|
1066
|
+
);
|
|
1067
|
+
#else
|
|
1068
|
+
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
|
|
1069
|
+
#endif
|
|
1070
|
+
reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1071
|
+
}
|
|
1072
|
+
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1073
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1074
|
+
}
|
|
1075
|
+
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
1076
|
+
#ifdef CLEARCOAT
|
|
1077
|
+
float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
|
1078
|
+
reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
|
|
1079
|
+
float ccDotNL = ccDotNV;
|
|
1080
|
+
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
|
|
1081
|
+
#else
|
|
1082
|
+
float clearcoatDHR = 0.0;
|
|
1083
|
+
#endif
|
|
1084
|
+
float clearcoatInv = 1.0 - clearcoatDHR;
|
|
1085
|
+
vec3 singleScattering = vec3( 0.0 );
|
|
1086
|
+
vec3 multiScattering = vec3( 0.0 );
|
|
1087
|
+
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
1088
|
+
BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
|
|
1089
|
+
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
|
1090
|
+
reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
|
|
1091
|
+
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
1092
|
+
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
1093
|
+
}
|
|
1094
|
+
#define RE_Direct RE_Direct_Physical
|
|
1095
|
+
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
1096
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
1097
|
+
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1098
|
+
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1099
|
+
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1100
|
+
}`,jh=`
|
|
1101
|
+
GeometricContext geometry;
|
|
1102
|
+
geometry.position = - vViewPosition;
|
|
1103
|
+
geometry.normal = normal;
|
|
1104
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1105
|
+
#ifdef CLEARCOAT
|
|
1106
|
+
geometry.clearcoatNormal = clearcoatNormal;
|
|
1107
|
+
#endif
|
|
1108
|
+
IncidentLight directLight;
|
|
1109
|
+
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1110
|
+
PointLight pointLight;
|
|
1111
|
+
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1112
|
+
PointLightShadow pointLightShadow;
|
|
1113
|
+
#endif
|
|
1114
|
+
#pragma unroll_loop_start
|
|
1115
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1116
|
+
pointLight = pointLights[ i ];
|
|
1117
|
+
getPointDirectLightIrradiance( pointLight, geometry, directLight );
|
|
1118
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
1119
|
+
pointLightShadow = pointLightShadows[ i ];
|
|
1120
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1121
|
+
#endif
|
|
1122
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1123
|
+
}
|
|
1124
|
+
#pragma unroll_loop_end
|
|
1125
|
+
#endif
|
|
1126
|
+
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1127
|
+
SpotLight spotLight;
|
|
1128
|
+
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1129
|
+
SpotLightShadow spotLightShadow;
|
|
1130
|
+
#endif
|
|
1131
|
+
#pragma unroll_loop_start
|
|
1132
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1133
|
+
spotLight = spotLights[ i ];
|
|
1134
|
+
getSpotDirectLightIrradiance( spotLight, geometry, directLight );
|
|
1135
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1136
|
+
spotLightShadow = spotLightShadows[ i ];
|
|
1137
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1138
|
+
#endif
|
|
1139
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1140
|
+
}
|
|
1141
|
+
#pragma unroll_loop_end
|
|
1142
|
+
#endif
|
|
1143
|
+
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1144
|
+
DirectionalLight directionalLight;
|
|
1145
|
+
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1146
|
+
DirectionalLightShadow directionalLightShadow;
|
|
1147
|
+
#endif
|
|
1148
|
+
#pragma unroll_loop_start
|
|
1149
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1150
|
+
directionalLight = directionalLights[ i ];
|
|
1151
|
+
getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
|
|
1152
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1153
|
+
directionalLightShadow = directionalLightShadows[ i ];
|
|
1154
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1155
|
+
#endif
|
|
1156
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1157
|
+
}
|
|
1158
|
+
#pragma unroll_loop_end
|
|
1159
|
+
#endif
|
|
1160
|
+
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1161
|
+
RectAreaLight rectAreaLight;
|
|
1162
|
+
#pragma unroll_loop_start
|
|
1163
|
+
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1164
|
+
rectAreaLight = rectAreaLights[ i ];
|
|
1165
|
+
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
|
1166
|
+
}
|
|
1167
|
+
#pragma unroll_loop_end
|
|
1168
|
+
#endif
|
|
1169
|
+
#if defined( RE_IndirectDiffuse )
|
|
1170
|
+
vec3 iblIrradiance = vec3( 0.0 );
|
|
1171
|
+
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1172
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometry );
|
|
1173
|
+
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1174
|
+
#pragma unroll_loop_start
|
|
1175
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1176
|
+
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
1177
|
+
}
|
|
1178
|
+
#pragma unroll_loop_end
|
|
1179
|
+
#endif
|
|
1180
|
+
#endif
|
|
1181
|
+
#if defined( RE_IndirectSpecular )
|
|
1182
|
+
vec3 radiance = vec3( 0.0 );
|
|
1183
|
+
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1184
|
+
#endif`,Jh=`#if defined( RE_IndirectDiffuse )
|
|
1185
|
+
#ifdef USE_LIGHTMAP
|
|
1186
|
+
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
1187
|
+
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
1188
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1189
|
+
lightMapIrradiance *= PI;
|
|
1190
|
+
#endif
|
|
1191
|
+
irradiance += lightMapIrradiance;
|
|
1192
|
+
#endif
|
|
1193
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1194
|
+
iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
|
|
1195
|
+
#endif
|
|
1196
|
+
#endif
|
|
1197
|
+
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1198
|
+
radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
|
|
1199
|
+
#ifdef CLEARCOAT
|
|
1200
|
+
clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
|
|
1201
|
+
#endif
|
|
1202
|
+
#endif`,Qh=`#if defined( RE_IndirectDiffuse )
|
|
1203
|
+
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
1204
|
+
#endif
|
|
1205
|
+
#if defined( RE_IndirectSpecular )
|
|
1206
|
+
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
|
1207
|
+
#endif`,$h=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1208
|
+
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1209
|
+
#endif`,Kh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1210
|
+
uniform float logDepthBufFC;
|
|
1211
|
+
varying float vFragDepth;
|
|
1212
|
+
varying float vIsPerspective;
|
|
1213
|
+
#endif`,eu=`#ifdef USE_LOGDEPTHBUF
|
|
1214
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1215
|
+
varying float vFragDepth;
|
|
1216
|
+
varying float vIsPerspective;
|
|
1217
|
+
#else
|
|
1218
|
+
uniform float logDepthBufFC;
|
|
1219
|
+
#endif
|
|
1220
|
+
#endif`,tu=`#ifdef USE_LOGDEPTHBUF
|
|
1221
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1222
|
+
vFragDepth = 1.0 + gl_Position.w;
|
|
1223
|
+
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1224
|
+
#else
|
|
1225
|
+
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|
1226
|
+
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|
1227
|
+
gl_Position.z *= gl_Position.w;
|
|
1228
|
+
}
|
|
1229
|
+
#endif
|
|
1230
|
+
#endif`,nu=`#ifdef USE_MAP
|
|
1231
|
+
vec4 texelColor = texture2D( map, vUv );
|
|
1232
|
+
texelColor = mapTexelToLinear( texelColor );
|
|
1233
|
+
diffuseColor *= texelColor;
|
|
1234
|
+
#endif`,iu=`#ifdef USE_MAP
|
|
1235
|
+
uniform sampler2D map;
|
|
1236
|
+
#endif`,ru=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1237
|
+
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1238
|
+
#endif
|
|
1239
|
+
#ifdef USE_MAP
|
|
1240
|
+
vec4 mapTexel = texture2D( map, uv );
|
|
1241
|
+
diffuseColor *= mapTexelToLinear( mapTexel );
|
|
1242
|
+
#endif
|
|
1243
|
+
#ifdef USE_ALPHAMAP
|
|
1244
|
+
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1245
|
+
#endif`,su=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1246
|
+
uniform mat3 uvTransform;
|
|
1247
|
+
#endif
|
|
1248
|
+
#ifdef USE_MAP
|
|
1249
|
+
uniform sampler2D map;
|
|
1250
|
+
#endif
|
|
1251
|
+
#ifdef USE_ALPHAMAP
|
|
1252
|
+
uniform sampler2D alphaMap;
|
|
1253
|
+
#endif`,au=`float metalnessFactor = metalness;
|
|
1254
|
+
#ifdef USE_METALNESSMAP
|
|
1255
|
+
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
|
1256
|
+
metalnessFactor *= texelMetalness.b;
|
|
1257
|
+
#endif`,ou=`#ifdef USE_METALNESSMAP
|
|
1258
|
+
uniform sampler2D metalnessMap;
|
|
1259
|
+
#endif`,lu=`#ifdef USE_MORPHNORMALS
|
|
1260
|
+
objectNormal *= morphTargetBaseInfluence;
|
|
1261
|
+
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
1262
|
+
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
1263
|
+
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1264
|
+
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1265
|
+
#endif`,cu=`#ifdef USE_MORPHTARGETS
|
|
1266
|
+
uniform float morphTargetBaseInfluence;
|
|
1267
|
+
#ifndef USE_MORPHNORMALS
|
|
1268
|
+
uniform float morphTargetInfluences[ 8 ];
|
|
1269
|
+
#else
|
|
1270
|
+
uniform float morphTargetInfluences[ 4 ];
|
|
1271
|
+
#endif
|
|
1272
|
+
#endif`,hu=`#ifdef USE_MORPHTARGETS
|
|
1273
|
+
transformed *= morphTargetBaseInfluence;
|
|
1274
|
+
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
1275
|
+
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
1276
|
+
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
1277
|
+
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
1278
|
+
#ifndef USE_MORPHNORMALS
|
|
1279
|
+
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
1280
|
+
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
1281
|
+
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
1282
|
+
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1283
|
+
#endif
|
|
1284
|
+
#endif`,uu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1285
|
+
#ifdef FLAT_SHADED
|
|
1286
|
+
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
|
1287
|
+
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
|
1288
|
+
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1289
|
+
#else
|
|
1290
|
+
vec3 normal = normalize( vNormal );
|
|
1291
|
+
#ifdef DOUBLE_SIDED
|
|
1292
|
+
normal = normal * faceDirection;
|
|
1293
|
+
#endif
|
|
1294
|
+
#ifdef USE_TANGENT
|
|
1295
|
+
vec3 tangent = normalize( vTangent );
|
|
1296
|
+
vec3 bitangent = normalize( vBitangent );
|
|
1297
|
+
#ifdef DOUBLE_SIDED
|
|
1298
|
+
tangent = tangent * faceDirection;
|
|
1299
|
+
bitangent = bitangent * faceDirection;
|
|
1300
|
+
#endif
|
|
1301
|
+
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
|
1302
|
+
mat3 vTBN = mat3( tangent, bitangent, normal );
|
|
1303
|
+
#endif
|
|
1304
|
+
#endif
|
|
1305
|
+
#endif
|
|
1306
|
+
vec3 geometryNormal = normal;`,du=`#ifdef OBJECTSPACE_NORMALMAP
|
|
1307
|
+
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1308
|
+
#ifdef FLIP_SIDED
|
|
1309
|
+
normal = - normal;
|
|
1310
|
+
#endif
|
|
1311
|
+
#ifdef DOUBLE_SIDED
|
|
1312
|
+
normal = normal * faceDirection;
|
|
1313
|
+
#endif
|
|
1314
|
+
normal = normalize( normalMatrix * normal );
|
|
1315
|
+
#elif defined( TANGENTSPACE_NORMALMAP )
|
|
1316
|
+
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1317
|
+
mapN.xy *= normalScale;
|
|
1318
|
+
#ifdef USE_TANGENT
|
|
1319
|
+
normal = normalize( vTBN * mapN );
|
|
1320
|
+
#else
|
|
1321
|
+
normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );
|
|
1322
|
+
#endif
|
|
1323
|
+
#elif defined( USE_BUMPMAP )
|
|
1324
|
+
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1325
|
+
#endif`,fu=`#ifdef USE_NORMALMAP
|
|
1326
|
+
uniform sampler2D normalMap;
|
|
1327
|
+
uniform vec2 normalScale;
|
|
1328
|
+
#endif
|
|
1329
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
1330
|
+
uniform mat3 normalMatrix;
|
|
1331
|
+
#endif
|
|
1332
|
+
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
|
1333
|
+
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
|
1334
|
+
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
|
1335
|
+
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
|
1336
|
+
vec2 st0 = dFdx( vUv.st );
|
|
1337
|
+
vec2 st1 = dFdy( vUv.st );
|
|
1338
|
+
vec3 N = surf_norm;
|
|
1339
|
+
vec3 q1perp = cross( q1, N );
|
|
1340
|
+
vec3 q0perp = cross( N, q0 );
|
|
1341
|
+
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1342
|
+
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1343
|
+
float det = max( dot( T, T ), dot( B, B ) );
|
|
1344
|
+
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
|
1345
|
+
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
|
1346
|
+
}
|
|
1347
|
+
#endif`,pu=`#ifdef CLEARCOAT
|
|
1348
|
+
vec3 clearcoatNormal = geometryNormal;
|
|
1349
|
+
#endif`,mu=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1350
|
+
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1351
|
+
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1352
|
+
#ifdef USE_TANGENT
|
|
1353
|
+
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
|
1354
|
+
#else
|
|
1355
|
+
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
|
|
1356
|
+
#endif
|
|
1357
|
+
#endif`,gu=`#ifdef USE_CLEARCOATMAP
|
|
1358
|
+
uniform sampler2D clearcoatMap;
|
|
1359
|
+
#endif
|
|
1360
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1361
|
+
uniform sampler2D clearcoatRoughnessMap;
|
|
1362
|
+
#endif
|
|
1363
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1364
|
+
uniform sampler2D clearcoatNormalMap;
|
|
1365
|
+
uniform vec2 clearcoatNormalScale;
|
|
1366
|
+
#endif`,xu=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1367
|
+
return normalize( normal ) * 0.5 + 0.5;
|
|
1368
|
+
}
|
|
1369
|
+
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1370
|
+
return 2.0 * rgb.xyz - 1.0;
|
|
1371
|
+
}
|
|
1372
|
+
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
1373
|
+
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
1374
|
+
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
1375
|
+
const float ShiftRight8 = 1. / 256.;
|
|
1376
|
+
vec4 packDepthToRGBA( const in float v ) {
|
|
1377
|
+
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
1378
|
+
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
1379
|
+
}
|
|
1380
|
+
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1381
|
+
return dot( v, UnpackFactors );
|
|
1382
|
+
}
|
|
1383
|
+
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
1384
|
+
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
|
|
1385
|
+
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
|
|
1386
|
+
}
|
|
1387
|
+
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
1388
|
+
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1389
|
+
}
|
|
1390
|
+
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1391
|
+
return ( viewZ + near ) / ( near - far );
|
|
1392
|
+
}
|
|
1393
|
+
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
|
1394
|
+
return linearClipZ * ( near - far ) - near;
|
|
1395
|
+
}
|
|
1396
|
+
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1397
|
+
return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
|
|
1398
|
+
}
|
|
1399
|
+
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
|
1400
|
+
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
1401
|
+
}`,vu=`#ifdef PREMULTIPLIED_ALPHA
|
|
1402
|
+
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1403
|
+
#endif`,_u=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1404
|
+
#ifdef USE_INSTANCING
|
|
1405
|
+
mvPosition = instanceMatrix * mvPosition;
|
|
1406
|
+
#endif
|
|
1407
|
+
mvPosition = modelViewMatrix * mvPosition;
|
|
1408
|
+
gl_Position = projectionMatrix * mvPosition;`,yu=`#ifdef DITHERING
|
|
1409
|
+
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1410
|
+
#endif`,Mu=`#ifdef DITHERING
|
|
1411
|
+
vec3 dithering( vec3 color ) {
|
|
1412
|
+
float grid_position = rand( gl_FragCoord.xy );
|
|
1413
|
+
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1414
|
+
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1415
|
+
return color + dither_shift_RGB;
|
|
1416
|
+
}
|
|
1417
|
+
#endif`,wu=`float roughnessFactor = roughness;
|
|
1418
|
+
#ifdef USE_ROUGHNESSMAP
|
|
1419
|
+
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
|
1420
|
+
roughnessFactor *= texelRoughness.g;
|
|
1421
|
+
#endif`,bu=`#ifdef USE_ROUGHNESSMAP
|
|
1422
|
+
uniform sampler2D roughnessMap;
|
|
1423
|
+
#endif`,Su=`#ifdef USE_SHADOWMAP
|
|
1424
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1425
|
+
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1426
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1427
|
+
struct DirectionalLightShadow {
|
|
1428
|
+
float shadowBias;
|
|
1429
|
+
float shadowNormalBias;
|
|
1430
|
+
float shadowRadius;
|
|
1431
|
+
vec2 shadowMapSize;
|
|
1432
|
+
};
|
|
1433
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1434
|
+
#endif
|
|
1435
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1436
|
+
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1437
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1438
|
+
struct SpotLightShadow {
|
|
1439
|
+
float shadowBias;
|
|
1440
|
+
float shadowNormalBias;
|
|
1441
|
+
float shadowRadius;
|
|
1442
|
+
vec2 shadowMapSize;
|
|
1443
|
+
};
|
|
1444
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1445
|
+
#endif
|
|
1446
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1447
|
+
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1448
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1449
|
+
struct PointLightShadow {
|
|
1450
|
+
float shadowBias;
|
|
1451
|
+
float shadowNormalBias;
|
|
1452
|
+
float shadowRadius;
|
|
1453
|
+
vec2 shadowMapSize;
|
|
1454
|
+
float shadowCameraNear;
|
|
1455
|
+
float shadowCameraFar;
|
|
1456
|
+
};
|
|
1457
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1458
|
+
#endif
|
|
1459
|
+
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
1460
|
+
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
1461
|
+
}
|
|
1462
|
+
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
1463
|
+
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
1464
|
+
}
|
|
1465
|
+
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
1466
|
+
float occlusion = 1.0;
|
|
1467
|
+
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
1468
|
+
float hard_shadow = step( compare , distribution.x );
|
|
1469
|
+
if (hard_shadow != 1.0 ) {
|
|
1470
|
+
float distance = compare - distribution.x ;
|
|
1471
|
+
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
1472
|
+
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 );
|
|
1473
|
+
}
|
|
1474
|
+
return occlusion;
|
|
1475
|
+
}
|
|
1476
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1477
|
+
float shadow = 1.0;
|
|
1478
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1479
|
+
shadowCoord.z += shadowBias;
|
|
1480
|
+
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
|
1481
|
+
bool inFrustum = all( inFrustumVec );
|
|
1482
|
+
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
|
1483
|
+
bool frustumTest = all( frustumTestVec );
|
|
1484
|
+
if ( frustumTest ) {
|
|
1485
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1486
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1487
|
+
float dx0 = - texelSize.x * shadowRadius;
|
|
1488
|
+
float dy0 = - texelSize.y * shadowRadius;
|
|
1489
|
+
float dx1 = + texelSize.x * shadowRadius;
|
|
1490
|
+
float dy1 = + texelSize.y * shadowRadius;
|
|
1491
|
+
float dx2 = dx0 / 2.0;
|
|
1492
|
+
float dy2 = dy0 / 2.0;
|
|
1493
|
+
float dx3 = dx1 / 2.0;
|
|
1494
|
+
float dy3 = dy1 / 2.0;
|
|
1495
|
+
shadow = (
|
|
1496
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
1497
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
1498
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
1499
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
1500
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
1501
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
1502
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
1503
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
1504
|
+
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
1505
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
1506
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
1507
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
1508
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
1509
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
1510
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
1511
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
1512
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
1513
|
+
) * ( 1.0 / 17.0 );
|
|
1514
|
+
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
1515
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1516
|
+
float dx = texelSize.x;
|
|
1517
|
+
float dy = texelSize.y;
|
|
1518
|
+
vec2 uv = shadowCoord.xy;
|
|
1519
|
+
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
1520
|
+
uv -= f * texelSize;
|
|
1521
|
+
shadow = (
|
|
1522
|
+
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
1523
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
1524
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
1525
|
+
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
1526
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
1527
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
1528
|
+
f.x ) +
|
|
1529
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
1530
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
1531
|
+
f.x ) +
|
|
1532
|
+
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
1533
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
1534
|
+
f.y ) +
|
|
1535
|
+
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
1536
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
1537
|
+
f.y ) +
|
|
1538
|
+
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
1539
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
1540
|
+
f.x ),
|
|
1541
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
1542
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
1543
|
+
f.x ),
|
|
1544
|
+
f.y )
|
|
1545
|
+
) * ( 1.0 / 9.0 );
|
|
1546
|
+
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1547
|
+
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1548
|
+
#else
|
|
1549
|
+
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1550
|
+
#endif
|
|
1551
|
+
}
|
|
1552
|
+
return shadow;
|
|
1553
|
+
}
|
|
1554
|
+
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
1555
|
+
vec3 absV = abs( v );
|
|
1556
|
+
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
1557
|
+
absV *= scaleToCube;
|
|
1558
|
+
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
1559
|
+
vec2 planar = v.xy;
|
|
1560
|
+
float almostATexel = 1.5 * texelSizeY;
|
|
1561
|
+
float almostOne = 1.0 - almostATexel;
|
|
1562
|
+
if ( absV.z >= almostOne ) {
|
|
1563
|
+
if ( v.z > 0.0 )
|
|
1564
|
+
planar.x = 4.0 - v.x;
|
|
1565
|
+
} else if ( absV.x >= almostOne ) {
|
|
1566
|
+
float signX = sign( v.x );
|
|
1567
|
+
planar.x = v.z * signX + 2.0 * signX;
|
|
1568
|
+
} else if ( absV.y >= almostOne ) {
|
|
1569
|
+
float signY = sign( v.y );
|
|
1570
|
+
planar.x = v.x + 2.0 * signY + 2.0;
|
|
1571
|
+
planar.y = v.z * signY - 2.0;
|
|
1572
|
+
}
|
|
1573
|
+
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
1574
|
+
}
|
|
1575
|
+
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1576
|
+
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
1577
|
+
vec3 lightToPosition = shadowCoord.xyz;
|
|
1578
|
+
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
1579
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
1580
|
+
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
1581
|
+
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
1582
|
+
return (
|
|
1583
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
1584
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
1585
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
1586
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
1587
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
1588
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
1589
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
1590
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
1591
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
1592
|
+
) * ( 1.0 / 9.0 );
|
|
1593
|
+
#else
|
|
1594
|
+
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
1595
|
+
#endif
|
|
1596
|
+
}
|
|
1597
|
+
#endif`,Eu=`#ifdef USE_SHADOWMAP
|
|
1598
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1599
|
+
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1600
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1601
|
+
struct DirectionalLightShadow {
|
|
1602
|
+
float shadowBias;
|
|
1603
|
+
float shadowNormalBias;
|
|
1604
|
+
float shadowRadius;
|
|
1605
|
+
vec2 shadowMapSize;
|
|
1606
|
+
};
|
|
1607
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1608
|
+
#endif
|
|
1609
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1610
|
+
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1611
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1612
|
+
struct SpotLightShadow {
|
|
1613
|
+
float shadowBias;
|
|
1614
|
+
float shadowNormalBias;
|
|
1615
|
+
float shadowRadius;
|
|
1616
|
+
vec2 shadowMapSize;
|
|
1617
|
+
};
|
|
1618
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1619
|
+
#endif
|
|
1620
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1621
|
+
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1622
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1623
|
+
struct PointLightShadow {
|
|
1624
|
+
float shadowBias;
|
|
1625
|
+
float shadowNormalBias;
|
|
1626
|
+
float shadowRadius;
|
|
1627
|
+
vec2 shadowMapSize;
|
|
1628
|
+
float shadowCameraNear;
|
|
1629
|
+
float shadowCameraFar;
|
|
1630
|
+
};
|
|
1631
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1632
|
+
#endif
|
|
1633
|
+
#endif`,Tu=`#ifdef USE_SHADOWMAP
|
|
1634
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
|
|
1635
|
+
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1636
|
+
vec4 shadowWorldPosition;
|
|
1637
|
+
#endif
|
|
1638
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1639
|
+
#pragma unroll_loop_start
|
|
1640
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1641
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
1642
|
+
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
1643
|
+
}
|
|
1644
|
+
#pragma unroll_loop_end
|
|
1645
|
+
#endif
|
|
1646
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1647
|
+
#pragma unroll_loop_start
|
|
1648
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1649
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
|
|
1650
|
+
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
|
|
1651
|
+
}
|
|
1652
|
+
#pragma unroll_loop_end
|
|
1653
|
+
#endif
|
|
1654
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1655
|
+
#pragma unroll_loop_start
|
|
1656
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1657
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
1658
|
+
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
1659
|
+
}
|
|
1660
|
+
#pragma unroll_loop_end
|
|
1661
|
+
#endif
|
|
1662
|
+
#endif`,Au=`float getShadowMask() {
|
|
1663
|
+
float shadow = 1.0;
|
|
1664
|
+
#ifdef USE_SHADOWMAP
|
|
1665
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1666
|
+
DirectionalLightShadow directionalLight;
|
|
1667
|
+
#pragma unroll_loop_start
|
|
1668
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1669
|
+
directionalLight = directionalLightShadows[ i ];
|
|
1670
|
+
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1671
|
+
}
|
|
1672
|
+
#pragma unroll_loop_end
|
|
1673
|
+
#endif
|
|
1674
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1675
|
+
SpotLightShadow spotLight;
|
|
1676
|
+
#pragma unroll_loop_start
|
|
1677
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1678
|
+
spotLight = spotLightShadows[ i ];
|
|
1679
|
+
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1680
|
+
}
|
|
1681
|
+
#pragma unroll_loop_end
|
|
1682
|
+
#endif
|
|
1683
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1684
|
+
PointLightShadow pointLight;
|
|
1685
|
+
#pragma unroll_loop_start
|
|
1686
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1687
|
+
pointLight = pointLightShadows[ i ];
|
|
1688
|
+
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
1689
|
+
}
|
|
1690
|
+
#pragma unroll_loop_end
|
|
1691
|
+
#endif
|
|
1692
|
+
#endif
|
|
1693
|
+
return shadow;
|
|
1694
|
+
}`,Lu=`#ifdef USE_SKINNING
|
|
1695
|
+
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1696
|
+
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1697
|
+
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1698
|
+
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1699
|
+
#endif`,Ru=`#ifdef USE_SKINNING
|
|
1700
|
+
uniform mat4 bindMatrix;
|
|
1701
|
+
uniform mat4 bindMatrixInverse;
|
|
1702
|
+
#ifdef BONE_TEXTURE
|
|
1703
|
+
uniform highp sampler2D boneTexture;
|
|
1704
|
+
uniform int boneTextureSize;
|
|
1705
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1706
|
+
float j = i * 4.0;
|
|
1707
|
+
float x = mod( j, float( boneTextureSize ) );
|
|
1708
|
+
float y = floor( j / float( boneTextureSize ) );
|
|
1709
|
+
float dx = 1.0 / float( boneTextureSize );
|
|
1710
|
+
float dy = 1.0 / float( boneTextureSize );
|
|
1711
|
+
y = dy * ( y + 0.5 );
|
|
1712
|
+
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
|
1713
|
+
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
|
1714
|
+
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
|
1715
|
+
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
|
1716
|
+
mat4 bone = mat4( v1, v2, v3, v4 );
|
|
1717
|
+
return bone;
|
|
1718
|
+
}
|
|
1719
|
+
#else
|
|
1720
|
+
uniform mat4 boneMatrices[ MAX_BONES ];
|
|
1721
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1722
|
+
mat4 bone = boneMatrices[ int(i) ];
|
|
1723
|
+
return bone;
|
|
1724
|
+
}
|
|
1725
|
+
#endif
|
|
1726
|
+
#endif`,Cu=`#ifdef USE_SKINNING
|
|
1727
|
+
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
1728
|
+
vec4 skinned = vec4( 0.0 );
|
|
1729
|
+
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
1730
|
+
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
1731
|
+
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
1732
|
+
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
1733
|
+
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
1734
|
+
#endif`,Pu=`#ifdef USE_SKINNING
|
|
1735
|
+
mat4 skinMatrix = mat4( 0.0 );
|
|
1736
|
+
skinMatrix += skinWeight.x * boneMatX;
|
|
1737
|
+
skinMatrix += skinWeight.y * boneMatY;
|
|
1738
|
+
skinMatrix += skinWeight.z * boneMatZ;
|
|
1739
|
+
skinMatrix += skinWeight.w * boneMatW;
|
|
1740
|
+
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
1741
|
+
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
1742
|
+
#ifdef USE_TANGENT
|
|
1743
|
+
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
1744
|
+
#endif
|
|
1745
|
+
#endif`,Du=`float specularStrength;
|
|
1746
|
+
#ifdef USE_SPECULARMAP
|
|
1747
|
+
vec4 texelSpecular = texture2D( specularMap, vUv );
|
|
1748
|
+
specularStrength = texelSpecular.r;
|
|
1749
|
+
#else
|
|
1750
|
+
specularStrength = 1.0;
|
|
1751
|
+
#endif`,Iu=`#ifdef USE_SPECULARMAP
|
|
1752
|
+
uniform sampler2D specularMap;
|
|
1753
|
+
#endif`,Nu=`#if defined( TONE_MAPPING )
|
|
1754
|
+
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
1755
|
+
#endif`,Fu=`#ifndef saturate
|
|
1756
|
+
#define saturate(a) clamp( a, 0.0, 1.0 )
|
|
1757
|
+
#endif
|
|
1758
|
+
uniform float toneMappingExposure;
|
|
1759
|
+
vec3 LinearToneMapping( vec3 color ) {
|
|
1760
|
+
return toneMappingExposure * color;
|
|
1761
|
+
}
|
|
1762
|
+
vec3 ReinhardToneMapping( vec3 color ) {
|
|
1763
|
+
color *= toneMappingExposure;
|
|
1764
|
+
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
1765
|
+
}
|
|
1766
|
+
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
1767
|
+
color *= toneMappingExposure;
|
|
1768
|
+
color = max( vec3( 0.0 ), color - 0.004 );
|
|
1769
|
+
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
1770
|
+
}
|
|
1771
|
+
vec3 RRTAndODTFit( vec3 v ) {
|
|
1772
|
+
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
1773
|
+
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
1774
|
+
return a / b;
|
|
1775
|
+
}
|
|
1776
|
+
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
1777
|
+
const mat3 ACESInputMat = mat3(
|
|
1778
|
+
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
1779
|
+
vec3( 0.04823, 0.01566, 0.83777 )
|
|
1780
|
+
);
|
|
1781
|
+
const mat3 ACESOutputMat = mat3(
|
|
1782
|
+
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
1783
|
+
vec3( -0.07367, -0.00605, 1.07602 )
|
|
1784
|
+
);
|
|
1785
|
+
color *= toneMappingExposure / 0.6;
|
|
1786
|
+
color = ACESInputMat * color;
|
|
1787
|
+
color = RRTAndODTFit( color );
|
|
1788
|
+
color = ACESOutputMat * color;
|
|
1789
|
+
return saturate( color );
|
|
1790
|
+
}
|
|
1791
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Bu=`#ifdef USE_TRANSMISSIONMAP
|
|
1792
|
+
totalTransmission *= texture2D( transmissionMap, vUv ).r;
|
|
1793
|
+
#endif`,zu=`#ifdef USE_TRANSMISSIONMAP
|
|
1794
|
+
uniform sampler2D transmissionMap;
|
|
1795
|
+
#endif`,Ou=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
|
1796
|
+
varying vec2 vUv;
|
|
1797
|
+
#endif`,Uu=`#ifdef USE_UV
|
|
1798
|
+
#ifdef UVS_VERTEX_ONLY
|
|
1799
|
+
vec2 vUv;
|
|
1800
|
+
#else
|
|
1801
|
+
varying vec2 vUv;
|
|
1802
|
+
#endif
|
|
1803
|
+
uniform mat3 uvTransform;
|
|
1804
|
+
#endif`,Hu=`#ifdef USE_UV
|
|
1805
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1806
|
+
#endif`,Gu=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1807
|
+
varying vec2 vUv2;
|
|
1808
|
+
#endif`,Vu=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1809
|
+
attribute vec2 uv2;
|
|
1810
|
+
varying vec2 vUv2;
|
|
1811
|
+
uniform mat3 uv2Transform;
|
|
1812
|
+
#endif`,ku=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1813
|
+
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
|
1814
|
+
#endif`,Wu=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
|
|
1815
|
+
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
1816
|
+
#ifdef USE_INSTANCING
|
|
1817
|
+
worldPosition = instanceMatrix * worldPosition;
|
|
1818
|
+
#endif
|
|
1819
|
+
worldPosition = modelMatrix * worldPosition;
|
|
1820
|
+
#endif`,qu=`uniform sampler2D t2D;
|
|
1821
|
+
varying vec2 vUv;
|
|
1822
|
+
void main() {
|
|
1823
|
+
vec4 texColor = texture2D( t2D, vUv );
|
|
1824
|
+
gl_FragColor = mapTexelToLinear( texColor );
|
|
1825
|
+
#include <tonemapping_fragment>
|
|
1826
|
+
#include <encodings_fragment>
|
|
1827
|
+
}`,Xu=`varying vec2 vUv;
|
|
1828
|
+
uniform mat3 uvTransform;
|
|
1829
|
+
void main() {
|
|
1830
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1831
|
+
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
1832
|
+
}`,Yu=`#include <envmap_common_pars_fragment>
|
|
1833
|
+
uniform float opacity;
|
|
1834
|
+
varying vec3 vWorldDirection;
|
|
1835
|
+
#include <cube_uv_reflection_fragment>
|
|
1836
|
+
void main() {
|
|
1837
|
+
vec3 vReflect = vWorldDirection;
|
|
1838
|
+
#include <envmap_fragment>
|
|
1839
|
+
gl_FragColor = envColor;
|
|
1840
|
+
gl_FragColor.a *= opacity;
|
|
1841
|
+
#include <tonemapping_fragment>
|
|
1842
|
+
#include <encodings_fragment>
|
|
1843
|
+
}`,Zu=`varying vec3 vWorldDirection;
|
|
1844
|
+
#include <common>
|
|
1845
|
+
void main() {
|
|
1846
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1847
|
+
#include <begin_vertex>
|
|
1848
|
+
#include <project_vertex>
|
|
1849
|
+
gl_Position.z = gl_Position.w;
|
|
1850
|
+
}`,ju=`#if DEPTH_PACKING == 3200
|
|
1851
|
+
uniform float opacity;
|
|
1852
|
+
#endif
|
|
1853
|
+
#include <common>
|
|
1854
|
+
#include <packing>
|
|
1855
|
+
#include <uv_pars_fragment>
|
|
1856
|
+
#include <map_pars_fragment>
|
|
1857
|
+
#include <alphamap_pars_fragment>
|
|
1858
|
+
#include <logdepthbuf_pars_fragment>
|
|
1859
|
+
#include <clipping_planes_pars_fragment>
|
|
1860
|
+
varying vec2 vHighPrecisionZW;
|
|
1861
|
+
void main() {
|
|
1862
|
+
#include <clipping_planes_fragment>
|
|
1863
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1864
|
+
#if DEPTH_PACKING == 3200
|
|
1865
|
+
diffuseColor.a = opacity;
|
|
1866
|
+
#endif
|
|
1867
|
+
#include <map_fragment>
|
|
1868
|
+
#include <alphamap_fragment>
|
|
1869
|
+
#include <alphatest_fragment>
|
|
1870
|
+
#include <logdepthbuf_fragment>
|
|
1871
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
1872
|
+
#if DEPTH_PACKING == 3200
|
|
1873
|
+
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
1874
|
+
#elif DEPTH_PACKING == 3201
|
|
1875
|
+
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
1876
|
+
#endif
|
|
1877
|
+
}`,Ju=`#include <common>
|
|
1878
|
+
#include <uv_pars_vertex>
|
|
1879
|
+
#include <displacementmap_pars_vertex>
|
|
1880
|
+
#include <morphtarget_pars_vertex>
|
|
1881
|
+
#include <skinning_pars_vertex>
|
|
1882
|
+
#include <logdepthbuf_pars_vertex>
|
|
1883
|
+
#include <clipping_planes_pars_vertex>
|
|
1884
|
+
varying vec2 vHighPrecisionZW;
|
|
1885
|
+
void main() {
|
|
1886
|
+
#include <uv_vertex>
|
|
1887
|
+
#include <skinbase_vertex>
|
|
1888
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1889
|
+
#include <beginnormal_vertex>
|
|
1890
|
+
#include <morphnormal_vertex>
|
|
1891
|
+
#include <skinnormal_vertex>
|
|
1892
|
+
#endif
|
|
1893
|
+
#include <begin_vertex>
|
|
1894
|
+
#include <morphtarget_vertex>
|
|
1895
|
+
#include <skinning_vertex>
|
|
1896
|
+
#include <displacementmap_vertex>
|
|
1897
|
+
#include <project_vertex>
|
|
1898
|
+
#include <logdepthbuf_vertex>
|
|
1899
|
+
#include <clipping_planes_vertex>
|
|
1900
|
+
vHighPrecisionZW = gl_Position.zw;
|
|
1901
|
+
}`,Qu=`#define DISTANCE
|
|
1902
|
+
uniform vec3 referencePosition;
|
|
1903
|
+
uniform float nearDistance;
|
|
1904
|
+
uniform float farDistance;
|
|
1905
|
+
varying vec3 vWorldPosition;
|
|
1906
|
+
#include <common>
|
|
1907
|
+
#include <packing>
|
|
1908
|
+
#include <uv_pars_fragment>
|
|
1909
|
+
#include <map_pars_fragment>
|
|
1910
|
+
#include <alphamap_pars_fragment>
|
|
1911
|
+
#include <clipping_planes_pars_fragment>
|
|
1912
|
+
void main () {
|
|
1913
|
+
#include <clipping_planes_fragment>
|
|
1914
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1915
|
+
#include <map_fragment>
|
|
1916
|
+
#include <alphamap_fragment>
|
|
1917
|
+
#include <alphatest_fragment>
|
|
1918
|
+
float dist = length( vWorldPosition - referencePosition );
|
|
1919
|
+
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
1920
|
+
dist = saturate( dist );
|
|
1921
|
+
gl_FragColor = packDepthToRGBA( dist );
|
|
1922
|
+
}`,$u=`#define DISTANCE
|
|
1923
|
+
varying vec3 vWorldPosition;
|
|
1924
|
+
#include <common>
|
|
1925
|
+
#include <uv_pars_vertex>
|
|
1926
|
+
#include <displacementmap_pars_vertex>
|
|
1927
|
+
#include <morphtarget_pars_vertex>
|
|
1928
|
+
#include <skinning_pars_vertex>
|
|
1929
|
+
#include <clipping_planes_pars_vertex>
|
|
1930
|
+
void main() {
|
|
1931
|
+
#include <uv_vertex>
|
|
1932
|
+
#include <skinbase_vertex>
|
|
1933
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1934
|
+
#include <beginnormal_vertex>
|
|
1935
|
+
#include <morphnormal_vertex>
|
|
1936
|
+
#include <skinnormal_vertex>
|
|
1937
|
+
#endif
|
|
1938
|
+
#include <begin_vertex>
|
|
1939
|
+
#include <morphtarget_vertex>
|
|
1940
|
+
#include <skinning_vertex>
|
|
1941
|
+
#include <displacementmap_vertex>
|
|
1942
|
+
#include <project_vertex>
|
|
1943
|
+
#include <worldpos_vertex>
|
|
1944
|
+
#include <clipping_planes_vertex>
|
|
1945
|
+
vWorldPosition = worldPosition.xyz;
|
|
1946
|
+
}`,Ku=`uniform sampler2D tEquirect;
|
|
1947
|
+
varying vec3 vWorldDirection;
|
|
1948
|
+
#include <common>
|
|
1949
|
+
void main() {
|
|
1950
|
+
vec3 direction = normalize( vWorldDirection );
|
|
1951
|
+
vec2 sampleUV = equirectUv( direction );
|
|
1952
|
+
vec4 texColor = texture2D( tEquirect, sampleUV );
|
|
1953
|
+
gl_FragColor = mapTexelToLinear( texColor );
|
|
1954
|
+
#include <tonemapping_fragment>
|
|
1955
|
+
#include <encodings_fragment>
|
|
1956
|
+
}`,ed=`varying vec3 vWorldDirection;
|
|
1957
|
+
#include <common>
|
|
1958
|
+
void main() {
|
|
1959
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1960
|
+
#include <begin_vertex>
|
|
1961
|
+
#include <project_vertex>
|
|
1962
|
+
}`,td=`uniform vec3 diffuse;
|
|
1963
|
+
uniform float opacity;
|
|
1964
|
+
uniform float dashSize;
|
|
1965
|
+
uniform float totalSize;
|
|
1966
|
+
varying float vLineDistance;
|
|
1967
|
+
#include <common>
|
|
1968
|
+
#include <color_pars_fragment>
|
|
1969
|
+
#include <fog_pars_fragment>
|
|
1970
|
+
#include <logdepthbuf_pars_fragment>
|
|
1971
|
+
#include <clipping_planes_pars_fragment>
|
|
1972
|
+
void main() {
|
|
1973
|
+
#include <clipping_planes_fragment>
|
|
1974
|
+
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
1975
|
+
discard;
|
|
1976
|
+
}
|
|
1977
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
1978
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
1979
|
+
#include <logdepthbuf_fragment>
|
|
1980
|
+
#include <color_fragment>
|
|
1981
|
+
outgoingLight = diffuseColor.rgb;
|
|
1982
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
1983
|
+
#include <tonemapping_fragment>
|
|
1984
|
+
#include <encodings_fragment>
|
|
1985
|
+
#include <fog_fragment>
|
|
1986
|
+
#include <premultiplied_alpha_fragment>
|
|
1987
|
+
}`,nd=`uniform float scale;
|
|
1988
|
+
attribute float lineDistance;
|
|
1989
|
+
varying float vLineDistance;
|
|
1990
|
+
#include <common>
|
|
1991
|
+
#include <color_pars_vertex>
|
|
1992
|
+
#include <fog_pars_vertex>
|
|
1993
|
+
#include <morphtarget_pars_vertex>
|
|
1994
|
+
#include <logdepthbuf_pars_vertex>
|
|
1995
|
+
#include <clipping_planes_pars_vertex>
|
|
1996
|
+
void main() {
|
|
1997
|
+
vLineDistance = scale * lineDistance;
|
|
1998
|
+
#include <color_vertex>
|
|
1999
|
+
#include <begin_vertex>
|
|
2000
|
+
#include <morphtarget_vertex>
|
|
2001
|
+
#include <project_vertex>
|
|
2002
|
+
#include <logdepthbuf_vertex>
|
|
2003
|
+
#include <clipping_planes_vertex>
|
|
2004
|
+
#include <fog_vertex>
|
|
2005
|
+
}`,id=`uniform vec3 diffuse;
|
|
2006
|
+
uniform float opacity;
|
|
2007
|
+
#ifndef FLAT_SHADED
|
|
2008
|
+
varying vec3 vNormal;
|
|
2009
|
+
#endif
|
|
2010
|
+
#include <common>
|
|
2011
|
+
#include <dithering_pars_fragment>
|
|
2012
|
+
#include <color_pars_fragment>
|
|
2013
|
+
#include <uv_pars_fragment>
|
|
2014
|
+
#include <uv2_pars_fragment>
|
|
2015
|
+
#include <map_pars_fragment>
|
|
2016
|
+
#include <alphamap_pars_fragment>
|
|
2017
|
+
#include <aomap_pars_fragment>
|
|
2018
|
+
#include <lightmap_pars_fragment>
|
|
2019
|
+
#include <envmap_common_pars_fragment>
|
|
2020
|
+
#include <envmap_pars_fragment>
|
|
2021
|
+
#include <cube_uv_reflection_fragment>
|
|
2022
|
+
#include <fog_pars_fragment>
|
|
2023
|
+
#include <specularmap_pars_fragment>
|
|
2024
|
+
#include <logdepthbuf_pars_fragment>
|
|
2025
|
+
#include <clipping_planes_pars_fragment>
|
|
2026
|
+
void main() {
|
|
2027
|
+
#include <clipping_planes_fragment>
|
|
2028
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2029
|
+
#include <logdepthbuf_fragment>
|
|
2030
|
+
#include <map_fragment>
|
|
2031
|
+
#include <color_fragment>
|
|
2032
|
+
#include <alphamap_fragment>
|
|
2033
|
+
#include <alphatest_fragment>
|
|
2034
|
+
#include <specularmap_fragment>
|
|
2035
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2036
|
+
#ifdef USE_LIGHTMAP
|
|
2037
|
+
|
|
2038
|
+
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
2039
|
+
reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
2040
|
+
#else
|
|
2041
|
+
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2042
|
+
#endif
|
|
2043
|
+
#include <aomap_fragment>
|
|
2044
|
+
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2045
|
+
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2046
|
+
#include <envmap_fragment>
|
|
2047
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2048
|
+
#include <tonemapping_fragment>
|
|
2049
|
+
#include <encodings_fragment>
|
|
2050
|
+
#include <fog_fragment>
|
|
2051
|
+
#include <premultiplied_alpha_fragment>
|
|
2052
|
+
#include <dithering_fragment>
|
|
2053
|
+
}`,rd=`#include <common>
|
|
2054
|
+
#include <uv_pars_vertex>
|
|
2055
|
+
#include <uv2_pars_vertex>
|
|
2056
|
+
#include <envmap_pars_vertex>
|
|
2057
|
+
#include <color_pars_vertex>
|
|
2058
|
+
#include <fog_pars_vertex>
|
|
2059
|
+
#include <morphtarget_pars_vertex>
|
|
2060
|
+
#include <skinning_pars_vertex>
|
|
2061
|
+
#include <logdepthbuf_pars_vertex>
|
|
2062
|
+
#include <clipping_planes_pars_vertex>
|
|
2063
|
+
void main() {
|
|
2064
|
+
#include <uv_vertex>
|
|
2065
|
+
#include <uv2_vertex>
|
|
2066
|
+
#include <color_vertex>
|
|
2067
|
+
#include <skinbase_vertex>
|
|
2068
|
+
#ifdef USE_ENVMAP
|
|
2069
|
+
#include <beginnormal_vertex>
|
|
2070
|
+
#include <morphnormal_vertex>
|
|
2071
|
+
#include <skinnormal_vertex>
|
|
2072
|
+
#include <defaultnormal_vertex>
|
|
2073
|
+
#endif
|
|
2074
|
+
#include <begin_vertex>
|
|
2075
|
+
#include <morphtarget_vertex>
|
|
2076
|
+
#include <skinning_vertex>
|
|
2077
|
+
#include <project_vertex>
|
|
2078
|
+
#include <logdepthbuf_vertex>
|
|
2079
|
+
#include <worldpos_vertex>
|
|
2080
|
+
#include <clipping_planes_vertex>
|
|
2081
|
+
#include <envmap_vertex>
|
|
2082
|
+
#include <fog_vertex>
|
|
2083
|
+
}`,sd=`uniform vec3 diffuse;
|
|
2084
|
+
uniform vec3 emissive;
|
|
2085
|
+
uniform float opacity;
|
|
2086
|
+
varying vec3 vLightFront;
|
|
2087
|
+
varying vec3 vIndirectFront;
|
|
2088
|
+
#ifdef DOUBLE_SIDED
|
|
2089
|
+
varying vec3 vLightBack;
|
|
2090
|
+
varying vec3 vIndirectBack;
|
|
2091
|
+
#endif
|
|
2092
|
+
#include <common>
|
|
2093
|
+
#include <packing>
|
|
2094
|
+
#include <dithering_pars_fragment>
|
|
2095
|
+
#include <color_pars_fragment>
|
|
2096
|
+
#include <uv_pars_fragment>
|
|
2097
|
+
#include <uv2_pars_fragment>
|
|
2098
|
+
#include <map_pars_fragment>
|
|
2099
|
+
#include <alphamap_pars_fragment>
|
|
2100
|
+
#include <aomap_pars_fragment>
|
|
2101
|
+
#include <lightmap_pars_fragment>
|
|
2102
|
+
#include <emissivemap_pars_fragment>
|
|
2103
|
+
#include <envmap_common_pars_fragment>
|
|
2104
|
+
#include <envmap_pars_fragment>
|
|
2105
|
+
#include <cube_uv_reflection_fragment>
|
|
2106
|
+
#include <bsdfs>
|
|
2107
|
+
#include <lights_pars_begin>
|
|
2108
|
+
#include <fog_pars_fragment>
|
|
2109
|
+
#include <shadowmap_pars_fragment>
|
|
2110
|
+
#include <shadowmask_pars_fragment>
|
|
2111
|
+
#include <specularmap_pars_fragment>
|
|
2112
|
+
#include <logdepthbuf_pars_fragment>
|
|
2113
|
+
#include <clipping_planes_pars_fragment>
|
|
2114
|
+
void main() {
|
|
2115
|
+
#include <clipping_planes_fragment>
|
|
2116
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2117
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2118
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2119
|
+
#include <logdepthbuf_fragment>
|
|
2120
|
+
#include <map_fragment>
|
|
2121
|
+
#include <color_fragment>
|
|
2122
|
+
#include <alphamap_fragment>
|
|
2123
|
+
#include <alphatest_fragment>
|
|
2124
|
+
#include <specularmap_fragment>
|
|
2125
|
+
#include <emissivemap_fragment>
|
|
2126
|
+
#ifdef DOUBLE_SIDED
|
|
2127
|
+
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
|
2128
|
+
#else
|
|
2129
|
+
reflectedLight.indirectDiffuse += vIndirectFront;
|
|
2130
|
+
#endif
|
|
2131
|
+
#include <lightmap_fragment>
|
|
2132
|
+
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
|
|
2133
|
+
#ifdef DOUBLE_SIDED
|
|
2134
|
+
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
|
2135
|
+
#else
|
|
2136
|
+
reflectedLight.directDiffuse = vLightFront;
|
|
2137
|
+
#endif
|
|
2138
|
+
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
|
|
2139
|
+
#include <aomap_fragment>
|
|
2140
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2141
|
+
#include <envmap_fragment>
|
|
2142
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2143
|
+
#include <tonemapping_fragment>
|
|
2144
|
+
#include <encodings_fragment>
|
|
2145
|
+
#include <fog_fragment>
|
|
2146
|
+
#include <premultiplied_alpha_fragment>
|
|
2147
|
+
#include <dithering_fragment>
|
|
2148
|
+
}`,ad=`#define LAMBERT
|
|
2149
|
+
varying vec3 vLightFront;
|
|
2150
|
+
varying vec3 vIndirectFront;
|
|
2151
|
+
#ifdef DOUBLE_SIDED
|
|
2152
|
+
varying vec3 vLightBack;
|
|
2153
|
+
varying vec3 vIndirectBack;
|
|
2154
|
+
#endif
|
|
2155
|
+
#include <common>
|
|
2156
|
+
#include <uv_pars_vertex>
|
|
2157
|
+
#include <uv2_pars_vertex>
|
|
2158
|
+
#include <envmap_pars_vertex>
|
|
2159
|
+
#include <bsdfs>
|
|
2160
|
+
#include <lights_pars_begin>
|
|
2161
|
+
#include <color_pars_vertex>
|
|
2162
|
+
#include <fog_pars_vertex>
|
|
2163
|
+
#include <morphtarget_pars_vertex>
|
|
2164
|
+
#include <skinning_pars_vertex>
|
|
2165
|
+
#include <shadowmap_pars_vertex>
|
|
2166
|
+
#include <logdepthbuf_pars_vertex>
|
|
2167
|
+
#include <clipping_planes_pars_vertex>
|
|
2168
|
+
void main() {
|
|
2169
|
+
#include <uv_vertex>
|
|
2170
|
+
#include <uv2_vertex>
|
|
2171
|
+
#include <color_vertex>
|
|
2172
|
+
#include <beginnormal_vertex>
|
|
2173
|
+
#include <morphnormal_vertex>
|
|
2174
|
+
#include <skinbase_vertex>
|
|
2175
|
+
#include <skinnormal_vertex>
|
|
2176
|
+
#include <defaultnormal_vertex>
|
|
2177
|
+
#include <begin_vertex>
|
|
2178
|
+
#include <morphtarget_vertex>
|
|
2179
|
+
#include <skinning_vertex>
|
|
2180
|
+
#include <project_vertex>
|
|
2181
|
+
#include <logdepthbuf_vertex>
|
|
2182
|
+
#include <clipping_planes_vertex>
|
|
2183
|
+
#include <worldpos_vertex>
|
|
2184
|
+
#include <envmap_vertex>
|
|
2185
|
+
#include <lights_lambert_vertex>
|
|
2186
|
+
#include <shadowmap_vertex>
|
|
2187
|
+
#include <fog_vertex>
|
|
2188
|
+
}`,od=`#define MATCAP
|
|
2189
|
+
uniform vec3 diffuse;
|
|
2190
|
+
uniform float opacity;
|
|
2191
|
+
uniform sampler2D matcap;
|
|
2192
|
+
varying vec3 vViewPosition;
|
|
2193
|
+
#ifndef FLAT_SHADED
|
|
2194
|
+
varying vec3 vNormal;
|
|
2195
|
+
#endif
|
|
2196
|
+
#include <common>
|
|
2197
|
+
#include <dithering_pars_fragment>
|
|
2198
|
+
#include <color_pars_fragment>
|
|
2199
|
+
#include <uv_pars_fragment>
|
|
2200
|
+
#include <map_pars_fragment>
|
|
2201
|
+
#include <alphamap_pars_fragment>
|
|
2202
|
+
#include <fog_pars_fragment>
|
|
2203
|
+
#include <bumpmap_pars_fragment>
|
|
2204
|
+
#include <normalmap_pars_fragment>
|
|
2205
|
+
#include <logdepthbuf_pars_fragment>
|
|
2206
|
+
#include <clipping_planes_pars_fragment>
|
|
2207
|
+
void main() {
|
|
2208
|
+
#include <clipping_planes_fragment>
|
|
2209
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2210
|
+
#include <logdepthbuf_fragment>
|
|
2211
|
+
#include <map_fragment>
|
|
2212
|
+
#include <color_fragment>
|
|
2213
|
+
#include <alphamap_fragment>
|
|
2214
|
+
#include <alphatest_fragment>
|
|
2215
|
+
#include <normal_fragment_begin>
|
|
2216
|
+
#include <normal_fragment_maps>
|
|
2217
|
+
vec3 viewDir = normalize( vViewPosition );
|
|
2218
|
+
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
2219
|
+
vec3 y = cross( viewDir, x );
|
|
2220
|
+
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
2221
|
+
#ifdef USE_MATCAP
|
|
2222
|
+
vec4 matcapColor = texture2D( matcap, uv );
|
|
2223
|
+
matcapColor = matcapTexelToLinear( matcapColor );
|
|
2224
|
+
#else
|
|
2225
|
+
vec4 matcapColor = vec4( 1.0 );
|
|
2226
|
+
#endif
|
|
2227
|
+
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
2228
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2229
|
+
#include <tonemapping_fragment>
|
|
2230
|
+
#include <encodings_fragment>
|
|
2231
|
+
#include <fog_fragment>
|
|
2232
|
+
#include <premultiplied_alpha_fragment>
|
|
2233
|
+
#include <dithering_fragment>
|
|
2234
|
+
}`,ld=`#define MATCAP
|
|
2235
|
+
varying vec3 vViewPosition;
|
|
2236
|
+
#ifndef FLAT_SHADED
|
|
2237
|
+
varying vec3 vNormal;
|
|
2238
|
+
#endif
|
|
2239
|
+
#include <common>
|
|
2240
|
+
#include <uv_pars_vertex>
|
|
2241
|
+
#include <color_pars_vertex>
|
|
2242
|
+
#include <displacementmap_pars_vertex>
|
|
2243
|
+
#include <fog_pars_vertex>
|
|
2244
|
+
#include <morphtarget_pars_vertex>
|
|
2245
|
+
#include <skinning_pars_vertex>
|
|
2246
|
+
#include <logdepthbuf_pars_vertex>
|
|
2247
|
+
#include <clipping_planes_pars_vertex>
|
|
2248
|
+
void main() {
|
|
2249
|
+
#include <uv_vertex>
|
|
2250
|
+
#include <color_vertex>
|
|
2251
|
+
#include <beginnormal_vertex>
|
|
2252
|
+
#include <morphnormal_vertex>
|
|
2253
|
+
#include <skinbase_vertex>
|
|
2254
|
+
#include <skinnormal_vertex>
|
|
2255
|
+
#include <defaultnormal_vertex>
|
|
2256
|
+
#ifndef FLAT_SHADED
|
|
2257
|
+
vNormal = normalize( transformedNormal );
|
|
2258
|
+
#endif
|
|
2259
|
+
#include <begin_vertex>
|
|
2260
|
+
#include <morphtarget_vertex>
|
|
2261
|
+
#include <skinning_vertex>
|
|
2262
|
+
#include <displacementmap_vertex>
|
|
2263
|
+
#include <project_vertex>
|
|
2264
|
+
#include <logdepthbuf_vertex>
|
|
2265
|
+
#include <clipping_planes_vertex>
|
|
2266
|
+
#include <fog_vertex>
|
|
2267
|
+
vViewPosition = - mvPosition.xyz;
|
|
2268
|
+
}`,cd=`#define TOON
|
|
2269
|
+
uniform vec3 diffuse;
|
|
2270
|
+
uniform vec3 emissive;
|
|
2271
|
+
uniform float opacity;
|
|
2272
|
+
#include <common>
|
|
2273
|
+
#include <packing>
|
|
2274
|
+
#include <dithering_pars_fragment>
|
|
2275
|
+
#include <color_pars_fragment>
|
|
2276
|
+
#include <uv_pars_fragment>
|
|
2277
|
+
#include <uv2_pars_fragment>
|
|
2278
|
+
#include <map_pars_fragment>
|
|
2279
|
+
#include <alphamap_pars_fragment>
|
|
2280
|
+
#include <aomap_pars_fragment>
|
|
2281
|
+
#include <lightmap_pars_fragment>
|
|
2282
|
+
#include <emissivemap_pars_fragment>
|
|
2283
|
+
#include <gradientmap_pars_fragment>
|
|
2284
|
+
#include <fog_pars_fragment>
|
|
2285
|
+
#include <bsdfs>
|
|
2286
|
+
#include <lights_pars_begin>
|
|
2287
|
+
#include <lights_toon_pars_fragment>
|
|
2288
|
+
#include <shadowmap_pars_fragment>
|
|
2289
|
+
#include <bumpmap_pars_fragment>
|
|
2290
|
+
#include <normalmap_pars_fragment>
|
|
2291
|
+
#include <logdepthbuf_pars_fragment>
|
|
2292
|
+
#include <clipping_planes_pars_fragment>
|
|
2293
|
+
void main() {
|
|
2294
|
+
#include <clipping_planes_fragment>
|
|
2295
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2296
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2297
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2298
|
+
#include <logdepthbuf_fragment>
|
|
2299
|
+
#include <map_fragment>
|
|
2300
|
+
#include <color_fragment>
|
|
2301
|
+
#include <alphamap_fragment>
|
|
2302
|
+
#include <alphatest_fragment>
|
|
2303
|
+
#include <normal_fragment_begin>
|
|
2304
|
+
#include <normal_fragment_maps>
|
|
2305
|
+
#include <emissivemap_fragment>
|
|
2306
|
+
#include <lights_toon_fragment>
|
|
2307
|
+
#include <lights_fragment_begin>
|
|
2308
|
+
#include <lights_fragment_maps>
|
|
2309
|
+
#include <lights_fragment_end>
|
|
2310
|
+
#include <aomap_fragment>
|
|
2311
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2312
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2313
|
+
#include <tonemapping_fragment>
|
|
2314
|
+
#include <encodings_fragment>
|
|
2315
|
+
#include <fog_fragment>
|
|
2316
|
+
#include <premultiplied_alpha_fragment>
|
|
2317
|
+
#include <dithering_fragment>
|
|
2318
|
+
}`,hd=`#define TOON
|
|
2319
|
+
varying vec3 vViewPosition;
|
|
2320
|
+
#ifndef FLAT_SHADED
|
|
2321
|
+
varying vec3 vNormal;
|
|
2322
|
+
#endif
|
|
2323
|
+
#include <common>
|
|
2324
|
+
#include <uv_pars_vertex>
|
|
2325
|
+
#include <uv2_pars_vertex>
|
|
2326
|
+
#include <displacementmap_pars_vertex>
|
|
2327
|
+
#include <color_pars_vertex>
|
|
2328
|
+
#include <fog_pars_vertex>
|
|
2329
|
+
#include <morphtarget_pars_vertex>
|
|
2330
|
+
#include <skinning_pars_vertex>
|
|
2331
|
+
#include <shadowmap_pars_vertex>
|
|
2332
|
+
#include <logdepthbuf_pars_vertex>
|
|
2333
|
+
#include <clipping_planes_pars_vertex>
|
|
2334
|
+
void main() {
|
|
2335
|
+
#include <uv_vertex>
|
|
2336
|
+
#include <uv2_vertex>
|
|
2337
|
+
#include <color_vertex>
|
|
2338
|
+
#include <beginnormal_vertex>
|
|
2339
|
+
#include <morphnormal_vertex>
|
|
2340
|
+
#include <skinbase_vertex>
|
|
2341
|
+
#include <skinnormal_vertex>
|
|
2342
|
+
#include <defaultnormal_vertex>
|
|
2343
|
+
#ifndef FLAT_SHADED
|
|
2344
|
+
vNormal = normalize( transformedNormal );
|
|
2345
|
+
#endif
|
|
2346
|
+
#include <begin_vertex>
|
|
2347
|
+
#include <morphtarget_vertex>
|
|
2348
|
+
#include <skinning_vertex>
|
|
2349
|
+
#include <displacementmap_vertex>
|
|
2350
|
+
#include <project_vertex>
|
|
2351
|
+
#include <logdepthbuf_vertex>
|
|
2352
|
+
#include <clipping_planes_vertex>
|
|
2353
|
+
vViewPosition = - mvPosition.xyz;
|
|
2354
|
+
#include <worldpos_vertex>
|
|
2355
|
+
#include <shadowmap_vertex>
|
|
2356
|
+
#include <fog_vertex>
|
|
2357
|
+
}`,ud=`#define PHONG
|
|
2358
|
+
uniform vec3 diffuse;
|
|
2359
|
+
uniform vec3 emissive;
|
|
2360
|
+
uniform vec3 specular;
|
|
2361
|
+
uniform float shininess;
|
|
2362
|
+
uniform float opacity;
|
|
2363
|
+
#include <common>
|
|
2364
|
+
#include <packing>
|
|
2365
|
+
#include <dithering_pars_fragment>
|
|
2366
|
+
#include <color_pars_fragment>
|
|
2367
|
+
#include <uv_pars_fragment>
|
|
2368
|
+
#include <uv2_pars_fragment>
|
|
2369
|
+
#include <map_pars_fragment>
|
|
2370
|
+
#include <alphamap_pars_fragment>
|
|
2371
|
+
#include <aomap_pars_fragment>
|
|
2372
|
+
#include <lightmap_pars_fragment>
|
|
2373
|
+
#include <emissivemap_pars_fragment>
|
|
2374
|
+
#include <envmap_common_pars_fragment>
|
|
2375
|
+
#include <envmap_pars_fragment>
|
|
2376
|
+
#include <cube_uv_reflection_fragment>
|
|
2377
|
+
#include <fog_pars_fragment>
|
|
2378
|
+
#include <bsdfs>
|
|
2379
|
+
#include <lights_pars_begin>
|
|
2380
|
+
#include <lights_phong_pars_fragment>
|
|
2381
|
+
#include <shadowmap_pars_fragment>
|
|
2382
|
+
#include <bumpmap_pars_fragment>
|
|
2383
|
+
#include <normalmap_pars_fragment>
|
|
2384
|
+
#include <specularmap_pars_fragment>
|
|
2385
|
+
#include <logdepthbuf_pars_fragment>
|
|
2386
|
+
#include <clipping_planes_pars_fragment>
|
|
2387
|
+
void main() {
|
|
2388
|
+
#include <clipping_planes_fragment>
|
|
2389
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2390
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2391
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2392
|
+
#include <logdepthbuf_fragment>
|
|
2393
|
+
#include <map_fragment>
|
|
2394
|
+
#include <color_fragment>
|
|
2395
|
+
#include <alphamap_fragment>
|
|
2396
|
+
#include <alphatest_fragment>
|
|
2397
|
+
#include <specularmap_fragment>
|
|
2398
|
+
#include <normal_fragment_begin>
|
|
2399
|
+
#include <normal_fragment_maps>
|
|
2400
|
+
#include <emissivemap_fragment>
|
|
2401
|
+
#include <lights_phong_fragment>
|
|
2402
|
+
#include <lights_fragment_begin>
|
|
2403
|
+
#include <lights_fragment_maps>
|
|
2404
|
+
#include <lights_fragment_end>
|
|
2405
|
+
#include <aomap_fragment>
|
|
2406
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2407
|
+
#include <envmap_fragment>
|
|
2408
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2409
|
+
#include <tonemapping_fragment>
|
|
2410
|
+
#include <encodings_fragment>
|
|
2411
|
+
#include <fog_fragment>
|
|
2412
|
+
#include <premultiplied_alpha_fragment>
|
|
2413
|
+
#include <dithering_fragment>
|
|
2414
|
+
}`,dd=`#define PHONG
|
|
2415
|
+
varying vec3 vViewPosition;
|
|
2416
|
+
#ifndef FLAT_SHADED
|
|
2417
|
+
varying vec3 vNormal;
|
|
2418
|
+
#endif
|
|
2419
|
+
#include <common>
|
|
2420
|
+
#include <uv_pars_vertex>
|
|
2421
|
+
#include <uv2_pars_vertex>
|
|
2422
|
+
#include <displacementmap_pars_vertex>
|
|
2423
|
+
#include <envmap_pars_vertex>
|
|
2424
|
+
#include <color_pars_vertex>
|
|
2425
|
+
#include <fog_pars_vertex>
|
|
2426
|
+
#include <morphtarget_pars_vertex>
|
|
2427
|
+
#include <skinning_pars_vertex>
|
|
2428
|
+
#include <shadowmap_pars_vertex>
|
|
2429
|
+
#include <logdepthbuf_pars_vertex>
|
|
2430
|
+
#include <clipping_planes_pars_vertex>
|
|
2431
|
+
void main() {
|
|
2432
|
+
#include <uv_vertex>
|
|
2433
|
+
#include <uv2_vertex>
|
|
2434
|
+
#include <color_vertex>
|
|
2435
|
+
#include <beginnormal_vertex>
|
|
2436
|
+
#include <morphnormal_vertex>
|
|
2437
|
+
#include <skinbase_vertex>
|
|
2438
|
+
#include <skinnormal_vertex>
|
|
2439
|
+
#include <defaultnormal_vertex>
|
|
2440
|
+
#ifndef FLAT_SHADED
|
|
2441
|
+
vNormal = normalize( transformedNormal );
|
|
2442
|
+
#endif
|
|
2443
|
+
#include <begin_vertex>
|
|
2444
|
+
#include <morphtarget_vertex>
|
|
2445
|
+
#include <skinning_vertex>
|
|
2446
|
+
#include <displacementmap_vertex>
|
|
2447
|
+
#include <project_vertex>
|
|
2448
|
+
#include <logdepthbuf_vertex>
|
|
2449
|
+
#include <clipping_planes_vertex>
|
|
2450
|
+
vViewPosition = - mvPosition.xyz;
|
|
2451
|
+
#include <worldpos_vertex>
|
|
2452
|
+
#include <envmap_vertex>
|
|
2453
|
+
#include <shadowmap_vertex>
|
|
2454
|
+
#include <fog_vertex>
|
|
2455
|
+
}`,fd=`#define STANDARD
|
|
2456
|
+
#ifdef PHYSICAL
|
|
2457
|
+
#define REFLECTIVITY
|
|
2458
|
+
#define CLEARCOAT
|
|
2459
|
+
#define TRANSMISSION
|
|
2460
|
+
#endif
|
|
2461
|
+
uniform vec3 diffuse;
|
|
2462
|
+
uniform vec3 emissive;
|
|
2463
|
+
uniform float roughness;
|
|
2464
|
+
uniform float metalness;
|
|
2465
|
+
uniform float opacity;
|
|
2466
|
+
#ifdef TRANSMISSION
|
|
2467
|
+
uniform float transmission;
|
|
2468
|
+
#endif
|
|
2469
|
+
#ifdef REFLECTIVITY
|
|
2470
|
+
uniform float reflectivity;
|
|
2471
|
+
#endif
|
|
2472
|
+
#ifdef CLEARCOAT
|
|
2473
|
+
uniform float clearcoat;
|
|
2474
|
+
uniform float clearcoatRoughness;
|
|
2475
|
+
#endif
|
|
2476
|
+
#ifdef USE_SHEEN
|
|
2477
|
+
uniform vec3 sheen;
|
|
2478
|
+
#endif
|
|
2479
|
+
varying vec3 vViewPosition;
|
|
2480
|
+
#ifndef FLAT_SHADED
|
|
2481
|
+
varying vec3 vNormal;
|
|
2482
|
+
#ifdef USE_TANGENT
|
|
2483
|
+
varying vec3 vTangent;
|
|
2484
|
+
varying vec3 vBitangent;
|
|
2485
|
+
#endif
|
|
2486
|
+
#endif
|
|
2487
|
+
#include <common>
|
|
2488
|
+
#include <packing>
|
|
2489
|
+
#include <dithering_pars_fragment>
|
|
2490
|
+
#include <color_pars_fragment>
|
|
2491
|
+
#include <uv_pars_fragment>
|
|
2492
|
+
#include <uv2_pars_fragment>
|
|
2493
|
+
#include <map_pars_fragment>
|
|
2494
|
+
#include <alphamap_pars_fragment>
|
|
2495
|
+
#include <aomap_pars_fragment>
|
|
2496
|
+
#include <lightmap_pars_fragment>
|
|
2497
|
+
#include <emissivemap_pars_fragment>
|
|
2498
|
+
#include <transmissionmap_pars_fragment>
|
|
2499
|
+
#include <bsdfs>
|
|
2500
|
+
#include <cube_uv_reflection_fragment>
|
|
2501
|
+
#include <envmap_common_pars_fragment>
|
|
2502
|
+
#include <envmap_physical_pars_fragment>
|
|
2503
|
+
#include <fog_pars_fragment>
|
|
2504
|
+
#include <lights_pars_begin>
|
|
2505
|
+
#include <lights_physical_pars_fragment>
|
|
2506
|
+
#include <shadowmap_pars_fragment>
|
|
2507
|
+
#include <bumpmap_pars_fragment>
|
|
2508
|
+
#include <normalmap_pars_fragment>
|
|
2509
|
+
#include <clearcoat_pars_fragment>
|
|
2510
|
+
#include <roughnessmap_pars_fragment>
|
|
2511
|
+
#include <metalnessmap_pars_fragment>
|
|
2512
|
+
#include <logdepthbuf_pars_fragment>
|
|
2513
|
+
#include <clipping_planes_pars_fragment>
|
|
2514
|
+
void main() {
|
|
2515
|
+
#include <clipping_planes_fragment>
|
|
2516
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2517
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2518
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2519
|
+
#ifdef TRANSMISSION
|
|
2520
|
+
float totalTransmission = transmission;
|
|
2521
|
+
#endif
|
|
2522
|
+
#include <logdepthbuf_fragment>
|
|
2523
|
+
#include <map_fragment>
|
|
2524
|
+
#include <color_fragment>
|
|
2525
|
+
#include <alphamap_fragment>
|
|
2526
|
+
#include <alphatest_fragment>
|
|
2527
|
+
#include <roughnessmap_fragment>
|
|
2528
|
+
#include <metalnessmap_fragment>
|
|
2529
|
+
#include <normal_fragment_begin>
|
|
2530
|
+
#include <normal_fragment_maps>
|
|
2531
|
+
#include <clearcoat_normal_fragment_begin>
|
|
2532
|
+
#include <clearcoat_normal_fragment_maps>
|
|
2533
|
+
#include <emissivemap_fragment>
|
|
2534
|
+
#include <transmissionmap_fragment>
|
|
2535
|
+
#include <lights_physical_fragment>
|
|
2536
|
+
#include <lights_fragment_begin>
|
|
2537
|
+
#include <lights_fragment_maps>
|
|
2538
|
+
#include <lights_fragment_end>
|
|
2539
|
+
#include <aomap_fragment>
|
|
2540
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2541
|
+
#ifdef TRANSMISSION
|
|
2542
|
+
diffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );
|
|
2543
|
+
#endif
|
|
2544
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2545
|
+
#include <tonemapping_fragment>
|
|
2546
|
+
#include <encodings_fragment>
|
|
2547
|
+
#include <fog_fragment>
|
|
2548
|
+
#include <premultiplied_alpha_fragment>
|
|
2549
|
+
#include <dithering_fragment>
|
|
2550
|
+
}`,pd=`#define STANDARD
|
|
2551
|
+
varying vec3 vViewPosition;
|
|
2552
|
+
#ifndef FLAT_SHADED
|
|
2553
|
+
varying vec3 vNormal;
|
|
2554
|
+
#ifdef USE_TANGENT
|
|
2555
|
+
varying vec3 vTangent;
|
|
2556
|
+
varying vec3 vBitangent;
|
|
2557
|
+
#endif
|
|
2558
|
+
#endif
|
|
2559
|
+
#include <common>
|
|
2560
|
+
#include <uv_pars_vertex>
|
|
2561
|
+
#include <uv2_pars_vertex>
|
|
2562
|
+
#include <displacementmap_pars_vertex>
|
|
2563
|
+
#include <color_pars_vertex>
|
|
2564
|
+
#include <fog_pars_vertex>
|
|
2565
|
+
#include <morphtarget_pars_vertex>
|
|
2566
|
+
#include <skinning_pars_vertex>
|
|
2567
|
+
#include <shadowmap_pars_vertex>
|
|
2568
|
+
#include <logdepthbuf_pars_vertex>
|
|
2569
|
+
#include <clipping_planes_pars_vertex>
|
|
2570
|
+
void main() {
|
|
2571
|
+
#include <uv_vertex>
|
|
2572
|
+
#include <uv2_vertex>
|
|
2573
|
+
#include <color_vertex>
|
|
2574
|
+
#include <beginnormal_vertex>
|
|
2575
|
+
#include <morphnormal_vertex>
|
|
2576
|
+
#include <skinbase_vertex>
|
|
2577
|
+
#include <skinnormal_vertex>
|
|
2578
|
+
#include <defaultnormal_vertex>
|
|
2579
|
+
#ifndef FLAT_SHADED
|
|
2580
|
+
vNormal = normalize( transformedNormal );
|
|
2581
|
+
#ifdef USE_TANGENT
|
|
2582
|
+
vTangent = normalize( transformedTangent );
|
|
2583
|
+
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
2584
|
+
#endif
|
|
2585
|
+
#endif
|
|
2586
|
+
#include <begin_vertex>
|
|
2587
|
+
#include <morphtarget_vertex>
|
|
2588
|
+
#include <skinning_vertex>
|
|
2589
|
+
#include <displacementmap_vertex>
|
|
2590
|
+
#include <project_vertex>
|
|
2591
|
+
#include <logdepthbuf_vertex>
|
|
2592
|
+
#include <clipping_planes_vertex>
|
|
2593
|
+
vViewPosition = - mvPosition.xyz;
|
|
2594
|
+
#include <worldpos_vertex>
|
|
2595
|
+
#include <shadowmap_vertex>
|
|
2596
|
+
#include <fog_vertex>
|
|
2597
|
+
}`,md=`#define NORMAL
|
|
2598
|
+
uniform float opacity;
|
|
2599
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2600
|
+
varying vec3 vViewPosition;
|
|
2601
|
+
#endif
|
|
2602
|
+
#ifndef FLAT_SHADED
|
|
2603
|
+
varying vec3 vNormal;
|
|
2604
|
+
#ifdef USE_TANGENT
|
|
2605
|
+
varying vec3 vTangent;
|
|
2606
|
+
varying vec3 vBitangent;
|
|
2607
|
+
#endif
|
|
2608
|
+
#endif
|
|
2609
|
+
#include <packing>
|
|
2610
|
+
#include <uv_pars_fragment>
|
|
2611
|
+
#include <bumpmap_pars_fragment>
|
|
2612
|
+
#include <normalmap_pars_fragment>
|
|
2613
|
+
#include <logdepthbuf_pars_fragment>
|
|
2614
|
+
#include <clipping_planes_pars_fragment>
|
|
2615
|
+
void main() {
|
|
2616
|
+
#include <clipping_planes_fragment>
|
|
2617
|
+
#include <logdepthbuf_fragment>
|
|
2618
|
+
#include <normal_fragment_begin>
|
|
2619
|
+
#include <normal_fragment_maps>
|
|
2620
|
+
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|
2621
|
+
}`,gd=`#define NORMAL
|
|
2622
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2623
|
+
varying vec3 vViewPosition;
|
|
2624
|
+
#endif
|
|
2625
|
+
#ifndef FLAT_SHADED
|
|
2626
|
+
varying vec3 vNormal;
|
|
2627
|
+
#ifdef USE_TANGENT
|
|
2628
|
+
varying vec3 vTangent;
|
|
2629
|
+
varying vec3 vBitangent;
|
|
2630
|
+
#endif
|
|
2631
|
+
#endif
|
|
2632
|
+
#include <common>
|
|
2633
|
+
#include <uv_pars_vertex>
|
|
2634
|
+
#include <displacementmap_pars_vertex>
|
|
2635
|
+
#include <morphtarget_pars_vertex>
|
|
2636
|
+
#include <skinning_pars_vertex>
|
|
2637
|
+
#include <logdepthbuf_pars_vertex>
|
|
2638
|
+
#include <clipping_planes_pars_vertex>
|
|
2639
|
+
void main() {
|
|
2640
|
+
#include <uv_vertex>
|
|
2641
|
+
#include <beginnormal_vertex>
|
|
2642
|
+
#include <morphnormal_vertex>
|
|
2643
|
+
#include <skinbase_vertex>
|
|
2644
|
+
#include <skinnormal_vertex>
|
|
2645
|
+
#include <defaultnormal_vertex>
|
|
2646
|
+
#ifndef FLAT_SHADED
|
|
2647
|
+
vNormal = normalize( transformedNormal );
|
|
2648
|
+
#ifdef USE_TANGENT
|
|
2649
|
+
vTangent = normalize( transformedTangent );
|
|
2650
|
+
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
2651
|
+
#endif
|
|
2652
|
+
#endif
|
|
2653
|
+
#include <begin_vertex>
|
|
2654
|
+
#include <morphtarget_vertex>
|
|
2655
|
+
#include <skinning_vertex>
|
|
2656
|
+
#include <displacementmap_vertex>
|
|
2657
|
+
#include <project_vertex>
|
|
2658
|
+
#include <logdepthbuf_vertex>
|
|
2659
|
+
#include <clipping_planes_vertex>
|
|
2660
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2661
|
+
vViewPosition = - mvPosition.xyz;
|
|
2662
|
+
#endif
|
|
2663
|
+
}`,xd=`uniform vec3 diffuse;
|
|
2664
|
+
uniform float opacity;
|
|
2665
|
+
#include <common>
|
|
2666
|
+
#include <color_pars_fragment>
|
|
2667
|
+
#include <map_particle_pars_fragment>
|
|
2668
|
+
#include <fog_pars_fragment>
|
|
2669
|
+
#include <logdepthbuf_pars_fragment>
|
|
2670
|
+
#include <clipping_planes_pars_fragment>
|
|
2671
|
+
void main() {
|
|
2672
|
+
#include <clipping_planes_fragment>
|
|
2673
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2674
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2675
|
+
#include <logdepthbuf_fragment>
|
|
2676
|
+
#include <map_particle_fragment>
|
|
2677
|
+
#include <color_fragment>
|
|
2678
|
+
#include <alphatest_fragment>
|
|
2679
|
+
outgoingLight = diffuseColor.rgb;
|
|
2680
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2681
|
+
#include <tonemapping_fragment>
|
|
2682
|
+
#include <encodings_fragment>
|
|
2683
|
+
#include <fog_fragment>
|
|
2684
|
+
#include <premultiplied_alpha_fragment>
|
|
2685
|
+
}`,vd=`uniform float size;
|
|
2686
|
+
uniform float scale;
|
|
2687
|
+
#include <common>
|
|
2688
|
+
#include <color_pars_vertex>
|
|
2689
|
+
#include <fog_pars_vertex>
|
|
2690
|
+
#include <morphtarget_pars_vertex>
|
|
2691
|
+
#include <logdepthbuf_pars_vertex>
|
|
2692
|
+
#include <clipping_planes_pars_vertex>
|
|
2693
|
+
void main() {
|
|
2694
|
+
#include <color_vertex>
|
|
2695
|
+
#include <begin_vertex>
|
|
2696
|
+
#include <morphtarget_vertex>
|
|
2697
|
+
#include <project_vertex>
|
|
2698
|
+
gl_PointSize = size;
|
|
2699
|
+
#ifdef USE_SIZEATTENUATION
|
|
2700
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2701
|
+
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
2702
|
+
#endif
|
|
2703
|
+
#include <logdepthbuf_vertex>
|
|
2704
|
+
#include <clipping_planes_vertex>
|
|
2705
|
+
#include <worldpos_vertex>
|
|
2706
|
+
#include <fog_vertex>
|
|
2707
|
+
}`,_d=`uniform vec3 color;
|
|
2708
|
+
uniform float opacity;
|
|
2709
|
+
#include <common>
|
|
2710
|
+
#include <packing>
|
|
2711
|
+
#include <fog_pars_fragment>
|
|
2712
|
+
#include <bsdfs>
|
|
2713
|
+
#include <lights_pars_begin>
|
|
2714
|
+
#include <shadowmap_pars_fragment>
|
|
2715
|
+
#include <shadowmask_pars_fragment>
|
|
2716
|
+
void main() {
|
|
2717
|
+
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
2718
|
+
#include <tonemapping_fragment>
|
|
2719
|
+
#include <encodings_fragment>
|
|
2720
|
+
#include <fog_fragment>
|
|
2721
|
+
}`,yd=`#include <common>
|
|
2722
|
+
#include <fog_pars_vertex>
|
|
2723
|
+
#include <shadowmap_pars_vertex>
|
|
2724
|
+
void main() {
|
|
2725
|
+
#include <begin_vertex>
|
|
2726
|
+
#include <project_vertex>
|
|
2727
|
+
#include <worldpos_vertex>
|
|
2728
|
+
#include <beginnormal_vertex>
|
|
2729
|
+
#include <morphnormal_vertex>
|
|
2730
|
+
#include <skinbase_vertex>
|
|
2731
|
+
#include <skinnormal_vertex>
|
|
2732
|
+
#include <defaultnormal_vertex>
|
|
2733
|
+
#include <shadowmap_vertex>
|
|
2734
|
+
#include <fog_vertex>
|
|
2735
|
+
}`,Md=`uniform vec3 diffuse;
|
|
2736
|
+
uniform float opacity;
|
|
2737
|
+
#include <common>
|
|
2738
|
+
#include <uv_pars_fragment>
|
|
2739
|
+
#include <map_pars_fragment>
|
|
2740
|
+
#include <alphamap_pars_fragment>
|
|
2741
|
+
#include <fog_pars_fragment>
|
|
2742
|
+
#include <logdepthbuf_pars_fragment>
|
|
2743
|
+
#include <clipping_planes_pars_fragment>
|
|
2744
|
+
void main() {
|
|
2745
|
+
#include <clipping_planes_fragment>
|
|
2746
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2747
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2748
|
+
#include <logdepthbuf_fragment>
|
|
2749
|
+
#include <map_fragment>
|
|
2750
|
+
#include <alphamap_fragment>
|
|
2751
|
+
#include <alphatest_fragment>
|
|
2752
|
+
outgoingLight = diffuseColor.rgb;
|
|
2753
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2754
|
+
#include <tonemapping_fragment>
|
|
2755
|
+
#include <encodings_fragment>
|
|
2756
|
+
#include <fog_fragment>
|
|
2757
|
+
}`,wd=`uniform float rotation;
|
|
2758
|
+
uniform vec2 center;
|
|
2759
|
+
#include <common>
|
|
2760
|
+
#include <uv_pars_vertex>
|
|
2761
|
+
#include <fog_pars_vertex>
|
|
2762
|
+
#include <logdepthbuf_pars_vertex>
|
|
2763
|
+
#include <clipping_planes_pars_vertex>
|
|
2764
|
+
void main() {
|
|
2765
|
+
#include <uv_vertex>
|
|
2766
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2767
|
+
vec2 scale;
|
|
2768
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
2769
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
2770
|
+
#ifndef USE_SIZEATTENUATION
|
|
2771
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2772
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
2773
|
+
#endif
|
|
2774
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
2775
|
+
vec2 rotatedPosition;
|
|
2776
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
2777
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
2778
|
+
mvPosition.xy += rotatedPosition;
|
|
2779
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
2780
|
+
#include <logdepthbuf_vertex>
|
|
2781
|
+
#include <clipping_planes_vertex>
|
|
2782
|
+
#include <fog_vertex>
|
|
2783
|
+
}`;const we={alphamap_fragment:nh,alphamap_pars_fragment:ih,alphatest_fragment:rh,aomap_fragment:sh,aomap_pars_fragment:ah,begin_vertex:oh,beginnormal_vertex:lh,bsdfs:ch,bumpmap_pars_fragment:hh,clipping_planes_fragment:uh,clipping_planes_pars_fragment:dh,clipping_planes_pars_vertex:fh,clipping_planes_vertex:ph,color_fragment:mh,color_pars_fragment:gh,color_pars_vertex:xh,color_vertex:vh,common:_h,cube_uv_reflection_fragment:yh,defaultnormal_vertex:Mh,displacementmap_pars_vertex:wh,displacementmap_vertex:bh,emissivemap_fragment:Sh,emissivemap_pars_fragment:Eh,encodings_fragment:Th,encodings_pars_fragment:Ah,envmap_fragment:Lh,envmap_common_pars_fragment:Rh,envmap_pars_fragment:Ch,envmap_pars_vertex:Ph,envmap_physical_pars_fragment:Vh,envmap_vertex:Dh,fog_vertex:Ih,fog_pars_vertex:Nh,fog_fragment:Fh,fog_pars_fragment:Bh,gradientmap_pars_fragment:zh,lightmap_fragment:Oh,lightmap_pars_fragment:Uh,lights_lambert_vertex:Hh,lights_pars_begin:Gh,lights_toon_fragment:kh,lights_toon_pars_fragment:Wh,lights_phong_fragment:qh,lights_phong_pars_fragment:Xh,lights_physical_fragment:Yh,lights_physical_pars_fragment:Zh,lights_fragment_begin:jh,lights_fragment_maps:Jh,lights_fragment_end:Qh,logdepthbuf_fragment:$h,logdepthbuf_pars_fragment:Kh,logdepthbuf_pars_vertex:eu,logdepthbuf_vertex:tu,map_fragment:nu,map_pars_fragment:iu,map_particle_fragment:ru,map_particle_pars_fragment:su,metalnessmap_fragment:au,metalnessmap_pars_fragment:ou,morphnormal_vertex:lu,morphtarget_pars_vertex:cu,morphtarget_vertex:hu,normal_fragment_begin:uu,normal_fragment_maps:du,normalmap_pars_fragment:fu,clearcoat_normal_fragment_begin:pu,clearcoat_normal_fragment_maps:mu,clearcoat_pars_fragment:gu,packing:xu,premultiplied_alpha_fragment:vu,project_vertex:_u,dithering_fragment:yu,dithering_pars_fragment:Mu,roughnessmap_fragment:wu,roughnessmap_pars_fragment:bu,shadowmap_pars_fragment:Su,shadowmap_pars_vertex:Eu,shadowmap_vertex:Tu,shadowmask_pars_fragment:Au,skinbase_vertex:Lu,skinning_pars_vertex:Ru,skinning_vertex:Cu,skinnormal_vertex:Pu,specularmap_fragment:Du,specularmap_pars_fragment:Iu,tonemapping_fragment:Nu,tonemapping_pars_fragment:Fu,transmissionmap_fragment:Bu,transmissionmap_pars_fragment:zu,uv_pars_fragment:Ou,uv_pars_vertex:Uu,uv_vertex:Hu,uv2_pars_fragment:Gu,uv2_pars_vertex:Vu,uv2_vertex:ku,worldpos_vertex:Wu,background_frag:qu,background_vert:Xu,cube_frag:Yu,cube_vert:Zu,depth_frag:ju,depth_vert:Ju,distanceRGBA_frag:Qu,distanceRGBA_vert:$u,equirect_frag:Ku,equirect_vert:ed,linedashed_frag:td,linedashed_vert:nd,meshbasic_frag:id,meshbasic_vert:rd,meshlambert_frag:sd,meshlambert_vert:ad,meshmatcap_frag:od,meshmatcap_vert:ld,meshtoon_frag:cd,meshtoon_vert:hd,meshphong_frag:ud,meshphong_vert:dd,meshphysical_frag:fd,meshphysical_vert:pd,normal_frag:md,normal_vert:gd,points_frag:xd,points_vert:vd,shadow_frag:_d,shadow_vert:yd,sprite_frag:Md,sprite_vert:wd},K={common:{diffuse:{value:new ce(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ke},uv2Transform:{value:new Ke},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new X(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ce(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 ce(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ke}},sprite:{diffuse:{value:new ce(15658734)},opacity:{value:1},center:{value:new X(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ke}}},Tt={basic:{uniforms:tt([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.fog]),vertexShader:we.meshbasic_vert,fragmentShader:we.meshbasic_frag},lambert:{uniforms:tt([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.fog,K.lights,{emissive:{value:new ce(0)}}]),vertexShader:we.meshlambert_vert,fragmentShader:we.meshlambert_frag},phong:{uniforms:tt([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.fog,K.lights,{emissive:{value:new ce(0)},specular:{value:new ce(1118481)},shininess:{value:30}}]),vertexShader:we.meshphong_vert,fragmentShader:we.meshphong_frag},standard:{uniforms:tt([K.common,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.roughnessmap,K.metalnessmap,K.fog,K.lights,{emissive:{value:new ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:we.meshphysical_vert,fragmentShader:we.meshphysical_frag},toon:{uniforms:tt([K.common,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.gradientmap,K.fog,K.lights,{emissive:{value:new ce(0)}}]),vertexShader:we.meshtoon_vert,fragmentShader:we.meshtoon_frag},matcap:{uniforms:tt([K.common,K.bumpmap,K.normalmap,K.displacementmap,K.fog,{matcap:{value:null}}]),vertexShader:we.meshmatcap_vert,fragmentShader:we.meshmatcap_frag},points:{uniforms:tt([K.points,K.fog]),vertexShader:we.points_vert,fragmentShader:we.points_frag},dashed:{uniforms:tt([K.common,K.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:we.linedashed_vert,fragmentShader:we.linedashed_frag},depth:{uniforms:tt([K.common,K.displacementmap]),vertexShader:we.depth_vert,fragmentShader:we.depth_frag},normal:{uniforms:tt([K.common,K.bumpmap,K.normalmap,K.displacementmap,{opacity:{value:1}}]),vertexShader:we.normal_vert,fragmentShader:we.normal_frag},sprite:{uniforms:tt([K.sprite,K.fog]),vertexShader:we.sprite_vert,fragmentShader:we.sprite_frag},background:{uniforms:{uvTransform:{value:new Ke},t2D:{value:null}},vertexShader:we.background_vert,fragmentShader:we.background_frag},cube:{uniforms:tt([K.envmap,{opacity:{value:1}}]),vertexShader:we.cube_vert,fragmentShader:we.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:we.equirect_vert,fragmentShader:we.equirect_frag},distanceRGBA:{uniforms:tt([K.common,K.displacementmap,{referencePosition:{value:new b},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:we.distanceRGBA_vert,fragmentShader:we.distanceRGBA_frag},shadow:{uniforms:tt([K.lights,K.fog,{color:{value:new ce(0)},opacity:{value:1}}]),vertexShader:we.shadow_vert,fragmentShader:we.shadow_frag}};Tt.physical={uniforms:tt([Tt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new X(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new ce(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:we.meshphysical_vert,fragmentShader:we.meshphysical_frag};function bd(r,e,t,n,i){const s=new ce(0);let a=0,o,l,c=null,h=0,u=null;function d(m,x,v,g){let p=x.isScene===!0?x.background:null;p&&p.isTexture&&(p=e.get(p));const T=r.xr,R=T.getSession&&T.getSession();R&&R.environmentBlendMode==="additive"&&(p=null),p===null?f(s,a):p&&p.isColor&&(f(p,1),g=!0),(r.autoClear||g)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),p&&(p.isCubeTexture||p.mapping===ss)?(l===void 0&&(l=new ft(new us(1,1,1),new Zt({name:"BackgroundCubeMaterial",uniforms:Pn(Tt.cube.uniforms),vertexShader:Tt.cube.vertexShader,fragmentShader:Tt.cube.fragmentShader,side:Ze,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(E,_,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=p,l.material.uniforms.flipEnvMap.value=p.isCubeTexture&&p._needsFlipEnvMap?-1:1,(c!==p||h!==p.version||u!==r.toneMapping)&&(l.material.needsUpdate=!0,c=p,h=p.version,u=r.toneMapping),m.unshift(l,l.geometry,l.material,0,0,null)):p&&p.isTexture&&(o===void 0&&(o=new ft(new po(2,2),new Zt({name:"BackgroundMaterial",uniforms:Pn(Tt.background.uniforms),vertexShader:Tt.background.vertexShader,fragmentShader:Tt.background.fragmentShader,side:er,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=p,p.matrixAutoUpdate===!0&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),(c!==p||h!==p.version||u!==r.toneMapping)&&(o.material.needsUpdate=!0,c=p,h=p.version,u=r.toneMapping),m.unshift(o,o.geometry,o.material,0,0,null))}function f(m,x){t.buffers.color.setClear(m.r,m.g,m.b,x,i)}return{getClearColor:function(){return s},setClearColor:function(m,x=1){s.set(m),a=x,f(s,a)},getClearAlpha:function(){return a},setClearAlpha:function(m){a=m,f(s,a)},render:d}}function Sd(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,o={},l=x(null);let c=l;function h(A,P,D,L,W){let Q=!1;if(a){const Z=m(L,D,P);c!==Z&&(c=Z,d(c.object)),Q=v(L,W),Q&&g(L,W)}else{const Z=P.wireframe===!0;(c.geometry!==L.id||c.program!==D.id||c.wireframe!==Z)&&(c.geometry=L.id,c.program=D.id,c.wireframe=Z,Q=!0)}A.isInstancedMesh===!0&&(Q=!0),W!==null&&t.update(W,34963),Q&&(C(A,P,D,L),W!==null&&r.bindBuffer(34963,t.get(W).buffer))}function u(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function d(A){return n.isWebGL2?r.bindVertexArray(A):s.bindVertexArrayOES(A)}function f(A){return n.isWebGL2?r.deleteVertexArray(A):s.deleteVertexArrayOES(A)}function m(A,P,D){const L=D.wireframe===!0;let W=o[A.id];W===void 0&&(W={},o[A.id]=W);let Q=W[P.id];Q===void 0&&(Q={},W[P.id]=Q);let Z=Q[L];return Z===void 0&&(Z=x(u()),Q[L]=Z),Z}function x(A){const P=[],D=[],L=[];for(let W=0;W<i;W++)P[W]=0,D[W]=0,L[W]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:D,attributeDivisors:L,object:A,attributes:{},index:null}}function v(A,P){const D=c.attributes,L=A.attributes;let W=0;for(const Q in L){const Z=D[Q],se=L[Q];if(Z===void 0||Z.attribute!==se||Z.data!==se.data)return!0;W++}return c.attributesNum!==W||c.index!==P}function g(A,P){const D={},L=A.attributes;let W=0;for(const Q in L){const Z=L[Q],se={};se.attribute=Z,Z.data&&(se.data=Z.data),D[Q]=se,W++}c.attributes=D,c.attributesNum=W,c.index=P}function p(){const A=c.newAttributes;for(let P=0,D=A.length;P<D;P++)A[P]=0}function T(A){R(A,0)}function R(A,P){const D=c.newAttributes,L=c.enabledAttributes,W=c.attributeDivisors;D[A]=1,L[A]===0&&(r.enableVertexAttribArray(A),L[A]=1),W[A]!==P&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,P),W[A]=P)}function E(){const A=c.newAttributes,P=c.enabledAttributes;for(let D=0,L=P.length;D<L;D++)P[D]!==A[D]&&(r.disableVertexAttribArray(D),P[D]=0)}function _(A,P,D,L,W,Q){n.isWebGL2===!0&&(D===5124||D===5125)?r.vertexAttribIPointer(A,P,D,W,Q):r.vertexAttribPointer(A,P,D,L,W,Q)}function C(A,P,D,L){if(n.isWebGL2===!1&&(A.isInstancedMesh||L.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;p();const W=L.attributes,Q=D.getAttributes(),Z=P.defaultAttributeValues;for(const se in Q){const re=Q[se];if(re>=0){const ue=W[se];if(ue!==void 0){const xe=ue.normalized,U=ue.itemSize,Fe=t.get(ue);if(Fe===void 0)continue;const Se=Fe.buffer,ve=Fe.type,de=Fe.bytesPerElement;if(ue.isInterleavedBufferAttribute){const Te=ue.data,Me=Te.stride,be=ue.offset;Te&&Te.isInstancedInterleavedBuffer?(R(re,Te.meshPerAttribute),L._maxInstanceCount===void 0&&(L._maxInstanceCount=Te.meshPerAttribute*Te.count)):T(re),r.bindBuffer(34962,Se),_(re,U,ve,xe,Me*de,be*de)}else ue.isInstancedBufferAttribute?(R(re,ue.meshPerAttribute),L._maxInstanceCount===void 0&&(L._maxInstanceCount=ue.meshPerAttribute*ue.count)):T(re),r.bindBuffer(34962,Se),_(re,U,ve,xe,0,0)}else if(se==="instanceMatrix"){const xe=t.get(A.instanceMatrix);if(xe===void 0)continue;const U=xe.buffer,Fe=xe.type;R(re+0,1),R(re+1,1),R(re+2,1),R(re+3,1),r.bindBuffer(34962,U),r.vertexAttribPointer(re+0,4,Fe,!1,64,0),r.vertexAttribPointer(re+1,4,Fe,!1,64,16),r.vertexAttribPointer(re+2,4,Fe,!1,64,32),r.vertexAttribPointer(re+3,4,Fe,!1,64,48)}else if(se==="instanceColor"){const xe=t.get(A.instanceColor);if(xe===void 0)continue;const U=xe.buffer,Fe=xe.type;R(re,1),r.bindBuffer(34962,U),r.vertexAttribPointer(re,3,Fe,!1,12,0)}else if(Z!==void 0){const xe=Z[se];if(xe!==void 0)switch(xe.length){case 2:r.vertexAttrib2fv(re,xe);break;case 3:r.vertexAttrib3fv(re,xe);break;case 4:r.vertexAttrib4fv(re,xe);break;default:r.vertexAttrib1fv(re,xe)}}}}E()}function N(){q();for(const A in o){const P=o[A];for(const D in P){const L=P[D];for(const W in L)f(L[W].object),delete L[W];delete P[D]}delete o[A]}}function B(A){if(o[A.id]===void 0)return;const P=o[A.id];for(const D in P){const L=P[D];for(const W in L)f(L[W].object),delete L[W];delete P[D]}delete o[A.id]}function G(A){for(const P in o){const D=o[P];if(D[A.id]===void 0)continue;const L=D[A.id];for(const W in L)f(L[W].object),delete L[W];delete D[A.id]}}function q(){O(),c!==l&&(c=l,d(c.object))}function O(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:q,resetDefaultState:O,dispose:N,releaseStatesOfGeometry:B,releaseStatesOfProgram:G,initAttributes:p,enableAttribute:T,disableUnusedAttributes:E}}function Ed(r,e,t,n){const i=n.isWebGL2;let s;function a(c){s=c}function o(c,h){r.drawArrays(s,c,h),t.update(h,s,1)}function l(c,h,u){if(u===0)return;let d,f;if(i)d=r,f="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),f="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[f](s,c,h,u),t.update(h,s,u)}this.setMode=a,this.render=o,this.renderInstances=l}function Td(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const _=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(_){if(_==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";_="mediump"}return _==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&r instanceof WebGL2ComputeRenderingContext;let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=t.logarithmicDepthBuffer===!0,h=r.getParameter(34930),u=r.getParameter(35660),d=r.getParameter(3379),f=r.getParameter(34076),m=r.getParameter(34921),x=r.getParameter(36347),v=r.getParameter(36348),g=r.getParameter(36349),p=u>0,T=a||e.has("OES_texture_float"),R=p&&T,E=a?r.getParameter(36183):0;return{isWebGL2:a,getMaxAnisotropy:i,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:p,floatFragmentTextures:T,floatVertexTextures:R,maxSamples:E}}function Ad(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Et,o=new Ke,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d,f){const m=u.length!==0||d||n!==0||i;return i=d,t=h(u,f,0),n=u.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1,c()},this.setState=function(u,d,f){const m=u.clippingPlanes,x=u.clipIntersection,v=u.clipShadows,g=r.get(u);if(!i||m===null||m.length===0||s&&!v)s?h(null):c();else{const p=s?0:n,T=p*4;let R=g.clippingState||null;l.value=R,R=h(m,d,T,f);for(let E=0;E!==T;++E)R[E]=t[E];g.clippingState=R,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=p}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){const x=u!==null?u.length:0;let v=null;if(x!==0){if(v=l.value,m!==!0||v===null){const g=f+x*4,p=d.matrixWorldInverse;o.getNormalMatrix(p),(v===null||v.length<g)&&(v=new Float32Array(g));for(let T=0,R=f;T!==x;++T,R+=4)a.copy(u[T]).applyMatrix4(p,o),a.normal.toArray(v,R),v[R+3]=a.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,v}}function Ld(r){let e=new WeakMap;function t(a,o){return o===Hs?a.mapping=is:o===Gs&&(a.mapping=rs),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Hs||o===Gs)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=r.getRenderTarget(),h=new ho(l.height/2);return h.fromEquirectangularTexture(r,a),e.set(a,h),r.setRenderTarget(c),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}function Rd(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Cd(r,e,t,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const m in d)e.update(d[m],34962);const f=u.morphAttributes;for(const m in f){const x=f[m];for(let v=0,g=x.length;v<g;v++)e.update(x[v],34962)}}function c(u){const d=[],f=u.index,m=u.attributes.position;let x=0;if(f!==null){const p=f.array;x=f.version;for(let T=0,R=p.length;T<R;T+=3){const E=p[T+0],_=p[T+1],C=p[T+2];d.push(E,_,_,C,C,E)}}else{const p=m.array;x=m.version;for(let T=0,R=p.length/3-1;T<R;T+=3){const E=T+0,_=T+1,C=T+2;d.push(E,_,_,C,C,E)}}const v=new(co(d)>65535?lo:oo)(d,1);v.version=x;const g=s.get(u);g&&e.remove(g),s.set(u,v)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function Pd(r,e,t,n){const i=n.isWebGL2;let s;function a(d){s=d}let o,l;function c(d){o=d.type,l=d.bytesPerElement}function h(d,f){r.drawElements(s,f,o,d*l),t.update(f,s,1)}function u(d,f,m){if(m===0)return;let x,v;if(i)x=r,v="drawElementsInstanced";else if(x=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",x===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}x[v](s,f,o,d*l,m),t.update(f,s,m)}this.setMode=a,this.setIndex=c,this.render=h,this.renderInstances=u}function Dd(r){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 4:t.triangles+=o*(s/3);break;case 1:t.lines+=o*(s/2);break;case 3:t.lines+=o*(s-1);break;case 2:t.lines+=o*s;break;case 0:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Id(r,e){return r[0]-e[0]}function Nd(r,e){return Math.abs(e[1])-Math.abs(r[1])}function Fd(r){const e={},t=new Float32Array(8),n=[];for(let s=0;s<8;s++)n[s]=[s,0];function i(s,a,o,l){const c=s.morphTargetInfluences,h=c===void 0?0:c.length;let u=e[a.id];if(u===void 0){u=[];for(let v=0;v<h;v++)u[v]=[v,0];e[a.id]=u}for(let v=0;v<h;v++){const g=u[v];g[0]=v,g[1]=c[v]}u.sort(Nd);for(let v=0;v<8;v++)v<h&&u[v][1]?(n[v][0]=u[v][0],n[v][1]=u[v][1]):(n[v][0]=Number.MAX_SAFE_INTEGER,n[v][1]=0);n.sort(Id);const d=o.morphTargets&&a.morphAttributes.position,f=o.morphNormals&&a.morphAttributes.normal;let m=0;for(let v=0;v<8;v++){const g=n[v],p=g[0],T=g[1];p!==Number.MAX_SAFE_INTEGER&&T?(d&&a.getAttribute("morphTarget"+v)!==d[p]&&a.setAttribute("morphTarget"+v,d[p]),f&&a.getAttribute("morphNormal"+v)!==f[p]&&a.setAttribute("morphNormal"+v,f[p]),t[v]=T,m+=T):(d&&a.hasAttribute("morphTarget"+v)===!0&&a.deleteAttribute("morphTarget"+v),f&&a.hasAttribute("morphNormal"+v)===!0&&a.deleteAttribute("morphNormal"+v),t[v]=0)}const x=a.morphTargetsRelative?1:1-m;l.getUniforms().setValue(r,"morphTargetBaseInfluence",x),l.getUniforms().setValue(r,"morphTargetInfluences",t)}return{update:i}}function Bd(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);return i.get(u)!==c&&(e.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),u}function a(){i=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 mo extends et{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=rt,this.minFilter=rt,this.wrapR=Mt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}mo.prototype.isDataTexture2DArray=!0;class go extends et{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=rt,this.minFilter=rt,this.wrapR=Mt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}go.prototype.isDataTexture3D=!0;const xo=new et,zd=new mo,Od=new go,vo=new ir,fa=[],pa=[],ma=new Float32Array(16),ga=new Float32Array(9),xa=new Float32Array(4);function On(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=fa[i];if(s===void 0&&(s=new Float32Array(i),fa[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function at(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function nt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function _o(r,e){let t=pa[e];t===void 0&&(t=new Int32Array(e),pa[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function Ud(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function Hd(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;r.uniform2fv(this.addr,e),nt(t,e)}}function Gd(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.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)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;r.uniform3fv(this.addr,e),nt(t,e)}}function Vd(r,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)&&(r.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(at(t,e))return;r.uniform4fv(this.addr,e),nt(t,e)}}function kd(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),nt(t,e)}else{if(at(t,n))return;xa.set(n),r.uniformMatrix2fv(this.addr,!1,xa),nt(t,n)}}function Wd(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),nt(t,e)}else{if(at(t,n))return;ga.set(n),r.uniformMatrix3fv(this.addr,!1,ga),nt(t,n)}}function qd(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),nt(t,e)}else{if(at(t,n))return;ma.set(n),r.uniformMatrix4fv(this.addr,!1,ma),nt(t,n)}}function Xd(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function Yd(r,e){const t=this.cache;at(t,e)||(r.uniform2iv(this.addr,e),nt(t,e))}function Zd(r,e){const t=this.cache;at(t,e)||(r.uniform3iv(this.addr,e),nt(t,e))}function jd(r,e){const t=this.cache;at(t,e)||(r.uniform4iv(this.addr,e),nt(t,e))}function Jd(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function Qd(r,e){const t=this.cache;at(t,e)||(r.uniform2uiv(this.addr,e),nt(t,e))}function $d(r,e){const t=this.cache;at(t,e)||(r.uniform3uiv(this.addr,e),nt(t,e))}function Kd(r,e){const t=this.cache;at(t,e)||(r.uniform4uiv(this.addr,e),nt(t,e))}function ef(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||xo,i)}function tf(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Od,i)}function nf(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||vo,i)}function rf(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||zd,i)}function sf(r){switch(r){case 5126:return Ud;case 35664:return Hd;case 35665:return Gd;case 35666:return Vd;case 35674:return kd;case 35675:return Wd;case 35676:return qd;case 5124:case 35670:return Xd;case 35667:case 35671:return Yd;case 35668:case 35672:return Zd;case 35669:case 35673:return jd;case 5125:return Jd;case 36294:return Qd;case 36295:return $d;case 36296:return Kd;case 35678:case 36198:case 36298:case 36306:case 35682:return ef;case 35679:case 36299:case 36307:return tf;case 35680:case 36300:case 36308:case 36293:return nf;case 36289:case 36303:case 36311:case 36292:return rf}}function af(r,e){r.uniform1fv(this.addr,e)}function of(r,e){const t=On(e,this.size,2);r.uniform2fv(this.addr,t)}function lf(r,e){const t=On(e,this.size,3);r.uniform3fv(this.addr,t)}function cf(r,e){const t=On(e,this.size,4);r.uniform4fv(this.addr,t)}function hf(r,e){const t=On(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function uf(r,e){const t=On(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function df(r,e){const t=On(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function ff(r,e){r.uniform1iv(this.addr,e)}function pf(r,e){r.uniform2iv(this.addr,e)}function mf(r,e){r.uniform3iv(this.addr,e)}function gf(r,e){r.uniform4iv(this.addr,e)}function xf(r,e){r.uniform1uiv(this.addr,e)}function vf(r,e){r.uniform2uiv(this.addr,e)}function _f(r,e){r.uniform3uiv(this.addr,e)}function yf(r,e){r.uniform4uiv(this.addr,e)}function Mf(r,e,t){const n=e.length,i=_o(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTexture2D(e[s]||xo,i[s])}function wf(r,e,t){const n=e.length,i=_o(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTextureCube(e[s]||vo,i[s])}function bf(r){switch(r){case 5126:return af;case 35664:return of;case 35665:return lf;case 35666:return cf;case 35674:return hf;case 35675:return uf;case 35676:return df;case 5124:case 35670:return ff;case 35667:case 35671:return pf;case 35668:case 35672:return mf;case 35669:case 35673:return gf;case 5125:return xf;case 36294:return vf;case 36295:return _f;case 36296:return yf;case 35678:case 36198:case 36298:case 36306:case 35682:return Mf;case 35680:case 36300:case 36308:case 36293:return wf}}function Sf(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=sf(e.type)}function yo(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=bf(e.type)}yo.prototype.updateCache=function(r){const e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),nt(e,r)};function Mo(r){this.id=r,this.seq=[],this.map={}}Mo.prototype.setValue=function(r,e,t){const n=this.seq;for(let i=0,s=n.length;i!==s;++i){const a=n[i];a.setValue(r,e[a.id],t)}};const Or=/(\w+)(\])?(\[|\.)?/g;function va(r,e){r.seq.push(e),r.map[e.id]=e}function Ef(r,e,t){const n=r.name,i=n.length;for(Or.lastIndex=0;;){const s=Or.exec(n),a=Or.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){va(t,c===void 0?new Sf(o,r,e):new yo(o,r,e));break}else{let u=t.map[o];u===void 0&&(u=new Mo(o),va(t,u)),t=u}}}function Xt(r,e){this.seq=[],this.map={};const t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){const i=r.getActiveUniform(e,n),s=r.getUniformLocation(e,i.name);Ef(i,s,this)}}Xt.prototype.setValue=function(r,e,t,n){const i=this.map[e];i!==void 0&&i.setValue(r,t,n)};Xt.prototype.setOptional=function(r,e,t){const n=e[t];n!==void 0&&this.setValue(r,t,n)};Xt.upload=function(r,e,t,n){for(let i=0,s=e.length;i!==s;++i){const a=e[i],o=t[a.id];o.needsUpdate!==!1&&a.setValue(r,o.value,n)}};Xt.seqWithValue=function(r,e){const t=[];for(let n=0,i=r.length;n!==i;++n){const s=r[n];s.id in e&&t.push(s)}return t};function _a(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}let Tf=0;function Af(r){const e=r.split(`
|
|
2784
|
+
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
2785
|
+
`)}function wo(r){switch(r){case di:return["Linear","( value )"];case so:return["sRGB","( value )"];case Sc:return["RGBE","( value )"];case Tc:return["RGBM","( value, 7.0 )"];case Ac:return["RGBM","( value, 16.0 )"];case Lc:return["RGBD","( value, 256.0 )"];case bc:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Ec:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function ya(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=r.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+t+`
|
|
2786
|
+
`+i+Af(s)}function qn(r,e){const t=wo(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function Lf(r,e){const t=wo(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Rf(r,e){let t;switch(e){case wl:t="Linear";break;case bl:t="Reinhard";break;case Sl:t="OptimizedCineon";break;case El:t="ACESFilmic";break;case Tl:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Cf(r){return[r.extensionDerivatives||r.envMapCubeUV||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter($n).join(`
|
|
2787
|
+
`)}function Pf(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
2788
|
+
`)}function Df(r,e){const t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){const a=r.getActiveAttrib(e,i).name;t[a]=r.getAttribLocation(e,a)}return t}function $n(r){return r!==""}function Ma(r,e){return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).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/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function wa(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const If=/^[ \t]*#include +<([\w\d./]+)>/gm;function $r(r){return r.replace(If,Nf)}function Nf(r,e){const t=we[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return $r(t)}const Ff=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Bf=/#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 ba(r){return r.replace(Bf,bo).replace(Ff,zf)}function zf(r,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),bo(r,e,t,n)}function bo(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Sa(r){let e="precision "+r.precision+` float;
|
|
2789
|
+
precision `+r.precision+" int;";return r.precision==="highp"?e+=`
|
|
2790
|
+
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
|
|
2791
|
+
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
|
|
2792
|
+
#define LOW_PRECISION`),e}function Of(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Ka?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===el?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Qn&&(e="SHADOWMAP_TYPE_VSM"),e}function Uf(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case is:case rs:e="ENVMAP_TYPE_CUBE";break;case ss:case as:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Hf(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case rs:case as:e="ENVMAP_MODE_REFRACTION";break}return e}function Gf(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case nr:e="ENVMAP_BLENDING_MULTIPLY";break;case yl:e="ENVMAP_BLENDING_MIX";break;case Ml:e="ENVMAP_BLENDING_ADD";break}return e}function Vf(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Of(t),c=Uf(t),h=Hf(t),u=Gf(t),d=r.gammaFactor>0?r.gammaFactor:1,f=t.isWebGL2?"":Cf(t),m=Pf(s),x=i.createProgram();let v,g,p=t.glslVersion?"#version "+t.glslVersion+`
|
|
2793
|
+
`:"";t.isRawShaderMaterial?(v=[m].filter($n).join(`
|
|
2794
|
+
`),v.length>0&&(v+=`
|
|
2795
|
+
`),g=[f,m].filter($n).join(`
|
|
2796
|
+
`),g.length>0&&(g+=`
|
|
2797
|
+
`)):(v=[Sa(t),"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
2798
|
+
`].filter($n).join(`
|
|
2799
|
+
`),g=[f,Sa(t),"#define SHADER_NAME "+t.shaderName,m,t.alphaTest?"#define ALPHATEST "+t.alphaTest+(t.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ni?"#define TONE_MAPPING":"",t.toneMapping!==ni?we.tonemapping_pars_fragment:"",t.toneMapping!==ni?Rf("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",we.encodings_pars_fragment,t.map?qn("mapTexelToLinear",t.mapEncoding):"",t.matcap?qn("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?qn("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?qn("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.lightMap?qn("lightMapTexelToLinear",t.lightMapEncoding):"",Lf("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
2800
|
+
`].filter($n).join(`
|
|
2801
|
+
`)),a=$r(a),a=Ma(a,t),a=wa(a,t),o=$r(o),o=Ma(o,t),o=wa(o,t),a=ba(a),o=ba(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(p=`#version 300 es
|
|
2802
|
+
`,v=["#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
2803
|
+
`)+`
|
|
2804
|
+
`+v,g=["#define varying in",t.glslVersion===ea?"":"out highp vec4 pc_fragColor;",t.glslVersion===ea?"":"#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(`
|
|
2805
|
+
`)+`
|
|
2806
|
+
`+g);const T=p+v+a,R=p+g+o,E=_a(i,35633,T),_=_a(i,35632,R);if(i.attachShader(x,E),i.attachShader(x,_),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x),r.debug.checkShaderErrors){const B=i.getProgramInfoLog(x).trim(),G=i.getShaderInfoLog(E).trim(),q=i.getShaderInfoLog(_).trim();let O=!0,A=!0;if(i.getProgramParameter(x,35714)===!1){O=!1;const P=ya(i,E,"vertex"),D=ya(i,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(x,35715),"gl.getProgramInfoLog",B,P,D)}else B!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",B):(G===""||q==="")&&(A=!1);A&&(this.diagnostics={runnable:O,programLog:B,vertexShader:{log:G,prefix:v},fragmentShader:{log:q,prefix:g}})}i.deleteShader(E),i.deleteShader(_);let C;this.getUniforms=function(){return C===void 0&&(C=new Xt(i,x)),C};let N;return this.getAttributes=function(){return N===void 0&&(N=Df(i,x)),N},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.name=t.shaderName,this.id=Tf++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=E,this.fragmentShader=_,this}function kf(r,e,t,n,i,s){const a=[],o=n.isWebGL2,l=n.logarithmicDepthBuffer,c=n.floatVertexTextures,h=n.maxVertexUniforms,u=n.vertexTextures;let d=n.precision;const f={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(_){const N=_.skeleton.bones;if(c)return 1024;{const G=Math.floor((h-20)/4),q=Math.min(G,N.length);return q<N.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+N.length+" bones. This GPU supports "+q+"."),0):q}}function v(_){let C;return _&&_.isTexture?C=_.encoding:_&&_.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),C=_.texture.encoding):C=di,C}function g(_,C,N,B,G){const q=B.fog,O=_.isMeshStandardMaterial?B.environment:null,A=e.get(_.envMap||O),P=f[_.type],D=G.isSkinnedMesh?x(G):0;_.precision!==null&&(d=n.getMaxPrecision(_.precision),d!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",d,"instead."));let L,W;if(P){const se=Tt[P];L=se.vertexShader,W=se.fragmentShader}else L=_.vertexShader,W=_.fragmentShader;const Q=r.getRenderTarget();return{isWebGL2:o,shaderID:P,shaderName:_.type,vertexShader:L,fragmentShader:W,defines:_.defines,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:d,instancing:G.isInstancedMesh===!0,instancingColor:G.isInstancedMesh===!0&&G.instanceColor!==null,supportsVertexTextures:u,outputEncoding:Q!==null?v(Q.texture):r.outputEncoding,map:!!_.map,mapEncoding:v(_.map),matcap:!!_.matcap,matcapEncoding:v(_.matcap),envMap:!!A,envMapMode:A&&A.mapping,envMapEncoding:v(A),envMapCubeUV:!!A&&(A.mapping===ss||A.mapping===as),lightMap:!!_.lightMap,lightMapEncoding:v(_.lightMap),aoMap:!!_.aoMap,emissiveMap:!!_.emissiveMap,emissiveMapEncoding:v(_.emissiveMap),bumpMap:!!_.bumpMap,normalMap:!!_.normalMap,objectSpaceNormalMap:_.normalMapType===Pc,tangentSpaceNormalMap:_.normalMapType===In,clearcoatMap:!!_.clearcoatMap,clearcoatRoughnessMap:!!_.clearcoatRoughnessMap,clearcoatNormalMap:!!_.clearcoatNormalMap,displacementMap:!!_.displacementMap,roughnessMap:!!_.roughnessMap,metalnessMap:!!_.metalnessMap,specularMap:!!_.specularMap,alphaMap:!!_.alphaMap,gradientMap:!!_.gradientMap,sheen:!!_.sheen,transmissionMap:!!_.transmissionMap,combine:_.combine,vertexTangents:_.normalMap&&_.vertexTangents,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&G.geometry&&G.geometry.attributes.color&&G.geometry.attributes.color.itemSize===4,vertexUvs:!!_.map||!!_.bumpMap||!!_.normalMap||!!_.specularMap||!!_.alphaMap||!!_.emissiveMap||!!_.roughnessMap||!!_.metalnessMap||!!_.clearcoatMap||!!_.clearcoatRoughnessMap||!!_.clearcoatNormalMap||!!_.displacementMap||!!_.transmissionMap,uvsVertexOnly:!(_.map||_.bumpMap||_.normalMap||_.specularMap||_.alphaMap||_.emissiveMap||_.roughnessMap||_.metalnessMap||_.clearcoatNormalMap||_.transmissionMap)&&!!_.displacementMap,fog:!!q,useFog:_.fog,fogExp2:q&&q.isFogExp2,flatShading:!!_.flatShading,sizeAttenuation:_.sizeAttenuation,logarithmicDepthBuffer:l,skinning:_.skinning&&D>0,maxBones:D,useVertexTexture:c,morphTargets:_.morphTargets,morphNormals:_.morphNormals,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:r.shadowMap.enabled&&N.length>0,shadowMapType:r.shadowMap.type,toneMapping:_.toneMapped?r.toneMapping:ni,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:_.premultipliedAlpha,alphaTest:_.alphaTest,doubleSided:_.side===tr,flipSided:_.side===Ze,depthPacking:_.depthPacking!==void 0?_.depthPacking:!1,index0AttributeName:_.index0AttributeName,extensionDerivatives:_.extensions&&_.extensions.derivatives,extensionFragDepth:_.extensions&&_.extensions.fragDepth,extensionDrawBuffers:_.extensions&&_.extensions.drawBuffers,extensionShaderTextureLOD:_.extensions&&_.extensions.shaderTextureLOD,rendererExtensionFragDepth:o||t.has("EXT_frag_depth"),rendererExtensionDrawBuffers:o||t.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:o||t.has("EXT_shader_texture_lod"),customProgramCacheKey:_.customProgramCacheKey()}}function p(_){const C=[];if(_.shaderID?C.push(_.shaderID):(C.push(_.fragmentShader),C.push(_.vertexShader)),_.defines!==void 0)for(const N in _.defines)C.push(N),C.push(_.defines[N]);if(_.isRawShaderMaterial===!1){for(let N=0;N<m.length;N++)C.push(_[m[N]]);C.push(r.outputEncoding),C.push(r.gammaFactor)}return C.push(_.customProgramCacheKey),C.join()}function T(_){const C=f[_.type];let N;if(C){const B=Tt[C];N=$c.clone(B.uniforms)}else N=_.uniforms;return N}function R(_,C){let N;for(let B=0,G=a.length;B<G;B++){const q=a[B];if(q.cacheKey===C){N=q,++N.usedTimes;break}}return N===void 0&&(N=new Vf(r,C,_,i),a.push(N)),N}function E(_){if(--_.usedTimes===0){const C=a.indexOf(_);a[C]=a[a.length-1],a.pop(),_.destroy()}}return{getParameters:g,getProgramCacheKey:p,getUniforms:T,acquireProgram:R,releaseProgram:E,programs:a}}function Wf(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,o){r.get(s)[a]=o}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function qf(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.program!==e.program?r.program.id-e.program.id:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Xf(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Ea(r){const e=[];let t=0;const n=[],i=[],s={id:-1};function a(){t=0,n.length=0,i.length=0}function o(d,f,m,x,v,g){let p=e[t];const T=r.get(m);return p===void 0?(p={id:d.id,object:d,geometry:f,material:m,program:T.program||s,groupOrder:x,renderOrder:d.renderOrder,z:v,group:g},e[t]=p):(p.id=d.id,p.object=d,p.geometry=f,p.material=m,p.program=T.program||s,p.groupOrder=x,p.renderOrder=d.renderOrder,p.z=v,p.group=g),t++,p}function l(d,f,m,x,v,g){const p=o(d,f,m,x,v,g);(m.transparent===!0?i:n).push(p)}function c(d,f,m,x,v,g){const p=o(d,f,m,x,v,g);(m.transparent===!0?i:n).unshift(p)}function h(d,f){n.length>1&&n.sort(d||qf),i.length>1&&i.sort(f||Xf)}function u(){for(let d=t,f=e.length;d<f;d++){const m=e[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.program=null,m.group=null}}return{opaque:n,transparent:i,init:a,push:l,unshift:c,finish:u,sort:h}}function Yf(r){let e=new WeakMap;function t(i,s){let a;return e.has(i)===!1?(a=new Ea(r),e.set(i,[a])):s>=e.get(i).length?(a=new Ea(r),e.get(i).push(a)):a=e.get(i)[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}function Zf(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new b,color:new ce};break;case"SpotLight":t={position:new b,direction:new b,color:new ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new b,color:new ce,distance:0,decay:0};break;case"HemisphereLight":t={direction:new b,skyColor:new ce,groundColor:new ce};break;case"RectAreaLight":t={color:new ce,position:new b,halfWidth:new b,halfHeight:new b};break}return r[e.id]=t,t}}}function jf(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new X};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new X};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new X,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Jf=0;function Qf(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function $f(r,e){const t=new Zf,n=jf(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let h=0;h<9;h++)i.probe.push(new b);const s=new b,a=new he,o=new he;function l(h){let u=0,d=0,f=0;for(let C=0;C<9;C++)i.probe[C].set(0,0,0);let m=0,x=0,v=0,g=0,p=0,T=0,R=0,E=0;h.sort(Qf);for(let C=0,N=h.length;C<N;C++){const B=h[C],G=B.color,q=B.intensity,O=B.distance,A=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)u+=G.r*q,d+=G.g*q,f+=G.b*q;else if(B.isLightProbe)for(let P=0;P<9;P++)i.probe[P].addScaledVector(B.sh.coefficients[P],q);else if(B.isDirectionalLight){const P=t.get(B);if(P.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const D=B.shadow,L=n.get(B);L.shadowBias=D.bias,L.shadowNormalBias=D.normalBias,L.shadowRadius=D.radius,L.shadowMapSize=D.mapSize,i.directionalShadow[m]=L,i.directionalShadowMap[m]=A,i.directionalShadowMatrix[m]=B.shadow.matrix,T++}i.directional[m]=P,m++}else if(B.isSpotLight){const P=t.get(B);if(P.position.setFromMatrixPosition(B.matrixWorld),P.color.copy(G).multiplyScalar(q),P.distance=O,P.coneCos=Math.cos(B.angle),P.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),P.decay=B.decay,B.castShadow){const D=B.shadow,L=n.get(B);L.shadowBias=D.bias,L.shadowNormalBias=D.normalBias,L.shadowRadius=D.radius,L.shadowMapSize=D.mapSize,i.spotShadow[v]=L,i.spotShadowMap[v]=A,i.spotShadowMatrix[v]=B.shadow.matrix,E++}i.spot[v]=P,v++}else if(B.isRectAreaLight){const P=t.get(B);P.color.copy(G).multiplyScalar(q),P.halfWidth.set(B.width*.5,0,0),P.halfHeight.set(0,B.height*.5,0),i.rectArea[g]=P,g++}else if(B.isPointLight){const P=t.get(B);if(P.color.copy(B.color).multiplyScalar(B.intensity),P.distance=B.distance,P.decay=B.decay,B.castShadow){const D=B.shadow,L=n.get(B);L.shadowBias=D.bias,L.shadowNormalBias=D.normalBias,L.shadowRadius=D.radius,L.shadowMapSize=D.mapSize,L.shadowCameraNear=D.camera.near,L.shadowCameraFar=D.camera.far,i.pointShadow[x]=L,i.pointShadowMap[x]=A,i.pointShadowMatrix[x]=B.shadow.matrix,R++}i.point[x]=P,x++}else if(B.isHemisphereLight){const P=t.get(B);P.skyColor.copy(B.color).multiplyScalar(q),P.groundColor.copy(B.groundColor).multiplyScalar(q),i.hemi[p]=P,p++}}g>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=K.LTC_FLOAT_1,i.rectAreaLTC2=K.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=K.LTC_HALF_1,i.rectAreaLTC2=K.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=f;const _=i.hash;(_.directionalLength!==m||_.pointLength!==x||_.spotLength!==v||_.rectAreaLength!==g||_.hemiLength!==p||_.numDirectionalShadows!==T||_.numPointShadows!==R||_.numSpotShadows!==E)&&(i.directional.length=m,i.spot.length=v,i.rectArea.length=g,i.point.length=x,i.hemi.length=p,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=R,i.pointShadowMap.length=R,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=R,i.spotShadowMatrix.length=E,_.directionalLength=m,_.pointLength=x,_.spotLength=v,_.rectAreaLength=g,_.hemiLength=p,_.numDirectionalShadows=T,_.numPointShadows=R,_.numSpotShadows=E,i.version=Jf++)}function c(h,u){let d=0,f=0,m=0,x=0,v=0;const g=u.matrixWorldInverse;for(let p=0,T=h.length;p<T;p++){const R=h[p];if(R.isDirectionalLight){const E=i.directional[d];E.direction.setFromMatrixPosition(R.matrixWorld),s.setFromMatrixPosition(R.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),d++}else if(R.isSpotLight){const E=i.spot[m];E.position.setFromMatrixPosition(R.matrixWorld),E.position.applyMatrix4(g),E.direction.setFromMatrixPosition(R.matrixWorld),s.setFromMatrixPosition(R.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),m++}else if(R.isRectAreaLight){const E=i.rectArea[x];E.position.setFromMatrixPosition(R.matrixWorld),E.position.applyMatrix4(g),o.identity(),a.copy(R.matrixWorld),a.premultiply(g),o.extractRotation(a),E.halfWidth.set(R.width*.5,0,0),E.halfHeight.set(0,R.height*.5,0),E.halfWidth.applyMatrix4(o),E.halfHeight.applyMatrix4(o),x++}else if(R.isPointLight){const E=i.point[f];E.position.setFromMatrixPosition(R.matrixWorld),E.position.applyMatrix4(g),f++}else if(R.isHemisphereLight){const E=i.hemi[v];E.direction.setFromMatrixPosition(R.matrixWorld),E.direction.transformDirection(g),E.direction.normalize(),v++}}}return{setup:l,setupView:c,state:i}}function Ta(r,e){const t=new $f(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(u){n.push(u)}function o(u){i.push(u)}function l(){t.setup(n)}function c(u){t.setupView(n,u)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function Kf(r,e){let t=new WeakMap;function n(s,a=0){let o;return t.has(s)===!1?(o=new Ta(r,e),t.set(s,[o])):a>=t.get(s).length?(o=new Ta(r,e),t.get(s).push(o)):o=t.get(s)[a],o}function i(){t=new WeakMap}return{get:n,dispose:i}}class So extends Qe{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Rc,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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}}So.prototype.isMeshDepthMaterial=!0;class Eo extends Qe{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new b,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Eo.prototype.isMeshDistanceMaterial=!0;var ep=`uniform sampler2D shadow_pass;
|
|
2807
|
+
uniform vec2 resolution;
|
|
2808
|
+
uniform float radius;
|
|
2809
|
+
#include <packing>
|
|
2810
|
+
void main() {
|
|
2811
|
+
float mean = 0.0;
|
|
2812
|
+
float squared_mean = 0.0;
|
|
2813
|
+
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
|
|
2814
|
+
for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
|
|
2815
|
+
#ifdef HORIZONTAL_PASS
|
|
2816
|
+
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
|
|
2817
|
+
mean += distribution.x;
|
|
2818
|
+
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
2819
|
+
#else
|
|
2820
|
+
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
|
|
2821
|
+
mean += depth;
|
|
2822
|
+
squared_mean += depth * depth;
|
|
2823
|
+
#endif
|
|
2824
|
+
}
|
|
2825
|
+
mean = mean * HALF_SAMPLE_RATE;
|
|
2826
|
+
squared_mean = squared_mean * HALF_SAMPLE_RATE;
|
|
2827
|
+
float std_dev = sqrt( squared_mean - mean * mean );
|
|
2828
|
+
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
2829
|
+
}`,tp=`void main() {
|
|
2830
|
+
gl_Position = vec4( position, 1.0 );
|
|
2831
|
+
}`;function To(r,e,t){let n=new rr;const i=new X,s=new X,a=new Ie,o=[],l=[],c={},h=t.maxTextureSize,u={0:Ze,1:er,2:tr},d=new Zt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new X},radius:{value:4}},vertexShader:tp,fragmentShader:ep}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Oe;m.setAttribute("position",new je(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new ft(m,d),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ka,this.render=function(_,C,N){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||_.length===0)return;const B=r.getRenderTarget(),G=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),O=r.state;O.setBlending(ei),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);for(let A=0,P=_.length;A<P;A++){const D=_[A],L=D.shadow;if(L===void 0){console.warn("THREE.WebGLShadowMap:",D,"has no shadow.");continue}if(L.autoUpdate===!1&&L.needsUpdate===!1)continue;i.copy(L.mapSize);const W=L.getFrameExtents();if(i.multiply(W),s.copy(L.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/W.x),i.x=s.x*W.x,L.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/W.y),i.y=s.y*W.y,L.mapSize.y=s.y)),L.map===null&&!L.isPointLightShadow&&this.type===Qn){const Z={minFilter:dt,magFilter:dt,format:wt};L.map=new an(i.x,i.y,Z),L.map.texture.name=D.name+".shadowMap",L.mapPass=new an(i.x,i.y,Z),L.camera.updateProjectionMatrix()}if(L.map===null){const Z={minFilter:rt,magFilter:rt,format:wt};L.map=new an(i.x,i.y,Z),L.map.texture.name=D.name+".shadowMap",L.camera.updateProjectionMatrix()}r.setRenderTarget(L.map),r.clear();const Q=L.getViewportCount();for(let Z=0;Z<Q;Z++){const se=L.getViewport(Z);a.set(s.x*se.x,s.y*se.y,s.x*se.z,s.y*se.w),O.viewport(a),L.updateMatrices(D,Z),n=L.getFrustum(),E(C,N,L.camera,D,this.type)}!L.isPointLightShadow&&this.type===Qn&&g(L,N),L.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(B,G,q)};function g(_,C){const N=e.update(x);d.uniforms.shadow_pass.value=_.map.texture,d.uniforms.resolution.value=_.mapSize,d.uniforms.radius.value=_.radius,r.setRenderTarget(_.mapPass),r.clear(),r.renderBufferDirect(C,null,N,d,x,null),f.uniforms.shadow_pass.value=_.mapPass.texture,f.uniforms.resolution.value=_.mapSize,f.uniforms.radius.value=_.radius,r.setRenderTarget(_.map),r.clear(),r.renderBufferDirect(C,null,N,f,x,null)}function p(_,C,N){const B=_<<0|C<<1|N<<2;let G=o[B];return G===void 0&&(G=new So({depthPacking:Cc,morphTargets:_,skinning:C}),o[B]=G),G}function T(_,C,N){const B=_<<0|C<<1|N<<2;let G=l[B];return G===void 0&&(G=new Eo({morphTargets:_,skinning:C}),l[B]=G),G}function R(_,C,N,B,G,q,O){let A=null,P=p,D=_.customDepthMaterial;if(B.isPointLight===!0&&(P=T,D=_.customDistanceMaterial),D===void 0){let L=!1;N.morphTargets===!0&&(L=C.morphAttributes&&C.morphAttributes.position&&C.morphAttributes.position.length>0);let W=!1;_.isSkinnedMesh===!0&&(N.skinning===!0?W=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",_));const Q=_.isInstancedMesh===!0;A=P(L,W,Q)}else A=D;if(r.localClippingEnabled&&N.clipShadows===!0&&N.clippingPlanes.length!==0){const L=A.uuid,W=N.uuid;let Q=c[L];Q===void 0&&(Q={},c[L]=Q);let Z=Q[W];Z===void 0&&(Z=A.clone(),Q[W]=Z),A=Z}return A.visible=N.visible,A.wireframe=N.wireframe,O===Qn?A.side=N.shadowSide!==null?N.shadowSide:N.side:A.side=N.shadowSide!==null?N.shadowSide:u[N.side],A.clipShadows=N.clipShadows,A.clippingPlanes=N.clippingPlanes,A.clipIntersection=N.clipIntersection,A.wireframeLinewidth=N.wireframeLinewidth,A.linewidth=N.linewidth,B.isPointLight===!0&&A.isMeshDistanceMaterial===!0&&(A.referencePosition.setFromMatrixPosition(B.matrixWorld),A.nearDistance=G,A.farDistance=q),A}function E(_,C,N,B,G){if(_.visible===!1)return;if(_.layers.test(C.layers)&&(_.isMesh||_.isLine||_.isPoints)&&(_.castShadow||_.receiveShadow&&G===Qn)&&(!_.frustumCulled||n.intersectsObject(_))){_.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,_.matrixWorld);const A=e.update(_),P=_.material;if(Array.isArray(P)){const D=A.groups;for(let L=0,W=D.length;L<W;L++){const Q=D[L],Z=P[Q.materialIndex];if(Z&&Z.visible){const se=R(_,A,Z,B,N.near,N.far,G);r.renderBufferDirect(N,null,A,se,_,Q)}}}else if(P.visible){const D=R(_,A,P,B,N.near,N.far,G);r.renderBufferDirect(N,null,A,D,_,null)}}const O=_.children;for(let A=0,P=O.length;A<P;A++)E(O[A],C,N,B,G)}}function np(r,e,t){const n=t.isWebGL2;function i(){let S=!1;const j=new Ie;let $=null;const le=new Ie(0,0,0,0);return{setMask:function(k){$!==k&&!S&&(r.colorMask(k,k,k,k),$=k)},setLocked:function(k){S=k},setClear:function(k,fe,Ce,ke,$t){$t===!0&&(k*=ke,fe*=ke,Ce*=ke),j.set(k,fe,Ce,ke),le.equals(j)===!1&&(r.clearColor(k,fe,Ce,ke),le.copy(j))},reset:function(){S=!1,$=null,le.set(-1,0,0,0)}}}function s(){let S=!1,j=null,$=null,le=null;return{setTest:function(k){k?ue(2929):xe(2929)},setMask:function(k){j!==k&&!S&&(r.depthMask(k),j=k)},setFunc:function(k){if($!==k){if(k)switch(k){case fl:r.depthFunc(512);break;case pl:r.depthFunc(519);break;case ml:r.depthFunc(513);break;case Zr:r.depthFunc(515);break;case gl:r.depthFunc(514);break;case xl:r.depthFunc(518);break;case vl:r.depthFunc(516);break;case _l:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);$=k}},setLocked:function(k){S=k},setClear:function(k){le!==k&&(r.clearDepth(k),le=k)},reset:function(){S=!1,j=null,$=null,le=null}}}function a(){let S=!1,j=null,$=null,le=null,k=null,fe=null,Ce=null,ke=null,$t=null;return{setTest:function(Ge){S||(Ge?ue(2960):xe(2960))},setMask:function(Ge){j!==Ge&&!S&&(r.stencilMask(Ge),j=Ge)},setFunc:function(Ge,Ct,gt){($!==Ge||le!==Ct||k!==gt)&&(r.stencilFunc(Ge,Ct,gt),$=Ge,le=Ct,k=gt)},setOp:function(Ge,Ct,gt){(fe!==Ge||Ce!==Ct||ke!==gt)&&(r.stencilOp(Ge,Ct,gt),fe=Ge,Ce=Ct,ke=gt)},setLocked:function(Ge){S=Ge},setClear:function(Ge){$t!==Ge&&(r.clearStencil(Ge),$t=Ge)},reset:function(){S=!1,j=null,$=null,le=null,k=null,fe=null,Ce=null,ke=null,$t=null}}}const o=new i,l=new s,c=new a;let h={},u=null,d={},f=null,m=!1,x=null,v=null,g=null,p=null,T=null,R=null,E=null,_=!1,C=null,N=null,B=null,G=null,q=null;const O=r.getParameter(35661);let A=!1,P=0;const D=r.getParameter(7938);D.indexOf("WebGL")!==-1?(P=parseFloat(/^WebGL (\d)/.exec(D)[1]),A=P>=1):D.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),A=P>=2);let L=null,W={};const Q=new Ie(0,0,r.canvas.width,r.canvas.height),Z=new Ie(0,0,r.canvas.width,r.canvas.height);function se(S,j,$){const le=new Uint8Array(4),k=r.createTexture();r.bindTexture(S,k),r.texParameteri(S,10241,9728),r.texParameteri(S,10240,9728);for(let fe=0;fe<$;fe++)r.texImage2D(j+fe,0,6408,1,1,0,6408,5121,le);return k}const re={};re[3553]=se(3553,3553,1),re[34067]=se(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),ue(2929),l.setFunc(Zr),be(!1),Y(Ns),ue(2884),Te(ei);function ue(S){h[S]!==!0&&(r.enable(S),h[S]=!0)}function xe(S){h[S]!==!1&&(r.disable(S),h[S]=!1)}function U(S){S!==u&&(r.bindFramebuffer(36160,S),u=S)}function Fe(S,j){j===null&&u!==null&&(j=u),d[S]!==j&&(r.bindFramebuffer(S,j),d[S]=j,n&&(S===36009&&(d[36160]=j),S===36160&&(d[36009]=j)))}function Se(S){return f!==S?(r.useProgram(S),f=S,!0):!1}const ve={[Tn]:32774,[nl]:32778,[il]:32779};if(n)ve[Os]=32775,ve[Us]=32776;else{const S=e.get("EXT_blend_minmax");S!==null&&(ve[Os]=S.MIN_EXT,ve[Us]=S.MAX_EXT)}const de={[rl]:0,[sl]:1,[al]:768,[to]:770,[dl]:776,[hl]:774,[ll]:772,[ol]:769,[no]:771,[ul]:775,[cl]:773};function Te(S,j,$,le,k,fe,Ce,ke){if(S===ei){m===!0&&(xe(3042),m=!1);return}if(m===!1&&(ue(3042),m=!0),S!==tl){if(S!==x||ke!==_){if((v!==Tn||T!==Tn)&&(r.blendEquation(32774),v=Tn,T=Tn),ke)switch(S){case ti:r.blendFuncSeparate(1,771,1,771);break;case Fs:r.blendFunc(1,1);break;case Bs:r.blendFuncSeparate(0,0,769,771);break;case zs:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",S);break}else switch(S){case ti:r.blendFuncSeparate(770,771,1,771);break;case Fs:r.blendFunc(770,1);break;case Bs:r.blendFunc(0,769);break;case zs:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",S);break}g=null,p=null,R=null,E=null,x=S,_=ke}return}k=k||j,fe=fe||$,Ce=Ce||le,(j!==v||k!==T)&&(r.blendEquationSeparate(ve[j],ve[k]),v=j,T=k),($!==g||le!==p||fe!==R||Ce!==E)&&(r.blendFuncSeparate(de[$],de[le],de[fe],de[Ce]),g=$,p=le,R=fe,E=Ce),x=S,_=null}function Me(S,j){S.side===tr?xe(2884):ue(2884);let $=S.side===Ze;j&&($=!$),be($),S.blending===ti&&S.transparent===!1?Te(ei):Te(S.blending,S.blendEquation,S.blendSrc,S.blendDst,S.blendEquationAlpha,S.blendSrcAlpha,S.blendDstAlpha,S.premultipliedAlpha),l.setFunc(S.depthFunc),l.setTest(S.depthTest),l.setMask(S.depthWrite),o.setMask(S.colorWrite);const le=S.stencilWrite;c.setTest(le),le&&(c.setMask(S.stencilWriteMask),c.setFunc(S.stencilFunc,S.stencilRef,S.stencilFuncMask),c.setOp(S.stencilFail,S.stencilZFail,S.stencilZPass)),ee(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),S.alphaToCoverage===!0?ue(32926):xe(32926)}function be(S){C!==S&&(S?r.frontFace(2304):r.frontFace(2305),C=S)}function Y(S){S!==$o?(ue(2884),S!==N&&(S===Ns?r.cullFace(1029):S===Ko?r.cullFace(1028):r.cullFace(1032))):xe(2884),N=S}function J(S){S!==B&&(A&&r.lineWidth(S),B=S)}function ee(S,j,$){S?(ue(32823),(G!==j||q!==$)&&(r.polygonOffset(j,$),G=j,q=$)):xe(32823)}function oe(S){S?ue(3089):xe(3089)}function ne(S){S===void 0&&(S=33984+O-1),L!==S&&(r.activeTexture(S),L=S)}function w(S,j){L===null&&ne();let $=W[L];$===void 0&&($={type:void 0,texture:void 0},W[L]=$),($.type!==S||$.texture!==j)&&(r.bindTexture(S,j||re[S]),$.type=S,$.texture=j)}function M(){const S=W[L];S!==void 0&&S.type!==void 0&&(r.bindTexture(S.type,null),S.type=void 0,S.texture=void 0)}function H(){try{r.compressedTexImage2D.apply(r,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function V(){try{r.texImage2D.apply(r,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function ie(){try{r.texImage3D.apply(r,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function ae(S){Q.equals(S)===!1&&(r.scissor(S.x,S.y,S.z,S.w),Q.copy(S))}function Ae(S){Z.equals(S)===!1&&(r.viewport(S.x,S.y,S.z,S.w),Z.copy(S))}function pe(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},L=null,W={},u=null,d={},f=null,m=!1,x=null,v=null,g=null,p=null,T=null,R=null,E=null,_=!1,C=null,N=null,B=null,G=null,q=null,Q.set(0,0,r.canvas.width,r.canvas.height),Z.set(0,0,r.canvas.width,r.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:ue,disable:xe,bindFramebuffer:Fe,bindXRFramebuffer:U,useProgram:Se,setBlending:Te,setMaterial:Me,setFlipSided:be,setCullFace:Y,setLineWidth:J,setPolygonOffset:ee,setScissorTest:oe,activeTexture:ne,bindTexture:w,unbindTexture:M,compressedTexImage2D:H,texImage2D:V,texImage3D:ie,scissor:ae,viewport:Ae,reset:pe}}function ip(r,e,t,n,i,s,a){const o=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,h=i.maxTextureSize,u=i.maxSamples,d=new WeakMap;let f,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(w,M){return m?new OffscreenCanvas(w,M):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(w,M,H,V){let ie=1;if((w.width>V||w.height>V)&&(ie=V/Math.max(w.width,w.height)),ie<1||M===!0)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap){const ae=M?Fc:Math.floor,Ae=ae(ie*w.width),pe=ae(ie*w.height);f===void 0&&(f=x(Ae,pe));const S=H?x(Ae,pe):f;return S.width=Ae,S.height=pe,S.getContext("2d").drawImage(w,0,0,Ae,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+w.width+"x"+w.height+") to ("+Ae+"x"+pe+")."),S}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+w.width+"x"+w.height+")."),w;return w}function g(w){return ta(w.width)&&ta(w.height)}function p(w){return o?!1:w.wrapS!==Mt||w.wrapT!==Mt||w.minFilter!==rt&&w.minFilter!==dt}function T(w,M){return w.generateMipmaps&&M&&w.minFilter!==rt&&w.minFilter!==dt}function R(w,M,H,V){r.generateMipmap(w);const ie=n.get(M);ie.__maxMipLevel=Math.log2(Math.max(H,V))}function E(w,M,H){if(o===!1)return M;if(w!==null){if(r[w]!==void 0)return r[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let V=M;return M===6403&&(H===5126&&(V=33326),H===5131&&(V=33325),H===5121&&(V=33321)),M===6407&&(H===5126&&(V=34837),H===5131&&(V=34843),H===5121&&(V=32849)),M===6408&&(H===5126&&(V=34836),H===5131&&(V=34842),H===5121&&(V=32856)),(V===33325||V===33326||V===34842||V===34836)&&e.get("EXT_color_buffer_float"),V}function _(w){return w===rt||w===Vs||w===ks?9728:9729}function C(w){const M=w.target;M.removeEventListener("dispose",C),B(M),M.isVideoTexture&&d.delete(M),a.memory.textures--}function N(w){const M=w.target;M.removeEventListener("dispose",N),G(M),a.memory.textures--}function B(w){const M=n.get(w);M.__webglInit!==void 0&&(r.deleteTexture(M.__webglTexture),n.remove(w))}function G(w){const M=w.texture,H=n.get(w),V=n.get(M);if(w){if(V.__webglTexture!==void 0&&r.deleteTexture(V.__webglTexture),w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let ie=0;ie<6;ie++)r.deleteFramebuffer(H.__webglFramebuffer[ie]),H.__webglDepthbuffer&&r.deleteRenderbuffer(H.__webglDepthbuffer[ie]);else r.deleteFramebuffer(H.__webglFramebuffer),H.__webglDepthbuffer&&r.deleteRenderbuffer(H.__webglDepthbuffer),H.__webglMultisampledFramebuffer&&r.deleteFramebuffer(H.__webglMultisampledFramebuffer),H.__webglColorRenderbuffer&&r.deleteRenderbuffer(H.__webglColorRenderbuffer),H.__webglDepthRenderbuffer&&r.deleteRenderbuffer(H.__webglDepthRenderbuffer);n.remove(M),n.remove(w)}}let q=0;function O(){q=0}function A(){const w=q;return w>=l&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+l),q+=1,w}function P(w,M){const H=n.get(w);if(w.isVideoTexture&&Y(w),w.version>0&&H.__version!==w.version){const V=w.image;if(V===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(V.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ue(H,w,M);return}}t.activeTexture(33984+M),t.bindTexture(3553,H.__webglTexture)}function D(w,M){const H=n.get(w);if(w.version>0&&H.__version!==w.version){ue(H,w,M);return}t.activeTexture(33984+M),t.bindTexture(35866,H.__webglTexture)}function L(w,M){const H=n.get(w);if(w.version>0&&H.__version!==w.version){ue(H,w,M);return}t.activeTexture(33984+M),t.bindTexture(32879,H.__webglTexture)}function W(w,M){const H=n.get(w);if(w.version>0&&H.__version!==w.version){xe(H,w,M);return}t.activeTexture(33984+M),t.bindTexture(34067,H.__webglTexture)}const Q={[jr]:10497,[Mt]:33071,[Jr]:33648},Z={[rt]:9728,[Vs]:9984,[ks]:9986,[dt]:9729,[Al]:9985,[os]:9987};function se(w,M,H){if(H?(r.texParameteri(w,10242,Q[M.wrapS]),r.texParameteri(w,10243,Q[M.wrapT]),(w===32879||w===35866)&&r.texParameteri(w,32882,Q[M.wrapR]),r.texParameteri(w,10240,Z[M.magFilter]),r.texParameteri(w,10241,Z[M.minFilter])):(r.texParameteri(w,10242,33071),r.texParameteri(w,10243,33071),(w===32879||w===35866)&&r.texParameteri(w,32882,33071),(M.wrapS!==Mt||M.wrapT!==Mt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(w,10240,_(M.magFilter)),r.texParameteri(w,10241,_(M.minFilter)),M.minFilter!==rt&&M.minFilter!==dt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const V=e.get("EXT_texture_filter_anisotropic");if(M.type===qt&&e.has("OES_texture_float_linear")===!1||o===!1&&M.type===Yi&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||n.get(M).__currentAnisotropy)&&(r.texParameterf(w,V.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy)}}function re(w,M){w.__webglInit===void 0&&(w.__webglInit=!0,M.addEventListener("dispose",C),w.__webglTexture=r.createTexture(),a.memory.textures++)}function ue(w,M,H){let V=3553;M.isDataTexture2DArray&&(V=35866),M.isDataTexture3D&&(V=32879),re(w,M),t.activeTexture(33984+H),t.bindTexture(V,w.__webglTexture),r.pixelStorei(37440,M.flipY),r.pixelStorei(37441,M.premultiplyAlpha),r.pixelStorei(3317,M.unpackAlignment),r.pixelStorei(37443,0);const ie=p(M)&&g(M.image)===!1,ae=v(M.image,ie,!1,h),Ae=g(ae)||o,pe=s.convert(M.format);let S=s.convert(M.type),j=E(M.internalFormat,pe,S);se(V,M,Ae);let $;const le=M.mipmaps;if(M.isDepthTexture)j=6402,o?M.type===qt?j=36012:M.type===qi?j=33190:M.type===ii?j=35056:j=33189:M.type===qt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===Cn&&j===6402&&M.type!==Xi&&M.type!==qi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=Xi,S=s.convert(M.type)),M.format===ai&&j===6402&&(j=34041,M.type!==ii&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=ii,S=s.convert(M.type))),t.texImage2D(3553,0,j,ae.width,ae.height,0,pe,S,null);else if(M.isDataTexture)if(le.length>0&&Ae){for(let k=0,fe=le.length;k<fe;k++)$=le[k],t.texImage2D(3553,k,j,$.width,$.height,0,pe,S,$.data);M.generateMipmaps=!1,w.__maxMipLevel=le.length-1}else t.texImage2D(3553,0,j,ae.width,ae.height,0,pe,S,ae.data),w.__maxMipLevel=0;else if(M.isCompressedTexture){for(let k=0,fe=le.length;k<fe;k++)$=le[k],M.format!==wt&&M.format!==sn?pe!==null?t.compressedTexImage2D(3553,k,j,$.width,$.height,0,$.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,k,j,$.width,$.height,0,pe,S,$.data);w.__maxMipLevel=le.length-1}else if(M.isDataTexture2DArray)t.texImage3D(35866,0,j,ae.width,ae.height,ae.depth,0,pe,S,ae.data),w.__maxMipLevel=0;else if(M.isDataTexture3D)t.texImage3D(32879,0,j,ae.width,ae.height,ae.depth,0,pe,S,ae.data),w.__maxMipLevel=0;else if(le.length>0&&Ae){for(let k=0,fe=le.length;k<fe;k++)$=le[k],t.texImage2D(3553,k,j,pe,S,$);M.generateMipmaps=!1,w.__maxMipLevel=le.length-1}else t.texImage2D(3553,0,j,pe,S,ae),w.__maxMipLevel=0;T(M,Ae)&&R(V,M,ae.width,ae.height),w.__version=M.version,M.onUpdate&&M.onUpdate(M)}function xe(w,M,H){if(M.image.length!==6)return;re(w,M),t.activeTexture(33984+H),t.bindTexture(34067,w.__webglTexture),r.pixelStorei(37440,M.flipY),r.pixelStorei(37441,M.premultiplyAlpha),r.pixelStorei(3317,M.unpackAlignment),r.pixelStorei(37443,0);const V=M&&(M.isCompressedTexture||M.image[0].isCompressedTexture),ie=M.image[0]&&M.image[0].isDataTexture,ae=[];for(let k=0;k<6;k++)!V&&!ie?ae[k]=v(M.image[k],!1,!0,c):ae[k]=ie?M.image[k].image:M.image[k];const Ae=ae[0],pe=g(Ae)||o,S=s.convert(M.format),j=s.convert(M.type),$=E(M.internalFormat,S,j);se(34067,M,pe);let le;if(V){for(let k=0;k<6;k++){le=ae[k].mipmaps;for(let fe=0;fe<le.length;fe++){const Ce=le[fe];M.format!==wt&&M.format!==sn?S!==null?t.compressedTexImage2D(34069+k,fe,$,Ce.width,Ce.height,0,Ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+k,fe,$,Ce.width,Ce.height,0,S,j,Ce.data)}}w.__maxMipLevel=le.length-1}else{le=M.mipmaps;for(let k=0;k<6;k++)if(ie){t.texImage2D(34069+k,0,$,ae[k].width,ae[k].height,0,S,j,ae[k].data);for(let fe=0;fe<le.length;fe++){const ke=le[fe].image[k].image;t.texImage2D(34069+k,fe+1,$,ke.width,ke.height,0,S,j,ke.data)}}else{t.texImage2D(34069+k,0,$,S,j,ae[k]);for(let fe=0;fe<le.length;fe++){const Ce=le[fe];t.texImage2D(34069+k,fe+1,$,S,j,Ce.image[k])}}w.__maxMipLevel=le.length}T(M,pe)&&R(34067,M,Ae.width,Ae.height),w.__version=M.version,M.onUpdate&&M.onUpdate(M)}function U(w,M,H,V){const ie=M.texture,ae=s.convert(ie.format),Ae=s.convert(ie.type),pe=E(ie.internalFormat,ae,Ae);V===32879||V===35866?t.texImage3D(V,0,pe,M.width,M.height,M.depth,0,ae,Ae,null):t.texImage2D(V,0,pe,M.width,M.height,0,ae,Ae,null),t.bindFramebuffer(36160,w),r.framebufferTexture2D(36160,H,V,n.get(ie).__webglTexture,0),t.bindFramebuffer(36160,null)}function Fe(w,M,H){if(r.bindRenderbuffer(36161,w),M.depthBuffer&&!M.stencilBuffer){let V=33189;if(H){const ie=M.depthTexture;ie&&ie.isDepthTexture&&(ie.type===qt?V=36012:ie.type===qi&&(V=33190));const ae=be(M);r.renderbufferStorageMultisample(36161,ae,V,M.width,M.height)}else r.renderbufferStorage(36161,V,M.width,M.height);r.framebufferRenderbuffer(36160,36096,36161,w)}else if(M.depthBuffer&&M.stencilBuffer){if(H){const V=be(M);r.renderbufferStorageMultisample(36161,V,35056,M.width,M.height)}else r.renderbufferStorage(36161,34041,M.width,M.height);r.framebufferRenderbuffer(36160,33306,36161,w)}else{const V=M.texture,ie=s.convert(V.format),ae=s.convert(V.type),Ae=E(V.internalFormat,ie,ae);if(H){const pe=be(M);r.renderbufferStorageMultisample(36161,pe,Ae,M.width,M.height)}else r.renderbufferStorage(36161,Ae,M.width,M.height)}r.bindRenderbuffer(36161,null)}function Se(w,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,w),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(M.depthTexture).__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),P(M.depthTexture,0);const V=n.get(M.depthTexture).__webglTexture;if(M.depthTexture.format===Cn)r.framebufferTexture2D(36160,36096,3553,V,0);else if(M.depthTexture.format===ai)r.framebufferTexture2D(36160,33306,3553,V,0);else throw new Error("Unknown depthTexture format")}function ve(w){const M=n.get(w),H=w.isWebGLCubeRenderTarget===!0;if(w.depthTexture){if(H)throw new Error("target.depthTexture not supported in Cube render targets");Se(M.__webglFramebuffer,w)}else if(H){M.__webglDepthbuffer=[];for(let V=0;V<6;V++)t.bindFramebuffer(36160,M.__webglFramebuffer[V]),M.__webglDepthbuffer[V]=r.createRenderbuffer(),Fe(M.__webglDepthbuffer[V],w,!1)}else t.bindFramebuffer(36160,M.__webglFramebuffer),M.__webglDepthbuffer=r.createRenderbuffer(),Fe(M.__webglDepthbuffer,w,!1);t.bindFramebuffer(36160,null)}function de(w){const M=w.texture,H=n.get(w),V=n.get(M);w.addEventListener("dispose",N),V.__webglTexture=r.createTexture(),V.__version=M.version,a.memory.textures++;const ie=w.isWebGLCubeRenderTarget===!0,ae=w.isWebGLMultisampleRenderTarget===!0,Ae=M.isDataTexture3D||M.isDataTexture2DArray,pe=g(w)||o;if(o&&M.format===sn&&(M.type===qt||M.type===Yi)&&(M.format=wt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ie){H.__webglFramebuffer=[];for(let S=0;S<6;S++)H.__webglFramebuffer[S]=r.createFramebuffer()}else if(H.__webglFramebuffer=r.createFramebuffer(),ae)if(o){H.__webglMultisampledFramebuffer=r.createFramebuffer(),H.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,H.__webglColorRenderbuffer);const S=s.convert(M.format),j=s.convert(M.type),$=E(M.internalFormat,S,j),le=be(w);r.renderbufferStorageMultisample(36161,le,$,w.width,w.height),t.bindFramebuffer(36160,H.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,H.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),w.depthBuffer&&(H.__webglDepthRenderbuffer=r.createRenderbuffer(),Fe(H.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ie){t.bindTexture(34067,V.__webglTexture),se(34067,M,pe);for(let S=0;S<6;S++)U(H.__webglFramebuffer[S],w,36064,34069+S);T(M,pe)&&R(34067,M,w.width,w.height),t.bindTexture(34067,null)}else{let S=3553;Ae&&(o?S=M.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(S,V.__webglTexture),se(S,M,pe),U(H.__webglFramebuffer,w,36064,S),T(M,pe)&&R(3553,M,w.width,w.height),t.bindTexture(3553,null)}w.depthBuffer&&ve(w)}function Te(w){const M=w.texture,H=g(w)||o;if(T(M,H)){const V=w.isWebGLCubeRenderTarget?34067:3553,ie=n.get(M).__webglTexture;t.bindTexture(V,ie),R(V,M,w.width,w.height),t.bindTexture(V,null)}}function Me(w){if(w.isWebGLMultisampleRenderTarget)if(o){const M=w.width,H=w.height;let V=16384;w.depthBuffer&&(V|=256),w.stencilBuffer&&(V|=1024);const ie=n.get(w);t.bindFramebuffer(36008,ie.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ie.__webglFramebuffer),r.blitFramebuffer(0,0,M,H,0,0,M,H,V,9728),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,ie.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function be(w){return o&&w.isWebGLMultisampleRenderTarget?Math.min(u,w.samples):0}function Y(w){const M=a.render.frame;d.get(w)!==M&&(d.set(w,M),w.update())}let J=!1,ee=!1;function oe(w,M){w&&w.isWebGLRenderTarget&&(J===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),J=!0),w=w.texture),P(w,M)}function ne(w,M){w&&w.isWebGLCubeRenderTarget&&(ee===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),ee=!0),w=w.texture),W(w,M)}this.allocateTextureUnit=A,this.resetTextureUnits=O,this.setTexture2D=P,this.setTexture2DArray=D,this.setTexture3D=L,this.setTextureCube=W,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Te,this.updateMultisampleRenderTarget=Me,this.safeSetTexture2D=oe,this.safeSetTextureCube=ne}function rp(r,e,t){const n=t.isWebGL2;function i(s){let a;if(s===ls)return 5121;if(s===Pl)return 32819;if(s===Dl)return 32820;if(s===Il)return 33635;if(s===Ll)return 5120;if(s===Rl)return 5122;if(s===Xi)return 5123;if(s===Cl)return 5124;if(s===qi)return 5125;if(s===qt)return 5126;if(s===Yi)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Nl)return 6406;if(s===sn)return 6407;if(s===wt)return 6408;if(s===Fl)return 6409;if(s===Bl)return 6410;if(s===Cn)return 6402;if(s===ai)return 34041;if(s===zl)return 6403;if(s===Ol)return 36244;if(s===Ul)return 33319;if(s===Hl)return 33320;if(s===Gl)return 36248;if(s===Vl)return 36249;if(s===Ws||s===qs||s===Xs||s===Ys)if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ws)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===qs)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Xs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ys)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Zs||s===js||s===Js||s===Qs)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Zs)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===js)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Js)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Qs)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===kl)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===$s||s===Ks)&&(a=e.get("WEBGL_compressed_texture_etc"),a!==null)){if(s===$s)return a.COMPRESSED_RGB8_ETC2;if(s===Ks)return a.COMPRESSED_RGBA8_ETC2_EAC}if(s===Wl||s===ql||s===Xl||s===Yl||s===Zl||s===jl||s===Jl||s===Ql||s===$l||s===Kl||s===ec||s===tc||s===nc||s===ic||s===sc||s===ac||s===oc||s===lc||s===cc||s===hc||s===uc||s===dc||s===fc||s===pc||s===mc||s===gc||s===xc||s===vc)return a=e.get("WEBGL_compressed_texture_astc"),a!==null?s:null;if(s===rc)return a=e.get("EXT_texture_compression_bptc"),a!==null?s:null;if(s===ii)return n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class Ao extends ut{constructor(e=[]){super(),this.cameras=e}}Ao.prototype.isArrayCamera=!0;class Kn extends Re{constructor(){super(),this.type="Group"}}Kn.prototype.isGroup=!0;const sp={type:"move"};class Ur{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Kn,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 Kn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new b,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new b),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Kn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new b,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new b),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}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 i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(o!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(sp))),c&&e.hand){a=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,n);if(c.joints[x.jointName]===void 0){const p=new Kn;p.matrixAutoUpdate=!1,p.visible=!1,c.joints[x.jointName]=p,c.add(p)}const g=c.joints[x.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),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));return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}}class ap extends on{constructor(e,t){super();const n=this,i=e.state;let s=null,a=1,o=null,l="local-floor",c=null;const h=[],u=new Map,d=new ut;d.layers.enable(1),d.viewport=new Ie;const f=new ut;f.layers.enable(2),f.viewport=new Ie;const m=[d,f],x=new Ao;x.layers.enable(1),x.layers.enable(2);let v=null,g=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let A=h[O];return A===void 0&&(A=new Ur,h[O]=A),A.getTargetRaySpace()},this.getControllerGrip=function(O){let A=h[O];return A===void 0&&(A=new Ur,h[O]=A),A.getGripSpace()},this.getHand=function(O){let A=h[O];return A===void 0&&(A=new Ur,h[O]=A),A.getHandSpace()};function p(O){const A=u.get(O.inputSource);A&&A.dispatchEvent({type:O.type,data:O.inputSource})}function T(){u.forEach(function(O,A){O.disconnect(A)}),u.clear(),v=null,g=null,i.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),q.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){a=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){l=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return s},this.setSession=async function(O){if(s=O,s!==null){s.addEventListener("select",p),s.addEventListener("selectstart",p),s.addEventListener("selectend",p),s.addEventListener("squeeze",p),s.addEventListener("squeezestart",p),s.addEventListener("squeezeend",p),s.addEventListener("end",T),s.addEventListener("inputsourceschange",R);const A=t.getContextAttributes();A.xrCompatible!==!0&&await t.makeXRCompatible();const P={antialias:A.antialias,alpha:A.alpha,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:a},D=new XRWebGLLayer(s,t,P);s.updateRenderState({baseLayer:D}),o=await s.requestReferenceSpace(l),q.setContext(s),q.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function R(O){const A=s.inputSources;for(let P=0;P<h.length;P++)u.set(A[P],h[P]);for(let P=0;P<O.removed.length;P++){const D=O.removed[P],L=u.get(D);L&&(L.dispatchEvent({type:"disconnected",data:D}),u.delete(D))}for(let P=0;P<O.added.length;P++){const D=O.added[P],L=u.get(D);L&&L.dispatchEvent({type:"connected",data:D})}}const E=new b,_=new b;function C(O,A,P){E.setFromMatrixPosition(A.matrixWorld),_.setFromMatrixPosition(P.matrixWorld);const D=E.distanceTo(_),L=A.projectionMatrix.elements,W=P.projectionMatrix.elements,Q=L[14]/(L[10]-1),Z=L[14]/(L[10]+1),se=(L[9]+1)/L[5],re=(L[9]-1)/L[5],ue=(L[8]-1)/L[0],xe=(W[8]+1)/W[0],U=Q*ue,Fe=Q*xe,Se=D/(-ue+xe),ve=Se*-ue;A.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(ve),O.translateZ(Se),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const de=Q+Se,Te=Z+Se,Me=U-ve,be=Fe+(D-ve),Y=se*Z/Te*de,J=re*Z/Te*de;O.projectionMatrix.makePerspective(Me,be,Y,J,de,Te)}function N(O,A){A===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(A.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.getCamera=function(O){x.near=f.near=d.near=O.near,x.far=f.far=d.far=O.far,(v!==x.near||g!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),v=x.near,g=x.far);const A=O.parent,P=x.cameras;N(x,A);for(let L=0;L<P.length;L++)N(P[L],A);O.matrixWorld.copy(x.matrixWorld),O.matrix.copy(x.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale);const D=O.children;for(let L=0,W=D.length;L<W;L++)D[L].updateMatrixWorld(!0);return P.length===2?C(x,d,f):x.projectionMatrix.copy(d.projectionMatrix),x};let B=null;function G(O,A){if(c=A.getViewerPose(o),c!==null){const D=c.views,L=s.renderState.baseLayer;i.bindXRFramebuffer(L.framebuffer);let W=!1;D.length!==x.cameras.length&&(x.cameras.length=0,W=!0);for(let Q=0;Q<D.length;Q++){const Z=D[Q],se=L.getViewport(Z),re=m[Q];re.matrix.fromArray(Z.transform.matrix),re.projectionMatrix.fromArray(Z.projectionMatrix),re.viewport.set(se.x,se.y,se.width,se.height),Q===0&&x.matrix.copy(re.matrix),W===!0&&x.cameras.push(re)}}const P=s.inputSources;for(let D=0;D<h.length;D++){const L=h[D],W=P[D];L.update(W,A,o)}B&&B(O,A)}const q=new fo;q.setAnimationLoop(G),this.setAnimationLoop=function(O){B=O},this.dispose=function(){}}}function op(r){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function t(g,p,T,R){p.isMeshBasicMaterial?n(g,p):p.isMeshLambertMaterial?(n(g,p),l(g,p)):p.isMeshToonMaterial?(n(g,p),h(g,p)):p.isMeshPhongMaterial?(n(g,p),c(g,p)):p.isMeshStandardMaterial?(n(g,p),p.isMeshPhysicalMaterial?d(g,p):u(g,p)):p.isMeshMatcapMaterial?(n(g,p),f(g,p)):p.isMeshDepthMaterial?(n(g,p),m(g,p)):p.isMeshDistanceMaterial?(n(g,p),x(g,p)):p.isMeshNormalMaterial?(n(g,p),v(g,p)):p.isLineBasicMaterial?(i(g,p),p.isLineDashedMaterial&&s(g,p)):p.isPointsMaterial?a(g,p,T,R):p.isSpriteMaterial?o(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function n(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap);const T=r.get(p).envMap;if(T){g.envMap.value=T,g.flipEnvMap.value=T.isCubeTexture&&T._needsFlipEnvMap?-1:1,g.reflectivity.value=p.reflectivity,g.refractionRatio.value=p.refractionRatio;const _=r.get(T).__maxMipLevel;_!==void 0&&(g.maxMipLevel.value=_)}p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let R;p.map?R=p.map:p.specularMap?R=p.specularMap:p.displacementMap?R=p.displacementMap:p.normalMap?R=p.normalMap:p.bumpMap?R=p.bumpMap:p.roughnessMap?R=p.roughnessMap:p.metalnessMap?R=p.metalnessMap:p.alphaMap?R=p.alphaMap:p.emissiveMap?R=p.emissiveMap:p.clearcoatMap?R=p.clearcoatMap:p.clearcoatNormalMap?R=p.clearcoatNormalMap:p.clearcoatRoughnessMap&&(R=p.clearcoatRoughnessMap),R!==void 0&&(R.isWebGLRenderTarget&&(R=R.texture),R.matrixAutoUpdate===!0&&R.updateMatrix(),g.uvTransform.value.copy(R.matrix));let E;p.aoMap?E=p.aoMap:p.lightMap&&(E=p.lightMap),E!==void 0&&(E.isWebGLRenderTarget&&(E=E.texture),E.matrixAutoUpdate===!0&&E.updateMatrix(),g.uv2Transform.value.copy(E.matrix))}function i(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function s(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function a(g,p,T,R){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*T,g.scale.value=R*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap);let E;p.map?E=p.map:p.alphaMap&&(E=p.alphaMap),E!==void 0&&(E.matrixAutoUpdate===!0&&E.updateMatrix(),g.uvTransform.value.copy(E.matrix))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap);let T;p.map?T=p.map:p.alphaMap&&(T=p.alphaMap),T!==void 0&&(T.matrixAutoUpdate===!0&&T.updateMatrix(),g.uvTransform.value.copy(T.matrix))}function l(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function c(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===Ze&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===Ze&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===Ze&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===Ze&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function u(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===Ze&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===Ze&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),r.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function d(g,p){u(g,p),g.reflectivity.value=p.reflectivity,g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.sheen&&g.sheen.value.copy(p.sheen),p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===Ze&&g.clearcoatNormalScale.value.negate()),g.transmission.value=p.transmission,p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap)}function f(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===Ze&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===Ze&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function x(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function v(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===Ze&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===Ze&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function lp(){const r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.style.display="block",r}function Ne(r){r=r||{};const e=r.canvas!==void 0?r.canvas:lp(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,a=r.antialias!==void 0?r.antialias:!1,o=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",h=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let u=null,d=null;const f=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=di,this.physicallyCorrectLights=!1,this.toneMapping=ni,this.toneMappingExposure=1;const x=this;let v=!1,g=0,p=0,T=null,R=-1,E=null;const _=new Ie,C=new Ie;let N=null,B=e.width,G=e.height,q=1,O=null,A=null;const P=new Ie(0,0,B,G),D=new Ie(0,0,B,G);let L=!1;const W=new rr;let Q=!1,Z=!1;const se=new he,re=new b,ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return T===null?q:1}let U=t;function Fe(y,F){for(let I=0;I<y.length;I++){const z=y[I],te=e.getContext(z,F);if(te!==null)return te}return null}try{const y={alpha:n,depth:i,stencil:s,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",fe,!1),e.addEventListener("webglcontextrestored",Ce,!1),U===null){const F=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&F.shift(),U=Fe(F,y),U===null)throw Fe(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let Se,ve,de,Te,Me,be,Y,J,ee,oe,ne,w,M,H,V,ie,ae,Ae,pe,S,j,$;function le(){Se=new Rd(U),ve=new Td(U,Se,r),Se.init(ve),j=new rp(U,Se,ve),de=new np(U,Se,ve),Te=new Dd,Me=new Wf,be=new ip(U,Se,de,Me,ve,j,Te),Y=new Ld(x),J=new th(U,ve),$=new Sd(U,Se,J,ve),ee=new Cd(U,J,Te,$),oe=new Bd(U,ee,J,Te),Ae=new Fd(U),V=new Ad(Me),ne=new kf(x,Y,Se,ve,$,V),w=new op(Me),M=new Yf(Me),H=new Kf(Se,ve),ae=new bd(x,Y,de,oe,o),ie=new To(x,oe,ve),pe=new Ed(U,Se,Te,ve),S=new Pd(U,Se,Te,ve),Te.programs=ne.programs,x.capabilities=ve,x.extensions=Se,x.properties=Me,x.renderLists=M,x.shadowMap=ie,x.state=de,x.info=Te}le();const k=new ap(x,U);this.xr=k,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){const y=Se.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=Se.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(y){y!==void 0&&(q=y,this.setSize(B,G,!1))},this.getSize=function(y){return y===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),y=new X),y.set(B,G)},this.setSize=function(y,F,I){if(k.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}B=y,G=F,e.width=Math.floor(y*q),e.height=Math.floor(F*q),I!==!1&&(e.style.width=y+"px",e.style.height=F+"px"),this.setViewport(0,0,y,F)},this.getDrawingBufferSize=function(y){return y===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),y=new X),y.set(B*q,G*q).floor()},this.setDrawingBufferSize=function(y,F,I){B=y,G=F,q=I,e.width=Math.floor(y*I),e.height=Math.floor(F*I),this.setViewport(0,0,y,F)},this.getCurrentViewport=function(y){return y===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),y=new Ie),y.copy(_)},this.getViewport=function(y){return y.copy(P)},this.setViewport=function(y,F,I,z){y.isVector4?P.set(y.x,y.y,y.z,y.w):P.set(y,F,I,z),de.viewport(_.copy(P).multiplyScalar(q).floor())},this.getScissor=function(y){return y.copy(D)},this.setScissor=function(y,F,I,z){y.isVector4?D.set(y.x,y.y,y.z,y.w):D.set(y,F,I,z),de.scissor(C.copy(D).multiplyScalar(q).floor())},this.getScissorTest=function(){return L},this.setScissorTest=function(y){de.setScissorTest(L=y)},this.setOpaqueSort=function(y){O=y},this.setTransparentSort=function(y){A=y},this.getClearColor=function(y){return y===void 0&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),y=new ce),y.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(y,F,I){let z=0;(y===void 0||y)&&(z|=16384),(F===void 0||F)&&(z|=256),(I===void 0||I)&&(z|=1024),U.clear(z)},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(){e.removeEventListener("webglcontextlost",fe,!1),e.removeEventListener("webglcontextrestored",Ce,!1),M.dispose(),H.dispose(),Me.dispose(),Y.dispose(),oe.dispose(),$.dispose(),k.dispose(),k.removeEventListener("sessionstart",As),k.removeEventListener("sessionend",Ls),Kt.stop()};function fe(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const y=Te.autoReset,F=ie.enabled,I=ie.autoUpdate,z=ie.needsUpdate,te=ie.type;le(),Te.autoReset=y,ie.enabled=F,ie.autoUpdate=I,ie.needsUpdate=z,ie.type=te}function ke(y){const F=y.target;F.removeEventListener("dispose",ke),$t(F)}function $t(y){Ge(y),Me.remove(y)}function Ge(y){const F=Me.get(y).programs;F!==void 0&&F.forEach(function(I){ne.releaseProgram(I)})}function Ct(y,F){y.render(function(I){x.renderBufferImmediate(I,F)})}this.renderBufferImmediate=function(y,F){$.initAttributes();const I=Me.get(y);y.hasPositions&&!I.position&&(I.position=U.createBuffer()),y.hasNormals&&!I.normal&&(I.normal=U.createBuffer()),y.hasUvs&&!I.uv&&(I.uv=U.createBuffer()),y.hasColors&&!I.color&&(I.color=U.createBuffer());const z=F.getAttributes();y.hasPositions&&(U.bindBuffer(34962,I.position),U.bufferData(34962,y.positionArray,35048),$.enableAttribute(z.position),U.vertexAttribPointer(z.position,3,5126,!1,0,0)),y.hasNormals&&(U.bindBuffer(34962,I.normal),U.bufferData(34962,y.normalArray,35048),$.enableAttribute(z.normal),U.vertexAttribPointer(z.normal,3,5126,!1,0,0)),y.hasUvs&&(U.bindBuffer(34962,I.uv),U.bufferData(34962,y.uvArray,35048),$.enableAttribute(z.uv),U.vertexAttribPointer(z.uv,2,5126,!1,0,0)),y.hasColors&&(U.bindBuffer(34962,I.color),U.bufferData(34962,y.colorArray,35048),$.enableAttribute(z.color),U.vertexAttribPointer(z.color,3,5126,!1,0,0)),$.disableUnusedAttributes(),U.drawArrays(4,0,y.count),y.count=0},this.renderBufferDirect=function(y,F,I,z,te,Ee){F===null&&(F=ue);const me=te.isMesh&&te.matrixWorld.determinant()<0,ye=Is(y,F,z,te);de.setMaterial(z,me);let Be=I.index;const _e=I.attributes.position;if(Be===null){if(_e===void 0||_e.count===0)return}else if(Be.count===0)return;let Le=1;z.wireframe===!0&&(Be=ee.getWireframeAttribute(I),Le=2),(z.morphTargets||z.morphNormals)&&Ae.update(te,I,z,ye),$.setup(te,z,ye,I,Be);let ge,Pe=pe;Be!==null&&(ge=J.get(Be),Pe=S,Pe.setIndex(ge));const bt=Be!==null?Be.count:_e.count,it=I.drawRange.start*Le,en=I.drawRange.count*Le,qe=Ee!==null?Ee.start*Le:0,tn=Ee!==null?Ee.count*Le:1/0,We=Math.max(it,qe),hr=Math.min(bt,it+en,qe+tn)-1,ot=Math.max(0,hr-We+1);if(ot!==0){if(te.isMesh)z.wireframe===!0?(de.setLineWidth(z.wireframeLinewidth*xe()),Pe.setMode(1)):Pe.setMode(4);else if(te.isLine){let Pt=z.linewidth;Pt===void 0&&(Pt=1),de.setLineWidth(Pt*xe()),te.isLineSegments?Pe.setMode(1):te.isLineLoop?Pe.setMode(2):Pe.setMode(3)}else te.isPoints?Pe.setMode(0):te.isSprite&&Pe.setMode(4);if(te.isInstancedMesh)Pe.renderInstances(We,ot,te.count);else if(I.isInstancedBufferGeometry){const Pt=Math.min(I.instanceCount,I._maxInstanceCount);Pe.renderInstances(We,ot,Pt)}else Pe.render(We,ot)}},this.compile=function(y,F){d=H.get(y),d.init(),y.traverseVisible(function(I){I.isLight&&I.layers.test(F.layers)&&(d.pushLight(I),I.castShadow&&d.pushShadow(I))}),d.setupLights(),y.traverse(function(I){const z=I.material;if(z)if(Array.isArray(z))for(let te=0;te<z.length;te++){const Ee=z[te];cr(Ee,y,I)}else cr(z,y,I)})};let gt=null;function Zo(y){gt&>(y)}function As(){Kt.stop()}function Ls(){Kt.start()}const Kt=new fo;Kt.setAnimationLoop(Zo),typeof window<"u"&&Kt.setContext(window),this.setAnimationLoop=function(y){gt=y,k.setAnimationLoop(y),y===null?Kt.stop():Kt.start()},k.addEventListener("sessionstart",As),k.addEventListener("sessionend",Ls),this.render=function(y,F){let I,z;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),I=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),z=arguments[3]),F!==void 0&&F.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;y.autoUpdate===!0&&y.updateMatrixWorld(),F.parent===null&&F.updateMatrixWorld(),k.enabled===!0&&k.isPresenting===!0&&(F=k.getCamera(F)),y.isScene===!0&&y.onBeforeRender(x,y,F,I||T),d=H.get(y,m.length),d.init(),m.push(d),se.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),W.setFromProjectionMatrix(se),Z=this.localClippingEnabled,Q=V.init(this.clippingPlanes,Z,F),u=M.get(y,f.length),u.init(),f.push(u),Rs(y,F,0,x.sortObjects),u.finish(),x.sortObjects===!0&&u.sort(O,A),Q===!0&&V.beginShadows();const te=d.state.shadowsArray;ie.render(te,y,F),d.setupLights(),d.setupLightsView(F),Q===!0&&V.endShadows(),this.info.autoReset===!0&&this.info.reset(),I!==void 0&&this.setRenderTarget(I),ae.render(u,y,F,z);const Ee=u.opaque,me=u.transparent;Ee.length>0&&Cs(Ee,y,F),me.length>0&&Cs(me,y,F),T!==null&&(be.updateRenderTargetMipmap(T),be.updateMultisampleRenderTarget(T)),y.isScene===!0&&y.onAfterRender(x,y,F),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1),$.resetDefaultState(),R=-1,E=null,m.pop(),m.length>0?d=m[m.length-1]:d=null,f.pop(),f.length>0?u=f[f.length-1]:u=null};function Rs(y,F,I,z){if(y.visible===!1)return;if(y.layers.test(F.layers)){if(y.isGroup)I=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(F);else if(y.isLight)d.pushLight(y),y.castShadow&&d.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||W.intersectsSprite(y)){z&&re.setFromMatrixPosition(y.matrixWorld).applyMatrix4(se);const me=oe.update(y),ye=y.material;ye.visible&&u.push(y,me,ye,I,re.z,null)}}else if(y.isImmediateRenderObject)z&&re.setFromMatrixPosition(y.matrixWorld).applyMatrix4(se),u.push(y,null,y.material,I,re.z,null);else if((y.isMesh||y.isLine||y.isPoints)&&(y.isSkinnedMesh&&y.skeleton.frame!==Te.render.frame&&(y.skeleton.update(),y.skeleton.frame=Te.render.frame),!y.frustumCulled||W.intersectsObject(y))){z&&re.setFromMatrixPosition(y.matrixWorld).applyMatrix4(se);const me=oe.update(y),ye=y.material;if(Array.isArray(ye)){const Be=me.groups;for(let _e=0,Le=Be.length;_e<Le;_e++){const ge=Be[_e],Pe=ye[ge.materialIndex];Pe&&Pe.visible&&u.push(y,me,Pe,I,re.z,ge)}}else ye.visible&&u.push(y,me,ye,I,re.z,null)}}const Ee=y.children;for(let me=0,ye=Ee.length;me<ye;me++)Rs(Ee[me],F,I,z)}function Cs(y,F,I){const z=F.isScene===!0?F.overrideMaterial:null;for(let te=0,Ee=y.length;te<Ee;te++){const me=y[te],ye=me.object,Be=me.geometry,_e=z===null?me.material:z,Le=me.group;if(I.isArrayCamera){const ge=I.cameras;for(let Pe=0,bt=ge.length;Pe<bt;Pe++){const it=ge[Pe];ye.layers.test(it.layers)&&(de.viewport(_.copy(it.viewport)),d.setupLightsView(it),Ps(ye,F,it,Be,_e,Le))}}else Ps(ye,F,I,Be,_e,Le)}}function Ps(y,F,I,z,te,Ee){if(y.onBeforeRender(x,F,I,z,te,Ee),y.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),y.isImmediateRenderObject){const me=Is(I,F,te,y);de.setMaterial(te),$.reset(),Ct(y,me)}else x.renderBufferDirect(I,F,z,te,y,Ee);y.onAfterRender(x,F,I,z,te,Ee)}function cr(y,F,I){F.isScene!==!0&&(F=ue);const z=Me.get(y),te=d.state.lights,Ee=d.state.shadowsArray,me=te.state.version,ye=ne.getParameters(y,te.state,Ee,F,I),Be=ne.getProgramCacheKey(ye);let _e=z.programs;z.environment=y.isMeshStandardMaterial?F.environment:null,z.fog=F.fog,z.envMap=Y.get(y.envMap||z.environment),_e===void 0&&(y.addEventListener("dispose",ke),_e=new Map,z.programs=_e);let Le=_e.get(Be);if(Le!==void 0){if(z.currentProgram===Le&&z.lightsStateVersion===me)return Ds(y,ye),Le}else ye.uniforms=ne.getUniforms(y),y.onBuild(ye,x),y.onBeforeCompile(ye,x),Le=ne.acquireProgram(ye,Be),_e.set(Be,Le),z.uniforms=ye.uniforms;const ge=z.uniforms;(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(ge.clippingPlanes=V.uniform),Ds(y,ye),z.needsLights=Jo(y),z.lightsStateVersion=me,z.needsLights&&(ge.ambientLightColor.value=te.state.ambient,ge.lightProbe.value=te.state.probe,ge.directionalLights.value=te.state.directional,ge.directionalLightShadows.value=te.state.directionalShadow,ge.spotLights.value=te.state.spot,ge.spotLightShadows.value=te.state.spotShadow,ge.rectAreaLights.value=te.state.rectArea,ge.ltc_1.value=te.state.rectAreaLTC1,ge.ltc_2.value=te.state.rectAreaLTC2,ge.pointLights.value=te.state.point,ge.pointLightShadows.value=te.state.pointShadow,ge.hemisphereLights.value=te.state.hemi,ge.directionalShadowMap.value=te.state.directionalShadowMap,ge.directionalShadowMatrix.value=te.state.directionalShadowMatrix,ge.spotShadowMap.value=te.state.spotShadowMap,ge.spotShadowMatrix.value=te.state.spotShadowMatrix,ge.pointShadowMap.value=te.state.pointShadowMap,ge.pointShadowMatrix.value=te.state.pointShadowMatrix);const Pe=Le.getUniforms(),bt=Xt.seqWithValue(Pe.seq,ge);return z.currentProgram=Le,z.uniformsList=bt,Le}function Ds(y,F){const I=Me.get(y);I.outputEncoding=F.outputEncoding,I.instancing=F.instancing,I.numClippingPlanes=F.numClippingPlanes,I.numIntersection=F.numClipIntersection,I.vertexAlphas=F.vertexAlphas}function Is(y,F,I,z){F.isScene!==!0&&(F=ue),be.resetTextureUnits();const te=F.fog,Ee=I.isMeshStandardMaterial?F.environment:null,me=T===null?x.outputEncoding:T.texture.encoding,ye=Y.get(I.envMap||Ee),Be=I.vertexColors===!0&&z.geometry&&z.geometry.attributes.color&&z.geometry.attributes.color.itemSize===4,_e=Me.get(I),Le=d.state.lights;if(Q===!0&&(Z===!0||y!==E)){const We=y===E&&I.id===R;V.setState(I,y,We)}let ge=!1;I.version===_e.__version?(_e.needsLights&&_e.lightsStateVersion!==Le.state.version||_e.outputEncoding!==me||z.isInstancedMesh&&_e.instancing===!1||!z.isInstancedMesh&&_e.instancing===!0||_e.envMap!==ye||I.fog&&_e.fog!==te||_e.numClippingPlanes!==void 0&&(_e.numClippingPlanes!==V.numPlanes||_e.numIntersection!==V.numIntersection)||_e.vertexAlphas!==Be)&&(ge=!0):(ge=!0,_e.__version=I.version);let Pe=_e.currentProgram;ge===!0&&(Pe=cr(I,F,z));let bt=!1,it=!1,en=!1;const qe=Pe.getUniforms(),tn=_e.uniforms;if(de.useProgram(Pe.program)&&(bt=!0,it=!0,en=!0),I.id!==R&&(R=I.id,it=!0),bt||E!==y){if(qe.setValue(U,"projectionMatrix",y.projectionMatrix),ve.logarithmicDepthBuffer&&qe.setValue(U,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),E!==y&&(E=y,it=!0,en=!0),I.isShaderMaterial||I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshStandardMaterial||I.envMap){const We=qe.map.cameraPosition;We!==void 0&&We.setValue(U,re.setFromMatrixPosition(y.matrixWorld))}(I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshLambertMaterial||I.isMeshBasicMaterial||I.isMeshStandardMaterial||I.isShaderMaterial)&&qe.setValue(U,"isOrthographic",y.isOrthographicCamera===!0),(I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshLambertMaterial||I.isMeshBasicMaterial||I.isMeshStandardMaterial||I.isShaderMaterial||I.isShadowMaterial||I.skinning)&&qe.setValue(U,"viewMatrix",y.matrixWorldInverse)}if(I.skinning){qe.setOptional(U,z,"bindMatrix"),qe.setOptional(U,z,"bindMatrixInverse");const We=z.skeleton;if(We){const hr=We.bones;if(ve.floatVertexTextures){if(We.boneTexture===null){let ot=Math.sqrt(hr.length*4);ot=Nc(ot),ot=Math.max(ot,4);const Pt=new Float32Array(ot*ot*4);Pt.set(We.boneMatrices);const Qo=new uo(Pt,ot,ot,wt,qt);We.boneMatrices=Pt,We.boneTexture=Qo,We.boneTextureSize=ot}qe.setValue(U,"boneTexture",We.boneTexture,be),qe.setValue(U,"boneTextureSize",We.boneTextureSize)}else qe.setOptional(U,We,"boneMatrices")}}return(it||_e.receiveShadow!==z.receiveShadow)&&(_e.receiveShadow=z.receiveShadow,qe.setValue(U,"receiveShadow",z.receiveShadow)),it&&(qe.setValue(U,"toneMappingExposure",x.toneMappingExposure),_e.needsLights&&jo(tn,en),te&&I.fog&&w.refreshFogUniforms(tn,te),w.refreshMaterialUniforms(tn,I,q,G),Xt.upload(U,_e.uniformsList,tn,be)),I.isShaderMaterial&&I.uniformsNeedUpdate===!0&&(Xt.upload(U,_e.uniformsList,tn,be),I.uniformsNeedUpdate=!1),I.isSpriteMaterial&&qe.setValue(U,"center",z.center),qe.setValue(U,"modelViewMatrix",z.modelViewMatrix),qe.setValue(U,"normalMatrix",z.normalMatrix),qe.setValue(U,"modelMatrix",z.matrixWorld),Pe}function jo(y,F){y.ambientLightColor.needsUpdate=F,y.lightProbe.needsUpdate=F,y.directionalLights.needsUpdate=F,y.directionalLightShadows.needsUpdate=F,y.pointLights.needsUpdate=F,y.pointLightShadows.needsUpdate=F,y.spotLights.needsUpdate=F,y.spotLightShadows.needsUpdate=F,y.rectAreaLights.needsUpdate=F,y.hemisphereLights.needsUpdate=F}function Jo(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return T},this.setRenderTarget=function(y,F=0,I=0){T=y,g=F,p=I,y&&Me.get(y).__webglFramebuffer===void 0&&be.setupRenderTarget(y);let z=null,te=!1,Ee=!1;if(y){const me=y.texture;(me.isDataTexture3D||me.isDataTexture2DArray)&&(Ee=!0);const ye=Me.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(z=ye[F],te=!0):y.isWebGLMultisampleRenderTarget?z=Me.get(y).__webglMultisampledFramebuffer:z=ye,_.copy(y.viewport),C.copy(y.scissor),N=y.scissorTest}else _.copy(P).multiplyScalar(q).floor(),C.copy(D).multiplyScalar(q).floor(),N=L;if(de.bindFramebuffer(36160,z),de.viewport(_),de.scissor(C),de.setScissorTest(N),te){const me=Me.get(y.texture);U.framebufferTexture2D(36160,36064,34069+F,me.__webglTexture,I)}else if(Ee){const me=Me.get(y.texture),ye=F||0;U.framebufferTextureLayer(36160,36064,me.__webglTexture,I||0,ye)}},this.readRenderTargetPixels=function(y,F,I,z,te,Ee,me){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ye=Me.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&me!==void 0&&(ye=ye[me]),ye){de.bindFramebuffer(36160,ye);try{const Be=y.texture,_e=Be.format,Le=Be.type;if(_e!==wt&&j.convert(_e)!==U.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ge=Le===Yi&&(Se.has("EXT_color_buffer_half_float")||ve.isWebGL2&&Se.has("EXT_color_buffer_float"));if(Le!==ls&&j.convert(Le)!==U.getParameter(35738)&&!(Le===qt&&(ve.isWebGL2||Se.has("OES_texture_float")||Se.has("WEBGL_color_buffer_float")))&&!ge){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U.checkFramebufferStatus(36160)===36053?F>=0&&F<=y.width-z&&I>=0&&I<=y.height-te&&U.readPixels(F,I,z,te,j.convert(_e),j.convert(Le),Ee):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Be=T!==null?Me.get(T).__webglFramebuffer:null;de.bindFramebuffer(36160,Be)}}},this.copyFramebufferToTexture=function(y,F,I=0){const z=Math.pow(2,-I),te=Math.floor(F.image.width*z),Ee=Math.floor(F.image.height*z),me=j.convert(F.format);be.setTexture2D(F,0),U.copyTexImage2D(3553,I,me,y.x,y.y,te,Ee,0),de.unbindTexture()},this.copyTextureToTexture=function(y,F,I,z=0){const te=F.image.width,Ee=F.image.height,me=j.convert(I.format),ye=j.convert(I.type);be.setTexture2D(I,0),U.pixelStorei(37440,I.flipY),U.pixelStorei(37441,I.premultiplyAlpha),U.pixelStorei(3317,I.unpackAlignment),F.isDataTexture?U.texSubImage2D(3553,z,y.x,y.y,te,Ee,me,ye,F.image.data):F.isCompressedTexture?U.compressedTexSubImage2D(3553,z,y.x,y.y,F.mipmaps[0].width,F.mipmaps[0].height,me,F.mipmaps[0].data):U.texSubImage2D(3553,z,y.x,y.y,me,ye,F.image),z===0&&I.generateMipmaps&&U.generateMipmap(3553),de.unbindTexture()},this.copyTextureToTexture3D=function(y,F,I,z,te=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const{width:Ee,height:me,data:ye}=I.image,Be=j.convert(z.format),_e=j.convert(z.type);let Le;if(z.isDataTexture3D)be.setTexture3D(z,0),Le=32879;else if(z.isDataTexture2DArray)be.setTexture2DArray(z,0),Le=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}U.pixelStorei(37440,z.flipY),U.pixelStorei(37441,z.premultiplyAlpha),U.pixelStorei(3317,z.unpackAlignment);const ge=U.getParameter(3314),Pe=U.getParameter(32878),bt=U.getParameter(3316),it=U.getParameter(3315),en=U.getParameter(32877);U.pixelStorei(3314,Ee),U.pixelStorei(32878,me),U.pixelStorei(3316,y.min.x),U.pixelStorei(3315,y.min.y),U.pixelStorei(32877,y.min.z),U.texSubImage3D(Le,te,F.x,F.y,F.z,y.max.x-y.min.x+1,y.max.y-y.min.y+1,y.max.z-y.min.z+1,Be,_e,ye),U.pixelStorei(3314,ge),U.pixelStorei(32878,Pe),U.pixelStorei(3316,bt),U.pixelStorei(3315,it),U.pixelStorei(32877,en),te===0&&z.generateMipmaps&&U.generateMipmap(Le),de.unbindTexture()},this.initTexture=function(y){be.setTexture2D(y,0),de.unbindTexture()},this.resetState=function(){g=0,p=0,T=null,de.reset(),$.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class cp extends Ne{}cp.prototype.isWebGL1Renderer=!0;class ps extends Re{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}ps.prototype.isScene=!0;class ln{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=oi,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=At(),this.onUploadCallback=function(){}}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=At()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new ln(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=At()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}ln.prototype.isInterleavedBuffer=!0;const Ve=new b;class li{constructor(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ve.x=this.getX(t),Ve.y=this.getY(t),Ve.z=this.getZ(t),Ve.applyMatrix4(e),this.setXYZ(t,Ve.x,Ve.y,Ve.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ve.x=this.getX(t),Ve.y=this.getY(t),Ve.z=this.getZ(t),Ve.applyNormalMatrix(e),this.setXYZ(t,Ve.x,Ve.y,Ve.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ve.x=this.getX(t),Ve.y=this.getY(t),Ve.z=this.getZ(t),Ve.transformDirection(e),this.setXYZ(t,Ve.x,Ve.y,Ve.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new je(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new li(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}li.prototype.isInterleavedBufferAttribute=!0;class Lo extends Qe{constructor(e){super(),this.type="SpriteMaterial",this.color=new ce(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}Lo.prototype.isSpriteMaterial=!0;let wn;const Xn=new b,bn=new b,Sn=new b,En=new X,Yn=new X,Ro=new he,Ii=new b,Zn=new b,Ni=new b,Aa=new X,Hr=new X,La=new X;class hp extends Re{constructor(e){if(super(),this.type="Sprite",wn===void 0){wn=new Oe;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ln(t,5);wn.setIndex([0,1,2,0,2,3]),wn.setAttribute("position",new li(n,3,0,!1)),wn.setAttribute("uv",new li(n,2,3,!1))}this.geometry=wn,this.material=e!==void 0?e:new Lo,this.center=new X(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),bn.setFromMatrixScale(this.matrixWorld),Ro.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Sn.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&bn.multiplyScalar(-Sn.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Fi(Ii.set(-.5,-.5,0),Sn,a,bn,i,s),Fi(Zn.set(.5,-.5,0),Sn,a,bn,i,s),Fi(Ni.set(.5,.5,0),Sn,a,bn,i,s),Aa.set(0,0),Hr.set(1,0),La.set(1,1);let o=e.ray.intersectTriangle(Ii,Zn,Ni,!1,Xn);if(o===null&&(Fi(Zn.set(-.5,.5,0),Sn,a,bn,i,s),Hr.set(0,1),o=e.ray.intersectTriangle(Ii,Ni,Zn,!1,Xn),o===null))return;const l=e.ray.origin.distanceTo(Xn);l<e.near||l>e.far||t.push({distance:l,point:Xn.clone(),uv:Xe.getUV(Xn,Ii,Zn,Ni,Aa,Hr,La,new X),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}hp.prototype.isSprite=!0;function Fi(r,e,t,n,i,s){En.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Yn.x=s*En.x-i*En.y,Yn.y=i*En.x+s*En.y):Yn.copy(En),r.copy(e),r.x+=Yn.x,r.y+=Yn.y,r.applyMatrix4(Ro)}const Ra=new b,Ca=new Ie,Pa=new Ie,up=new b,Da=new he;class Co extends ft{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new he,this.bindMatrixInverse=new he}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Ie,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;Ca.fromBufferAttribute(i.attributes.skinIndex,e),Pa.fromBufferAttribute(i.attributes.skinWeight,e),Ra.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Pa.getComponent(s);if(a!==0){const o=Ca.getComponent(s);Da.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(up.copy(Ra).applyMatrix4(Da),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}Co.prototype.isSkinnedMesh=!0;class dp extends Re{constructor(){super(),this.type="Bone"}}dp.prototype.isBone=!0;const Ia=new he,Na=new he,Bi=[],jn=new ft;class fp extends ft{constructor(e,t,n){super(e,t),this.instanceMatrix=new je(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(jn.geometry=this.geometry,jn.material=this.material,jn.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,Ia),Na.multiplyMatrices(n,Ia),jn.matrixWorld=Na,jn.raycast(e,Bi);for(let a=0,o=Bi.length;a<o;a++){const l=Bi[a];l.instanceId=s,l.object=this,t.push(l)}Bi.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new je(new Float32Array(this.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}fp.prototype.isInstancedMesh=!0;class fi extends Qe{constructor(e){super(),this.type="LineBasicMaterial",this.color=new ce(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this}}fi.prototype.isLineBasicMaterial=!0;const Fa=new b,Ba=new b,za=new he,Gr=new Bn,zi=new Fn;class ms extends Re{constructor(e=new Oe,t=new fi){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Fa.fromBufferAttribute(t,i-1),Ba.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Fa.distanceTo(Ba);e.setAttribute("lineDistance",new Je(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),zi.copy(n.boundingSphere),zi.applyMatrix4(i),zi.radius+=s,e.ray.intersectsSphere(zi)===!1)return;za.copy(i).invert(),Gr.copy(e.ray).applyMatrix4(za);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new b,h=new b,u=new b,d=new b,f=this.isLineSegments?2:1;if(n.isBufferGeometry){const m=n.index,v=n.attributes.position;if(m!==null){const g=Math.max(0,a.start),p=Math.min(m.count,a.start+a.count);for(let T=g,R=p-1;T<R;T+=f){const E=m.getX(T),_=m.getX(T+1);if(c.fromBufferAttribute(v,E),h.fromBufferAttribute(v,_),Gr.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(d);N<e.near||N>e.far||t.push({distance:N,point:u.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,a.start),p=Math.min(v.count,a.start+a.count);for(let T=g,R=p-1;T<R;T+=f){if(c.fromBufferAttribute(v,T),h.fromBufferAttribute(v,T+1),Gr.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const _=e.ray.origin.distanceTo(d);_<e.near||_>e.far||t.push({distance:_,point:u.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}ms.prototype.isLine=!0;const Oa=new b,Ua=new b;class gs extends ms{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Oa.fromBufferAttribute(t,i),Ua.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Oa.distanceTo(Ua);e.setAttribute("lineDistance",new Je(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}gs.prototype.isLineSegments=!0;class pp extends ms{constructor(e,t){super(e,t),this.type="LineLoop"}}pp.prototype.isLineLoop=!0;class Po extends Qe{constructor(e){super(),this.type="PointsMaterial",this.color=new ce(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,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.morphTargets=e.morphTargets,this}}Po.prototype.isPointsMaterial=!0;const Ha=new he,Kr=new Bn,Oi=new Fn,Ui=new b;class mp extends Re{constructor(e=new Oe,t=new Po){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Oi.copy(n.boundingSphere),Oi.applyMatrix4(i),Oi.radius+=s,e.ray.intersectsSphere(Oi)===!1)return;Ha.copy(i).invert(),Kr.copy(e.ray).applyMatrix4(Ha);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o;if(n.isBufferGeometry){const c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,x=f;m<x;m++){const v=c.getX(m);Ui.fromBufferAttribute(u,v),Ga(Ui,v,l,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,x=f;m<x;m++)Ui.fromBufferAttribute(u,m),Ga(Ui,m,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}mp.prototype.isPoints=!0;function Ga(r,e,t,n,i,s,a){const o=Kr.distanceSqToPoint(r);if(o<t){const l=new b;Kr.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class gp extends et{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.format=o!==void 0?o:sn,this.minFilter=a!==void 0?a:dt,this.magFilter=s!==void 0?s:dt,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}gp.prototype.isVideoTexture=!0;class xp extends et{constructor(e,t,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}xp.prototype.isCompressedTexture=!0;class vp extends et{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.needsUpdate=!0}}vp.prototype.isCanvasTexture=!0;class _p extends et{constructor(e,t,n,i,s,a,o,l,c,h){if(h=h!==void 0?h:Cn,h!==Cn&&h!==ai)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Cn&&(n=Xi),n===void 0&&h===ai&&(n=ii),super(null,i,s,a,o,l,h,n,c),this.image={width:e,height:t},this.magFilter=o!==void 0?o:rt,this.minFilter=l!==void 0?l:rt,this.flipY=!1,this.generateMipmaps=!1}}_p.prototype.isDepthTexture=!0;const yp={triangulate:function(r,e,t){t=t||2;const n=e&&e.length,i=n?e[0]*t:r.length;let s=Do(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,h,u,d,f;if(n&&(s=Ep(r,e,s,t)),r.length>80*t){o=c=r[0],l=h=r[1];for(let m=t;m<i;m+=t)u=r[m],d=r[m+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-o,h-l),f=f!==0?1/f:0}return ci(s,a,t,o,l,f),a}};function Do(r,e,t,n,i){let s,a;if(i===Bp(r,e,t,n)>0)for(s=e;s<t;s+=n)a=Va(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=Va(s,r[s],r[s+1],a);return a&&sr(a,a.next)&&(ui(a),a=a.next),a}function jt(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(sr(t,t.next)||He(t.prev,t,t.next)===0)){if(ui(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ci(r,e,t,n,i,s,a){if(!r)return;!a&&s&&Cp(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?wp(r,n,i,s):Mp(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),ui(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=bp(jt(r),e,t),ci(r,e,t,n,i,s,2)):a===2&&Sp(r,e,t,n,i,s):ci(jt(r),e,t,n,i,s,1);break}}}function Mp(r){const e=r.prev,t=r,n=r.next;if(He(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(Rn(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&He(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wp(r,e,t,n){const i=r.prev,s=r,a=r.next;if(He(i,s,a)>=0)return!1;const o=i.x<s.x?i.x<a.x?i.x:a.x:s.x<a.x?s.x:a.x,l=i.y<s.y?i.y<a.y?i.y:a.y:s.y<a.y?s.y:a.y,c=i.x>s.x?i.x>a.x?i.x:a.x:s.x>a.x?s.x:a.x,h=i.y>s.y?i.y>a.y?i.y:a.y:s.y>a.y?s.y:a.y,u=es(o,l,e,t,n),d=es(c,h,e,t,n);let f=r.prevZ,m=r.nextZ;for(;f&&f.z>=u&&m&&m.z<=d;){if(f!==r.prev&&f!==r.next&&Rn(i.x,i.y,s.x,s.y,a.x,a.y,f.x,f.y)&&He(f.prev,f,f.next)>=0||(f=f.prevZ,m!==r.prev&&m!==r.next&&Rn(i.x,i.y,s.x,s.y,a.x,a.y,m.x,m.y)&&He(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;f&&f.z>=u;){if(f!==r.prev&&f!==r.next&&Rn(i.x,i.y,s.x,s.y,a.x,a.y,f.x,f.y)&&He(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=d;){if(m!==r.prev&&m!==r.next&&Rn(i.x,i.y,s.x,s.y,a.x,a.y,m.x,m.y)&&He(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function bp(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!sr(i,s)&&Io(i,n,n.next,s)&&hi(i,s)&&hi(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),ui(n),ui(n.next),n=r=s),n=n.next}while(n!==r);return jt(n)}function Sp(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Ip(a,o)){let l=No(a,o);a=jt(a,a.next),l=jt(l,l.next),ci(a,e,t,n,i,s),ci(l,e,t,n,i,s);return}o=o.next}a=a.next}while(a!==r)}function Ep(r,e,t,n){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*n,l=s<a-1?e[s+1]*n:r.length,c=Do(r,o,l,n,!1),c===c.next&&(c.steiner=!0),i.push(Dp(c));for(i.sort(Tp),s=0;s<i.length;s++)Ap(i[s],t),t=jt(t,t.next);return t}function Tp(r,e){return r.x-e.x}function Ap(r,e){if(e=Lp(r,e),e){const t=No(e,r);jt(e,e.next),jt(t,t.next)}}function Lp(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s){if(s=d,d===n){if(i===t.y)return t;if(i===t.next.y)return t.next}a=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!a)return null;if(n===s)return a;const o=a,l=a.x,c=a.y;let h=1/0,u;t=a;do n>=t.x&&t.x>=l&&n!==t.x&&Rn(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(u=Math.abs(i-t.y)/(n-t.x),hi(t,r)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&Rp(a,t)))&&(a=t,h=u)),t=t.next;while(t!==o);return a}function Rp(r,e){return He(r.prev,r,e.prev)<0&&He(e.next,r,r.next)<0}function Cp(r,e,t,n){let i=r;do i.z===null&&(i.z=es(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Pp(i)}function Pp(r){let e,t,n,i,s,a,o,l,c=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e<c&&(o++,n=n.nextZ,!!n);e++);for(l=c;o>0||l>0&&n;)o!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(a>1);return r}function es(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Dp(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Rn(r,e,t,n,i,s,a,o){return(i-a)*(e-o)-(r-a)*(s-o)>=0&&(r-a)*(n-o)-(t-a)*(e-o)>=0&&(t-a)*(s-o)-(i-a)*(n-o)>=0}function Ip(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Np(r,e)&&(hi(r,e)&&hi(e,r)&&Fp(r,e)&&(He(r.prev,r,e.prev)||He(r,e.prev,e))||sr(r,e)&&He(r.prev,r,r.next)>0&&He(e.prev,e,e.next)>0)}function He(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function sr(r,e){return r.x===e.x&&r.y===e.y}function Io(r,e,t,n){const i=Gi(He(r,e,t)),s=Gi(He(r,e,n)),a=Gi(He(t,n,r)),o=Gi(He(t,n,e));return!!(i!==s&&a!==o||i===0&&Hi(r,t,e)||s===0&&Hi(r,n,e)||a===0&&Hi(t,r,n)||o===0&&Hi(t,e,n))}function Hi(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Gi(r){return r>0?1:r<0?-1:0}function Np(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Io(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function hi(r,e){return He(r.prev,r,r.next)<0?He(r,e,r.next)>=0&&He(r,r.prev,e)>=0:He(r,e,r.prev)<0||He(r,r.next,e)<0}function Fp(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function No(r,e){const t=new ts(r.i,r.x,r.y),n=new ts(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Va(r,e,t,n){const i=new ts(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ui(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ts(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Bp(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class Yt{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Yt.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];ka(e),Wa(n,e);let a=e.length;t.forEach(ka);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,Wa(n,t[l]);const o=yp.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function ka(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Wa(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class ar extends Oe{constructor(e,t){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Je(i,3)),this.setAttribute("uv",new Je(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1;let u=t.depth!==void 0?t.depth:100,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:6,m=t.bevelSize!==void 0?t.bevelSize:f-2,x=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,p=t.UVGenerator!==void 0?t.UVGenerator:zp;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=t.amount);let T,R=!1,E,_,C,N;g&&(T=g.getSpacedPoints(h),R=!0,d=!1,E=g.computeFrenetFrames(h,!1),_=new b,C=new b,N=new b),d||(v=0,f=0,m=0,x=0);const B=o.extractPoints(c);let G=B.shape;const q=B.holes;if(!Yt.isClockWise(G)){G=G.reverse();for(let Y=0,J=q.length;Y<J;Y++){const ee=q[Y];Yt.isClockWise(ee)&&(q[Y]=ee.reverse())}}const A=Yt.triangulateShape(G,q),P=G;for(let Y=0,J=q.length;Y<J;Y++){const ee=q[Y];G=G.concat(ee)}function D(Y,J,ee){return J||console.error("THREE.ExtrudeGeometry: vec does not exist"),J.clone().multiplyScalar(ee).add(Y)}const L=G.length,W=A.length;function Q(Y,J,ee){let oe,ne,w;const M=Y.x-J.x,H=Y.y-J.y,V=ee.x-Y.x,ie=ee.y-Y.y,ae=M*M+H*H,Ae=M*ie-H*V;if(Math.abs(Ae)>Number.EPSILON){const pe=Math.sqrt(ae),S=Math.sqrt(V*V+ie*ie),j=J.x-H/pe,$=J.y+M/pe,le=ee.x-ie/S,k=ee.y+V/S,fe=((le-j)*ie-(k-$)*V)/(M*ie-H*V);oe=j+M*fe-Y.x,ne=$+H*fe-Y.y;const Ce=oe*oe+ne*ne;if(Ce<=2)return new X(oe,ne);w=Math.sqrt(Ce/2)}else{let pe=!1;M>Number.EPSILON?V>Number.EPSILON&&(pe=!0):M<-Number.EPSILON?V<-Number.EPSILON&&(pe=!0):Math.sign(H)===Math.sign(ie)&&(pe=!0),pe?(oe=-H,ne=M,w=Math.sqrt(ae)):(oe=M,ne=H,w=Math.sqrt(ae/2))}return new X(oe/w,ne/w)}const Z=[];for(let Y=0,J=P.length,ee=J-1,oe=Y+1;Y<J;Y++,ee++,oe++)ee===J&&(ee=0),oe===J&&(oe=0),Z[Y]=Q(P[Y],P[ee],P[oe]);const se=[];let re,ue=Z.concat();for(let Y=0,J=q.length;Y<J;Y++){const ee=q[Y];re=[];for(let oe=0,ne=ee.length,w=ne-1,M=oe+1;oe<ne;oe++,w++,M++)w===ne&&(w=0),M===ne&&(M=0),re[oe]=Q(ee[oe],ee[w],ee[M]);se.push(re),ue=ue.concat(re)}for(let Y=0;Y<v;Y++){const J=Y/v,ee=f*Math.cos(J*Math.PI/2),oe=m*Math.sin(J*Math.PI/2)+x;for(let ne=0,w=P.length;ne<w;ne++){const M=D(P[ne],Z[ne],oe);ve(M.x,M.y,-ee)}for(let ne=0,w=q.length;ne<w;ne++){const M=q[ne];re=se[ne];for(let H=0,V=M.length;H<V;H++){const ie=D(M[H],re[H],oe);ve(ie.x,ie.y,-ee)}}}const xe=m+x;for(let Y=0;Y<L;Y++){const J=d?D(G[Y],ue[Y],xe):G[Y];R?(C.copy(E.normals[0]).multiplyScalar(J.x),_.copy(E.binormals[0]).multiplyScalar(J.y),N.copy(T[0]).add(C).add(_),ve(N.x,N.y,N.z)):ve(J.x,J.y,0)}for(let Y=1;Y<=h;Y++)for(let J=0;J<L;J++){const ee=d?D(G[J],ue[J],xe):G[J];R?(C.copy(E.normals[Y]).multiplyScalar(ee.x),_.copy(E.binormals[Y]).multiplyScalar(ee.y),N.copy(T[Y]).add(C).add(_),ve(N.x,N.y,N.z)):ve(ee.x,ee.y,u/h*Y)}for(let Y=v-1;Y>=0;Y--){const J=Y/v,ee=f*Math.cos(J*Math.PI/2),oe=m*Math.sin(J*Math.PI/2)+x;for(let ne=0,w=P.length;ne<w;ne++){const M=D(P[ne],Z[ne],oe);ve(M.x,M.y,u+ee)}for(let ne=0,w=q.length;ne<w;ne++){const M=q[ne];re=se[ne];for(let H=0,V=M.length;H<V;H++){const ie=D(M[H],re[H],oe);R?ve(ie.x,ie.y+T[h-1].y,T[h-1].x+ee):ve(ie.x,ie.y,u+ee)}}}U(),Fe();function U(){const Y=i.length/3;if(d){let J=0,ee=L*J;for(let oe=0;oe<W;oe++){const ne=A[oe];de(ne[2]+ee,ne[1]+ee,ne[0]+ee)}J=h+v*2,ee=L*J;for(let oe=0;oe<W;oe++){const ne=A[oe];de(ne[0]+ee,ne[1]+ee,ne[2]+ee)}}else{for(let J=0;J<W;J++){const ee=A[J];de(ee[2],ee[1],ee[0])}for(let J=0;J<W;J++){const ee=A[J];de(ee[0]+L*h,ee[1]+L*h,ee[2]+L*h)}}n.addGroup(Y,i.length/3-Y,0)}function Fe(){const Y=i.length/3;let J=0;Se(P,J),J+=P.length;for(let ee=0,oe=q.length;ee<oe;ee++){const ne=q[ee];Se(ne,J),J+=ne.length}n.addGroup(Y,i.length/3-Y,1)}function Se(Y,J){let ee=Y.length;for(;--ee>=0;){const oe=ee;let ne=ee-1;ne<0&&(ne=Y.length-1);for(let w=0,M=h+v*2;w<M;w++){const H=L*w,V=L*(w+1),ie=J+oe+H,ae=J+ne+H,Ae=J+ne+V,pe=J+oe+V;Te(ie,ae,Ae,pe)}}}function ve(Y,J,ee){l.push(Y),l.push(J),l.push(ee)}function de(Y,J,ee){Me(Y),Me(J),Me(ee);const oe=i.length/3,ne=p.generateTopUV(n,i,oe-3,oe-2,oe-1);be(ne[0]),be(ne[1]),be(ne[2])}function Te(Y,J,ee,oe){Me(Y),Me(J),Me(oe),Me(J),Me(ee),Me(oe);const ne=i.length/3,w=p.generateSideWallUV(n,i,ne-6,ne-3,ne-2,ne-1);be(w[0]),be(w[1]),be(w[3]),be(w[1]),be(w[2]),be(w[3])}function Me(Y){i.push(l[Y*3+0]),i.push(l[Y*3+1]),i.push(l[Y*3+2])}function be(Y){s.push(Y.x),s.push(Y.y)}}}toJSON(){const e=Oe.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Op(t,n,e)}}const zp={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[i*3],h=e[i*3+1];return[new X(s,a),new X(o,l),new X(c,h)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],u=e[n*3+2],d=e[i*3],f=e[i*3+1],m=e[i*3+2],x=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(o-h)<.01?[new X(a,1-l),new X(c,1-u),new X(d,1-m),new X(x,1-g)]:[new X(o,1-l),new X(h,1-u),new X(f,1-m),new X(v,1-g)]}};function Op(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Up extends Oe{constructor(e,t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new Je(i,3)),this.setAttribute("normal",new Je(s,3)),this.setAttribute("uv",new Je(a,2));function c(h){const u=i.length/3,d=h.extractPoints(t);let f=d.shape;const m=d.holes;Yt.isClockWise(f)===!1&&(f=f.reverse());for(let v=0,g=m.length;v<g;v++){const p=m[v];Yt.isClockWise(p)===!0&&(m[v]=p.reverse())}const x=Yt.triangulateShape(f,m);for(let v=0,g=m.length;v<g;v++){const p=m[v];f=f.concat(p)}for(let v=0,g=f.length;v<g;v++){const p=f[v];i.push(p.x,p.y,0),s.push(0,0,1),a.push(p.x,p.y)}for(let v=0,g=x.length;v<g;v++){const p=x[v],T=p[0]+u,R=p[1]+u,E=p[2]+u;n.push(T,R,E),l+=3}}}toJSON(){const e=Oe.prototype.toJSON.call(this),t=this.parameters.shapes;return Hp(t,e)}}function Hp(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Gp extends Qe{constructor(e){super(),this.type="ShadowMaterial",this.color=new ce(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Gp.prototype.isShadowMaterial=!0;class Vp extends Zt{constructor(e){super(e),this.type="RawShaderMaterial"}}Vp.prototype.isRawShaderMaterial=!0;class Fo extends Qe{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ce(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=In,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this}}Fo.prototype.isMeshStandardMaterial=!0;class kp extends Fo{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new X(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=ht(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new ce).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this}}kp.prototype.isMeshPhysicalMaterial=!0;class Wp extends Qe{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new ce(16777215),this.specular=new ce(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=In,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=nr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Wp.prototype.isMeshPhongMaterial=!0;class qp extends Qe{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ce(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=In,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}qp.prototype.isMeshToonMaterial=!0;class Xp extends Qe{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=In,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Xp.prototype.isMeshNormalMaterial=!0;class Yp extends Qe{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=nr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Yp.prototype.isMeshLambertMaterial=!0;class Zp extends Qe{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ce(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=In,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Zp.prototype.isMeshMatcapMaterial=!0;class jp extends fi{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}jp.prototype.isLineDashedMaterial=!0;const Ue={arraySlice:function(r,e,t){return Ue.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const m=c.times[f]*i;if(!(m<t||m>=n)){u.push(c.times[f]);for(let x=0;x<h;++x)d.push(c.values[f*h+x])}}u.length!==0&&(c.times=Ue.convertArray(u,c.times.constructor),c.values=Ue.convertArray(d,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(g){return g.name===o.name&&g.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const m=o.times.length-1;let x;if(s<=o.times[0]){const g=h,p=u-h;x=Ue.arraySlice(o.values,g,p)}else if(s>=o.times[m]){const g=m*u+h,p=g+u-h;x=Ue.arraySlice(o.values,g,p)}else{const g=o.createInterpolant(),p=h,T=u-h;g.evaluate(s),x=Ue.arraySlice(g.resultBuffer,p,T)}l==="quaternion"&&new st().fromArray(x).normalize().conjugate().toArray(x);const v=c.times.length;for(let g=0;g<v;++g){const p=g*f+d;if(l==="quaternion")st.multiplyQuaternionsFlat(c.values,p,x,0,c.values,p);else{const T=f-d*2;for(let R=0;R<T;++R)c.values[p+R]-=x[R]}}}return r.blendMode=ro,r}};class Jt{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Jt.prototype.beforeStart_=Jt.prototype.copySampleValue_;Jt.prototype.afterEnd_=Jt.prototype.copySampleValue_;class Jp extends Jt{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:An,endingEnd:An}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ln:s=e,o=2*t-n;break;case Ji:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Ln:a=e,l=2*n-t;break;case Ji:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),x=m*m,v=x*m,g=-d*v+2*d*x-d*m,p=(1+d)*v+(-1.5-2*d)*x+(-.5+d)*m+1,T=(-1-f)*v+(1.5+f)*x+.5*m,R=f*v-f*x;for(let E=0;E!==o;++E)s[E]=g*a[h+E]+p*a[c+E]+T*a[l+E]+R*a[u+E];return s}}class Bo extends Jt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)s[d]=a[c+d]*u+a[l+d]*h;return s}}class Qp extends Jt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Rt{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ue.convertArray(t,this.TimeBufferType),this.values=Ue.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ue.convertArray(e.times,Array),values:Ue.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Qp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bo(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Jp(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Zi:t=this.InterpolantFactoryMethodDiscrete;break;case ji:t=this.InterpolantFactoryMethodLinear;break;case ur:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Zi;case this.InterpolantFactoryMethodLinear:return ji;case this.InterpolantFactoryMethodSmooth:return ur}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=Ue.arraySlice(n,s,a),this.values=Ue.arraySlice(this.values,s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Ue.isTypedArray(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=Ue.arraySlice(this.times),t=Ue.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===ur,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const x=t[u+m];if(x!==t[d+m]||x!==t[f+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=Ue.arraySlice(e,0,a),this.values=Ue.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}clone(){const e=Ue.arraySlice(this.times,0),t=Ue.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Rt.prototype.TimeBufferType=Float32Array;Rt.prototype.ValueBufferType=Float32Array;Rt.prototype.DefaultInterpolation=ji;class Un extends Rt{}Un.prototype.ValueTypeName="bool";Un.prototype.ValueBufferType=Array;Un.prototype.DefaultInterpolation=Zi;Un.prototype.InterpolantFactoryMethodLinear=void 0;Un.prototype.InterpolantFactoryMethodSmooth=void 0;class zo extends Rt{}zo.prototype.ValueTypeName="color";class $i extends Rt{}$i.prototype.ValueTypeName="number";class $p extends Jt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;c+=4)st.slerpFlat(s,0,a,c-o,a,c,l);return s}}class pi extends Rt{InterpolantFactoryMethodLinear(e){return new $p(this.times,this.values,this.getValueSize(),e)}}pi.prototype.ValueTypeName="quaternion";pi.prototype.DefaultInterpolation=ji;pi.prototype.InterpolantFactoryMethodSmooth=void 0;class Hn extends Rt{}Hn.prototype.ValueTypeName="string";Hn.prototype.ValueBufferType=Array;Hn.prototype.DefaultInterpolation=Zi;Hn.prototype.InterpolantFactoryMethodLinear=void 0;Hn.prototype.InterpolantFactoryMethodSmooth=void 0;class Ki extends Rt{}Ki.prototype.ValueTypeName="vector";class qa{constructor(e,t=-1,n,i=cs){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=At(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(em(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(Rt.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=Ue.getKeyframeOrder(l);l=Ue.sortedArray(l,1,h),c=Ue.sortedArray(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new $i(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,x){if(f.length!==0){const v=[],g=[];Ue.flattenJSON(f,v,g,m),v.length!==0&&x.push(new u(d,v,g))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let x=0;x<d[m].morphTargets.length;x++)f[d[m].morphTargets[x]]=-1;for(const x in f){const v=[],g=[];for(let p=0;p!==d[m].morphTargets.length;++p){const T=d[m];v.push(T.time),g.push(T.morphTarget===x?1:0)}i.push(new $i(".morphTargetInfluence["+x+"]",v,g))}l=f.length*a}else{const f=".bones["+t[u].name+"]";n(Ki,f+".position",d,"pos",i),n(pi,f+".quaternion",d,"rot",i),n(Ki,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Kp(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $i;case"vector":case"vector2":case"vector3":case"vector4":return Ki;case"color":return zo;case"quaternion":return pi;case"bool":case"boolean":return Un;case"string":return Hn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function em(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Kp(r.type);if(r.times===void 0){const t=[],n=[];Ue.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Dn={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class tm{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,s===!1&&i.onStart!==void 0&&i.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null}}}const nm=new tm;class Qt{constructor(e){this.manager=e!==void 0?e:nm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const yt={};class im extends Qt{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Dn.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;if(yt[e]!==void 0){yt[e].push({onLoad:t,onProgress:n,onError:i});return}const o=/^data:(.*?)(;base64)?,(.*)$/,l=e.match(o);let c;if(l){const h=l[1],u=!!l[2];let d=l[3];d=decodeURIComponent(d),u&&(d=atob(d));try{let f;const m=(this.responseType||"").toLowerCase();switch(m){case"arraybuffer":case"blob":const x=new Uint8Array(d.length);for(let g=0;g<d.length;g++)x[g]=d.charCodeAt(g);m==="blob"?f=new Blob([x.buffer],{type:h}):f=x.buffer;break;case"document":f=new DOMParser().parseFromString(d,h);break;case"json":f=JSON.parse(d);break;default:f=d;break}setTimeout(function(){t&&t(f),s.manager.itemEnd(e)},0)}catch(f){setTimeout(function(){i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)},0)}}else{yt[e]=[],yt[e].push({onLoad:t,onProgress:n,onError:i}),c=new XMLHttpRequest,c.open("GET",e,!0),c.addEventListener("load",function(h){const u=this.response,d=yt[e];if(delete yt[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Dn.add(e,u);for(let f=0,m=d.length;f<m;f++){const x=d[f];x.onLoad&&x.onLoad(u)}s.manager.itemEnd(e)}else{for(let f=0,m=d.length;f<m;f++){const x=d[f];x.onError&&x.onError(h)}s.manager.itemError(e),s.manager.itemEnd(e)}},!1),c.addEventListener("progress",function(h){const u=yt[e];for(let d=0,f=u.length;d<f;d++){const m=u[d];m.onProgress&&m.onProgress(h)}},!1),c.addEventListener("error",function(h){const u=yt[e];delete yt[e];for(let d=0,f=u.length;d<f;d++){const m=u[d];m.onError&&m.onError(h)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),c.addEventListener("abort",function(h){const u=yt[e];delete yt[e];for(let d=0,f=u.length;d<f;d++){const m=u[d];m.onError&&m.onError(h)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),this.responseType!==void 0&&(c.responseType=this.responseType),this.withCredentials!==void 0&&(c.withCredentials=this.withCredentials),c.overrideMimeType&&c.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const h in this.requestHeader)c.setRequestHeader(h,this.requestHeader[h]);c.send(null)}return s.manager.itemStart(e),c}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Oo extends Qt{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Dn.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function l(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1),Dn.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class rm extends Qt{constructor(e){super(e)}load(e,t,n,i){const s=new ir,a=new Oo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class sm extends Qt{constructor(e){super(e)}load(e,t,n,i){const s=new et,a=new Oo(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o;const l=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;s.format=l?sn:wt,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class pt{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new X:new b);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new b,i=[],s=[],a=[],o=new b,l=new he;for(let f=0;f<=e;f++){const m=f/e;i[f]=this.getTangentAt(m,new b),i[f].normalize()}s[0]=new b,a[0]=new b;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(ht(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(ht(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class or extends pt{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const n=t||new X,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}or.prototype.isEllipseCurve=!0;class Uo extends or{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.type="ArcCurve"}}Uo.prototype.isArcCurve=!0;function xs(){let r=0,e=0,t=0,n=0;function i(s,a,o,l){r=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,u){let d=(a-s)/c-(o-s)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const Vi=new b,Vr=new xs,kr=new xs,Wr=new xs;class Ho extends pt{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new b){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(Vi.subVectors(i[0],i[1]).add(i[0]),c=Vi);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(Vi.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Vi),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),f),x=Math.pow(u.distanceToSquared(d),f),v=Math.pow(d.distanceToSquared(h),f);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),Vr.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,x,v),kr.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,x,v),Wr.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,x,v)}else this.curveType==="catmullrom"&&(Vr.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),kr.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),Wr.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(Vr.calc(l),kr.calc(l),Wr.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new b().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}Ho.prototype.isCatmullRomCurve3=!0;function Xa(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,l=r*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*r+t}function am(r,e){const t=1-r;return t*t*e}function om(r,e){return 2*(1-r)*r*e}function lm(r,e){return r*r*e}function ri(r,e,t,n){return am(r,e)+om(r,t)+lm(r,n)}function cm(r,e){const t=1-r;return t*t*t*e}function hm(r,e){const t=1-r;return 3*t*t*r*e}function um(r,e){return 3*(1-r)*r*r*e}function dm(r,e){return r*r*r*e}function si(r,e,t,n,i){return cm(r,e)+hm(r,t)+um(r,n)+dm(r,i)}class vs extends pt{constructor(e=new X,t=new X,n=new X,i=new X){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new X){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(si(e,i.x,s.x,a.x,o.x),si(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}vs.prototype.isCubicBezierCurve=!0;class Go extends pt{constructor(e=new b,t=new b,n=new b,i=new b){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new b){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(si(e,i.x,s.x,a.x,o.x),si(e,i.y,s.y,a.y,o.y),si(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Go.prototype.isCubicBezierCurve3=!0;class lr extends pt{constructor(e=new X,t=new X){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new X){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new X;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}lr.prototype.isLineCurve=!0;class fm extends pt{constructor(e=new b,t=new b){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new b){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _s extends pt{constructor(e=new X,t=new X,n=new X){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new X){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(ri(e,i.x,s.x,a.x),ri(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}_s.prototype.isQuadraticBezierCurve=!0;class Vo extends pt{constructor(e=new b,t=new b,n=new b){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new b){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(ri(e,i.x,s.x,a.x),ri(e,i.y,s.y,a.y),ri(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Vo.prototype.isQuadraticBezierCurve3=!0;class ys extends pt{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new X){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(Xa(o,l.x,c.x,h.x,u.x),Xa(o,l.y,c.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new X().fromArray(i))}return this}}ys.prototype.isSplineCurve=!0;var pm=Object.freeze({__proto__:null,ArcCurve:Uo,CatmullRomCurve3:Ho,CubicBezierCurve:vs,CubicBezierCurve3:Go,EllipseCurve:or,LineCurve:lr,LineCurve3:fm,QuadraticBezierCurve:_s,QuadraticBezierCurve3:Vo,SplineCurve:ys});class mm extends pt{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new lr(t,e))}getPoint(e){const t=e*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=t){const s=n[i]-t,a=this.curves[i],o=a.getLength(),l=o===0?0:1-s/o;return a.getPointAt(l)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new pm[i.type]().fromJSON(i))}return this}}class ns extends mm{constructor(e){super(),this.type="Path",this.currentPoint=new X,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new lr(this.currentPoint.clone(),new X(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new _s(this.currentPoint.clone(),new X(e,t),new X(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new vs(this.currentPoint.clone(),new X(e,t),new X(n,i),new X(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new ys(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,i,s,a,o,l),this}absellipse(e,t,n,i,s,a,o,l){const c=new or(e,t,n,i,s,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ms extends ns{constructor(e){super(e),this.uuid=At(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new ns().fromJSON(i))}return this}}class Lt extends Re{constructor(e,t=1){super(),this.type="Light",this.color=new ce(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}Lt.prototype.isLight=!0;class gm extends Lt{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(Re.DefaultUp),this.updateMatrix(),this.groundColor=new ce(t)}copy(e){return Lt.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}gm.prototype.isHemisphereLight=!0;const Ya=new he,Za=new b,ja=new b;class ws{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new X(512,512),this.map=null,this.mapPass=null,this.matrix=new he,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rr,this._frameExtents=new X(1,1),this._viewportCount=1,this._viewports=[new Ie(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Za.setFromMatrixPosition(e.matrixWorld),t.position.copy(Za),ja.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ja),t.updateMatrixWorld(),Ya.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ya),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class ko extends ws{constructor(){super(new ut(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=Qr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}ko.prototype.isSpotLightShadow=!0;class xm extends Lt{constructor(e,t,n=0,i=Math.PI/3,s=0,a=1){super(e,t),this.type="SpotLight",this.position.copy(Re.DefaultUp),this.updateMatrix(),this.target=new Re,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.shadow=new ko}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}xm.prototype.isSpotLight=!0;const Ja=new he,Jn=new b,qr=new b;class Wo extends ws{constructor(){super(new ut(90,1,.5,500)),this._frameExtents=new X(4,2),this._viewportCount=6,this._viewports=[new Ie(2,1,1,1),new Ie(0,1,1,1),new Ie(3,1,1,1),new Ie(1,1,1,1),new Ie(3,0,1,1),new Ie(1,0,1,1)],this._cubeDirections=[new b(1,0,0),new b(-1,0,0),new b(0,0,1),new b(0,0,-1),new b(0,1,0),new b(0,-1,0)],this._cubeUps=[new b(0,1,0),new b(0,1,0),new b(0,1,0),new b(0,1,0),new b(0,0,1),new b(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Jn.setFromMatrixPosition(e.matrixWorld),n.position.copy(Jn),qr.copy(n.position),qr.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(qr),n.updateMatrixWorld(),i.makeTranslation(-Jn.x,-Jn.y,-Jn.z),Ja.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ja)}}Wo.prototype.isPointLightShadow=!0;class vm extends Lt{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Wo}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}vm.prototype.isPointLight=!0;class bs extends ds{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,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,i,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=i,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,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far),this.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}}bs.prototype.isOrthographicCamera=!0;class qo extends ws{constructor(){super(new bs(-5,5,5,-5,.5,500))}}qo.prototype.isDirectionalLightShadow=!0;class _m extends Lt{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(Re.DefaultUp),this.updateMatrix(),this.target=new Re,this.shadow=new qo}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}_m.prototype.isDirectionalLight=!0;class ym extends Lt{constructor(e,t){super(e,t),this.type="AmbientLight"}}ym.prototype.isAmbientLight=!0;class Mm extends Lt{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}Mm.prototype.isRectAreaLight=!0;class Xo{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new b)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}Xo.prototype.isSphericalHarmonics3=!0;class Ss extends Lt{constructor(e=new Xo,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Ss.prototype.isLightProbe=!0;class wm{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}}class bm extends Oe{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}bm.prototype.isInstancedBufferGeometry=!0;class Sm extends je{constructor(e,t,n,i){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=i||1}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}Sm.prototype.isInstancedBufferAttribute=!0;class Em extends Qt{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Dn.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Dn.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}Em.prototype.isImageBitmapLoader=!0;let ki;const Tm={getContext:function(){return ki===void 0&&(ki=new(window.AudioContext||window.webkitAudioContext)),ki},setContext:function(r){ki=r}};class Am extends Qt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new im(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{const l=o.slice(0);Tm.getContext().decodeAudioData(l,function(h){t(h)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class Lm extends Ss{constructor(e,t,n=1){super(void 0,n);const i=new ce().set(e),s=new ce().set(t),a=new b(i.r,i.g,i.b),o=new b(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}Lm.prototype.isHemisphereLightProbe=!0;class Rm extends Ss{constructor(e,t=1){super(void 0,t);const n=new ce().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Rm.prototype.isAmbientLightProbe=!0;class Cm extends Re{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}class Pm{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){st.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;st.multiplyQuaternionsFlat(e,a,e,t,e,n),st.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Es="\\[\\]\\.:\\/",Dm=new RegExp("["+Es+"]","g"),Ts="[^"+Es+"]",Im="[^"+Es.replace("\\.","")+"]",Nm=/((?:WC+[\/:])*)/.source.replace("WC",Ts),Fm=/(WCOD+)?/.source.replace("WCOD",Im),Bm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ts),zm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ts),Om=new RegExp("^"+Nm+Fm+Bm+zm+"$"),Um=["material","materials","bones"];class Hm{constructor(e,t,n){const i=n||De.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class De{constructor(e,t,n){this.path=t,this.parsedPath=n||De.parseTrackName(t),this.node=De.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new De.Composite(e,t,n):new De(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Dm,"")}static parseTrackName(e){const t=Om.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);Um.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.node[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=De.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}De.Composite=Hm;De.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};De.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};De.prototype.GetterByBindingType=[De.prototype._getValue_direct,De.prototype._getValue_array,De.prototype._getValue_arrayElement,De.prototype._getValue_toArray];De.prototype.SetterByBindingTypeAndVersioning=[[De.prototype._setValue_direct,De.prototype._setValue_direct_setNeedsUpdate,De.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[De.prototype._setValue_array,De.prototype._setValue_array_setNeedsUpdate,De.prototype._setValue_array_setMatrixWorldNeedsUpdate],[De.prototype._setValue_arrayElement,De.prototype._setValue_arrayElement_setNeedsUpdate,De.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[De.prototype._setValue_fromArray,De.prototype._setValue_fromArray_setNeedsUpdate,De.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Gm{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:An,endingEnd:An};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=yc,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case ro:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case cs:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Mc;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===_c){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ln,i.endingEnd=Ln):(e?i.endingStart=this.zeroSlopeAtStart?Ln:An:i.endingStart=Ji,t?i.endingEnd=this.zeroSlopeAtEnd?Ln:An:i.endingEnd=Ji)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}class Vm extends on{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const x=t&&t._propertyBindings[u].binding.parsedPath;m=new Pm(De.create(n,f,x),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Bo(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?qa.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=cs),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new Gm(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?qa.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}Vm.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class km extends ln{constructor(e,t,n=1){super(e,t),this.meshPerAttribute=n||1}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}km.prototype.isInstancedInterleavedBuffer=!0;class Wm extends Re{constructor(e){super(),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Wm.prototype.isImmediateRenderObject=!0;const Wt=new b,Wi=new he,Xr=new he;class qm extends gs{constructor(e){const t=Yo(e),n=new Oe,i=[],s=[],a=new ce(0,0,1),o=new ce(0,1,0);for(let c=0;c<t.length;c++){const h=t[c];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}n.setAttribute("position",new Je(i,3)),n.setAttribute("color",new Je(s,3));const l=new fi({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Xr.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Wi.multiplyMatrices(Xr,o.matrixWorld),Wt.setFromMatrixPosition(Wi),i.setXYZ(a,Wt.x,Wt.y,Wt.z),Wi.multiplyMatrices(Xr,o.parent.matrixWorld),Wt.setFromMatrixPosition(Wi),i.setXYZ(a+1,Wt.x,Wt.y,Wt.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function Yo(r){const e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,Yo(r.children[t]));return e}class Xm extends gs{constructor(e=10,t=10,n=4473924,i=8947848){n=new ce(n),i=new ce(i);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=t;d++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const x=d===s?n:i;x.toArray(c,f),f+=3,x.toArray(c,f),f+=3,x.toArray(c,f),f+=3,x.toArray(c,f),f+=3}const h=new Oe;h.setAttribute("position",new Je(l,3)),h.setAttribute("color",new Je(c,3));const u=new fi({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}}const Ym=new Float32Array(1);new Int32Array(Ym.buffer);const Zm=new hs({side:Ze,depthWrite:!1,depthTest:!1});new ft(new us,Zm);pt.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(pt.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};ns.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};Xm.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};qm.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Qt.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),wm.extractUrlBase(r)};Qt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};mt.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)};mt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};mt.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};mt.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};mt.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)};Fn.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};rr.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)};Ke.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Ke.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Ke.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Ke.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Ke.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Ke.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};he.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)};he.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};he.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new b().setFromMatrixColumn(this,3)};he.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)};he.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};he.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};he.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};he.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};he.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)};he.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};he.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};he.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};he.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};he.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};he.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};he.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};he.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};he.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)};he.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Et.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};st.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};st.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Bn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Bn.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)};Bn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};Xe.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Xe.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)};Xe.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)};Xe.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)};Xe.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)};Xe.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Xe.getBarycoord(r,e,t,n,i)};Xe.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Xe.getNormal(r,e,t,n)};Ms.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)};Ms.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ar(this,r)};Ms.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Up(this,r)};X.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};X.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};X.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};b.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};b.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};b.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)};b.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)};b.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)};b.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)};b.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};b.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};b.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ie.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};Ie.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Re.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)};Re.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Re.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)};Re.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Re.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Re.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});ft.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(ft.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),wc},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Co.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};ut.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(Lt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(je.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Qi},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Qi)}}});je.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Qi:oi),this};je.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},je.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Oe.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)};Oe.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new je(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)};Oe.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)};Oe.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Oe.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Oe.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)};Oe.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Oe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});ln.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Qi:oi),this};ln.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};ar.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};ar.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};ar.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};ps.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Object.defineProperties(Qe.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new ce}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===eo}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}}});Object.defineProperties(Zt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});Ne.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)};Ne.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)};Ne.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ne.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ne.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ne.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ne.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ne.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ne.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ne.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ne.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ne.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ne.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ne.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ne.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)};Ne.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ne.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ne.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ne.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ne.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ne.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ne.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ne.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ne.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ne.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ne.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?so:di}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(To.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(an.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});Cm.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new Am().load(r,function(n){e.setBuffer(n)}),this};fs.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)};fs.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)};Nn.crossOrigin=void 0;Nn.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new sm;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Nn.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new rm;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Nn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Nn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:$a}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=$a);const jm=`
|
|
2832
|
+
varying vec2 vUv;
|
|
2833
|
+
void main() {
|
|
2834
|
+
vUv = uv;
|
|
2835
|
+
gl_Position = vec4(position, 1.0);
|
|
2836
|
+
}
|
|
2837
|
+
`,Jm=`
|
|
2838
|
+
uniform float uTime;
|
|
2839
|
+
uniform vec2 uResolution;
|
|
2840
|
+
uniform vec2 uMouse;
|
|
2841
|
+
uniform float uGridScale;
|
|
2842
|
+
uniform float uMouseAmount;
|
|
2843
|
+
uniform float uPulseSpeed;
|
|
2844
|
+
uniform float uRadius;
|
|
2845
|
+
uniform float uOpacity;
|
|
2846
|
+
varying vec2 vUv;
|
|
2847
|
+
void main() {
|
|
2848
|
+
vec2 uv = gl_FragCoord.xy / uResolution.xy;
|
|
2849
|
+
float aspect = uResolution.x / uResolution.y;
|
|
2850
|
+
uv.x *= aspect;
|
|
2851
|
+
uv += uMouse * uMouseAmount;
|
|
2852
|
+
vec2 grid = fract(uv * uGridScale);
|
|
2853
|
+
vec2 id = floor(uv * uGridScale);
|
|
2854
|
+
float dist = length(grid - vec2(0.5));
|
|
2855
|
+
float pulse = sin(uTime * uPulseSpeed + id.x * 0.05 + id.y * 0.05) * 0.5 + 0.5;
|
|
2856
|
+
float radius = 0.08 + pulse * uRadius;
|
|
2857
|
+
float alpha = smoothstep(radius, radius - 0.05, dist);
|
|
2858
|
+
vec2 center = vec2(0.5 * aspect, 0.5);
|
|
2859
|
+
float depthFade = smoothstep(1.2, 0.1, length(uv - center));
|
|
2860
|
+
vec3 color = vec3(0.0, 0.9, 1.0) * pulse;
|
|
2861
|
+
gl_FragColor = vec4(color, alpha * depthFade * uOpacity);
|
|
2862
|
+
}
|
|
2863
|
+
`,Qa={speed:1,gridScale:60,mouseAmount:.04,pulseSpeed:.4,radius:.15,opacity:.35,hue:0};function Qm({className:r="",...e}){const t=mi.useRef(null),n=mi.useRef(null),i=mi.useRef({...Qa,...e});return i.current={...Qa,...e},mi.useEffect(()=>{const s=t.current,a=n.current;if(!s||!a)return;const o=new Ne({canvas:a,antialias:!0,alpha:!0});o.setPixelRatio(Math.min(window.devicePixelRatio,2));const l=new ps,c=new bs(-1,1,1,-1,.1,10);c.position.z=1;const h={uTime:{value:0},uResolution:{value:new X},uMouse:{value:new X},uGridScale:{value:60},uMouseAmount:{value:.04},uPulseSpeed:{value:.4},uRadius:{value:.15},uOpacity:{value:.35}},u=new po(2,2),d=new Zt({uniforms:h,vertexShader:jm,fragmentShader:Jm,transparent:!0,depthWrite:!1});l.add(new ft(u,d));let f=new X,m=new X,x=0,v=!0,g=performance.now();const p=C=>{const N=a.getBoundingClientRect();m.x=(C.clientX-N.left)/Math.max(1,N.width)*2-1,m.y=-((C.clientY-N.top)/Math.max(1,N.height)*2-1)},T=()=>{const C=s.getBoundingClientRect();o.setSize(C.width,C.height,!1),h.uResolution.value.set(C.width,C.height)},R=C=>{const N=i.current;f.lerp(m,.05),h.uTime.value=(C-g)*.001*N.speed,h.uMouse.value=f,h.uGridScale.value=N.gridScale,h.uMouseAmount.value=N.mouseAmount,h.uPulseSpeed.value=N.pulseSpeed,h.uRadius.value=N.radius,h.uOpacity.value=N.opacity,o.render(l,c),x=v&&!document.hidden?requestAnimationFrame(R):0},E=new ResizeObserver(T),_=new IntersectionObserver(([C])=>{v=(C==null?void 0:C.isIntersecting)??!0,v&&!x&&(x=requestAnimationFrame(R)),!v&&x&&(cancelAnimationFrame(x),x=0)});return E.observe(s),_.observe(s),a.addEventListener("pointermove",p,{passive:!0}),T(),x=requestAnimationFrame(R),()=>{x&&cancelAnimationFrame(x),E.disconnect(),_.disconnect(),a.removeEventListener("pointermove",p),u.dispose(),d.dispose(),o.dispose()}},[]),Yr.jsx("div",{ref:t,className:`threeui-background dot-matrix${r?` ${r}`:""}`,children:Yr.jsx("canvas",{ref:n,style:{filter:`hue-rotate(${i.current.hue}deg)`}})})}function eg(){return Yr.jsx(Qm,{className:"h-full w-full",opacity:.3,speed:.8,gridScale:52,mouseAmount:0,hue:225})}export{eg as default};
|